From 0d00798f6bdd098dbb59c6f1da5be5efd6c283fa Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 24 Mar 2009 11:07:00 +1000 Subject: Squashed commit of the following: commit 39de3862f5678b3226b4932eeb342c4a023d2f2b Author: Ian Walters Date: Thu Feb 19 14:16:05 2009 +1000 Fixes: Test runs (and passes), doc links. Task: QT-308 Details: Minor changes related to the code having moved. commit 5a8910dd1018fb228d0e2e2819ea429577bfa834 Author: Ian Walters Date: Thu Feb 19 09:47:20 2009 +1000 Fixes: Checkin of QOffsetVector stuff for branch Task: QT-308 Details: Files originally from research/qcircularbuffer This checkin likely won't compile. Just a copy for now. --- doc/src/examples/offsetvector.qdoc | 70 +++++ examples/tools/offsetvector/main.cpp | 15 + examples/tools/offsetvector/offsetvector.pro | 9 + examples/tools/offsetvector/randomlistmodel.cpp | 56 ++++ examples/tools/offsetvector/randomlistmodel.h | 26 ++ examples/tools/tools.pro | 1 + src/corelib/tools/qoffsetvector.cpp | 360 ++++++++++++++++++++++ src/corelib/tools/qoffsetvector.h | 386 ++++++++++++++++++++++++ src/corelib/tools/tools.pri | 2 + tests/auto/auto.pro | 1 + tests/auto/qoffsetvector/qoffsetvector.pro | 8 + tests/auto/qoffsetvector/tst_qoffsetvector.cpp | 361 ++++++++++++++++++++++ 12 files changed, 1295 insertions(+) create mode 100644 doc/src/examples/offsetvector.qdoc create mode 100644 examples/tools/offsetvector/main.cpp create mode 100644 examples/tools/offsetvector/offsetvector.pro create mode 100644 examples/tools/offsetvector/randomlistmodel.cpp create mode 100644 examples/tools/offsetvector/randomlistmodel.h create mode 100644 src/corelib/tools/qoffsetvector.cpp create mode 100644 src/corelib/tools/qoffsetvector.h create mode 100644 tests/auto/qoffsetvector/qoffsetvector.pro create mode 100644 tests/auto/qoffsetvector/tst_qoffsetvector.cpp diff --git a/doc/src/examples/offsetvector.qdoc b/doc/src/examples/offsetvector.qdoc new file mode 100644 index 0000000..256569e --- /dev/null +++ b/doc/src/examples/offsetvector.qdoc @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/*! + \example tools/offsetvector + \title Offset Vector Example + + The Offset Vector example shows how to use QOffsetVector to manage memory usage for + very large models. In some environments memory is limited, and even when it + isn't users still dislike an application using + excessive memory. Using QOffsetVector to manage a list rather than loading + the entire list into memory allows the application to limit the amount + of memory it uses regardless of the size of the data set it accesses + + The simplest way to use QOffsetVector is to cache as items are requested. When + a view requests an item at row N it is also likely to ask for items at rows near + to N. + + \snippet examples/tools/offsetvector/randomlistmodel.cpp 0 + + After getting the row the class determines if the row is in the bounds + of the offset vector's current range. It would have been equally valid to + simply have the following code instead. + + \code + while (row > m_words.lastIndex()) + m_words.append(fetchWord(m_words.lastIndex()+1); + while (row < m_words.firstIndex()) + m_words.prepend(fetchWord(m_words.firstIndex()-1); + \endcode + + However a list will often jump rows if the scroll bar is used directly, and + the above code would cause every row between where the cache was last centered + to where the cache is currently centered to be cached before the requested + row is reached. + + Using QOffsetVector::lastIndex() and QOffsetVector::firstIndex() allows + the example to determine where the list the vector is currently over. These values + don't represent the indexes into the vector own memory, but rather a virtual + infinite array that the vector represents. + + By using QOffsetVector::append() and QOffsetVector::prepend() the code ensures + that items that may be still on the screen are not lost when the requested row + has not moved far from the current vector range. QOffsetVector::insert() can + potentially remove more than one item from the cache as QOffsetVector does not + allow for gaps. If your cache needs to quickly jump back and forth between + rows with significant gaps between them consider using QCache instead. + + And thats it. A perfectly reasonable cache, using minimal memory for a very large + list. In this case the accessor for getting the words into cache: + + \snippet examples/tools/offsetvector/randomlistmodel.cpp 1 + + Generates random information rather than fixed information. This allows you + to see how the cache range is kept for a local number of rows when running the + example. + + It is also worth considering pre-fetching items into the cache outside of the + applications paint routine. This can be done either with a separate thread + or using a QTimer to incrementally expand the range of the thread prior to + rows being requested out of the current vector range. +*/ diff --git a/examples/tools/offsetvector/main.cpp b/examples/tools/offsetvector/main.cpp new file mode 100644 index 0000000..bdeb3f3 --- /dev/null +++ b/examples/tools/offsetvector/main.cpp @@ -0,0 +1,15 @@ +#include "randomlistmodel.h" +#include +#include + +int main(int c, char **v) +{ + QApplication a(c, v); + + QListView view; + view.setUniformItemSizes(true); + view.setModel(new RandomListModel(&view)); + view.show(); + + return a.exec(); +} diff --git a/examples/tools/offsetvector/offsetvector.pro b/examples/tools/offsetvector/offsetvector.pro new file mode 100644 index 0000000..f329bb9 --- /dev/null +++ b/examples/tools/offsetvector/offsetvector.pro @@ -0,0 +1,9 @@ +HEADERS = randomlistmodel.h +SOURCES = randomlistmodel.cpp \ + main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tools/offsetvector +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS offsetvector.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tools/offsetvector +INSTALLS += target sources diff --git a/examples/tools/offsetvector/randomlistmodel.cpp b/examples/tools/offsetvector/randomlistmodel.cpp new file mode 100644 index 0000000..5c0953b --- /dev/null +++ b/examples/tools/offsetvector/randomlistmodel.cpp @@ -0,0 +1,56 @@ +#include "randomlistmodel.h" + +static const int bufferSize(500); +static const int lookAhead(100); +static const int halfLookAhead(lookAhead/2); + +RandomListModel::RandomListModel(QObject *parent) +: QAbstractListModel(parent), m_rows(bufferSize), m_count(10000) +{ +} + +RandomListModel::~RandomListModel() +{ +} + +int RandomListModel::rowCount(const QModelIndex &) const +{ + return m_count; +} + +//! [0] +QVariant RandomListModel::data(const QModelIndex &index, int role) const +{ + if (role != Qt::DisplayRole) + return QVariant(); + + int row = index.row(); + + if (row > m_rows.lastIndex()) { + if (row - m_rows.lastIndex() > lookAhead) + cacheRows(row-halfLookAhead, qMin(m_count, row+halfLookAhead)); + else while (row > m_rows.lastIndex()) + m_rows.append(fetchRow(m_rows.lastIndex()+1)); + } else if (row < m_rows.firstIndex()) { + if (m_rows.firstIndex() - row > lookAhead) + cacheRows(qMax(0, row-halfLookAhead), row+halfLookAhead); + else while (row < m_rows.firstIndex()) + m_rows.prepend(fetchRow(m_rows.firstIndex()-1)); + } + + return m_rows.at(row); +} + +void RandomListModel::cacheRows(int from, int to) const +{ + for (int i = from; i <= to; ++i) + m_rows.insert(i, fetchRow(i)); +} +//![0] + +//![1] +QString RandomListModel::fetchRow(int position) const +{ + return QString::number(rand() % ++position); +} +//![1] diff --git a/examples/tools/offsetvector/randomlistmodel.h b/examples/tools/offsetvector/randomlistmodel.h new file mode 100644 index 0000000..e102255 --- /dev/null +++ b/examples/tools/offsetvector/randomlistmodel.h @@ -0,0 +1,26 @@ +#ifndef RANDOMLISTMODEL_H +#define RANDOMLISTMODEL_H + +#include +#include + +class QTimer; +class RandomListModel : public QAbstractListModel +{ + Q_OBJECT +public: + RandomListModel(QObject *parent = 0); + ~RandomListModel(); + + int rowCount(const QModelIndex & = QModelIndex()) const; + QVariant data(const QModelIndex &, int) const; + +private: + void cacheRows(int, int) const; + QString fetchRow(int) const; + + mutable QOffsetVector m_rows; + const int m_count; +}; + +#endif diff --git a/examples/tools/tools.pro b/examples/tools/tools.pro index 79f0faa..424f286 100644 --- a/examples/tools/tools.pro +++ b/examples/tools/tools.pro @@ -5,6 +5,7 @@ SUBDIRS = codecs \ customcompleter \ echoplugin \ i18n \ + offsetvector \ plugandpaintplugins \ plugandpaint \ regexp \ diff --git a/src/corelib/tools/qoffsetvector.cpp b/src/corelib/tools/qoffsetvector.cpp new file mode 100644 index 0000000..32d2872 --- /dev/null +++ b/src/corelib/tools/qoffsetvector.cpp @@ -0,0 +1,360 @@ +/**************************************************************************** +** +** 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 "qoffsetvector.h" +#include + +void QOffsetVectorData::dump() const +{ + qDebug() << "capacity:" << alloc; + qDebug() << "count:" << count; + qDebug() << "start:" << start; + qDebug() << "offset:" << offset; +} + +/*! \class QOffsetVector + \brief The QOffsetVector class is a template class that provides a offset vector. + \ingroup tools + \ingroup shared + \reentrant + + The QOffsetVector class provides an efficient way of caching items for + display in a user interface view. It does this by providing a window + into a theoretical infinite sized vector. This has the advantage that + it matches how user interface views most commonly request the data, in + a set of rows localized around the current scrolled position. It also + allows the cache to use less overhead than QCache both in terms of + performance and memory. In turn, unlike a QCache, the key has to be + an int and has to be contiguous. That is to say if an item is inserted + at index 85, then if there were no previous items at 84 or 86 then the + cache will be cleared before the new item at 85 is inserted. If this + restriction is not suitable consider using QCache instead. + + The simplest way of using an offset vector is to use the append() + and prepend() functions to slide the window to where it is needed. + +\code +MyRecord record(int row) const +{ + Q_ASSERT(row >= 0 && row < count()); + + while(row > cache.lastIndex()) + cache.append(slowFetchRecord(cache.lastIndex()+1)); + while(row < cache.firstIndex()) + cache.prepend(slowFetchRecord(cache.firstIndex()-1)); + + return cache.at(row); +} +\endcode + + The append() and prepend() functions cause the vector window to move to + where the current row is requested from. This usage can be further + optimized by using the insert() function to reset the vector window to + a row in the case where the row is a long way from the current row. It + may also be worth while to fetch multiple records into the cache if + it is faster to retrieve them in a batch operation. + + See the The \l{Offset Vector Example}{Offset Vector} example. +*/ + +/*! \fn QOffsetVector::QOffsetVector(int capacity) + + Constructs a vector with the given \a capacity. + + \sa setCapacity() +*/ + +/*! \fn QOffsetVector::QOffsetVector(const QOffsetVector &other) + + Constructs a copy of \a other. + + This operation takes \l{constant time}, because QOffsetVector is + \l{implicitly shared}. This makes returning a QOffsetVector from a + function very fast. If a shared instance is modified, it will be + copied (copy-on-write), and that takes \l{linear time}. + + \sa operator=() +*/ + +/*! \fn QOffsetVector::~QOffsetVector() + Destorys the vector. +*/ + +/*! \fn void QOffsetVector::detach() + + \internal +*/ + +/*! \fn bool QOffsetVector::isDetached() const + + \internal +*/ + +/*! \fn void QOffsetVector::setSharable(bool sharable) + + \internal +*/ + + +/*! \fn QOffsetVector &QOffsetVector::operator=(const QOffsetVector &other) + + Assigns \a other to this vector and returns a reference to this vector. +*/ + +/*! \fn bool QOffsetVector::operator==(const QOffsetVector &other) const + + Returns true if \a other is equal to this vector; otherwise returns false. + + Two vectors are considered equal if they contain the same values at the same + indexes. This function requires the value type to implement the \c operator==(). + + \sa operator!=() +*/ + +/*! \fn bool QOffsetVector::operator!=(const QOffsetVector &other) const + + Returns true if \a other is not equal to this vector; otherwise + returns false. + + Two vector are considered equal if they contain the same values at the same + indexes. This function requires the value type to implement the \c operator==(). + + \sa operator==() +*/ + +/*! \fn int QOffsetVector::capacity() const + + Returns the number of items the vector can store before it is full. + When a vector contains a number of items equal to its capacity, adding new + items will cause items furthest from the added item to be removed. + + \sa setCapacity(), size() +*/ + +/*! \fn int QOffsetVector::count() const + + \overload + + Same as size(). +*/ + +/*! \fn int QOffsetVector::size() const + + Returns the number of items contained within the vector. + + \sa capacity() +*/ + +/*! \fn bool QOffsetVector::isEmpty() const + + Returns true if no items are stored within the vector. + + \sa size(), capacity() +*/ + +/*! \fn bool QOffsetVector::isFull() const + + Returns true if the number of items stored within the vector is equal + to the capacity of the vector. + + \sa size(), capacity() +*/ + +/*! \fn int QOffsetVector::available() const + + Returns the number of items that can be added to the vector before it becomes full. + + \sa size(), capacity(), isFull() +*/ + +/*! \fn void QOffsetVector::clear() + + Removes all items from the vector. The capacity is unchanged. +*/ + +/*! \fn void QOffsetVector::setCapacity(int size) + + Sets the capacity of the vector to the given \a size. A vector can hold a + number of items equal to its capacity. When inserting, appending or prepending + items to the vector, if the vector is already full then the item furthest from + the added item will be removed. + + If the given \a size is smaller than the current count of items in the vector + then only the last \a size items from the vector will remain. + + \sa capacity(), isFull() +*/ + +/*! \fn const T &QOffsetVector::at(int i) const + + Returns the item at index position \a i in the vector. \a i must + be a valid index position in the vector (i.e, firstIndex() <= \a i <= lastIndex()). + + The indexes in the vector refer to number of positions the item is from the + first item appended into the vector. That is to say a vector with a capacity of + 100, that has had 150 items appended will have a valid index range of + 50 to 149. This allows inserting an retrieving items into the vector based + on a theoretical infinite list + + \sa firstIndex(), lastIndex(), insert(), operator[]() +*/ + +/*! \fn T &QOffsetVector::operator[](int i) + + Returns the item at index position \a i as a modifiable reference. If + the vector does not contain an item at the given index position \a i + then it will first insert an empty item at that position. + + In most cases it is better to use either at() or insert(). + + Note that using non-const operators can cause QOffsetVector to do a deep + copy. + + \sa insert(), at() +*/ + +/*! \fn const T &QOffsetVector::operator[](int i) const + + \overload + + Same as at(\a i). +*/ + +/*! \fn void QOffsetVector::append(const T &value) + + Inserts \a value at the end of the vector. If the vector is already full + the item at the start of the vector will be removed. + + \sa prepend(), insert(), isFull() +*/ + +/*! \fn void QOffsetVector::prepend(const T &value) + + Inserts \a value at the start of the vector. If the vector is already full + the item at the end of the vector will be removed. + + \sa append(), insert(), isFull() +*/ + +/*! \fn void QOffsetVector::insert(int i, const T &value) + + Inserts the \a value at the index position \a i. If the vector already contains + an item at \a i then that value is replaced. If \a i is either one more than + lastIndex() or one less than firstIndex() it is the equivalent to an append() + or a prepend(). + + If the given index \a i is not within the current range of the vector nor adjacent + to the bounds of the vector's index range the vector is first cleared before + inserting the item. At this point the vector will have a size of 1. It is worth + while then taking effort to insert items in an order than starts adjacent to the + current index range for the vector. + + \sa prepend(), append(), isFull(), firstIndex(), lastIndex() +*/ + +/*! \fn bool QOffsetVector::containsIndex(int i) const + + Returns true if the vector's index range includes the given index \a i. + + \sa firstIndex(), lastIndex() +*/ + +/*! \fn int QOffsetVector::firstIndex() const + Returns the first valid index in the vector. The index will be invalid if the + vector is empty. However the following code is valid even when the vector is empty: + + \code + for (int i = vector.firstIndex(); i <= vector.lastIndex(); ++i) + qDebug() << "Item" << i << "of the vector is" << vector.at(i); + \endcode + + \sa capacity(), size(), lastIndex() +*/ + +/*! \fn int QOffsetVector::lastIndex() const + + Returns the last valid index in the vector. If the vector is empty will return -1. + + \code + for (int i = vector.firstIndex(); i <= vector.lastIndex(); ++i) + qDebug() << "Item" << i << "of the vector is" << vector.at(i); + \endcode + + \sa capacity(), size(), firstIndex() +*/ + + +/*! \fn T &QOffsetVector::first() + + Returns a reference to the first item in the vector. This function + assumes that the vector isn't empty. + + \sa last(), isEmpty() +*/ + +/*! \fn T &QOffsetVector::last() + + Returns a reference to the last item in the vector. This function + assumes that the vector isn't empty. + + \sa first(), isEmpty() +*/ + +/*! \fn const T& QOffsetVector::first() const + + \overload +*/ + +/*! \fn const T& QOffsetVector::last() const + + \overload +*/ + +/*! \fn void QOffsetVector::removeFirst() + + Removes the first item from the vector. This function assumes that + the vector isn't empty. + + \sa removeLast() +*/ + +/*! \fn void QOffsetVector::removeLast() + + Removes the last item from the vector. This function assumes that + the vector isn't empty. + + \sa removeFirst() +*/ + +/*! \fn T QOffsetVector::takeFirst() + + Removes the first item in the vector and returns it. + + If you don't sue the return value, removeFirst() is more efficient. + + \sa takeLast(), removeFirst() +*/ + +/*! \fn T QOffsetVector::takeLast() + + Removes the last item in the vector and returns it. + + If you don't sue the return value, removeLast() is more efficient. + + \sa takeFirst(), removeLast() +*/ + +/*! \fn void QOffsetVector::dump() const + + \internal + + Sends information about the vector's internal structure to qDebug() +*/ diff --git a/src/corelib/tools/qoffsetvector.h b/src/corelib/tools/qoffsetvector.h new file mode 100644 index 0000000..7030862 --- /dev/null +++ b/src/corelib/tools/qoffsetvector.h @@ -0,0 +1,386 @@ +/**************************************************************************** +** +** 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 QCIRCULARBUFFER_H +#define QCIRCULARBUFFER_H + +#include + +struct QOffsetVectorData +{ + QBasicAtomicInt ref; + int alloc; + int count; + int start; + int offset; + uint sharable : 1; + + void dump() const; +}; + +template +struct QOffsetVectorTypedData +{ + QBasicAtomicInt ref; + int alloc; + int count; + int start; + int offset; + uint sharable : 1; + + T array[1]; +}; + +class QOffsetVectorDevice; + +template +class QOffsetVector { + typedef QOffsetVectorTypedData Data; + union { QOffsetVectorData *p; QOffsetVectorTypedData *d; }; +public: + explicit QOffsetVector(int capacity = 0); + QOffsetVector(const QOffsetVector &v) : d(v.d) { d->ref.ref(); if (!d->sharable) detach_helper(); } + + inline ~QOffsetVector() { if (!d) return; if (!d->ref.deref()) free(d); } + + inline void detach() { if (d->ref != 1) detach_helper(); } + inline bool isDetached() const { return d->ref == 1; } + inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + + QOffsetVector &operator=(const QOffsetVector &other); + bool operator==(const QOffsetVector &other) const; + inline bool operator!=(const QOffsetVector &other) const { return !(*this == other); } + + inline int capacity() const {return d->alloc; } + inline int count() const { return d->count; } + inline int size() const { return d->count; } + + inline bool isEmpty() const { return d->count == 0; } + inline bool isFull() const { return d->count == d->alloc; } + inline int available() const { return d->alloc - d->count; } + + void clear(); + void setCapacity(int size); + + const T &at(int pos) const; + T &operator[](int i); + const T &operator[](int i) const; + + void append(const T &value); + void prepend(const T &value); + void insert(int pos, const T &value); + + inline bool containsIndex(int pos) const { return pos >= d->offset && pos - d->offset < d->count; } + inline int firstIndex() const { return d->offset; } + inline int lastIndex() const { return d->offset + d->count - 1; } + + inline const T &first() const { Q_ASSERT(!isEmpty()); return d->array[d->start]; } + inline const T &last() const { Q_ASSERT(!isEmpty()); return d->array[(d->start + d->count -1) % d->alloc]; } + inline T &first() { Q_ASSERT(!isEmpty()); detach(); return d->array[d->start]; } + inline T &last() { Q_ASSERT(!isEmpty()); detach(); return d->array[(d->start + d->count -1) % d->alloc]; } + + void removeFirst(); + T takeFirst(); + void removeLast(); + T takeLast(); + + // debug + void dump() const { p->dump(); } +private: + void detach_helper(); + + QOffsetVectorData *malloc(int alloc); + void free(Data *d); + int sizeOfTypedData() { + // this is more or less the same as sizeof(Data), except that it doesn't + // count the padding at the end + return reinterpret_cast(&(reinterpret_cast(this))->array[1]) - reinterpret_cast(this); + } +}; + +template +void QOffsetVector::detach_helper() +{ + union { QOffsetVectorData *p; QOffsetVectorTypedData *d; } x; + + x.p = malloc(d->alloc); + x.d->ref = 1; + x.d->count = d->count; + x.d->start = d->start; + x.d->offset = d->offset; + x.d->alloc = d->alloc; + x.d->sharable = true; + + T *dest = x.d->array + x.d->start; + T *src = d->array + d->start; + int count = x.d->count; + while (count--) { + if (QTypeInfo::isComplex) { + new (dest) T(*src); + } else { + *dest = *src; + } + dest++; + if (dest == x.d->array + x.d->alloc) + dest = x.d->array; + src++; + if (src == d->array + d->alloc) + src = d->array; + } + + if (!d->ref.deref()) + free(d); + d = x.d; +} + +template +void QOffsetVector::setCapacity(int asize) +{ + if (asize == d->alloc) + return; + detach(); + union { QOffsetVectorData *p; QOffsetVectorTypedData *d; } x; + x.p = malloc(asize); + x.d->alloc = asize; + x.d->count = qMin(d->count, asize); + x.d->offset = d->offset + d->count - x.d->count; + x.d->start = x.d->offset % x.d->alloc; + /* deep copy - + slow way now, get unit test working, then + improve performance if need be. (e.g. memcpy) + */ + T *dest = x.d->array + (x.d->start + x.d->count-1) % x.d->alloc; + T *src = d->array + (d->start + d->count-1) % d->alloc; + int count = x.d->count; + while (count--) { + if (QTypeInfo::isComplex) { + new (dest) T(*src); + } else { + *dest = *src; + } + if (dest == x.d->array) + dest = x.d->array + x.d->alloc; + dest--; + if (src == d->array) + src = d->array + d->alloc; + src--; + } + /* free old */ + free(d); + d = x.d; +} + +template +void QOffsetVector::clear() +{ + if (d->ref == 1) { + if (QTypeInfo::isComplex) { + int count = d->count; + T * i = d->array + d->start; + T * e = d->array + d->alloc; + while (count--) { + i->~T(); + i++; + if (i == e) + i = d->array; + } + } + d->count = d->start = d->offset = 0; + } else { + union { QOffsetVectorData *p; QOffsetVectorTypedData *d; } x; + x.p = malloc(d->alloc); + x.d->ref = 1; + x.d->alloc = d->alloc; + x.d->count = x.d->start = x.d->offset = 0; + x.d->sharable = true; + if (!d->ref.deref()) free(d); + d = x.d; + } +} + +template +inline QOffsetVectorData *QOffsetVector::malloc(int aalloc) +{ + return static_cast(qMalloc(sizeOfTypedData() + (aalloc - 1) * sizeof(T))); +} + +template +QOffsetVector::QOffsetVector(int asize) +{ + p = malloc(asize); + d->ref = 1; + d->alloc = asize; + d->count = d->start = d->offset = 0; + d->sharable = true; +} + +template +QOffsetVector &QOffsetVector::operator=(const QOffsetVector &other) +{ + other.d->ref.ref(); + if (!d->ref.deref()) + free(d); + d = other.d; + if (!d->sharable) + detach_helper(); + return *this; +} + +template +bool QOffsetVector::operator==(const QOffsetVector &other) const +{ + if (other.d == d) + return true; + if (other.d->start != d->start + || other.d->count != d->count + || other.d->offset != d->offset + || other.d->alloc != d->alloc) + return false; + for (int i = firstIndex(); i <= lastIndex(); ++i) + if (!(at(i) == other.at(i))) + return false; + return true; +} + +template +void QOffsetVector::free(Data *x) +{ + if (QTypeInfo::isComplex) { + int count = d->count; + T * i = d->array + d->start; + T * e = d->array + d->alloc; + while (count--) { + i->~T(); + i++; + if (i == e) + i = d->array; + } + } + qFree(x); +} + +template +void QOffsetVector::append(const T &value) +{ + detach(); + if (QTypeInfo::isComplex) { + if (d->count == d->alloc) + (d->array + (d->start+d->count) % d->alloc)->~T(); + new (d->array + (d->start+d->count) % d->alloc) T(value); + } else { + d->array[(d->start+d->count) % d->alloc] = value; + } + + if (d->count == d->alloc) { + d->start++; + d->start %= d->alloc; + d->offset++; + } else { + d->count++; + } +} + +template +void QOffsetVector::prepend(const T &value) +{ + detach(); + if (d->start) + d->start--; + else + d->start = d->alloc-1; + d->offset--; + + if (d->count != d->alloc) + d->count++; + else + if (d->count == d->alloc) + (d->array + d->start)->~T(); + + if (QTypeInfo::isComplex) + new (d->array + d->start) T(value); + else + d->array[d->start] = value; +} + +template +void QOffsetVector::insert(int pos, const T &value) +{ + detach(); + if (containsIndex(pos)) { + if(QTypeInfo::isComplex) + new (d->array + pos % d->alloc) T(value); + else + d->array[pos % d->alloc] = value; + } else if (pos == d->offset-1) + prepend(value); + else if (pos == d->offset+d->count) + append(value); + else { + // we don't leave gaps. + clear(); + d->offset = d->start = pos; + d->start %= d->alloc; + d->count = 1; + if (QTypeInfo::isComplex) + new (d->array + d->start) T(value); + else + d->array[d->start] = value; + } +} + +template +inline const T &QOffsetVector::at(int pos) const +{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QOffsetVector::at", "index out of range"); return d->array[pos % d->alloc]; } +template +inline const T &QOffsetVector::operator[](int pos) const +{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QOffsetVector::at", "index out of range"); return d->array[pos % d->alloc]; } +template + +// can use the non-inline one to modify the index range. +inline T &QOffsetVector::operator[](int pos) +{ + detach(); + if (!containsIndex(pos)) + insert(pos, T()); + return d->array[pos % d->alloc]; +} + +template +inline void QOffsetVector::removeFirst() +{ + Q_ASSERT(d->count > 0); + detach(); + d->count--; + if (QTypeInfo::isComplex) + (d->array + d->start)->~T(); + d->start = (d->start + 1) % d->alloc; + d->offset++; +} + +template +inline void QOffsetVector::removeLast() +{ + Q_ASSERT(d->count > 0); + detach(); + d->count--; + if (QTypeInfo::isComplex) + (d->array + (d->start + d->count) % d->alloc)->~T(); +} + +template +inline T QOffsetVector::takeFirst() +{ T t = first(); removeFirst(); return t; } + +template +inline T QOffsetVector::takeLast() +{ T t = last(); removeLast(); return t; } + +#endif diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index e5bf7e4..626c9e5 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -19,6 +19,7 @@ HEADERS += \ tools/qlocale_p.h \ tools/qlocale_data_p.h \ tools/qmap.h \ + tools/qoffsetvector.h \ tools/qpodlist_p.h \ tools/qpoint.h \ tools/qqueue.h \ @@ -53,6 +54,7 @@ SOURCES += \ tools/qlocale.cpp \ tools/qpoint.cpp \ tools/qmap.cpp \ + tools/qoffsetvector.cpp \ tools/qrect.cpp \ tools/qregexp.cpp \ tools/qshareddata.cpp \ diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 19f6b43..5d71e79 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -209,6 +209,7 @@ SUBDIRS += bic \ qnumeric \ qobject \ qobjectrace \ + qoffsetvector \ qpaintengine \ qpainter \ qpainterpath \ diff --git a/tests/auto/qoffsetvector/qoffsetvector.pro b/tests/auto/qoffsetvector/qoffsetvector.pro new file mode 100644 index 0000000..0b801f3 --- /dev/null +++ b/tests/auto/qoffsetvector/qoffsetvector.pro @@ -0,0 +1,8 @@ +load(qttest_p4) + +QT = core + +SOURCES += tst_qoffsetvector.cpp + + + diff --git a/tests/auto/qoffsetvector/tst_qoffsetvector.cpp b/tests/auto/qoffsetvector/tst_qoffsetvector.cpp new file mode 100644 index 0000000..439ea2c --- /dev/null +++ b/tests/auto/qoffsetvector/tst_qoffsetvector.cpp @@ -0,0 +1,361 @@ +/**************************************************************************** +** +** This file is part of the $PACKAGE_NAME$. +** +** Copyright (C) $THISYEAR$ $COMPANY_NAME$. +** +** $QT_EXTENDED_DUAL_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include +#include + + +#if defined(FORCE_UREF) +template +inline QDebug &operator<<(QDebug debug, const QOffsetVector &offsetVector) +#else +template +inline QDebug operator<<(QDebug debug, const QOffsetVector &offsetVector) +#endif +{ + debug.nospace() << "QOffsetVector("; + for (int i = offsetVector.firstIndex(); i <= offsetVector.lastIndex(); ++i) { + debug << offsetVector[i]; + if (i != offsetVector.lastIndex()) + debug << ", "; + } + debug << ")"; + return debug.space(); +} + +#if defined(NO_BENCHMARK) and defined(QBENCHMARK) +#undef QBENCHMARK +#define QBENCHMARK +#endif + +class tst_QOffsetVector : public QObject +{ + Q_OBJECT +public: + tst_QOffsetVector() {} + virtual ~tst_QOffsetVector() {} +private slots: + void empty(); + void forwardBuffer(); + void scrollingList(); + + void complexType(); + + void operatorAt(); + + void cacheBenchmark(); + void offsetVectorBenchmark(); + + void setCapacity(); +}; + +QTEST_MAIN(tst_QOffsetVector) + +void tst_QOffsetVector::empty() +{ + QOffsetVector c(10); + QCOMPARE(c.capacity(), 10); + QCOMPARE(c.count(), 0); + QVERIFY(c.isEmpty()); + c.append(1); + QVERIFY(!c.isEmpty()); + c.clear(); + QCOMPARE(c.capacity(), 10); + QCOMPARE(c.count(), 0); + QVERIFY(c.isEmpty()); + c.prepend(1); + QVERIFY(!c.isEmpty()); + c.clear(); + QCOMPARE(c.count(), 0); + QVERIFY(c.isEmpty()); + QCOMPARE(c.capacity(), 10); +} + +void tst_QOffsetVector::forwardBuffer() +{ + int i; + QOffsetVector c(10); + for(i = 1; i < 30; ++i) { + c.append(i); + QCOMPARE(c.first(), qMax(1, i-9)); + QCOMPARE(c.last(), i); + QCOMPARE(c.count(), qMin(i, 10)); + } + + c.clear(); + + for(i = 1; i < 30; ++i) { + c.prepend(i); + QCOMPARE(c.last(), qMax(1, i-9)); + QCOMPARE(c.first(), i); + QCOMPARE(c.count(), qMin(i, 10)); + } +} + +void tst_QOffsetVector::scrollingList() +{ + int i; + QOffsetVector c(10); + + // Once allocated QOffsetVector should not + // allocate any additional memory for non + // complex data types. + QBENCHMARK { + // simulate scrolling in a list of items; + for(i = 0; i < 10; ++i) + c.append(i); + + QCOMPARE(c.firstIndex(), 0); + QCOMPARE(c.lastIndex(), 9); + QVERIFY(c.containsIndex(0)); + QVERIFY(c.containsIndex(9)); + QVERIFY(!c.containsIndex(10)); + + for (i = 0; i < 10; ++i) + QCOMPARE(c.at(i), i); + + for (i = 10; i < 30; ++i) + c.append(i); + + QCOMPARE(c.firstIndex(), 20); + QCOMPARE(c.lastIndex(), 29); + QVERIFY(c.containsIndex(20)); + QVERIFY(c.containsIndex(29)); + QVERIFY(!c.containsIndex(30)); + + for (i = 20; i < 30; ++i) + QCOMPARE(c.at(i), i); + + for (i = 19; i >= 10; --i) + c.prepend(i); + + QCOMPARE(c.firstIndex(), 10); + QCOMPARE(c.lastIndex(), 19); + QVERIFY(c.containsIndex(10)); + QVERIFY(c.containsIndex(19)); + QVERIFY(!c.containsIndex(20)); + + for (i = 10; i < 20; ++i) + QCOMPARE(c.at(i), i); + + for (i = 200; i < 220; ++i) + c.insert(i, i); + + QCOMPARE(c.firstIndex(), 210); + QCOMPARE(c.lastIndex(), 219); + QVERIFY(c.containsIndex(210)); + QVERIFY(c.containsIndex(219)); + QVERIFY(!c.containsIndex(300)); + QVERIFY(!c.containsIndex(209)); + + for (i = 220; i < 220; ++i) { + QVERIFY(c.containsIndex(i)); + QCOMPARE(c.at(i), i); + } + c.clear(); // needed to reset benchmark + } + + // from a specific bug that was encountered. 100 to 299 cached, attempted to cache 250 - 205 via insert, failed. + // bug was that item at 150 would instead be item that should have been inserted at 250 + c.setCapacity(200); + for(i = 100; i < 300; ++i) + c.insert(i, i); + for (i = 250; i <= 306; ++i) + c.insert(i, 1000+i); + for (i = 107; i <= 306; ++i) { + QVERIFY(c.containsIndex(i)); + QCOMPARE(c.at(i), i < 250 ? i : 1000+i); + } +} + +struct RefCountingClassData +{ + QBasicAtomicInt ref; + static RefCountingClassData shared_null; +}; + +RefCountingClassData RefCountingClassData::shared_null = { + Q_BASIC_ATOMIC_INITIALIZER(1) +}; + +class RefCountingClass +{ +public: + RefCountingClass() : d(&RefCountingClassData::shared_null) { d->ref.ref(); } + + RefCountingClass(const RefCountingClass &other) + { + d = other.d; + d->ref.ref(); + } + + ~RefCountingClass() + { + if (!d->ref.deref()) + delete d; + } + + RefCountingClass &operator=(const RefCountingClass &other) + { + if (!d->ref.deref()) + delete d; + d = other.d; + d->ref.ref(); + return *this; + } + + int refCount() const { return d->ref; } +private: + RefCountingClassData *d; +}; + +void tst_QOffsetVector::complexType() +{ + RefCountingClass original; + + QOffsetVector offsetVector(10); + offsetVector.append(original); + QCOMPARE(original.refCount(), 3); + offsetVector.removeFirst(); + QCOMPARE(original.refCount(), 2); // shared null, 'original'. + offsetVector.append(original); + QCOMPARE(original.refCount(), 3); + offsetVector.clear(); + QCOMPARE(original.refCount(), 2); + + for(int i = 0; i < 100; ++i) + offsetVector.insert(i, original); + + QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in offsetVector. + + offsetVector.clear(); + QCOMPARE(original.refCount(), 2); + for (int i = 0; i < 100; i++) + offsetVector.append(original); + + QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in offsetVector. + offsetVector.clear(); + QCOMPARE(original.refCount(), 2); + + for (int i = 0; i < 100; i++) + offsetVector.prepend(original); + + QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in offsetVector. + offsetVector.clear(); + QCOMPARE(original.refCount(), 2); + + for (int i = 0; i < 100; i++) + offsetVector.append(original); + + offsetVector.takeLast(); + QCOMPARE(original.refCount(), 11); + + offsetVector.takeFirst(); + QCOMPARE(original.refCount(), 10); +} + +void tst_QOffsetVector::operatorAt() +{ + RefCountingClass original; + QOffsetVector offsetVector(10); + + for (int i = 25; i < 35; ++i) + offsetVector[i] = original; + + QCOMPARE(original.refCount(), 12); // shared null, orig, items in vector + + // verify const access does not copy items. + const QOffsetVector copy(offsetVector); + for (int i = 25; i < 35; ++i) + QCOMPARE(copy[i].refCount(), 12); + + // verify modifying the original increments ref count (e.g. does a detach) + offsetVector[25] = original; + QCOMPARE(original.refCount(), 22); +} + +/* + Benchmarks must be near identical in tasks to be fair. + QCache uses pointers to ints as its a requirement of QCache, + whereas QOffsetVector doesn't support pointers (won't free them). + Given the ability to use simple data types is a benefit, its + fair. Although this obviously must take into account we are + testing QOffsetVector use cases here, QCache has its own + areas where it is the more sensible class to use. +*/ +void tst_QOffsetVector::cacheBenchmark() +{ + QBENCHMARK { + QCache cache; + cache.setMaxCost(100); + + for (int i = 0; i < 1000; i++) + cache.insert(i, new int(i)); + } +} + +void tst_QOffsetVector::offsetVectorBenchmark() +{ + QBENCHMARK { + QOffsetVector offsetVector(100); + for (int i = 0; i < 1000; i++) + offsetVector.insert(i, i); + } +} + +void tst_QOffsetVector::setCapacity() +{ + int i; + QOffsetVector offsetVector(100); + for (i = 280; i < 310; ++i) + offsetVector.insert(i, i); + QCOMPARE(offsetVector.capacity(), 100); + QCOMPARE(offsetVector.count(), 30); + QCOMPARE(offsetVector.firstIndex(), 280); + QCOMPARE(offsetVector.lastIndex(), 309); + + for (i = offsetVector.firstIndex(); i <= offsetVector.lastIndex(); ++i) { + QVERIFY(offsetVector.containsIndex(i)); + QCOMPARE(offsetVector.at(i), i); + } + + offsetVector.setCapacity(150); + + QCOMPARE(offsetVector.capacity(), 150); + QCOMPARE(offsetVector.count(), 30); + QCOMPARE(offsetVector.firstIndex(), 280); + QCOMPARE(offsetVector.lastIndex(), 309); + + for (i = offsetVector.firstIndex(); i <= offsetVector.lastIndex(); ++i) { + QVERIFY(offsetVector.containsIndex(i)); + QCOMPARE(offsetVector.at(i), i); + } + + offsetVector.setCapacity(20); + + QCOMPARE(offsetVector.capacity(), 20); + QCOMPARE(offsetVector.count(), 20); + QCOMPARE(offsetVector.firstIndex(), 290); + QCOMPARE(offsetVector.lastIndex(), 309); + + for (i = offsetVector.firstIndex(); i <= offsetVector.lastIndex(); ++i) { + QVERIFY(offsetVector.containsIndex(i)); + QCOMPARE(offsetVector.at(i), i); + } +} + +#include "tst_qoffsetvector.moc" -- cgit v0.12 From 16488d6e1073ce311c173d78c16be8da1f57f94e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 30 Mar 2009 16:44:55 +0200 Subject: Doc: Synchronized the QTransform constructor arguments with the class documentation and updated a diagram. Task-number: 228201 Reviewed-by: TrustMe --- doc/src/diagrams/qtransform-representation.sk | 103 ++++++++++++++++++++++++++ src/gui/painting/qtransform.cpp | 19 +++-- 2 files changed, 114 insertions(+), 8 deletions(-) create mode 100644 doc/src/diagrams/qtransform-representation.sk diff --git a/doc/src/diagrams/qtransform-representation.sk b/doc/src/diagrams/qtransform-representation.sk new file mode 100644 index 0000000..17dcbfe --- /dev/null +++ b/doc/src/diagrams/qtransform-representation.sk @@ -0,0 +1,103 @@ +##Sketch 1 2 +document() +layout('A4',0) +layer('Layer 1',1,1,0,0,(0,0,0)) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,190,760) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,190,695) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,190,630) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,320,760) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,320,695) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,320,630) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,255,760) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,255,695) +lp((0,0,1)) +lw(2) +r(65,0,0,-65,255,630) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m33',(329.16,589.968)) +G() +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('dy',(274.828,577.768)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m32',(264.16,602.768)) +G_() +G() +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m31',(199.16,602.768)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('dx',(209.828,577.8)) +G_() +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m11',(199.16,719.968)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m12',(264.16,719.968)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m13',(329.16,719.968)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m21',(199.16,654.968)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m22',(264.16,654.968)) +fp((0,0,0)) +le() +lw(1) +Fn('Helvetica') +Fs(24) +txt('m23',(329.16,654.968)) +guidelayer('Guide Lines',1,0,0,1,(0,0,1)) +grid((0,0,5,5),1,(0,0,1),'Grid') diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index da8c428..c70208c 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -168,10 +168,10 @@ QT_BEGIN_NAMESPACE \image qtransform-representation.png - A QTransform object contains a 3 x 3 matrix. The \c dx and \c dy - elements specify horizontal and vertical translation. The \c m11 - and \c m22 elements specify horizontal and vertical scaling. The - \c m21 and \c m12 elements specify horizontal and vertical \e shearing. + A QTransform object contains a 3 x 3 matrix. The \c m31 (\c dx) and + \c m32 (\c dy) elements specify horizontal and vertical translation. + The \c m11 and \c m22 elements specify horizontal and vertical scaling. + The \c m21 and \c m12 elements specify horizontal and vertical \e shearing. And finally, the \c m13 and \c m23 elements specify horizontal and vertical projection, with \c m33 as an additional projection factor. @@ -246,8 +246,10 @@ QTransform::QTransform() } /*! - Constructs a matrix with the elements, \a h11, \a h12, \a h13, - \a h21, \a h22, \a h23, \a h31, \a h32, \a h33. + \fn QTransform::QTransform(qreal m11, qreal m12, qreal m13, qreal m21, qreal m22, qreal m23, qreal m31, qreal m32, qreal m33) + + Constructs a matrix with the elements, \a m11, \a m12, \a m13, + \a m21, \a m22, \a m23, \a m31, \a m32, \a m33. \sa setMatrix() */ @@ -263,8 +265,9 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h13, } /*! - Constructs a matrix with the elements, \a h11, \a h12, \a h21, \a - h22, \a dx and \a dy. + \fn QTransform::QTransform(qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qreal dy) + + Constructs a matrix with the elements, \a m11, \a m12, \a m21, \a m22, \a dx and \a dy. \sa setMatrix() */ -- cgit v0.12 From 1e2fdb56ce6025b34b88b1da1386f8c79464b412 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 30 Mar 2009 16:48:26 +0200 Subject: Doc: Synchronized the QTransform constructor arguments with the class documentation and updated a diagram. Task-number: 228201 Reviewed-by: TrustMe --- doc/src/images/qtransform-representation.png | Bin 17892 -> 17385 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/doc/src/images/qtransform-representation.png b/doc/src/images/qtransform-representation.png index 2608872..883d5dc 100644 Binary files a/doc/src/images/qtransform-representation.png and b/doc/src/images/qtransform-representation.png differ -- cgit v0.12 From 87f1ea14ae7e245dd7589b1d992f67b0058ae1b5 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 30 Mar 2009 17:03:01 +0200 Subject: Doc: Fixed typo. Reviewed-by: TrustMe --- src/corelib/kernel/qmetatype.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 4d7d309..ce10bae 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1255,7 +1255,7 @@ void QMetaType::destroy(int type, void *data) \relates QMetaType \threadsafe - Registers the type name \a typeName to the type \c{T}. Returns + Registers the type name \a typeName for the type \c{T}. Returns the internal ID used by QMetaType. Any class or struct that has a public default constructor, a public copy constructor and a public destructor can be registered. -- cgit v0.12 From 577853b93dd4cf848abbd95abfed7e5a9d48688b Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 30 Mar 2009 18:11:04 +0200 Subject: Doc: Added a code snippet to illustrate the opening of local files. Task-number: 223087 Reviewed-by: TrustMe --- doc/src/snippets/code/src_gui_util_qdesktopservices.cpp | 5 ++++- src/gui/util/qdesktopservices.cpp | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp b/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp index a9c630b..5001984 100644 --- a/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp +++ b/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp @@ -11,7 +11,10 @@ public slots: QDesktopServices::setUrlHandler("help", helpInstance, "showHelp"); //! [0] - //! [1] mailto:user@foo.com?subject=Test&body=Just a test //! [1] + +//! [2] +QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desktop", QUrl::TolerantMode)); +//! [2] diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 0fe1d69..84aa16e 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -157,6 +157,11 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler) If the URL is a reference to a local file (i.e., the URL scheme is "file") then it will be opened with a suitable application instead of a Web browser. + The following example opens a file on the Windows file system residing on a path + that contains spaces: + + \snippet doc/src/snippets/code/src_gui_util_qdesktopservices.cpp 2 + If a \c mailto URL is specified, the user's e-mail client will be used to open a composer window containing the options specified in the URL, similar to the way \c mailto links are handled by a Web browser. -- cgit v0.12 From 22ee1110301b228bbcbe9d39a9bcebe9ab4cdad0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 31 Mar 2009 14:55:33 +0200 Subject: Doc: Removed a reference to a deprecated function. Reported by a former Doc Manager. Reviewed-by: TrustMe --- src/gui/dialogs/qcolordialog.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index b744dca..3aa04f6 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -1523,10 +1523,10 @@ static const Qt::WindowFlags DefaultWindowFlags = If you require a modeless dialog, use the QColorDialog constructor. \endomit - The static getColor() function shows the dialog, and allows the - user to specify a color. The getRgba() function does the same, but - also allows the user to specify a color with an alpha channel - (transparency) value. + The static getColor() function shows the dialog, and allows the user to + specify a color. This function can also be used to let users choose a + color with a level of transparency: pass the ShowAlphaChannel option as + an additional argument. The user can store customCount() different custom colors. The custom colors are shared by all color dialogs, and remembered -- cgit v0.12 From 94c3e15e0fd04a178c319c2bc151b492a46380ee Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 31 Mar 2009 16:53:36 +0200 Subject: Doc: Clarified that the main use case for QRegion is as a clipping primitive not as a rendering primitive. Task-number: 183493 Reviewed-by: TrustMe --- src/gui/painting/qregion.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 8169ef8..c88af7c 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -65,9 +65,17 @@ QT_BEGIN_NAMESPACE \ingroup shared QRegion is used with QPainter::setClipRegion() to limit the paint - area to what needs to be painted. There is also a - QWidget::repaint() function that takes a QRegion parameter. - QRegion is the best tool for reducing flicker. + area to what needs to be painted. There is also a QWidget::repaint() + function that takes a QRegion parameter. QRegion is the best tool for + minimizing the amount of screen area to be updated by a repaint. + + This class is not suitable for constructing shapes for rendering, especially + as outlines. Use QPainterPath to create paths and shapes for use with + QPainter. + + QRegion is an \l{implicitly shared} class. + + \section1 Creating and Using Regions A region can be created from a rectangle, an ellipse, a polygon or a bitmap. Complex regions may be created by combining simple @@ -84,8 +92,6 @@ QT_BEGIN_NAMESPACE Example of using complex regions: \snippet doc/src/snippets/code/src_gui_painting_qregion.cpp 0 - QRegion is an \l{implicitly shared} class. - \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. @@ -93,7 +99,7 @@ QT_BEGIN_NAMESPACE \section1 Additional License Information On Embedded Linux, Windows CE and X11 platforms, parts of this class rely on - code obtained under the following license: + code obtained under the following licenses: \legalese Copyright (c) 1987 X Consortium @@ -120,9 +126,7 @@ QT_BEGIN_NAMESPACE in this Software without prior written authorization from the X Consortium. \endlegalese - \raw HTML -
- \endraw + \br \legalese Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. -- cgit v0.12 From cf4d9e09afc72dfb474b497a95c872965335e341 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 31 Mar 2009 17:35:33 +0200 Subject: Doc: Noted the difference between the qLowerBound() functions. Task-number: 160621 Reviewed-by: TrustMe --- doc/src/qalgorithms.qdoc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/src/qalgorithms.qdoc b/doc/src/qalgorithms.qdoc index 459fb81..b33c250 100644 --- a/doc/src/qalgorithms.qdoc +++ b/doc/src/qalgorithms.qdoc @@ -490,7 +490,10 @@ of \a value in the variable passed as a reference in argument \a n. \overload - This is the same as qLowerBound(\a{container}.begin(), \a{container}.end(), value); + For read-only iteration over containers, this function is broadly equivalent to + qLowerBound(\a{container}.begin(), \a{container}.end(), value). However, since it + returns a const iterator, you cannot use it to modify the container; for example, + to insert items. */ /*! \fn RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value) -- cgit v0.12 From 93ca19a8ff7570606b4c01cfb9953921f897aa6e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 31 Mar 2009 17:38:40 +0200 Subject: Doc: Made it clearer that QProcess::start() only starts a new process if one is not already running. Task-number: 231513 Reviewed-by: TrustMe --- src/corelib/io/qprocess.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index a9d8ee2..18618fc 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1476,11 +1476,15 @@ QByteArray QProcess::readAllStandardError() } /*! - Starts the program \a program in a new process, passing the - command line arguments in \a arguments. The OpenMode is set to \a - mode. QProcess will immediately enter the Starting state. If the - process starts successfully, QProcess will emit started(); - otherwise, error() will be emitted. + Starts the program \a program in a new process, if one is not already + running, passing the command line arguments in \a arguments. The OpenMode + is set to \a mode. + + The QProcess object will immediately enter the Starting state. If the + process starts successfully, QProcess will emit started(); otherwise, + error() will be emitted. If the QProcess object is already running a + process, a warning may be printed at the console, and the existing + process will continue running. Note that arguments that contain spaces are not passed to the process as separate arguments. @@ -1577,10 +1581,10 @@ static QStringList parseCombinedArgString(const QString &program) /*! \overload - Starts the program \a program in a new process. \a program is a - single string of text containing both the program name and its - arguments. The arguments are separated by one or more - spaces. For example: + Starts the program \a program in a new process, if one is not already + running. \a program is a single string of text containing both the + program name and its arguments. The arguments are separated by one or + more spaces. For example: \snippet doc/src/snippets/code/src_corelib_io_qprocess.cpp 5 @@ -1589,6 +1593,9 @@ static QStringList parseCombinedArgString(const QString &program) \snippet doc/src/snippets/code/src_corelib_io_qprocess.cpp 6 + If the QProcess object is already running a process, a warning may be + printed at the console, and the existing process will continue running. + Note that, on Windows, quotes need to be both escaped and quoted. For example, the above code would be specified in the following way to ensure that \c{"My Documents"} is used as the argument to -- cgit v0.12 From 65c16391fff38e28e4a9db215758b1df6c868a32 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 31 Mar 2009 19:53:21 +0200 Subject: Doc: Fixed the screenshots and example description to match the code. Task-number: 242369 Reviewed-by: TrustMe --- doc/src/examples/extension.qdoc | 11 +++++------ doc/src/images/extension-example.png | Bin 7676 -> 9929 bytes doc/src/images/extension_more.png | Bin 9309 -> 13523 bytes 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/src/examples/extension.qdoc b/doc/src/examples/extension.qdoc index 8a0ca3a..02e0698 100644 --- a/doc/src/examples/extension.qdoc +++ b/doc/src/examples/extension.qdoc @@ -80,9 +80,9 @@ user type a word to search for, we need several \l {QCheckBox}{QCheckBox}es to facilitate the search options, and we need three \l {QPushButton}{QPushButton}s: the \gui Find button to - start a search, the \gui More button to enable an advanced search, - and the \gui Close button to exit the application. Finally, we - need a QWidget representing the application's extension part. + start a search and the \gui More button to enable an advanced search. + Finally, we need a QWidget representing the application's extension + part. \section1 FindDialog Class Implementation @@ -128,8 +128,7 @@ the connection makes sure that the extension widget is shown depending on the state of \gui More button. - We also connect the \gui Close button to the QWidget::close() - slot, and we put the checkboxes associated with the advanced + We also put the check boxes associated with the advanced search options into a layout we install on the extension widget. \snippet examples/dialogs/extension/finddialog.cpp 4 @@ -137,7 +136,7 @@ Before we create the main layout, we create several child layouts for the widgets: First we allign the QLabel ans its buddy, the QLineEdit, using a QHBoxLayout. Then we vertically allign the - QLabel and QLineEdit with the checkboxes associated with the + QLabel and QLineEdit with the check boxes associated with the simple search, using a QVBoxLayout. We also create a QVBoxLayout for the buttons. In the end we lay out the two latter layouts and the extension widget using a QGridLayout. diff --git a/doc/src/images/extension-example.png b/doc/src/images/extension-example.png index dfaacc0..18fab52 100644 Binary files a/doc/src/images/extension-example.png and b/doc/src/images/extension-example.png differ diff --git a/doc/src/images/extension_more.png b/doc/src/images/extension_more.png index 2b06809..407af27 100644 Binary files a/doc/src/images/extension_more.png and b/doc/src/images/extension_more.png differ -- cgit v0.12 From 23174985c19c61fbce412965ecc1ba49c1cb5582 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Apr 2009 16:36:19 +0200 Subject: Doc: Minor language fixes and tidying. Reviewed-by: TrustMe --- doc/src/phonon-api.qdoc | 2 +- doc/src/phonon.qdoc | 2 +- doc/src/qnamespace.qdoc | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/src/phonon-api.qdoc b/doc/src/phonon-api.qdoc index 147ded3..3d04c68 100644 --- a/doc/src/phonon-api.qdoc +++ b/doc/src/phonon-api.qdoc @@ -2568,7 +2568,7 @@ details. Phonon also provides EffectWidget, which lets the user modify the - parameters of an effect an the fly, e.g., with comboboxes. + parameters of an effect an the fly; e.g., with combo boxes. \sa {Phonon Module}, EffectWidget */ diff --git a/doc/src/phonon.qdoc b/doc/src/phonon.qdoc index fa84b96..9470e61 100644 --- a/doc/src/phonon.qdoc +++ b/doc/src/phonon.qdoc @@ -49,7 +49,7 @@ \section1 Introduction Qt uses the Phonon multimedia framework to provide functionality - for playback of the most common multimedia formats.The media can + for playback of the most common multimedia formats. The media can be read from files or streamed over a network, using a QURL to a file. diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index 6220795..e6a1a36 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -508,11 +508,11 @@ \value DirectConnection When emitted, the signal is immediately delivered to the slot. \value QueuedConnection When emitted, the signal is queued until the event loop is able to deliver it to the slot. - \value - BlockingQueuedConnection Same as QueuedConnection, except that the current thread blocks + \value BlockingQueuedConnection + Same as QueuedConnection, except that the current thread blocks until the slot has been delivered. This connection type should only be used for receivers in a different thread. Note that misuse - of this type can lead to dead locks in your application. + of this type can lead to deadlocks in your application. \value AutoConnection If the signal is emitted from the thread in which the receiving object lives, the slot is invoked directly, as with -- cgit v0.12 From 80293b874047c028e47d91d33c2afe157d9e6785 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Apr 2009 16:37:14 +0200 Subject: Doc: Trivial fixes. Reviewed-by: TrustMe --- src/corelib/global/qglobal.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 1645279..8324d05 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2944,12 +2944,12 @@ bool QInternal::callFunction(InternalFunction func, void **args) Compares the floating point value \a p1 and \a p2 and returns \c true if they are considered equal, otherwise \c false. - + Note that comparing values where either \a p1 or \a p2 is 0.0 will not work. - The solution to this is to compare against values greater than or equal to 1.0 - + The solution to this is to compare against values greater than or equal to 1.0. + \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 46 - + The two numbers are compared in a relative way, where the exactness is stronger the smaller the numbers are. */ -- cgit v0.12 From 244daeabfb55160387985d0ff3f057aa03d4d2da Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Apr 2009 16:38:15 +0200 Subject: Doc: Updated the deployment documentation with the QtScriptTools module and references to Phonon documentation. Task-number: 212939 Reviewed-by: TrustMe --- doc/src/deployment.qdoc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/src/deployment.qdoc b/doc/src/deployment.qdoc index 7e02f1a..d9f7c1a 100644 --- a/doc/src/deployment.qdoc +++ b/doc/src/deployment.qdoc @@ -91,7 +91,7 @@ The disadvantage with the shared library approach is that you will get more files to deploy. For more information, see \l{sharedlibrary.html}{Creating Shared Libraries}. - + \section1 Deploying Qt's Libraries \table @@ -111,13 +111,14 @@ \o \l {QtNetwork} \o \l {QtOpenGL} \o \l {QtScript} - \o \l {QtSql} + \o \l {QtScriptTools} \row + \o \l {QtSql} \o \l {QtSvg} \o \l {QtWebKit} \o \l {QtXml} - \o \l {QtXmlPatterns} \row + \o \l {QtXmlPatterns} \o \l {Phonon Module}{Phonon} \o \l {Qt3Support} \endtable @@ -178,11 +179,13 @@ Please see \l{QtWebKit Module#License Information}{the QtWebKit module documentation} for more information. - \row \o Phonon \o Phonon + \row \o \l{Phonon Module}{Phonon} \o Phonon \o Phonon relies on the native multimedia engines on different platforms. Phonon itself is licensed under the GNU LGPL version 2. Please see \l{Phonon Module#License Information}{the Phonon module documentation} - for more information. + for more information on licensing and the + \l{Phonon Overview#Backends}{Phonon Overview} for details of the backends + in use on different platforms. \endtable \section1 Platform-Specific Notes -- cgit v0.12 From 10d0536fd3b08a394c41de349e67325183328ec6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Apr 2009 16:59:51 +0200 Subject: Doc: Clarified the usage of QImage::dotsPerMeterX() and QImage::dotsPerMeterY(). Task-number: 240164 Reviewed-by: Jan Erik Hanssen --- src/gui/image/qimage.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 558d574..dc236e4 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4937,10 +4937,12 @@ int QImage::dotsPerMeterY() const meter, to \a x. Together with dotsPerMeterY(), this number defines the intended - scale and aspect ratio of the image. + scale and aspect ratio of the image, and determines the scale + at which QPainter will draw graphics on the image. It does not + change the scale or aspect ratio of the image when it is rendered + on other paint devices. - \sa dotsPerMeterX(), {QImage#Image Information}{Image - Information} + \sa dotsPerMeterX(), {QImage#Image Information}{Image Information} */ void QImage::setDotsPerMeterX(int x) { @@ -4957,10 +4959,12 @@ void QImage::setDotsPerMeterX(int x) to \a y. Together with dotsPerMeterX(), this number defines the intended - scale and aspect ratio of the image. + scale and aspect ratio of the image, and determines the scale + at which QPainter will draw graphics on the image. It does not + change the scale or aspect ratio of the image when it is rendered + on other paint devices. - \sa dotsPerMeterY(), {QImage#Image Information}{Image - Information} + \sa dotsPerMeterY(), {QImage#Image Information}{Image Information} */ void QImage::setDotsPerMeterY(int y) { -- cgit v0.12 From 423d6052844b2026c8acc8826d6546d3afc494d3 Mon Sep 17 00:00:00 2001 From: Ian Walters Date: Fri, 3 Apr 2009 12:44:38 +1000 Subject: Rename OffsetVector to ContiguousCache --- doc/src/examples/contiguouscache.qdoc | 69 ++++ doc/src/examples/offsetvector.qdoc | 70 ---- examples/tools/contiguouscache/contiguouscache.pro | 9 + examples/tools/contiguouscache/main.cpp | 15 + examples/tools/contiguouscache/randomlistmodel.cpp | 56 +++ examples/tools/contiguouscache/randomlistmodel.h | 26 ++ examples/tools/offsetvector/main.cpp | 15 - examples/tools/offsetvector/offsetvector.pro | 9 - examples/tools/offsetvector/randomlistmodel.cpp | 56 --- examples/tools/offsetvector/randomlistmodel.h | 26 -- examples/tools/tools.pro | 2 +- src/corelib/tools/qcontiguouscache.cpp | 359 +++++++++++++++++++ src/corelib/tools/qcontiguouscache.h | 386 +++++++++++++++++++++ src/corelib/tools/qoffsetvector.cpp | 360 ------------------- src/corelib/tools/qoffsetvector.h | 386 --------------------- src/corelib/tools/tools.pri | 4 +- tests/auto/qcontiguouscache/qcontiguouscache.pro | 8 + .../auto/qcontiguouscache/tst_qcontiguouscache.cpp | 361 +++++++++++++++++++ tests/auto/qoffsetvector/qoffsetvector.pro | 8 - tests/auto/qoffsetvector/tst_qoffsetvector.cpp | 361 ------------------- 20 files changed, 1292 insertions(+), 1294 deletions(-) create mode 100644 doc/src/examples/contiguouscache.qdoc delete mode 100644 doc/src/examples/offsetvector.qdoc create mode 100644 examples/tools/contiguouscache/contiguouscache.pro create mode 100644 examples/tools/contiguouscache/main.cpp create mode 100644 examples/tools/contiguouscache/randomlistmodel.cpp create mode 100644 examples/tools/contiguouscache/randomlistmodel.h delete mode 100644 examples/tools/offsetvector/main.cpp delete mode 100644 examples/tools/offsetvector/offsetvector.pro delete mode 100644 examples/tools/offsetvector/randomlistmodel.cpp delete mode 100644 examples/tools/offsetvector/randomlistmodel.h create mode 100644 src/corelib/tools/qcontiguouscache.cpp create mode 100644 src/corelib/tools/qcontiguouscache.h delete mode 100644 src/corelib/tools/qoffsetvector.cpp delete mode 100644 src/corelib/tools/qoffsetvector.h create mode 100644 tests/auto/qcontiguouscache/qcontiguouscache.pro create mode 100644 tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp delete mode 100644 tests/auto/qoffsetvector/qoffsetvector.pro delete mode 100644 tests/auto/qoffsetvector/tst_qoffsetvector.cpp diff --git a/doc/src/examples/contiguouscache.qdoc b/doc/src/examples/contiguouscache.qdoc new file mode 100644 index 0000000..22c97fa --- /dev/null +++ b/doc/src/examples/contiguouscache.qdoc @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/*! + \example tools/contiguouscache + \title Contiguous Cache Example + + The Contiguous Cache example shows how to use QContiguousCache to manage memory usage for + very large models. In some environments memory is limited, and even when it + isn't users still dislike an application using + excessive memory. Using QContiguousCache to manage a list rather than loading + the entire list into memory allows the application to limit the amount + of memory it uses regardless of the size of the data set it accesses + + The simplest way to use QContiguousCache is to cache as items are requested. When + a view requests an item at row N it is also likely to ask for items at rows near + to N. + + \snippet examples/tools/contiguouscache/randomlistmodel.cpp 0 + + After getting the row the class determines if the row is in the bounds + of the contiguous cache's current range. It would have been equally valid to + simply have the following code instead. + + \code + while (row > m_words.lastIndex()) + m_words.append(fetchWord(m_words.lastIndex()+1); + while (row < m_words.firstIndex()) + m_words.prepend(fetchWord(m_words.firstIndex()-1); + \endcode + + However a list will often jump rows if the scroll bar is used directly, resulting in + the code above to cause every row between where the cache was last centered + to the requested row to be fetched before the requested row is fetched. + + Using QContiguousCache::lastIndex() and QContiguousCache::firstIndex() allows + the example to determine where in the list the cache is currently over. These values + don't represent the indexes into the cache own memory, but rather a virtual + infinite array that the cache represents. + + By using QContiguousCache::append() and QContiguousCache::prepend() the code ensures + that items that may be still on the screen are not lost when the requested row + has not moved far from the current cache range. QContiguousCache::insert() can + potentially remove more than one item from the cache as QContiguousCache does not + allow for gaps. If your cache needs to quickly jump back and forth between + rows with significant gaps between them consider using QCache instead. + + And thats it. A perfectly reasonable cache, using minimal memory for a very large + list. In this case the accessor for getting the words into cache: + + \snippet examples/tools/contiguouscache/randomlistmodel.cpp 1 + + Generates random information rather than fixed information. This allows you + to see how the cache range is kept for a local number of rows when running the + example. + + It is also worth considering pre-fetching items into the cache outside of the + applications paint routine. This can be done either with a separate thread + or using a QTimer to incrementally expand the range of the thread prior to + rows being requested out of the current cache range. +*/ diff --git a/doc/src/examples/offsetvector.qdoc b/doc/src/examples/offsetvector.qdoc deleted file mode 100644 index 256569e..0000000 --- a/doc/src/examples/offsetvector.qdoc +++ /dev/null @@ -1,70 +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 $MODULE$ of the Qt Toolkit. -** -** $TROLLTECH_DUAL_LICENSE$ -** -****************************************************************************/ - -/*! - \example tools/offsetvector - \title Offset Vector Example - - The Offset Vector example shows how to use QOffsetVector to manage memory usage for - very large models. In some environments memory is limited, and even when it - isn't users still dislike an application using - excessive memory. Using QOffsetVector to manage a list rather than loading - the entire list into memory allows the application to limit the amount - of memory it uses regardless of the size of the data set it accesses - - The simplest way to use QOffsetVector is to cache as items are requested. When - a view requests an item at row N it is also likely to ask for items at rows near - to N. - - \snippet examples/tools/offsetvector/randomlistmodel.cpp 0 - - After getting the row the class determines if the row is in the bounds - of the offset vector's current range. It would have been equally valid to - simply have the following code instead. - - \code - while (row > m_words.lastIndex()) - m_words.append(fetchWord(m_words.lastIndex()+1); - while (row < m_words.firstIndex()) - m_words.prepend(fetchWord(m_words.firstIndex()-1); - \endcode - - However a list will often jump rows if the scroll bar is used directly, and - the above code would cause every row between where the cache was last centered - to where the cache is currently centered to be cached before the requested - row is reached. - - Using QOffsetVector::lastIndex() and QOffsetVector::firstIndex() allows - the example to determine where the list the vector is currently over. These values - don't represent the indexes into the vector own memory, but rather a virtual - infinite array that the vector represents. - - By using QOffsetVector::append() and QOffsetVector::prepend() the code ensures - that items that may be still on the screen are not lost when the requested row - has not moved far from the current vector range. QOffsetVector::insert() can - potentially remove more than one item from the cache as QOffsetVector does not - allow for gaps. If your cache needs to quickly jump back and forth between - rows with significant gaps between them consider using QCache instead. - - And thats it. A perfectly reasonable cache, using minimal memory for a very large - list. In this case the accessor for getting the words into cache: - - \snippet examples/tools/offsetvector/randomlistmodel.cpp 1 - - Generates random information rather than fixed information. This allows you - to see how the cache range is kept for a local number of rows when running the - example. - - It is also worth considering pre-fetching items into the cache outside of the - applications paint routine. This can be done either with a separate thread - or using a QTimer to incrementally expand the range of the thread prior to - rows being requested out of the current vector range. -*/ diff --git a/examples/tools/contiguouscache/contiguouscache.pro b/examples/tools/contiguouscache/contiguouscache.pro new file mode 100644 index 0000000..f840514 --- /dev/null +++ b/examples/tools/contiguouscache/contiguouscache.pro @@ -0,0 +1,9 @@ +HEADERS = randomlistmodel.h +SOURCES = randomlistmodel.cpp \ + main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tools/contiguouscache +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS contiguouscache.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tools/contiguouscache +INSTALLS += target sources diff --git a/examples/tools/contiguouscache/main.cpp b/examples/tools/contiguouscache/main.cpp new file mode 100644 index 0000000..bdeb3f3 --- /dev/null +++ b/examples/tools/contiguouscache/main.cpp @@ -0,0 +1,15 @@ +#include "randomlistmodel.h" +#include +#include + +int main(int c, char **v) +{ + QApplication a(c, v); + + QListView view; + view.setUniformItemSizes(true); + view.setModel(new RandomListModel(&view)); + view.show(); + + return a.exec(); +} diff --git a/examples/tools/contiguouscache/randomlistmodel.cpp b/examples/tools/contiguouscache/randomlistmodel.cpp new file mode 100644 index 0000000..5c0953b --- /dev/null +++ b/examples/tools/contiguouscache/randomlistmodel.cpp @@ -0,0 +1,56 @@ +#include "randomlistmodel.h" + +static const int bufferSize(500); +static const int lookAhead(100); +static const int halfLookAhead(lookAhead/2); + +RandomListModel::RandomListModel(QObject *parent) +: QAbstractListModel(parent), m_rows(bufferSize), m_count(10000) +{ +} + +RandomListModel::~RandomListModel() +{ +} + +int RandomListModel::rowCount(const QModelIndex &) const +{ + return m_count; +} + +//! [0] +QVariant RandomListModel::data(const QModelIndex &index, int role) const +{ + if (role != Qt::DisplayRole) + return QVariant(); + + int row = index.row(); + + if (row > m_rows.lastIndex()) { + if (row - m_rows.lastIndex() > lookAhead) + cacheRows(row-halfLookAhead, qMin(m_count, row+halfLookAhead)); + else while (row > m_rows.lastIndex()) + m_rows.append(fetchRow(m_rows.lastIndex()+1)); + } else if (row < m_rows.firstIndex()) { + if (m_rows.firstIndex() - row > lookAhead) + cacheRows(qMax(0, row-halfLookAhead), row+halfLookAhead); + else while (row < m_rows.firstIndex()) + m_rows.prepend(fetchRow(m_rows.firstIndex()-1)); + } + + return m_rows.at(row); +} + +void RandomListModel::cacheRows(int from, int to) const +{ + for (int i = from; i <= to; ++i) + m_rows.insert(i, fetchRow(i)); +} +//![0] + +//![1] +QString RandomListModel::fetchRow(int position) const +{ + return QString::number(rand() % ++position); +} +//![1] diff --git a/examples/tools/contiguouscache/randomlistmodel.h b/examples/tools/contiguouscache/randomlistmodel.h new file mode 100644 index 0000000..ad8cfad --- /dev/null +++ b/examples/tools/contiguouscache/randomlistmodel.h @@ -0,0 +1,26 @@ +#ifndef RANDOMLISTMODEL_H +#define RANDOMLISTMODEL_H + +#include +#include + +class QTimer; +class RandomListModel : public QAbstractListModel +{ + Q_OBJECT +public: + RandomListModel(QObject *parent = 0); + ~RandomListModel(); + + int rowCount(const QModelIndex & = QModelIndex()) const; + QVariant data(const QModelIndex &, int) const; + +private: + void cacheRows(int, int) const; + QString fetchRow(int) const; + + mutable QContiguousCache m_rows; + const int m_count; +}; + +#endif diff --git a/examples/tools/offsetvector/main.cpp b/examples/tools/offsetvector/main.cpp deleted file mode 100644 index bdeb3f3..0000000 --- a/examples/tools/offsetvector/main.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "randomlistmodel.h" -#include -#include - -int main(int c, char **v) -{ - QApplication a(c, v); - - QListView view; - view.setUniformItemSizes(true); - view.setModel(new RandomListModel(&view)); - view.show(); - - return a.exec(); -} diff --git a/examples/tools/offsetvector/offsetvector.pro b/examples/tools/offsetvector/offsetvector.pro deleted file mode 100644 index f329bb9..0000000 --- a/examples/tools/offsetvector/offsetvector.pro +++ /dev/null @@ -1,9 +0,0 @@ -HEADERS = randomlistmodel.h -SOURCES = randomlistmodel.cpp \ - main.cpp - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/offsetvector -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS offsetvector.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/tools/offsetvector -INSTALLS += target sources diff --git a/examples/tools/offsetvector/randomlistmodel.cpp b/examples/tools/offsetvector/randomlistmodel.cpp deleted file mode 100644 index 5c0953b..0000000 --- a/examples/tools/offsetvector/randomlistmodel.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "randomlistmodel.h" - -static const int bufferSize(500); -static const int lookAhead(100); -static const int halfLookAhead(lookAhead/2); - -RandomListModel::RandomListModel(QObject *parent) -: QAbstractListModel(parent), m_rows(bufferSize), m_count(10000) -{ -} - -RandomListModel::~RandomListModel() -{ -} - -int RandomListModel::rowCount(const QModelIndex &) const -{ - return m_count; -} - -//! [0] -QVariant RandomListModel::data(const QModelIndex &index, int role) const -{ - if (role != Qt::DisplayRole) - return QVariant(); - - int row = index.row(); - - if (row > m_rows.lastIndex()) { - if (row - m_rows.lastIndex() > lookAhead) - cacheRows(row-halfLookAhead, qMin(m_count, row+halfLookAhead)); - else while (row > m_rows.lastIndex()) - m_rows.append(fetchRow(m_rows.lastIndex()+1)); - } else if (row < m_rows.firstIndex()) { - if (m_rows.firstIndex() - row > lookAhead) - cacheRows(qMax(0, row-halfLookAhead), row+halfLookAhead); - else while (row < m_rows.firstIndex()) - m_rows.prepend(fetchRow(m_rows.firstIndex()-1)); - } - - return m_rows.at(row); -} - -void RandomListModel::cacheRows(int from, int to) const -{ - for (int i = from; i <= to; ++i) - m_rows.insert(i, fetchRow(i)); -} -//![0] - -//![1] -QString RandomListModel::fetchRow(int position) const -{ - return QString::number(rand() % ++position); -} -//![1] diff --git a/examples/tools/offsetvector/randomlistmodel.h b/examples/tools/offsetvector/randomlistmodel.h deleted file mode 100644 index e102255..0000000 --- a/examples/tools/offsetvector/randomlistmodel.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef RANDOMLISTMODEL_H -#define RANDOMLISTMODEL_H - -#include -#include - -class QTimer; -class RandomListModel : public QAbstractListModel -{ - Q_OBJECT -public: - RandomListModel(QObject *parent = 0); - ~RandomListModel(); - - int rowCount(const QModelIndex & = QModelIndex()) const; - QVariant data(const QModelIndex &, int) const; - -private: - void cacheRows(int, int) const; - QString fetchRow(int) const; - - mutable QOffsetVector m_rows; - const int m_count; -}; - -#endif diff --git a/examples/tools/tools.pro b/examples/tools/tools.pro index 424f286..c694dd8 100644 --- a/examples/tools/tools.pro +++ b/examples/tools/tools.pro @@ -5,7 +5,7 @@ SUBDIRS = codecs \ customcompleter \ echoplugin \ i18n \ - offsetvector \ + contiguouscache \ plugandpaintplugins \ plugandpaint \ regexp \ diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp new file mode 100644 index 0000000..5046912 --- /dev/null +++ b/src/corelib/tools/qcontiguouscache.cpp @@ -0,0 +1,359 @@ +/**************************************************************************** +** +** 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 "qcontiguouscache.h" +#include + +void QContiguousCacheData::dump() const +{ + qDebug() << "capacity:" << alloc; + qDebug() << "count:" << count; + qDebug() << "start:" << start; + qDebug() << "offset:" << offset; +} + +/*! \class QContiguousCache + \brief The QContiguousCache class is a template class that provides a contiguous cache. + \ingroup tools + \ingroup shared + \reentrant + + The QContiguousCache class provides an efficient way of caching items for + display in a user interface view. Unlike QCache though it adds a restriction + that elements within the cache are contiguous. This has the advantage that + of matching how user interface views most commonly request data, as + a set of rows localized around the current scrolled position. It also + allows the cache to use less overhead than QCache both in terms of + performance and memory. + + The simplest way of using an contiguous cache is to use the append() + and prepend(). + +\code +MyRecord record(int row) const +{ + Q_ASSERT(row >= 0 && row < count()); + + while(row > cache.lastIndex()) + cache.append(slowFetchRecord(cache.lastIndex()+1)); + while(row < cache.firstIndex()) + cache.prepend(slowFetchRecord(cache.firstIndex()-1)); + + return cache.at(row); +} +\endcode + + If the cache is full then the item with the furthest index from where + the new item is appended or prepended is removed. + + This usage can be further optimized by using the insert() function + in the case where the requested row is a long way from the currently cached + items. If there is a is a gap between where the new item is inserted and the currently + cached items then the existing cached items are first removed to retain + the contiguous nature of the cache. Hence it is important to take some care then + when using insert() in order to avoid to unwanted clearing of the cache. + + See the The \l{Contiguous Cache Example}{Contiguous Cache} example. +*/ + +/*! \fn QContiguousCache::QContiguousCache(int capacity) + + Constructs a cache with the given \a capacity. + + \sa setCapacity() +*/ + +/*! \fn QContiguousCache::QContiguousCache(const QContiguousCache &other) + + Constructs a copy of \a other. + + This operation takes \l{constant time}, because QContiguousCache is + \l{implicitly shared}. This makes returning a QContiguousCache from a + function very fast. If a shared instance is modified, it will be + copied (copy-on-write), and that takes \l{linear time}. + + \sa operator=() +*/ + +/*! \fn QContiguousCache::~QContiguousCache() + Destroys the cache. +*/ + +/*! \fn void QContiguousCache::detach() + + \internal +*/ + +/*! \fn bool QContiguousCache::isDetached() const + + \internal +*/ + +/*! \fn void QContiguousCache::setSharable(bool sharable) + + \internal +*/ + + +/*! \fn QContiguousCache &QContiguousCache::operator=(const QContiguousCache &other) + + Assigns \a other to this cache and returns a reference to this cache. +*/ + +/*! \fn bool QContiguousCache::operator==(const QContiguousCache &other) const + + Returns true if \a other is equal to this cache; otherwise returns false. + + Two cache are considered equal if they contain the same values at the same + indexes. This function requires the value type to implement the \c operator==(). + + \sa operator!=() +*/ + +/*! \fn bool QContiguousCache::operator!=(const QContiguousCache &other) const + + Returns true if \a other is not equal to this cache; otherwise + returns false. + + Two cache are considered equal if they contain the same values at the same + indexes. This function requires the value type to implement the \c operator==(). + + \sa operator==() +*/ + +/*! \fn int QContiguousCache::capacity() const + + Returns the number of items the cache can store before it is full. + When a cache contains a number of items equal to its capacity, adding new + items will cause items furthest from the added item to be removed. + + \sa setCapacity(), size() +*/ + +/*! \fn int QContiguousCache::count() const + + \overload + + Same as size(). +*/ + +/*! \fn int QContiguousCache::size() const + + Returns the number of items contained within the cache. + + \sa capacity() +*/ + +/*! \fn bool QContiguousCache::isEmpty() const + + Returns true if no items are stored within the cache. + + \sa size(), capacity() +*/ + +/*! \fn bool QContiguousCache::isFull() const + + Returns true if the number of items stored within the cache is equal + to the capacity of the cache. + + \sa size(), capacity() +*/ + +/*! \fn int QContiguousCache::available() const + + Returns the number of items that can be added to the cache before it becomes full. + + \sa size(), capacity(), isFull() +*/ + +/*! \fn void QContiguousCache::clear() + + Removes all items from the cache. The capacity is unchanged. +*/ + +/*! \fn void QContiguousCache::setCapacity(int size) + + Sets the capacity of the cache to the given \a size. A cache can hold a + number of items equal to its capacity. When inserting, appending or prepending + items to the cache, if the cache is already full then the item furthest from + the added item will be removed. + + If the given \a size is smaller than the current count of items in the cache + then only the last \a size items from the cache will remain. + + \sa capacity(), isFull() +*/ + +/*! \fn const T &QContiguousCache::at(int i) const + + Returns the item at index position \a i in the cache. \a i must + be a valid index position in the cache (i.e, firstIndex() <= \a i <= lastIndex()). + + The indexes in the cache refer to number of positions the item is from the + first item appended into the cache. That is to say a cache with a capacity of + 100, that has had 150 items appended will have a valid index range of + 50 to 149. This allows inserting an retrieving items into the cache based + on a theoretical infinite list + + \sa firstIndex(), lastIndex(), insert(), operator[]() +*/ + +/*! \fn T &QContiguousCache::operator[](int i) + + Returns the item at index position \a i as a modifiable reference. If + the cache does not contain an item at the given index position \a i + then it will first insert an empty item at that position. + + In most cases it is better to use either at() or insert(). + + Note that using non-const operators can cause QContiguousCache to do a deep + copy. + + \sa insert(), at() +*/ + +/*! \fn const T &QContiguousCache::operator[](int i) const + + \overload + + Same as at(\a i). +*/ + +/*! \fn void QContiguousCache::append(const T &value) + + Inserts \a value at the end of the cache. If the cache is already full + the item at the start of the cache will be removed. + + \sa prepend(), insert(), isFull() +*/ + +/*! \fn void QContiguousCache::prepend(const T &value) + + Inserts \a value at the start of the cache. If the cache is already full + the item at the end of the cache will be removed. + + \sa append(), insert(), isFull() +*/ + +/*! \fn void QContiguousCache::insert(int i, const T &value) + + Inserts the \a value at the index position \a i. If the cache already contains + an item at \a i then that value is replaced. If \a i is either one more than + lastIndex() or one less than firstIndex() it is the equivalent to an append() + or a prepend(). + + If the given index \a i is not within the current range of the cache nor adjacent + to the bounds of the cache's index range the cache is first cleared before + inserting the item. At this point the cache will have a size of 1. It is worth + while then taking effort to insert items in an order that starts adjacent to the + current index range for the cache. + + \sa prepend(), append(), isFull(), firstIndex(), lastIndex() +*/ + +/*! \fn bool QContiguousCache::containsIndex(int i) const + + Returns true if the cache's index range includes the given index \a i. + + \sa firstIndex(), lastIndex() +*/ + +/*! \fn int QContiguousCache::firstIndex() const + Returns the first valid index in the cache. The index will be invalid if the + cache is empty. However the following code is valid even when the cache is empty: + + \code + for (int i = cache.firstIndex(); i <= cache.lastIndex(); ++i) + qDebug() << "Item" << i << "of the cache is" << cache.at(i); + \endcode + + \sa capacity(), size(), lastIndex() +*/ + +/*! \fn int QContiguousCache::lastIndex() const + + Returns the last valid index in the cache. If the cache is empty will return -1. + + \code + for (int i = cache.firstIndex(); i <= cache.lastIndex(); ++i) + qDebug() << "Item" << i << "of the cache is" << cache.at(i); + \endcode + + \sa capacity(), size(), firstIndex() +*/ + + +/*! \fn T &QContiguousCache::first() + + Returns a reference to the first item in the cache. This function + assumes that the cache isn't empty. + + \sa last(), isEmpty() +*/ + +/*! \fn T &QContiguousCache::last() + + Returns a reference to the last item in the cache. This function + assumes that the cache isn't empty. + + \sa first(), isEmpty() +*/ + +/*! \fn const T& QContiguousCache::first() const + + \overload +*/ + +/*! \fn const T& QContiguousCache::last() const + + \overload +*/ + +/*! \fn void QContiguousCache::removeFirst() + + Removes the first item from the cache. This function assumes that + the cache isn't empty. + + \sa removeLast() +*/ + +/*! \fn void QContiguousCache::removeLast() + + Removes the last item from the cache. This function assumes that + the cache isn't empty. + + \sa removeFirst() +*/ + +/*! \fn T QContiguousCache::takeFirst() + + Removes the first item in the cache and returns it. + + If you don't sue the return value, removeFirst() is more efficient. + + \sa takeLast(), removeFirst() +*/ + +/*! \fn T QContiguousCache::takeLast() + + Removes the last item in the cache and returns it. + + If you don't sue the return value, removeLast() is more efficient. + + \sa takeFirst(), removeLast() +*/ + +/*! \fn void QContiguousCache::dump() const + + \internal + + Sends information about the cache's internal structure to qDebug() +*/ diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h new file mode 100644 index 0000000..03012a2 --- /dev/null +++ b/src/corelib/tools/qcontiguouscache.h @@ -0,0 +1,386 @@ +/**************************************************************************** +** +** 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 QCONTIGUOUSCACHE_H +#define QCONTIGUOUSCACHE_H + +#include + +struct QContiguousCacheData +{ + QBasicAtomicInt ref; + int alloc; + int count; + int start; + int offset; + uint sharable : 1; + + void dump() const; +}; + +template +struct QContiguousCacheTypedData +{ + QBasicAtomicInt ref; + int alloc; + int count; + int start; + int offset; + uint sharable : 1; + + T array[1]; +}; + +class QContiguousCacheDevice; + +template +class QContiguousCache { + typedef QContiguousCacheTypedData Data; + union { QContiguousCacheData *p; QContiguousCacheTypedData *d; }; +public: + explicit QContiguousCache(int capacity = 0); + QContiguousCache(const QContiguousCache &v) : d(v.d) { d->ref.ref(); if (!d->sharable) detach_helper(); } + + inline ~QContiguousCache() { if (!d) return; if (!d->ref.deref()) free(d); } + + inline void detach() { if (d->ref != 1) detach_helper(); } + inline bool isDetached() const { return d->ref == 1; } + inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + + QContiguousCache &operator=(const QContiguousCache &other); + bool operator==(const QContiguousCache &other) const; + inline bool operator!=(const QContiguousCache &other) const { return !(*this == other); } + + inline int capacity() const {return d->alloc; } + inline int count() const { return d->count; } + inline int size() const { return d->count; } + + inline bool isEmpty() const { return d->count == 0; } + inline bool isFull() const { return d->count == d->alloc; } + inline int available() const { return d->alloc - d->count; } + + void clear(); + void setCapacity(int size); + + const T &at(int pos) const; + T &operator[](int i); + const T &operator[](int i) const; + + void append(const T &value); + void prepend(const T &value); + void insert(int pos, const T &value); + + inline bool containsIndex(int pos) const { return pos >= d->offset && pos - d->offset < d->count; } + inline int firstIndex() const { return d->offset; } + inline int lastIndex() const { return d->offset + d->count - 1; } + + inline const T &first() const { Q_ASSERT(!isEmpty()); return d->array[d->start]; } + inline const T &last() const { Q_ASSERT(!isEmpty()); return d->array[(d->start + d->count -1) % d->alloc]; } + inline T &first() { Q_ASSERT(!isEmpty()); detach(); return d->array[d->start]; } + inline T &last() { Q_ASSERT(!isEmpty()); detach(); return d->array[(d->start + d->count -1) % d->alloc]; } + + void removeFirst(); + T takeFirst(); + void removeLast(); + T takeLast(); + + // debug + void dump() const { p->dump(); } +private: + void detach_helper(); + + QContiguousCacheData *malloc(int alloc); + void free(Data *d); + int sizeOfTypedData() { + // this is more or less the same as sizeof(Data), except that it doesn't + // count the padding at the end + return reinterpret_cast(&(reinterpret_cast(this))->array[1]) - reinterpret_cast(this); + } +}; + +template +void QContiguousCache::detach_helper() +{ + union { QContiguousCacheData *p; QContiguousCacheTypedData *d; } x; + + x.p = malloc(d->alloc); + x.d->ref = 1; + x.d->count = d->count; + x.d->start = d->start; + x.d->offset = d->offset; + x.d->alloc = d->alloc; + x.d->sharable = true; + + T *dest = x.d->array + x.d->start; + T *src = d->array + d->start; + int count = x.d->count; + while (count--) { + if (QTypeInfo::isComplex) { + new (dest) T(*src); + } else { + *dest = *src; + } + dest++; + if (dest == x.d->array + x.d->alloc) + dest = x.d->array; + src++; + if (src == d->array + d->alloc) + src = d->array; + } + + if (!d->ref.deref()) + free(d); + d = x.d; +} + +template +void QContiguousCache::setCapacity(int asize) +{ + if (asize == d->alloc) + return; + detach(); + union { QContiguousCacheData *p; QContiguousCacheTypedData *d; } x; + x.p = malloc(asize); + x.d->alloc = asize; + x.d->count = qMin(d->count, asize); + x.d->offset = d->offset + d->count - x.d->count; + x.d->start = x.d->offset % x.d->alloc; + /* deep copy - + slow way now, get unit test working, then + improve performance if need be. (e.g. memcpy) + */ + T *dest = x.d->array + (x.d->start + x.d->count-1) % x.d->alloc; + T *src = d->array + (d->start + d->count-1) % d->alloc; + int count = x.d->count; + while (count--) { + if (QTypeInfo::isComplex) { + new (dest) T(*src); + } else { + *dest = *src; + } + if (dest == x.d->array) + dest = x.d->array + x.d->alloc; + dest--; + if (src == d->array) + src = d->array + d->alloc; + src--; + } + /* free old */ + free(d); + d = x.d; +} + +template +void QContiguousCache::clear() +{ + if (d->ref == 1) { + if (QTypeInfo::isComplex) { + int count = d->count; + T * i = d->array + d->start; + T * e = d->array + d->alloc; + while (count--) { + i->~T(); + i++; + if (i == e) + i = d->array; + } + } + d->count = d->start = d->offset = 0; + } else { + union { QContiguousCacheData *p; QContiguousCacheTypedData *d; } x; + x.p = malloc(d->alloc); + x.d->ref = 1; + x.d->alloc = d->alloc; + x.d->count = x.d->start = x.d->offset = 0; + x.d->sharable = true; + if (!d->ref.deref()) free(d); + d = x.d; + } +} + +template +inline QContiguousCacheData *QContiguousCache::malloc(int aalloc) +{ + return static_cast(qMalloc(sizeOfTypedData() + (aalloc - 1) * sizeof(T))); +} + +template +QContiguousCache::QContiguousCache(int asize) +{ + p = malloc(asize); + d->ref = 1; + d->alloc = asize; + d->count = d->start = d->offset = 0; + d->sharable = true; +} + +template +QContiguousCache &QContiguousCache::operator=(const QContiguousCache &other) +{ + other.d->ref.ref(); + if (!d->ref.deref()) + free(d); + d = other.d; + if (!d->sharable) + detach_helper(); + return *this; +} + +template +bool QContiguousCache::operator==(const QContiguousCache &other) const +{ + if (other.d == d) + return true; + if (other.d->start != d->start + || other.d->count != d->count + || other.d->offset != d->offset + || other.d->alloc != d->alloc) + return false; + for (int i = firstIndex(); i <= lastIndex(); ++i) + if (!(at(i) == other.at(i))) + return false; + return true; +} + +template +void QContiguousCache::free(Data *x) +{ + if (QTypeInfo::isComplex) { + int count = d->count; + T * i = d->array + d->start; + T * e = d->array + d->alloc; + while (count--) { + i->~T(); + i++; + if (i == e) + i = d->array; + } + } + qFree(x); +} + +template +void QContiguousCache::append(const T &value) +{ + detach(); + if (QTypeInfo::isComplex) { + if (d->count == d->alloc) + (d->array + (d->start+d->count) % d->alloc)->~T(); + new (d->array + (d->start+d->count) % d->alloc) T(value); + } else { + d->array[(d->start+d->count) % d->alloc] = value; + } + + if (d->count == d->alloc) { + d->start++; + d->start %= d->alloc; + d->offset++; + } else { + d->count++; + } +} + +template +void QContiguousCache::prepend(const T &value) +{ + detach(); + if (d->start) + d->start--; + else + d->start = d->alloc-1; + d->offset--; + + if (d->count != d->alloc) + d->count++; + else + if (d->count == d->alloc) + (d->array + d->start)->~T(); + + if (QTypeInfo::isComplex) + new (d->array + d->start) T(value); + else + d->array[d->start] = value; +} + +template +void QContiguousCache::insert(int pos, const T &value) +{ + detach(); + if (containsIndex(pos)) { + if(QTypeInfo::isComplex) + new (d->array + pos % d->alloc) T(value); + else + d->array[pos % d->alloc] = value; + } else if (pos == d->offset-1) + prepend(value); + else if (pos == d->offset+d->count) + append(value); + else { + // we don't leave gaps. + clear(); + d->offset = d->start = pos; + d->start %= d->alloc; + d->count = 1; + if (QTypeInfo::isComplex) + new (d->array + d->start) T(value); + else + d->array[d->start] = value; + } +} + +template +inline const T &QContiguousCache::at(int pos) const +{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache::at", "index out of range"); return d->array[pos % d->alloc]; } +template +inline const T &QContiguousCache::operator[](int pos) const +{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache::at", "index out of range"); return d->array[pos % d->alloc]; } +template + +// can use the non-inline one to modify the index range. +inline T &QContiguousCache::operator[](int pos) +{ + detach(); + if (!containsIndex(pos)) + insert(pos, T()); + return d->array[pos % d->alloc]; +} + +template +inline void QContiguousCache::removeFirst() +{ + Q_ASSERT(d->count > 0); + detach(); + d->count--; + if (QTypeInfo::isComplex) + (d->array + d->start)->~T(); + d->start = (d->start + 1) % d->alloc; + d->offset++; +} + +template +inline void QContiguousCache::removeLast() +{ + Q_ASSERT(d->count > 0); + detach(); + d->count--; + if (QTypeInfo::isComplex) + (d->array + (d->start + d->count) % d->alloc)->~T(); +} + +template +inline T QContiguousCache::takeFirst() +{ T t = first(); removeFirst(); return t; } + +template +inline T QContiguousCache::takeLast() +{ T t = last(); removeLast(); return t; } + +#endif diff --git a/src/corelib/tools/qoffsetvector.cpp b/src/corelib/tools/qoffsetvector.cpp deleted file mode 100644 index 32d2872..0000000 --- a/src/corelib/tools/qoffsetvector.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/**************************************************************************** -** -** 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 "qoffsetvector.h" -#include - -void QOffsetVectorData::dump() const -{ - qDebug() << "capacity:" << alloc; - qDebug() << "count:" << count; - qDebug() << "start:" << start; - qDebug() << "offset:" << offset; -} - -/*! \class QOffsetVector - \brief The QOffsetVector class is a template class that provides a offset vector. - \ingroup tools - \ingroup shared - \reentrant - - The QOffsetVector class provides an efficient way of caching items for - display in a user interface view. It does this by providing a window - into a theoretical infinite sized vector. This has the advantage that - it matches how user interface views most commonly request the data, in - a set of rows localized around the current scrolled position. It also - allows the cache to use less overhead than QCache both in terms of - performance and memory. In turn, unlike a QCache, the key has to be - an int and has to be contiguous. That is to say if an item is inserted - at index 85, then if there were no previous items at 84 or 86 then the - cache will be cleared before the new item at 85 is inserted. If this - restriction is not suitable consider using QCache instead. - - The simplest way of using an offset vector is to use the append() - and prepend() functions to slide the window to where it is needed. - -\code -MyRecord record(int row) const -{ - Q_ASSERT(row >= 0 && row < count()); - - while(row > cache.lastIndex()) - cache.append(slowFetchRecord(cache.lastIndex()+1)); - while(row < cache.firstIndex()) - cache.prepend(slowFetchRecord(cache.firstIndex()-1)); - - return cache.at(row); -} -\endcode - - The append() and prepend() functions cause the vector window to move to - where the current row is requested from. This usage can be further - optimized by using the insert() function to reset the vector window to - a row in the case where the row is a long way from the current row. It - may also be worth while to fetch multiple records into the cache if - it is faster to retrieve them in a batch operation. - - See the The \l{Offset Vector Example}{Offset Vector} example. -*/ - -/*! \fn QOffsetVector::QOffsetVector(int capacity) - - Constructs a vector with the given \a capacity. - - \sa setCapacity() -*/ - -/*! \fn QOffsetVector::QOffsetVector(const QOffsetVector &other) - - Constructs a copy of \a other. - - This operation takes \l{constant time}, because QOffsetVector is - \l{implicitly shared}. This makes returning a QOffsetVector from a - function very fast. If a shared instance is modified, it will be - copied (copy-on-write), and that takes \l{linear time}. - - \sa operator=() -*/ - -/*! \fn QOffsetVector::~QOffsetVector() - Destorys the vector. -*/ - -/*! \fn void QOffsetVector::detach() - - \internal -*/ - -/*! \fn bool QOffsetVector::isDetached() const - - \internal -*/ - -/*! \fn void QOffsetVector::setSharable(bool sharable) - - \internal -*/ - - -/*! \fn QOffsetVector &QOffsetVector::operator=(const QOffsetVector &other) - - Assigns \a other to this vector and returns a reference to this vector. -*/ - -/*! \fn bool QOffsetVector::operator==(const QOffsetVector &other) const - - Returns true if \a other is equal to this vector; otherwise returns false. - - Two vectors are considered equal if they contain the same values at the same - indexes. This function requires the value type to implement the \c operator==(). - - \sa operator!=() -*/ - -/*! \fn bool QOffsetVector::operator!=(const QOffsetVector &other) const - - Returns true if \a other is not equal to this vector; otherwise - returns false. - - Two vector are considered equal if they contain the same values at the same - indexes. This function requires the value type to implement the \c operator==(). - - \sa operator==() -*/ - -/*! \fn int QOffsetVector::capacity() const - - Returns the number of items the vector can store before it is full. - When a vector contains a number of items equal to its capacity, adding new - items will cause items furthest from the added item to be removed. - - \sa setCapacity(), size() -*/ - -/*! \fn int QOffsetVector::count() const - - \overload - - Same as size(). -*/ - -/*! \fn int QOffsetVector::size() const - - Returns the number of items contained within the vector. - - \sa capacity() -*/ - -/*! \fn bool QOffsetVector::isEmpty() const - - Returns true if no items are stored within the vector. - - \sa size(), capacity() -*/ - -/*! \fn bool QOffsetVector::isFull() const - - Returns true if the number of items stored within the vector is equal - to the capacity of the vector. - - \sa size(), capacity() -*/ - -/*! \fn int QOffsetVector::available() const - - Returns the number of items that can be added to the vector before it becomes full. - - \sa size(), capacity(), isFull() -*/ - -/*! \fn void QOffsetVector::clear() - - Removes all items from the vector. The capacity is unchanged. -*/ - -/*! \fn void QOffsetVector::setCapacity(int size) - - Sets the capacity of the vector to the given \a size. A vector can hold a - number of items equal to its capacity. When inserting, appending or prepending - items to the vector, if the vector is already full then the item furthest from - the added item will be removed. - - If the given \a size is smaller than the current count of items in the vector - then only the last \a size items from the vector will remain. - - \sa capacity(), isFull() -*/ - -/*! \fn const T &QOffsetVector::at(int i) const - - Returns the item at index position \a i in the vector. \a i must - be a valid index position in the vector (i.e, firstIndex() <= \a i <= lastIndex()). - - The indexes in the vector refer to number of positions the item is from the - first item appended into the vector. That is to say a vector with a capacity of - 100, that has had 150 items appended will have a valid index range of - 50 to 149. This allows inserting an retrieving items into the vector based - on a theoretical infinite list - - \sa firstIndex(), lastIndex(), insert(), operator[]() -*/ - -/*! \fn T &QOffsetVector::operator[](int i) - - Returns the item at index position \a i as a modifiable reference. If - the vector does not contain an item at the given index position \a i - then it will first insert an empty item at that position. - - In most cases it is better to use either at() or insert(). - - Note that using non-const operators can cause QOffsetVector to do a deep - copy. - - \sa insert(), at() -*/ - -/*! \fn const T &QOffsetVector::operator[](int i) const - - \overload - - Same as at(\a i). -*/ - -/*! \fn void QOffsetVector::append(const T &value) - - Inserts \a value at the end of the vector. If the vector is already full - the item at the start of the vector will be removed. - - \sa prepend(), insert(), isFull() -*/ - -/*! \fn void QOffsetVector::prepend(const T &value) - - Inserts \a value at the start of the vector. If the vector is already full - the item at the end of the vector will be removed. - - \sa append(), insert(), isFull() -*/ - -/*! \fn void QOffsetVector::insert(int i, const T &value) - - Inserts the \a value at the index position \a i. If the vector already contains - an item at \a i then that value is replaced. If \a i is either one more than - lastIndex() or one less than firstIndex() it is the equivalent to an append() - or a prepend(). - - If the given index \a i is not within the current range of the vector nor adjacent - to the bounds of the vector's index range the vector is first cleared before - inserting the item. At this point the vector will have a size of 1. It is worth - while then taking effort to insert items in an order than starts adjacent to the - current index range for the vector. - - \sa prepend(), append(), isFull(), firstIndex(), lastIndex() -*/ - -/*! \fn bool QOffsetVector::containsIndex(int i) const - - Returns true if the vector's index range includes the given index \a i. - - \sa firstIndex(), lastIndex() -*/ - -/*! \fn int QOffsetVector::firstIndex() const - Returns the first valid index in the vector. The index will be invalid if the - vector is empty. However the following code is valid even when the vector is empty: - - \code - for (int i = vector.firstIndex(); i <= vector.lastIndex(); ++i) - qDebug() << "Item" << i << "of the vector is" << vector.at(i); - \endcode - - \sa capacity(), size(), lastIndex() -*/ - -/*! \fn int QOffsetVector::lastIndex() const - - Returns the last valid index in the vector. If the vector is empty will return -1. - - \code - for (int i = vector.firstIndex(); i <= vector.lastIndex(); ++i) - qDebug() << "Item" << i << "of the vector is" << vector.at(i); - \endcode - - \sa capacity(), size(), firstIndex() -*/ - - -/*! \fn T &QOffsetVector::first() - - Returns a reference to the first item in the vector. This function - assumes that the vector isn't empty. - - \sa last(), isEmpty() -*/ - -/*! \fn T &QOffsetVector::last() - - Returns a reference to the last item in the vector. This function - assumes that the vector isn't empty. - - \sa first(), isEmpty() -*/ - -/*! \fn const T& QOffsetVector::first() const - - \overload -*/ - -/*! \fn const T& QOffsetVector::last() const - - \overload -*/ - -/*! \fn void QOffsetVector::removeFirst() - - Removes the first item from the vector. This function assumes that - the vector isn't empty. - - \sa removeLast() -*/ - -/*! \fn void QOffsetVector::removeLast() - - Removes the last item from the vector. This function assumes that - the vector isn't empty. - - \sa removeFirst() -*/ - -/*! \fn T QOffsetVector::takeFirst() - - Removes the first item in the vector and returns it. - - If you don't sue the return value, removeFirst() is more efficient. - - \sa takeLast(), removeFirst() -*/ - -/*! \fn T QOffsetVector::takeLast() - - Removes the last item in the vector and returns it. - - If you don't sue the return value, removeLast() is more efficient. - - \sa takeFirst(), removeLast() -*/ - -/*! \fn void QOffsetVector::dump() const - - \internal - - Sends information about the vector's internal structure to qDebug() -*/ diff --git a/src/corelib/tools/qoffsetvector.h b/src/corelib/tools/qoffsetvector.h deleted file mode 100644 index 7030862..0000000 --- a/src/corelib/tools/qoffsetvector.h +++ /dev/null @@ -1,386 +0,0 @@ -/**************************************************************************** -** -** 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 QCIRCULARBUFFER_H -#define QCIRCULARBUFFER_H - -#include - -struct QOffsetVectorData -{ - QBasicAtomicInt ref; - int alloc; - int count; - int start; - int offset; - uint sharable : 1; - - void dump() const; -}; - -template -struct QOffsetVectorTypedData -{ - QBasicAtomicInt ref; - int alloc; - int count; - int start; - int offset; - uint sharable : 1; - - T array[1]; -}; - -class QOffsetVectorDevice; - -template -class QOffsetVector { - typedef QOffsetVectorTypedData Data; - union { QOffsetVectorData *p; QOffsetVectorTypedData *d; }; -public: - explicit QOffsetVector(int capacity = 0); - QOffsetVector(const QOffsetVector &v) : d(v.d) { d->ref.ref(); if (!d->sharable) detach_helper(); } - - inline ~QOffsetVector() { if (!d) return; if (!d->ref.deref()) free(d); } - - inline void detach() { if (d->ref != 1) detach_helper(); } - inline bool isDetached() const { return d->ref == 1; } - inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } - - QOffsetVector &operator=(const QOffsetVector &other); - bool operator==(const QOffsetVector &other) const; - inline bool operator!=(const QOffsetVector &other) const { return !(*this == other); } - - inline int capacity() const {return d->alloc; } - inline int count() const { return d->count; } - inline int size() const { return d->count; } - - inline bool isEmpty() const { return d->count == 0; } - inline bool isFull() const { return d->count == d->alloc; } - inline int available() const { return d->alloc - d->count; } - - void clear(); - void setCapacity(int size); - - const T &at(int pos) const; - T &operator[](int i); - const T &operator[](int i) const; - - void append(const T &value); - void prepend(const T &value); - void insert(int pos, const T &value); - - inline bool containsIndex(int pos) const { return pos >= d->offset && pos - d->offset < d->count; } - inline int firstIndex() const { return d->offset; } - inline int lastIndex() const { return d->offset + d->count - 1; } - - inline const T &first() const { Q_ASSERT(!isEmpty()); return d->array[d->start]; } - inline const T &last() const { Q_ASSERT(!isEmpty()); return d->array[(d->start + d->count -1) % d->alloc]; } - inline T &first() { Q_ASSERT(!isEmpty()); detach(); return d->array[d->start]; } - inline T &last() { Q_ASSERT(!isEmpty()); detach(); return d->array[(d->start + d->count -1) % d->alloc]; } - - void removeFirst(); - T takeFirst(); - void removeLast(); - T takeLast(); - - // debug - void dump() const { p->dump(); } -private: - void detach_helper(); - - QOffsetVectorData *malloc(int alloc); - void free(Data *d); - int sizeOfTypedData() { - // this is more or less the same as sizeof(Data), except that it doesn't - // count the padding at the end - return reinterpret_cast(&(reinterpret_cast(this))->array[1]) - reinterpret_cast(this); - } -}; - -template -void QOffsetVector::detach_helper() -{ - union { QOffsetVectorData *p; QOffsetVectorTypedData *d; } x; - - x.p = malloc(d->alloc); - x.d->ref = 1; - x.d->count = d->count; - x.d->start = d->start; - x.d->offset = d->offset; - x.d->alloc = d->alloc; - x.d->sharable = true; - - T *dest = x.d->array + x.d->start; - T *src = d->array + d->start; - int count = x.d->count; - while (count--) { - if (QTypeInfo::isComplex) { - new (dest) T(*src); - } else { - *dest = *src; - } - dest++; - if (dest == x.d->array + x.d->alloc) - dest = x.d->array; - src++; - if (src == d->array + d->alloc) - src = d->array; - } - - if (!d->ref.deref()) - free(d); - d = x.d; -} - -template -void QOffsetVector::setCapacity(int asize) -{ - if (asize == d->alloc) - return; - detach(); - union { QOffsetVectorData *p; QOffsetVectorTypedData *d; } x; - x.p = malloc(asize); - x.d->alloc = asize; - x.d->count = qMin(d->count, asize); - x.d->offset = d->offset + d->count - x.d->count; - x.d->start = x.d->offset % x.d->alloc; - /* deep copy - - slow way now, get unit test working, then - improve performance if need be. (e.g. memcpy) - */ - T *dest = x.d->array + (x.d->start + x.d->count-1) % x.d->alloc; - T *src = d->array + (d->start + d->count-1) % d->alloc; - int count = x.d->count; - while (count--) { - if (QTypeInfo::isComplex) { - new (dest) T(*src); - } else { - *dest = *src; - } - if (dest == x.d->array) - dest = x.d->array + x.d->alloc; - dest--; - if (src == d->array) - src = d->array + d->alloc; - src--; - } - /* free old */ - free(d); - d = x.d; -} - -template -void QOffsetVector::clear() -{ - if (d->ref == 1) { - if (QTypeInfo::isComplex) { - int count = d->count; - T * i = d->array + d->start; - T * e = d->array + d->alloc; - while (count--) { - i->~T(); - i++; - if (i == e) - i = d->array; - } - } - d->count = d->start = d->offset = 0; - } else { - union { QOffsetVectorData *p; QOffsetVectorTypedData *d; } x; - x.p = malloc(d->alloc); - x.d->ref = 1; - x.d->alloc = d->alloc; - x.d->count = x.d->start = x.d->offset = 0; - x.d->sharable = true; - if (!d->ref.deref()) free(d); - d = x.d; - } -} - -template -inline QOffsetVectorData *QOffsetVector::malloc(int aalloc) -{ - return static_cast(qMalloc(sizeOfTypedData() + (aalloc - 1) * sizeof(T))); -} - -template -QOffsetVector::QOffsetVector(int asize) -{ - p = malloc(asize); - d->ref = 1; - d->alloc = asize; - d->count = d->start = d->offset = 0; - d->sharable = true; -} - -template -QOffsetVector &QOffsetVector::operator=(const QOffsetVector &other) -{ - other.d->ref.ref(); - if (!d->ref.deref()) - free(d); - d = other.d; - if (!d->sharable) - detach_helper(); - return *this; -} - -template -bool QOffsetVector::operator==(const QOffsetVector &other) const -{ - if (other.d == d) - return true; - if (other.d->start != d->start - || other.d->count != d->count - || other.d->offset != d->offset - || other.d->alloc != d->alloc) - return false; - for (int i = firstIndex(); i <= lastIndex(); ++i) - if (!(at(i) == other.at(i))) - return false; - return true; -} - -template -void QOffsetVector::free(Data *x) -{ - if (QTypeInfo::isComplex) { - int count = d->count; - T * i = d->array + d->start; - T * e = d->array + d->alloc; - while (count--) { - i->~T(); - i++; - if (i == e) - i = d->array; - } - } - qFree(x); -} - -template -void QOffsetVector::append(const T &value) -{ - detach(); - if (QTypeInfo::isComplex) { - if (d->count == d->alloc) - (d->array + (d->start+d->count) % d->alloc)->~T(); - new (d->array + (d->start+d->count) % d->alloc) T(value); - } else { - d->array[(d->start+d->count) % d->alloc] = value; - } - - if (d->count == d->alloc) { - d->start++; - d->start %= d->alloc; - d->offset++; - } else { - d->count++; - } -} - -template -void QOffsetVector::prepend(const T &value) -{ - detach(); - if (d->start) - d->start--; - else - d->start = d->alloc-1; - d->offset--; - - if (d->count != d->alloc) - d->count++; - else - if (d->count == d->alloc) - (d->array + d->start)->~T(); - - if (QTypeInfo::isComplex) - new (d->array + d->start) T(value); - else - d->array[d->start] = value; -} - -template -void QOffsetVector::insert(int pos, const T &value) -{ - detach(); - if (containsIndex(pos)) { - if(QTypeInfo::isComplex) - new (d->array + pos % d->alloc) T(value); - else - d->array[pos % d->alloc] = value; - } else if (pos == d->offset-1) - prepend(value); - else if (pos == d->offset+d->count) - append(value); - else { - // we don't leave gaps. - clear(); - d->offset = d->start = pos; - d->start %= d->alloc; - d->count = 1; - if (QTypeInfo::isComplex) - new (d->array + d->start) T(value); - else - d->array[d->start] = value; - } -} - -template -inline const T &QOffsetVector::at(int pos) const -{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QOffsetVector::at", "index out of range"); return d->array[pos % d->alloc]; } -template -inline const T &QOffsetVector::operator[](int pos) const -{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QOffsetVector::at", "index out of range"); return d->array[pos % d->alloc]; } -template - -// can use the non-inline one to modify the index range. -inline T &QOffsetVector::operator[](int pos) -{ - detach(); - if (!containsIndex(pos)) - insert(pos, T()); - return d->array[pos % d->alloc]; -} - -template -inline void QOffsetVector::removeFirst() -{ - Q_ASSERT(d->count > 0); - detach(); - d->count--; - if (QTypeInfo::isComplex) - (d->array + d->start)->~T(); - d->start = (d->start + 1) % d->alloc; - d->offset++; -} - -template -inline void QOffsetVector::removeLast() -{ - Q_ASSERT(d->count > 0); - detach(); - d->count--; - if (QTypeInfo::isComplex) - (d->array + (d->start + d->count) % d->alloc)->~T(); -} - -template -inline T QOffsetVector::takeFirst() -{ T t = first(); removeFirst(); return t; } - -template -inline T QOffsetVector::takeLast() -{ T t = last(); removeLast(); return t; } - -#endif diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 626c9e5..aaf3f21 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -19,7 +19,7 @@ HEADERS += \ tools/qlocale_p.h \ tools/qlocale_data_p.h \ tools/qmap.h \ - tools/qoffsetvector.h \ + tools/qcontiguouscache.h \ tools/qpodlist_p.h \ tools/qpoint.h \ tools/qqueue.h \ @@ -54,7 +54,7 @@ SOURCES += \ tools/qlocale.cpp \ tools/qpoint.cpp \ tools/qmap.cpp \ - tools/qoffsetvector.cpp \ + tools/qcontiguouscache.cpp \ tools/qrect.cpp \ tools/qregexp.cpp \ tools/qshareddata.cpp \ diff --git a/tests/auto/qcontiguouscache/qcontiguouscache.pro b/tests/auto/qcontiguouscache/qcontiguouscache.pro new file mode 100644 index 0000000..618efed --- /dev/null +++ b/tests/auto/qcontiguouscache/qcontiguouscache.pro @@ -0,0 +1,8 @@ +load(qttest_p4) + +QT = core + +SOURCES += tst_qcontiguouscache.cpp + + + diff --git a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp new file mode 100644 index 0000000..493032a --- /dev/null +++ b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp @@ -0,0 +1,361 @@ +/**************************************************************************** +** +** This file is part of the $PACKAGE_NAME$. +** +** Copyright (C) $THISYEAR$ $COMPANY_NAME$. +** +** $QT_EXTENDED_DUAL_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include +#include + + +#if defined(FORCE_UREF) +template +inline QDebug &operator<<(QDebug debug, const QContiguousCache &contiguousCache) +#else +template +inline QDebug operator<<(QDebug debug, const QContiguousCache &contiguousCache) +#endif +{ + debug.nospace() << "QContiguousCache("; + for (int i = contiguousCache.firstIndex(); i <= contiguousCache.lastIndex(); ++i) { + debug << contiguousCache[i]; + if (i != contiguousCache.lastIndex()) + debug << ", "; + } + debug << ")"; + return debug.space(); +} + +#if defined(NO_BENCHMARK) and defined(QBENCHMARK) +#undef QBENCHMARK +#define QBENCHMARK +#endif + +class tst_QContiguousCache : public QObject +{ + Q_OBJECT +public: + tst_QContiguousCache() {} + virtual ~tst_QContiguousCache() {} +private slots: + void empty(); + void forwardBuffer(); + void scrollingList(); + + void complexType(); + + void operatorAt(); + + void cacheBenchmark(); + void contiguousCacheBenchmark(); + + void setCapacity(); +}; + +QTEST_MAIN(tst_QContiguousCache) + +void tst_QContiguousCache::empty() +{ + QContiguousCache c(10); + QCOMPARE(c.capacity(), 10); + QCOMPARE(c.count(), 0); + QVERIFY(c.isEmpty()); + c.append(1); + QVERIFY(!c.isEmpty()); + c.clear(); + QCOMPARE(c.capacity(), 10); + QCOMPARE(c.count(), 0); + QVERIFY(c.isEmpty()); + c.prepend(1); + QVERIFY(!c.isEmpty()); + c.clear(); + QCOMPARE(c.count(), 0); + QVERIFY(c.isEmpty()); + QCOMPARE(c.capacity(), 10); +} + +void tst_QContiguousCache::forwardBuffer() +{ + int i; + QContiguousCache c(10); + for(i = 1; i < 30; ++i) { + c.append(i); + QCOMPARE(c.first(), qMax(1, i-9)); + QCOMPARE(c.last(), i); + QCOMPARE(c.count(), qMin(i, 10)); + } + + c.clear(); + + for(i = 1; i < 30; ++i) { + c.prepend(i); + QCOMPARE(c.last(), qMax(1, i-9)); + QCOMPARE(c.first(), i); + QCOMPARE(c.count(), qMin(i, 10)); + } +} + +void tst_QContiguousCache::scrollingList() +{ + int i; + QContiguousCache c(10); + + // Once allocated QContiguousCache should not + // allocate any additional memory for non + // complex data types. + QBENCHMARK { + // simulate scrolling in a list of items; + for(i = 0; i < 10; ++i) + c.append(i); + + QCOMPARE(c.firstIndex(), 0); + QCOMPARE(c.lastIndex(), 9); + QVERIFY(c.containsIndex(0)); + QVERIFY(c.containsIndex(9)); + QVERIFY(!c.containsIndex(10)); + + for (i = 0; i < 10; ++i) + QCOMPARE(c.at(i), i); + + for (i = 10; i < 30; ++i) + c.append(i); + + QCOMPARE(c.firstIndex(), 20); + QCOMPARE(c.lastIndex(), 29); + QVERIFY(c.containsIndex(20)); + QVERIFY(c.containsIndex(29)); + QVERIFY(!c.containsIndex(30)); + + for (i = 20; i < 30; ++i) + QCOMPARE(c.at(i), i); + + for (i = 19; i >= 10; --i) + c.prepend(i); + + QCOMPARE(c.firstIndex(), 10); + QCOMPARE(c.lastIndex(), 19); + QVERIFY(c.containsIndex(10)); + QVERIFY(c.containsIndex(19)); + QVERIFY(!c.containsIndex(20)); + + for (i = 10; i < 20; ++i) + QCOMPARE(c.at(i), i); + + for (i = 200; i < 220; ++i) + c.insert(i, i); + + QCOMPARE(c.firstIndex(), 210); + QCOMPARE(c.lastIndex(), 219); + QVERIFY(c.containsIndex(210)); + QVERIFY(c.containsIndex(219)); + QVERIFY(!c.containsIndex(300)); + QVERIFY(!c.containsIndex(209)); + + for (i = 220; i < 220; ++i) { + QVERIFY(c.containsIndex(i)); + QCOMPARE(c.at(i), i); + } + c.clear(); // needed to reset benchmark + } + + // from a specific bug that was encountered. 100 to 299 cached, attempted to cache 250 - 205 via insert, failed. + // bug was that item at 150 would instead be item that should have been inserted at 250 + c.setCapacity(200); + for(i = 100; i < 300; ++i) + c.insert(i, i); + for (i = 250; i <= 306; ++i) + c.insert(i, 1000+i); + for (i = 107; i <= 306; ++i) { + QVERIFY(c.containsIndex(i)); + QCOMPARE(c.at(i), i < 250 ? i : 1000+i); + } +} + +struct RefCountingClassData +{ + QBasicAtomicInt ref; + static RefCountingClassData shared_null; +}; + +RefCountingClassData RefCountingClassData::shared_null = { + Q_BASIC_ATOMIC_INITIALIZER(1) +}; + +class RefCountingClass +{ +public: + RefCountingClass() : d(&RefCountingClassData::shared_null) { d->ref.ref(); } + + RefCountingClass(const RefCountingClass &other) + { + d = other.d; + d->ref.ref(); + } + + ~RefCountingClass() + { + if (!d->ref.deref()) + delete d; + } + + RefCountingClass &operator=(const RefCountingClass &other) + { + if (!d->ref.deref()) + delete d; + d = other.d; + d->ref.ref(); + return *this; + } + + int refCount() const { return d->ref; } +private: + RefCountingClassData *d; +}; + +void tst_QContiguousCache::complexType() +{ + RefCountingClass original; + + QContiguousCache contiguousCache(10); + contiguousCache.append(original); + QCOMPARE(original.refCount(), 3); + contiguousCache.removeFirst(); + QCOMPARE(original.refCount(), 2); // shared null, 'original'. + contiguousCache.append(original); + QCOMPARE(original.refCount(), 3); + contiguousCache.clear(); + QCOMPARE(original.refCount(), 2); + + for(int i = 0; i < 100; ++i) + contiguousCache.insert(i, original); + + QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in contiguousCache. + + contiguousCache.clear(); + QCOMPARE(original.refCount(), 2); + for (int i = 0; i < 100; i++) + contiguousCache.append(original); + + QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in contiguousCache. + contiguousCache.clear(); + QCOMPARE(original.refCount(), 2); + + for (int i = 0; i < 100; i++) + contiguousCache.prepend(original); + + QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in contiguousCache. + contiguousCache.clear(); + QCOMPARE(original.refCount(), 2); + + for (int i = 0; i < 100; i++) + contiguousCache.append(original); + + contiguousCache.takeLast(); + QCOMPARE(original.refCount(), 11); + + contiguousCache.takeFirst(); + QCOMPARE(original.refCount(), 10); +} + +void tst_QContiguousCache::operatorAt() +{ + RefCountingClass original; + QContiguousCache contiguousCache(10); + + for (int i = 25; i < 35; ++i) + contiguousCache[i] = original; + + QCOMPARE(original.refCount(), 12); // shared null, orig, items in cache + + // verify const access does not copy items. + const QContiguousCache copy(contiguousCache); + for (int i = 25; i < 35; ++i) + QCOMPARE(copy[i].refCount(), 12); + + // verify modifying the original increments ref count (e.g. does a detach) + contiguousCache[25] = original; + QCOMPARE(original.refCount(), 22); +} + +/* + Benchmarks must be near identical in tasks to be fair. + QCache uses pointers to ints as its a requirement of QCache, + whereas QContiguousCache doesn't support pointers (won't free them). + Given the ability to use simple data types is a benefit, its + fair. Although this obviously must take into account we are + testing QContiguousCache use cases here, QCache has its own + areas where it is the more sensible class to use. +*/ +void tst_QContiguousCache::cacheBenchmark() +{ + QBENCHMARK { + QCache cache; + cache.setMaxCost(100); + + for (int i = 0; i < 1000; i++) + cache.insert(i, new int(i)); + } +} + +void tst_QContiguousCache::contiguousCacheBenchmark() +{ + QBENCHMARK { + QContiguousCache contiguousCache(100); + for (int i = 0; i < 1000; i++) + contiguousCache.insert(i, i); + } +} + +void tst_QContiguousCache::setCapacity() +{ + int i; + QContiguousCache contiguousCache(100); + for (i = 280; i < 310; ++i) + contiguousCache.insert(i, i); + QCOMPARE(contiguousCache.capacity(), 100); + QCOMPARE(contiguousCache.count(), 30); + QCOMPARE(contiguousCache.firstIndex(), 280); + QCOMPARE(contiguousCache.lastIndex(), 309); + + for (i = contiguousCache.firstIndex(); i <= contiguousCache.lastIndex(); ++i) { + QVERIFY(contiguousCache.containsIndex(i)); + QCOMPARE(contiguousCache.at(i), i); + } + + contiguousCache.setCapacity(150); + + QCOMPARE(contiguousCache.capacity(), 150); + QCOMPARE(contiguousCache.count(), 30); + QCOMPARE(contiguousCache.firstIndex(), 280); + QCOMPARE(contiguousCache.lastIndex(), 309); + + for (i = contiguousCache.firstIndex(); i <= contiguousCache.lastIndex(); ++i) { + QVERIFY(contiguousCache.containsIndex(i)); + QCOMPARE(contiguousCache.at(i), i); + } + + contiguousCache.setCapacity(20); + + QCOMPARE(contiguousCache.capacity(), 20); + QCOMPARE(contiguousCache.count(), 20); + QCOMPARE(contiguousCache.firstIndex(), 290); + QCOMPARE(contiguousCache.lastIndex(), 309); + + for (i = contiguousCache.firstIndex(); i <= contiguousCache.lastIndex(); ++i) { + QVERIFY(contiguousCache.containsIndex(i)); + QCOMPARE(contiguousCache.at(i), i); + } +} + +#include "tst_qcontiguouscache.moc" diff --git a/tests/auto/qoffsetvector/qoffsetvector.pro b/tests/auto/qoffsetvector/qoffsetvector.pro deleted file mode 100644 index 0b801f3..0000000 --- a/tests/auto/qoffsetvector/qoffsetvector.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) - -QT = core - -SOURCES += tst_qoffsetvector.cpp - - - diff --git a/tests/auto/qoffsetvector/tst_qoffsetvector.cpp b/tests/auto/qoffsetvector/tst_qoffsetvector.cpp deleted file mode 100644 index 439ea2c..0000000 --- a/tests/auto/qoffsetvector/tst_qoffsetvector.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/**************************************************************************** -** -** This file is part of the $PACKAGE_NAME$. -** -** Copyright (C) $THISYEAR$ $COMPANY_NAME$. -** -** $QT_EXTENDED_DUAL_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include -#include - - -#if defined(FORCE_UREF) -template -inline QDebug &operator<<(QDebug debug, const QOffsetVector &offsetVector) -#else -template -inline QDebug operator<<(QDebug debug, const QOffsetVector &offsetVector) -#endif -{ - debug.nospace() << "QOffsetVector("; - for (int i = offsetVector.firstIndex(); i <= offsetVector.lastIndex(); ++i) { - debug << offsetVector[i]; - if (i != offsetVector.lastIndex()) - debug << ", "; - } - debug << ")"; - return debug.space(); -} - -#if defined(NO_BENCHMARK) and defined(QBENCHMARK) -#undef QBENCHMARK -#define QBENCHMARK -#endif - -class tst_QOffsetVector : public QObject -{ - Q_OBJECT -public: - tst_QOffsetVector() {} - virtual ~tst_QOffsetVector() {} -private slots: - void empty(); - void forwardBuffer(); - void scrollingList(); - - void complexType(); - - void operatorAt(); - - void cacheBenchmark(); - void offsetVectorBenchmark(); - - void setCapacity(); -}; - -QTEST_MAIN(tst_QOffsetVector) - -void tst_QOffsetVector::empty() -{ - QOffsetVector c(10); - QCOMPARE(c.capacity(), 10); - QCOMPARE(c.count(), 0); - QVERIFY(c.isEmpty()); - c.append(1); - QVERIFY(!c.isEmpty()); - c.clear(); - QCOMPARE(c.capacity(), 10); - QCOMPARE(c.count(), 0); - QVERIFY(c.isEmpty()); - c.prepend(1); - QVERIFY(!c.isEmpty()); - c.clear(); - QCOMPARE(c.count(), 0); - QVERIFY(c.isEmpty()); - QCOMPARE(c.capacity(), 10); -} - -void tst_QOffsetVector::forwardBuffer() -{ - int i; - QOffsetVector c(10); - for(i = 1; i < 30; ++i) { - c.append(i); - QCOMPARE(c.first(), qMax(1, i-9)); - QCOMPARE(c.last(), i); - QCOMPARE(c.count(), qMin(i, 10)); - } - - c.clear(); - - for(i = 1; i < 30; ++i) { - c.prepend(i); - QCOMPARE(c.last(), qMax(1, i-9)); - QCOMPARE(c.first(), i); - QCOMPARE(c.count(), qMin(i, 10)); - } -} - -void tst_QOffsetVector::scrollingList() -{ - int i; - QOffsetVector c(10); - - // Once allocated QOffsetVector should not - // allocate any additional memory for non - // complex data types. - QBENCHMARK { - // simulate scrolling in a list of items; - for(i = 0; i < 10; ++i) - c.append(i); - - QCOMPARE(c.firstIndex(), 0); - QCOMPARE(c.lastIndex(), 9); - QVERIFY(c.containsIndex(0)); - QVERIFY(c.containsIndex(9)); - QVERIFY(!c.containsIndex(10)); - - for (i = 0; i < 10; ++i) - QCOMPARE(c.at(i), i); - - for (i = 10; i < 30; ++i) - c.append(i); - - QCOMPARE(c.firstIndex(), 20); - QCOMPARE(c.lastIndex(), 29); - QVERIFY(c.containsIndex(20)); - QVERIFY(c.containsIndex(29)); - QVERIFY(!c.containsIndex(30)); - - for (i = 20; i < 30; ++i) - QCOMPARE(c.at(i), i); - - for (i = 19; i >= 10; --i) - c.prepend(i); - - QCOMPARE(c.firstIndex(), 10); - QCOMPARE(c.lastIndex(), 19); - QVERIFY(c.containsIndex(10)); - QVERIFY(c.containsIndex(19)); - QVERIFY(!c.containsIndex(20)); - - for (i = 10; i < 20; ++i) - QCOMPARE(c.at(i), i); - - for (i = 200; i < 220; ++i) - c.insert(i, i); - - QCOMPARE(c.firstIndex(), 210); - QCOMPARE(c.lastIndex(), 219); - QVERIFY(c.containsIndex(210)); - QVERIFY(c.containsIndex(219)); - QVERIFY(!c.containsIndex(300)); - QVERIFY(!c.containsIndex(209)); - - for (i = 220; i < 220; ++i) { - QVERIFY(c.containsIndex(i)); - QCOMPARE(c.at(i), i); - } - c.clear(); // needed to reset benchmark - } - - // from a specific bug that was encountered. 100 to 299 cached, attempted to cache 250 - 205 via insert, failed. - // bug was that item at 150 would instead be item that should have been inserted at 250 - c.setCapacity(200); - for(i = 100; i < 300; ++i) - c.insert(i, i); - for (i = 250; i <= 306; ++i) - c.insert(i, 1000+i); - for (i = 107; i <= 306; ++i) { - QVERIFY(c.containsIndex(i)); - QCOMPARE(c.at(i), i < 250 ? i : 1000+i); - } -} - -struct RefCountingClassData -{ - QBasicAtomicInt ref; - static RefCountingClassData shared_null; -}; - -RefCountingClassData RefCountingClassData::shared_null = { - Q_BASIC_ATOMIC_INITIALIZER(1) -}; - -class RefCountingClass -{ -public: - RefCountingClass() : d(&RefCountingClassData::shared_null) { d->ref.ref(); } - - RefCountingClass(const RefCountingClass &other) - { - d = other.d; - d->ref.ref(); - } - - ~RefCountingClass() - { - if (!d->ref.deref()) - delete d; - } - - RefCountingClass &operator=(const RefCountingClass &other) - { - if (!d->ref.deref()) - delete d; - d = other.d; - d->ref.ref(); - return *this; - } - - int refCount() const { return d->ref; } -private: - RefCountingClassData *d; -}; - -void tst_QOffsetVector::complexType() -{ - RefCountingClass original; - - QOffsetVector offsetVector(10); - offsetVector.append(original); - QCOMPARE(original.refCount(), 3); - offsetVector.removeFirst(); - QCOMPARE(original.refCount(), 2); // shared null, 'original'. - offsetVector.append(original); - QCOMPARE(original.refCount(), 3); - offsetVector.clear(); - QCOMPARE(original.refCount(), 2); - - for(int i = 0; i < 100; ++i) - offsetVector.insert(i, original); - - QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in offsetVector. - - offsetVector.clear(); - QCOMPARE(original.refCount(), 2); - for (int i = 0; i < 100; i++) - offsetVector.append(original); - - QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in offsetVector. - offsetVector.clear(); - QCOMPARE(original.refCount(), 2); - - for (int i = 0; i < 100; i++) - offsetVector.prepend(original); - - QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in offsetVector. - offsetVector.clear(); - QCOMPARE(original.refCount(), 2); - - for (int i = 0; i < 100; i++) - offsetVector.append(original); - - offsetVector.takeLast(); - QCOMPARE(original.refCount(), 11); - - offsetVector.takeFirst(); - QCOMPARE(original.refCount(), 10); -} - -void tst_QOffsetVector::operatorAt() -{ - RefCountingClass original; - QOffsetVector offsetVector(10); - - for (int i = 25; i < 35; ++i) - offsetVector[i] = original; - - QCOMPARE(original.refCount(), 12); // shared null, orig, items in vector - - // verify const access does not copy items. - const QOffsetVector copy(offsetVector); - for (int i = 25; i < 35; ++i) - QCOMPARE(copy[i].refCount(), 12); - - // verify modifying the original increments ref count (e.g. does a detach) - offsetVector[25] = original; - QCOMPARE(original.refCount(), 22); -} - -/* - Benchmarks must be near identical in tasks to be fair. - QCache uses pointers to ints as its a requirement of QCache, - whereas QOffsetVector doesn't support pointers (won't free them). - Given the ability to use simple data types is a benefit, its - fair. Although this obviously must take into account we are - testing QOffsetVector use cases here, QCache has its own - areas where it is the more sensible class to use. -*/ -void tst_QOffsetVector::cacheBenchmark() -{ - QBENCHMARK { - QCache cache; - cache.setMaxCost(100); - - for (int i = 0; i < 1000; i++) - cache.insert(i, new int(i)); - } -} - -void tst_QOffsetVector::offsetVectorBenchmark() -{ - QBENCHMARK { - QOffsetVector offsetVector(100); - for (int i = 0; i < 1000; i++) - offsetVector.insert(i, i); - } -} - -void tst_QOffsetVector::setCapacity() -{ - int i; - QOffsetVector offsetVector(100); - for (i = 280; i < 310; ++i) - offsetVector.insert(i, i); - QCOMPARE(offsetVector.capacity(), 100); - QCOMPARE(offsetVector.count(), 30); - QCOMPARE(offsetVector.firstIndex(), 280); - QCOMPARE(offsetVector.lastIndex(), 309); - - for (i = offsetVector.firstIndex(); i <= offsetVector.lastIndex(); ++i) { - QVERIFY(offsetVector.containsIndex(i)); - QCOMPARE(offsetVector.at(i), i); - } - - offsetVector.setCapacity(150); - - QCOMPARE(offsetVector.capacity(), 150); - QCOMPARE(offsetVector.count(), 30); - QCOMPARE(offsetVector.firstIndex(), 280); - QCOMPARE(offsetVector.lastIndex(), 309); - - for (i = offsetVector.firstIndex(); i <= offsetVector.lastIndex(); ++i) { - QVERIFY(offsetVector.containsIndex(i)); - QCOMPARE(offsetVector.at(i), i); - } - - offsetVector.setCapacity(20); - - QCOMPARE(offsetVector.capacity(), 20); - QCOMPARE(offsetVector.count(), 20); - QCOMPARE(offsetVector.firstIndex(), 290); - QCOMPARE(offsetVector.lastIndex(), 309); - - for (i = offsetVector.firstIndex(); i <= offsetVector.lastIndex(); ++i) { - QVERIFY(offsetVector.containsIndex(i)); - QCOMPARE(offsetVector.at(i), i); - } -} - -#include "tst_qoffsetvector.moc" -- cgit v0.12 From f7516971028d4637eeff6899fbbc6f3e8b8b5c79 Mon Sep 17 00:00:00 2001 From: Ian Walters Date: Tue, 7 Apr 2009 16:37:51 +1000 Subject: Update licensing headers. Update files to have consistent licencesing with the rest of Qt. --- doc/src/examples/contiguouscache.qdoc | 34 +++++++++++++++- examples/tools/contiguouscache/main.cpp | 41 +++++++++++++++++++ examples/tools/contiguouscache/randomlistmodel.cpp | 40 +++++++++++++++++++ examples/tools/contiguouscache/randomlistmodel.h | 40 +++++++++++++++++++ src/corelib/tools/qcontiguouscache.cpp | 40 +++++++++++++++++-- src/corelib/tools/qcontiguouscache.h | 46 ++++++++++++++++++++-- .../auto/qcontiguouscache/tst_qcontiguouscache.cpp | 37 +++++++++++++++-- 7 files changed, 267 insertions(+), 11 deletions(-) diff --git a/doc/src/examples/contiguouscache.qdoc b/doc/src/examples/contiguouscache.qdoc index 22c97fa..6c67d77 100644 --- a/doc/src/examples/contiguouscache.qdoc +++ b/doc/src/examples/contiguouscache.qdoc @@ -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 documentation 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/tools/contiguouscache/main.cpp b/examples/tools/contiguouscache/main.cpp index bdeb3f3..291aaf4 100644 --- a/examples/tools/contiguouscache/main.cpp +++ b/examples/tools/contiguouscache/main.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "randomlistmodel.h" #include #include diff --git a/examples/tools/contiguouscache/randomlistmodel.cpp b/examples/tools/contiguouscache/randomlistmodel.cpp index 5c0953b..0f58c0e 100644 --- a/examples/tools/contiguouscache/randomlistmodel.cpp +++ b/examples/tools/contiguouscache/randomlistmodel.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ #include "randomlistmodel.h" static const int bufferSize(500); diff --git a/examples/tools/contiguouscache/randomlistmodel.h b/examples/tools/contiguouscache/randomlistmodel.h index ad8cfad..d32bf16 100644 --- a/examples/tools/contiguouscache/randomlistmodel.h +++ b/examples/tools/contiguouscache/randomlistmodel.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ #ifndef RANDOMLISTMODEL_H #define RANDOMLISTMODEL_H diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp index 5046912..1bcac96 100644 --- a/src/corelib/tools/qcontiguouscache.cpp +++ b/src/corelib/tools/qcontiguouscache.cpp @@ -1,17 +1,49 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** 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 QtCore module 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$ ** ****************************************************************************/ #include "qcontiguouscache.h" #include +QT_BEGIN_NAMESPACE + void QContiguousCacheData::dump() const { qDebug() << "capacity:" << alloc; @@ -357,3 +389,5 @@ MyRecord record(int row) const Sends information about the cache's internal structure to qDebug() */ + +QT_END_NAMESPACE diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index 03012a2..5250a79 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -1,11 +1,41 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** 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 QtCore module 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$ ** ****************************************************************************/ @@ -14,6 +44,12 @@ #include +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + struct QContiguousCacheData { QBasicAtomicInt ref; @@ -383,4 +419,8 @@ template inline T QContiguousCache::takeLast() { T t = last(); removeLast(); return t; } +QT_END_NAMESPACE + +QT_END_HEADER + #endif diff --git a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp index 493032a..6580f87 100644 --- a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp +++ b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp @@ -1,10 +1,41 @@ /**************************************************************************** ** -** This file is part of the $PACKAGE_NAME$. +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) ** -** Copyright (C) $THISYEAR$ $COMPANY_NAME$. +** This file is part of the test suite of the Qt Toolkit. ** -** $QT_EXTENDED_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$ ** ****************************************************************************/ -- cgit v0.12 From 21f15b50777ab3507f79061e749c5cee9acecb3b Mon Sep 17 00:00:00 2001 From: Ian Walters Date: Wed, 8 Apr 2009 10:05:27 +1000 Subject: Move qDebug code to correct location --- src/corelib/io/qdebug.h | 19 +++++++++++++++++ .../auto/qcontiguouscache/tst_qcontiguouscache.cpp | 24 ---------------------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 8334146..6c05756 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -51,6 +51,7 @@ #include #include #include +#include QT_BEGIN_HEADER @@ -232,6 +233,24 @@ inline QDebug operator<<(QDebug debug, const QSet &set) return operator<<(debug, set.toList()); } +#if defined(FORCE_UREF) +template +inline QDebug &operator<<(QDebug debug, const QContiguousCache &contiguousCache) +#else +template +inline QDebug operator<<(QDebug debug, const QContiguousCache &cache) +#endif +{ + debug.nospace() << "QContiguousCache("; + for (int i = cache.firstIndex(); i <= cache.lastIndex(); ++i) { + debug << cache[i]; + if (i != cache.lastIndex()) + debug << ", "; + } + debug << ")"; + return debug.space(); +} + #if !defined(QT_NO_DEBUG_STREAM) Q_CORE_EXPORT_INLINE QDebug qDebug() { return QDebug(QtDebugMsg); } diff --git a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp index 6580f87..91f6a9c 100644 --- a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp +++ b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp @@ -49,30 +49,6 @@ #include #include - -#if defined(FORCE_UREF) -template -inline QDebug &operator<<(QDebug debug, const QContiguousCache &contiguousCache) -#else -template -inline QDebug operator<<(QDebug debug, const QContiguousCache &contiguousCache) -#endif -{ - debug.nospace() << "QContiguousCache("; - for (int i = contiguousCache.firstIndex(); i <= contiguousCache.lastIndex(); ++i) { - debug << contiguousCache[i]; - if (i != contiguousCache.lastIndex()) - debug << ", "; - } - debug << ")"; - return debug.space(); -} - -#if defined(NO_BENCHMARK) and defined(QBENCHMARK) -#undef QBENCHMARK -#define QBENCHMARK -#endif - class tst_QContiguousCache : public QObject { Q_OBJECT -- cgit v0.12 From c07b3bd9c3c2d7195dfa52547961647a963c8d41 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 29 Apr 2009 18:20:49 +0200 Subject: Merged local changes. --- doc/src/animation.qdoc | 14 +++++++------- doc/src/groups.qdoc | 2 +- src/corelib/animation/qanimationgroup.cpp | 2 +- src/gui/statemachine/qbasickeyeventtransition.cpp | 2 ++ src/gui/statemachine/qbasicmouseeventtransition.cpp | 2 ++ 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/doc/src/animation.qdoc b/doc/src/animation.qdoc index 081660c..5eb2eda 100644 --- a/doc/src/animation.qdoc +++ b/doc/src/animation.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \page animation.html + \page animation-overview.html \title The Animation Framework \ingroup architecture \ingroup animation @@ -132,7 +132,7 @@ \endcode This code will move \c button from the top left corner of the - screen to the position (250, 250). + screen to the position (250, 250) in 10 seconds (10000 milliseconds). The example above will do a linear interpolation between the start and end value. It is also possible to set values @@ -162,7 +162,7 @@ that is not declared as a Qt property. The only requirement is that this value has a setter. You can then subclass the class containing the value and declare a property that uses this setter. - Note that all Qt properties requires a getter, so you will need to + Note that each Qt property requires a getter, so you will need to provide a getter yourself if this is not defined. \code @@ -184,9 +184,9 @@ \section1 Animations and the Graphics View Framework When you want to animate \l{QGraphicsItem}s, you also use - QPropertyAnimation. But, unfortunetly, QGraphicsItem does not - inherit QObject. A good solution is to subclass the graphics item - you wish to animate. This class will then also inherit QObject. + QPropertyAnimation. However, QGraphicsItem does not inherit QObject. + A good solution is to subclass the graphics item you wish to animate. + This class will then also inherit QObject. This way, QPropertyAnimation can be used for \l{QGraphicsItem}s. The example below shows how this is done. Another possibility is to inherit QGraphicsWidget, which already is a QObject. @@ -326,7 +326,7 @@ When using a \l{The State Machine Framework}{state machine}, we have a special state, QAnimationState, that will play one or more animations. - + The QState::addAnimatedTransition() convenience function lets you associate an animation to a state transition. The function will create the QAnimationState for you, and insert it into the state diff --git a/doc/src/groups.qdoc b/doc/src/groups.qdoc index 0411c3a..fda54dc 100644 --- a/doc/src/groups.qdoc +++ b/doc/src/groups.qdoc @@ -69,7 +69,7 @@ */ /*! - \group animations + \group animation \ingroup groups \title Animation Framework diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp index 03573bb..0d87527 100644 --- a/src/corelib/animation/qanimationgroup.cpp +++ b/src/corelib/animation/qanimationgroup.cpp @@ -41,7 +41,7 @@ /*! \class QAnimationGroup - \brief The QAnimationGroup is an abstract base class for group of animations. + \brief The QAnimationGroup class is an abstract base class for groups of animations. \since 4.5 \ingroup animation \preliminary diff --git a/src/gui/statemachine/qbasickeyeventtransition.cpp b/src/gui/statemachine/qbasickeyeventtransition.cpp index 4e3fa11..189332d 100644 --- a/src/gui/statemachine/qbasickeyeventtransition.cpp +++ b/src/gui/statemachine/qbasickeyeventtransition.cpp @@ -25,6 +25,8 @@ QT_BEGIN_NAMESPACE /*! \internal \class QBasicKeyEventTransition + \since 4.6 + \ingroup statemachine \brief The QBasicKeyEventTransition class provides a transition for Qt key events. */ diff --git a/src/gui/statemachine/qbasicmouseeventtransition.cpp b/src/gui/statemachine/qbasicmouseeventtransition.cpp index 83254dc..a330c78 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition.cpp +++ b/src/gui/statemachine/qbasicmouseeventtransition.cpp @@ -25,6 +25,8 @@ QT_BEGIN_NAMESPACE /*! \internal \class QBasicMouseEventTransition + \since 4.6 + \ingroup statemachine \brief The QBasicMouseEventTransition class provides a transition for Qt mouse events. */ -- cgit v0.12 From b39781b214e2502e0884bce88aa3ac324f2d0b12 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 7 May 2009 13:03:59 +0200 Subject: Make it impossible to have root state as source or target of transition or as error state Since the root state has no ancestors, it cannot be source or target in transitions since there will be no LCA for the transition, which is required for the algorithm of enterStates and exitStates. In SCXML the root state cannot be target or source of a transition. By the same logic, it cannot be an error state. The root state will always have a valid machine, since it's added to a machine immediately, which makes this code possible. --- src/corelib/statemachine/qabstracttransition.cpp | 15 ++++++++++++--- src/corelib/statemachine/qstate.cpp | 13 ++++++++++++- src/corelib/statemachine/qstatemachine.cpp | 2 ++ tests/auto/qstatemachine/tst_qstatemachine.cpp | 7 +++++-- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp index 1897aa6..c6a261d 100644 --- a/src/corelib/statemachine/qabstracttransition.cpp +++ b/src/corelib/statemachine/qabstracttransition.cpp @@ -180,7 +180,7 @@ QAbstractTransition::QAbstractTransition(const QList &targets, d_ptr->q_ptr = this; #endif Q_D(QAbstractTransition); - d->targetStates = targets; + setTargetStates(targets); } /*! @@ -221,7 +221,7 @@ QAbstractTransition::QAbstractTransition(QAbstractTransitionPrivate &dd, d_ptr->q_ptr = this; #endif Q_D(QAbstractTransition); - d->targetStates = targets; + setTargetStates(targets); } /*! @@ -265,7 +265,7 @@ void QAbstractTransition::setTargetState(QAbstractState* target) if (!target) d->targetStates.clear(); else - d->targetStates = QList() << target; + setTargetStates(QList() << target); } /*! @@ -284,6 +284,15 @@ QList QAbstractTransition::targetStates() const void QAbstractTransition::setTargetStates(const QList &targets) { Q_D(QAbstractTransition); + + for (int i=0; imachine() != 0 && target->machine()->rootState() == target) { + qWarning("QAbstractTransition::setTargetStates: root state cannot be target of transition"); + return; + } + } + d->targetStates = targets; } diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 4c9e033..acee27d 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -280,11 +280,15 @@ QAbstractState *QState::errorState() const void QState::setErrorState(QAbstractState *state) { Q_D(QState); - if (state != 0 && QAbstractStatePrivate::get(state)->machine() != d->machine()) { + if (state != 0 && state->machine() != machine()) { qWarning("QState::setErrorState: error state cannot belong " "to a different state machine"); return; } + if (state->machine() != 0 && state->machine()->rootState() == state) { + qWarning("QStateMachine::setErrorState: root state cannot be error state"); + return; + } d->errorState = state; } @@ -301,6 +305,13 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition) qWarning("QState::addTransition: cannot add null transition"); return 0; } + + // machine() will always be non-null for root state + if (machine() != 0 && machine()->rootState() == this) { + qWarning("QState::addTransition: cannot add transition from root state"); + return 0; + } + const QList &targets = QAbstractTransitionPrivate::get(transition)->targetStates; for (int i = 0; i < targets.size(); ++i) { QAbstractState *t = targets.at(i); diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 21e564c..110a4f8 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1011,6 +1011,8 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta } Q_ASSERT(currentErrorState != 0); + Q_ASSERT(currentErrorState != rootState); + QState *lca = findLCA(QList() << currentErrorState << currentContext); addStatesToEnter(currentErrorState, lca, pendingErrorStates, pendingErrorStatesForDefaultEntry); } diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index edd6459..9b7bff3 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -254,6 +254,8 @@ private: void tst_QStateMachine::transitionToRootState() { + s_countWarnings = false; + QStateMachine machine; QState *initialState = new QState(); @@ -668,6 +670,8 @@ void tst_QStateMachine::errorStateHasErrors() void tst_QStateMachine::errorStateIsRootState() { + s_countWarnings = false; + QStateMachine machine; machine.setErrorState(machine.rootState()); @@ -691,9 +695,8 @@ void tst_QStateMachine::errorStateIsRootState() machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1))); QCoreApplication::processEvents(); - QEXPECT_FAIL("", "Covered by transitionToRootState test. Remove this when that test passes", Continue); QCOMPARE(machine.configuration().count(), 1); - QVERIFY(machine.configuration().contains(initialState)); + QVERIFY(machine.configuration().contains(machine.errorState())); } void tst_QStateMachine::errorStateEntersParentFirst() -- cgit v0.12 From 00f04527d3d28ab1aa5b90b9a05366012ff5d1e5 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 7 May 2009 17:18:51 +0200 Subject: don't add signal transition if target is null or signal doesn't exist --- src/corelib/statemachine/qstate.cpp | 9 +++++++++ tests/auto/qstatemachine/tst_qstatemachine.cpp | 23 +++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index acee27d..4d12219 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -346,6 +346,15 @@ QSignalTransition *QState::addTransition(QObject *sender, const char *signal, qWarning("QState::addTransition: signal cannot be null"); return 0; } + if (!target) { + qWarning("QState::addTransition: cannot add transition to null state"); + return 0; + } + if (*signal && sender->metaObject()->indexOfSignal(signal+1) == -1) { + qWarning("QState::addTransition: no such signal %s::%s", + sender->metaObject()->className(), signal+1); + return 0; + } QSignalTransition *trans = new QSignalTransition(sender, signal, QList() << target); addTransition(trans); return trans; diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 9b7bff3..f7fce94 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1579,9 +1579,28 @@ void tst_QStateMachine::signalTransitions() { QStateMachine machine; QState *s0 = new QState(machine.rootState()); - QFinalState *s1 = new QFinalState(machine.rootState()); + QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: sender cannot be null"); + QCOMPARE(s0->addTransition(0, SIGNAL(noSuchSignal()), 0), (QObject*)0); + SignalEmitter emitter; - s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1); + QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: signal cannot be null"); + QCOMPARE(s0->addTransition(&emitter, 0, 0), (QObject*)0); + + QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: cannot add transition to null state"); + QCOMPARE(s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), 0), (QObject*)0); + + QFinalState *s1 = new QFinalState(machine.rootState()); + QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: no such signal SignalEmitter::noSuchSignal()"); + QCOMPARE(s0->addTransition(&emitter, SIGNAL(noSuchSignal()), s1), (QObject*)0); + + { + QSignalTransition *trans = s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1); + QVERIFY(trans != 0); + QCOMPARE(trans->sourceState(), s0); + QCOMPARE(trans->targetState(), (QAbstractState*)s1); + QCOMPARE(trans->senderObject(), (QObject*)&emitter); + QCOMPARE(trans->signal(), QByteArray(SIGNAL(signalWithNoArg()))); + } QSignalSpy finishedSpy(&machine, SIGNAL(finished())); machine.setInitialState(s0); -- cgit v0.12 From 58bf96d7252df3346d0f325af265873897e56172 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 8 May 2009 09:55:28 +0200 Subject: don't create transition to null state --- src/corelib/statemachine/qstate.cpp | 7 +++++-- tests/auto/qstatemachine/tst_qstatemachine.cpp | 25 +++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 4d12219..63a0a69 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -381,9 +381,12 @@ protected: */ QAbstractTransition *QState::addTransition(QAbstractState *target) { + if (!target) { + qWarning("QState::addTransition: cannot add transition to null state"); + return 0; + } UnconditionalTransition *trans = new UnconditionalTransition(target); - addTransition(trans); - return trans; + return addTransition(trans); } /*! diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index f7fce94..93cd1b3 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1091,11 +1091,28 @@ void tst_QStateMachine::stateEntryAndExit() QStateMachine machine; TestState *s1 = new TestState(machine.rootState()); + QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: cannot add transition to null state"); + s1->addTransition((QAbstractState*)0); + QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: cannot add null transition"); + s1->addTransition((QAbstractTransition*)0); + QTest::ignoreMessage(QtWarningMsg, "QState::removeTransition: cannot remove null transition"); + s1->removeTransition((QAbstractTransition*)0); + TestState *s2 = new TestState(machine.rootState()); QFinalState *s3 = new QFinalState(machine.rootState()); TestTransition *t = new TestTransition(s2); - s1->addTransition(t); - s2->addTransition(s3); + QCOMPARE(s1->addTransition(t), (QAbstractTransition*)t); + { + QAbstractTransition *trans = s2->addTransition(s3); + QVERIFY(trans != 0); + QCOMPARE(trans->sourceState(), (QAbstractState*)s2); + QCOMPARE(trans->targetState(), (QAbstractState*)s3); + s2->removeTransition(trans); + QCOMPARE(trans->sourceState(), (QAbstractState*)0); + QCOMPARE(trans->targetState(), (QAbstractState*)s3); + QCOMPARE(s2->addTransition(trans), trans); + QCOMPARE(trans->sourceState(), (QAbstractState*)s2); + } QSignalSpy startedSpy(&machine, SIGNAL(started())); QSignalSpy stoppedSpy(&machine, SIGNAL(stopped())); @@ -1311,6 +1328,8 @@ void tst_QStateMachine::assignPropertyWithAnimation() QStateMachine machine; QObject obj; QState *s1 = new QState(machine.rootState()); + QCOMPARE(s1->childMode(), QState::ExclusiveStates); + QCOMPARE(s1->initialState(), (QAbstractState*)0); s1->setObjectName("s1"); s1->assignProperty(&obj, "foo", 123); s1->assignProperty(&obj, "bar", 456); @@ -1324,6 +1343,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() s22->setObjectName("s22"); s22->assignProperty(&obj, "bar", 789); s2->setInitialState(s21); + QCOMPARE(s2->initialState(), (QAbstractState*)s21); QAbstractTransition *trans = s1->addTransition(s2); QPropertyAnimation anim(&obj, "foo"); @@ -1448,6 +1468,7 @@ void tst_QStateMachine::parallelStates() QStateMachine machine; QState *s1 = new QState(QState::ParallelStates); + QCOMPARE(s1->childMode(), QState::ParallelStates); QState *s1_1 = new QState(s1); QState *s1_1_1 = new QState(s1_1); QFinalState *s1_1_f = new QFinalState(s1_1); -- cgit v0.12 From c7b44a8bd67f4eace20c11ee78af6afeda774386 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Fri, 8 May 2009 10:42:27 +0200 Subject: Doc: Work on QAnimationGroup class description. --- src/corelib/animation/qanimationgroup.cpp | 52 ++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp index 03573bb..2f8cc28 100644 --- a/src/corelib/animation/qanimationgroup.cpp +++ b/src/corelib/animation/qanimationgroup.cpp @@ -46,18 +46,46 @@ \ingroup animation \preliminary - QAnimationGroup represents a group of animations, such as parallel or sequential, - and lets you combine different animations into one. The group manages any animation - that inherits QAbstractAnimation. By combining groups, you can easily construct - complex animation graphs. - - The QAnimationGroup base class provides methods for adding and retrieving animations. - Besides that, you can remove animations by calling remove(), and clear the animation - group by calling clearAnimations(). You may keep track of changes in the group's animations by - listening to QEvent::ChildAdded and QEvent::ChildRemoved events. - - QAnimationGroup takes ownership of the animations it manages, and ensures that they are - deleted when the animation group is deleted. + An animation group is a container for animations (subclasses of + QAbstractAnimation). A group is usually responsible for managing + the \l{QAbstractAnimation::State}{state} of its animations, i.e., + it decides when to start, stop, resume, and pause them. Currently, + Qt provides two such groups: QParallelAnimationGroup and + QSequentialAnimationGroup. Look up their class descriptions for + details. + + Since QAnimationGroup inherits from QAbstractAnimation, you can + combine groups, and easily construct complex animation graphs. + You can query QAbstractAnimation for the group it belongs to + (using the \l{QAbstractAnimation::}{group()} function). + + To start a top-level animation group, you simply use the + \l{QAbstractAnimation::}{start()} function from + QAbstractAnimation. By a top-level animation group, we think of a + group that itself is not contained within another group. Starting + sub groups directly is not supported, and may lead to unexpected + behavior. + + \omit OK, we'll put in a snippet on this here \endomit + + QAnimationGroup provides methods for adding and retrieving + animations. Besides that, you can remove animations by calling + remove(), and clear the animation group by calling + clearAnimations(). You may keep track of changes in the group's + animations by listening to QEvent::ChildAdded and + QEvent::ChildRemoved events. + + \omit OK, let's find a snippet here as well. \endomit + + QAnimationGroup takes ownership of the animations it manages, and + ensures that they are deleted when the animation group is deleted. + + You can also use a \l{The State Machine Framework}{state machine} + to create complex animations. The framework provides a special + state, QAnimationState, that plays an animation upon entry and + transitions to a new state when the animation has finished + playing. This technique can also be combined with using animation + groups. \sa QAbstractAnimation, QVariantAnimation, {The Animation Framework} */ -- cgit v0.12 From f64170262441cce51b52d05a2f2ba2f0021ba8e4 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 8 May 2009 12:59:03 +0200 Subject: make sure connections and event filters are removed when state machine halts --- src/corelib/statemachine/qstatemachine.cpp | 16 ++++++++++++++++ src/corelib/statemachine/qstatemachine_p.h | 1 + tests/auto/qstatemachine/tst_qstatemachine.cpp | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 110a4f8..24af8e4 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1224,10 +1224,12 @@ void QStateMachinePrivate::_q_process() break; case Finished: state = NotRunning; + unregisterAllTransitions(); emit q->finished(); break; case Stopped: state = NotRunning; + unregisterAllTransitions(); emit q->stopped(); break; } @@ -1358,6 +1360,20 @@ void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transit #endif } +void QStateMachinePrivate::unregisterAllTransitions() +{ + { + QList transitions = qFindChildren(rootState); + for (int i = 0; i < transitions.size(); ++i) + unregisterSignalTransition(transitions.at(i)); + } + { + QList transitions = qFindChildren(rootState); + for (int i = 0; i < transitions.size(); ++i) + unregisterEventTransition(transitions.at(i)); + } +} + #ifndef QT_NO_STATEMACHINE_EVENTFILTER void QStateMachinePrivate::registerEventTransition(QEventTransition *transition) { diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h index bb4a78c..47b139c 100644 --- a/src/corelib/statemachine/qstatemachine_p.h +++ b/src/corelib/statemachine/qstatemachine_p.h @@ -150,6 +150,7 @@ public: void unregisterEventTransition(QEventTransition *transition); #endif void unregisterTransition(QAbstractTransition *transition); + void unregisterAllTransitions(); void handleTransitionSignal(const QObject *sender, int signalIndex, void **args); void scheduleProcess(); diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 93cd1b3..288cbec 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1631,6 +1631,8 @@ void tst_QStateMachine::signalTransitions() emitter.emitSignalWithNoArg(); QTRY_COMPARE(finishedSpy.count(), 1); + + emitter.emitSignalWithNoArg(); } { QStateMachine machine; @@ -1722,6 +1724,8 @@ void tst_QStateMachine::eventTransitions() QCoreApplication::processEvents(); QTRY_COMPARE(finishedSpy.count(), 1); + + QTest::mousePress(&button, Qt::LeftButton); } { QStateMachine machine; -- cgit v0.12 From a70e9bc07f2252a49060132fc88ddd4c5963d456 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 8 May 2009 13:34:22 +0200 Subject: Test what happens when target state doesn't have a parent --- tests/auto/qstatemachine/tst_qstatemachine.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 288cbec..fa49ecb 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -105,6 +105,7 @@ private slots: void eventTransitions(); void historyStates(); void startAndStop(); + void targetStateWithNoParent(); void transitionToRootState(); void transitionEntersParent(); @@ -1490,6 +1491,8 @@ void tst_QStateMachine::parallelStates() QSignalSpy finishedSpy(&machine, SIGNAL(finished())); machine.start(); QTRY_COMPARE(finishedSpy.count(), 1); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s2)); } void tst_QStateMachine::allSourceToTargetConfigurations() @@ -1915,6 +1918,28 @@ void tst_QStateMachine::startAndStop() QVERIFY(machine.configuration().contains(s1)); } +void tst_QStateMachine::targetStateWithNoParent() +{ + QStateMachine machine; + QState *s1 = new QState(machine.rootState()); + s1->setObjectName("s1"); + QState *s2 = new QState(); + s1->addTransition(s2); + machine.setInitialState(s1); + QSignalSpy startedSpy(&machine, SIGNAL(started())); + QSignalSpy stoppedSpy(&machine, SIGNAL(stopped())); + QSignalSpy finishedSpy(&machine, SIGNAL(finished())); + machine.start(); + QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: No common ancestor for targets and source of transition from state 's1'"); + QTRY_COMPARE(machine.isRunning(), true); + QTRY_COMPARE(startedSpy.count(), 1); + QCOMPARE(stoppedSpy.count(), 0); + QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(machine.errorState())); + QCOMPARE(machine.error(), QStateMachine::NoCommonAncestorForTransitionError); +} + void tst_QStateMachine::defaultGlobalRestorePolicy() { QStateMachine machine; -- cgit v0.12 From 110473e9eece3231c3df4fc50c3a958c6c25f2de Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 8 May 2009 14:29:28 +0200 Subject: get rid of warnings --- src/corelib/statemachine/qabstracttransition.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp index c6a261d..696da9f 100644 --- a/src/corelib/statemachine/qabstracttransition.cpp +++ b/src/corelib/statemachine/qabstracttransition.cpp @@ -179,7 +179,6 @@ QAbstractTransition::QAbstractTransition(const QList &targets, #ifdef QT_STATEMACHINE_SOLUTION d_ptr->q_ptr = this; #endif - Q_D(QAbstractTransition); setTargetStates(targets); } @@ -220,7 +219,6 @@ QAbstractTransition::QAbstractTransition(QAbstractTransitionPrivate &dd, #ifdef QT_STATEMACHINE_SOLUTION d_ptr->q_ptr = this; #endif - Q_D(QAbstractTransition); setTargetStates(targets); } -- cgit v0.12 From 98f3ebcf1f6751cb76f9268d33faf0bc5ac70f6e Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 8 May 2009 16:37:21 +0200 Subject: gracefully handle deletion of transition's target state --- src/corelib/statemachine/qabstracttransition.cpp | 16 ++++++++++++++-- src/corelib/statemachine/qabstracttransition_p.h | 3 ++- src/corelib/statemachine/qstate.cpp | 2 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 13 +++++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp index 696da9f..6ddb416 100644 --- a/src/corelib/statemachine/qabstracttransition.cpp +++ b/src/corelib/statemachine/qabstracttransition.cpp @@ -273,7 +273,13 @@ void QAbstractTransition::setTargetState(QAbstractState* target) QList QAbstractTransition::targetStates() const { Q_D(const QAbstractTransition); - return d->targetStates; + QList result; + for (int i = 0; i < d->targetStates.size(); ++i) { + QAbstractState *target = d->targetStates.at(i); + if (target) + result.append(target); + } + return result; } /*! @@ -285,13 +291,19 @@ void QAbstractTransition::setTargetStates(const QList &targets) for (int i=0; imachine() != 0 && target->machine()->rootState() == target) { qWarning("QAbstractTransition::setTargetStates: root state cannot be target of transition"); return; } } - d->targetStates = targets; + d->targetStates.clear(); + for (int i = 0; i < targets.size(); ++i) + d->targetStates.append(targets.at(i)); } /*! diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h index b4e1c88..eb0ec21 100644 --- a/src/corelib/statemachine/qabstracttransition_p.h +++ b/src/corelib/statemachine/qabstracttransition_p.h @@ -58,6 +58,7 @@ #endif #include +#include QT_BEGIN_NAMESPACE @@ -83,7 +84,7 @@ public: QState *sourceState() const; QStateMachine *machine() const; - QList targetStates; + QList > targetStates; #ifndef QT_NO_ANIMATION QList animations; diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 63a0a69..5f61865 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -312,7 +312,7 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition) return 0; } - const QList &targets = QAbstractTransitionPrivate::get(transition)->targetStates; + const QList > &targets = QAbstractTransitionPrivate::get(transition)->targetStates; for (int i = 0; i < targets.size(); ++i) { QAbstractState *t = targets.at(i); if (!t) { diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index fa49ecb..dbc67d1 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -106,6 +106,7 @@ private slots: void historyStates(); void startAndStop(); void targetStateWithNoParent(); + void targetStateDeleted(); void transitionToRootState(); void transitionEntersParent(); @@ -1940,6 +1941,18 @@ void tst_QStateMachine::targetStateWithNoParent() QCOMPARE(machine.error(), QStateMachine::NoCommonAncestorForTransitionError); } +void tst_QStateMachine::targetStateDeleted() +{ + QStateMachine machine; + QState *s1 = new QState(machine.rootState()); + s1->setObjectName("s1"); + QState *s2 = new QState(machine.rootState()); + QAbstractTransition *trans = s1->addTransition(s2); + delete s2; + QCOMPARE(trans->targetState(), (QAbstractState*)0); + QVERIFY(trans->targetStates().isEmpty()); +} + void tst_QStateMachine::defaultGlobalRestorePolicy() { QStateMachine machine; -- cgit v0.12 From d03757e2bcf267790bf84d1b0e78c39c87b571ca Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 11 May 2009 08:09:29 +1000 Subject: Mac OSX compile errors in shader usage --- demos/boxes/scene.cpp | 18 +++++++++--------- src/opengl/qglpixmapfilter.cpp | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp index db32928..e2aa16b 100644 --- a/demos/boxes/scene.cpp +++ b/demos/boxes/scene.cpp @@ -680,9 +680,9 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) if (glActiveTexture) { m_environment->bind(); m_environmentProgram->enable(); - m_environmentProgram->setUniformValue("tex", 0); - m_environmentProgram->setUniformValue("env", 1); - m_environmentProgram->setUniformValue("noise", 2); + m_environmentProgram->setUniformValue("tex", GLint(0)); + m_environmentProgram->setUniformValue("env", GLint(1)); + m_environmentProgram->setUniformValue("noise", GLint(2)); m_box->draw(); m_environmentProgram->disable(); m_environment->unbind(); @@ -715,9 +715,9 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) m_environment->bind(); } m_programs[i]->enable(); - m_programs[i]->setUniformValue("tex", 0); - m_programs[i]->setUniformValue("env", 1); - m_programs[i]->setUniformValue("noise", 2); + m_programs[i]->setUniformValue("tex", GLint(0)); + m_programs[i]->setUniformValue("env", GLint(1)); + m_programs[i]->setUniformValue("noise", GLint(2)); m_programs[i]->setUniformValue("view", view); m_programs[i]->setUniformValue("invView", invView); m_box->draw(); @@ -746,9 +746,9 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) } m_programs[m_currentShader]->enable(); - m_programs[m_currentShader]->setUniformValue("tex", 0); - m_programs[m_currentShader]->setUniformValue("env", 1); - m_programs[m_currentShader]->setUniformValue("noise", 2); + m_programs[m_currentShader]->setUniformValue("tex", GLint(0)); + m_programs[m_currentShader]->setUniformValue("env", GLint(1)); + m_programs[m_currentShader]->setUniformValue("noise", GLint(2)); m_programs[m_currentShader]->setUniformValue("view", view); m_programs[m_currentShader]->setUniformValue("invView", invView); m_box->draw(); diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 4b811e5..83e6717 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -172,7 +172,7 @@ QGLPixmapColorizeFilter::QGLPixmapColorizeFilter() m_program.addShader(QGLShader::FragmentShader, qt_gl_colorize_filter); m_program.link(); m_program.enable(); - m_program.setUniformValue(m_program.uniformLocation("texture"), 0); // GL_TEXTURE_0 + m_program.setUniformValue(m_program.uniformLocation("texture"), GLint(0)); // GL_TEXTURE_0 m_colorUniform = m_program.uniformLocation("color"); } -- cgit v0.12 From 142c059031f42f1f4cb64873c634e655f3b7a46d Mon Sep 17 00:00:00 2001 From: Ian Walters Date: Mon, 11 May 2009 10:26:10 +1000 Subject: Documentation patch from Jason A bunch of minor doc fixes. --- doc/src/examples/contiguouscache.qdoc | 34 ++++++++--------- src/corelib/tools/qcontiguouscache.cpp | 67 ++++++++++++++++++---------------- 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/doc/src/examples/contiguouscache.qdoc b/doc/src/examples/contiguouscache.qdoc index 6c67d77..71e7740 100644 --- a/doc/src/examples/contiguouscache.qdoc +++ b/doc/src/examples/contiguouscache.qdoc @@ -44,11 +44,11 @@ \title Contiguous Cache Example The Contiguous Cache example shows how to use QContiguousCache to manage memory usage for - very large models. In some environments memory is limited, and even when it - isn't users still dislike an application using - excessive memory. Using QContiguousCache to manage a list rather than loading - the entire list into memory allows the application to limit the amount - of memory it uses regardless of the size of the data set it accesses + very large models. In some environments memory is limited and, even when it + isn't, users still dislike an application using excessive memory. + Using QContiguousCache to manage a list, rather than loading + the entire list into memory, allows the application to limit the amount + of memory it uses, regardless of the size of the data set it accesses The simplest way to use QContiguousCache is to cache as items are requested. When a view requests an item at row N it is also likely to ask for items at rows near @@ -56,7 +56,7 @@ \snippet examples/tools/contiguouscache/randomlistmodel.cpp 0 - After getting the row the class determines if the row is in the bounds + After getting the row, the class determines if the row is in the bounds of the contiguous cache's current range. It would have been equally valid to simply have the following code instead. @@ -68,13 +68,12 @@ \endcode However a list will often jump rows if the scroll bar is used directly, resulting in - the code above to cause every row between where the cache was last centered - to the requested row to be fetched before the requested row is fetched. + the code above causing every row between the old and new rows to be fetched. Using QContiguousCache::lastIndex() and QContiguousCache::firstIndex() allows - the example to determine where in the list the cache is currently over. These values - don't represent the indexes into the cache own memory, but rather a virtual - infinite array that the cache represents. + the example to determine what part of the list the cache is currently caching. + These values don't represent the indexes into the cache's own memory, but rather + a virtual infinite array that the cache represents. By using QContiguousCache::append() and QContiguousCache::prepend() the code ensures that items that may be still on the screen are not lost when the requested row @@ -84,16 +83,15 @@ rows with significant gaps between them consider using QCache instead. And thats it. A perfectly reasonable cache, using minimal memory for a very large - list. In this case the accessor for getting the words into cache: - - \snippet examples/tools/contiguouscache/randomlistmodel.cpp 1 - - Generates random information rather than fixed information. This allows you + list. In this case the accessor for getting the words into the cache + generates random information rather than fixed information. This allows you to see how the cache range is kept for a local number of rows when running the example. + \snippet examples/tools/contiguouscache/randomlistmodel.cpp 1 + It is also worth considering pre-fetching items into the cache outside of the - applications paint routine. This can be done either with a separate thread - or using a QTimer to incrementally expand the range of the thread prior to + application's paint routine. This can be done either with a separate thread + or using a QTimer to incrementally expand the range of the cache prior to rows being requested out of the current cache range. */ diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp index 1bcac96..95fa9e7 100644 --- a/src/corelib/tools/qcontiguouscache.cpp +++ b/src/corelib/tools/qcontiguouscache.cpp @@ -59,14 +59,14 @@ void QContiguousCacheData::dump() const \reentrant The QContiguousCache class provides an efficient way of caching items for - display in a user interface view. Unlike QCache though it adds a restriction - that elements within the cache are contiguous. This has the advantage that + display in a user interface view. Unlike QCache, it adds a restriction + that elements within the cache are contiguous. This has the advantage of matching how user interface views most commonly request data, as a set of rows localized around the current scrolled position. It also - allows the cache to use less overhead than QCache both in terms of - performance and memory. + allows the cache to consume less memory and processor cycles than QCache + for this use-case. - The simplest way of using an contiguous cache is to use the append() + The simplest way of using a contiguous cache is to use the append() and prepend(). \code @@ -82,18 +82,18 @@ MyRecord record(int row) const return cache.at(row); } \endcode - - If the cache is full then the item with the furthest index from where - the new item is appended or prepended is removed. + + If the cache is full then the item at the opposite end of the cache from where + the new item is appended or prepended will be removed. This usage can be further optimized by using the insert() function - in the case where the requested row is a long way from the currently cached - items. If there is a is a gap between where the new item is inserted and the currently + in the case where the requested row is a long way from the currently cached + items. If there is a gap between where the new item is inserted and the currently cached items then the existing cached items are first removed to retain the contiguous nature of the cache. Hence it is important to take some care then - when using insert() in order to avoid to unwanted clearing of the cache. + when using insert() in order to avoid unwanted clearing of the cache. - See the The \l{Contiguous Cache Example}{Contiguous Cache} example. + See the \l{Contiguous Cache Example}{Contiguous Cache} example. */ /*! \fn QContiguousCache::QContiguousCache(int capacity) @@ -116,6 +116,7 @@ MyRecord record(int row) const */ /*! \fn QContiguousCache::~QContiguousCache() + Destroys the cache. */ @@ -134,7 +135,6 @@ MyRecord record(int row) const \internal */ - /*! \fn QContiguousCache &QContiguousCache::operator=(const QContiguousCache &other) Assigns \a other to this cache and returns a reference to this cache. @@ -144,7 +144,7 @@ MyRecord record(int row) const Returns true if \a other is equal to this cache; otherwise returns false. - Two cache are considered equal if they contain the same values at the same + Two caches are considered equal if they contain the same values at the same indexes. This function requires the value type to implement the \c operator==(). \sa operator!=() @@ -155,17 +155,17 @@ MyRecord record(int row) const Returns true if \a other is not equal to this cache; otherwise returns false. - Two cache are considered equal if they contain the same values at the same + Two caches are considered equal if they contain the same values at the same indexes. This function requires the value type to implement the \c operator==(). \sa operator==() */ /*! \fn int QContiguousCache::capacity() const - + Returns the number of items the cache can store before it is full. When a cache contains a number of items equal to its capacity, adding new - items will cause items furthest from the added item to be removed. + items will cause items farthest from the added item to be removed. \sa setCapacity(), size() */ @@ -215,7 +215,7 @@ MyRecord record(int row) const Sets the capacity of the cache to the given \a size. A cache can hold a number of items equal to its capacity. When inserting, appending or prepending - items to the cache, if the cache is already full then the item furthest from + items to the cache, if the cache is already full then the item farthest from the added item will be removed. If the given \a size is smaller than the current count of items in the cache @@ -229,10 +229,10 @@ MyRecord record(int row) const Returns the item at index position \a i in the cache. \a i must be a valid index position in the cache (i.e, firstIndex() <= \a i <= lastIndex()). - The indexes in the cache refer to number of positions the item is from the + The indexes in the cache refer to the number of positions the item is from the first item appended into the cache. That is to say a cache with a capacity of 100, that has had 150 items appended will have a valid index range of - 50 to 149. This allows inserting an retrieving items into the cache based + 50 to 149. This allows inserting and retrieving items into the cache based on a theoretical infinite list \sa firstIndex(), lastIndex(), insert(), operator[]() @@ -283,10 +283,10 @@ MyRecord record(int row) const or a prepend(). If the given index \a i is not within the current range of the cache nor adjacent - to the bounds of the cache's index range the cache is first cleared before - inserting the item. At this point the cache will have a size of 1. It is worth - while then taking effort to insert items in an order that starts adjacent to the - current index range for the cache. + to the bounds of the cache's index range, the cache is first cleared before + inserting the item. At this point the cache will have a size of 1. It is + worthwhile taking effort to insert items in an order that starts adjacent + to the current index range for the cache. \sa prepend(), append(), isFull(), firstIndex(), lastIndex() */ @@ -299,6 +299,7 @@ MyRecord record(int row) const */ /*! \fn int QContiguousCache::firstIndex() const + Returns the first valid index in the cache. The index will be invalid if the cache is empty. However the following code is valid even when the cache is empty: @@ -350,7 +351,7 @@ MyRecord record(int row) const */ /*! \fn void QContiguousCache::removeFirst() - + Removes the first item from the cache. This function assumes that the cache isn't empty. @@ -358,7 +359,7 @@ MyRecord record(int row) const */ /*! \fn void QContiguousCache::removeLast() - + Removes the last item from the cache. This function assumes that the cache isn't empty. @@ -366,19 +367,21 @@ MyRecord record(int row) const */ /*! \fn T QContiguousCache::takeFirst() - - Removes the first item in the cache and returns it. - If you don't sue the return value, removeFirst() is more efficient. + Removes the first item in the cache and returns it. This function + assumes that the cache isn't empty. + + If you don't use the return value, removeFirst() is more efficient. \sa takeLast(), removeFirst() */ /*! \fn T QContiguousCache::takeLast() - - Removes the last item in the cache and returns it. - If you don't sue the return value, removeLast() is more efficient. + Removes the last item in the cache and returns it. This function + assumes that the cache isn't empty. + + If you don't use the return value, removeLast() is more efficient. \sa takeFirst(), removeLast() */ -- cgit v0.12 From 9fe787a58abe38d35e801c95132b7ee5886f565b Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Mon, 11 May 2009 13:34:03 +0200 Subject: Doc: Work on QParallelAnimationGroup and QSequentialAnimationGroup --- src/corelib/animation/qparallelanimationgroup.cpp | 23 +++++++++++++-- .../animation/qsequentialanimationgroup.cpp | 33 ++++++++++++++++++---- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index 407ffde..e4bce6a 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -46,8 +46,27 @@ \ingroup animation \preliminary - The animations are all started at the same time, and run in parallel. The animation group - finishes when the longest lasting animation has finished. + QParallelAnimationGroup--a \l{QAnimationGroup}{container for + animations}--starts all its animations when it is + \l{QAbstractAnimation::start()}{started} itself, i.e., runs all + animations in parallel. The animation group finishes when the + longest lasting animation has finished. + + You can treat QParallelAnimation as any other QAbstractAnimation, + e.g., pause, resume, or add it to other animation groups. + + \code + QParallelAnimationGroup *group = new QParallelAnimationGroup; + group->addAnimation(anim1); + group->addAnimation(anim2); + + group->start(); + \endcode + + In this example, \c anim1 and \c anim2 are two + \l{QPropertyAnimation}s that have already been set up. + + \sa QAnimationGroup, QPropertyAnimation, {The Animation Framework} */ #ifndef QT_NO_ANIMATION diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 61ff98d..38f4818 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -46,13 +46,36 @@ \ingroup animation \preliminary - The first animation in the group is started first, and when it finishes, the next animation - is started, and so on. The animation group finishes when the last animation has finished. + QSequentialAnimationGroup is a QAnimationGroup that runs its + animations in sequence, i.e., it starts one animation after + another has finished playing. The animations are played in the + order they are added to the group (using + \l{QAnimationGroup::}{addAnimation()} or + \l{QAnimationGroup::}{insertAnimationAt()}). The animation group + finishes when its last animation has finished. - At each moment there is at most one animation that is active in the group, called currentAnimation. - An empty group has no current animation. + At each moment there is at most one animation that is active in + the group; it is returned by currentAnimation(). An empty group + has no current animation. - You can call addPause() or insertPause() to add a pause to a sequential animation group. + A sequential animation group can be treated as any other + animation, i.e., it can be started, stopped, and added to other + groups. You can also call addPause() or insertPauseAt() to add a + pause to a sequential animation group. + + \code + QSequentialAnimationGroup group; + + group.addAnimation(anim1); + group.addAnimation(anim2); + + group.start(); + \endcode + + In this example, \c anim1 and \c anim2 are two already set up + \l{QPropertyAnimation}s. + + \sa QAnimationGroup, QAbstractAnimation, {The Animation Framework} */ #ifndef QT_NO_ANIMATION -- cgit v0.12 From aeea8fd5a940787600002dda39a10dff4d19d090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 11 May 2009 13:37:59 +0200 Subject: Made QFontEngineFT compile on 64-bit platforms with legacy headers. In older Freetype headers FT_LCD_FILTER_DEFAULT is apparently defined to be ((const FT_Byte*)(void*)(ft_ptrdiff_t)1), which leads to a compile error due to precision loss when casting to int. Task-number: 253186 Reviewed-by: Trond --- src/gui/text/qfontengine_ft.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 7a236fd..6f5ee1f 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -613,7 +613,7 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd) subpixelType = Subpixel_None; lcdFilterType = 0; #if defined(FT_LCD_FILTER_H) - lcdFilterType = (int) FT_LCD_FILTER_DEFAULT; + lcdFilterType = (int)((quintptr) FT_LCD_FILTER_DEFAULT); #endif defaultFormat = Format_None; canUploadGlyphsToServer = false; -- cgit v0.12 From e51c865ceb47dddfedb83ca4554ead21bd24ce7c Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Mon, 11 May 2009 14:19:17 +0200 Subject: Explaining details in QKeyEvent consruktor signature Explained the role of the key attribute. Task-number:246839 Rev-by: Richard Moe Gustavsen --- src/gui/kernel/qevent.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 8c7e47d..2aed287 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -675,12 +675,13 @@ QWheelEvent::QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, The \a type parameter must be QEvent::KeyPress, QEvent::KeyRelease, or QEvent::ShortcutOverride. - If \a key is 0, the event is not a result of - a known key; for example, it may be the result of a compose - sequence or keyboard macro. The \a modifiers holds the keyboard - modifiers, and the given \a text is the Unicode text that the - key generated. If \a autorep is true, isAutoRepeat() will be - true. \a count is the number of keys involved in the event. + Int \a key is the code for the Qt::Key that the event loop should listen + for. If \a key is 0, the event is not a result of a known key; for + example, it may be the result of a compose sequence or keyboard macro. + The \a modifiers holds the keyboard modifiers, and the given \a text + is the Unicode text that the key generated. If \a autorep is true, + isAutoRepeat() will be true. \a count is the number of keys involved + in the event. */ QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text, bool autorep, ushort count) -- cgit v0.12 From 8cd40802bd50bc02485738e49938eda3a1e45c1d Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Mon, 11 May 2009 14:23:15 +0200 Subject: Doc: Work on QPauseAnimation --- src/corelib/animation/qpauseanimation.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp index 30ea92c..685fa98 100644 --- a/src/corelib/animation/qpauseanimation.cpp +++ b/src/corelib/animation/qpauseanimation.cpp @@ -45,6 +45,22 @@ \since 4.5 \ingroup animation \preliminary + + If you wish to introduce a delay between animations in a + QSequentialAnimationGroup, you can insert a QPauseAnimation. This + class does not animate anything, but does not + \l{QAbstractAnimation::finished()}{finish} before a specified + number of milliseconds have elapsed from when it was started. You + specify the duration of the pause in the constructor. It can also + be set directly with setDuration(). + + It is not necessary to construct a QPauseAnimation yourself. + QSequentialAnimationGroup provides the convenience functions + \l{QSequentialAnimationGroup::}{addPause()} and + \l{QSequentialAnimationGroup::}{insertPauseAt()}. These functions + simply take the number of milliseconds the pause should last. + + \sa QSequentialAnimationGroup */ #ifndef QT_NO_ANIMATION -- cgit v0.12 From 1d09e9cfd77d398788b6a31eb8c07ca2ac6fa9a8 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 11 May 2009 14:52:00 +0200 Subject: Set the instruction set when building on Debian's Linux/MIPS port We use MIPS2 instructions in the inline assembler, so we need to make sure that the assembler is informed of this. Task-number: 253275 Reviewed-by: thiago --- src/corelib/arch/qatomic_mips.h | 106 ++++++++++++++++++++++++++++++++-------- 1 file changed, 86 insertions(+), 20 deletions(-) diff --git a/src/corelib/arch/qatomic_mips.h b/src/corelib/arch/qatomic_mips.h index b263aab..ea9954b 100644 --- a/src/corelib/arch/qatomic_mips.h +++ b/src/corelib/arch/qatomic_mips.h @@ -103,16 +103,25 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer::isFetchAndAddWaitFree() #if defined(Q_CC_GNU) && !defined(Q_OS_IRIX) +#if _MIPS_SIM == _ABIO32 +#define SET_MIPS2 ".set mips2\n\t" +#else +#define SET_MIPS2 +#endif + inline bool QBasicAtomicInt::ref() { register int originalValue; register int newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[one]\n" "sc %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -125,12 +134,15 @@ inline bool QBasicAtomicInt::deref() { register int originalValue; register int newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[minusOne]\n" "sc %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -143,7 +155,9 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) { register int result; register int tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" "bnez %[result], 0f\n" @@ -153,6 +167,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) "beqz %[tempValue], 0b\n" "nop\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -166,7 +181,9 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) { register int result; register int tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" "bnez %[result], 0f\n" @@ -177,6 +194,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) "nop\n" "sync\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -190,7 +208,9 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) { register int result; register int tempValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" "ll %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" @@ -201,6 +221,7 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) "beqz %[tempValue], 0b\n" "nop\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -219,12 +240,15 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) { register int originalValue; register int tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" "sc %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -237,13 +261,16 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) { register int originalValue; register int tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" "sc %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" "sync\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -256,13 +283,16 @@ inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) { register int originalValue; register int tempValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" "ll %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" "sc %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -280,12 +310,15 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) { register int originalValue; register int newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" "sc %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -298,13 +331,16 @@ inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) { register int originalValue; register int newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" "sc %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" "sync\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -317,13 +353,16 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) { register int originalValue; register int newValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" "ll %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" "sc %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -350,7 +389,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetRelaxed(T *expectedValu { register T *result; register T *tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" "bnez %[result], 0f\n" @@ -360,6 +401,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetRelaxed(T *expectedValu "beqz %[tempValue], 0b\n" "nop\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -374,7 +416,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetAcquire(T *expectedValu { register T *result; register T *tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" "bnez %[result], 0f\n" @@ -385,6 +429,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetAcquire(T *expectedValu "nop\n" "sync\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -399,7 +444,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetRelease(T *expectedValu { register T *result; register T *tempValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" LLP" %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" @@ -410,6 +457,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetRelease(T *expectedValu "beqz %[tempValue], 0b\n" "nop\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -430,12 +478,15 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreRelaxed(T *newValue) { register T *originalValue; register T *tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" SCP" %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -449,13 +500,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreAcquire(T *newValue) { register T *originalValue; register T *tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" SCP" %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" "sync\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -469,13 +523,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreRelease(T *newValue) { register T *originalValue; register T *tempValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" LLP" %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" SCP" %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -495,12 +552,15 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddRelaxed(qptrdiff valueTo { register T *originalValue; register T *newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" SCP" %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -514,13 +574,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddAcquire(qptrdiff valueTo { register T *originalValue; register T *newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" SCP" %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" "sync\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -534,13 +597,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddRelease(qptrdiff valueTo { register T *originalValue; register T *newValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" LLP" %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" SCP" %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) -- cgit v0.12 From 27d2f348792be0e08e204896dad8f3d80f51d80b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 11 May 2009 15:35:49 +0200 Subject: qdoc: Fixed qdoc errors, or tried to. --- src/corelib/tools/qhash.cpp | 219 +++++++++++++++++++++----------------------- 1 file changed, 102 insertions(+), 117 deletions(-) diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 21d98b5..b2512e1 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -379,6 +379,107 @@ void QHashData::checkSanity() #endif /*! + \fn uint qHash(const QPair &key) + \relates QHash + \since 4.3 + + Returns the hash value for the \a key. + + Types \c T1 and \c T2 must be supported by qHash(). +*/ + +/*! \fn uint qHash(char key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(uchar key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(signed char key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(ushort key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(short key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(uint key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(int key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(ulong key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(long key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(quint64 key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(qint64 key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(QChar key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(const QByteArray &key) + \fn uint qHash(const QBitArray &key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(const QString &key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(const T *key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \class QHash \brief The QHash class is a template class that provides a hash-table-based dictionary. @@ -401,7 +502,7 @@ void QHashData::checkSanity() key. With QHash, the items are arbitrarily ordered. \i The key type of a QMap must provide operator<(). The key type of a QHash must provide operator==() and a global - \l{qHash()}{qHash}(Key) function. + \l{qHash()} {hash} function. \endlist Here's an example QHash with QString keys and \c int values: @@ -732,7 +833,6 @@ void QHashData::checkSanity() */ /*! \fn const T QHash::value(const Key &key, const T &defaultValue) const - \overload If the hash contains no item with the given \a key, the function returns @@ -1490,121 +1590,6 @@ void QHashData::checkSanity() \sa operator+=(), operator-() */ -/*! \fn uint qHash(char key) - \relates QHash - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(uchar key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(signed char key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(ushort key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(short key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(uint key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(int key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(ulong key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(long key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(quint64 key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(qint64 key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(QChar key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(const QByteArray &key) - \fn uint qHash(const QBitArray &key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(const QString &key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(const T *key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! - \fn uint qHash(const QPair &key) - \relates QHash - \since 4.3 - - Returns the hash value for the \a key. - - Types \c T1 and \c T2 must be supported by qHash(). -*/ - /*! \fn QDataStream &operator<<(QDataStream &out, const QHash& hash) \relates QHash -- cgit v0.12 From 0ce24108aa20a38e53a7f307231a6752f89ef65a Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Mon, 11 May 2009 15:41:26 +0200 Subject: Correcting bug in custom Database Driver code snipptet Adding const to call. Changing QSqlRecord record() { return QSqlRecord(); } to QSqlRecord record() const { return QSqlRecord(); } This is needed since record() is a virtual function. Task-number:204557 Rev-by: Geir Vattekar --- doc/src/snippets/sqldatabase/sqldatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/snippets/sqldatabase/sqldatabase.cpp b/doc/src/snippets/sqldatabase/sqldatabase.cpp index ae176ac..06afa0c 100644 --- a/doc/src/snippets/sqldatabase/sqldatabase.cpp +++ b/doc/src/snippets/sqldatabase/sqldatabase.cpp @@ -524,7 +524,7 @@ protected: bool fetchLast() { return false; } int size() { return 0; } int numRowsAffected() { return 0; } - QSqlRecord record() { return QSqlRecord(); } + QSqlRecord record() const { return QSqlRecord(); } }; //! [47] -- cgit v0.12 From fecfc325bbd4decc0d61e10dc6536575c305f812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 11 May 2009 13:32:46 +0200 Subject: QFSFileEngine: Fix access to uninitialized memory Reviewed-by: Peter Hartmann --- src/corelib/io/qfsfileengine_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 0d88b06..18b92e2 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -780,7 +780,7 @@ QString QFSFileEngine::fileName(FileName file) const #endif if (len > 0) { QString ret; - if (S_ISDIR(d->st.st_mode) && s[0] != '/') { + if (d->doStat() && S_ISDIR(d->st.st_mode) && s[0] != '/') { QDir parent(d->filePath); parent.cdUp(); ret = parent.path(); -- cgit v0.12 From e9c8a4cf013906a54b1b05796d6007d878e85398 Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Mon, 11 May 2009 15:55:59 +0200 Subject: typos in docs: double "the" --- doc/src/accessible.qdoc | 2 +- doc/src/deployment.qdoc | 2 +- doc/src/examples/codeeditor.qdoc | 2 +- doc/src/examples/containerextension.qdoc | 2 +- doc/src/examples/fortuneserver.qdoc | 2 +- doc/src/examples/ftp.qdoc | 4 ++-- doc/src/examples/icons.qdoc | 2 +- doc/src/examples/musicplayerexample.qdoc | 2 +- doc/src/examples/qobjectxmlmodel.qdoc | 2 +- doc/src/examples/tabdialog.qdoc | 2 +- doc/src/examples/tooltips.qdoc | 2 +- doc/src/examples/transformations.qdoc | 2 +- doc/src/examples/trollprint.qdoc | 2 +- doc/src/licenses.qdoc | 2 +- doc/src/mac-differences.qdoc | 2 +- doc/src/phonon-api.qdoc | 2 +- doc/src/q3valuelist.qdoc | 2 +- doc/src/qalgorithms.qdoc | 2 +- doc/src/qtdesigner.qdoc | 2 +- doc/src/qtscriptdebugger-manual.qdoc | 2 +- doc/src/stylesheet.qdoc | 8 ++++---- doc/src/tech-preview/known-issues.html | 2 +- doc/src/timers.qdoc | 4 ++-- doc/src/xquery-introduction.qdoc | 2 +- 24 files changed, 29 insertions(+), 29 deletions(-) diff --git a/doc/src/accessible.qdoc b/doc/src/accessible.qdoc index 090da86..ad9f4f1 100644 --- a/doc/src/accessible.qdoc +++ b/doc/src/accessible.qdoc @@ -527,7 +527,7 @@ on plugins, consult the plugins \l{How to Create Qt Plugins}{overview document}. - You can omit the the first macro unless you want the plugin + You can omit the first macro unless you want the plugin to be statically linked with the application. \section2 Implementing Interface Factories diff --git a/doc/src/deployment.qdoc b/doc/src/deployment.qdoc index bcfa93d..446c91b 100644 --- a/doc/src/deployment.qdoc +++ b/doc/src/deployment.qdoc @@ -1247,7 +1247,7 @@ \snippet doc/src/snippets/code/doc_src_deployment.qdoc 48 Then we update the source code in \c tools/plugandpaint/main.cpp - to look for the the new plugins. After constructing the + to look for the new plugins. After constructing the QApplication, we add the following code: \snippet doc/src/snippets/code/doc_src_deployment.qdoc 49 diff --git a/doc/src/examples/codeeditor.qdoc b/doc/src/examples/codeeditor.qdoc index 669ab45..d218d0d 100644 --- a/doc/src/examples/codeeditor.qdoc +++ b/doc/src/examples/codeeditor.qdoc @@ -67,7 +67,7 @@ QTextEdit because it is optimized for handling plain text. See the QPlainTextEdit class description for details. - QPlainTextEdit lets us add selections in addition to the the + QPlainTextEdit lets us add selections in addition to the selection the user can make with the mouse or keyboard. We use this functionality to highlight the current line. More on this later. diff --git a/doc/src/examples/containerextension.qdoc b/doc/src/examples/containerextension.qdoc index a4fbcea..6d29cf6 100644 --- a/doc/src/examples/containerextension.qdoc +++ b/doc/src/examples/containerextension.qdoc @@ -305,7 +305,7 @@ MultiPageWidget class \l {designer/containerextension/multipagewidget.cpp}{implementation}). Finally, we implicitly force an update of the page's property - sheet by calling the the + sheet by calling the QDesignerPropertySheetExtension::setChanged() function. \snippet examples/designer/containerextension/multipagewidgetplugin.cpp 4 diff --git a/doc/src/examples/fortuneserver.qdoc b/doc/src/examples/fortuneserver.qdoc index e6a7f85..848a3a3 100644 --- a/doc/src/examples/fortuneserver.qdoc +++ b/doc/src/examples/fortuneserver.qdoc @@ -45,7 +45,7 @@ The Fortune Server example shows how to create a server for a simple network service. It is intended to be run alongside the - \l{network/fortuneclient}{Fortune Client} example or the the + \l{network/fortuneclient}{Fortune Client} example or the \l{network/blockingfortuneclient}{Blocking Fortune Client} example. \image fortuneserver-example.png Screenshot of the Fortune Server example diff --git a/doc/src/examples/ftp.qdoc b/doc/src/examples/ftp.qdoc index 9cc9cd1..7a74a37 100644 --- a/doc/src/examples/ftp.qdoc +++ b/doc/src/examples/ftp.qdoc @@ -172,7 +172,7 @@ no entries were found (in which case our \c addToList() function would not have been called). - Let's continue with the the \c addToList() slot: + Let's continue with the \c addToList() slot: \snippet examples/network/ftp/ftpwindow.cpp 10 @@ -190,7 +190,7 @@ \snippet examples/network/ftp/ftpwindow.cpp 12 - \c cdToParent() is invoked when the the user requests to go to the + \c cdToParent() is invoked when the user requests to go to the parent directory of the one displayed in the file list. After changing the directory, we QFtp::List its contents. diff --git a/doc/src/examples/icons.qdoc b/doc/src/examples/icons.qdoc index 750ef2e..a81ddb9 100644 --- a/doc/src/examples/icons.qdoc +++ b/doc/src/examples/icons.qdoc @@ -479,7 +479,7 @@ QTableWidget::openPersistentEditor() function to create comboboxes for the mode and state columns of the items. - Due to the the connection between the table widget's \l + Due to the connection between the table widget's \l {QTableWidget::itemChanged()}{itemChanged()} signal and the \c changeIcon() slot, the new image is automatically converted into a pixmap and made part of the set of pixmaps available to the icon diff --git a/doc/src/examples/musicplayerexample.qdoc b/doc/src/examples/musicplayerexample.qdoc index d23c1f1..9f04bf6 100644 --- a/doc/src/examples/musicplayerexample.qdoc +++ b/doc/src/examples/musicplayerexample.qdoc @@ -154,7 +154,7 @@ \snippet examples/phonon/musicplayer/mainwindow.cpp 5 - We move on to the the slots of \c MainWindow, starting with \c + We move on to the slots of \c MainWindow, starting with \c addFiles(): \snippet examples/phonon/musicplayer/mainwindow.cpp 6 diff --git a/doc/src/examples/qobjectxmlmodel.qdoc b/doc/src/examples/qobjectxmlmodel.qdoc index ce1dab6..37c66bc 100644 --- a/doc/src/examples/qobjectxmlmodel.qdoc +++ b/doc/src/examples/qobjectxmlmodel.qdoc @@ -71,7 +71,7 @@ The query engine can only traverse two dimensional trees, because an XML document is always a two dimensional tree. If we want to add the QMetaObject tree to the node model, we have to somehow flatten it - into the the same plane as the QObject tree. This requires that the + into the same plane as the QObject tree. This requires that the node model class must build an auxiliary data structure and make it part of the two dimensional QObject node model. How to do this is explained in \l{Including The QMetaObject Tree}. diff --git a/doc/src/examples/tabdialog.qdoc b/doc/src/examples/tabdialog.qdoc index c9500af..5394b82 100644 --- a/doc/src/examples/tabdialog.qdoc +++ b/doc/src/examples/tabdialog.qdoc @@ -91,7 +91,7 @@ \snippet examples/dialogs/tabdialog/tabdialog.cpp 1 \snippet examples/dialogs/tabdialog/tabdialog.cpp 3 - We arrange the the tab widget above the buttons in the dialog: + We arrange the tab widget above the buttons in the dialog: \snippet examples/dialogs/tabdialog/tabdialog.cpp 4 diff --git a/doc/src/examples/tooltips.qdoc b/doc/src/examples/tooltips.qdoc index 5daa2b2..78b350b 100644 --- a/doc/src/examples/tooltips.qdoc +++ b/doc/src/examples/tooltips.qdoc @@ -353,7 +353,7 @@ Whenever the user creates a new shape item, we want the new item to appear at a random position, and we use the \c randomItemPosition() function to calculate such a position. We - make sure that the item appears within the the visible area of the + make sure that the item appears within the visible area of the \c SortingBox widget, using the widget's current width and heigth when calculating the random coordinates. diff --git a/doc/src/examples/transformations.qdoc b/doc/src/examples/transformations.qdoc index eabb803..58c8b80 100644 --- a/doc/src/examples/transformations.qdoc +++ b/doc/src/examples/transformations.qdoc @@ -208,7 +208,7 @@ After transforming the coordinate system, we draw the \c RenderArea's shape, and then we restore the painter state using - the the QPainter::restore() function (i.e. popping the saved state off + the QPainter::restore() function (i.e. popping the saved state off the stack). \snippet examples/painting/transformations/renderarea.cpp 7 diff --git a/doc/src/examples/trollprint.qdoc b/doc/src/examples/trollprint.qdoc index 38251ee..489012e 100644 --- a/doc/src/examples/trollprint.qdoc +++ b/doc/src/examples/trollprint.qdoc @@ -142,7 +142,7 @@ We can easily determine which file must be changed because the translator's "context" is in fact the class name for the class where the texts that must be changed appears. In this case the file is \c - printpanel.cpp, where the there are four lines to change. Add the + printpanel.cpp, where there are four lines to change. Add the second argument "two-sided" in the appropriate \c tr() calls to the first pair of radio buttons: diff --git a/doc/src/licenses.qdoc b/doc/src/licenses.qdoc index 1c3f6d2..a11c071 100644 --- a/doc/src/licenses.qdoc +++ b/doc/src/licenses.qdoc @@ -45,7 +45,7 @@ \ingroup licensing \brief Information about other licenses used for Qt components and third-party code. - Qt contains some code that is not provided under the the + Qt contains some code that is not provided under the \l{GNU General Public License (GPL)}, \l{GNU Lesser General Public License (LGPL)} or the \l{Qt Commercial Editions}{Qt Commercial License Agreement}, but rather under diff --git a/doc/src/mac-differences.qdoc b/doc/src/mac-differences.qdoc index 573e62d..5849850 100644 --- a/doc/src/mac-differences.qdoc +++ b/doc/src/mac-differences.qdoc @@ -128,7 +128,7 @@ If you want to build a new dynamic library combining the Qt 4 dynamic libraries, you need to introduce the \c{ld -r} flag. Then - relocation information is stored in the the output file, so that + relocation information is stored in the output file, so that this file could be the subject of another \c ld run. This is done by setting the \c -r flag in the \c .pro file, and the \c LFLAGS settings. diff --git a/doc/src/phonon-api.qdoc b/doc/src/phonon-api.qdoc index 501b5a5..dd37fe2 100644 --- a/doc/src/phonon-api.qdoc +++ b/doc/src/phonon-api.qdoc @@ -2973,7 +2973,7 @@ \value ToggledHint If this hint is set it means that - the the control has only two states: zero and non-zero + the control has only two states: zero and non-zero (see isToggleControl()). \value LogarithmicHint diff --git a/doc/src/q3valuelist.qdoc b/doc/src/q3valuelist.qdoc index be315c2..e3681af 100644 --- a/doc/src/q3valuelist.qdoc +++ b/doc/src/q3valuelist.qdoc @@ -108,7 +108,7 @@ pointing to the removed member become invalid. Inserting into the list does not invalidate any iterator. For convenience, the function last() returns a reference to the last item in the list, - and first() returns a reference to the the first item. If the + and first() returns a reference to the first item. If the list is empty(), both last() and first() have undefined behavior (your application will crash or do unpredictable things). Use last() and first() with caution, for example: diff --git a/doc/src/qalgorithms.qdoc b/doc/src/qalgorithms.qdoc index b33c250..90289f9 100644 --- a/doc/src/qalgorithms.qdoc +++ b/doc/src/qalgorithms.qdoc @@ -59,7 +59,7 @@ If STL is available on all your target platforms, you can use the STL algorithms instead of their Qt counterparts. One reason why - you might want to use the the STL algorithms is that STL provides + you might want to use the STL algorithms is that STL provides dozens and dozens of algorithms, whereas Qt only provides the most important ones, making no attempt to duplicate functionality that is already provided by the C++ standard. diff --git a/doc/src/qtdesigner.qdoc b/doc/src/qtdesigner.qdoc index 7e3b619..9699c5b 100644 --- a/doc/src/qtdesigner.qdoc +++ b/doc/src/qtdesigner.qdoc @@ -632,7 +632,7 @@ /*! \fn void QDesignerContainerExtension::setCurrentIndex(int index) - Sets the the currently selected page in the container to be the + Sets the currently selected page in the container to be the page at the given \a index in the extension's list of pages. \sa currentIndex() diff --git a/doc/src/qtscriptdebugger-manual.qdoc b/doc/src/qtscriptdebugger-manual.qdoc index 3dfe879..75d87f8 100644 --- a/doc/src/qtscriptdebugger-manual.qdoc +++ b/doc/src/qtscriptdebugger-manual.qdoc @@ -367,7 +367,7 @@ \section3 continue Continues execution normally, i.e, gives the execution control over - the script back the the QScriptEngine. + the script back to the QScriptEngine. \section3 eval diff --git a/doc/src/stylesheet.qdoc b/doc/src/stylesheet.qdoc index c0d13da..7d4b05d 100644 --- a/doc/src/stylesheet.qdoc +++ b/doc/src/stylesheet.qdoc @@ -332,7 +332,7 @@ respect to the reference element. Once positioned, they are treated the same as widgets and can be styled - using the the \l{box model}. + using the \l{box model}. See the \l{List of Sub-Controls} below for a list of supported sub-controls, and \l{Customizing the QPushButton's Menu Indicator @@ -671,7 +671,7 @@ \l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin} properties. - Once positioned, sub-controls can be styled using the the \l{box model}. + Once positioned, sub-controls can be styled using the \l{box model}. \note With complex widgets such as QComboBox and QScrollBar, if one property or sub-control is customized, \bold{all} the other properties or @@ -1154,7 +1154,7 @@ \l{#pane-sub}{::pane} subcontrol. The left and right corners are styled using the \l{#left-corner-sub}{::left-corner} and \l{#right-corner-sub}{::right-corner} respectively. - The position of the the tab bar is controlled using the + The position of the tab bar is controlled using the \l{#tab-bar-sub}{::tab-bar} subcontrol. By default, the subcontrols have positions of a QTabWidget in @@ -1254,7 +1254,7 @@ the \l{#menu-button-sub}{::menu-button} subcontrol is used to draw the menu button. \l{#menu-arrow-sub}{::menu-arrow} subcontrol is used to draw the menu arrow inside the menu-button. By default, it is - positioned in the center of the Contents rectangle of the the + positioned in the center of the Contents rectangle of the menu-button subcontrol. When the QToolButton displays arrows, the \l{#up-arrow-sub}{::up-arrow}, diff --git a/doc/src/tech-preview/known-issues.html b/doc/src/tech-preview/known-issues.html index 05df69e..885104e 100644 --- a/doc/src/tech-preview/known-issues.html +++ b/doc/src/tech-preview/known-issues.html @@ -16,7 +16,7 @@

Known Issues: Qt 4.0.0 Technology Preview 1

- This is the list of known and reported issues for the the Qt 4.0.0 + This is the list of known and reported issues for the Qt 4.0.0 Technology Preview 1. This list is updated daily.



diff --git a/doc/src/timers.qdoc b/doc/src/timers.qdoc index 4f54343..1b48d7d 100644 --- a/doc/src/timers.qdoc +++ b/doc/src/timers.qdoc @@ -62,7 +62,7 @@ In multithreaded applications, you can use the timer mechanism in any thread that has an event loop. To start an event loop from a - non-GUI thread, use QThread::exec(). Qt uses the the object's + non-GUI thread, use QThread::exec(). Qt uses the object's \l{QObject::thread()}{thread affinity} to determine which thread will deliver the QTimerEvent. Because of this, you must start and stop all timers in the object's thread; it is not possible to @@ -105,7 +105,7 @@ In multithreaded applications, you can use QTimer in any thread that has an event loop. To start an event loop from a non-GUI - thread, use QThread::exec(). Qt uses the the timer's + thread, use QThread::exec(). Qt uses the timer's \l{QObject::thread()}{thread affinity} to determine which thread will emit the \l{QTimer::}{timeout()} signal. Because of this, you must start and stop the timer in its thread; it is not possible to diff --git a/doc/src/xquery-introduction.qdoc b/doc/src/xquery-introduction.qdoc index 37a45ac..fe541e2 100644 --- a/doc/src/xquery-introduction.qdoc +++ b/doc/src/xquery-introduction.qdoc @@ -347,7 +347,7 @@ has a more detailed section on the shorthand form, which it calls the \l{http://www.w3.org/TR/xquery/#abbrev} {abbreviated syntax}. More examples of path expressions written in the shorthand form are found there. There is also a section listing examples of path expressions -written in the the \l{http://www.w3.org/TR/xquery/#unabbrev} {longhand +written in the \l{http://www.w3.org/TR/xquery/#unabbrev} {longhand form}. \target Name Tests -- cgit v0.12 From 65165a0a3c32843486ebd8901b6cb825d9403766 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 11 May 2009 16:19:27 +0200 Subject: Make selecting plugins more user friendly and platform independent Using *.dll was just a placeholder here. The code is mostly copied from the Plug&Paint example, and goes through all the plugins to find the compatible ones with some hacks to find out the application directory on windows and mac. --- examples/statemachine/errorstate/mainwindow.cpp | 76 +++++++++++++++++----- .../errorstateplugins/random_ai/random_ai_plugin.h | 2 + .../errorstateplugins/seek_ai/seek_ai.h | 2 + .../errorstateplugins/spin_ai/spin_ai.h | 2 + .../spin_ai_with_error/spin_ai_with_error.h | 2 + 5 files changed, 66 insertions(+), 18 deletions(-) diff --git a/examples/statemachine/errorstate/mainwindow.cpp b/examples/statemachine/errorstate/mainwindow.cpp index 39b8663..07719bc 100644 --- a/examples/statemachine/errorstate/mainwindow.cpp +++ b/examples/statemachine/errorstate/mainwindow.cpp @@ -12,6 +12,9 @@ #include #include #include +#include +#include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_scene(0), m_machine(0), m_runningState(0), m_started(false) @@ -193,25 +196,62 @@ void MainWindow::addTank() { Q_ASSERT(!m_spawns.isEmpty()); - QString fileName = QFileDialog::getOpenFileName(this, "Select plugin file", "plugins/", "*.dll"); - QPluginLoader loader(fileName); + QDir pluginsDir(qApp->applicationDirPath()); +#if defined(Q_OS_WIN) + if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release") + pluginsDir.cdUp(); +#elif defined(Q_OS_MAC) + if (pluginsDir.dirName() == "MacOS") { + pluginsDir.cdUp(); + pluginsDir.cdUp(); + pluginsDir.cdUp(); + } +#endif + + pluginsDir.cd("plugins"); + + QStringList itemNames; + QList items; + foreach (QString fileName, pluginsDir.entryList(QDir::Files)) { + QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); + QObject *possiblePlugin = loader.instance(); + if (Plugin *plugin = qobject_cast(possiblePlugin)) { + QString objectName = possiblePlugin->objectName(); + if (objectName.isEmpty()) + objectName = fileName; + + itemNames.append(objectName); + items.append(plugin); + } + } + + if (items.isEmpty()) { + QMessageBox::information(this, "No tank types found", "Please build the errorstateplugins directory"); + return; + } + + bool ok; + QString selectedName = QInputDialog::getItem(this, "Select a tank type", "Tank types", + itemNames, 0, false, &ok); - Plugin *plugin = qobject_cast(loader.instance()); - if (plugin != 0) { - TankItem *tankItem = m_spawns.takeLast(); - m_scene->addItem(tankItem); - connect(tankItem, SIGNAL(cannonFired()), this, SLOT(addRocket())); - if (m_spawns.isEmpty()) - emit mapFull(); - - QState *region = new QState(m_runningState); - QState *pluginState = plugin->create(region, tankItem); - region->setInitialState(pluginState); - - // If the plugin has an error it is disabled - QState *errorState = new QState(region); - errorState->assignProperty(tankItem, "enabled", false); - pluginState->setErrorState(errorState); + if (ok && !selectedName.isEmpty()) { + int idx = itemNames.indexOf(selectedName); + if (Plugin *plugin = idx >= 0 ? items.at(idx) : 0) { + TankItem *tankItem = m_spawns.takeLast(); + m_scene->addItem(tankItem); + connect(tankItem, SIGNAL(cannonFired()), this, SLOT(addRocket())); + if (m_spawns.isEmpty()) + emit mapFull(); + + QState *region = new QState(m_runningState); + QState *pluginState = plugin->create(region, tankItem); + region->setInitialState(pluginState); + + // If the plugin has an error it is disabled + QState *errorState = new QState(region); + errorState->assignProperty(tankItem, "enabled", false); + pluginState->setErrorState(errorState); + } } } diff --git a/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.h b/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.h index 3db464b..10e6f48 100644 --- a/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.h +++ b/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.h @@ -56,6 +56,8 @@ class RandomAiPlugin: public QObject, public Plugin Q_OBJECT Q_INTERFACES(Plugin) public: + RandomAiPlugin() { setObjectName("Random"); } + virtual QState *create(QState *parentState, QObject *tank); }; diff --git a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h b/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h index 34d203e..a1b5749 100644 --- a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h +++ b/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h @@ -196,6 +196,8 @@ class SeekAi: public QObject, public Plugin Q_OBJECT Q_INTERFACES(Plugin) public: + SeekAi() { setObjectName("Seek and destroy"); } + virtual QState *create(QState *parentState, QObject *tank); }; diff --git a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.h b/examples/statemachine/errorstateplugins/spin_ai/spin_ai.h index 4b4629c..6e220ed 100644 --- a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.h +++ b/examples/statemachine/errorstateplugins/spin_ai/spin_ai.h @@ -38,6 +38,8 @@ class SpinAi: public QObject, public Plugin Q_OBJECT Q_INTERFACES(Plugin) public: + SpinAi() { setObjectName("Spin and destroy"); } + virtual QState *create(QState *parentState, QObject *tank); }; diff --git a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.h b/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.h index 9a96a8b..d520455 100644 --- a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.h +++ b/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.h @@ -38,6 +38,8 @@ class SpinAiWithError: public QObject, public Plugin Q_OBJECT Q_INTERFACES(Plugin) public: + SpinAiWithError() { setObjectName("Spin and destroy with runtime error in state machine"); } + virtual QState *create(QState *parentState, QObject *tank); }; -- cgit v0.12 From 6200d413487517eadb8f4696d92a38fc73ba737c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 11 May 2009 16:40:33 +0200 Subject: Improved caching of QSvgIconEngine::actualSize() calls. If an application calls QIcon::actualSize() for SVG based icons, before the icon is drawn for the first time, the actualSize() call will result in the SVG file being loaded and parsed for each call. Instead of doing that, just render a pixmap of the queried size and then the resulting actualSize() calls will used the size of the cached pixmap. Task-number: related to 251106 Reviewed-by: Kim --- src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp index c7249d3..3273513 100644 --- a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp +++ b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp @@ -122,16 +122,10 @@ QSize QSvgIconEngine::actualSize(const QSize &size, QIcon::Mode mode, return size; } - QSvgRenderer renderer; - d->loadDataForModeAndState(&renderer, mode, state); - if (renderer.isValid()) { - QSize defaultSize = renderer.defaultSize(); - if (!defaultSize.isNull()) - defaultSize.scale(size, Qt::KeepAspectRatio); - return defaultSize; - } else { + QPixmap pm = pixmap(size, mode, state); + if (pm.isNull()) return QSize(); - } + return pm.size(); } void QSvgIconEnginePrivate::loadDataForModeAndState(QSvgRenderer *renderer, QIcon::Mode mode, QIcon::State state) -- cgit v0.12 From 45c063d91d6a682821ab337cdc8839cc2229f6ef Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Mon, 11 May 2009 16:51:37 +0200 Subject: Doc: Assign state machine overview to architecture group (get it in the overview list) --- doc/src/statemachine.qdoc | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/statemachine.qdoc b/doc/src/statemachine.qdoc index 60ae815..abc089d 100644 --- a/doc/src/statemachine.qdoc +++ b/doc/src/statemachine.qdoc @@ -13,6 +13,7 @@ \page statemachine-api.html \title The State Machine Framework \brief An overview of the State Machine framework for constructing and executing state graphs. + \ingroup architecture \tableofcontents -- cgit v0.12 From 5f135bd9ba053c0ef41df9fe5450c78460ad89d3 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 11 May 2009 10:16:44 -0700 Subject: Fix a type in warning QDirecttFBPixmapData => QDirectFBPixmapData Reviewed-by: TrustMe --- src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 7297a99..c9b676a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -271,7 +271,7 @@ void QDirectFBPixmapData::fill(const QColor &color) forceRaster = false; setSerialNumber(++global_ser_no); if (!dfbSurface) { - qWarning("QDirecttFBPixmapData::fill()"); + qWarning("QDirectFBPixmapData::fill()"); invalidate(); return; } -- cgit v0.12 From 17e1bca1ce366395f8331e16aa96b7176ca1abac Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 11 May 2009 15:21:14 -0400 Subject: Optimize rendering in the GL engine By using REPLACE we don't have to clean the stencil on every draw, effectively optimizing the rendering by 200%. --- src/opengl/qpaintengine_opengl.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index aee351d..4259a5c 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -2233,7 +2233,7 @@ void QOpenGLPaintEnginePrivate::fillVertexArray(Qt::FillRule fillRule) // Enable color writes. glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glStencilMask(0); + glStencilMask(stencilMask); setGradientOps(cbrush, QRectF(QPointF(min_x, min_y), QSizeF(max_x - min_x, max_y - min_y))); @@ -2245,12 +2245,14 @@ void QOpenGLPaintEnginePrivate::fillVertexArray(Qt::FillRule fillRule) // Enable stencil func. glStencilFunc(GL_NOTEQUAL, 0, stencilMask); + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); composite(rect); } else { DEBUG_ONCE qDebug() << "QOpenGLPaintEnginePrivate: Drawing polygon using stencil method (no fragment programs)"; // Enable stencil func. glStencilFunc(GL_NOTEQUAL, 0, stencilMask); + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); #ifndef QT_OPENGL_ES glBegin(GL_QUADS); glVertex2f(min_x, min_y); @@ -2261,24 +2263,6 @@ void QOpenGLPaintEnginePrivate::fillVertexArray(Qt::FillRule fillRule) #endif } - glStencilMask(~0); - glStencilFunc(GL_ALWAYS, 0, 0); - glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); - - // clear all stencil values to 0 - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - -#ifndef QT_OPENGL_ES - glBegin(GL_QUADS); - glVertex2f(min_x, min_y); - glVertex2f(max_x, min_y); - glVertex2f(max_x, max_y); - glVertex2f(min_x, max_y); - glEnd(); -#endif - - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - // Disable stencil writes. glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glStencilMask(0); -- cgit v0.12 From 15e5a770635ca891bb3e0297fab130f7c1538655 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 11 May 2009 14:01:54 -0700 Subject: Remove unused variable Reviewed-by: TrustMe --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 91a60e7..989a37a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -275,7 +275,6 @@ private: int lastLockedHeight; IDirectFB *fb; - DFBSurfaceDescription fbDescription; int fbWidth; int fbHeight; -- cgit v0.12 From e16c235ecdb0b13ece15722b69e180a53cff431a Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 11 May 2009 14:07:39 -0700 Subject: initialize all DFBSurfaceDescriptions to 0 Since this is C there are no constructors. Reviewed-by: Donald --- src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index f571d1b..65fddbf 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -205,6 +205,7 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size, SurfaceCreationOptions options) { DFBSurfaceDescription desc; + memset(&desc, 0, sizeof(DFBSurfaceDescription)); desc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH|DSDESC_HEIGHT); if (!QDirectFBScreen::initSurfaceDescriptionPixelFormat(&desc, format)) return 0; @@ -213,7 +214,6 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size, return createDFBSurface(desc, options); } - IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options) { DFBResult result = DFB_OK; @@ -247,6 +247,7 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, } desc.caps = DFBSurfaceCapabilities(desc.caps & ~DSCAPS_VIDEOONLY); } + if (d_ptr->directFBFlags & SystemOnly) desc.caps = DFBSurfaceCapabilities(desc.caps | DSCAPS_SYSTEMONLY); @@ -445,6 +446,7 @@ QImage::Format QDirectFBScreen::getImageFormat(IDirectFBSurface *surface) DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const QImage &image) { DFBSurfaceDescription description; + memset(&description, 0, sizeof(DFBSurfaceDescription)); const DFBSurfacePixelFormat format = getSurfacePixelFormat(image.format()); @@ -479,6 +481,7 @@ DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const uint *buffer, int length) { DFBSurfaceDescription description; + memset(&description, 0, sizeof(DFBSurfaceDescription)); description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS | DSDESC_WIDTH @@ -917,6 +920,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec) d_ptr->dfb->SetCooperativeLevel(d_ptr->dfb, DFSCL_FULLSCREEN); DFBSurfaceDescription description; + memset(&description, 0, sizeof(DFBSurfaceDescription)); + description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS); if (::setIntOption(displayArgs, QLatin1String("width"), &description.width)) description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_WIDTH); -- cgit v0.12 From ee533dd0818c3bf7c940cd2d543adb1c6807dd1c Mon Sep 17 00:00:00 2001 From: Ian Walters Date: Tue, 12 May 2009 10:09:23 +1000 Subject: Various fixes resulting from QA code review. Some documentation fixes. More clear handling of what is and isn't a valid indexes. Added functions for the 'really long lived circular buffer use case' Improved unit tests. --- doc/src/examples/contiguouscache.qdoc | 8 +- src/corelib/io/qdebug.h | 2 +- src/corelib/tools/qcontiguouscache.cpp | 73 ++++++--- src/corelib/tools/qcontiguouscache.h | 32 ++-- tests/auto/auto.pro | 2 +- .../auto/qcontiguouscache/tst_qcontiguouscache.cpp | 169 +++++++++++++++++---- 6 files changed, 217 insertions(+), 69 deletions(-) diff --git a/doc/src/examples/contiguouscache.qdoc b/doc/src/examples/contiguouscache.qdoc index 71e7740..fbfde3f 100644 --- a/doc/src/examples/contiguouscache.qdoc +++ b/doc/src/examples/contiguouscache.qdoc @@ -61,10 +61,10 @@ simply have the following code instead. \code - while (row > m_words.lastIndex()) - m_words.append(fetchWord(m_words.lastIndex()+1); - while (row < m_words.firstIndex()) - m_words.prepend(fetchWord(m_words.firstIndex()-1); + while (row > m_rows.lastIndex()) + m_rows.append(fetchWord(m_rows.lastIndex()+1); + while (row < m_rows.firstIndex()) + m_rows.prepend(fetchWord(m_rows.firstIndex()-1); \endcode However a list will often jump rows if the scroll bar is used directly, resulting in diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 6c05756..9b0fbe5 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -235,7 +235,7 @@ inline QDebug operator<<(QDebug debug, const QSet &set) #if defined(FORCE_UREF) template -inline QDebug &operator<<(QDebug debug, const QContiguousCache &contiguousCache) +inline QDebug &operator<<(QDebug debug, const QContiguousCache &cache) #else template inline QDebug operator<<(QDebug debug, const QContiguousCache &cache) diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp index 95fa9e7..6671982 100644 --- a/src/corelib/tools/qcontiguouscache.cpp +++ b/src/corelib/tools/qcontiguouscache.cpp @@ -62,9 +62,10 @@ void QContiguousCacheData::dump() const display in a user interface view. Unlike QCache, it adds a restriction that elements within the cache are contiguous. This has the advantage of matching how user interface views most commonly request data, as - a set of rows localized around the current scrolled position. It also - allows the cache to consume less memory and processor cycles than QCache - for this use-case. + a set of rows localized around the current scrolled position. This + restriction allows the cache to consume less memory and processor + cycles than QCache. The QContiguousCache class also can provide + an upper bound on memory usage via setCapacity(). The simplest way of using a contiguous cache is to use the append() and prepend(). @@ -83,8 +84,8 @@ MyRecord record(int row) const } \endcode - If the cache is full then the item at the opposite end of the cache from where - the new item is appended or prepended will be removed. + If the cache is full then the item at the opposite end of the cache from + where the new item is appended or prepended will be removed. This usage can be further optimized by using the insert() function in the case where the requested row is a long way from the currently cached @@ -93,6 +94,19 @@ MyRecord record(int row) const the contiguous nature of the cache. Hence it is important to take some care then when using insert() in order to avoid unwanted clearing of the cache. + The range of valid indexes for the QContiguousCache class are from + 0 to INT_MAX. Calling prepend() such that the first index would become less + than 0 or append() such that the last index would become greater + than INT_MAX can result in the indexes of the cache being invalid. + When the cache indexes are invalid it is important to call + normalizeIndexes() before calling any of containsIndex(), firstIndex(), + lastIndex(), at() or the [] operator. Calling these + functions when the cache has invalid indexes will result in undefined + behavior. The indexes can be checked by using areIndexesValid() + + In most cases the indexes will not exceed 0 to INT_MAX, and + normalizeIndexes() will not need to be be used. + See the \l{Contiguous Cache Example}{Contiguous Cache} example. */ @@ -288,6 +302,10 @@ MyRecord record(int row) const worthwhile taking effort to insert items in an order that starts adjacent to the current index range for the cache. + The range of valid indexes for the QContiguousCache class are from + 0 to INT_MAX. Inserting outside of this range has undefined behavior. + + \sa prepend(), append(), isFull(), firstIndex(), lastIndex() */ @@ -301,24 +319,14 @@ MyRecord record(int row) const /*! \fn int QContiguousCache::firstIndex() const Returns the first valid index in the cache. The index will be invalid if the - cache is empty. However the following code is valid even when the cache is empty: - - \code - for (int i = cache.firstIndex(); i <= cache.lastIndex(); ++i) - qDebug() << "Item" << i << "of the cache is" << cache.at(i); - \endcode + cache is empty. \sa capacity(), size(), lastIndex() */ /*! \fn int QContiguousCache::lastIndex() const - Returns the last valid index in the cache. If the cache is empty will return -1. - - \code - for (int i = cache.firstIndex(); i <= cache.lastIndex(); ++i) - qDebug() << "Item" << i << "of the cache is" << cache.at(i); - \endcode + Returns the last valid index in the cache. The index will be invalid if the cache is empty. \sa capacity(), size(), firstIndex() */ @@ -386,6 +394,37 @@ MyRecord record(int row) const \sa takeFirst(), removeLast() */ +/*! \fn void QContiguousCache::normalizeIndexes() + + Moves the first index and last index of the cache + such that they point to valid indexes. The function does not modify + the contents of the cache or the ordering of elements within the cache. + + It is provided so that index overflows can be corrected when using the + cache as a circular buffer. + + \code + QContiguousCache cache(10); + cache.insert(INT_MAX, 1); // cache contains one value and has valid indexes, INT_MAX to INT_MAX + cache.append(2); // cache contains two values but does not have valid indexes. + cache.normalizeIndexes(); // cache has two values, 1 and 2. New first index will be in the range of 0 to capacity(). + \endcode + + \sa areIndexesValid(), append(), prepend() +*/ + +/*! \fn bool QContiguousCache::areIndexesValid() const + + Returns whether the indexes for items stored in the cache are valid. + Indexes can become invalid if items are appended after the index position + INT_MAX or prepended before the index position 0. This is only expected + to occur in very long lived circular buffer style usage of the + contiguous cache. Indexes can be made valid again by calling + normalizeIndexs(). + + \sa normalizeIndexes(), append(), prepend() +*/ + /*! \fn void QContiguousCache::dump() const \internal diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index 5250a79..5cd1582 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -43,6 +43,7 @@ #define QCONTIGUOUSCACHE_H #include +#include QT_BEGIN_HEADER @@ -50,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) -struct QContiguousCacheData +struct Q_CORE_EXPORT QContiguousCacheData { QBasicAtomicInt ref; int alloc; @@ -75,8 +76,6 @@ struct QContiguousCacheTypedData T array[1]; }; -class QContiguousCacheDevice; - template class QContiguousCache { typedef QContiguousCacheTypedData Data; @@ -128,13 +127,17 @@ public: void removeLast(); T takeLast(); + inline bool areIndexesValid() const + { return d->offset >= 0 && d->offset < INT_MAX - d->count && (d->offset % d->alloc) == d->start; } + + inline void normalizeIndexes() { d->offset = d->start; } // debug void dump() const { p->dump(); } private: void detach_helper(); - QContiguousCacheData *malloc(int alloc); - void free(Data *d); + QContiguousCacheData *malloc(int aalloc); + void free(Data *x); int sizeOfTypedData() { // this is more or less the same as sizeof(Data), except that it doesn't // count the padding at the end @@ -189,10 +192,6 @@ void QContiguousCache::setCapacity(int asize) x.d->count = qMin(d->count, asize); x.d->offset = d->offset + d->count - x.d->count; x.d->start = x.d->offset % x.d->alloc; - /* deep copy - - slow way now, get unit test working, then - improve performance if need be. (e.g. memcpy) - */ T *dest = x.d->array + (x.d->start + x.d->count-1) % x.d->alloc; T *src = d->array + (d->start + d->count-1) % d->alloc; int count = x.d->count; @@ -249,11 +248,11 @@ inline QContiguousCacheData *QContiguousCache::malloc(int aalloc) } template -QContiguousCache::QContiguousCache(int asize) +QContiguousCache::QContiguousCache(int capacity) { - p = malloc(asize); + p = malloc(capacity); d->ref = 1; - d->alloc = asize; + d->alloc = capacity; d->count = d->start = d->offset = 0; d->sharable = true; } @@ -302,7 +301,6 @@ void QContiguousCache::free(Data *x) } qFree(x); } - template void QContiguousCache::append(const T &value) { @@ -349,6 +347,7 @@ void QContiguousCache::prepend(const T &value) template void QContiguousCache::insert(int pos, const T &value) { + Q_ASSERT_X(pos >= 0 && pos < INT_MAX, "QContiguousCache::insert", "index out of range"); detach(); if (containsIndex(pos)) { if(QTypeInfo::isComplex) @@ -362,8 +361,8 @@ void QContiguousCache::insert(int pos, const T &value) else { // we don't leave gaps. clear(); - d->offset = d->start = pos; - d->start %= d->alloc; + d->offset = pos; + d->start = pos % d->alloc; d->count = 1; if (QTypeInfo::isComplex) new (d->array + d->start) T(value); @@ -378,9 +377,8 @@ inline const T &QContiguousCache::at(int pos) const template inline const T &QContiguousCache::operator[](int pos) const { Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache::at", "index out of range"); return d->array[pos % d->alloc]; } -template -// can use the non-inline one to modify the index range. +template inline T &QContiguousCache::operator[](int pos) { detach(); diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index cfd9525..1f972bf 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -209,7 +209,7 @@ SUBDIRS += bic \ qnumeric \ qobject \ qobjectrace \ - qoffsetvector \ + qcontiguouscache \ qpaintengine \ qpainter \ qpainterpath \ diff --git a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp index 91f6a9c..6d59390 100644 --- a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp +++ b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp @@ -41,8 +41,6 @@ #include #include -#include -#include #include #include @@ -57,8 +55,13 @@ public: virtual ~tst_QContiguousCache() {} private slots: void empty(); - void forwardBuffer(); - void scrollingList(); + void append_data(); + void append(); + + void prepend_data(); + void prepend(); + + void asScrollingList(); void complexType(); @@ -79,12 +82,14 @@ void tst_QContiguousCache::empty() QCOMPARE(c.count(), 0); QVERIFY(c.isEmpty()); c.append(1); + QCOMPARE(c.count(), 1); QVERIFY(!c.isEmpty()); c.clear(); QCOMPARE(c.capacity(), 10); QCOMPARE(c.count(), 0); QVERIFY(c.isEmpty()); c.prepend(1); + QCOMPARE(c.count(), 1); QVERIFY(!c.isEmpty()); c.clear(); QCOMPARE(c.count(), 0); @@ -92,28 +97,111 @@ void tst_QContiguousCache::empty() QCOMPARE(c.capacity(), 10); } -void tst_QContiguousCache::forwardBuffer() +void tst_QContiguousCache::append_data() { - int i; - QContiguousCache c(10); - for(i = 1; i < 30; ++i) { + QTest::addColumn("start"); + QTest::addColumn("count"); + QTest::addColumn("cacheSize"); + QTest::addColumn("invalidIndexes"); + + QTest::newRow("0+30[10]") << 0 << 30 << 10 << false; + QTest::newRow("300+30[10]") << 300 << 30 << 10 << false; + QTest::newRow("MAX-10+30[10]") << INT_MAX-10 << 30 << 10 << true; +} + +void tst_QContiguousCache::append() +{ + QFETCH(int, start); + QFETCH(int, count); + QFETCH(int, cacheSize); + QFETCH(bool, invalidIndexes); + + int i, j; + QContiguousCache c(cacheSize); + + i = 1; + QCOMPARE(c.available(), cacheSize); + if (start == 0) + c.append(i++); + else + c.insert(start, i++); + while (i < count) { c.append(i); - QCOMPARE(c.first(), qMax(1, i-9)); + QCOMPARE(c.available(), qMax(0, cacheSize - i)); + QCOMPARE(c.first(), qMax(1, i-cacheSize+1)); QCOMPARE(c.last(), i); - QCOMPARE(c.count(), qMin(i, 10)); + QCOMPARE(c.count(), qMin(i, cacheSize)); + QCOMPARE(c.isFull(), i >= cacheSize); + i++; } - c.clear(); + QCOMPARE(c.areIndexesValid(), !invalidIndexes); + if (invalidIndexes) + c.normalizeIndexes(); + QVERIFY(c.areIndexesValid()); + + // test taking from end until empty. + for (j = 0; j < cacheSize; j++, i--) { + QCOMPARE(c.takeLast(), i-1); + QCOMPARE(c.count(), cacheSize-j-1); + QCOMPARE(c.available(), j+1); + QVERIFY(!c.isFull()); + QCOMPARE(c.isEmpty(), j==cacheSize-1); + } + +} + +void tst_QContiguousCache::prepend_data() +{ + QTest::addColumn("start"); + QTest::addColumn("count"); + QTest::addColumn("cacheSize"); + QTest::addColumn("invalidIndexes"); + + QTest::newRow("30-30[10]") << 30 << 30 << 10 << false; + QTest::newRow("300-30[10]") << 300 << 30 << 10 << false; + QTest::newRow("10-30[10]") << 10 << 30 << 10 << true; +} - for(i = 1; i < 30; ++i) { +void tst_QContiguousCache::prepend() +{ + QFETCH(int, start); + QFETCH(int, count); + QFETCH(int, cacheSize); + QFETCH(bool, invalidIndexes); + + int i, j; + QContiguousCache c(cacheSize); + + i = 1; + QCOMPARE(c.available(), cacheSize); + c.insert(start, i++); + while(i < count) { c.prepend(i); - QCOMPARE(c.last(), qMax(1, i-9)); + QCOMPARE(c.available(), qMax(0, cacheSize - i)); + QCOMPARE(c.last(), qMax(1, i-cacheSize+1)); QCOMPARE(c.first(), i); - QCOMPARE(c.count(), qMin(i, 10)); + QCOMPARE(c.count(), qMin(i, cacheSize)); + QCOMPARE(c.isFull(), i >= cacheSize); + i++; + } + + QCOMPARE(c.areIndexesValid(), !invalidIndexes); + if (invalidIndexes) + c.normalizeIndexes(); + QVERIFY(c.areIndexesValid()); + + // test taking from start until empty. + for (j = 0; j < cacheSize; j++, i--) { + QCOMPARE(c.takeFirst(), i-1); + QCOMPARE(c.count(), cacheSize-j-1); + QCOMPARE(c.available(), j+1); + QVERIFY(!c.isFull()); + QCOMPARE(c.isEmpty(), j==cacheSize-1); } } -void tst_QContiguousCache::scrollingList() +void tst_QContiguousCache::asScrollingList() { int i; QContiguousCache c(10); @@ -123,55 +211,78 @@ void tst_QContiguousCache::scrollingList() // complex data types. QBENCHMARK { // simulate scrolling in a list of items; - for(i = 0; i < 10; ++i) + for(i = 0; i < 10; ++i) { + QCOMPARE(c.available(), 10-i); c.append(i); + } QCOMPARE(c.firstIndex(), 0); QCOMPARE(c.lastIndex(), 9); - QVERIFY(c.containsIndex(0)); - QVERIFY(c.containsIndex(9)); + QCOMPARE(c.first(), 0); + QCOMPARE(c.last(), 9); + QVERIFY(!c.containsIndex(-1)); QVERIFY(!c.containsIndex(10)); + QCOMPARE(c.available(), 0); - for (i = 0; i < 10; ++i) + for (i = 0; i < 10; ++i) { + QVERIFY(c.containsIndex(i)); QCOMPARE(c.at(i), i); + QCOMPARE(c[i], i); + QCOMPARE(((const QContiguousCache)c)[i], i); + } for (i = 10; i < 30; ++i) c.append(i); QCOMPARE(c.firstIndex(), 20); QCOMPARE(c.lastIndex(), 29); - QVERIFY(c.containsIndex(20)); - QVERIFY(c.containsIndex(29)); + QCOMPARE(c.first(), 20); + QCOMPARE(c.last(), 29); + QVERIFY(!c.containsIndex(19)); QVERIFY(!c.containsIndex(30)); + QCOMPARE(c.available(), 0); - for (i = 20; i < 30; ++i) + for (i = 20; i < 30; ++i) { + QVERIFY(c.containsIndex(i)); QCOMPARE(c.at(i), i); + QCOMPARE(c[i], i); + QCOMPARE(((const QContiguousCache )c)[i], i); + } for (i = 19; i >= 10; --i) c.prepend(i); QCOMPARE(c.firstIndex(), 10); QCOMPARE(c.lastIndex(), 19); - QVERIFY(c.containsIndex(10)); - QVERIFY(c.containsIndex(19)); + QCOMPARE(c.first(), 10); + QCOMPARE(c.last(), 19); + QVERIFY(!c.containsIndex(9)); QVERIFY(!c.containsIndex(20)); + QCOMPARE(c.available(), 0); - for (i = 10; i < 20; ++i) + for (i = 10; i < 20; ++i) { + QVERIFY(c.containsIndex(i)); QCOMPARE(c.at(i), i); + QCOMPARE(c[i], i); + QCOMPARE(((const QContiguousCache )c)[i], i); + } for (i = 200; i < 220; ++i) c.insert(i, i); QCOMPARE(c.firstIndex(), 210); QCOMPARE(c.lastIndex(), 219); - QVERIFY(c.containsIndex(210)); - QVERIFY(c.containsIndex(219)); - QVERIFY(!c.containsIndex(300)); + QCOMPARE(c.first(), 210); + QCOMPARE(c.last(), 219); QVERIFY(!c.containsIndex(209)); + QVERIFY(!c.containsIndex(300)); + QCOMPARE(c.available(), 0); - for (i = 220; i < 220; ++i) { + for (i = 210; i < 220; ++i) { QVERIFY(c.containsIndex(i)); QCOMPARE(c.at(i), i); + QCOMPARE(c[i], i); + QCOMPARE(((const QContiguousCache )c)[i], i); } c.clear(); // needed to reset benchmark } -- cgit v0.12 From 7f0ffec90467c12d41566bb20fc02e09cfe3afa1 Mon Sep 17 00:00:00 2001 From: kh Date: Tue, 12 May 2009 09:09:33 +0200 Subject: Version update. --- tools/assistant/tools/assistant/assistant.qch | Bin 368640 -> 368640 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/tools/assistant/tools/assistant/assistant.qch b/tools/assistant/tools/assistant/assistant.qch index 64763f7..99687ed 100644 Binary files a/tools/assistant/tools/assistant/assistant.qch and b/tools/assistant/tools/assistant/assistant.qch differ -- cgit v0.12 From 8d94fcce0a2ca382eac8357dae05ad387551e364 Mon Sep 17 00:00:00 2001 From: jasplin Date: Tue, 12 May 2009 09:47:29 +0200 Subject: Fixed bug with Qt::WidgetWithChildren shortcut context in QGraphicsWidget. For a QGraphicsWidget w, a shortcut with Qt::WidgetWithChildren context would trigger even if w did not have focus (provided no other widgets in the view had focus). Reviewed-by: andreas Task-number: 250119 --- src/gui/kernel/qshortcutmap.cpp | 1 + tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 85 ++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index ed9654b..86894b4 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -753,6 +753,7 @@ bool QShortcutMap::correctGraphicsWidgetContext(Qt::ShortcutContext context, QGr tw = tw->parentWidget(); return tw == w; } + return false; } // Below is Qt::WindowShortcut context diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index f25a079..b85abd3 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include "../../shared/util.h" @@ -150,6 +151,7 @@ private slots: // Task fixes void task236127_bspTreeIndexFails(); void task243004_setStyleCrash(); + void task250119_shortcutContext(); }; @@ -1827,6 +1829,89 @@ void tst_QGraphicsWidget::task243004_setStyleCrash() delete item2; } +class GraphicsWidget_task250119 : public QGraphicsWidget +{ +public: + GraphicsWidget_task250119() + : shortcutEvents(0) + { + setFocusPolicy(Qt::StrongFocus); + resize(100, 100); + } + + int shortcutEvents; + +private: + bool event(QEvent *event) + { + if (event->type() == QEvent::Shortcut) + shortcutEvents++; + return QGraphicsWidget::event(event); + } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) + { + if (hasFocus()) { + painter->setPen(QPen(Qt::black, 0, Qt::DashLine)); + painter->drawRect(rect()); + } + painter->setPen(QPen(Qt::black, 0, Qt::SolidLine)); + painter->fillRect(rect().adjusted(2, 2, -2, -2), Qt::yellow); + painter->drawRect(rect().adjusted(2, 2, -2, -2)); + } +}; + +void tst_QGraphicsWidget::task250119_shortcutContext() +{ + QGraphicsScene scene; + QGraphicsView view; + view.setScene(&scene); + view.show(); + QTest::qWait(100); + + + // *** Event: *** + + GraphicsWidget_task250119 w_event; + scene.addItem(&w_event); + + const int id = w_event.grabShortcut(Qt::Key_A, Qt::WidgetWithChildrenShortcut); + w_event.setShortcutEnabled(id, true); + + w_event.setFocus(); + QTest::keyPress(&view, Qt::Key_A); + QCOMPARE(w_event.shortcutEvents, 1); + + w_event.clearFocus(); + QTest::keyPress(&view, Qt::Key_A); + QCOMPARE(w_event.shortcutEvents, 1); + + scene.removeItem(&w_event); + + + // *** Signal: *** + + GraphicsWidget_task250119 w_signal; + scene.addItem(&w_signal); + + QAction action(0); + action.setShortcut(Qt::Key_B); + action.setShortcutContext(Qt::WidgetWithChildrenShortcut); + QSignalSpy spy(&action, SIGNAL(triggered())); + + w_signal.addAction(&action); + + w_signal.setFocus(); + QTest::keyPress(&view, Qt::Key_B); + QCOMPARE(spy.count(), 1); + + w_signal.clearFocus(); + QTest::keyPress(&view, Qt::Key_B); + QCOMPARE(spy.count(), 1); + + scene.removeItem(&w_signal); +} + QTEST_MAIN(tst_QGraphicsWidget) #include "tst_qgraphicswidget.moc" -- cgit v0.12 From bb0e2a55192cd134eb642dfa2f5e7ee93668a059 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 12 May 2009 10:21:21 +0200 Subject: Fix handling of gradients on pens in the emulation paint engine. The handling of gradients with object bounding mode on pens in the emulation paint engine has been changed to agree with the SVG standard, where pen widths are ignored when calculating bounding boxes. Instead of converting strokes to fills and then transforming the gradients based on the fills' bounding box, the gradients are now transformed first based on the bounding box of the stroke path. Reviewed-by: Trond --- src/gui/painting/qemulationpaintengine.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp index 3397c45..175f1ab 100644 --- a/src/gui/painting/qemulationpaintengine.cpp +++ b/src/gui/painting/qemulationpaintengine.cpp @@ -123,14 +123,30 @@ void QEmulationPaintEngine::stroke(const QVectorPath &path, const QPen &pen) real_engine->stroke(path, bgPen); } - QBrush brush = pen.brush(); + QPen copy = pen; Qt::BrushStyle style = qbrush_style(brush); if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { const QGradient *g = brush.gradient(); + if (g->coordinateMode() > QGradient::LogicalMode) { - QPaintEngineEx::stroke(path, pen); - return; + if (g->coordinateMode() == QGradient::StretchToDeviceMode) { + QTransform mat = brush.transform(); + mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height()); + brush.setTransform(mat); + copy.setBrush(brush); + real_engine->stroke(path, copy); + return; + } else if (g->coordinateMode() == QGradient::ObjectBoundingMode) { + QTransform mat = brush.transform(); + QRealRect r = path.controlPointRect(); + mat.translate(r.x1, r.y1); + mat.scale(r.x2 - r.x1, r.y2 - r.y1); + brush.setTransform(mat); + copy.setBrush(brush); + real_engine->stroke(path, copy); + return; + } } } -- cgit v0.12 From e51a4a22cdeb200d2851c96a82b4c282ec5dd2d3 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 12 May 2009 11:49:15 +0200 Subject: Avoid warnings in assignPropertyWithAnimation test They added a warning when you animate a non-existent property, so we make sure the properties are defined. --- tests/auto/qstatemachine/tst_qstatemachine.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index dbc67d1..df19f26 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1253,6 +1253,8 @@ void tst_QStateMachine::assignPropertyWithAnimation() { QStateMachine machine; QObject obj; + obj.setProperty("foo", 321); + obj.setProperty("bar", 654); QState *s1 = new QState(machine.rootState()); s1->assignProperty(&obj, "foo", 123); QState *s2 = new QState(machine.rootState()); @@ -1276,6 +1278,8 @@ void tst_QStateMachine::assignPropertyWithAnimation() { QStateMachine machine; QObject obj; + obj.setProperty("foo", 321); + obj.setProperty("bar", 654); QState *s1 = new QState(machine.rootState()); s1->assignProperty(&obj, "foo", 123); QState *s2 = new QState(machine.rootState()); @@ -1302,6 +1306,8 @@ void tst_QStateMachine::assignPropertyWithAnimation() { QStateMachine machine; QObject obj; + obj.setProperty("foo", 321); + obj.setProperty("bar", 654); QState *s1 = new QState(machine.rootState()); s1->assignProperty(&obj, "foo", 123); s1->assignProperty(&obj, "bar", 321); @@ -1329,6 +1335,8 @@ void tst_QStateMachine::assignPropertyWithAnimation() { QStateMachine machine; QObject obj; + obj.setProperty("foo", 321); + obj.setProperty("bar", 654); QState *s1 = new QState(machine.rootState()); QCOMPARE(s1->childMode(), QState::ExclusiveStates); QCOMPARE(s1->initialState(), (QAbstractState*)0); -- cgit v0.12 From 5e12abc10ced54cf169773be78d19fc767b2439f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 12 May 2009 12:19:53 +0200 Subject: Fixes crash when calling QState::setErrorState() with null pointer When the state is null, it isn't the root state. --- src/corelib/statemachine/qstate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 5f61865..3a3bfc3 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -285,7 +285,7 @@ void QState::setErrorState(QAbstractState *state) "to a different state machine"); return; } - if (state->machine() != 0 && state->machine()->rootState() == state) { + if (state != 0 && state->machine() != 0 && state->machine()->rootState() == state) { qWarning("QStateMachine::setErrorState: root state cannot be error state"); return; } -- cgit v0.12 From 0b01202d770a5847af00dc6ebba0d2a75f1a271b Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 12 May 2009 12:23:31 +0200 Subject: Kill warning in removeDefaultAnimation() test Warning about animating non-existent properties. --- tests/auto/qstatemachine/tst_qstatemachine.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index df19f26..d24a945 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -2715,9 +2715,12 @@ void tst_QStateMachine::removeDefaultAnimation() { QStateMachine machine; + QObject propertyHolder; + propertyHolder.setProperty("foo", 0); + QCOMPARE(machine.defaultAnimations().size(), 0); - QPropertyAnimation *anim = new QPropertyAnimation(this, "foo"); + QPropertyAnimation *anim = new QPropertyAnimation(&propertyHolder, "foo"); machine.addDefaultAnimation(anim); @@ -2730,7 +2733,7 @@ void tst_QStateMachine::removeDefaultAnimation() machine.addDefaultAnimation(anim); - QPropertyAnimation *anim2 = new QPropertyAnimation(this, "foo"); + QPropertyAnimation *anim2 = new QPropertyAnimation(&propertyHolder, "foo"); machine.addDefaultAnimation(anim2); QCOMPARE(machine.defaultAnimations().size(), 2); -- cgit v0.12 From 0b5f851adea024df6a81bb9dc69c51e000c9253e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 12 May 2009 12:49:49 +0200 Subject: Don't interrupt test before animation finishes We're testing if both animations actually run and finish, so we need to make sure one of the polished signals is emitted last, and then react to this. I've done this by setting the duration of the animation which animated the property set by s2Child, so that it's sufficient to listen to this polished signal. --- tests/auto/qstatemachine/tst_qstatemachine.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index d24a945..9058cb6 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -2529,6 +2529,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation() QAbstractTransition *at = s2Child->addTransition(new EventTransition(QEvent::User, s2Child2)); QPropertyAnimation *animation = new QPropertyAnimation(object, "bar", s2); + animation->setDuration(2000); connect(animation, SIGNAL(finished()), &counter, SLOT(slot())); at->addAnimation(animation); @@ -2541,10 +2542,11 @@ void tst_QStateMachine::nestedTargetStateForAnimation() animation = new QPropertyAnimation(object, "bar", s2); connect(animation, SIGNAL(finished()), &counter, SLOT(slot())); at->addAnimation(animation); - + QState *s3 = new QState(machine.rootState()); + s2->addTransition(s2Child, SIGNAL(polished()), s3); + QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - s2->addTransition(s2, SIGNAL(polished()), s3); machine.setInitialState(s1); machine.start(); -- cgit v0.12 From 636f82be8db71c6f2ba815ca5b5d2e983476701b Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 12 May 2009 13:16:46 +0200 Subject: redo statecharts in proper UML notation, expand documentation --- doc/src/images/statemachine-button-history.png | Bin 91677 -> 8493 bytes doc/src/images/statemachine-button-nested.png | Bin 73774 -> 7051 bytes doc/src/images/statemachine-button.png | Bin 32767 -> 4233 bytes doc/src/images/statemachine-customevents.png | Bin 0 -> 2544 bytes doc/src/images/statemachine-finished.png | Bin 37907 -> 5518 bytes doc/src/images/statemachine-nonparallel.png | Bin 68482 -> 5350 bytes doc/src/images/statemachine-parallel.png | Bin 99587 -> 8631 bytes doc/src/statemachine.qdoc | 172 +++++++++++++++++++++---- 8 files changed, 150 insertions(+), 22 deletions(-) create mode 100644 doc/src/images/statemachine-customevents.png diff --git a/doc/src/images/statemachine-button-history.png b/doc/src/images/statemachine-button-history.png index cd66478..7f51cae 100644 Binary files a/doc/src/images/statemachine-button-history.png and b/doc/src/images/statemachine-button-history.png differ diff --git a/doc/src/images/statemachine-button-nested.png b/doc/src/images/statemachine-button-nested.png index 60360d1..762ac14 100644 Binary files a/doc/src/images/statemachine-button-nested.png and b/doc/src/images/statemachine-button-nested.png differ diff --git a/doc/src/images/statemachine-button.png b/doc/src/images/statemachine-button.png index 75d9e53..10102bd 100644 Binary files a/doc/src/images/statemachine-button.png and b/doc/src/images/statemachine-button.png differ diff --git a/doc/src/images/statemachine-customevents.png b/doc/src/images/statemachine-customevents.png new file mode 100644 index 0000000..62a4222 Binary files /dev/null and b/doc/src/images/statemachine-customevents.png differ diff --git a/doc/src/images/statemachine-finished.png b/doc/src/images/statemachine-finished.png index 802621e..0ac081d 100644 Binary files a/doc/src/images/statemachine-finished.png and b/doc/src/images/statemachine-finished.png differ diff --git a/doc/src/images/statemachine-nonparallel.png b/doc/src/images/statemachine-nonparallel.png index 1fe60d8..f9850a7 100644 Binary files a/doc/src/images/statemachine-nonparallel.png and b/doc/src/images/statemachine-nonparallel.png differ diff --git a/doc/src/images/statemachine-parallel.png b/doc/src/images/statemachine-parallel.png index 1868792..a65c297 100644 Binary files a/doc/src/images/statemachine-parallel.png and b/doc/src/images/statemachine-parallel.png differ diff --git a/doc/src/statemachine.qdoc b/doc/src/statemachine.qdoc index 60ae815..dff6731 100644 --- a/doc/src/statemachine.qdoc +++ b/doc/src/statemachine.qdoc @@ -33,10 +33,10 @@ The State Machine framework provides an API and execution model that can be used to effectively embed the elements and semantics of statecharts in Qt - applications. The framework integrates tightly with Qt's existing event - system and meta-object system; for example, transitions between states can - be triggered by signals, and states can be configured to set properties and - invoke methods on QObjects. + applications. The framework integrates tightly with Qt's meta-object system; + for example, transitions between states can be triggered by signals, and + states can be configured to set properties and invoke methods on QObjects. + Qt's event system is used to drive the state machines. \section1 A Simple State Machine @@ -52,34 +52,49 @@ \endomit The following snippet shows the code needed to create such a state machine. + First, we create the state machine and states: \code QStateMachine machine; QState *s1 = new QState(); QState *s2 = new QState(); QState *s3 = new QState(); + \endcode + + Then, we create the transitions by using the QState::addTransition() + function: + \code s1->addTransition(button, SIGNAL(clicked()), s2); s2->addTransition(button, SIGNAL(clicked()), s3); s3->addTransition(button, SIGNAL(clicked()), s1); + \endcode + Next, we add the states to the machine and set the machine's initial state: + + \code machine.addState(s1); machine.addState(s2); machine.addState(s3); machine.setInitialState(s1); + \endcode + Finally, we start the state machine: + + \code machine.start(); \endcode - Once the state machine has been set up, you need to start it by calling - QStateMachine::start(). The state machine executes asynchronously, i.e. it - becomes part of your application's event loop. + The state machine executes asynchronously, i.e. it becomes part of your + application's event loop. + + \section1 Doing Useful Work on State Entry and Exit - The above state machine is perfectly fine, but it doesn't \e do anything; it - merely transitions from one state to another. The QState::assignProperty() - function can be used to have a state set a property of a QObject when the - state is entered. In the following snippet, the value that should be - assigned to a QLabel's text property is specified for each state: + The above state machine merely transitions from one state to another, it + doesn't perform any operations. The QState::assignProperty() function can be + used to have a state set a property of a QObject when the state is + entered. In the following snippet, the value that should be assigned to a + QLabel's text property is specified for each state: \code s1->assignProperty(label, "text", "In state s1"); @@ -90,20 +105,26 @@ When any of the states is entered, the label's text will be changed accordingly. - The QActionState::entered() signal is emitted when the state is entered. In the + The QState::entered() signal is emitted when the state is entered, and the + QState::exited() signal is emitted when the state is exited. In the following snippet, the button's showMaximized() slot will be called when - state \c s3 is entered: + state \c s3 is entered, and the button's showMinimized() slot will be called + when \c s3 is exited: \code QObject::connect(s3, SIGNAL(entered()), button, SLOT(showMaximized())); + QObject::connect(s3, SIGNAL(exited()), button, SLOT(showMinimized())); \endcode - \section1 Sharing Transitions By Grouping States + \section1 State Machines That Finish The state machine defined in the previous section never finishes. In order for a state machine to be able to finish, it needs to have a top-level \e - final state. When the state machine enters a top-level final state, the - machine will emit the finished() signal and halt. + final state (QFinalState object). When the state machine enters a top-level + final state, the machine will emit the QStateMachine::finished() signal and + halt. + + \section1 Sharing Transitions By Grouping States Assume we wanted the user to be able to quit the application at any time by clicking a Quit button. In order to achieve this, we need to create a final @@ -165,6 +186,9 @@ s12>addTransition(quitButton, SIGNAL(clicked()), s12); \endcode + A transition can have any state as its target, i.e. the target state does + not have to be on the same level in the state hierarchy as the source state. + \section1 Using History States to Save and Restore the Current State Imagine that we wanted to add an "interrupt" mechanism to the example @@ -251,10 +275,16 @@ QState *s12 = new QState(s1); \endcode + When a parallel state group is entered, all its child states will be + simultaneously entered. Transitions within the individual child states + operate normally. However, any of the child states may take a transition + outside the parent state. When this happens, the parent state and all of its + child states are exited. + \section1 Detecting that a Composite State has Finished - A child state can be final; when a final child state is entered, the parent - state emits the QState::finished() signal. + A child state can be final (a QFinalState object); when a final child state + is entered, the parent state emits the QState::finished() signal. \img statemachine-finished.png \omit @@ -263,7 +293,105 @@ This is useful when you want to hide the internal details of a state; i.e. the only thing the outside world should be able to do is enter the - state, and get a notification when the state has finished (i.e. when a final - child state has been entered). + state, and get a notification when the state has completed its work. + + For parallel state groups, the QState::finished() signal is emitted when \e + all the child states have entered final states. + + \section1 Events, Transitions and Guards + + A QStateMachine runs its own event loop. For signal transitions + (QSignalTransition objects), QStateMachine automatically posts a + QSignalEvent to itself when it intercepts the corresponding signal; + similarly, for QObject event transitions (QEventTransition objects) a + QWrappedEvent is posted. + + You can post your own events to the state machine using + QStateMachine::postEvent(). + + When posting a custom event to the state machine, you typically also have + one or more custom transitions that can be triggered from events of that + type. To create such a transition, you subclass QAbstractTransition and + reimplement QAbstractTransition::eventTest(), where you check if an event + matches your event type (and optionally other criteria, e.g. attributes of + the event object). + + Here we define our own custom event type, \c StringEvent, for posting + strings to the state machine: + + \code + struct StringEvent : public QEvent + { + StringEvent(const QString &val) + : QEvent(QEvent::Type(QEvent::User+1)), + value(val) {} + + QString value; + }; + \endcode + + Next, we define a transition that only triggers when the event's string + matches a particular string (a \e guarded transition): - */ + \code + class StringTransition : public QAbstractTransition + { + public: + StringTransition(const QString &value) + : m_value(value) {} + + protected: + virtual bool eventTest(QEvent *e) const + { + if (e->type() != QEvent::Type(QEvent::User+1)) // StringEvent + return false; + StringEvent *se = static_cast(e); + return (m_value == se->value); + } + + virtual void onTransition(QEvent *) {} + + private: + QString m_value; + }; + \endcode + + In the eventTest() reimplementation, we first check if the event type is the + desired one; if so, we cast the event to a StringEvent and perform the + string comparison. + + The following is a statechart that uses the custom event and transition: + + \img statemachine-customevents.png + \omit + \caption This is a caption + \endomit + + Here's what the implementation of the statechart looks like: + + \code + QStateMachine machine; + QState *s1 = new QState(); + QState *s2 = new QState(); + QFinalState *done = new QFinalState(); + + StringTransition *t1 = new StringTransition("Hello"); + t1->setTargetState(s2); + s1->addTransition(t1); + StringTransition *t2 = new StringTransition("world"); + t2->setTargetState(done); + s2->addTransition(t2); + + machine.addState(s1); + machine.addState(s2); + machine.addState(done); + machine.setInitialState(s1); + \endcode + + Once the machine is started, we can post events to it. + + \code + machine.postEvent(new StringEvent("Hello")); + machine.postEvent(new StringEvent("world")); + \endcode +*/ -- cgit v0.12 From bc184432c49eb56254bc5db07c6af03718c6b0e7 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Tue, 12 May 2009 13:52:28 +0200 Subject: Correcting bug in QString::fromWCharArray documentation Clearifying details about bit size of the wchar_t input and the way they are handled. Task-number:227709 Rev-by: Marius Storm-Olsen --- src/corelib/tools/qstring.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 375d672..c3649e3 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -743,7 +743,9 @@ int QString::grow(int size) /*! \since 4.2 - Returns a copy of the \a string string encoded in ucs4. + Returns a copy of the \a string, where the encoding of \a string depends on + the size of wchar. If wchar is 4 bytes, the \a string is interpreted as ucs-4, + if wchar is 2 bytes it is interpreted as ucs-2. If \a size is -1 (default), the \a string has to be 0 terminated. -- cgit v0.12 From a62575f61db7d4b34799205de1956600c8e9c47e Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 12 May 2009 14:27:25 +0200 Subject: improve the docs for the trafficlight example --- doc/src/examples/trafficlight.qdoc | 43 +++++++++++++++---------- doc/src/images/trafficlight-example1.png | Bin 0 -> 3694 bytes doc/src/images/trafficlight-example2.png | Bin 0 -> 7257 bytes examples/statemachine/trafficlight/main.cpp | 47 +++++++++++++--------------- 4 files changed, 49 insertions(+), 41 deletions(-) create mode 100644 doc/src/images/trafficlight-example1.png create mode 100644 doc/src/images/trafficlight-example2.png diff --git a/doc/src/examples/trafficlight.qdoc b/doc/src/examples/trafficlight.qdoc index 16ee8ad..50cab035 100644 --- a/doc/src/examples/trafficlight.qdoc +++ b/doc/src/examples/trafficlight.qdoc @@ -26,30 +26,41 @@ \snippet examples/statemachine/trafficlight/main.cpp 0 The LightWidget class represents a single light of the traffic light. It - provides a setOn() function to turn the light on or off. It paints itself - in the color that's passed to the constructor. + provides an \c on property and two slots, turnOn() and turnOff(), to turn + the light on and off, respectively. The widget paints itself in the color + that's passed to the constructor. - \snippet examples/statemachine/trafficlight/main.cpp 2 + \snippet examples/statemachine/trafficlight/main.cpp 1 The TrafficLightWidget class represents the visual part of the traffic - light; it's a widget that contains three lights, and provides accessor - functions for these. + light; it's a widget that contains three lights arranged vertically, and + provides accessor functions for these. - \snippet examples/statemachine/trafficlight/main.cpp 1 + \snippet examples/statemachine/trafficlight/main.cpp 2 + + The createLightState() function creates a state that turns a light on when + the state is entered, and off when the state is exited. The state uses a + timer, and as we shall see the timeout is used to transition from one + LightState to another. Here is the statechart for the light state: - The LightState class represents a state that turns a light on when the - state is entered, and off when the state is exited. The class is a timer, - and as we shall see the timeout is used to transition from one LightState - to another. + \img trafficlight-example1.png + \omit + \caption This is a caption + \endomit \snippet examples/statemachine/trafficlight/main.cpp 3 - The TrafficLight class combines the TrafficLightWidget with control flow - based on the LightState class. The state graph has four states: - red-to-yellow, yellow-to-green, green-to-yellow and yellow-to-red. The - initial state is red-to-yellow; when the state's timer times out, the - state machine transitions to yellow-to-green. The same process repeats - through the other states. + The TrafficLight class combines the TrafficLightWidget with a state + machine. The state graph has four states: red-to-yellow, yellow-to-green, + green-to-yellow and yellow-to-red. The initial state is red-to-yellow; + when the state's timer times out, the state machine transitions to + yellow-to-green. The same process repeats through the other states. + This is what the statechart looks like: + + \img trafficlight-example2.png + \omit + \caption This is a caption + \endomit \snippet examples/statemachine/trafficlight/main.cpp 4 diff --git a/doc/src/images/trafficlight-example1.png b/doc/src/images/trafficlight-example1.png new file mode 100644 index 0000000..ec8c7ff Binary files /dev/null and b/doc/src/images/trafficlight-example1.png differ diff --git a/doc/src/images/trafficlight-example2.png b/doc/src/images/trafficlight-example2.png new file mode 100644 index 0000000..a12e4db Binary files /dev/null and b/doc/src/images/trafficlight-example2.png differ diff --git a/examples/statemachine/trafficlight/main.cpp b/examples/statemachine/trafficlight/main.cpp index 3c47a51..8a46fff 100644 --- a/examples/statemachine/trafficlight/main.cpp +++ b/examples/statemachine/trafficlight/main.cpp @@ -87,27 +87,6 @@ private: //! [0] //! [1] -class LightState : public QState -{ -public: - LightState(LightWidget *light, int duration, QState *parent = 0) - : QState(parent) - { - QTimer *timer = new QTimer(this); - timer->setInterval(duration); - timer->setSingleShot(true); - QState *timing = new QState(this); - QObject::connect(timing, SIGNAL(entered()), light, SLOT(turnOn())); - QObject::connect(timing, SIGNAL(entered()), timer, SLOT(start())); - QObject::connect(timing, SIGNAL(exited()), light, SLOT(turnOff())); - QFinalState *done = new QFinalState(this); - timing->addTransition(timer, SIGNAL(timeout()), done); - setInitialState(timing); - } -}; -//! [1] - -//! [2] class TrafficLightWidget : public QWidget { public: @@ -139,6 +118,24 @@ private: LightWidget *m_yellow; LightWidget *m_green; }; +//! [1] + +//! [2] +QState *createLightState(LightWidget *light, int duration, QState *parent = 0) +{ + QState *lightState = new QState(parent); + QTimer *timer = new QTimer(lightState); + timer->setInterval(duration); + timer->setSingleShot(true); + QState *timing = new QState(lightState); + QObject::connect(timing, SIGNAL(entered()), light, SLOT(turnOn())); + QObject::connect(timing, SIGNAL(entered()), timer, SLOT(start())); + QObject::connect(timing, SIGNAL(exited()), light, SLOT(turnOff())); + QFinalState *done = new QFinalState(lightState); + timing->addTransition(timer, SIGNAL(timeout()), done); + lightState->setInitialState(timing); + return lightState; +} //! [2] //! [3] @@ -154,15 +151,15 @@ public: vbox->setMargin(0); QStateMachine *machine = new QStateMachine(this); - LightState *redGoingYellow = new LightState(widget->redLight(), 3000); + QState *redGoingYellow = createLightState(widget->redLight(), 3000); redGoingYellow->setObjectName("redGoingYellow"); - LightState *yellowGoingGreen = new LightState(widget->yellowLight(), 1000); + QState *yellowGoingGreen = createLightState(widget->yellowLight(), 1000); yellowGoingGreen->setObjectName("yellowGoingGreen"); redGoingYellow->addTransition(redGoingYellow, SIGNAL(finished()), yellowGoingGreen); - LightState *greenGoingYellow = new LightState(widget->greenLight(), 3000); + QState *greenGoingYellow = createLightState(widget->greenLight(), 3000); greenGoingYellow->setObjectName("greenGoingYellow"); yellowGoingGreen->addTransition(yellowGoingGreen, SIGNAL(finished()), greenGoingYellow); - LightState *yellowGoingRed = new LightState(widget->yellowLight(), 1000); + QState *yellowGoingRed = createLightState(widget->yellowLight(), 1000); yellowGoingRed->setObjectName("yellowGoingRed"); greenGoingYellow->addTransition(greenGoingYellow, SIGNAL(finished()), yellowGoingRed); yellowGoingRed->addTransition(yellowGoingRed, SIGNAL(finished()), redGoingYellow); -- cgit v0.12 From 5d6f17acc0995558f919ea4c2e974530df7b8a08 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 12 May 2009 14:29:02 +0200 Subject: update license headers --- doc/src/examples/trafficlight.qdoc | 36 +++++++++++++++++++++++++++++++++--- doc/src/statemachine.qdoc | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 66 insertions(+), 6 deletions(-) diff --git a/doc/src/examples/trafficlight.qdoc b/doc/src/examples/trafficlight.qdoc index 50cab035..ae62127 100644 --- a/doc/src/examples/trafficlight.qdoc +++ b/doc/src/examples/trafficlight.qdoc @@ -1,11 +1,41 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** 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 documentation 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/doc/src/statemachine.qdoc b/doc/src/statemachine.qdoc index 16eae39..18c5307 100644 --- a/doc/src/statemachine.qdoc +++ b/doc/src/statemachine.qdoc @@ -1,11 +1,41 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** 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 documentation 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$ ** ****************************************************************************/ -- cgit v0.12 From 4d5a5149b716c67f031a3a40e23370f90542c92f Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 12 May 2009 14:34:10 +0200 Subject: Make QAccessibleLineEdit actually accessible Q_ACCESSIBLE_OBJECT was missing --- src/plugins/accessible/widgets/simplewidgets.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h index d4552e3..d1fd0da 100644 --- a/src/plugins/accessible/widgets/simplewidgets.h +++ b/src/plugins/accessible/widgets/simplewidgets.h @@ -115,6 +115,7 @@ public: class QAccessibleLineEdit : public QAccessibleWidgetEx, public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface { + Q_ACCESSIBLE_OBJECT public: explicit QAccessibleLineEdit(QWidget *o, const QString &name = QString()); -- cgit v0.12 From c6add575d50ee30b19580fc2c1ebda5316a2f51b Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 12 May 2009 14:32:04 +0200 Subject: doc: Add documentation for animations, restore policy and polished signal --- doc/src/statemachine.qdoc | 182 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) diff --git a/doc/src/statemachine.qdoc b/doc/src/statemachine.qdoc index 18c5307..27bd4f8 100644 --- a/doc/src/statemachine.qdoc +++ b/doc/src/statemachine.qdoc @@ -425,4 +425,186 @@ machine.postEvent(new StringEvent("Hello")); machine.postEvent(new StringEvent("world")); \endcode + + \section1 Using Restore Policy To Automatically Restore Properties + + In some state machines it can be useful to focus the attention on assigning properties in states, + not on restoring them when the state is no longer active. If you know that a property should + always be restored to its initial value when the machine enters a state that does not explicitly + give the property a value, you can set the global restore policy to + QStateMachine::RestoreProperties. + + \code + QStateMachine machine; + machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); + \endcode + + When this restore policy is set, the machine will automatically restore all properties. If it + enters a state where a given property is not set, it will first search the hierarchy of ancestors + to see if the property is defined there. If it is, the property will be restored to the value + defined by the closest ancestor. If not, it will be restored to its initial value (i.e. the + value of the property before any property assignments in states were executed.) + + Take the following code: + \code + QStateMachine machine; + machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); + + QState *s1 = new QState(); + s1->assignProperty(object, "fooBar", 1.0); + machine.addState(s1); + machine.setInitialState(s1); + + QState *s2 = new QState(); + machine.addState(s2); + \endcode + + Lets say the property \c fooBar is 0.0 when the machine starts. When the machine is in state + \c s1, the property will be 1.0, since the state explicitly assigns this value to it. When the + machine is in state \c s2, no value is explicitly defined for the property, so it will implicitly + be restored to 0.0. + + If we are using nested states, the parent defines a value for the property which is inherited by + all descendants that do not explicitly assign a value to the property. + \code + QStateMachine machine; + machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); + + QState *s1 = new QState(); + s1->assignProperty(object, "fooBar", 1.0); + machine.addState(s1); + machine.setInitialState(s1); + + QState *s2 = new QState(s1); + s2->assignProperty(object, "fooBar", 2.0); + s1->setInitialState(s2); + + QState *s3 = new QState(s1); + \endcode + + Here \c s1 has two children: \c s2 and \c s3. When \c s2 is entered, the property \c fooBar + will have the value 2.0, since this is explicitly defined for the state. When the machine is in + state \c s3, no value is defined for the state, but \c s1 defines the property to be 1.0, so this + is the value that will be assigned to \c fooBar. + + \section1 Animating Property Assignments + + The State Machine API connects with the Animation API in Qt to allow automatically animating + properties as they are assigned in states. + + Say we have the following code: + \code + QState *s1 = new QState(); + QState *s2 = new QState(); + + s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100)); + + s1->addTransition(button, SIGNAL(clicked()), s2); + \endcode + + Here we define two states of a user interface. In \c s1 the \c button is small, and in \c s2 + it is bigger. If we click the button to transition from \c s1 to \c s2, the geometry of the button + will be set immediately when a given state has been entered. If we want the transition to be + smooth, however, all we need to do is make a QPropertyAnimation and add this to the transition + object. + + \code + QState *s1 = new QState(); + QState *s2 = new QState(); + + s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100)); + + QSignalTransition *transition = s1->addTransition(button, SIGNAL(clicked()), s2); + transition->addAnimation(new QPropertyAnimation(button, "geometry")); + \endcode + + Adding an animation for the property in question means that the property assignment will no + longer take immediate effect when the state has been entered. Instead, the animation will start + playing when the state has been entered and smoothly animate the property assignment. Since we + do not set the start value or end value of the animation, these will be set implicitly. The + start value of the animation will be the property's current value when the animation starts, and + the end value will be set based on the property assignments defined for the state. + + If the global restore policy of the state machine is set to QStateMachine::RestoreProperties, + it is possible to also add animations for the property restorations. + + \section1 Detecting That All Properties Have Been Set In A State + + When animations are used to assign properties, a state no longer defines the exact values that a + property will have when the machine is in the given state. While the animation is running, the + property can potentially have any value, depending on the animation. + + In some cases, it can be useful to be able to detect when the property has actually been assigned + the value defined by a state. For this, we can use the state's polished() signal. + \code + QState *s1 = new QState(); + s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50)); + + QState *s2 = new QState(); + + s1->addTransition(s1, SIGNAL(polished()), s2); + \endcode + + The machine will be in state \c s1 until the \c geometry property has been set. Then it will + immediately transition into \c s2. If the transition into \c s1 has an animation for the \c + geometry property, then the machine will stay in \c s1 until the animation has finished. If there + is no animation, it will simply set the property and immediately enter state \c s2. + + Either way, when the machine is in state \c s2, the property \c geometry has been assigned the + defined value. + + If the global restore policy is set to QStateMachine::RestoreProperties, the state will not emit + the polished() signal until these have been executed as well. + + \section1 What happens if a state is exited before the animation has finished + + If a state has property assignments, and the transition into the state has animations for the + properties, the state can potentially be exited before the properties have been assigned to the + values defines by the state. This is true in particular when there are transitions out from the + state that do not depend on the state being polished, as described in the previous section. + + The State Machine API guarantees that a property assigned by the state machine either: + \list + \o Has a value explicitly assigned to the property. + \o Is currently being animated into a value explicitly assigned to the property. + \endlist + + When a state is exited prior to the animation finishing, the behavior of the state machine depends + on the target state of the transition. If the target state explicitly assigns a value to the + property, no additional action will be taken. The property will be assigned the value defined by + the target state. + + If the target state does not assign any value to the property, there are two + options: By default, the property will be assigned the value defined by the state it is leaving + (the value it would have been assigned if the animation had been permitted to finish playing.) If + a global restore policy is set, however, this will take precedence, and the property will be + restored as usual. + + \section1 Default Animations + + As described earlier, you can add animations to transitions to make sure property assignments + in the target state are animated. If you want a specific animation to be used for a given property + regardless of which transition is taken, you can add it as a default animation to the state + machine. This is in particular useful when the properties assigned (or restored) by specific + states is not known when the machine is constructed. + + \code + QState *s1 = new QState(); + QState *s2 = new QState(); + + s2->assignProperty(object, "fooBar", 2.0); + s1->addTransition(s2); + + QStateMachine machine; + machine.setInitialState(s1); + machine.addDefaultAnimation(new QPropertyAnimation(object, "fooBar")); + \endcode + + When the machine is in state \c s2, the machine will play the default animation for the + property \c fooBar since this property is assigned by \c s2. + + Note that animations explicitly set on transitions will take precedence over any default + animation for the given property. */ -- cgit v0.12 From 8c4aee1be1e50bd49207aee61ac41613e07e0605 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Tue, 5 May 2009 11:09:25 +0200 Subject: Fix typo in spreadsheet example Reviewed-by: Kavindra Palaraja --- demos/spreadsheet/spreadsheet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/spreadsheet/spreadsheet.cpp b/demos/spreadsheet/spreadsheet.cpp index 742855e..d740aee 100644 --- a/demos/spreadsheet/spreadsheet.cpp +++ b/demos/spreadsheet/spreadsheet.cpp @@ -481,7 +481,7 @@ void SpreadSheet::setupContents() table->setItem(3, 0, new SpreadSheetItem("Lunch")); table->setItem(4, 0, new SpreadSheetItem("Flight (LA)")); table->setItem(5, 0, new SpreadSheetItem("Taxi")); - table->setItem(6, 0, new SpreadSheetItem("Diinner")); + table->setItem(6, 0, new SpreadSheetItem("Dinner")); table->setItem(7, 0, new SpreadSheetItem("Hotel")); table->setItem(8, 0, new SpreadSheetItem("Flight (Oslo)")); table->setItem(9, 0, new SpreadSheetItem("Total:")); -- cgit v0.12 From e863e3195e90db89c29603508e6857a5cc874ca4 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 12 May 2009 15:51:39 +0200 Subject: document the statemachine/pingpong example --- doc/src/examples.qdoc | 1 + doc/src/examples/pingpong.qdoc | 107 ++++++++++++++++++++++++++++++++ doc/src/images/pingpong-example.png | Bin 0 -> 7843 bytes examples/statemachine/pingpong/main.cpp | 14 +++++ 4 files changed, 122 insertions(+) create mode 100644 doc/src/examples/pingpong.qdoc create mode 100644 doc/src/images/pingpong-example.png diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc index 06d7727..4bedcde 100644 --- a/doc/src/examples.qdoc +++ b/doc/src/examples.qdoc @@ -312,6 +312,7 @@ \list \o \l{statemachine/trafficlight}{Traffic Light}\raisedaster + \o \l{statemachine/pingpong}{Ping Pong States}\raisedaster \endlist \section1 Threads diff --git a/doc/src/examples/pingpong.qdoc b/doc/src/examples/pingpong.qdoc new file mode 100644 index 0000000..040e429 --- /dev/null +++ b/doc/src/examples/pingpong.qdoc @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** 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 statemachine/pingpong + \title Ping Pong States Example + + The Ping Pong States example shows how to use parallel states together + with custom events and transitions in \l{The State Machine Framework}. + + This example implements a statechart where two states communicate by + posting events to the state machine. The state chart looks as follows: + + \img pingpong-example.png + \omit + \caption This is a caption + \endomit + + The \c pinger and \c ponger states are parallel states, i.e. they are + entered simultaneously and will take transitions independently of + eachother. + + The \c pinger state will post the first \c ping event upon entry; the \c + ponger state will respond by posting a \c pong event; this will cause the + \c pinger state to post a new \c ping event; and so on. + + \snippet examples/statemachine/pingpong/main.cpp 0 + + Two custom events are defined, \c PingEvent and \c PongEvent. + + \snippet examples/statemachine/pingpong/main.cpp 1 + + The \c Pinger class defines a state that posts a \c PingEvent to the state + machine when the state is entered. + + \snippet examples/statemachine/pingpong/main.cpp 2 + + The \c PingTransition class defines a transition that is triggered by + events of type \c PingEvent, and that posts a \c PongEvent (with a delay + of 500 milliseconds) to the state machine when the transition is + triggered. + + \snippet examples/statemachine/pingpong/main.cpp 3 + + The \c PongTransition class defines a transition that is triggered by + events of type \c PongEvent, and that posts a \c PingEvent (with a delay + of 500 milliseconds) to the state machine when the transition is + triggered. + + \snippet examples/statemachine/pingpong/main.cpp 4 + + The main() function begins by creating a state machine and a parallel + state group. + + \snippet examples/statemachine/pingpong/main.cpp 5 + + Next, the \c pinger and \c ponger states are created, with the parallel + state group as their parent state. Note that the transitions are \e + targetless. When such a transition is triggered, the source state won't be + exited and re-entered; only the transition's onTransition() function will + be called, and the state machine's configuration will remain the same, + which is precisely what we want in this case. + + \snippet examples/statemachine/pingpong/main.cpp 6 + + Finally, the group is added to the state machine, the machine is started, + and the application event loop is entered. + + */ diff --git a/doc/src/images/pingpong-example.png b/doc/src/images/pingpong-example.png new file mode 100644 index 0000000..af707e4 Binary files /dev/null and b/doc/src/images/pingpong-example.png differ diff --git a/examples/statemachine/pingpong/main.cpp b/examples/statemachine/pingpong/main.cpp index eb8fd5d..db66bfd 100644 --- a/examples/statemachine/pingpong/main.cpp +++ b/examples/statemachine/pingpong/main.cpp @@ -47,6 +47,7 @@ #include #endif +//! [0] class PingEvent : public QEvent { public: @@ -60,7 +61,9 @@ public: PongEvent() : QEvent(QEvent::Type(QEvent::User+3)) {} }; +//! [0] +//! [1] class Pinger : public QState { public: @@ -74,7 +77,9 @@ protected: fprintf(stdout, "ping?\n"); } }; +//! [1] +//! [3] class PongTransition : public QAbstractTransition { public: @@ -90,7 +95,9 @@ protected: fprintf(stdout, "ping?\n"); } }; +//! [3] +//! [2] class PingTransition : public QAbstractTransition { public: @@ -106,7 +113,9 @@ protected: fprintf(stdout, "pong!\n"); } }; +//! [2] +//! [4] int main(int argc, char **argv) { QCoreApplication app(argc, argv); @@ -114,7 +123,9 @@ int main(int argc, char **argv) QStateMachine machine; QState *group = new QState(QState::ParallelStates); group->setObjectName("group"); +//! [4] +//! [5] Pinger *pinger = new Pinger(group); pinger->setObjectName("pinger"); pinger->addTransition(new PongTransition()); @@ -122,10 +133,13 @@ int main(int argc, char **argv) QState *ponger = new QState(group); ponger->setObjectName("ponger"); ponger->addTransition(new PingTransition()); +//! [5] +//! [6] machine.addState(group); machine.setInitialState(group); machine.start(); return app.exec(); } +//! [6] -- cgit v0.12 From 62edc8d78a8e38c62a87420bd3b37c886c6926d3 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Tue, 12 May 2009 16:11:41 +0200 Subject: Adding documentation to the fancy browser example Added documentation to the fancy browser example. Task-number:252097 Rev-by: Geir Vattekar Rev-by: Ariya Hidayat --- doc/src/examples/fancybrowser.qdoc | 103 +++++++++++++++++++++++++++- examples/webkit/fancybrowser/mainwindow.cpp | 20 +++++- examples/webkit/fancybrowser/mainwindow.h | 4 +- 3 files changed, 122 insertions(+), 5 deletions(-) diff --git a/doc/src/examples/fancybrowser.qdoc b/doc/src/examples/fancybrowser.qdoc index 9001c20..8338d8b 100644 --- a/doc/src/examples/fancybrowser.qdoc +++ b/doc/src/examples/fancybrowser.qdoc @@ -40,12 +40,109 @@ ****************************************************************************/ /*! - \example webkit/fancybrowser - \title Fancy Browser Example + \example webkit/fancybrowser + \title Fancy Browser Example The Fancy Browser example shows how to use jQuery with QtWebKit to - make a web browser with some special effects and content manipulation. + create a web browser with special effects and content + manipulation. \image fancybrowser-example.png + The application makes use of QWebFrame::evaluateJavaScript to + evaluate the jQuery JavaScript code. A QMainWindow with a QWebView + as central widget builds up the browser itself. + + \section1 MainWindow Class Definition + + The \c MainWindow class inherits QMainWindow. It implements a number of + slots to perform actions on both the application and on the web content. + + \snippet examples/webkit/fancybrowser/mainwindow.h 1 + + We also declare a QString that contains the jQuery, a QWebView + that displays the web content, and a QLineEdit that acts as the + address bar. + + \section1 MainWindow Class Implementation + + We start by implementing the constructor. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 1 + + The first part of the constructor sets the value of \c progress to + 0. This value will be used later in the code to visualize the + loading of a webpage. + + Next, the jQuery library is loaded using a QFile and reading the file + content. The jQuery library is a JavaScript library that provides different + functions for manipulating HTML. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 2 + + The second part of the constructor creates a QWebView and connects + slots to the views signals. Furthermore, we create a QLineEdit as + the browsers address bar. We then set the horizontal QSizePolicy + to fill the available area in the browser at all times. We add the + QLineEdit to a QToolbar together with a set of navigation actions + from QWebView::pageAction. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 3 + + The third and last part of the constructor implements two QMenus and assigns + a set of actions to them. The last line sets the QWebView as the central + widget in the QMainWindow. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 4 + + When the page is loaded, \c adjustLocation() updates the address + bar; \c adjustLocation() is triggered by the \c loadFinished() + signal in QWebView. In \c changeLocation() we create a QUrl + objecti, and then use it to load the page into the QWebView. When + the new web page has finished loading, \c adjustLocation() will be + run once more to update the address bar. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 5 + + \c adjustTitle() sets the window title and displays the loading + progress. This slot is triggered by the \c titleChanged() signal + in QWebView. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 6 + + When a web page has loaded, \c finishLoading() is triggered by the + \c loadFinished() signal in QWebView. \c finishLoading() then updates the + progress in the title bar and calls \c evaluateJavaScript() to evaluate the + jQuery library. This evaluates the JavaScript against the current web page. + What that means is that the JavaScript can be viewed as part of the content + loaded into the QWebView, and therefore needs to be loaded every time a new + page is loaded. Once the jQuery library is loaded, we can start executing + the different jQuery functions in the browser. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 7 + + The first jQuery-based function, \c highlightAllLinks(), is designed to + highlight all links in the current webpage. The JavaScript code looks + for web elements named \i {a}, which is the tag for a hyperlink. + For each such element, the background color is set to be yellow by + using CSS. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 8 + + The \c rotateImages() function rotates the images on the current + web page. Webkit supports CSS transforms and this JavaScript code + looks up all \i {img} elements and rotates the images 180 degrees + and then back again. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 9 + + The remaining four methods remove different elements from the current web + page. \c removeGifImages() removes all Gif images on the page by looking up + the \i {src} attribute of all the elements on the web page. Any element with + a \i {gif} file as its source is removed. \c removeInlineFrames() removes all + \i {iframe} or inline elements. \c removeObjectElements() removes all + \i {object} elements, and \c removeEmbeddedElements() removes any elements + such as plugins embedded on the page using the \i {embed} element. + */ + diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index bf61f9c..e24f6cf 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -43,6 +43,8 @@ #include #include "mainwindow.h" +//! [1] + MainWindow::MainWindow() { progress = 0; @@ -52,7 +54,9 @@ MainWindow::MainWindow() file.open(QIODevice::ReadOnly); jQuery = file.readAll(); file.close(); +//! [1] +//! [2] view = new QWebView(this); view->load(QUrl("http://www.google.com/ncr")); connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation())); @@ -70,7 +74,9 @@ MainWindow::MainWindow() toolBar->addAction(view->pageAction(QWebPage::Reload)); toolBar->addAction(view->pageAction(QWebPage::Stop)); toolBar->addWidget(locationEdit); +//! [2] +//! [3] QMenu *effectMenu = menuBar()->addMenu(tr("&Effect")); effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks())); @@ -89,7 +95,9 @@ MainWindow::MainWindow() setCentralWidget(view); } +//! [3] +//! [4] void MainWindow::adjustLocation() { locationEdit->setText(view->url().toString()); @@ -98,11 +106,12 @@ void MainWindow::adjustLocation() void MainWindow::changeLocation() { QUrl url = QUrl(locationEdit->text()); - locationEdit->setText(url.toString()); view->load(url); view->setFocus(); } +//! [4] +//! [5] void MainWindow::adjustTitle() { if (progress <= 0 || progress >= 100) @@ -116,20 +125,26 @@ void MainWindow::setProgress(int p) progress = p; adjustTitle(); } +//! [5] +//! [6] void MainWindow::finishLoading(bool) { progress = 100; adjustTitle(); view->page()->mainFrame()->evaluateJavaScript(jQuery); } +//! [6] +//! [7] void MainWindow::highlightAllLinks() { QString code = "$('a').each( function () { $(this).css('background-color', 'yellow') } )"; view->page()->mainFrame()->evaluateJavaScript(code); } +//! [7] +//! [8] void MainWindow::rotateImages(bool toggle) { QString code = "$('img').each( function () { $(this).css('-webkit-transition', '-webkit-transform 2s') } )"; @@ -140,7 +155,9 @@ void MainWindow::rotateImages(bool toggle) code = "$('img').each( function () { $(this).css('-webkit-transform', 'rotate(0deg)') } )"; view->page()->mainFrame()->evaluateJavaScript(code); } +//! [8] +//! [9] void MainWindow::removeGifImages() { QString code = "$('[src*=gif]').remove()"; @@ -164,4 +181,5 @@ void MainWindow::removeEmbeddedElements() QString code = "$('embed').remove()"; view->page()->mainFrame()->evaluateJavaScript(code); } +//! [9] diff --git a/examples/webkit/fancybrowser/mainwindow.h b/examples/webkit/fancybrowser/mainwindow.h index 9362ca7..2e1068c 100644 --- a/examples/webkit/fancybrowser/mainwindow.h +++ b/examples/webkit/fancybrowser/mainwindow.h @@ -39,13 +39,14 @@ ** ****************************************************************************/ -#include +#include QT_BEGIN_NAMESPACE class QWebView; class QLineEdit; QT_END_NAMESPACE +//! [1] class MainWindow : public QMainWindow { Q_OBJECT @@ -73,4 +74,5 @@ private: QWebView *view; QLineEdit *locationEdit; int progress; +//! [1] }; -- cgit v0.12 From 0c3d59a34c404ba1cec1ab6dbe88e4bf0664538b Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 12 May 2009 16:13:40 +0200 Subject: QListView was assuming that selected indexes were always children of their root. This can be different. ...especially if one manages the selection by program or if you share the selection model with a treeview. Task-number: 196118 Reviewed-by: ogoffart --- src/gui/itemviews/qlistview.cpp | 8 ++++++-- tests/auto/qlistview/tst_qlistview.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 3e00cd0..1071c1d 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1608,6 +1608,10 @@ QRegion QListView::visualRegionForSelection(const QItemSelection &selection) con if (!selection.at(i).isValid()) continue; QModelIndex parent = selection.at(i).topLeft().parent(); + //we only display the children of the root in a listview + //we're not interested in the other model indexes + if (parent != d->root) + continue; int t = selection.at(i).topLeft().row(); int b = selection.at(i).bottomRight().row(); if (d->viewMode == IconMode || d->isWrapping()) { // in non-static mode, we have to go through all selected items @@ -1616,8 +1620,8 @@ QRegion QListView::visualRegionForSelection(const QItemSelection &selection) con } else { // in static mode, we can optimize a bit while (t <= b && d->isHidden(t)) ++t; while (b >= t && d->isHidden(b)) --b; - const QModelIndex top = d->model->index(t, c, d->root); - const QModelIndex bottom = d->model->index(b, c, d->root); + const QModelIndex top = d->model->index(t, c, parent); + const QModelIndex bottom = d->model->index(b, c, parent); QRect rect(visualRect(top).topLeft(), visualRect(bottom).bottomRight()); selectionRegion += QRegion(rect); diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 791a472..f70db14 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -106,6 +106,7 @@ private slots: void task228566_infiniteRelayout(); void task248430_crashWith0SizedItem(); void task250446_scrollChanged(); + void task196118_visualRegionForSelection(); void keyboardSearch(); }; @@ -1556,6 +1557,29 @@ void tst_QListView::task250446_scrollChanged() QCOMPARE(view.currentIndex(), index); } +void tst_QListView::task196118_visualRegionForSelection() +{ + class MyListView : public QListView + { + public: + QRegion visualRegionForSelection() const + { return QListView::visualRegionForSelection( selectionModel()->selection()); } + } view; + + QStandardItemModel model; + QStandardItem top1("top1"); + QStandardItem sub1("sub1"); + top1.appendRow(QList() << &sub1); + model.appendColumn(QList() << &top1); + view.setModel(&model); + view.setRootIndex(top1.index()); + + view.selectionModel()->select(top1.index(), QItemSelectionModel::Select); + + QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1); + QVERIFY(view.visualRegionForSelection().isEmpty()); +} + void tst_QListView::keyboardSearch() { QStringList items; -- cgit v0.12 From 4ece5c8923e559643f79833146d02a3976021f63 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 12 May 2009 16:16:35 +0200 Subject: kill some simplistic/overlapping/under-developed examples --- .../statemachine/clockticking/clockticking.pro | 10 -- examples/statemachine/clockticking/main.cpp | 123 --------------------- examples/statemachine/composition/composition.pro | 7 -- examples/statemachine/composition/main.cpp | 104 ----------------- examples/statemachine/helloworld/helloworld.pro | 10 -- examples/statemachine/helloworld/main.cpp | 78 ------------- examples/statemachine/pauseandresume/main.cpp | 102 ----------------- .../statemachine/pauseandresume/pauseandresume.pro | 7 -- examples/statemachine/statemachine.pro | 4 - 9 files changed, 445 deletions(-) delete mode 100644 examples/statemachine/clockticking/clockticking.pro delete mode 100644 examples/statemachine/clockticking/main.cpp delete mode 100644 examples/statemachine/composition/composition.pro delete mode 100644 examples/statemachine/composition/main.cpp delete mode 100644 examples/statemachine/helloworld/helloworld.pro delete mode 100644 examples/statemachine/helloworld/main.cpp delete mode 100644 examples/statemachine/pauseandresume/main.cpp delete mode 100644 examples/statemachine/pauseandresume/pauseandresume.pro diff --git a/examples/statemachine/clockticking/clockticking.pro b/examples/statemachine/clockticking/clockticking.pro deleted file mode 100644 index bff9cb8..0000000 --- a/examples/statemachine/clockticking/clockticking.pro +++ /dev/null @@ -1,10 +0,0 @@ -QT = core -TEMPLATE = app -TARGET = -win32: CONFIG += console -mac:CONFIG -= app_bundle -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp diff --git a/examples/statemachine/clockticking/main.cpp b/examples/statemachine/clockticking/main.cpp deleted file mode 100644 index ea8e692..0000000 --- a/examples/statemachine/clockticking/main.cpp +++ /dev/null @@ -1,123 +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 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 -#include -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#endif - -class ClockEvent : public QEvent -{ -public: - ClockEvent() : QEvent(QEvent::Type(QEvent::User+2)) - {} -}; - -class ClockState : public QState -{ -public: - ClockState(QState *parent) - : QState(parent) {} - -protected: - virtual void onEntry(QEvent *) - { - fprintf(stdout, "ClockState entered; posting the initial tick\n"); - machine()->postEvent(new ClockEvent()); - } -}; - -class ClockTransition : public QAbstractTransition -{ -public: - ClockTransition() {} - -protected: - virtual bool eventTest(QEvent *e) const { - return (e->type() == QEvent::User+2); - } - virtual void onTransition(QEvent *) - { - fprintf(stdout, "ClockTransition triggered; posting another tick with a delay of 1 second\n"); - machine()->postEvent(new ClockEvent(), 1000); - } -}; - -class ClockListener : public QAbstractTransition -{ -public: - ClockListener() {} - -protected: - virtual bool eventTest(QEvent *e) const { - return (e->type() == QEvent::User+2); - } - virtual void onTransition(QEvent *) - { - fprintf(stdout, "ClockListener heard a tick!\n"); - } -}; - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - QStateMachine machine; - QState *group = new QState(QState::ParallelStates); - group->setObjectName("group"); - - ClockState *clock = new ClockState(group); - clock->setObjectName("clock"); - clock->addTransition(new ClockTransition()); - - QState *listener = new QState(group); - listener->setObjectName("listener"); - listener->addTransition(new ClockListener()); - - machine.addState(group); - machine.setInitialState(group); - machine.start(); - - return app.exec(); -} diff --git a/examples/statemachine/composition/composition.pro b/examples/statemachine/composition/composition.pro deleted file mode 100644 index 6a976cb..0000000 --- a/examples/statemachine/composition/composition.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp diff --git a/examples/statemachine/composition/main.cpp b/examples/statemachine/composition/main.cpp deleted file mode 100644 index 0afff66..0000000 --- a/examples/statemachine/composition/main.cpp +++ /dev/null @@ -1,104 +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 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#endif - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - QLabel label; - label.setAlignment(Qt::AlignCenter); - - QStateMachine machine; - - QState *s1 = new QState(); - s1->setObjectName("s1"); - s1->assignProperty(&label, "text", "In S1, hang on..."); - s1->assignProperty(&label, "geometry", QRect(100, 100, 200, 100)); - - QState *s1_timer = new QState(s1); - s1_timer->setObjectName("s1_timer"); - QTimer t1; - t1.setInterval(2000); - QObject::connect(s1_timer, SIGNAL(entered()), &t1, SLOT(start())); - QFinalState *s1_done = new QFinalState(s1); - s1_done->setObjectName("s1_done"); - s1_timer->addTransition(&t1, SIGNAL(timeout()), s1_done); - s1->setInitialState(s1_timer); - - QState *s2 = new QState(); - s2->setObjectName("s2"); - s2->assignProperty(&label, "text", "In S2, I'm gonna quit on you..."); - s2->assignProperty(&label, "geometry", QRect(300, 300, 300, 100)); -// s2->invokeMethodOnEntry(&label, "setNum", QList() << 123); -// s2->invokeMethodOnEntry(&label, "showMaximized"); - - QState *s2_timer = new QState(s2); - s2_timer->setObjectName("s2_timer"); - QTimer t2; - t2.setInterval(2000); - QObject::connect(s2_timer, SIGNAL(entered()), &t2, SLOT(start())); - QFinalState *s2_done = new QFinalState(s2); - s2_done->setObjectName("s2_done"); - s2_timer->addTransition(&t2, SIGNAL(timeout()), s2_done); - s2->setInitialState(s2_timer); - - s1->addTransition(s1, SIGNAL(finished()), s2); - - QFinalState *s3 = new QFinalState(); - s3->setObjectName("s3"); - s2->addTransition(s2, SIGNAL(finished()), s3); - - machine.addState(s1); - machine.addState(s2); - machine.addState(s3); - machine.setInitialState(s1); - QObject::connect(&machine, SIGNAL(finished()), &app, SLOT(quit())); - machine.start(); - - label.show(); - return app.exec(); -} diff --git a/examples/statemachine/helloworld/helloworld.pro b/examples/statemachine/helloworld/helloworld.pro deleted file mode 100644 index ac79117..0000000 --- a/examples/statemachine/helloworld/helloworld.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = app -TARGET = -QT = core -win32: CONFIG += console -mac:CONFIG -= app_bundle -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp diff --git a/examples/statemachine/helloworld/main.cpp b/examples/statemachine/helloworld/main.cpp deleted file mode 100644 index fbe34b5..0000000 --- a/examples/statemachine/helloworld/main.cpp +++ /dev/null @@ -1,78 +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 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#endif - -class S0 : public QState -{ -public: - S0(QState *parent = 0) - : QState(parent) {} - - virtual void onEntry(QEvent *) - { - fprintf(stdout, "Hello world!\n"); - } -}; - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - QStateMachine machine; - QState *s0 = new S0(); - QFinalState *s1 = new QFinalState(); - s0->addTransition(s1); - - machine.addState(s0); - machine.addState(s1); - machine.setInitialState(s0); - - QObject::connect(&machine, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit())); - machine.start(); - - return app.exec(); -} diff --git a/examples/statemachine/pauseandresume/main.cpp b/examples/statemachine/pauseandresume/main.cpp deleted file mode 100644 index 5bacb41..0000000 --- a/examples/statemachine/pauseandresume/main.cpp +++ /dev/null @@ -1,102 +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 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#include -#endif - -class Window : public QWidget -{ -public: - Window(QWidget *parent = 0) - : QWidget(parent) - { - QPushButton *pb = new QPushButton("Go"); - QPushButton *pauseButton = new QPushButton("Pause"); - QPushButton *quitButton = new QPushButton("Quit"); - QVBoxLayout *vbox = new QVBoxLayout(this); - vbox->addWidget(pb); - vbox->addWidget(pauseButton); - vbox->addWidget(quitButton); - - QStateMachine *machine = new QStateMachine(this); - - QState *process = new QState(machine->rootState()); - process->setObjectName("process"); - - QState *s1 = new QState(process); - s1->setObjectName("s1"); - QState *s2 = new QState(process); - s2->setObjectName("s2"); - s1->addTransition(pb, SIGNAL(clicked()), s2); - s2->addTransition(pb, SIGNAL(clicked()), s1); - - QHistoryState *h = new QHistoryState(process); - h->setDefaultState(s1); - - QState *interrupted = new QState(machine->rootState()); - interrupted->setObjectName("interrupted"); - QFinalState *terminated = new QFinalState(machine->rootState()); - terminated->setObjectName("terminated"); - interrupted->addTransition(pauseButton, SIGNAL(clicked()), h); - interrupted->addTransition(quitButton, SIGNAL(clicked()), terminated); - - process->addTransition(pauseButton, SIGNAL(clicked()), interrupted); - process->addTransition(quitButton, SIGNAL(clicked()), terminated); - - process->setInitialState(s1); - machine->setInitialState(process); - QObject::connect(machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit())); - machine->start(); - } -}; - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - Window win; - win.show(); - return app.exec(); -} diff --git a/examples/statemachine/pauseandresume/pauseandresume.pro b/examples/statemachine/pauseandresume/pauseandresume.pro deleted file mode 100644 index 6a976cb..0000000 --- a/examples/statemachine/pauseandresume/pauseandresume.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp diff --git a/examples/statemachine/statemachine.pro b/examples/statemachine/statemachine.pro index ba32c12..ea3e7a8 100644 --- a/examples/statemachine/statemachine.pro +++ b/examples/statemachine/statemachine.pro @@ -1,11 +1,7 @@ TEMPLATE = subdirs SUBDIRS = \ - clockticking \ - composition \ eventtransitions \ factorial \ - helloworld \ - pauseandresume \ pingpong \ trafficlight \ twowaybutton -- cgit v0.12 From 544072cae31038ab16425c06186d8bca176f26e4 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 12 May 2009 16:12:52 +0200 Subject: The description cited MySQL and the code is for PostgreSQL. Task-number: 253427 Reviewed-by: TrustMe --- src/sql/kernel/qsqldatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 6232452..a270c0e 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -378,7 +378,7 @@ void QSqlDatabasePrivate::disable() the connection name argument, if you don't pass the connection name argument, the default connection is assumed. The following snippet shows how to create and open a default connection to a - MySQL database: + PostgreSQL database: \snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 0 -- cgit v0.12 From 661096f7ed2d9d5c91d716ba414c7286220c6cf9 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 12 May 2009 16:12:52 +0200 Subject: The description cited MySQL and the code is for PostgreSQL. Task-number: 253427 Reviewed-by: TrustMe --- src/sql/kernel/qsqldatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 6232452..a270c0e 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -378,7 +378,7 @@ void QSqlDatabasePrivate::disable() the connection name argument, if you don't pass the connection name argument, the default connection is assumed. The following snippet shows how to create and open a default connection to a - MySQL database: + PostgreSQL database: \snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 0 -- cgit v0.12 From cb516fd65149991a2105c545192a52f26a6ab67d Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 12 May 2009 16:33:28 +0200 Subject: Fixes: document statemachine/twowaybutton example --- doc/src/examples.qdoc | 1 + doc/src/examples/twowaybutton.qdoc | 82 +++++++++++++++++++++++++++++ examples/statemachine/twowaybutton/main.cpp | 22 +++++--- 3 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 doc/src/examples/twowaybutton.qdoc diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc index 4bedcde..bf169e3 100644 --- a/doc/src/examples.qdoc +++ b/doc/src/examples.qdoc @@ -311,6 +311,7 @@ \section1 State Machine \list + \o \l{statemachine/twowaybutton}{Two-way Button}\raisedaster \o \l{statemachine/trafficlight}{Traffic Light}\raisedaster \o \l{statemachine/pingpong}{Ping Pong States}\raisedaster \endlist diff --git a/doc/src/examples/twowaybutton.qdoc b/doc/src/examples/twowaybutton.qdoc new file mode 100644 index 0000000..87de2e8 --- /dev/null +++ b/doc/src/examples/twowaybutton.qdoc @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** 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 statemachine/twowaybutton + \title Two-way Button Example + + The Two-way button example shows how to use \l{The State Machine + Framework} to implement a simple state machine that toggles the current + state when a button is clicked. + + \snippet examples/statemachine/twowaybutton/main.cpp 0 + + The application's main() function begins by constructing the application + object, a button and a state machine. + + \snippet examples/statemachine/twowaybutton/main.cpp 1 + + The state machine has two states; \c on and \c off. When either state is + entered, the text of the button will be set accordingly. + + \snippet examples/statemachine/twowaybutton/main.cpp 2 + + When the state machine is in the \c off state and the button is clicked, + it will transition to the \c on state; when the state machine is in the \c + on state and the button is clicked, it will transition to the \c off + state. + + \snippet examples/statemachine/twowaybutton/main.cpp 3 + + The states are added to the state machine; they become top-level (sibling) + states. + + \snippet examples/statemachine/twowaybutton/main.cpp 4 + + The initial state is \c off; this is the state the state machine will + immediately transition to once the state machine is started. + + \snippet examples/statemachine/twowaybutton/main.cpp 5 + + Finally, the button is resized and made visible, and the application event + loop is entered. + +*/ diff --git a/examples/statemachine/twowaybutton/main.cpp b/examples/statemachine/twowaybutton/main.cpp index 61a0f32..a2c6e45 100644 --- a/examples/statemachine/twowaybutton/main.cpp +++ b/examples/statemachine/twowaybutton/main.cpp @@ -45,34 +45,42 @@ #include #endif +//! [0] int main(int argc, char **argv) { QApplication app(argc, argv); - QPushButton button; - QStateMachine machine; - QState *first = new QState(); - first->setObjectName("first"); +//! [0] +//! [1] QState *off = new QState(); off->assignProperty(&button, "text", "Off"); off->setObjectName("off"); - first->addTransition(off); QState *on = new QState(); on->setObjectName("on"); on->assignProperty(&button, "text", "On"); +//! [1] + +//! [2] off->addTransition(&button, SIGNAL(clicked()), on); on->addTransition(&button, SIGNAL(clicked()), off); +//! [2] - machine.addState(first); +//! [3] machine.addState(off); machine.addState(on); - machine.setInitialState(first); +//! [3] + +//! [4] + machine.setInitialState(off); machine.start(); +//! [4] +//! [5] button.resize(100, 50); button.show(); return app.exec(); } +//! [5] -- cgit v0.12 From d26a56e2d94bea2b5a1135b8336bbeefebf3ba1c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 12 May 2009 16:40:44 +0200 Subject: Change name of "errorstate" example to "tankgame" The error state is not a big enough part of the example to justify naming it after it. --- examples/statemachine/errorstate/errorstate.pro | 13 - examples/statemachine/errorstate/gameitem.cpp | 88 ------- examples/statemachine/errorstate/gameitem.h | 23 -- examples/statemachine/errorstate/main.cpp | 12 - examples/statemachine/errorstate/mainwindow.cpp | 257 -------------------- examples/statemachine/errorstate/mainwindow.h | 46 ---- examples/statemachine/errorstate/plugin.h | 17 -- examples/statemachine/errorstate/rocketitem.cpp | 60 ----- examples/statemachine/errorstate/rocketitem.h | 26 -- examples/statemachine/errorstate/tankitem.cpp | 262 -------------------- examples/statemachine/errorstate/tankitem.h | 65 ----- .../errorstateplugins/errorstateplugins.pro | 11 - .../errorstateplugins/random_ai/random_ai.pro | 13 - .../random_ai/random_ai_plugin.cpp | 38 --- .../errorstateplugins/random_ai/random_ai_plugin.h | 64 ----- .../errorstateplugins/seek_ai/seek_ai.cpp | 48 ---- .../errorstateplugins/seek_ai/seek_ai.h | 204 ---------------- .../errorstateplugins/seek_ai/seek_ai.pro | 13 - .../errorstateplugins/spin_ai/spin_ai.cpp | 29 --- .../errorstateplugins/spin_ai/spin_ai.h | 46 ---- .../errorstateplugins/spin_ai/spin_ai.pro | 13 - .../spin_ai_with_error/spin_ai_with_error.cpp | 29 --- .../spin_ai_with_error/spin_ai_with_error.h | 46 ---- .../spin_ai_with_error/spin_ai_with_error.pro | 13 - examples/statemachine/statemachine.pro | 4 +- examples/statemachine/tankgame/gameitem.cpp | 88 +++++++ examples/statemachine/tankgame/gameitem.h | 23 ++ examples/statemachine/tankgame/main.cpp | 12 + examples/statemachine/tankgame/mainwindow.cpp | 264 +++++++++++++++++++++ examples/statemachine/tankgame/mainwindow.h | 46 ++++ examples/statemachine/tankgame/plugin.h | 17 ++ examples/statemachine/tankgame/rocketitem.cpp | 60 +++++ examples/statemachine/tankgame/rocketitem.h | 26 ++ examples/statemachine/tankgame/tankgame.pro | 13 + examples/statemachine/tankgame/tankitem.cpp | 262 ++++++++++++++++++++ examples/statemachine/tankgame/tankitem.h | 67 ++++++ .../tankgameplugins/random_ai/random_ai.pro | 13 + .../tankgameplugins/random_ai/random_ai_plugin.cpp | 38 +++ .../tankgameplugins/random_ai/random_ai_plugin.h | 64 +++++ .../tankgameplugins/seek_ai/seek_ai.cpp | 48 ++++ .../statemachine/tankgameplugins/seek_ai/seek_ai.h | 204 ++++++++++++++++ .../tankgameplugins/seek_ai/seek_ai.pro | 13 + .../tankgameplugins/spin_ai/spin_ai.cpp | 29 +++ .../statemachine/tankgameplugins/spin_ai/spin_ai.h | 46 ++++ .../tankgameplugins/spin_ai/spin_ai.pro | 13 + .../spin_ai_with_error/spin_ai_with_error.cpp | 29 +++ .../spin_ai_with_error/spin_ai_with_error.h | 46 ++++ .../spin_ai_with_error/spin_ai_with_error.pro | 13 + .../tankgameplugins/tankgameplugins.pro | 11 + 49 files changed, 1448 insertions(+), 1437 deletions(-) delete mode 100644 examples/statemachine/errorstate/errorstate.pro delete mode 100644 examples/statemachine/errorstate/gameitem.cpp delete mode 100644 examples/statemachine/errorstate/gameitem.h delete mode 100644 examples/statemachine/errorstate/main.cpp delete mode 100644 examples/statemachine/errorstate/mainwindow.cpp delete mode 100644 examples/statemachine/errorstate/mainwindow.h delete mode 100644 examples/statemachine/errorstate/plugin.h delete mode 100644 examples/statemachine/errorstate/rocketitem.cpp delete mode 100644 examples/statemachine/errorstate/rocketitem.h delete mode 100644 examples/statemachine/errorstate/tankitem.cpp delete mode 100644 examples/statemachine/errorstate/tankitem.h delete mode 100644 examples/statemachine/errorstateplugins/errorstateplugins.pro delete mode 100644 examples/statemachine/errorstateplugins/random_ai/random_ai.pro delete mode 100644 examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.cpp delete mode 100644 examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.h delete mode 100644 examples/statemachine/errorstateplugins/seek_ai/seek_ai.cpp delete mode 100644 examples/statemachine/errorstateplugins/seek_ai/seek_ai.h delete mode 100644 examples/statemachine/errorstateplugins/seek_ai/seek_ai.pro delete mode 100644 examples/statemachine/errorstateplugins/spin_ai/spin_ai.cpp delete mode 100644 examples/statemachine/errorstateplugins/spin_ai/spin_ai.h delete mode 100644 examples/statemachine/errorstateplugins/spin_ai/spin_ai.pro delete mode 100644 examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.cpp delete mode 100644 examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.h delete mode 100644 examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.pro create mode 100644 examples/statemachine/tankgame/gameitem.cpp create mode 100644 examples/statemachine/tankgame/gameitem.h create mode 100644 examples/statemachine/tankgame/main.cpp create mode 100644 examples/statemachine/tankgame/mainwindow.cpp create mode 100644 examples/statemachine/tankgame/mainwindow.h create mode 100644 examples/statemachine/tankgame/plugin.h create mode 100644 examples/statemachine/tankgame/rocketitem.cpp create mode 100644 examples/statemachine/tankgame/rocketitem.h create mode 100644 examples/statemachine/tankgame/tankgame.pro create mode 100644 examples/statemachine/tankgame/tankitem.cpp create mode 100644 examples/statemachine/tankgame/tankitem.h create mode 100644 examples/statemachine/tankgameplugins/random_ai/random_ai.pro create mode 100644 examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp create mode 100644 examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h create mode 100644 examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp create mode 100644 examples/statemachine/tankgameplugins/seek_ai/seek_ai.h create mode 100644 examples/statemachine/tankgameplugins/seek_ai/seek_ai.pro create mode 100644 examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp create mode 100644 examples/statemachine/tankgameplugins/spin_ai/spin_ai.h create mode 100644 examples/statemachine/tankgameplugins/spin_ai/spin_ai.pro create mode 100644 examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp create mode 100644 examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h create mode 100644 examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.pro create mode 100644 examples/statemachine/tankgameplugins/tankgameplugins.pro diff --git a/examples/statemachine/errorstate/errorstate.pro b/examples/statemachine/errorstate/errorstate.pro deleted file mode 100644 index b93a691..0000000 --- a/examples/statemachine/errorstate/errorstate.pro +++ /dev/null @@ -1,13 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) on 22. apr 14:11:33 2009 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += C:/dev/kinetic/examples/statemachine/errorstate/. . - -# Input -HEADERS += mainwindow.h plugin.h tankitem.h rocketitem.h gameitem.h -SOURCES += main.cpp mainwindow.cpp tankitem.cpp rocketitem.cpp gameitem.cpp -CONFIG += console diff --git a/examples/statemachine/errorstate/gameitem.cpp b/examples/statemachine/errorstate/gameitem.cpp deleted file mode 100644 index 1a2af71..0000000 --- a/examples/statemachine/errorstate/gameitem.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "gameitem.h" - -#include -#include - -GameItem::GameItem(QObject *parent) : QObject(parent) -{ -} - -QPointF GameItem::tryMove(const QPointF &requestedPosition, QLineF *collidedLine, - QGraphicsItem **collidedItem) const -{ - QLineF movementPath(pos(), requestedPosition); - - qreal cannonLength = 0.0; - { - QPointF p1 = boundingRect().center(); - QPointF p2 = QPointF(boundingRect().right() + 10.0, p1.y()); - - cannonLength = QLineF(mapToScene(p1), mapToScene(p2)).length(); - } - - movementPath.setLength(movementPath.length() + cannonLength); - - QRectF boundingRectPath(QPointF(qMin(movementPath.x1(), movementPath.x2()), qMin(movementPath.y1(), movementPath.y2())), - QPointF(qMax(movementPath.x1(), movementPath.x2()), qMax(movementPath.y1(), movementPath.y2()))); - - QList itemsInRect = scene()->items(boundingRectPath, Qt::IntersectsItemBoundingRect); - - QPointF nextPoint = requestedPosition; - QRectF sceneRect = scene()->sceneRect(); - - foreach (QGraphicsItem *item, itemsInRect) { - if (item == static_cast(this)) - continue; - - QPolygonF mappedBoundingRect = item->mapToScene(item->boundingRect()); - for (int i=0; isceneRect().topLeft(), scene()->sceneRect().bottomLeft()); - } - - if (nextPoint.x() > sceneRect.right()) { - nextPoint.rx() = sceneRect.right(); - if (collidedLine != 0) - *collidedLine = QLineF(scene()->sceneRect().topRight(), scene()->sceneRect().bottomRight()); - } - - if (nextPoint.y() < sceneRect.top()) { - nextPoint.ry() = sceneRect.top(); - if (collidedLine != 0) - *collidedLine = QLineF(scene()->sceneRect().topLeft(), scene()->sceneRect().topRight()); - } - - if (nextPoint.y() > sceneRect.bottom()) { - nextPoint.ry() = sceneRect.bottom(); - if (collidedLine != 0) - *collidedLine = QLineF(scene()->sceneRect().bottomLeft(), scene()->sceneRect().bottomRight()); - } - - return nextPoint; -} - diff --git a/examples/statemachine/errorstate/gameitem.h b/examples/statemachine/errorstate/gameitem.h deleted file mode 100644 index 43b8785..0000000 --- a/examples/statemachine/errorstate/gameitem.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef GAMEITEM_H -#define GAMEITEM_H - -#include - -class QLineF; -class GameItem: public QObject, public QGraphicsItem -{ - Q_OBJECT -public: - enum { Type = UserType + 1 }; - int type() const { return Type; } - - GameItem(QObject *parent = 0); - - virtual void idle(qreal elapsed) = 0; - -protected: - QPointF tryMove(const QPointF &requestedPosition, QLineF *collidedLine = 0, - QGraphicsItem **collidedItem = 0) const; -}; - -#endif diff --git a/examples/statemachine/errorstate/main.cpp b/examples/statemachine/errorstate/main.cpp deleted file mode 100644 index 26fc1bb..0000000 --- a/examples/statemachine/errorstate/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include "mainwindow.h" - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - MainWindow mainWindow; - mainWindow.show(); - - return app.exec(); -} diff --git a/examples/statemachine/errorstate/mainwindow.cpp b/examples/statemachine/errorstate/mainwindow.cpp deleted file mode 100644 index 07719bc..0000000 --- a/examples/statemachine/errorstate/mainwindow.cpp +++ /dev/null @@ -1,257 +0,0 @@ -#include "mainwindow.h" -#include "tankitem.h" -#include "rocketitem.h" -#include "plugin.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent), m_scene(0), m_machine(0), m_runningState(0), m_started(false) -{ - init(); -} - -MainWindow::~MainWindow() -{ -} - -void MainWindow::addWall(const QRectF &wall) -{ - QGraphicsRectItem *item = new QGraphicsRectItem; - item->setRect(wall); - item->setBrush(Qt::darkGreen); - item->setPen(QPen(Qt::black, 0)); - - m_scene->addItem(item); -} - -void MainWindow::init() -{ - setWindowTitle("Pluggable Tank Game"); - - QGraphicsView *view = new QGraphicsView(this); - view->setRenderHints(QPainter::Antialiasing); - setCentralWidget(view); - - m_scene = new QGraphicsScene(this); - view->setScene(m_scene); - - QRectF sceneRect = QRectF(-200.0, -200.0, 400.0, 400.0); - m_scene->setSceneRect(sceneRect); - - { - TankItem *item = new TankItem(this); - - item->setPos(m_scene->sceneRect().topLeft() + QPointF(15.0, 15.0)); - item->setDirection(45.0); - item->setColor(Qt::red); - - m_spawns.append(item); - } - - { - TankItem *item = new TankItem(this); - - item->setPos(m_scene->sceneRect().topRight() + QPointF(-15.0, 15.0)); - item->setDirection(135.0); - item->setColor(Qt::green); - - m_spawns.append(item); - } - - { - TankItem *item = new TankItem(this); - - item->setPos(m_scene->sceneRect().bottomRight() + QPointF(-15.0, -15.0)); - item->setDirection(225.0); - item->setColor(Qt::blue); - - m_spawns.append(item); - } - - { - TankItem *item = new TankItem(this); - - item->setPos(m_scene->sceneRect().bottomLeft() + QPointF(15.0, -15.0)); - item->setDirection(315.0); - item->setColor(Qt::yellow); - - m_spawns.append(item); - } - - QPointF centerOfMap = sceneRect.center(); - - addWall(QRectF(centerOfMap + QPointF(-50.0, -60.0), centerOfMap + QPointF(50.0, -50.0))); - addWall(QRectF(centerOfMap - QPointF(-50.0, -60.0), centerOfMap - QPointF(50.0, -50.0))); - addWall(QRectF(centerOfMap + QPointF(-50.0, -50.0), centerOfMap + QPointF(-40.0, 50.0))); - addWall(QRectF(centerOfMap - QPointF(-50.0, -50.0), centerOfMap - QPointF(-40.0, 50.0))); - - addWall(QRectF(sceneRect.topLeft() + QPointF(sceneRect.width() / 2.0 - 5.0, -10.0), - sceneRect.topLeft() + QPointF(sceneRect.width() / 2.0 + 5.0, 100.0))); - addWall(QRectF(sceneRect.bottomLeft() + QPointF(sceneRect.width() / 2.0 - 5.0, 10.0), - sceneRect.bottomLeft() + QPointF(sceneRect.width() / 2.0 + 5.0, -100.0))); - addWall(QRectF(sceneRect.topLeft() + QPointF(-10.0, sceneRect.height() / 2.0 - 5.0), - sceneRect.topLeft() + QPointF(100.0, sceneRect.height() / 2.0 + 5.0))); - addWall(QRectF(sceneRect.topRight() + QPointF(10.0, sceneRect.height() / 2.0 - 5.0), - sceneRect.topRight() + QPointF(-100.0, sceneRect.height() / 2.0 + 5.0))); - - - QAction *addTankAction = menuBar()->addAction("&Add tank"); - QAction *runGameAction = menuBar()->addAction("&Run game"); - runGameAction->setObjectName("runGameAction"); - QAction *stopGameAction = menuBar()->addAction("&Stop game"); - menuBar()->addSeparator(); - QAction *quitAction = menuBar()->addAction("&Quit"); - - connect(addTankAction, SIGNAL(triggered()), this, SLOT(addTank())); - connect(quitAction, SIGNAL(triggered()), this, SLOT(close())); - - m_machine = new QStateMachine(this); - QState *stoppedState = new QState(m_machine->rootState()); - stoppedState->setObjectName("stoppedState"); - stoppedState->assignProperty(runGameAction, "enabled", true); - stoppedState->assignProperty(stopGameAction, "enabled", false); - stoppedState->assignProperty(this, "started", false); - m_machine->setInitialState(stoppedState); - - QState *spawnsAvailable = new QState(stoppedState); - spawnsAvailable->setObjectName("spawnsAvailable"); - spawnsAvailable->assignProperty(addTankAction, "enabled", true); - - QState *noSpawnsAvailable = new QState(stoppedState); - noSpawnsAvailable->setObjectName("noSpawnsAvailable"); - noSpawnsAvailable->assignProperty(addTankAction, "enabled", false); - - spawnsAvailable->addTransition(this, SIGNAL(mapFull()), noSpawnsAvailable); - - QHistoryState *hs = new QHistoryState(stoppedState); - hs->setDefaultState(spawnsAvailable); - - stoppedState->setInitialState(hs); - - m_runningState = new QState(QState::ParallelStates, m_machine->rootState()); - m_runningState->setObjectName("runningState"); - m_runningState->assignProperty(addTankAction, "enabled", false); - m_runningState->assignProperty(runGameAction, "enabled", false); - m_runningState->assignProperty(stopGameAction, "enabled", true); - - stoppedState->addTransition(runGameAction, SIGNAL(triggered()), m_runningState); - m_runningState->addTransition(stopGameAction, SIGNAL(triggered()), stoppedState); - - QTimer *timer = new QTimer(this); - timer->setInterval(100); - connect(timer, SIGNAL(timeout()), this, SLOT(runStep())); - connect(m_runningState, SIGNAL(entered()), timer, SLOT(start())); - connect(m_runningState, SIGNAL(exited()), timer, SLOT(stop())); - - m_machine->start(); - m_time.start(); -} - -void MainWindow::runStep() -{ - if (!m_started) { - m_time.restart(); - m_started = true; - } else { - int elapsed = m_time.elapsed(); - if (elapsed > 0) { - m_time.restart(); - qreal elapsedSecs = elapsed / 1000.0; - QList items = m_scene->items(); - foreach (QGraphicsItem *item, items) { - if (GameItem *gameItem = qgraphicsitem_cast(item)) - gameItem->idle(elapsedSecs); - } - } - } -} - -void MainWindow::addRocket() -{ - TankItem *tankItem = qobject_cast(sender()); - if (tankItem != 0) { - RocketItem *rocketItem = new RocketItem; - - QPointF s = tankItem->mapToScene(QPointF(tankItem->boundingRect().right() + 10.0, - tankItem->boundingRect().center().y())); - rocketItem->setPos(s); - rocketItem->setDirection(tankItem->direction()); - m_scene->addItem(rocketItem); - } -} - -void MainWindow::addTank() -{ - Q_ASSERT(!m_spawns.isEmpty()); - - QDir pluginsDir(qApp->applicationDirPath()); -#if defined(Q_OS_WIN) - if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release") - pluginsDir.cdUp(); -#elif defined(Q_OS_MAC) - if (pluginsDir.dirName() == "MacOS") { - pluginsDir.cdUp(); - pluginsDir.cdUp(); - pluginsDir.cdUp(); - } -#endif - - pluginsDir.cd("plugins"); - - QStringList itemNames; - QList items; - foreach (QString fileName, pluginsDir.entryList(QDir::Files)) { - QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); - QObject *possiblePlugin = loader.instance(); - if (Plugin *plugin = qobject_cast(possiblePlugin)) { - QString objectName = possiblePlugin->objectName(); - if (objectName.isEmpty()) - objectName = fileName; - - itemNames.append(objectName); - items.append(plugin); - } - } - - if (items.isEmpty()) { - QMessageBox::information(this, "No tank types found", "Please build the errorstateplugins directory"); - return; - } - - bool ok; - QString selectedName = QInputDialog::getItem(this, "Select a tank type", "Tank types", - itemNames, 0, false, &ok); - - if (ok && !selectedName.isEmpty()) { - int idx = itemNames.indexOf(selectedName); - if (Plugin *plugin = idx >= 0 ? items.at(idx) : 0) { - TankItem *tankItem = m_spawns.takeLast(); - m_scene->addItem(tankItem); - connect(tankItem, SIGNAL(cannonFired()), this, SLOT(addRocket())); - if (m_spawns.isEmpty()) - emit mapFull(); - - QState *region = new QState(m_runningState); - QState *pluginState = plugin->create(region, tankItem); - region->setInitialState(pluginState); - - // If the plugin has an error it is disabled - QState *errorState = new QState(region); - errorState->assignProperty(tankItem, "enabled", false); - pluginState->setErrorState(errorState); - } - } -} - diff --git a/examples/statemachine/errorstate/mainwindow.h b/examples/statemachine/errorstate/mainwindow.h deleted file mode 100644 index 622dabe..0000000 --- a/examples/statemachine/errorstate/mainwindow.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include -#include - -class QGraphicsScene; -class QStateMachine; -class QState; -class TankItem; -class MainWindow: public QMainWindow -{ - Q_OBJECT - Q_PROPERTY(bool started READ started WRITE setStarted) -public: - MainWindow(QWidget *parent = 0); - ~MainWindow(); - - void setStarted(bool b) { m_started = b; } - bool started() const { return m_started; } - -public slots: - void addTank(); - void addRocket(); - void runStep(); - -signals: - void mapFull(); - -private: - void init(); - void addWall(const QRectF &wall); - - QGraphicsScene *m_scene; - - QStateMachine *m_machine; - QState *m_runningState; - - QList m_spawns; - QTime m_time; - - bool m_started : 1; -}; - -#endif - diff --git a/examples/statemachine/errorstate/plugin.h b/examples/statemachine/errorstate/plugin.h deleted file mode 100644 index 2b48d43..0000000 --- a/examples/statemachine/errorstate/plugin.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef PLUGIN_H -#define PLUGIN_H - -#include - -class QState; -class Plugin -{ -public: - virtual ~Plugin() {} - - virtual QState *create(QState *parentState, QObject *tank) = 0; -}; - -Q_DECLARE_INTERFACE(Plugin, "TankPlugin") - -#endif diff --git a/examples/statemachine/errorstate/rocketitem.cpp b/examples/statemachine/errorstate/rocketitem.cpp deleted file mode 100644 index c324980..0000000 --- a/examples/statemachine/errorstate/rocketitem.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "rocketitem.h" -#include "tankitem.h" - -#include -#include - -#include - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -RocketItem::RocketItem(QObject *parent) - : GameItem(parent), m_direction(0.0), m_distance(300.0) -{ -} - -QRectF RocketItem::boundingRect() const -{ - return QRectF(-1.0, -1.0, 2.0, 2.0); -} - -void RocketItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) -{ - painter->setBrush(Qt::black); - painter->drawEllipse(boundingRect()); -} - -void RocketItem::idle(qreal elapsed) -{ - qreal dist = elapsed * speed(); - - m_distance -= dist; - if (m_distance < 0.0) { - scene()->removeItem(this); - delete this; - return; - } - - qreal a = m_direction * M_PI / 180.0; - - qreal yd = dist * sin(a); - qreal xd = dist * sin(M_PI / 2.0 - a); - - QPointF requestedPosition = pos() + QPointF(xd, yd); - QGraphicsItem *collidedItem = 0; - QPointF nextPosition = tryMove(requestedPosition, 0, &collidedItem); - if (requestedPosition == nextPosition) { - setPos(nextPosition); - } else { - if (GameItem *gameItem = qgraphicsitem_cast(collidedItem)) { - TankItem *tankItem = qobject_cast(gameItem); - if (tankItem != 0) - tankItem->hitByRocket(); - } - - scene()->removeItem(this); - delete this; - } -} diff --git a/examples/statemachine/errorstate/rocketitem.h b/examples/statemachine/errorstate/rocketitem.h deleted file mode 100644 index 189a1dd..0000000 --- a/examples/statemachine/errorstate/rocketitem.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef ROCKETITEM_H -#define ROCKETITEM_H - -#include "gameitem.h" - -class RocketItem: public GameItem -{ - Q_OBJECT -public: - RocketItem(QObject *parent = 0); - - virtual void idle(qreal elapsed); - qreal speed() const { return 100.0; } - void setDirection(qreal direction) { m_direction = direction; } - -protected: - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - QRectF boundingRect() const; - -private: - qreal m_direction; - qreal m_distance; -}; - - -#endif diff --git a/examples/statemachine/errorstate/tankitem.cpp b/examples/statemachine/errorstate/tankitem.cpp deleted file mode 100644 index 5506a7e..0000000 --- a/examples/statemachine/errorstate/tankitem.cpp +++ /dev/null @@ -1,262 +0,0 @@ -#include "tankitem.h" - -#include -#include -#include - -#include - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -class Action -{ -public: - Action(TankItem *item) : m_item(item) - { - } - - TankItem *item() const { return m_item; } - void setItem(TankItem *item) { m_item = item; } - - virtual bool apply(qreal timeDelta) = 0; - -private: - TankItem *m_item; -}; - -class MoveAction: public Action -{ -public: - MoveAction(TankItem *item, qreal distance) - : Action(item), m_distance(distance) - { - m_reverse = m_distance < 0.0; - } - - bool apply(qreal timeDelta) - { - qreal dist = timeDelta * item()->speed() * (m_reverse ? -1.0 : 1.0); - - bool done = false; - if (qAbs(m_distance) < qAbs(dist)) { - done = true; - dist = m_distance; - } - m_distance -= dist; - - qreal a = item()->direction() * M_PI / 180.0; - - qreal yd = dist * sin(a); - qreal xd = dist * sin(M_PI / 2.0 - a); - - item()->setPos(item()->pos() + QPointF(xd, yd)); - return !done; - } - -private: - qreal m_distance; - bool m_reverse; -}; - -class TurnAction: public Action -{ -public: - TurnAction(TankItem *item, qreal distance) - : Action(item), m_distance(distance) - { - m_reverse = m_distance < 0.0; - } - - bool apply(qreal timeDelta) - { - qreal dist = timeDelta * item()->angularSpeed() * (m_reverse ? -1.0 : 1.0); - bool done = false; - if (qAbs(m_distance) < qAbs(dist)) { - done = true; - dist = m_distance; - } - m_distance -= dist; - - item()->setDirection(item()->direction() + dist); - return !done; - } - -private: - qreal m_distance; - bool m_reverse; -}; - -TankItem::TankItem(QObject *parent) - : GameItem(parent), m_currentAction(0), m_currentDirection(0.0), m_enabled(true) -{ - connect(this, SIGNAL(cannonFired()), this, SIGNAL(actionCompleted())); -} - -void TankItem::idle(qreal elapsed) -{ - if (m_enabled) { - if (m_currentAction != 0) { - if (!m_currentAction->apply(elapsed)) { - setAction(0); - emit actionCompleted(); - } - - QGraphicsItem *item = 0; - qreal distance = distanceToObstacle(&item); - if (TankItem *tankItem = qgraphicsitem_cast(item)) - emit tankSpotted(tankItem->direction(), distance); - } - } -} - -void TankItem::hitByRocket() -{ - deleteLater(); -} - -void TankItem::setAction(Action *newAction) -{ - if (m_currentAction != 0) - delete m_currentAction; - - m_currentAction = newAction; -} - -void TankItem::fireCannon() -{ - emit cannonFired(); -} - -void TankItem::moveForwards(qreal length) -{ - setAction(new MoveAction(this, length)); -} - -void TankItem::moveBackwards(qreal length) -{ - setAction(new MoveAction(this, -length)); -} - -void TankItem::turn(qreal degrees) -{ - setAction(new TurnAction(this, degrees)); -} - -void TankItem::turnTo(qreal degrees) -{ - setAction(new TurnAction(this, degrees - direction())); -} - -void TankItem::stop() -{ - setAction(0); -} - -QVariant TankItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) -{ - if (change == ItemPositionChange && scene()) { - QPointF requestedPosition = value.toPointF(); - QLineF collidedLine; - QPointF nextPoint = tryMove(requestedPosition, &collidedLine); - if (nextPoint != requestedPosition) - emit collision(collidedLine); - return nextPoint; - } else { - return QGraphicsItem::itemChange(change, value); - } -} - - -void TankItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) -{ - QRectF brect = boundingRect(); - - painter->setBrush(m_color); - painter->setPen(Qt::black); - - // body - painter->drawRect(brect.adjusted(0.0, 4.0, -2.0, -4.0)); - - // cannon - QRectF cannonBase = brect.adjusted(10.0, 6.0, -12.0, -6.0); - painter->drawEllipse(cannonBase); - - painter->drawRect(QRectF(QPointF(cannonBase.center().x(), cannonBase.center().y() - 2.0), - QPointF(brect.right(), cannonBase.center().y() + 2.0))); - - // left track - painter->setBrush(QBrush(Qt::black, Qt::VerPattern)); - QRectF leftTrackRect = QRectF(brect.topLeft(), QPointF(brect.right() - 2.0, brect.top() + 4.0)); - painter->fillRect(leftTrackRect, Qt::darkYellow); - painter->drawRect(leftTrackRect); - - // right track - QRectF rightTrackRect = QRectF(QPointF(brect.left(), brect.bottom() - 4.0), - QPointF(brect.right() - 2.0, brect.bottom())); - painter->fillRect(rightTrackRect, Qt::darkYellow); - painter->drawRect(rightTrackRect); - - if (!m_enabled) { - painter->setPen(QPen(Qt::red, 5)); - - painter->drawEllipse(brect); - - QPainterPath path; - path.addEllipse(brect); - painter->setClipPath(path); - painter->drawLine(brect.topRight(), brect.bottomLeft()); - } -} - -QRectF TankItem::boundingRect() const -{ - return QRectF(-20.0, -10.0, 40.0, 20.0); -} - -qreal TankItem::direction() const -{ - return m_currentDirection; -} - -void TankItem::setDirection(qreal newDirection) -{ - int fullRotations = int(newDirection) / 360; - newDirection -= fullRotations * 360.0; - - qreal diff = newDirection - m_currentDirection; - m_currentDirection = newDirection; - rotate(diff); -} - -qreal TankItem::distanceToObstacle(QGraphicsItem **obstacle) const -{ - qreal dist = sqrt(pow(scene()->sceneRect().width(), 2) + pow(scene()->sceneRect().height(), 2)); - - qreal a = m_currentDirection * M_PI / 180.0; - - qreal yd = dist * sin(a); - qreal xd = dist * sin(M_PI / 2.0 - a); - - QPointF requestedPosition = pos() + QPointF(xd, yd); - QGraphicsItem *collidedItem = 0; - QPointF nextPosition = tryMove(requestedPosition, 0, &collidedItem); - if (collidedItem != 0) { - if (obstacle != 0) - *obstacle = collidedItem; - - QPointF d = nextPosition - pos(); - return sqrt(pow(d.x(), 2) + pow(d.y(), 2)); - } else { - return 0.0; - } -} - -qreal TankItem::distanceToObstacle() const -{ - return distanceToObstacle(0); -} - - - diff --git a/examples/statemachine/errorstate/tankitem.h b/examples/statemachine/errorstate/tankitem.h deleted file mode 100644 index cefed69..0000000 --- a/examples/statemachine/errorstate/tankitem.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef TANKITEM_H -#define TANKITEM_H - -#include "gameitem.h" - -#include - -class Action; -class TankItem: public GameItem -{ - Q_OBJECT - Q_PROPERTY(bool enabled READ enabled WRITE setEnabled) - Q_PROPERTY(qreal direction READ direction WRITE turnTo) - Q_PROPERTY(qreal distanceToObstacle READ distanceToObstacle) -public: - TankItem(QObject *parent = 0); - - void setColor(const QColor &color) { m_color = color; } - QColor color() const { return m_color; } - - void idle(qreal elapsed); - void setDirection(qreal newDirection); - - qreal speed() const { return 90.0; } - qreal angularSpeed() const { return 90.0; } - - QRectF boundingRect() const; - - void hitByRocket(); - - void setEnabled(bool b) { m_enabled = b; } - bool enabled() const { return m_enabled; } - - qreal direction() const; - qreal distanceToObstacle() const; - qreal distanceToObstacle(QGraphicsItem **item) const; - -signals: - void tankSpotted(qreal direction, qreal distance); - void collision(const QLineF &collidedLine); - void actionCompleted(); - void cannonFired(); - -public slots: - void moveForwards(qreal length = 10.0); - void moveBackwards(qreal length = 10.0); - void turn(qreal degrees = 30.0); - void turnTo(qreal degrees = 0.0); - void stop(); - void fireCannon(); - -protected: - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value); - -private: - void setAction(Action *newAction); - - Action *m_currentAction; - qreal m_currentDirection; - QColor m_color; - bool m_enabled; -}; - -#endif diff --git a/examples/statemachine/errorstateplugins/errorstateplugins.pro b/examples/statemachine/errorstateplugins/errorstateplugins.pro deleted file mode 100644 index 5b6b758..0000000 --- a/examples/statemachine/errorstateplugins/errorstateplugins.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = random_ai \ - spin_ai_with_error \ - spin_ai \ - seek_ai - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS errorstateplugins.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins -INSTALLS += target sources diff --git a/examples/statemachine/errorstateplugins/random_ai/random_ai.pro b/examples/statemachine/errorstateplugins/random_ai/random_ai.pro deleted file mode 100644 index f290250..0000000 --- a/examples/statemachine/errorstateplugins/random_ai/random_ai.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -INCLUDEPATH += ../.. -HEADERS = random_ai_plugin.h -SOURCES = random_ai_plugin.cpp -TARGET = $$qtLibraryTarget(random_ai) -DESTDIR = ../../errorstate/plugins - -#! [0] -# install -target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstate/plugins -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS random_ai.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins/random_ai \ No newline at end of file diff --git a/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.cpp b/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.cpp deleted file mode 100644 index c196247..0000000 --- a/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "random_ai_plugin.h" - -#include -#include - -#include - -QState *RandomAiPlugin::create(QState *parentState, QObject *tank) -{ - qsrand(uint(time(NULL))); - - QState *topLevel = new QState(parentState); - - QState *selectNextActionState = new SelectActionState(topLevel); - topLevel->setInitialState(selectNextActionState); - - QState *fireState = new RandomDistanceState(topLevel); - connect(fireState, SIGNAL(distanceComputed(qreal)), tank, SLOT(fireCannon())); - selectNextActionState->addTransition(selectNextActionState, SIGNAL(fireSelected()), fireState); - - QState *moveForwardsState = new RandomDistanceState(topLevel); - connect(moveForwardsState, SIGNAL(distanceComputed(qreal)), tank, SLOT(moveForwards(qreal))); - selectNextActionState->addTransition(selectNextActionState, SIGNAL(moveForwardsSelected()), moveForwardsState); - - QState *moveBackwardsState = new RandomDistanceState(topLevel); - connect(moveBackwardsState, SIGNAL(distanceComputed(qreal)), tank, SLOT(moveBackwards(qreal))); - selectNextActionState->addTransition(selectNextActionState, SIGNAL(moveBackwardsSelected()), moveBackwardsState); - - QState *turnState = new RandomDistanceState(topLevel); - connect(turnState, SIGNAL(distanceComputed(qreal)), tank, SLOT(turn(qreal))); - selectNextActionState->addTransition(selectNextActionState, SIGNAL(turnSelected()), turnState); - - topLevel->addTransition(tank, SIGNAL(actionCompleted()), selectNextActionState); - - return topLevel; -} - -Q_EXPORT_PLUGIN2(random_ai, RandomAiPlugin) diff --git a/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.h b/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.h deleted file mode 100644 index 10e6f48..0000000 --- a/examples/statemachine/errorstateplugins/random_ai/random_ai_plugin.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef RANDOM_AI_PLUGIN_H -#define RANDOM_AI_PLUGIN_H - -#include -#include - -#include - -class SelectActionState: public QState -{ - Q_OBJECT -public: - SelectActionState(QState *parent = 0) : QState(parent) - { - } - -signals: - void fireSelected(); - void moveForwardsSelected(); - void moveBackwardsSelected(); - void turnSelected(); - -protected: - void onEntry(QEvent *) - { - int rand = qrand() % 4; - switch (rand) { - case 0: emit fireSelected(); break; - case 1: emit moveForwardsSelected(); break; - case 2: emit moveBackwardsSelected(); break; - case 3: emit turnSelected(); break; - }; - } -}; - -class RandomDistanceState: public QState -{ - Q_OBJECT -public: - RandomDistanceState(QState *parent = 0) : QState(parent) - { - } - -signals: - void distanceComputed(qreal distance); - -protected: - void onEntry(QEvent *) - { - emit distanceComputed(qreal(qrand() % 180)); - } -}; - -class RandomAiPlugin: public QObject, public Plugin -{ - Q_OBJECT - Q_INTERFACES(Plugin) -public: - RandomAiPlugin() { setObjectName("Random"); } - - virtual QState *create(QState *parentState, QObject *tank); -}; - -#endif // RANDOM_AI_PLUGIN_H diff --git a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.cpp b/examples/statemachine/errorstateplugins/seek_ai/seek_ai.cpp deleted file mode 100644 index 2fb05d4..0000000 --- a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "seek_ai.h" - -QState *SeekAi::create(QState *parentState, QObject *tank) -{ - QState *topLevel = new QState(parentState); - topLevel->setObjectName("topLevel"); - - QState *seek = new QState(topLevel); - seek->setObjectName("seek"); - topLevel->setInitialState(seek); - - QState *lookForNearestWall = new SearchState(tank, seek); - lookForNearestWall->setObjectName("lookForNearestWall"); - seek->setInitialState(lookForNearestWall); - - QState *driveToFirstObstacle = new QState(seek); - driveToFirstObstacle->setObjectName("driveToFirstObstacle"); - lookForNearestWall->addTransition(lookForNearestWall, SIGNAL(nearestObstacleStraightAhead()), - driveToFirstObstacle); - - QState *drive = new QState(driveToFirstObstacle); - drive->setObjectName("drive"); - driveToFirstObstacle->setInitialState(drive); - connect(drive, SIGNAL(entered()), tank, SLOT(moveForwards())); - connect(drive, SIGNAL(exited()), tank, SLOT(stop())); - - // Go in loop - QState *finishedDriving = new QState(driveToFirstObstacle); - finishedDriving->setObjectName("finishedDriving"); - drive->addTransition(tank, SIGNAL(actionCompleted()), finishedDriving); - finishedDriving->addTransition(drive); - - QState *turnTo = new QState(seek); - turnTo->setObjectName("turnTo"); - driveToFirstObstacle->addTransition(new CollisionTransition(tank, turnTo)); - - turnTo->addTransition(tank, SIGNAL(actionCompleted()), driveToFirstObstacle); - - ChaseState *chase = new ChaseState(tank, topLevel); - chase->setObjectName("chase"); - seek->addTransition(new TankSpottedTransition(tank, chase)); - chase->addTransition(chase, SIGNAL(finished()), driveToFirstObstacle); - chase->addTransition(new TankSpottedTransition(tank, chase)); - - return topLevel; -} - -Q_EXPORT_PLUGIN2(seek_ai, SeekAi) diff --git a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h b/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h deleted file mode 100644 index a1b5749..0000000 --- a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h +++ /dev/null @@ -1,204 +0,0 @@ -#ifndef SEEK_AI_H -#define SEEK_AI_H - -#include - -#include -#include -#include -#include -#include -#include -#include - -class SearchState: public QState -{ - Q_OBJECT -public: - SearchState(QObject *tank, QState *parentState = 0) - : QState(parentState), - m_tank(tank), - m_distanceToTurn(360.0), - m_nearestDistance(-1.0), - m_directionOfNearestObstacle(0.0) - { - } - -public slots: - void turnAlittle() - { - qreal dist = m_tank->property("distanceToObstacle").toDouble(); - - if (m_nearestDistance < 0.0 || dist < m_nearestDistance) { - m_nearestDistance = dist; - m_directionOfNearestObstacle = m_tank->property("direction").toDouble(); - } - - m_distanceToTurn -= 10.0; - if (m_distanceToTurn < 0.0) { - disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(turnAlittle())); - connect(m_tank, SIGNAL(actionCompleted()), this, SIGNAL(nearestObstacleStraightAhead())); - m_tank->setProperty("direction", m_directionOfNearestObstacle); - } - - qreal currentDirection = m_tank->property("direction").toDouble(); - m_tank->setProperty("direction", currentDirection + 10.0); - } - -signals: - void nearestObstacleStraightAhead(); - -protected: - void onEntry(QEvent *) - { - connect(m_tank, SIGNAL(actionCompleted()), this, SLOT(turnAlittle())); - turnAlittle(); - } - - void onExit(QEvent *) - { - disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(turnAlittle())); - disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(nearestObstacleStraightAhead())); - } - -private: - QObject *m_tank; - - qreal m_distanceToTurn; - qreal m_nearestDistance; - qreal m_directionOfNearestObstacle; -}; - -class CollisionTransition: public QSignalTransition -{ -public: - CollisionTransition(QObject *tank, QState *turnTo) - : QSignalTransition(tank, SIGNAL(collision(QLineF))), - m_tank(tank), - m_turnTo(turnTo) - { - setTargetState(turnTo); - } - -protected: - bool eventTest(QEvent *event) const - { - bool b = QSignalTransition::eventTest(event); - if (b) { - QSignalEvent *se = static_cast(event); - m_lastLine = se->arguments().at(0).toLineF(); - } - return b; - } - - void onTransition(QEvent *) - { - qreal angleOfWall = m_lastLine.angle(); - - qreal newDirection; - if (qrand() % 2 == 0) - newDirection = angleOfWall; - else - newDirection = angleOfWall - 180.0; - - m_turnTo->assignProperty(m_tank, "direction", newDirection); - } - -private: - mutable QLineF m_lastLine; - QObject *m_tank; - QState *m_turnTo; -}; - -class ChaseState: public QState -{ - class GoToLocationState: public QState - { - public: - GoToLocationState(QObject *tank, QState *parentState = 0) - : QState(parentState), m_tank(tank), m_distance(0.0) - { - } - - void setDistance(qreal distance) { m_distance = distance; } - - protected: - void onEntry() - { - QMetaObject::invokeMethod(m_tank, "moveForwards", Q_ARG(qreal, m_distance)); - } - - private: - QObject *m_tank; - qreal m_distance; - }; - -public: - ChaseState(QObject *tank, QState *parentState = 0) : QState(parentState), m_tank(tank) - { - QState *fireCannon = new QState(this); - connect(fireCannon, SIGNAL(entered()), tank, SLOT(fireCannon())); - setInitialState(fireCannon); - - m_goToLocation = new GoToLocationState(this); - fireCannon->addTransition(tank, SIGNAL(actionCompleted()), m_goToLocation); - - m_turnToDirection = new QState(this); - m_goToLocation->addTransition(tank, SIGNAL(actionCompleted()), m_turnToDirection); - - QFinalState *finalState = new QFinalState(this); - m_turnToDirection->addTransition(tank, SIGNAL(actionCompleted()), finalState); - } - - void setDirection(qreal direction) - { - m_turnToDirection->assignProperty(m_tank, "direction", direction); - } - - void setDistance(qreal distance) - { - m_goToLocation->setDistance(distance); - } - -private: - QObject *m_tank; - GoToLocationState *m_goToLocation; - QState *m_turnToDirection; - -}; - -class TankSpottedTransition: public QSignalTransition -{ -public: - TankSpottedTransition(QObject *tank, ChaseState *target) : QSignalTransition(tank, SIGNAL(tankSpotted(qreal,qreal))), m_chase(target) - { - setTargetState(target); - } - -protected: - bool eventTest(QEvent *event) const - { - bool b = QSignalTransition::eventTest(event); - if (b) { - QSignalEvent *se = static_cast(event); - m_chase->setDirection(se->arguments().at(0).toDouble()); - m_chase->setDistance(se->arguments().at(1).toDouble()); - } - return b; - } - -private: - ChaseState *m_chase; -}; - -class SeekAi: public QObject, public Plugin -{ - Q_OBJECT - Q_INTERFACES(Plugin) -public: - SeekAi() { setObjectName("Seek and destroy"); } - - virtual QState *create(QState *parentState, QObject *tank); -}; - -#endif diff --git a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.pro b/examples/statemachine/errorstateplugins/seek_ai/seek_ai.pro deleted file mode 100644 index 11bd242..0000000 --- a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -INCLUDEPATH += ../.. -HEADERS = seek_ai.h -SOURCES = seek_ai.cpp -TARGET = $$qtLibraryTarget(seek_ai) -DESTDIR = ../../errorstate/plugins - -#! [0] -# install -target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstate/plugins -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS seek_ai.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins/seek_ai \ No newline at end of file diff --git a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.cpp b/examples/statemachine/errorstateplugins/spin_ai/spin_ai.cpp deleted file mode 100644 index de95f41..0000000 --- a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "spin_ai.h" - -#include - -QState *SpinAi::create(QState *parentState, QObject *tank) -{ - QState *topLevel = new QState(parentState); - QState *spinState = new SpinState(tank, topLevel); - topLevel->setInitialState(spinState); - - // When tank is spotted, fire two times and go back to spin state - QState *fireState = new QState(topLevel); - - QState *fireOnce = new QState(fireState); - fireState->setInitialState(fireOnce); - connect(fireOnce, SIGNAL(entered()), tank, SLOT(fireCannon())); - - QState *fireTwice = new QState(fireState); - connect(fireTwice, SIGNAL(entered()), tank, SLOT(fireCannon())); - - fireOnce->addTransition(tank, SIGNAL(actionCompleted()), fireTwice); - fireTwice->addTransition(tank, SIGNAL(actionCompleted()), spinState); - - spinState->addTransition(tank, SIGNAL(tankSpotted(qreal,qreal)), fireState); - - return topLevel; -} - -Q_EXPORT_PLUGIN2(spin_ai, SpinAi) diff --git a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.h b/examples/statemachine/errorstateplugins/spin_ai/spin_ai.h deleted file mode 100644 index 6e220ed..0000000 --- a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef SPIN_AI_H -#define SPIN_AI_H - -#include - -#include -#include -#include - -class SpinState: public QState -{ - Q_OBJECT -public: - SpinState(QObject *tank, QState *parent) : QState(parent), m_tank(tank) - { - } - -public slots: - void spin() - { - m_tank->setProperty("direction", 90.0); - } - -protected: - void onEntry(QEvent *) - { - connect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin())); - spin(); - } - -private: - QObject *m_tank; - -}; - -class SpinAi: public QObject, public Plugin -{ - Q_OBJECT - Q_INTERFACES(Plugin) -public: - SpinAi() { setObjectName("Spin and destroy"); } - - virtual QState *create(QState *parentState, QObject *tank); -}; - -#endif diff --git a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.pro b/examples/statemachine/errorstateplugins/spin_ai/spin_ai.pro deleted file mode 100644 index c2fd937..0000000 --- a/examples/statemachine/errorstateplugins/spin_ai/spin_ai.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -INCLUDEPATH += ../.. -HEADERS = spin_ai.h -SOURCES = spin_ai.cpp -TARGET = $$qtLibraryTarget(spin_ai) -DESTDIR = ../../errorstate/plugins - -#! [0] -# install -target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstate/plugins -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS spin_ai.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins/spin_ai \ No newline at end of file diff --git a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.cpp b/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.cpp deleted file mode 100644 index 5499ba3..0000000 --- a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "spin_ai_with_error.h" - -#include - -QState *SpinAiWithError::create(QState *parentState, QObject *tank) -{ - QState *topLevel = new QState(parentState); - QState *spinState = new SpinState(tank, topLevel); - topLevel->setInitialState(spinState); - - // When tank is spotted, fire two times and go back to spin state - // (no initial state set for fireState will lead to run-time error in machine) - QState *fireState = new QState(topLevel); - - QState *fireOnce = new QState(fireState); - connect(fireOnce, SIGNAL(entered()), tank, SLOT(fireCannon())); - - QState *fireTwice = new QState(fireState); - connect(fireTwice, SIGNAL(entered()), tank, SLOT(fireCannon())); - - fireOnce->addTransition(tank, SIGNAL(actionCompleted()), fireTwice); - fireTwice->addTransition(tank, SIGNAL(actionCompleted()), spinState); - - spinState->addTransition(tank, SIGNAL(tankSpotted(qreal,qreal)), fireState); - - return topLevel; -} - -Q_EXPORT_PLUGIN2(spin_ai_with_error, SpinAiWithError) diff --git a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.h b/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.h deleted file mode 100644 index d520455..0000000 --- a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef SPIN_AI_WITH_ERROR_H -#define SPIN_AI_WITH_ERROR_H - -#include - -#include -#include -#include - -class SpinState: public QState -{ - Q_OBJECT -public: - SpinState(QObject *tank, QState *parent) : QState(parent), m_tank(tank) - { - } - -public slots: - void spin() - { - m_tank->setProperty("direction", 90.0); - } - -protected: - void onEntry(QEvent *) - { - connect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin())); - spin(); - } - -private: - QObject *m_tank; - -}; - -class SpinAiWithError: public QObject, public Plugin -{ - Q_OBJECT - Q_INTERFACES(Plugin) -public: - SpinAiWithError() { setObjectName("Spin and destroy with runtime error in state machine"); } - - virtual QState *create(QState *parentState, QObject *tank); -}; - -#endif diff --git a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.pro b/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.pro deleted file mode 100644 index 31f4c7f..0000000 --- a/examples/statemachine/errorstateplugins/spin_ai_with_error/spin_ai_with_error.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -INCLUDEPATH += ../.. -HEADERS = spin_ai_with_error.h -SOURCES = spin_ai_with_error.cpp -TARGET = $$qtLibraryTarget(spin_ai_with_error) -DESTDIR = ../../errorstate/plugins - -#! [0] -# install -target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstate/plugins -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS spin_ai_with_error.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/errorstateplugins/spin_ai_with_error \ No newline at end of file diff --git a/examples/statemachine/statemachine.pro b/examples/statemachine/statemachine.pro index ea3e7a8..5074a3c 100644 --- a/examples/statemachine/statemachine.pro +++ b/examples/statemachine/statemachine.pro @@ -4,7 +4,9 @@ SUBDIRS = \ factorial \ pingpong \ trafficlight \ - twowaybutton + twowaybutton \ + tankgame \ + tankgameplugins # install target.path = $$[QT_INSTALL_EXAMPLES]/statemachine diff --git a/examples/statemachine/tankgame/gameitem.cpp b/examples/statemachine/tankgame/gameitem.cpp new file mode 100644 index 0000000..1a2af71 --- /dev/null +++ b/examples/statemachine/tankgame/gameitem.cpp @@ -0,0 +1,88 @@ +#include "gameitem.h" + +#include +#include + +GameItem::GameItem(QObject *parent) : QObject(parent) +{ +} + +QPointF GameItem::tryMove(const QPointF &requestedPosition, QLineF *collidedLine, + QGraphicsItem **collidedItem) const +{ + QLineF movementPath(pos(), requestedPosition); + + qreal cannonLength = 0.0; + { + QPointF p1 = boundingRect().center(); + QPointF p2 = QPointF(boundingRect().right() + 10.0, p1.y()); + + cannonLength = QLineF(mapToScene(p1), mapToScene(p2)).length(); + } + + movementPath.setLength(movementPath.length() + cannonLength); + + QRectF boundingRectPath(QPointF(qMin(movementPath.x1(), movementPath.x2()), qMin(movementPath.y1(), movementPath.y2())), + QPointF(qMax(movementPath.x1(), movementPath.x2()), qMax(movementPath.y1(), movementPath.y2()))); + + QList itemsInRect = scene()->items(boundingRectPath, Qt::IntersectsItemBoundingRect); + + QPointF nextPoint = requestedPosition; + QRectF sceneRect = scene()->sceneRect(); + + foreach (QGraphicsItem *item, itemsInRect) { + if (item == static_cast(this)) + continue; + + QPolygonF mappedBoundingRect = item->mapToScene(item->boundingRect()); + for (int i=0; isceneRect().topLeft(), scene()->sceneRect().bottomLeft()); + } + + if (nextPoint.x() > sceneRect.right()) { + nextPoint.rx() = sceneRect.right(); + if (collidedLine != 0) + *collidedLine = QLineF(scene()->sceneRect().topRight(), scene()->sceneRect().bottomRight()); + } + + if (nextPoint.y() < sceneRect.top()) { + nextPoint.ry() = sceneRect.top(); + if (collidedLine != 0) + *collidedLine = QLineF(scene()->sceneRect().topLeft(), scene()->sceneRect().topRight()); + } + + if (nextPoint.y() > sceneRect.bottom()) { + nextPoint.ry() = sceneRect.bottom(); + if (collidedLine != 0) + *collidedLine = QLineF(scene()->sceneRect().bottomLeft(), scene()->sceneRect().bottomRight()); + } + + return nextPoint; +} + diff --git a/examples/statemachine/tankgame/gameitem.h b/examples/statemachine/tankgame/gameitem.h new file mode 100644 index 0000000..43b8785 --- /dev/null +++ b/examples/statemachine/tankgame/gameitem.h @@ -0,0 +1,23 @@ +#ifndef GAMEITEM_H +#define GAMEITEM_H + +#include + +class QLineF; +class GameItem: public QObject, public QGraphicsItem +{ + Q_OBJECT +public: + enum { Type = UserType + 1 }; + int type() const { return Type; } + + GameItem(QObject *parent = 0); + + virtual void idle(qreal elapsed) = 0; + +protected: + QPointF tryMove(const QPointF &requestedPosition, QLineF *collidedLine = 0, + QGraphicsItem **collidedItem = 0) const; +}; + +#endif diff --git a/examples/statemachine/tankgame/main.cpp b/examples/statemachine/tankgame/main.cpp new file mode 100644 index 0000000..26fc1bb --- /dev/null +++ b/examples/statemachine/tankgame/main.cpp @@ -0,0 +1,12 @@ +#include +#include "mainwindow.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + MainWindow mainWindow; + mainWindow.show(); + + return app.exec(); +} diff --git a/examples/statemachine/tankgame/mainwindow.cpp b/examples/statemachine/tankgame/mainwindow.cpp new file mode 100644 index 0000000..3bc9bbe --- /dev/null +++ b/examples/statemachine/tankgame/mainwindow.cpp @@ -0,0 +1,264 @@ +#include "mainwindow.h" +#include "tankitem.h" +#include "rocketitem.h" +#include "plugin.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent), m_scene(0), m_machine(0), m_runningState(0), m_started(false) +{ + init(); +} + +MainWindow::~MainWindow() +{ +} + +void MainWindow::addWall(const QRectF &wall) +{ + QGraphicsRectItem *item = new QGraphicsRectItem; + item->setRect(wall); + item->setBrush(Qt::darkGreen); + item->setPen(QPen(Qt::black, 0)); + + m_scene->addItem(item); +} + +void MainWindow::init() +{ + setWindowTitle("Pluggable Tank Game"); + + QGraphicsView *view = new QGraphicsView(this); + view->setRenderHints(QPainter::Antialiasing); + setCentralWidget(view); + + m_scene = new QGraphicsScene(this); + view->setScene(m_scene); + + QRectF sceneRect = QRectF(-200.0, -200.0, 400.0, 400.0); + m_scene->setSceneRect(sceneRect); + + { + TankItem *item = new TankItem(this); + + item->setPos(m_scene->sceneRect().topLeft() + QPointF(15.0, 15.0)); + item->setDirection(45.0); + item->setColor(Qt::red); + + m_spawns.append(item); + } + + { + TankItem *item = new TankItem(this); + + item->setPos(m_scene->sceneRect().topRight() + QPointF(-15.0, 15.0)); + item->setDirection(135.0); + item->setColor(Qt::green); + + m_spawns.append(item); + } + + { + TankItem *item = new TankItem(this); + + item->setPos(m_scene->sceneRect().bottomRight() + QPointF(-15.0, -15.0)); + item->setDirection(225.0); + item->setColor(Qt::blue); + + m_spawns.append(item); + } + + { + TankItem *item = new TankItem(this); + + item->setPos(m_scene->sceneRect().bottomLeft() + QPointF(15.0, -15.0)); + item->setDirection(315.0); + item->setColor(Qt::yellow); + + m_spawns.append(item); + } + + QPointF centerOfMap = sceneRect.center(); + + addWall(QRectF(centerOfMap + QPointF(-50.0, -60.0), centerOfMap + QPointF(50.0, -50.0))); + addWall(QRectF(centerOfMap - QPointF(-50.0, -60.0), centerOfMap - QPointF(50.0, -50.0))); + addWall(QRectF(centerOfMap + QPointF(-50.0, -50.0), centerOfMap + QPointF(-40.0, 50.0))); + addWall(QRectF(centerOfMap - QPointF(-50.0, -50.0), centerOfMap - QPointF(-40.0, 50.0))); + + addWall(QRectF(sceneRect.topLeft() + QPointF(sceneRect.width() / 2.0 - 5.0, -10.0), + sceneRect.topLeft() + QPointF(sceneRect.width() / 2.0 + 5.0, 100.0))); + addWall(QRectF(sceneRect.bottomLeft() + QPointF(sceneRect.width() / 2.0 - 5.0, 10.0), + sceneRect.bottomLeft() + QPointF(sceneRect.width() / 2.0 + 5.0, -100.0))); + addWall(QRectF(sceneRect.topLeft() + QPointF(-10.0, sceneRect.height() / 2.0 - 5.0), + sceneRect.topLeft() + QPointF(100.0, sceneRect.height() / 2.0 + 5.0))); + addWall(QRectF(sceneRect.topRight() + QPointF(10.0, sceneRect.height() / 2.0 - 5.0), + sceneRect.topRight() + QPointF(-100.0, sceneRect.height() / 2.0 + 5.0))); + + + QAction *addTankAction = menuBar()->addAction("&Add tank"); + QAction *runGameAction = menuBar()->addAction("&Run game"); + runGameAction->setObjectName("runGameAction"); + QAction *stopGameAction = menuBar()->addAction("&Stop game"); + menuBar()->addSeparator(); + QAction *quitAction = menuBar()->addAction("&Quit"); + + connect(addTankAction, SIGNAL(triggered()), this, SLOT(addTank())); + connect(quitAction, SIGNAL(triggered()), this, SLOT(close())); + + m_machine = new QStateMachine(this); + QState *stoppedState = new QState(m_machine->rootState()); + stoppedState->setObjectName("stoppedState"); + stoppedState->assignProperty(runGameAction, "enabled", true); + stoppedState->assignProperty(stopGameAction, "enabled", false); + stoppedState->assignProperty(this, "started", false); + m_machine->setInitialState(stoppedState); + + QState *spawnsAvailable = new QState(stoppedState); + spawnsAvailable->setObjectName("spawnsAvailable"); + spawnsAvailable->assignProperty(addTankAction, "enabled", true); + + QState *noSpawnsAvailable = new QState(stoppedState); + noSpawnsAvailable->setObjectName("noSpawnsAvailable"); + noSpawnsAvailable->assignProperty(addTankAction, "enabled", false); + + spawnsAvailable->addTransition(this, SIGNAL(mapFull()), noSpawnsAvailable); + + QHistoryState *hs = new QHistoryState(stoppedState); + hs->setDefaultState(spawnsAvailable); + + stoppedState->setInitialState(hs); + +//! [0] + m_runningState = new QState(QState::ParallelStates, m_machine->rootState()); +//! [0] + m_runningState->setObjectName("runningState"); + m_runningState->assignProperty(addTankAction, "enabled", false); + m_runningState->assignProperty(runGameAction, "enabled", false); + m_runningState->assignProperty(stopGameAction, "enabled", true); + + stoppedState->addTransition(runGameAction, SIGNAL(triggered()), m_runningState); + m_runningState->addTransition(stopGameAction, SIGNAL(triggered()), stoppedState); + + QTimer *timer = new QTimer(this); + timer->setInterval(100); + connect(timer, SIGNAL(timeout()), this, SLOT(runStep())); + connect(m_runningState, SIGNAL(entered()), timer, SLOT(start())); + connect(m_runningState, SIGNAL(exited()), timer, SLOT(stop())); + + m_machine->start(); + m_time.start(); +} + +void MainWindow::runStep() +{ + if (!m_started) { + m_time.restart(); + m_started = true; + } else { + int elapsed = m_time.elapsed(); + if (elapsed > 0) { + m_time.restart(); + qreal elapsedSecs = elapsed / 1000.0; + QList items = m_scene->items(); + foreach (QGraphicsItem *item, items) { + if (GameItem *gameItem = qgraphicsitem_cast(item)) + gameItem->idle(elapsedSecs); + } + } + } +} + +void MainWindow::addRocket() +{ + TankItem *tankItem = qobject_cast(sender()); + if (tankItem != 0) { + RocketItem *rocketItem = new RocketItem; + + QPointF s = tankItem->mapToScene(QPointF(tankItem->boundingRect().right() + 10.0, + tankItem->boundingRect().center().y())); + rocketItem->setPos(s); + rocketItem->setDirection(tankItem->direction()); + m_scene->addItem(rocketItem); + } +} + +void MainWindow::addTank() +{ + Q_ASSERT(!m_spawns.isEmpty()); + + QDir pluginsDir(qApp->applicationDirPath()); +#if defined(Q_OS_WIN) + if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release") + pluginsDir.cdUp(); +#elif defined(Q_OS_MAC) + if (pluginsDir.dirName() == "MacOS") { + pluginsDir.cdUp(); + pluginsDir.cdUp(); + pluginsDir.cdUp(); + } +#endif + + pluginsDir.cd("plugins"); + + QStringList itemNames; + QList items; + foreach (QString fileName, pluginsDir.entryList(QDir::Files)) { + QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); + QObject *possiblePlugin = loader.instance(); + if (Plugin *plugin = qobject_cast(possiblePlugin)) { + QString objectName = possiblePlugin->objectName(); + if (objectName.isEmpty()) + objectName = fileName; + + itemNames.append(objectName); + items.append(plugin); + } + } + + if (items.isEmpty()) { + QMessageBox::information(this, "No tank types found", "Please build the errorstateplugins directory"); + return; + } + + bool ok; +//! [1] + QString selectedName = QInputDialog::getItem(this, "Select a tank type", "Tank types", + itemNames, 0, false, &ok); +//! [1] + + if (ok && !selectedName.isEmpty()) { + int idx = itemNames.indexOf(selectedName); + if (Plugin *plugin = idx >= 0 ? items.at(idx) : 0) { + TankItem *tankItem = m_spawns.takeLast(); + m_scene->addItem(tankItem); + connect(tankItem, SIGNAL(cannonFired()), this, SLOT(addRocket())); + if (m_spawns.isEmpty()) + emit mapFull(); + + QState *region = new QState(m_runningState); +//! [2] + QState *pluginState = plugin->create(region, tankItem); +//! [2] + region->setInitialState(pluginState); + + + // If the plugin has an error it is disabled + QState *errorState = new QState(region); + errorState->assignProperty(tankItem, "enabled", false); + pluginState->setErrorState(errorState); + } + } +} + diff --git a/examples/statemachine/tankgame/mainwindow.h b/examples/statemachine/tankgame/mainwindow.h new file mode 100644 index 0000000..622dabe --- /dev/null +++ b/examples/statemachine/tankgame/mainwindow.h @@ -0,0 +1,46 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include + +class QGraphicsScene; +class QStateMachine; +class QState; +class TankItem; +class MainWindow: public QMainWindow +{ + Q_OBJECT + Q_PROPERTY(bool started READ started WRITE setStarted) +public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); + + void setStarted(bool b) { m_started = b; } + bool started() const { return m_started; } + +public slots: + void addTank(); + void addRocket(); + void runStep(); + +signals: + void mapFull(); + +private: + void init(); + void addWall(const QRectF &wall); + + QGraphicsScene *m_scene; + + QStateMachine *m_machine; + QState *m_runningState; + + QList m_spawns; + QTime m_time; + + bool m_started : 1; +}; + +#endif + diff --git a/examples/statemachine/tankgame/plugin.h b/examples/statemachine/tankgame/plugin.h new file mode 100644 index 0000000..2b48d43 --- /dev/null +++ b/examples/statemachine/tankgame/plugin.h @@ -0,0 +1,17 @@ +#ifndef PLUGIN_H +#define PLUGIN_H + +#include + +class QState; +class Plugin +{ +public: + virtual ~Plugin() {} + + virtual QState *create(QState *parentState, QObject *tank) = 0; +}; + +Q_DECLARE_INTERFACE(Plugin, "TankPlugin") + +#endif diff --git a/examples/statemachine/tankgame/rocketitem.cpp b/examples/statemachine/tankgame/rocketitem.cpp new file mode 100644 index 0000000..c324980 --- /dev/null +++ b/examples/statemachine/tankgame/rocketitem.cpp @@ -0,0 +1,60 @@ +#include "rocketitem.h" +#include "tankitem.h" + +#include +#include + +#include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +RocketItem::RocketItem(QObject *parent) + : GameItem(parent), m_direction(0.0), m_distance(300.0) +{ +} + +QRectF RocketItem::boundingRect() const +{ + return QRectF(-1.0, -1.0, 2.0, 2.0); +} + +void RocketItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) +{ + painter->setBrush(Qt::black); + painter->drawEllipse(boundingRect()); +} + +void RocketItem::idle(qreal elapsed) +{ + qreal dist = elapsed * speed(); + + m_distance -= dist; + if (m_distance < 0.0) { + scene()->removeItem(this); + delete this; + return; + } + + qreal a = m_direction * M_PI / 180.0; + + qreal yd = dist * sin(a); + qreal xd = dist * sin(M_PI / 2.0 - a); + + QPointF requestedPosition = pos() + QPointF(xd, yd); + QGraphicsItem *collidedItem = 0; + QPointF nextPosition = tryMove(requestedPosition, 0, &collidedItem); + if (requestedPosition == nextPosition) { + setPos(nextPosition); + } else { + if (GameItem *gameItem = qgraphicsitem_cast(collidedItem)) { + TankItem *tankItem = qobject_cast(gameItem); + if (tankItem != 0) + tankItem->hitByRocket(); + } + + scene()->removeItem(this); + delete this; + } +} diff --git a/examples/statemachine/tankgame/rocketitem.h b/examples/statemachine/tankgame/rocketitem.h new file mode 100644 index 0000000..189a1dd --- /dev/null +++ b/examples/statemachine/tankgame/rocketitem.h @@ -0,0 +1,26 @@ +#ifndef ROCKETITEM_H +#define ROCKETITEM_H + +#include "gameitem.h" + +class RocketItem: public GameItem +{ + Q_OBJECT +public: + RocketItem(QObject *parent = 0); + + virtual void idle(qreal elapsed); + qreal speed() const { return 100.0; } + void setDirection(qreal direction) { m_direction = direction; } + +protected: + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + QRectF boundingRect() const; + +private: + qreal m_direction; + qreal m_distance; +}; + + +#endif diff --git a/examples/statemachine/tankgame/tankgame.pro b/examples/statemachine/tankgame/tankgame.pro new file mode 100644 index 0000000..f7b0760 --- /dev/null +++ b/examples/statemachine/tankgame/tankgame.pro @@ -0,0 +1,13 @@ +###################################################################### +# Automatically generated by qmake (2.01a) on 22. apr 14:11:33 2009 +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += C:/dev/kinetic/examples/statemachine/tankgame/. . + +# Input +HEADERS += mainwindow.h plugin.h tankitem.h rocketitem.h gameitem.h +SOURCES += main.cpp mainwindow.cpp tankitem.cpp rocketitem.cpp gameitem.cpp +CONFIG += console diff --git a/examples/statemachine/tankgame/tankitem.cpp b/examples/statemachine/tankgame/tankitem.cpp new file mode 100644 index 0000000..5506a7e --- /dev/null +++ b/examples/statemachine/tankgame/tankitem.cpp @@ -0,0 +1,262 @@ +#include "tankitem.h" + +#include +#include +#include + +#include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +class Action +{ +public: + Action(TankItem *item) : m_item(item) + { + } + + TankItem *item() const { return m_item; } + void setItem(TankItem *item) { m_item = item; } + + virtual bool apply(qreal timeDelta) = 0; + +private: + TankItem *m_item; +}; + +class MoveAction: public Action +{ +public: + MoveAction(TankItem *item, qreal distance) + : Action(item), m_distance(distance) + { + m_reverse = m_distance < 0.0; + } + + bool apply(qreal timeDelta) + { + qreal dist = timeDelta * item()->speed() * (m_reverse ? -1.0 : 1.0); + + bool done = false; + if (qAbs(m_distance) < qAbs(dist)) { + done = true; + dist = m_distance; + } + m_distance -= dist; + + qreal a = item()->direction() * M_PI / 180.0; + + qreal yd = dist * sin(a); + qreal xd = dist * sin(M_PI / 2.0 - a); + + item()->setPos(item()->pos() + QPointF(xd, yd)); + return !done; + } + +private: + qreal m_distance; + bool m_reverse; +}; + +class TurnAction: public Action +{ +public: + TurnAction(TankItem *item, qreal distance) + : Action(item), m_distance(distance) + { + m_reverse = m_distance < 0.0; + } + + bool apply(qreal timeDelta) + { + qreal dist = timeDelta * item()->angularSpeed() * (m_reverse ? -1.0 : 1.0); + bool done = false; + if (qAbs(m_distance) < qAbs(dist)) { + done = true; + dist = m_distance; + } + m_distance -= dist; + + item()->setDirection(item()->direction() + dist); + return !done; + } + +private: + qreal m_distance; + bool m_reverse; +}; + +TankItem::TankItem(QObject *parent) + : GameItem(parent), m_currentAction(0), m_currentDirection(0.0), m_enabled(true) +{ + connect(this, SIGNAL(cannonFired()), this, SIGNAL(actionCompleted())); +} + +void TankItem::idle(qreal elapsed) +{ + if (m_enabled) { + if (m_currentAction != 0) { + if (!m_currentAction->apply(elapsed)) { + setAction(0); + emit actionCompleted(); + } + + QGraphicsItem *item = 0; + qreal distance = distanceToObstacle(&item); + if (TankItem *tankItem = qgraphicsitem_cast(item)) + emit tankSpotted(tankItem->direction(), distance); + } + } +} + +void TankItem::hitByRocket() +{ + deleteLater(); +} + +void TankItem::setAction(Action *newAction) +{ + if (m_currentAction != 0) + delete m_currentAction; + + m_currentAction = newAction; +} + +void TankItem::fireCannon() +{ + emit cannonFired(); +} + +void TankItem::moveForwards(qreal length) +{ + setAction(new MoveAction(this, length)); +} + +void TankItem::moveBackwards(qreal length) +{ + setAction(new MoveAction(this, -length)); +} + +void TankItem::turn(qreal degrees) +{ + setAction(new TurnAction(this, degrees)); +} + +void TankItem::turnTo(qreal degrees) +{ + setAction(new TurnAction(this, degrees - direction())); +} + +void TankItem::stop() +{ + setAction(0); +} + +QVariant TankItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) +{ + if (change == ItemPositionChange && scene()) { + QPointF requestedPosition = value.toPointF(); + QLineF collidedLine; + QPointF nextPoint = tryMove(requestedPosition, &collidedLine); + if (nextPoint != requestedPosition) + emit collision(collidedLine); + return nextPoint; + } else { + return QGraphicsItem::itemChange(change, value); + } +} + + +void TankItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) +{ + QRectF brect = boundingRect(); + + painter->setBrush(m_color); + painter->setPen(Qt::black); + + // body + painter->drawRect(brect.adjusted(0.0, 4.0, -2.0, -4.0)); + + // cannon + QRectF cannonBase = brect.adjusted(10.0, 6.0, -12.0, -6.0); + painter->drawEllipse(cannonBase); + + painter->drawRect(QRectF(QPointF(cannonBase.center().x(), cannonBase.center().y() - 2.0), + QPointF(brect.right(), cannonBase.center().y() + 2.0))); + + // left track + painter->setBrush(QBrush(Qt::black, Qt::VerPattern)); + QRectF leftTrackRect = QRectF(brect.topLeft(), QPointF(brect.right() - 2.0, brect.top() + 4.0)); + painter->fillRect(leftTrackRect, Qt::darkYellow); + painter->drawRect(leftTrackRect); + + // right track + QRectF rightTrackRect = QRectF(QPointF(brect.left(), brect.bottom() - 4.0), + QPointF(brect.right() - 2.0, brect.bottom())); + painter->fillRect(rightTrackRect, Qt::darkYellow); + painter->drawRect(rightTrackRect); + + if (!m_enabled) { + painter->setPen(QPen(Qt::red, 5)); + + painter->drawEllipse(brect); + + QPainterPath path; + path.addEllipse(brect); + painter->setClipPath(path); + painter->drawLine(brect.topRight(), brect.bottomLeft()); + } +} + +QRectF TankItem::boundingRect() const +{ + return QRectF(-20.0, -10.0, 40.0, 20.0); +} + +qreal TankItem::direction() const +{ + return m_currentDirection; +} + +void TankItem::setDirection(qreal newDirection) +{ + int fullRotations = int(newDirection) / 360; + newDirection -= fullRotations * 360.0; + + qreal diff = newDirection - m_currentDirection; + m_currentDirection = newDirection; + rotate(diff); +} + +qreal TankItem::distanceToObstacle(QGraphicsItem **obstacle) const +{ + qreal dist = sqrt(pow(scene()->sceneRect().width(), 2) + pow(scene()->sceneRect().height(), 2)); + + qreal a = m_currentDirection * M_PI / 180.0; + + qreal yd = dist * sin(a); + qreal xd = dist * sin(M_PI / 2.0 - a); + + QPointF requestedPosition = pos() + QPointF(xd, yd); + QGraphicsItem *collidedItem = 0; + QPointF nextPosition = tryMove(requestedPosition, 0, &collidedItem); + if (collidedItem != 0) { + if (obstacle != 0) + *obstacle = collidedItem; + + QPointF d = nextPosition - pos(); + return sqrt(pow(d.x(), 2) + pow(d.y(), 2)); + } else { + return 0.0; + } +} + +qreal TankItem::distanceToObstacle() const +{ + return distanceToObstacle(0); +} + + + diff --git a/examples/statemachine/tankgame/tankitem.h b/examples/statemachine/tankgame/tankitem.h new file mode 100644 index 0000000..66f05aa --- /dev/null +++ b/examples/statemachine/tankgame/tankitem.h @@ -0,0 +1,67 @@ +#ifndef TANKITEM_H +#define TANKITEM_H + +#include "gameitem.h" + +#include + +class Action; +class TankItem: public GameItem +{ + Q_OBJECT + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled) + Q_PROPERTY(qreal direction READ direction WRITE turnTo) + Q_PROPERTY(qreal distanceToObstacle READ distanceToObstacle) +public: + TankItem(QObject *parent = 0); + + void setColor(const QColor &color) { m_color = color; } + QColor color() const { return m_color; } + + void idle(qreal elapsed); + void setDirection(qreal newDirection); + + qreal speed() const { return 90.0; } + qreal angularSpeed() const { return 90.0; } + + QRectF boundingRect() const; + + void hitByRocket(); + + void setEnabled(bool b) { m_enabled = b; } + bool enabled() const { return m_enabled; } + + qreal direction() const; + qreal distanceToObstacle() const; + qreal distanceToObstacle(QGraphicsItem **item) const; + +//! [0] +signals: + void tankSpotted(qreal direction, qreal distance); + void collision(const QLineF &collidedLine); + void actionCompleted(); + void cannonFired(); + +public slots: + void moveForwards(qreal length = 10.0); + void moveBackwards(qreal length = 10.0); + void turn(qreal degrees = 30.0); + void turnTo(qreal degrees = 0.0); + void stop(); + void fireCannon(); +//! [0] + +protected: + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value); + +private: + void setAction(Action *newAction); + + Action *m_currentAction; + qreal m_currentDirection; + QColor m_color; + bool m_enabled; +}; + +#endif diff --git a/examples/statemachine/tankgameplugins/random_ai/random_ai.pro b/examples/statemachine/tankgameplugins/random_ai/random_ai.pro new file mode 100644 index 0000000..5bc0b26 --- /dev/null +++ b/examples/statemachine/tankgameplugins/random_ai/random_ai.pro @@ -0,0 +1,13 @@ +TEMPLATE = lib +CONFIG += plugin +INCLUDEPATH += ../.. +HEADERS = random_ai_plugin.h +SOURCES = random_ai_plugin.cpp +TARGET = $$qtLibraryTarget(random_ai) +DESTDIR = ../../tankgame/plugins + +#! [0] +# install +target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgame/plugins +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS random_ai.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins/random_ai \ No newline at end of file diff --git a/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp new file mode 100644 index 0000000..c196247 --- /dev/null +++ b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp @@ -0,0 +1,38 @@ +#include "random_ai_plugin.h" + +#include +#include + +#include + +QState *RandomAiPlugin::create(QState *parentState, QObject *tank) +{ + qsrand(uint(time(NULL))); + + QState *topLevel = new QState(parentState); + + QState *selectNextActionState = new SelectActionState(topLevel); + topLevel->setInitialState(selectNextActionState); + + QState *fireState = new RandomDistanceState(topLevel); + connect(fireState, SIGNAL(distanceComputed(qreal)), tank, SLOT(fireCannon())); + selectNextActionState->addTransition(selectNextActionState, SIGNAL(fireSelected()), fireState); + + QState *moveForwardsState = new RandomDistanceState(topLevel); + connect(moveForwardsState, SIGNAL(distanceComputed(qreal)), tank, SLOT(moveForwards(qreal))); + selectNextActionState->addTransition(selectNextActionState, SIGNAL(moveForwardsSelected()), moveForwardsState); + + QState *moveBackwardsState = new RandomDistanceState(topLevel); + connect(moveBackwardsState, SIGNAL(distanceComputed(qreal)), tank, SLOT(moveBackwards(qreal))); + selectNextActionState->addTransition(selectNextActionState, SIGNAL(moveBackwardsSelected()), moveBackwardsState); + + QState *turnState = new RandomDistanceState(topLevel); + connect(turnState, SIGNAL(distanceComputed(qreal)), tank, SLOT(turn(qreal))); + selectNextActionState->addTransition(selectNextActionState, SIGNAL(turnSelected()), turnState); + + topLevel->addTransition(tank, SIGNAL(actionCompleted()), selectNextActionState); + + return topLevel; +} + +Q_EXPORT_PLUGIN2(random_ai, RandomAiPlugin) diff --git a/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h new file mode 100644 index 0000000..f5e3b6f --- /dev/null +++ b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h @@ -0,0 +1,64 @@ +#ifndef RANDOM_AI_PLUGIN_H +#define RANDOM_AI_PLUGIN_H + +#include +#include + +#include + +class SelectActionState: public QState +{ + Q_OBJECT +public: + SelectActionState(QState *parent = 0) : QState(parent) + { + } + +signals: + void fireSelected(); + void moveForwardsSelected(); + void moveBackwardsSelected(); + void turnSelected(); + +protected: + void onEntry(QEvent *) + { + int rand = qrand() % 4; + switch (rand) { + case 0: emit fireSelected(); break; + case 1: emit moveForwardsSelected(); break; + case 2: emit moveBackwardsSelected(); break; + case 3: emit turnSelected(); break; + }; + } +}; + +class RandomDistanceState: public QState +{ + Q_OBJECT +public: + RandomDistanceState(QState *parent = 0) : QState(parent) + { + } + +signals: + void distanceComputed(qreal distance); + +protected: + void onEntry(QEvent *) + { + emit distanceComputed(qreal(qrand() % 180)); + } +}; + +class RandomAiPlugin: public QObject, public Plugin +{ + Q_OBJECT + Q_INTERFACES(Plugin) +public: + RandomAiPlugin() { setObjectName("Random"); } + + virtual QState *create(QState *parentState, QObject *tank); +}; + +#endif // RANDOM_AI_PLUGIN_H diff --git a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp new file mode 100644 index 0000000..2fb05d4 --- /dev/null +++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp @@ -0,0 +1,48 @@ +#include "seek_ai.h" + +QState *SeekAi::create(QState *parentState, QObject *tank) +{ + QState *topLevel = new QState(parentState); + topLevel->setObjectName("topLevel"); + + QState *seek = new QState(topLevel); + seek->setObjectName("seek"); + topLevel->setInitialState(seek); + + QState *lookForNearestWall = new SearchState(tank, seek); + lookForNearestWall->setObjectName("lookForNearestWall"); + seek->setInitialState(lookForNearestWall); + + QState *driveToFirstObstacle = new QState(seek); + driveToFirstObstacle->setObjectName("driveToFirstObstacle"); + lookForNearestWall->addTransition(lookForNearestWall, SIGNAL(nearestObstacleStraightAhead()), + driveToFirstObstacle); + + QState *drive = new QState(driveToFirstObstacle); + drive->setObjectName("drive"); + driveToFirstObstacle->setInitialState(drive); + connect(drive, SIGNAL(entered()), tank, SLOT(moveForwards())); + connect(drive, SIGNAL(exited()), tank, SLOT(stop())); + + // Go in loop + QState *finishedDriving = new QState(driveToFirstObstacle); + finishedDriving->setObjectName("finishedDriving"); + drive->addTransition(tank, SIGNAL(actionCompleted()), finishedDriving); + finishedDriving->addTransition(drive); + + QState *turnTo = new QState(seek); + turnTo->setObjectName("turnTo"); + driveToFirstObstacle->addTransition(new CollisionTransition(tank, turnTo)); + + turnTo->addTransition(tank, SIGNAL(actionCompleted()), driveToFirstObstacle); + + ChaseState *chase = new ChaseState(tank, topLevel); + chase->setObjectName("chase"); + seek->addTransition(new TankSpottedTransition(tank, chase)); + chase->addTransition(chase, SIGNAL(finished()), driveToFirstObstacle); + chase->addTransition(new TankSpottedTransition(tank, chase)); + + return topLevel; +} + +Q_EXPORT_PLUGIN2(seek_ai, SeekAi) diff --git a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h new file mode 100644 index 0000000..2835988 --- /dev/null +++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h @@ -0,0 +1,204 @@ +#ifndef SEEK_AI_H +#define SEEK_AI_H + +#include + +#include +#include +#include +#include +#include +#include +#include + +class SearchState: public QState +{ + Q_OBJECT +public: + SearchState(QObject *tank, QState *parentState = 0) + : QState(parentState), + m_tank(tank), + m_distanceToTurn(360.0), + m_nearestDistance(-1.0), + m_directionOfNearestObstacle(0.0) + { + } + +public slots: + void turnAlittle() + { + qreal dist = m_tank->property("distanceToObstacle").toDouble(); + + if (m_nearestDistance < 0.0 || dist < m_nearestDistance) { + m_nearestDistance = dist; + m_directionOfNearestObstacle = m_tank->property("direction").toDouble(); + } + + m_distanceToTurn -= 10.0; + if (m_distanceToTurn < 0.0) { + disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(turnAlittle())); + connect(m_tank, SIGNAL(actionCompleted()), this, SIGNAL(nearestObstacleStraightAhead())); + m_tank->setProperty("direction", m_directionOfNearestObstacle); + } + + qreal currentDirection = m_tank->property("direction").toDouble(); + m_tank->setProperty("direction", currentDirection + 10.0); + } + +signals: + void nearestObstacleStraightAhead(); + +protected: + void onEntry(QEvent *) + { + connect(m_tank, SIGNAL(actionCompleted()), this, SLOT(turnAlittle())); + turnAlittle(); + } + + void onExit(QEvent *) + { + disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(turnAlittle())); + disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(nearestObstacleStraightAhead())); + } + +private: + QObject *m_tank; + + qreal m_distanceToTurn; + qreal m_nearestDistance; + qreal m_directionOfNearestObstacle; +}; + +class CollisionTransition: public QSignalTransition +{ +public: + CollisionTransition(QObject *tank, QState *turnTo) + : QSignalTransition(tank, SIGNAL(collision(QLineF))), + m_tank(tank), + m_turnTo(turnTo) + { + setTargetState(turnTo); + } + +protected: + bool eventTest(QEvent *event) const + { + bool b = QSignalTransition::eventTest(event); + if (b) { + QSignalEvent *se = static_cast(event); + m_lastLine = se->arguments().at(0).toLineF(); + } + return b; + } + + void onTransition(QEvent *) + { + qreal angleOfWall = m_lastLine.angle(); + + qreal newDirection; + if (qrand() % 2 == 0) + newDirection = angleOfWall; + else + newDirection = angleOfWall - 180.0; + + m_turnTo->assignProperty(m_tank, "direction", newDirection); + } + +private: + mutable QLineF m_lastLine; + QObject *m_tank; + QState *m_turnTo; +}; + +class ChaseState: public QState +{ + class GoToLocationState: public QState + { + public: + GoToLocationState(QObject *tank, QState *parentState = 0) + : QState(parentState), m_tank(tank), m_distance(0.0) + { + } + + void setDistance(qreal distance) { m_distance = distance; } + + protected: + void onEntry() + { + QMetaObject::invokeMethod(m_tank, "moveForwards", Q_ARG(qreal, m_distance)); + } + + private: + QObject *m_tank; + qreal m_distance; + }; + +public: + ChaseState(QObject *tank, QState *parentState = 0) : QState(parentState), m_tank(tank) + { + QState *fireCannon = new QState(this); + connect(fireCannon, SIGNAL(entered()), tank, SLOT(fireCannon())); + setInitialState(fireCannon); + + m_goToLocation = new GoToLocationState(this); + fireCannon->addTransition(tank, SIGNAL(actionCompleted()), m_goToLocation); + + m_turnToDirection = new QState(this); + m_goToLocation->addTransition(tank, SIGNAL(actionCompleted()), m_turnToDirection); + + QFinalState *finalState = new QFinalState(this); + m_turnToDirection->addTransition(tank, SIGNAL(actionCompleted()), finalState); + } + + void setDirection(qreal direction) + { + m_turnToDirection->assignProperty(m_tank, "direction", direction); + } + + void setDistance(qreal distance) + { + m_goToLocation->setDistance(distance); + } + +private: + QObject *m_tank; + GoToLocationState *m_goToLocation; + QState *m_turnToDirection; + +}; + +class TankSpottedTransition: public QSignalTransition +{ +public: + TankSpottedTransition(QObject *tank, ChaseState *target) : QSignalTransition(tank, SIGNAL(tankSpotted(qreal,qreal))), m_chase(target) + { + setTargetState(target); + } + +protected: + bool eventTest(QEvent *event) const + { + bool b = QSignalTransition::eventTest(event); + if (b) { + QSignalEvent *se = static_cast(event); + m_chase->setDirection(se->arguments().at(0).toDouble()); + m_chase->setDistance(se->arguments().at(1).toDouble()); + } + return b; + } + +private: + ChaseState *m_chase; +}; + +class SeekAi: public QObject, public Plugin +{ + Q_OBJECT + Q_INTERFACES(Plugin) +public: + SeekAi() { setObjectName("Seek and destroy"); } + + virtual QState *create(QState *parentState, QObject *tank); +}; + +#endif diff --git a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.pro b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.pro new file mode 100644 index 0000000..0d8bf2e --- /dev/null +++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.pro @@ -0,0 +1,13 @@ +TEMPLATE = lib +CONFIG += plugin +INCLUDEPATH += ../.. +HEADERS = seek_ai.h +SOURCES = seek_ai.cpp +TARGET = $$qtLibraryTarget(seek_ai) +DESTDIR = ../../tankgame/plugins + +#! [0] +# install +target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgame/plugins +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS seek_ai.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins/seek_ai \ No newline at end of file diff --git a/examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp new file mode 100644 index 0000000..de95f41 --- /dev/null +++ b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp @@ -0,0 +1,29 @@ +#include "spin_ai.h" + +#include + +QState *SpinAi::create(QState *parentState, QObject *tank) +{ + QState *topLevel = new QState(parentState); + QState *spinState = new SpinState(tank, topLevel); + topLevel->setInitialState(spinState); + + // When tank is spotted, fire two times and go back to spin state + QState *fireState = new QState(topLevel); + + QState *fireOnce = new QState(fireState); + fireState->setInitialState(fireOnce); + connect(fireOnce, SIGNAL(entered()), tank, SLOT(fireCannon())); + + QState *fireTwice = new QState(fireState); + connect(fireTwice, SIGNAL(entered()), tank, SLOT(fireCannon())); + + fireOnce->addTransition(tank, SIGNAL(actionCompleted()), fireTwice); + fireTwice->addTransition(tank, SIGNAL(actionCompleted()), spinState); + + spinState->addTransition(tank, SIGNAL(tankSpotted(qreal,qreal)), fireState); + + return topLevel; +} + +Q_EXPORT_PLUGIN2(spin_ai, SpinAi) diff --git a/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h new file mode 100644 index 0000000..a331a3e --- /dev/null +++ b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h @@ -0,0 +1,46 @@ +#ifndef SPIN_AI_H +#define SPIN_AI_H + +#include + +#include +#include +#include + +class SpinState: public QState +{ + Q_OBJECT +public: + SpinState(QObject *tank, QState *parent) : QState(parent), m_tank(tank) + { + } + +public slots: + void spin() + { + m_tank->setProperty("direction", 90.0); + } + +protected: + void onEntry(QEvent *) + { + connect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin())); + spin(); + } + +private: + QObject *m_tank; + +}; + +class SpinAi: public QObject, public Plugin +{ + Q_OBJECT + Q_INTERFACES(Plugin) +public: + SpinAi() { setObjectName("Spin and destroy"); } + + virtual QState *create(QState *parentState, QObject *tank); +}; + +#endif diff --git a/examples/statemachine/tankgameplugins/spin_ai/spin_ai.pro b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.pro new file mode 100644 index 0000000..8ab4da0 --- /dev/null +++ b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.pro @@ -0,0 +1,13 @@ +TEMPLATE = lib +CONFIG += plugin +INCLUDEPATH += ../.. +HEADERS = spin_ai.h +SOURCES = spin_ai.cpp +TARGET = $$qtLibraryTarget(spin_ai) +DESTDIR = ../../tankgame/plugins + +#! [0] +# install +target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgame/plugins +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS spin_ai.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins/spin_ai \ No newline at end of file diff --git a/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp new file mode 100644 index 0000000..5499ba3 --- /dev/null +++ b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp @@ -0,0 +1,29 @@ +#include "spin_ai_with_error.h" + +#include + +QState *SpinAiWithError::create(QState *parentState, QObject *tank) +{ + QState *topLevel = new QState(parentState); + QState *spinState = new SpinState(tank, topLevel); + topLevel->setInitialState(spinState); + + // When tank is spotted, fire two times and go back to spin state + // (no initial state set for fireState will lead to run-time error in machine) + QState *fireState = new QState(topLevel); + + QState *fireOnce = new QState(fireState); + connect(fireOnce, SIGNAL(entered()), tank, SLOT(fireCannon())); + + QState *fireTwice = new QState(fireState); + connect(fireTwice, SIGNAL(entered()), tank, SLOT(fireCannon())); + + fireOnce->addTransition(tank, SIGNAL(actionCompleted()), fireTwice); + fireTwice->addTransition(tank, SIGNAL(actionCompleted()), spinState); + + spinState->addTransition(tank, SIGNAL(tankSpotted(qreal,qreal)), fireState); + + return topLevel; +} + +Q_EXPORT_PLUGIN2(spin_ai_with_error, SpinAiWithError) diff --git a/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h new file mode 100644 index 0000000..5cfb364 --- /dev/null +++ b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h @@ -0,0 +1,46 @@ +#ifndef SPIN_AI_WITH_ERROR_H +#define SPIN_AI_WITH_ERROR_H + +#include + +#include +#include +#include + +class SpinState: public QState +{ + Q_OBJECT +public: + SpinState(QObject *tank, QState *parent) : QState(parent), m_tank(tank) + { + } + +public slots: + void spin() + { + m_tank->setProperty("direction", 90.0); + } + +protected: + void onEntry(QEvent *) + { + connect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin())); + spin(); + } + +private: + QObject *m_tank; + +}; + +class SpinAiWithError: public QObject, public Plugin +{ + Q_OBJECT + Q_INTERFACES(Plugin) +public: + SpinAiWithError() { setObjectName("Spin and destroy with runtime error in state machine"); } + + virtual QState *create(QState *parentState, QObject *tank); +}; + +#endif diff --git a/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.pro b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.pro new file mode 100644 index 0000000..124cf98 --- /dev/null +++ b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.pro @@ -0,0 +1,13 @@ +TEMPLATE = lib +CONFIG += plugin +INCLUDEPATH += ../.. +HEADERS = spin_ai_with_error.h +SOURCES = spin_ai_with_error.cpp +TARGET = $$qtLibraryTarget(spin_ai_with_error) +DESTDIR = ../../tankgame/plugins + +#! [0] +# install +target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgame/plugins +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS spin_ai_with_error.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins/spin_ai_with_error \ No newline at end of file diff --git a/examples/statemachine/tankgameplugins/tankgameplugins.pro b/examples/statemachine/tankgameplugins/tankgameplugins.pro new file mode 100644 index 0000000..a098e03 --- /dev/null +++ b/examples/statemachine/tankgameplugins/tankgameplugins.pro @@ -0,0 +1,11 @@ +TEMPLATE = subdirs +SUBDIRS = random_ai \ + spin_ai_with_error \ + spin_ai \ + seek_ai + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS tankgameplugins.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgameplugins +INSTALLS += target sources -- cgit v0.12 From b6c082925a6fd51d05fcba6276d1cb9bd5886374 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 12 May 2009 16:41:50 +0200 Subject: add State Machine to examples overview --- doc/src/examples-overview.qdoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/src/examples-overview.qdoc b/doc/src/examples-overview.qdoc index 549574d..92ccd4e 100644 --- a/doc/src/examples-overview.qdoc +++ b/doc/src/examples-overview.qdoc @@ -319,6 +319,14 @@ from displaying Web pages within a Qt user interface to an implementation of a basic function Web browser. + \section1 \l{Qt Examples#State Machine}{State Machine} + + Qt provides a powerful hierchical finite state machine through the Qt State + Machine classes. + + These examples demonstrate the fundamental aspects of implementing + Statecharts with Qt. + \section1 \l{Qt Examples#Qt for Embedded Linux}{Qt for Embedded Linux} \l{Qt Examples#Qt for Embedded Linux}{\inlineimage qt-embedded-examples.png -- cgit v0.12 From 3db6f6234eb36ec4b3d6e14dc48917762653cbd7 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 12 May 2009 17:02:27 +0200 Subject: document the statemachine/eventtransitions example --- doc/src/examples.qdoc | 5 +- doc/src/examples/eventtransitions.qdoc | 86 +++++++++++++++++++++++++ examples/statemachine/eventtransitions/main.cpp | 16 ++++- 3 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 doc/src/examples/eventtransitions.qdoc diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc index bf169e3..0153252 100644 --- a/doc/src/examples.qdoc +++ b/doc/src/examples.qdoc @@ -311,9 +311,10 @@ \section1 State Machine \list - \o \l{statemachine/twowaybutton}{Two-way Button}\raisedaster - \o \l{statemachine/trafficlight}{Traffic Light}\raisedaster + \o \l{statemachine/eventtransitions}{Event Transitions}\raisedaster \o \l{statemachine/pingpong}{Ping Pong States}\raisedaster + \o \l{statemachine/trafficlight}{Traffic Light}\raisedaster + \o \l{statemachine/twowaybutton}{Two-way Button}\raisedaster \endlist \section1 Threads diff --git a/doc/src/examples/eventtransitions.qdoc b/doc/src/examples/eventtransitions.qdoc new file mode 100644 index 0000000..3b956bb --- /dev/null +++ b/doc/src/examples/eventtransitions.qdoc @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** 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 statemachine/eventtransitions + \title Event Transitions Example + + The Event Transitions example shows how to use event transitions, a + feature of \l{The State Machine Framework}. + + \snippet examples/statemachine/eventtransitions/main.cpp 0 + + The \c Window class's constructors begins by creating a button. + + \snippet examples/statemachine/eventtransitions/main.cpp 1 + + Two states, \c s1 and \c s2, are created; upon entry they will assign + "Outside" and "Inside" to the button's text, respectively. + + \snippet examples/statemachine/eventtransitions/main.cpp 2 + + When the button receives an event of type QEvent::Enter and the state + machine is in state \c s1, the machine will transition to state \c s2. + + \snippet examples/statemachine/eventtransitions/main.cpp 3 + + When the button receives an event of type QEvent::Leave and the state + machine is in state \c s2, the machine will transition back to state \c + s1. + + \snippet examples/statemachine/eventtransitions/main.cpp 4 + + Next, the state \c s3 is created. \c s3 will be entered when the button + receives an event of type QEvent::MouseButtonPress and the state machine + is in state \c s2. When the button receives an event of type + QEvent::MouseButtonRelease and the state machine is in state \c s3, the + machine will transition back to state \c s2. + + \snippet examples/statemachine/eventtransitions/main.cpp 5 + + Finally, the states are added to the machine as top-level states, the + initial state is set to be \c s1 ("Outside"), and the machine is started. + + \snippet examples/statemachine/eventtransitions/main.cpp 6 + + The main() function constructs a Window object and shows it. + +*/ diff --git a/examples/statemachine/eventtransitions/main.cpp b/examples/statemachine/eventtransitions/main.cpp index f564b7e..aba0c73 100644 --- a/examples/statemachine/eventtransitions/main.cpp +++ b/examples/statemachine/eventtransitions/main.cpp @@ -46,6 +46,7 @@ #include #endif +//! [0] class Window : public QWidget { public: @@ -54,7 +55,9 @@ public: { QPushButton *button = new QPushButton(this); button->setGeometry(QRect(100, 100, 100, 100)); +//! [0] +//! [1] QStateMachine *machine = new QStateMachine(this); QState *s1 = new QState(); @@ -62,15 +65,21 @@ public: QState *s2 = new QState(); s2->assignProperty(button, "text", "Inside"); +//! [1] +//! [2] QEventTransition *enterTransition = new QEventTransition(button, QEvent::Enter); enterTransition->setTargetState(s2); s1->addTransition(enterTransition); +//! [2] +//! [3] QEventTransition *leaveTransition = new QEventTransition(button, QEvent::Leave); leaveTransition->setTargetState(s1); s2->addTransition(leaveTransition); +//! [3] +//! [4] QState *s3 = new QState(); s3->assignProperty(button, "text", "Pressing..."); @@ -81,16 +90,20 @@ public: QEventTransition *releaseTransition = new QEventTransition(button, QEvent::MouseButtonRelease); releaseTransition->setTargetState(s2); s3->addTransition(releaseTransition); +//! [4] +//! [5] machine->addState(s1); machine->addState(s2); machine->addState(s3); + machine->setInitialState(s1); - QObject::connect(machine, SIGNAL(finished()), qApp, SLOT(quit())); machine->start(); } }; +//! [5] +//! [6] int main(int argc, char **argv) { QApplication app(argc, argv); @@ -100,3 +113,4 @@ int main(int argc, char **argv) return app.exec(); } +//! [6] -- cgit v0.12 From 64f86caef81ee0047fe28f0bc9c1d8a4ca606ebb Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 12 May 2009 17:05:33 +0200 Subject: Reviewed-by: TrustMe Small polishing. --- doc/src/examples/fancybrowser.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/examples/fancybrowser.qdoc b/doc/src/examples/fancybrowser.qdoc index 8338d8b..ea4da71 100644 --- a/doc/src/examples/fancybrowser.qdoc +++ b/doc/src/examples/fancybrowser.qdoc @@ -98,7 +98,7 @@ When the page is loaded, \c adjustLocation() updates the address bar; \c adjustLocation() is triggered by the \c loadFinished() signal in QWebView. In \c changeLocation() we create a QUrl - objecti, and then use it to load the page into the QWebView. When + object, and then use it to load the page into the QWebView. When the new web page has finished loading, \c adjustLocation() will be run once more to update the address bar. @@ -142,7 +142,7 @@ a \i {gif} file as its source is removed. \c removeInlineFrames() removes all \i {iframe} or inline elements. \c removeObjectElements() removes all \i {object} elements, and \c removeEmbeddedElements() removes any elements - such as plugins embedded on the page using the \i {embed} element. + such as plugins embedded on the page using the \i {embed} tag. */ -- cgit v0.12 From e58b7a29206bf81735ce45c964285de2e94ccc70 Mon Sep 17 00:00:00 2001 From: Trond Kjernaasen Date: Tue, 12 May 2009 17:22:33 +0200 Subject: Fixed a memory leak that occured when loading system icons on Windows. There was a qFree() call missing. Task-number: related to 253367 Reviewed-by: jbache --- src/gui/image/qpixmap_win.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 3ec441b..cbe9004 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -319,6 +319,7 @@ static QImage qt_fromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h) } else { qWarning("qt_fromWinHBITMAP(), failed to get bitmap bits"); } + qFree(data); return image; } -- cgit v0.12 From 6c154a5fc2b6e3fe3ccf9dbee709b01c08c27f6c Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 12 May 2009 17:49:41 +0200 Subject: Ensure that windows hidden by deletion affect closeOnLastWindow Our destructor didn't call close, which meant that we never emitted lastWindowClosed. Task-number: 253333 Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index b7c4d33..0942f8b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1345,7 +1345,7 @@ QWidget::~QWidget() d->setDirtyOpaqueRegion(); if (isWindow() && isVisible() && internalWinId()) - hide(); + d->close_helper(QWidgetPrivate::CloseNoEvent); #if defined(Q_WS_WIN) || defined(Q_WS_X11) else if (!internalWinId() && isVisible()) qApp->d_func()->sendSyntheticEnterLeave(this); -- cgit v0.12 From 8a4934d8b97b55b80b2709dba04346e068251906 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 12 May 2009 17:53:27 +0200 Subject: Document a gotcha with QIcon::addFile addFile makes a QIcon not null, which may be a surprise if the path given is bad. Reviewed-by: Jens Bache-Wiig --- src/gui/image/qicon.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 3c71f15..53430ab 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -854,6 +854,9 @@ void QIcon::addPixmap(const QPixmap &pixmap, Mode mode, State state) QImageWriter::supportedImageFormats() functions to retrieve a complete list of the supported file formats. + Note: When you add a non-empty filename to a QIcon, the icon becomes + non-null, even if the file doesn't exist or points to a corrupt file. + \sa addPixmap() */ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State state) -- cgit v0.12 From efad5df3ee7dea6cb587aacd27010e15a69f4320 Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Tue, 12 May 2009 18:18:29 +0200 Subject: Doc - cleaning up the documentation of QUiLoader. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also mentioned an important point: If you subclass QUiLoader and reimplement either createAction(), createActionGroup(), createLayout(), or createWidget() -- you must call the original implementation first, within your implementation. Reviewed-by: João Abecasis --- tools/designer/src/uitools/quiloader.cpp | 194 +++++++++++++++++-------------- 1 file changed, 105 insertions(+), 89 deletions(-) diff --git a/tools/designer/src/uitools/quiloader.cpp b/tools/designer/src/uitools/quiloader.cpp index 67bd29c..106e641 100644 --- a/tools/designer/src/uitools/quiloader.cpp +++ b/tools/designer/src/uitools/quiloader.cpp @@ -572,53 +572,52 @@ void QUiLoaderPrivate::setupWidgetMap() const \class QUiLoader \inmodule QtUiTools - \brief The QUiLoader class allows standalone applications dynamically - create user interfaces at run-time using the information stored in - .ui files or specified plugin paths. + \brief enables standalone applications to dynamically create user + interfaces at run-time using the information stored in .ui files or + specified in plugin paths. - In addition, you can customize of creating an user interface by + 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 Qt - Designer, you can also use the QFormBuilder class provided by the - QtDesigner module to create user interfaces from .ui files. + 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. - The QUiLoader class provides a collection of functions that allows - you to create widgets based on the information stored in \c .ui - files (created with Qt Designer) or available in the specified - plugin paths. The specified plugin paths can be retrieved using - the pluginPaths() function. You can retrieve the contents of an \c - .ui file using the load() function. For example: + The QUiLoader class provides a collection of functions allowing you to + create widgets based on the information stored in \c .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 + example: \snippet doc/src/snippets/quiloader/mywidget.cpp 0 - By including the user interface in the form's resources (\c myform.qrc), - we ensure that it will be present at run-time: + By including the user interface in the form's resources (\c myform.qrc), we + ensure that it will be present at run-time: \quotefile doc/src/snippets/quiloader/mywidget.qrc - The availableWidgets() function returns a QStringList with the - class names of the widgets available in the specified plugin - paths. You can create any of these widgets using the - createWidget() function. For example: + The availableWidgets() function returns a QStringList with the class names + of the widgets available in the specified plugin paths. To create these + widgets, simply use the createWidget() function. For example: \snippet doc/src/snippets/quiloader/main.cpp 0 - You can make a custom widget available to the loader using the - addPluginPath() function, and you can remove all the available widgets - by calling the clearPluginPaths() function. + To make a custom widget available to the loader, you can use the + addPluginPath() function; to remove all available widgets, you can call + the clearPluginPaths() function. - The createAction(), createActionGroup(), createLayout() and - createWidget() functions are used internally by the QUiLoader class - whenever it has to create an action, action group, layout or - widget respectively. For that reason, you can subclass the QUiLoader - class and reimplement these functions to intervene the process of - constructing an user interface. For example, you might want to - create a list of the actions created when loading a form or - creating a custom widget. + The createAction(), createActionGroup(), createLayout(), and createWidget() + functions are used internally by the QUiLoader class whenever it has to + create an action, action group, layout, or widget respectively. For that + reason, you can subclass the QUiLoader class and reimplement these + functions to intervene the process of constructing a user interface. For + example, you might want to have a list of the actions created when loading + a form or creating a custom widget. However, in your reimplementation, you + must call QUiLoader's original implementation of these functions first. - For a complete example using the QUiLoader class, see the \l - {designer/calculatorbuilder}{Calculator Builder} example. + For a complete example using the QUiLoader class, see the + \l{Calculator Builder Example}. \sa QtUiTools, QFormBuilder */ @@ -653,8 +652,8 @@ QUiLoader::~QUiLoader() } /*! - Loads a form from the given \a device and creates a new widget with the given - \a parentWidget to hold its contents. + Loads a form from the given \a device and creates a new widget with the + given \a parentWidget to hold its contents. \sa createWidget() */ @@ -668,8 +667,8 @@ QWidget *QUiLoader::load(QIODevice *device, QWidget *parentWidget) } /*! - Returns a list naming the paths the loader searches when locating - custom widget plugins. + Returns a list naming the paths in which the loader will search when + locating custom widget plugins. \sa addPluginPath(), clearPluginPaths() */ @@ -680,7 +679,7 @@ QStringList QUiLoader::pluginPaths() const } /*! - Clears the list of paths the loader searches when locating + Clears the list of paths in which the loader will search when locating plugins. \sa addPluginPath(), pluginPaths() @@ -692,7 +691,7 @@ void QUiLoader::clearPluginPaths() } /*! - Adds the given \a path to the list of paths the loader searches + Adds the given \a path to the list of paths in which the loader will search when locating plugins. \sa pluginPaths(), clearPluginPaths() @@ -704,17 +703,17 @@ void QUiLoader::addPluginPath(const QString &path) } /*! - Creates a new widget with the given \a parent and \a name - using the class specified by \a className. You can use this - function to create any of the widgets returned by the - availableWidgets() function. + Creates a new widget with the given \a parent and \a name using the class + specified by \a className. You can use this function to create any of the + widgets returned by the availableWidgets() function. - The function is also used internally by the QUiLoader class whenever - it has to create a widget. For that reason, you can subclass the - QUiLoader class and reimplement this function to intervene in the - process of constructing a user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. - \sa availableWidgets(), load() + \sa availableWidgets(), load() */ QWidget *QUiLoader::createWidget(const QString &className, QWidget *parent, const QString &name) { @@ -723,13 +722,14 @@ QWidget *QUiLoader::createWidget(const QString &className, QWidget *parent, cons } /*! - Creates a new layout with the given \a parent and \a name - using the class specified by \a className. + Creates a new layout with the given \a parent and \a name using the class + specified by \a className. - The function is used internally by the QUiLoader class whenever it - has to create a layout. For that reason, you can subclass the - QUiLoader class and reimplement this function to intervene the - process of constructing an user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. \sa createWidget(), load() */ @@ -742,10 +742,11 @@ QLayout *QUiLoader::createLayout(const QString &className, QObject *parent, cons /*! Creates a new action group with the given \a parent and \a name. - The function is used internally by the QUiLoader class whenever it - has to create an action group. For that reason, you can subclass - the QUiLoader class and reimplement this function to intervene the - process of constructing an user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. \sa createAction(), createWidget(), load() */ @@ -758,10 +759,11 @@ QActionGroup *QUiLoader::createActionGroup(QObject *parent, const QString &name) /*! Creates a new action with the given \a parent and \a name. - The function is used internally by the QUiLoader class whenever it - has to create an action. For that reason, you can subclass the - QUiLoader class and reimplement this function to intervene the - process of constructing an user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. \sa createActionGroup(), createWidget(), load() */ @@ -772,9 +774,9 @@ QAction *QUiLoader::createAction(QObject *parent, const QString &name) } /*! - Returns a list naming the available widgets that can be built - using the createWidget() function, i.e all the widgets specified - within the given plugin paths. + Returns a list naming all available widgets that can be built using the + createWidget() function, i.e all the widgets specified within the given + plugin paths. \sa pluginPaths(), createWidget() @@ -795,11 +797,11 @@ QStringList QUiLoader::availableWidgets() const /*! - Returns a list naming the available layouts that can be built - using the createLayout() function + \since 4.5 + Returns a list naming all available layouts that can be built using the + createLayout() function \sa createLayout() - \since 4.5 */ QStringList QUiLoader::availableLayouts() const @@ -816,9 +818,9 @@ QStringList QUiLoader::availableLayouts() const } /*! - Sets the working directory of the loader to \a dir. The loader - looks for other resources, such as icons and resource files, - in paths relative to this directory. + Sets the working directory of the loader to \a dir. The loader will look + for other resources, such as icons and resource files, in paths relative to + this directory. \sa workingDirectory() */ @@ -842,9 +844,13 @@ QDir QUiLoader::workingDirectory() const } /*! - Sets whether the execution of scripts is enabled to \a enabled. - \since 4.3 \internal + \since 4.3 + + If \a enabled is true, the loader will be able to execute scripts. + Otherwise, execution of scripts will be disabled. + + \sa isScriptingEnabled() */ void QUiLoader::setScriptingEnabled(bool enabled) @@ -854,10 +860,12 @@ void QUiLoader::setScriptingEnabled(bool enabled) } /*! - Returns whether the execution of scripts is enabled. - \sa setScriptingEnabled() - \since 4.3 - \internal + \internal + \since 4.3 + + Returns true if execution of scripts is enabled; returns false otherwise. + + \sa setScriptingEnabled() */ bool QUiLoader::isScriptingEnabled() const @@ -867,11 +875,13 @@ bool QUiLoader::isScriptingEnabled() const } /*! - Sets whether user interfaces loaded by this loader automatically - retranslate themselves upon receiving a language change event or not, - depending on \a enabled. - \since 4.5 + + If \a enabled is true, user interfaces loaded by this loader will + automatically retranslate themselves upon receiving a language change + event. Otherwise, the user interfaces will not be retranslated. + + \sa isLanguageChangeEnabled() */ void QUiLoader::setLanguageChangeEnabled(bool enabled) @@ -881,9 +891,12 @@ void QUiLoader::setLanguageChangeEnabled(bool enabled) } /*! - Returns whether dynamic retranslation on language change is enabled. - \sa setLanguageChangeEnabled() - \since 4.5 + \since 4.5 + + Returns true if dynamic retranslation on language change is enabled; + returns false otherwise. + + \sa setLanguageChangeEnabled() */ bool QUiLoader::isLanguageChangeEnabled() const @@ -894,11 +907,14 @@ bool QUiLoader::isLanguageChangeEnabled() const /*! \internal + \since 4.5 + + If \a enabled is true, user interfaces loaded by this loader will be + translated. Otherwise, the user interfaces will not be translated. - Sets whether user interfaces loaded by this loader are translated - at all. Note that this is orthogonal to languageChangeEnabled. + \note This is orthogonal to languageChangeEnabled. - \since 4.5 + \sa isLanguageChangeEnabled(), setLanguageChangeEnabled() */ void QUiLoader::setTranslationEnabled(bool enabled) @@ -909,11 +925,11 @@ void QUiLoader::setTranslationEnabled(bool enabled) /*! \internal + \since 4.5 - Returns whether translation is enabled. - \sa setTranslationEnabled() + Returns true if translation is enabled; returns false otherwise. - \since 4.5 + \sa setTranslationEnabled() */ bool QUiLoader::isTranslationEnabled() const -- cgit v0.12 From 7f5e15034a324ecd7df082e012403ad99c5b5476 Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Tue, 12 May 2009 18:25:30 +0200 Subject: Doc - removing trailing whitespaces --- tools/designer/src/uitools/quiloader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/designer/src/uitools/quiloader.cpp b/tools/designer/src/uitools/quiloader.cpp index 106e641..548f07e 100644 --- a/tools/designer/src/uitools/quiloader.cpp +++ b/tools/designer/src/uitools/quiloader.cpp @@ -862,7 +862,7 @@ void QUiLoader::setScriptingEnabled(bool enabled) /*! \internal \since 4.3 - + Returns true if execution of scripts is enabled; returns false otherwise. \sa setScriptingEnabled() @@ -908,7 +908,7 @@ bool QUiLoader::isLanguageChangeEnabled() const /*! \internal \since 4.5 - + If \a enabled is true, user interfaces loaded by this loader will be translated. Otherwise, the user interfaces will not be translated. -- cgit v0.12 From 09d1e6ee7d93c9fb658b2be5fe49698bf3faa0d6 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 12 May 2009 18:38:32 +0200 Subject: correctly handle multiple signal transitions for same (object,signal) The signal was not disconnected at the right time. We now store the number of active signal transitions for a particular (object,signal) and only disconnect when the count drops to zero. --- src/corelib/statemachine/qstate.cpp | 2 ++ src/corelib/statemachine/qstatemachine.cpp | 33 +++++++++++-------- src/corelib/statemachine/qstatemachine_p.h | 3 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 45 ++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 15 deletions(-) diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 3a3bfc3..f1528b8 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -327,6 +327,8 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition) } } transition->setParent(this); + if (machine() != 0 && machine()->configuration().contains(this)) + QStateMachinePrivate::get(machine())->registerTransitions(this); return transition; } diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 24af8e4..40a465a 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1311,8 +1311,10 @@ void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transitio sender->metaObject()->className(), signal.constData()); return; } - QList &connectedSignalIndexes = connections[sender]; - if (!connectedSignalIndexes.contains(signalIndex)) { + QVector &connectedSignalIndexes = connections[sender]; + if (connectedSignalIndexes.size() <= signalIndex) + connectedSignalIndexes.resize(signalIndex+1); + if (connectedSignalIndexes.at(signalIndex) == 0) { #ifndef QT_STATEMACHINE_SOLUTION if (!signalEventGenerator) signalEventGenerator = new QSignalEventGenerator(q); @@ -1329,8 +1331,8 @@ void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transitio #endif return; } - connectedSignalIndexes.append(signalIndex); } + ++connectedSignalIndexes[signalIndex]; QSignalTransitionPrivate::get(transition)->signalIndex = signalIndex; #ifdef QSTATEMACHINE_DEBUG qDebug() << q << ": added signal transition from" << transition->sourceState() @@ -1345,17 +1347,20 @@ void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transit if (signalIndex == -1) return; // not registered #ifndef QT_STATEMACHINE_SOLUTION + QSignalTransitionPrivate::get(transition)->signalIndex = -1; const QObject *sender = QSignalTransitionPrivate::get(transition)->sender; - QList &connectedSignalIndexes = connections[sender]; - Q_ASSERT(connectedSignalIndexes.contains(signalIndex)); - Q_ASSERT(signalEventGenerator != 0); - bool ok = QMetaObject::disconnect(sender, signalIndex, signalEventGenerator, - signalEventGenerator->metaObject()->methodOffset()); - if (ok) { - connectedSignalIndexes.removeOne(signalIndex); - if (connectedSignalIndexes.isEmpty()) + QVector &connectedSignalIndexes = connections[sender]; + Q_ASSERT(connectedSignalIndexes.size() > signalIndex); + Q_ASSERT(connectedSignalIndexes.at(signalIndex) != 0); + if (--connectedSignalIndexes[signalIndex] == 0) { + Q_ASSERT(signalEventGenerator != 0); + QMetaObject::disconnect(sender, signalIndex, signalEventGenerator, + signalEventGenerator->metaObject()->methodOffset()); + int sum = 0; + for (int i = 0; i < connectedSignalIndexes.size(); ++i) + sum += connectedSignalIndexes.at(i); + if (sum == 0) connections.remove(sender); - QSignalTransitionPrivate::get(transition)->signalIndex = -1; } #endif } @@ -1420,8 +1425,8 @@ void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transitio void QStateMachinePrivate::handleTransitionSignal(const QObject *sender, int signalIndex, void **argv) { - const QList &connectedSignalIndexes = connections[sender]; - Q_ASSERT(connectedSignalIndexes.contains(signalIndex)); + const QVector &connectedSignalIndexes = connections[sender]; + Q_ASSERT(connectedSignalIndexes.at(signalIndex) != 0); const QMetaObject *meta = sender->metaObject(); QMetaMethod method = meta->method(signalIndex); QList parameterTypes = method.parameterTypes(); diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h index 47b139c..4bf9ce2 100644 --- a/src/corelib/statemachine/qstatemachine_p.h +++ b/src/corelib/statemachine/qstatemachine_p.h @@ -61,6 +61,7 @@ #include #include #include +#include #include "qstate.h" #include "qstate_p.h" @@ -202,7 +203,7 @@ public: #ifndef QT_STATEMACHINE_SOLUTION QSignalEventGenerator *signalEventGenerator; #endif - QHash > connections; + QHash > connections; #ifndef QT_NO_STATEMACHINE_EVENTFILTER QHash > qobjectEvents; #endif diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 9058cb6..3f94ad9 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1711,6 +1711,51 @@ void tst_QStateMachine::signalTransitions() QTRY_COMPARE(finishedSpy.count(), 1); } + // Multiple transitions for same (object,signal) + { + QStateMachine machine; + SignalEmitter emitter; + QState *s0 = new QState(machine.rootState()); + QState *s1 = new QState(machine.rootState()); + QSignalTransition *t0 = s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1); + QSignalTransition *t1 = s1->addTransition(&emitter, SIGNAL(signalWithNoArg()), s0); + + QSignalSpy finishedSpy(&machine, SIGNAL(finished())); + machine.setInitialState(s0); + machine.start(); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + emitter.emitSignalWithNoArg(); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s1)); + + s0->removeTransition(t0); + emitter.emitSignalWithNoArg(); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + emitter.emitSignalWithNoArg(); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + s1->removeTransition(t1); + emitter.emitSignalWithNoArg(); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + s0->addTransition(t0); + s1->addTransition(t1); + emitter.emitSignalWithNoArg(); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s1)); + } } void tst_QStateMachine::eventTransitions() -- cgit v0.12 From 4ffda2918b3f5c789ef325cdeaac72e5e7ef2c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 12 May 2009 16:54:18 +0200 Subject: Reduce QWidget footprint and do some cleanup. This patch cleans up several things, like bit fields that are interleaved with with other variables, resulting in bits not being packed properly. Example: "uint a : 8; int c; uint b: 8;" -> "uint a : 8; uint b : 8; int c;" In that case we'll use 12 bytes instead of 8 bytes. I've also changed the order we declare certain variables to avoid unnecessary gaps/padding on 64-bit architectures. Example: "char *a; int c; char *b;" -> "char *a; char *b; int c;" Pointers are 64-bit aligned, so padding appears between 'c' and 'b', resulting in a total use of 24 bytes instead of 20 bytes. ...and since I anyways was moving the code around, I took the opportunity to add some overall structure by first declaring cross-platform functions/variables followed by platform specific functions/variables. ...and it was kinda scary to actually be able to see all the QStrings, pointers and whatnot we put into QWidgetPrivate. I'm sure we can remove lots of stuff, but I'll do that in a separate commit. Quick numbers (X11/64 bit): sizeof(QWidgetPrivate) == before: 472, after: 456 sizeof(QTLWExtra) == before: 112, after: 104 sizeof(QWExtra) == before: 152, after: 144 Acked-by: Olivier --- src/gui/kernel/qwidget.cpp | 130 +++++----- src/gui/kernel/qwidget_mac.mm | 6 +- src/gui/kernel/qwidget_p.h | 518 +++++++++++++++++++-------------------- src/gui/kernel/qwidget_qws.cpp | 3 + src/gui/kernel/qwidget_win.cpp | 11 +- src/gui/kernel/qwidget_wince.cpp | 7 - src/gui/kernel/qwidget_x11.cpp | 7 +- 7 files changed, 332 insertions(+), 350 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 0942f8b..a8eae9b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -167,39 +167,48 @@ static inline bool bypassGraphicsProxyWidget(QWidget *p) extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp -QWidgetPrivate::QWidgetPrivate(int version) : - QObjectPrivate(version), extra(0), focus_child(0) - ,layout(0), widgetItem(0) - ,leftmargin(0), topmargin(0), rightmargin(0), bottommargin(0) - ,leftLayoutItemMargin(0), topLayoutItemMargin(0), rightLayoutItemMargin(0) - ,bottomLayoutItemMargin(0) - ,fg_role(QPalette::NoRole) - ,bg_role(QPalette::NoRole) - ,hd(0) - ,dirty(0) - ,needsFlush(0) - ,dirtyOpaqueChildren(1) - ,isOpaque(0) - ,inDirtyList(0) - ,isScrolled(0) - ,isMoved(0) - ,usesDoubleBufferedGLContext(0) -#ifdef Q_WS_WIN - ,noPaintOnScreen(0) -#endif - ,inheritedFontResolveMask(0) - ,inheritedPaletteResolveMask(0) +QWidgetPrivate::QWidgetPrivate(int version) + : QObjectPrivate(version) + , extra(0) + , focus_next(0) + , focus_prev(0) + , focus_child(0) + , layout(0) + , needsFlush(0) + , redirectDev(0) + , widgetItem(0) + , extraPaintEngine(0) + , polished(0) + , inheritedFontResolveMask(0) + , inheritedPaletteResolveMask(0) + , leftmargin(0) + , topmargin(0) + , rightmargin(0) + , bottommargin(0) + , leftLayoutItemMargin(0) + , topLayoutItemMargin(0) + , rightLayoutItemMargin(0) + , bottomLayoutItemMargin(0) + , hd(0) + , size_policy(QSizePolicy::Preferred, QSizePolicy::Preferred) + , fg_role(QPalette::NoRole) + , bg_role(QPalette::NoRole) + , dirtyOpaqueChildren(1) + , isOpaque(0) + , inDirtyList(0) + , isScrolled(0) + , isMoved(0) + , usesDoubleBufferedGLContext(0) #if defined(Q_WS_X11) - ,picture(0) -#endif -#ifdef Q_WS_MAC - ,needWindowChange(0) - ,isGLWidget(0) + , picture(0) +#elif defined(Q_WS_WIN) + , noPaintOnScreen(0) +#elif defined(Q_WS_MAC) + , needWindowChange(0) + , isGLWidget(0) + , window_event(0) + , qd_hd(0) #endif - ,polished(0) - - , size_policy(QSizePolicy::Preferred, QSizePolicy::Preferred) - , redirectDev(0) { if (!qApp) { qFatal("QWidget: Must construct a QApplication before a QPaintDevice"); @@ -1412,36 +1421,26 @@ void QWidgetPrivate::createTLExtra() createExtra(); if (!extra->topextra) { QTLWExtra* x = extra->topextra = new QTLWExtra; + x->icon = 0; + x->iconPixmap = 0; + x->backingStore = 0; x->windowSurface = 0; + x->sharedPainter = 0; + x->incw = x->inch = 0; + x->basew = x->baseh = 0; + x->frameStrut.setCoords(0, 0, 0, 0); + x->normalGeometry = QRect(0,0,-1,-1); + x->savedFlags = 0; x->opacity = 255; x->posFromMove = false; x->sizeAdjusted = false; x->inTopLevelResize = false; x->inRepaint = false; - x->backingStore = 0; - x->icon = 0; - x->iconPixmap = 0; - x->frameStrut.setCoords(0, 0, 0, 0); - x->incw = x->inch = 0; - x->basew = x->baseh = 0; - x->normalGeometry = QRect(0,0,-1,-1); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) x->embedded = 0; -#endif -#if defined(Q_WS_X11) - x->parentWinId = 0; - x->spont_unmapped = 0; - x->dnd = 0; -#endif - x->savedFlags = 0; -#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER) - x->qwsManager = 0; -#endif - x->sharedPainter = 0; createTLSysExtra(); #ifdef QWIDGET_EXTRA_DEBUG - static int count = 0; - qDebug() << "tlextra" << ++count; + static int count = 0; + qDebug() << "tlextra" << ++count; #endif } } @@ -1455,27 +1454,28 @@ void QWidgetPrivate::createExtra() { if (!extra) { // if not exists extra = new QWExtra; - extra->minw = extra->minh = 0; - extra->maxw = extra->maxh = QWIDGETSIZE_MAX; + extra->glContext = 0; + extra->topextra = 0; + extra->proxyWidget = 0; +#ifndef QT_NO_CURSOR + extra->curs = 0; +#endif + extra->minw = 0; + extra->minh = 0; + extra->maxw = QWIDGETSIZE_MAX; + extra->maxh = QWIDGETSIZE_MAX; + extra->customDpiX = 0; + extra->customDpiY = 0; extra->explicitMinSize = 0; extra->explicitMaxSize = 0; extra->autoFillBackground = 0; extra->nativeChildrenForced = 0; extra->inRenderWithPainter = 0; extra->hasMask = 0; -#ifndef QT_NO_CURSOR - extra->curs = 0; -#endif - extra->style = 0; - extra->topextra = 0; - extra->proxyWidget = 0; - extra->glContext = 0; - extra->customDpiX = 0; - extra->customDpiY = 0; createSysExtra(); #ifdef QWIDGET_EXTRA_DEBUG - static int count = 0; - qDebug() << "extra" << ++count; + static int count = 0; + qDebug() << "extra" << ++count; #endif } } diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 1896b97..cbfdaa0 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4438,11 +4438,13 @@ void QWidgetPrivate::deleteSysExtra() void QWidgetPrivate::createTLSysExtra() { + extra->topextra->resizer = 0; + extra->topextra->isSetGeometry = 0; + extra->topextra->isMove = 0; + extra->topextra->wattr = 0; extra->topextra->wclass = 0; extra->topextra->group = 0; extra->topextra->windowIcon = 0; - extra->topextra->resizer = 0; - extra->topextra->isSetGeometry = 0; extra->topextra->savedWindowAttributesFromMaximized = 0; } diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 8c6a234..6dc4c95 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -99,88 +99,92 @@ class QWidgetItemV2; class QStyle; struct QTLWExtra { + // *************************** Cross-platform variables ***************************** + + // Regular pointers (keep them together to avoid gaps on 64 bits architectures). + QIcon *icon; // widget icon + QPixmap *iconPixmap; + QWidgetBackingStore *backingStore; + QWindowSurface *windowSurface; + QPainter *sharedPainter; + + // Implicit pointers (shared_null). QString caption; // widget caption QString iconText; // widget icon text QString role; // widget role QString filePath; // widget file path - QIcon *icon; // widget icon - QPixmap *iconPixmap; + + // Other variables. short incw, inch; // size increments + short basew, baseh; // base sizes // frame strut, don't use these directly, use QWidgetPrivate::frameStrut() instead. QRect frameStrut; + QRect normalGeometry; // used by showMin/maximized/FullScreen + Qt::WindowFlags savedFlags; // Save widget flags while showing fullscreen + + // *************************** Cross-platform bit fields **************************** uint opacity : 8; uint posFromMove : 1; uint sizeAdjusted : 1; uint inTopLevelResize : 1; uint inRepaint : 1; - QWidgetBackingStore *backingStore; -#if defined(Q_WS_WIN) - ulong savedFlags; // Save window flags while showing fullscreen - uint embedded : 1; // window is embedded in another application -#else - Qt::WindowFlags savedFlags; // Save widget flags while showing fullscreen -#endif - short basew, baseh; // base sizes -#if defined(Q_WS_X11) - WId parentWinId; // parent window Id (valid after reparenting) - uint embedded : 1; // window is embedded in another Qt application + uint embedded : 1; + + // *************************** Platform specific values (bit fields first) ********** +#if defined(Q_WS_X11) // <----------------------------------------------------------- X11 uint spont_unmapped: 1; // window was spontaneously unmapped uint dnd : 1; // DND properties installed uint validWMState : 1; // is WM_STATE valid? uint waitingForMapNotify : 1; // show() has been called, haven't got the MapNotify yet + WId parentWinId; // parent window Id (valid after reparenting) WId userTimeWindow; // window id that contains user-time timestamp when WM supports a _NET_WM_USER_TIME_WINDOW atom QPoint fullScreenOffset; -#endif -#if defined(Q_WS_MAC) +#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN + HICON winIconBig; // internal big Windows icon + HICON winIconSmall; // internal small Windows icon +#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC + uint resizer : 4; + uint isSetGeometry : 1; + uint isMove : 1; quint32 wattr; quint32 wclass; WindowGroupRef group; IconRef windowIcon; // the current window icon, if set with setWindowIcon_sys. quint32 savedWindowAttributesFromMaximized; // Saved attributes from when the calling updateMaximizeButton_sys() - uint resizer : 4; - uint isSetGeometry : 1; - uint isMove : 1; - uint embedded : 1; -#endif -#if defined(Q_WS_QWS) && !defined (QT_NO_QWS_MANAGER) +#elif defined(Q_WS_QWS) // <--------------------------------------------------------- QWS +#ifndef QT_NO_QWS_MANAGER QWSManager *qwsManager; #endif -#if defined(Q_WS_WIN) - HICON winIconBig; // internal big Windows icon - HICON winIconSmall; // internal small Windows icon #endif - QRect normalGeometry; // used by showMin/maximized/FullScreen - QWindowSurface *windowSurface; - QPainter *sharedPainter; }; struct QWExtra { - qint32 minw, minh; // minimum size - qint32 maxw, maxh; // maximum size - QPointer focus_proxy; -#ifndef QT_NO_CURSOR - QCursor *curs; -#endif + // *************************** Cross-platform variables ***************************** + + // Regular pointers (keep them together to avoid gaps on 64 bits architectures). + void *glContext; // if the widget is hijacked by QGLWindowSurface QTLWExtra *topextra; // only useful for TLWs QGraphicsProxyWidget *proxyWidget; // if the widget is embedded - void *glContext; // if the widget is hijacked by QGLWindowSurface -#if defined(Q_WS_WIN) && !defined(QT_NO_DRAGANDDROP) - QOleDropTarget *dropTarget; // drop target - QList > oleDropWidgets; -#endif -#if defined(Q_WS_X11) - WId xDndProxy; // XDND forwarding to embedded windows +#ifndef QT_NO_CURSOR + QCursor *curs; #endif + QPointer style; + QPointer focus_proxy; + + // Implicit pointers (shared_empty/shared_null). QRegion mask; // widget mask + QString styleSheet; + + // Other variables. + qint32 minw; + qint32 minh; // minimum size + qint32 maxw; + qint32 maxh; // maximum size + quint16 customDpiX; + quint16 customDpiY; QSize staticContentsSize; -//bit flags at the end to improve packing -#if defined(Q_WS_WIN) - uint shown_mode : 8; // widget show mode -#endif -#if defined(Q_WS_X11) - uint compress_events : 1; -#endif + // *************************** Cross-platform bit fields **************************** uint explicitMinSize : 2; uint explicitMaxSize : 2; uint autoFillBackground : 1; @@ -188,16 +192,22 @@ struct QWExtra { uint inRenderWithPainter : 1; uint hasMask : 1; - QPointer style; - QString styleSheet; - - quint16 customDpiX; - quint16 customDpiY; -#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) + // *************************** Platform specific values (bit fields first) ********** +#if defined(Q_WS_WIN) // <----------------------------------------------------------- WIN +#ifndef QT_NO_DRAGANDDROP + QOleDropTarget *dropTarget; // drop target + QList > oleDropWidgets; +#endif +#elif defined(Q_WS_X11) // <--------------------------------------------------------- X11 + uint compress_events : 1; + WId xDndProxy; // XDND forwarding to embedded windows +#elif defined(Q_WS_MAC) // <------------------------------------------------------ MAC +#ifdef QT_MAC_USE_COCOA // Cocoa Mask stuff QImage maskBits; CGImageRef imageMask; #endif +#endif }; class Q_GUI_EXPORT QWidgetPrivate : public QObjectPrivate @@ -205,6 +215,24 @@ class Q_GUI_EXPORT QWidgetPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QWidget) public: + // *************************** Cross-platform *************************************** + enum DrawWidgetFlags { + DrawAsRoot = 0x01, + DrawPaintOnScreen = 0x02, + DrawRecursive = 0x04, + DrawInvisible = 0x08, + DontSubtractOpaqueChildren = 0x10, + DontSetCompositionMode = 0x20, + DontDrawOpaqueChildren = 0x40 + }; + + enum CloseMode { + CloseNoEvent, + CloseWithEvent, + CloseWithSpontaneousEvent + }; + + // Functions. explicit QWidgetPrivate(int version = QObjectPrivateVersion); ~QWidgetPrivate(); @@ -214,10 +242,6 @@ public: QPainter *sharedPainter() const; void setSharedPainter(QPainter *painter); QWidgetBackingStore *maybeBackingStore() const; -#ifdef Q_WS_QWS - void setMaxWindowState_helper(); - void setFullScreenSize_helper(); -#endif void init(QWidget *desktopWidget, Qt::WindowFlags f); void create_sys(WId window, bool initializeWindow, bool destroyOldWindow); void createRecursively(); @@ -238,24 +262,6 @@ public: QPalette naturalWidgetPalette(uint inheritedMask) const; void setMask_sys(const QRegion &); -#ifdef Q_WS_WIN - bool shouldShowMaximizeButton(); - void winUpdateIsOpaque(); -#endif - -#ifdef Q_WS_MAC - void macUpdateSizeAttribute(); - void macUpdateHideOnSuspend(); - void macUpdateOpaqueSizeGrip(); - void macUpdateIgnoreMouseEvents(); - void macUpdateMetalAttribute(); - void macUpdateIsOpaque(); - void setEnabled_helper_sys(bool enable); - bool isRealWindow() const; - void adjustWithinMaxAndMinSize(int &w, int &h); - void applyMaxAndMinSizeOnWindow(); -#endif - void raise_sys(); void lower_sys(); void stackUnder_sys(QWidget *); @@ -285,15 +291,6 @@ public: void setUpdatesEnabled_helper(bool ); void paintBackground(QPainter *, const QRegion &, const QPoint & = QPoint(), int flags = DrawAsRoot) const; - enum DrawWidgetFlags { - DrawAsRoot = 0x01, - DrawPaintOnScreen = 0x02, - DrawRecursive = 0x04, - DrawInvisible = 0x08, - DontSubtractOpaqueChildren = 0x10, - DontSetCompositionMode = 0x20, - DontDrawOpaqueChildren = 0x40 - }; bool isAboutToShow() const; QRegion prepareToRender(const QRegion ®ion, QWidget::RenderFlags renderFlags); void render_helper(QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, @@ -316,10 +313,6 @@ public: QWindowSurface *createDefaultWindowSurface(); QWindowSurface *createDefaultWindowSurface_sys(); void repaint_sys(const QRegion &rgn); -#ifdef Q_WS_MAC - void update_sys(const QRect &rect); - void update_sys(const QRegion &rgn); -#endif QRect clipRect() const; QRegion clipRegion() const; @@ -337,35 +330,15 @@ public: const QRegion &getOpaqueChildren() const; void setDirtyOpaqueRegion(); - QRegion opaqueChildren; - - enum CloseMode { - CloseNoEvent, - CloseWithEvent, - CloseWithSpontaneousEvent - }; bool close_helper(CloseMode mode); bool compositeEvent(QEvent *e); void setWindowIcon_helper(); void setWindowIcon_sys(bool forceReset = false); void setWindowOpacity_sys(qreal opacity); - void adjustQuitOnCloseAttribute(); -#if defined(Q_WS_X11) - void setWindowRole(); - void sendStartupMessage(const char *message) const; - void setNetWmWindowTypes(); - void x11UpdateIsOpaque(); -#endif - -#if defined (Q_WS_WIN) - void reparentChildren(); -#endif - void scrollChildren(int dx, int dy); - void moveRect(const QRect &, int dx, int dy); void scrollRect(const QRect &, int dx, int dy); void invalidateBuffer_resizeHelper(const QPoint &oldPos, const QSize &oldSize); @@ -389,9 +362,6 @@ public: void scroll_sys(int dx, int dy, const QRect &r); void deactivateWidgetCleanup(); void setGeometry_sys(int, int, int, int, bool); -#ifdef Q_WS_MAC - void setGeometry_sys_helper(int, int, int, int, bool); -#endif void sendPendingMoveAndResizeEvents(bool recursive = false, bool disableUpdates = false); void activateChildLayoutsRecursively(); void show_recursive(); @@ -403,10 +373,6 @@ public: void setEnabled_helper(bool); void registerDropSite(bool); -#if defined(Q_WS_WIN) && !defined(QT_NO_DRAGANDDROP) - QOleDropTarget *registerOleDnd(QWidget *widget); - void unregisterOleDnd(QWidget *widget, QOleDropTarget *target); -#endif static void adjustFlags(Qt::WindowFlags &flags, QWidget *w = 0); void updateFrameStrut(); @@ -416,32 +382,11 @@ public: void setWindowIconText_helper(const QString &cap); void setWindowTitle_sys(const QString &cap); -#ifdef Q_OS_WIN - void grabMouseWhileInWindow(); -#endif - #ifndef QT_NO_CURSOR void setCursor_sys(const QCursor &cursor); void unsetCursor_sys(); #endif -#ifdef Q_WS_MAC - void setWindowModified_sys(bool b); - void updateMaximizeButton_sys(); - void setWindowFilePath_sys(const QString &filePath); - void createWindow_sys(); - void recreateMacWindow(); -#ifndef QT_MAC_USE_COCOA - void initWindowPtr(); - void finishCreateWindow_sys_Carbon(OSWindowRef windowRef); -#else - void finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ windowRef); - void syncCocoaMask(); - void finishCocoaMaskSetup(); -#endif - void determineWindowClass(); - void transferChildren(); -#endif void setWindowTitle_helper(const QString &cap); void setWindowFilePath_helper(const QString &filePath); @@ -457,59 +402,89 @@ public: QInputContext *inputContext() const; -#if defined(Q_WS_QWS) - void moveSurface(QWindowSurface *surface, const QPoint &offset); + void setModal_sys(); - QRegion localRequestedRegion() const; - QRegion localAllocatedRegion() const; + inline void setRedirected(QPaintDevice *replacement, const QPoint &offset) + { + Q_ASSERT(q_func()->testAttribute(Qt::WA_WState_InPaintEvent)); + redirectDev = replacement; + redirectOffset = offset; + } - void blitToScreen(const QRegion &globalrgn); -#ifndef QT_NO_CURSOR - void updateCursor() const; -#endif + inline QPaintDevice *redirected(QPoint *offset) const + { + if (offset) + *offset = redirectDev ? redirectOffset : QPoint(); + return redirectDev; + } - QScreen* getScreen() const; + inline void restoreRedirected() + { redirectDev = 0; } - friend class QWSManager; - friend class QWSManagerPrivate; - friend class QDecoration; -#endif + inline void enforceNativeChildren() + { + if (!extra) + createExtra(); - static int instanceCounter; // Current number of widget instances - static int maxInstances; // Maximum number of widget instances + if (extra->nativeChildrenForced) + return; + extra->nativeChildrenForced = 1; -#ifdef QT_KEYPAD_NAVIGATION - static QPointer editingWidget; -#endif + for (int i = 0; i < children.size(); ++i) { + if (QWidget *child = qobject_cast(children.at(i))) + child->setAttribute(Qt::WA_NativeWindow); + } + } - QWidgetData data; + inline bool nativeChildrenForced() const + { + return extra ? extra->nativeChildrenForced : false; + } + + QSize adjustedSize() const; + +#ifndef Q_WS_QWS // Almost cross-platform :-) + void setWSGeometry(bool dontShow=false, const QRect &oldRect = QRect()); + inline QPoint mapToWS(const QPoint &p) const + { return p - data.wrect.topLeft(); } + + inline QPoint mapFromWS(const QPoint &p) const + { return p + data.wrect.topLeft(); } + + inline QRect mapToWS(const QRect &r) const + { QRect rr(r); rr.translate(-data.wrect.topLeft()); return rr; } + + inline QRect mapFromWS(const QRect &r) const + { QRect rr(r); rr.translate(data.wrect.topLeft()); return rr; } +#endif + + // Variables. + // Regular pointers (keep them together to avoid gaps on 64 bit architectures). QWExtra *extra; QWidget *focus_next; QWidget *focus_prev; QWidget *focus_child; -#ifndef QT_NO_ACTION - QList actions; -#endif QLayout *layout; + QRegion *needsFlush; + QPaintDevice *redirectDev; QWidgetItemV2 *widgetItem; -#if !defined(QT_NO_IM) - QPointer ic; -#endif + QPaintEngine *extraPaintEngine; + mutable const QMetaObject *polished; // All widgets are initially added into the uncreatedWidgets set. Once // they receive a window id they are removed and added to the mapper static QWidgetMapper *mapper; static QWidgetSet *uncreatedWidgets; +#if !defined(QT_NO_IM) + QPointer ic; +#endif +#ifdef QT_KEYPAD_NAVIGATION + static QPointer editingWidget; +#endif - short leftmargin, topmargin, rightmargin, bottommargin; - - signed char leftLayoutItemMargin; - signed char topLayoutItemMargin; - signed char rightLayoutItemMargin; - signed char bottomLayoutItemMargin; - - // ### TODO: reorganize private/extra/topextra to save memory - QPointer compositeChildGrab; + // Implicit pointers (shared_null/shared_empty). + QRegion opaqueChildren; + QRegion dirty; #ifndef QT_NO_TOOLTIP QString toolTip; #endif @@ -519,14 +494,37 @@ public: #ifndef QT_NO_WHATSTHIS QString whatsThis; #endif - QString accessibleName, accessibleDescription; +#ifndef QT_NO_ACCESSIBILITY + QString accessibleName; + QString accessibleDescription; +#endif + + // Other variables. + uint inheritedFontResolveMask; + uint inheritedPaletteResolveMask; + short leftmargin; + short topmargin; + short rightmargin; + short bottommargin; + signed char leftLayoutItemMargin; + signed char topLayoutItemMargin; + signed char rightLayoutItemMargin; + signed char bottomLayoutItemMargin; + static int instanceCounter; // Current number of widget instances + static int maxInstances; // Maximum number of widget instances + Qt::HANDLE hd; + QWidgetData data; + QSizePolicy size_policy; + QLocale locale; + QPoint redirectOffset; +#ifndef QT_NO_ACTION + QList actions; +#endif + // Bit fields. + uint high_attributes[3]; // the low ones are in QWidget::widget_attributes QPalette::ColorRole fg_role : 8; QPalette::ColorRole bg_role : 8; - uint high_attributes[3]; // the low ones are in QWidget::widget_attributes - Qt::HANDLE hd; - QRegion dirty; - QRegion *needsFlush; uint dirtyOpaqueChildren : 1; uint isOpaque : 1; uint inDirtyList : 1; @@ -534,35 +532,39 @@ public: uint isMoved : 1; uint usesDoubleBufferedGLContext : 1; -#ifdef Q_WS_WIN - uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine() -#endif - - uint inheritedFontResolveMask; - uint inheritedPaletteResolveMask; -#if defined(Q_WS_X11) + // *************************** Platform specific ************************************ +#if defined(Q_WS_X11) // <----------------------------------------------------------- X11 QX11Info xinfo; Qt::HANDLE picture; + static QWidget *mouseGrabber; + static QWidget *keyboardGrabber; + + void setWindowRole(); + void sendStartupMessage(const char *message) const; + void setNetWmWindowTypes(); + void x11UpdateIsOpaque(); +#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN + uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine() + + bool shouldShowMaximizeButton(); + void winUpdateIsOpaque(); + void reparentChildren(); +#ifndef QT_NO_DRAGANDDROP + QOleDropTarget *registerOleDnd(QWidget *widget); + void unregisterOleDnd(QWidget *widget, QOleDropTarget *target); #endif -#if defined(Q_WS_MAC) + void grabMouseWhileInWindow(); +#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC + // This is new stuff + uint needWindowChange : 1; + uint isGLWidget : 1; + enum PaintChildrenOPs { PC_None = 0x00, PC_Now = 0x01, PC_NoPaint = 0x04, PC_Later = 0x10 }; - EventHandlerRef window_event; - bool qt_mac_dnd_event(uint, DragRef); - void toggleDrawers(bool); - //mac event functions - static bool qt_create_root_win(); - static void qt_clean_root_win(); - static bool qt_recreate_root_win(); - static bool qt_mac_update_sizer(QWidget *, int up = 0); - static OSStatus qt_window_event(EventHandlerCallRef er, EventRef event, void *); - static OSStatus qt_widget_event(EventHandlerCallRef er, EventRef event, void *); - static bool qt_widget_rgn(QWidget *, short, RgnHandle, bool); - static bool qt_widget_shape(QWidget *, short, HIMutableShapeRef, bool); // Each wiget keeps a list of all its child and grandchild OpenGL widgets. // This list is used to update the gl context whenever a parent and a granparent @@ -575,95 +577,73 @@ public: QWidget * widget; QWidget * lastUpdateWidget; }; - QList glWidgets; // dirtyOnWidget contains the areas in the widget that needs to be repained, // in the same way as dirtyOnScreen does for the window. Areas are added in // dirtyWidget_sys and cleared in the paint event. In scroll_sys we then use // this information repaint invalid areas when widgets are scrolled. QRegion dirtyOnWidget; + EventHandlerRef window_event; + QList glWidgets; //these are here just for code compat (HIViews) Qt::HANDLE qd_hd; - // This is new stuff - uint needWindowChange : 1; - uint isGLWidget : 1; -#endif - -#if defined(Q_WS_X11) || defined (Q_WS_WIN) || defined(Q_WS_MAC) -#ifdef Q_WS_MAC - void setWSGeometry(bool dontShow=false, const QRect &oldRect = QRect()); + void macUpdateSizeAttribute(); + void macUpdateHideOnSuspend(); + void macUpdateOpaqueSizeGrip(); + void macUpdateIgnoreMouseEvents(); + void macUpdateMetalAttribute(); + void macUpdateIsOpaque(); + void setEnabled_helper_sys(bool enable); + bool isRealWindow() const; + void adjustWithinMaxAndMinSize(int &w, int &h); + void applyMaxAndMinSizeOnWindow(); + void update_sys(const QRect &rect); + void update_sys(const QRegion &rgn); + void setGeometry_sys_helper(int, int, int, int, bool); + void setWindowModified_sys(bool b); + void updateMaximizeButton_sys(); + void setWindowFilePath_sys(const QString &filePath); + void createWindow_sys(); + void recreateMacWindow(); +#ifndef QT_MAC_USE_COCOA + void initWindowPtr(); + void finishCreateWindow_sys_Carbon(OSWindowRef windowRef); #else - void setWSGeometry(bool dontShow=false); + void finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ windowRef); + void syncCocoaMask(); + void finishCocoaMaskSetup(); #endif + void determineWindowClass(); + void transferChildren(); + bool qt_mac_dnd_event(uint, DragRef); + void toggleDrawers(bool); + //mac event functions + static bool qt_create_root_win(); + static void qt_clean_root_win(); + static bool qt_recreate_root_win(); + static bool qt_mac_update_sizer(QWidget *, int up = 0); + static OSStatus qt_window_event(EventHandlerCallRef er, EventRef event, void *); + static OSStatus qt_widget_event(EventHandlerCallRef er, EventRef event, void *); + static bool qt_widget_rgn(QWidget *, short, RgnHandle, bool); + static bool qt_widget_shape(QWidget *, short, HIMutableShapeRef, bool); +#elif defined(Q_WS_QWS) // <--------------------------------------------------------- QWS + void setMaxWindowState_helper(); + void setFullScreenSize_helper(); + void moveSurface(QWindowSurface *surface, const QPoint &offset); + QRegion localRequestedRegion() const; + QRegion localAllocatedRegion() const; + void blitToScreen(const QRegion &globalrgn); - inline QPoint mapToWS(const QPoint &p) const - { return p - data.wrect.topLeft(); } - - inline QPoint mapFromWS(const QPoint &p) const - { return p + data.wrect.topLeft(); } - - inline QRect mapToWS(const QRect &r) const - { QRect rr(r); rr.translate(-data.wrect.topLeft()); return rr; } - - inline QRect mapFromWS(const QRect &r) const - { QRect rr(r); rr.translate(data.wrect.topLeft()); return rr; } + friend class QWSManager; + friend class QWSManagerPrivate; + friend class QDecoration; +#ifndef QT_NO_CURSOR + void updateCursor() const; #endif - - QPaintEngine *extraPaintEngine; - - mutable const QMetaObject *polished; - - void setModal_sys(); - QSizePolicy size_policy; - QLocale locale; - -#ifdef Q_WS_X11 - static QWidget *mouseGrabber; - static QWidget *keyboardGrabber; + QScreen* getScreen() const; #endif - QPaintDevice *redirectDev; - QPoint redirectOffset; - - inline void setRedirected(QPaintDevice *replacement, const QPoint &offset) - { - Q_ASSERT(q_func()->testAttribute(Qt::WA_WState_InPaintEvent)); - redirectDev = replacement; - redirectOffset = offset; - } - - inline QPaintDevice *redirected(QPoint *offset) const - { - if (offset) - *offset = redirectDev ? redirectOffset : QPoint(); - return redirectDev; - } - - inline void restoreRedirected() - { redirectDev = 0; } - - inline void enforceNativeChildren() - { - if (!extra) - createExtra(); - - if (extra->nativeChildrenForced) - return; - extra->nativeChildrenForced = 1; - - for (int i = 0; i < children.size(); ++i) { - if (QWidget *child = qobject_cast(children.at(i))) - child->setAttribute(Qt::WA_NativeWindow); - } - } - - inline bool nativeChildrenForced() const - { - return extra ? extra->nativeChildrenForced : false; - } - - QSize adjustedSize() const; }; inline QWExtra *QWidgetPrivate::extraData() const diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp index 1445f57..096116f 100644 --- a/src/gui/kernel/qwidget_qws.cpp +++ b/src/gui/kernel/qwidget_qws.cpp @@ -1037,6 +1037,9 @@ void QWidgetPrivate::deleteSysExtra() void QWidgetPrivate::createTLSysExtra() { +#ifndef QT_NO_QWS_MANAGER + extra->topextra->qwsManager = 0; +#endif } void QWidgetPrivate::deleteTLSysExtra() diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index cfdabaf..0f341fd 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -1025,13 +1025,13 @@ 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 = GetWindowLongA(internalWinId(), GWL_STYLE); + d->topData()->savedFlags = Qt::WindowFlags(GetWindowLongA(internalWinId(), GWL_STYLE)); #ifndef Q_FLATTEN_EXPOSE UINT style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP; #else UINT style = WS_POPUP; #endif - if (d->topData()->savedFlags & WS_SYSMENU) + if (ulong(d->topData()->savedFlags) & WS_SYSMENU) style |= WS_SYSMENU; if (isVisible()) style |= WS_VISIBLE; @@ -1234,7 +1234,7 @@ void QWidgetPrivate::stackUnder_sys(QWidget* w) (In all comments below: s/X/Windows/g) */ -void QWidgetPrivate::setWSGeometry(bool dontShow) +void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &) { Q_Q(QWidget); Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); @@ -1704,7 +1704,6 @@ int QWidget::metric(PaintDeviceMetric m) const return val; } -#ifndef Q_WS_WINCE void QWidgetPrivate::createSysExtra() { #ifndef QT_NO_DRAGANDDROP @@ -1712,6 +1711,7 @@ void QWidgetPrivate::createSysExtra() #endif } +#ifndef Q_WS_WINCE void QWidgetPrivate::deleteSysExtra() { } @@ -1719,8 +1719,9 @@ void QWidgetPrivate::deleteSysExtra() void QWidgetPrivate::createTLSysExtra() { - extra->topextra->winIconSmall = 0; + extra->topextra->savedFlags = 0; extra->topextra->winIconBig = 0; + extra->topextra->winIconSmall = 0; } void QWidgetPrivate::deleteTLSysExtra() diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp index cca928e..0ed40fa 100644 --- a/src/gui/kernel/qwidget_wince.cpp +++ b/src/gui/kernel/qwidget_wince.cpp @@ -598,13 +598,6 @@ void QWidget::setWindowState(Qt::WindowStates newstate) QApplication::sendEvent(this, &e); } - -void QWidgetPrivate::createSysExtra() { -#ifndef QT_NO_DRAGANDDROP - extra->dropTarget = 0; -#endif -} - void QWidgetPrivate::deleteSysExtra() { Q_Q(QWidget); diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 6202b35..906500e 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -2152,7 +2152,7 @@ static void do_size_hints(QWidget* widget, QWExtra *x) parentWRect is the geometry of the parent's X rect, measured in parent's coord sys */ -void QWidgetPrivate::setWSGeometry(bool dontShow) +void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &) { Q_Q(QWidget); Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); @@ -2610,8 +2610,8 @@ int QWidget::metric(PaintDeviceMetric m) const void QWidgetPrivate::createSysExtra() { - extra->xDndProxy = 0; extra->compress_events = true; + extra->xDndProxy = 0; } void QWidgetPrivate::deleteSysExtra() @@ -2620,8 +2620,11 @@ void QWidgetPrivate::deleteSysExtra() void QWidgetPrivate::createTLSysExtra() { + extra->topextra->spont_unmapped = 0; + extra->topextra->dnd = 0; extra->topextra->validWMState = 0; extra->topextra->waitingForMapNotify = 0; + extra->topextra->parentWinId = 0; extra->topextra->userTimeWindow = 0; } -- cgit v0.12 From 8a4fbf2edfd88128aeead769adb9842338e09623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 12 May 2009 17:46:52 +0200 Subject: Cleanup private QWidget functions. I actually found a few functions that were not even implemented, only declared. Those should obviously not be in the header file. I've also removed a few functions not in use / not belonging to QWidgetPrivate. Reviewed-by: Olivier --- src/gui/kernel/qlayoutitem.cpp | 6 ++-- src/gui/kernel/qwidget.cpp | 65 ------------------------------------------ src/gui/kernel/qwidget_mac.mm | 18 ------------ src/gui/kernel/qwidget_p.h | 16 +---------- src/gui/kernel/qwidget_qws.cpp | 14 --------- src/gui/kernel/qwidget_x11.cpp | 38 ++++++++++++++++++++++++ 6 files changed, 43 insertions(+), 114 deletions(-) diff --git a/src/gui/kernel/qlayoutitem.cpp b/src/gui/kernel/qlayoutitem.cpp index 0fd73b8..c70ab2d 100644 --- a/src/gui/kernel/qlayoutitem.cpp +++ b/src/gui/kernel/qlayoutitem.cpp @@ -54,7 +54,8 @@ QT_BEGIN_NAMESPACE inline static QRect fromLayoutItemRect(QWidgetPrivate *priv, const QRect &rect) { - return priv->fromOrToLayoutItemRect(rect, -1); + return rect.adjusted(priv->leftLayoutItemMargin, priv->topLayoutItemMargin, + -priv->rightLayoutItemMargin, -priv->bottomLayoutItemMargin); } inline static QSize fromLayoutItemSize(QWidgetPrivate *priv, const QSize &size) @@ -64,7 +65,8 @@ inline static QSize fromLayoutItemSize(QWidgetPrivate *priv, const QSize &size) inline static QRect toLayoutItemRect(QWidgetPrivate *priv, const QRect &rect) { - return priv->fromOrToLayoutItemRect(rect, +1); + return rect.adjusted(-priv->leftLayoutItemMargin, -priv->topLayoutItemMargin, + priv->rightLayoutItemMargin, priv->bottomLayoutItemMargin); } inline static QSize toLayoutItemSize(QWidgetPrivate *priv, const QSize &size) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index a8eae9b..ab529fe 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1516,45 +1516,6 @@ void QWidgetPrivate::deleteExtra() } /* - Returns true if the background is inherited; otherwise returns - false. - - Mainly used in the paintOnScreen case. -*/ - -bool QWidgetPrivate::isBackgroundInherited() const -{ - Q_Q(const QWidget); - - // windows do not inherit their background - if (q->isWindow() || q->windowType() == Qt::SubWindow) - return false; - - if (q->testAttribute(Qt::WA_NoSystemBackground) || q->testAttribute(Qt::WA_OpaquePaintEvent)) - return false; - - const QPalette &pal = q->palette(); - QPalette::ColorRole bg = q->backgroundRole(); - QBrush brush = pal.brush(bg); - - // non opaque brushes leaves us no choice, we must inherit - if (!q->autoFillBackground() || !brush.isOpaque()) - return true; - - if (brush.style() == Qt::SolidPattern) { - // the background is just a solid color. If there is no - // propagated contents, then we claim as performance - // optimization that it was not inheritet. This is the normal - // case in standard Windows or Motif style. - const QWidget *w = q->parentWidget(); - if (!w->d_func()->isBackgroundInherited()) - return false; - } - - return true; -} - -/* Returns true if there are widgets above this which overlap with \a rect, which is in parent's coordinate system (same as crect). */ @@ -1900,24 +1861,6 @@ void QWidgetPrivate::clipToEffectiveMask(QRegion ®ion) const } } -bool QWidgetPrivate::hasBackground() const -{ - Q_Q(const QWidget); - if (!q->isWindow() && q->parentWidget() && q->parentWidget()->testAttribute(Qt::WA_PaintOnScreen)) - return true; - if (q->testAttribute(Qt::WA_PaintOnScreen)) - return true; - if (!q->testAttribute(Qt::WA_OpaquePaintEvent) && !q->testAttribute(Qt::WA_NoSystemBackground)) { - const QPalette &pal = q->palette(); - QPalette::ColorRole bg = q->backgroundRole(); - QBrush bgBrush = pal.brush(bg); - return (bgBrush.style() != Qt::NoBrush && - ((q->isWindow() || q->windowType() == Qt::SubWindow) - || (QPalette::ColorRole(bg_role) != QPalette::NoRole || (pal.resolve() & (1<window(); - QBrush bgBrush = win->palette().brush(win->backgroundRole()); - bool opaque = bgBrush.style() == Qt::NoBrush || bgBrush.isOpaque(); - QWidget::qwsDisplay()->repaintRegion(win->data->winid, win->windowFlags(), opaque, globalrgn); -} - void QWidgetPrivate::show_sys() { Q_Q(QWidget); diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 906500e..b35740a 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -906,6 +906,44 @@ void QWidgetPrivate::x11UpdateIsOpaque() #endif } +/* + Returns true if the background is inherited; otherwise returns + false. + + Mainly used in the paintOnScreen case. +*/ +bool QWidgetPrivate::isBackgroundInherited() const +{ + Q_Q(const QWidget); + + // windows do not inherit their background + if (q->isWindow() || q->windowType() == Qt::SubWindow) + return false; + + if (q->testAttribute(Qt::WA_NoSystemBackground) || q->testAttribute(Qt::WA_OpaquePaintEvent)) + return false; + + const QPalette &pal = q->palette(); + QPalette::ColorRole bg = q->backgroundRole(); + QBrush brush = pal.brush(bg); + + // non opaque brushes leaves us no choice, we must inherit + if (!q->autoFillBackground() || !brush.isOpaque()) + return true; + + if (brush.style() == Qt::SolidPattern) { + // the background is just a solid color. If there is no + // propagated contents, then we claim as performance + // optimization that it was not inheritet. This is the normal + // case in standard Windows or Motif style. + const QWidget *w = q->parentWidget(); + if (!w->d_func()->isBackgroundInherited()) + return false; + } + + return true; +} + void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { Q_D(QWidget); -- cgit v0.12 From d3f8c08548cf7a454d3fd31c3313031d3e0bb223 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 12 May 2009 16:31:32 -0700 Subject: Fixed wrong function name in warning Reviewed-by: Donald --- src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 65fddbf..98e32ed 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -294,14 +294,14 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img, IDirectFBSurface *dfbSurface = createDFBSurface(image.size(), pixmapFormat, options); if (!dfbSurface) { - qWarning("QDirectFBPixmapData::fromImage() Couldn't create surface"); + qWarning("QDirectFBScreen::copyToDFBSurface() Couldn't create surface"); return 0; } #ifndef QT_NO_DIRECTFB_PREALLOCATED IDirectFBSurface *imgSurface = createDFBSurface(image, DontTrackSurface); if (!imgSurface) { - qWarning("QDirectFBPixmapData::fromImage()"); + qWarning("QDirectFBScreen::copyToDFBSurface()"); QDirectFBScreen::releaseDFBSurface(dfbSurface); return 0; } @@ -316,7 +316,7 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img, dfbSurface->SetBlittingFlags(dfbSurface, flags); DFBResult result = dfbSurface->Blit(dfbSurface, imgSurface, 0, 0, 0); if (result != DFB_OK) - DirectFBError("QDirectFBPixmapData::fromImage()", result); + DirectFBError("QDirectFBScreen::copyToDFBSurface()", result); dfbSurface->ReleaseSource(dfbSurface); imgSurface->Release(imgSurface); #else // QT_NO_DIRECTFB_PREALLOCATED -- cgit v0.12 From dde94b1737e9860838c87d3f432cf76de3157ad7 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 13 May 2009 10:33:59 +1000 Subject: Fixed compile on Windows in debug-only mode. A Qt project can't unconditionally do `CONFIG+=release' or `CONFIG+=debug' since the release and debug libraries are named differently on Windows. In this case, CONFIG+=release meant this project was looking for QtSql.lib, but when Qt is configured with `-debug', only QtSqld.lib exists. Reviewed-by: Rhys Weatherley --- tools/qtestlib/chart/chart.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qtestlib/chart/chart.pro b/tools/qtestlib/chart/chart.pro index 6f6e6d5..7328e5d 100644 --- a/tools/qtestlib/chart/chart.pro +++ b/tools/qtestlib/chart/chart.pro @@ -4,7 +4,7 @@ SOURCES += main.cpp RESOURCES = $$PWD/chart.qrc QT += sql xml -CONFIG += console release +CONFIG += console CONFIG -= app_bundle -- cgit v0.12 From dcf1867f5715991e233120122f6252b18ccd26e3 Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 13 May 2009 14:06:47 +1000 Subject: Fixes a segfault from out of order cleanup of mysql resources. If a QSqlQuery survived the lifetime of removal of a mysql db connection (that failed), the cleanup code would cause a segfault because it was using an out of date pointer that was pointing at memory that'd been freed by the removeDatabase() call. Revby: Justin McPherson Task-number: 205701 --- src/sql/drivers/mysql/qsql_mysql.cpp | 123 +++++++++++++++++++-------------- tests/auto/qsqlquery/tst_qsqlquery.cpp | 22 +++++- 2 files changed, 93 insertions(+), 52 deletions(-) diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index 1f54db7..fbefa0c 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -163,18 +163,21 @@ static inline QVariant qDateTimeFromString(QString &val) #endif } -class QMYSQLResultPrivate +class QMYSQLResultPrivate : public QObject { + Q_OBJECT public: - QMYSQLResultPrivate(QMYSQLDriverPrivate* dp) : d(dp), result(0), + QMYSQLResultPrivate(const QMYSQLDriver* dp) : driver(dp), result(0), rowsAffected(0), hasBlobs(false) #if MYSQL_VERSION_ID >= 40108 , stmt(0), meta(0), inBinds(0), outBinds(0) #endif , precisionPolicy(QSql::HighPrecision) - {} + { + connect(dp, SIGNAL(destroyed()), this, SLOT(driverDestroyed())); + } - QMYSQLDriverPrivate* d; + const QMYSQLDriver* driver; MYSQL_RES *result; MYSQL_ROW row; @@ -207,6 +210,8 @@ public: MYSQL_BIND *outBinds; #endif QSql::NumericalPrecisionPolicy precisionPolicy; +private Q_SLOTS: + void driverDestroyed() { driver = NULL; } }; #ifndef QT_NO_TEXTCODEC @@ -379,7 +384,7 @@ bool QMYSQLResultPrivate::bindInValues() QMYSQLResult::QMYSQLResult(const QMYSQLDriver* db) : QSqlResult(db) { - d = new QMYSQLResultPrivate(db->d); + d = new QMYSQLResultPrivate(db); } QMYSQLResult::~QMYSQLResult() @@ -391,7 +396,7 @@ QMYSQLResult::~QMYSQLResult() QVariant QMYSQLResult::handle() const { #if MYSQL_VERSION_ID >= 40108 - if(d->d->preparedQuerys) + if(d->driver && d->driver->d->preparedQuerys) return d->meta ? qVariantFromValue(d->meta) : qVariantFromValue(d->stmt); else #endif @@ -406,8 +411,8 @@ void QMYSQLResult::cleanup() // must iterate trough leftover result sets from multi-selects or stored procedures // if this isn't done subsequent queries will fail with "Commands out of sync" #if MYSQL_VERSION_ID >= 40100 - while (d->d->mysql && mysql_next_result(d->d->mysql) == 0) { - MYSQL_RES *res = mysql_store_result(d->d->mysql); + while (d->driver && d->driver->d->mysql && mysql_next_result(d->driver->d->mysql) == 0) { + MYSQL_RES *res = mysql_store_result(d->driver->d->mysql); if (res) mysql_free_result(res); } @@ -447,11 +452,14 @@ void QMYSQLResult::cleanup() setAt(-1); setActive(false); - d->d->preparedQuerys = d->d->preparedQuerysEnabled; + if(d->driver) + d->driver->d->preparedQuerys = d->driver->d->preparedQuerysEnabled; } bool QMYSQLResult::fetch(int i) { + if(!d->driver) + return false; if (isForwardOnly()) { // fake a forward seek if (at() < i) { int x = i - at(); @@ -463,7 +471,7 @@ bool QMYSQLResult::fetch(int i) } if (at() == i) return true; - if (d->d->preparedQuerys) { + if (d->driver->d->preparedQuerys) { #if MYSQL_VERSION_ID >= 40108 mysql_stmt_data_seek(d->stmt, i); @@ -494,7 +502,9 @@ bool QMYSQLResult::fetch(int i) bool QMYSQLResult::fetchNext() { - if (d->d->preparedQuerys) { + if(!d->driver) + return false; + if (d->driver->d->preparedQuerys) { #if MYSQL_VERSION_ID >= 40108 if (mysql_stmt_fetch(d->stmt)) return false; @@ -512,6 +522,8 @@ bool QMYSQLResult::fetchNext() bool QMYSQLResult::fetchLast() { + if(!d->driver) + return false; if (isForwardOnly()) { // fake this since MySQL can't seek on forward only queries bool success = fetchNext(); // did we move at all? while (fetchNext()) {}; @@ -519,7 +531,7 @@ bool QMYSQLResult::fetchLast() } my_ulonglong numRows; - if (d->d->preparedQuerys) { + if (d->driver->d->preparedQuerys) { #if MYSQL_VERSION_ID >= 40108 numRows = mysql_stmt_num_rows(d->stmt); #else @@ -553,15 +565,18 @@ QVariant QMYSQLResult::data(int field) return QVariant(); } + if (!d->driver) + return QVariant(); + int fieldLength = 0; const QMYSQLResultPrivate::QMyField &f = d->fields.at(field); QString val; - if (d->d->preparedQuerys) { + if (d->driver->d->preparedQuerys) { if (f.nullIndicator) return QVariant(f.type); if (f.type != QVariant::ByteArray) - val = toUnicode(d->d->tc, f.outField, f.bufLength); + val = toUnicode(d->driver->d->tc, f.outField, f.bufLength); } else { if (d->row[field] == NULL) { // NULL value @@ -569,7 +584,7 @@ QVariant QMYSQLResult::data(int field) } fieldLength = mysql_fetch_lengths(d->result)[field]; if (f.type != QVariant::ByteArray) - val = toUnicode(d->d->tc, d->row[field], fieldLength); + val = toUnicode(d->driver->d->tc, d->row[field], fieldLength); } switch(f.type) { @@ -614,7 +629,7 @@ QVariant QMYSQLResult::data(int field) case QVariant::ByteArray: { QByteArray ba; - if (d->d->preparedQuerys) { + if (d->driver->d->preparedQuerys) { ba = QByteArray(f.outField, f.bufLength); } else { ba = QByteArray(d->row[field], fieldLength); @@ -631,7 +646,7 @@ QVariant QMYSQLResult::data(int field) bool QMYSQLResult::isNull(int field) { - if (d->d->preparedQuerys) + if (d->driver->d->preparedQuerys) return d->fields.at(field).nullIndicator; else return d->row[field] == NULL; @@ -639,31 +654,31 @@ bool QMYSQLResult::isNull(int field) bool QMYSQLResult::reset (const QString& query) { - if (!driver() || !driver()->isOpen() || driver()->isOpenError()) + if (!driver() || !driver()->isOpen() || driver()->isOpenError() || !d->driver) return false; - if(d->d->preparedQuerysEnabled && prepare(query)) { - d->d->preparedQuerys = true; + if(d->driver->d->preparedQuerysEnabled && prepare(query)) { + d->driver->d->preparedQuerys = true; return exec(); } - d->d->preparedQuerys = false; + d->driver->d->preparedQuerys = false; - const QByteArray encQuery(fromUnicode(d->d->tc, query)); - if (mysql_real_query(d->d->mysql, encQuery.data(), encQuery.length())) { + const QByteArray encQuery(fromUnicode(d->driver->d->tc, query)); + if (mysql_real_query(d->driver->d->mysql, encQuery.data(), encQuery.length())) { setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to execute query"), - QSqlError::StatementError, d->d)); + QSqlError::StatementError, d->driver->d)); return false; } - d->result = mysql_store_result(d->d->mysql); - if (!d->result && mysql_field_count(d->d->mysql) > 0) { + d->result = mysql_store_result(d->driver->d->mysql); + if (!d->result && mysql_field_count(d->driver->d->mysql) > 0) { setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to store result"), - QSqlError::StatementError, d->d)); + QSqlError::StatementError, d->driver->d)); return false; } - int numFields = mysql_field_count(d->d->mysql); + int numFields = mysql_field_count(d->driver->d->mysql); setSelect(numFields != 0); d->fields.resize(numFields); - d->rowsAffected = mysql_affected_rows(d->d->mysql); + d->rowsAffected = mysql_affected_rows(d->driver->d->mysql); if (isSelect()) { for(int i = 0; i < numFields; i++) { MYSQL_FIELD* field = mysql_fetch_field_direct(d->result, i); @@ -677,8 +692,8 @@ bool QMYSQLResult::reset (const QString& query) int QMYSQLResult::size() { - if (isSelect()) - if (d->d->preparedQuerys) + if (d->driver && isSelect()) + if (d->driver->d->preparedQuerys) #if MYSQL_VERSION_ID >= 40108 return mysql_stmt_num_rows(d->stmt); #else @@ -697,17 +712,17 @@ int QMYSQLResult::numRowsAffected() QVariant QMYSQLResult::lastInsertId() const { - if (!isActive()) + if (!isActive() || !d->driver) return QVariant(); - if (d->d->preparedQuerys) { + if (d->driver->d->preparedQuerys) { #if MYSQL_VERSION_ID >= 40108 quint64 id = mysql_stmt_insert_id(d->stmt); if (id) return QVariant(id); #endif } else { - quint64 id = mysql_insert_id(d->d->mysql); + quint64 id = mysql_insert_id(d->driver->d->mysql); if (id) return QVariant(id); } @@ -718,20 +733,20 @@ QSqlRecord QMYSQLResult::record() const { QSqlRecord info; MYSQL_RES *res; - if (!isActive() || !isSelect()) + if (!isActive() || !isSelect() || !d->driver) return info; #if MYSQL_VERSION_ID >= 40108 - res = d->d->preparedQuerys ? d->meta : d->result; + res = d->driver->d->preparedQuerys ? d->meta : d->result; #else res = d->result; #endif - if (!mysql_errno(d->d->mysql)) { + if (!mysql_errno(d->driver->d->mysql)) { mysql_field_seek(res, 0); MYSQL_FIELD* field = mysql_fetch_field(res); while(field) { - info.append(qToField(field, d->d->tc)); + info.append(qToField(field, d->driver->d->tc)); field = mysql_fetch_field(res); } } @@ -741,6 +756,8 @@ QSqlRecord QMYSQLResult::record() const bool QMYSQLResult::nextResult() { + if(!d->driver) + return false; #if MYSQL_VERSION_ID >= 40100 setAt(-1); setActive(false); @@ -754,26 +771,26 @@ bool QMYSQLResult::nextResult() delete[] d->fields[i].outField; d->fields.clear(); - int status = mysql_next_result(d->d->mysql); + int status = mysql_next_result(d->driver->d->mysql); if (status > 0) { setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to execute next query"), - QSqlError::StatementError, d->d)); + QSqlError::StatementError, d->driver->d)); return false; } else if (status == -1) { return false; // No more result sets } - d->result = mysql_store_result(d->d->mysql); - int numFields = mysql_field_count(d->d->mysql); + d->result = mysql_store_result(d->driver->d->mysql); + int numFields = mysql_field_count(d->driver->d->mysql); if (!d->result && numFields > 0) { setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to store next result"), - QSqlError::StatementError, d->d)); + QSqlError::StatementError, d->driver->d)); return false; } setSelect(numFields > 0); d->fields.resize(numFields); - d->rowsAffected = mysql_affected_rows(d->d->mysql); + d->rowsAffected = mysql_affected_rows(d->driver->d->mysql); if (isSelect()) { for (int i = 0; i < numFields; i++) { @@ -833,9 +850,11 @@ static MYSQL_TIME *toMySqlDate(QDate date, QTime time, QVariant::Type type) bool QMYSQLResult::prepare(const QString& query) { + if(!d->driver) + return false; #if MYSQL_VERSION_ID >= 40108 cleanup(); - if (!d->d->preparedQuerys) + if (!d->driver->d->preparedQuerys) return QSqlResult::prepare(query); int r; @@ -844,14 +863,14 @@ bool QMYSQLResult::prepare(const QString& query) return false; if (!d->stmt) - d->stmt = mysql_stmt_init(d->d->mysql); + d->stmt = mysql_stmt_init(d->driver->d->mysql); if (!d->stmt) { setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to prepare statement"), - QSqlError::StatementError, d->d)); + QSqlError::StatementError, d->driver->d)); return false; } - const QByteArray encQuery(fromUnicode(d->d->tc, query)); + const QByteArray encQuery(fromUnicode(d->driver->d->tc, query)); r = mysql_stmt_prepare(d->stmt, encQuery.constData(), encQuery.length()); if (r != 0) { setLastError(qMakeStmtError(QCoreApplication::translate("QMYSQLResult", @@ -873,7 +892,9 @@ bool QMYSQLResult::prepare(const QString& query) bool QMYSQLResult::exec() { - if (!d->d->preparedQuerys) + if (!d->driver) + return false; + if (!d->driver->d->preparedQuerys) return QSqlResult::exec(); if (!d->stmt) return false; @@ -963,7 +984,7 @@ bool QMYSQLResult::exec() break; case QVariant::String: default: { - QByteArray ba = fromUnicode(d->d->tc, val.toString()); + QByteArray ba = fromUnicode(d->driver->d->tc, val.toString()); stringVector.append(ba); currBind->buffer_type = MYSQL_TYPE_STRING; currBind->buffer = const_cast(ba.constData()); @@ -1459,3 +1480,5 @@ bool QMYSQLDriver::isIdentifierEscapedImplementation(const QString &identifier, } QT_END_NAMESPACE + +#include "qsql_mysql.moc" \ No newline at end of file diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 074f16f..7f97972 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -178,9 +178,11 @@ private slots: void task_217003_data() { generic_data(); } void task_217003(); #endif - void task_250026_data() { generic_data("QODBC"); } void task_250026(); + void task_205701_data() { generic_data("QMYSQL"); } + void task_205701(); + private: @@ -297,7 +299,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) #ifdef NOT_READY_YET tablenames << qTableName( "Planet" ); #endif - tablenames << qTableName( "task_250026" ); + tablenames << qTableName( "task_250026" ); tst_Databases::safeDropTables( db, tablenames ); } @@ -2711,5 +2713,21 @@ void tst_QSqlQuery::task_250026() QCOMPARE( q.value( 0 ).toString().length(), data1026.length() ); } +void tst_QSqlQuery::task_205701() +{ + QSqlDatabase qsdb = QSqlDatabase::addDatabase("QMYSQL", "atest"); + qsdb.setHostName("test"); + qsdb.setDatabaseName("test"); + qsdb.setUserName("test"); + qsdb.setPassword("test"); + qsdb.open(); + +// { + QSqlQuery query(qsdb); +// } + QSqlDatabase::removeDatabase("atest"); +} + + QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" -- cgit v0.12 From 03415f5db33ee1d8af15b924f84b547a9ed8020b Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 8 May 2009 09:09:32 +0200 Subject: fix WinCE build Reviewed-by: thartman --- src/gui/widgets/qmenu_wince.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp index 847a623..fbe54fe 100644 --- a/src/gui/widgets/qmenu_wince.cpp +++ b/src/gui/widgets/qmenu_wince.cpp @@ -214,10 +214,12 @@ static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, i mbi.nToolBarId = toolbarID; if (ptrCreateMenuBar(&mbi)) { +#ifdef Q_WS_WINCE_WM // Tell the menu bar that we want to override hot key behaviour. LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, SHMBOF_NODEFAULT | SHMBOF_NOTIFY); SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam); +#endif return mbi.hwndMB; } } -- cgit v0.12 From 23a76927148ef6e2bf6aed6c894e23e838f763e6 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Wed, 13 May 2009 08:52:16 +0200 Subject: fix wince build in 4ffda2918b3f5c789ef325cdeaac72e5e7ef2c0c savedFlags has been made crossplatform by switching from ulong to Qt::WindowFlags. WinCE does not have an automatic conversion between those types, thus bails out with an error. Need to cast it to the proper type. Reviewed-by: Marius Storm-Olsen --- src/gui/kernel/qwidget_wince.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp index 0ed40fa..435fd31 100644 --- a/src/gui/kernel/qwidget_wince.cpp +++ b/src/gui/kernel/qwidget_wince.cpp @@ -535,7 +535,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 = GetWindowLongA(internalWinId(), GWL_STYLE); + d->topData()->savedFlags = (Qt::WindowFlags) GetWindowLongA(internalWinId(), GWL_STYLE); UINT style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP; if (isVisible()) style |= WS_VISIBLE; -- cgit v0.12 From 5cbaaa1a8baf14b66efe89fe967a3e966dac659c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 13 May 2009 09:40:05 +0200 Subject: Fixed Qt 4.6 source package compilation by moving the qvfb skins. Move skins to tools/shared/deviceskin and have them included automatically by the profile. Acked-by: Jason McDonald Acked-by: Warwick Allison --- tools/designer/src/lib/sdk/abstractformeditor.cpp | 1 - tools/designer/src/lib/shared/shared.pri | 15 +-- tools/qvfb/ClamshellPhone.qrc | 5 - tools/qvfb/ClamshellPhone.skin/ClamshellPhone.skin | 30 ----- .../ClamshellPhone1-5-closed.png | Bin 68200 -> 0 bytes .../ClamshellPhone1-5-pressed.png | Bin 113907 -> 0 bytes .../qvfb/ClamshellPhone.skin/ClamshellPhone1-5.png | Bin 113450 -> 0 bytes tools/qvfb/ClamshellPhone.skin/defaultbuttons.conf | 78 ----------- .../DualScreenPhone.skin/DualScreen-pressed.png | Bin 115575 -> 0 bytes tools/qvfb/DualScreenPhone.skin/DualScreen.png | Bin 104711 -> 0 bytes .../qvfb/DualScreenPhone.skin/DualScreenPhone.skin | 29 ----- .../qvfb/DualScreenPhone.skin/defaultbuttons.conf | 78 ----------- tools/qvfb/PDAPhone.qrc | 5 - tools/qvfb/PDAPhone.skin/PDAPhone.skin | 18 --- tools/qvfb/PDAPhone.skin/defaultbuttons.conf | 36 ------ tools/qvfb/PDAPhone.skin/finger.png | Bin 40343 -> 0 bytes tools/qvfb/PDAPhone.skin/pda_down.png | Bin 52037 -> 0 bytes tools/qvfb/PDAPhone.skin/pda_up.png | Bin 100615 -> 0 bytes tools/qvfb/PortableMedia.qrc | 5 - tools/qvfb/PortableMedia.skin/PortableMedia.skin | 14 -- tools/qvfb/PortableMedia.skin/defaultbuttons.conf | 23 ---- .../PortableMedia.skin/portablemedia-pressed.png | Bin 6183 -> 0 bytes tools/qvfb/PortableMedia.skin/portablemedia.png | Bin 6182 -> 0 bytes tools/qvfb/PortableMedia.skin/portablemedia.xcf | Bin 41592 -> 0 bytes tools/qvfb/S60-QVGA-Candybar.qrc | 5 - .../S60-QVGA-Candybar-down.png | Bin 161184 -> 0 bytes .../S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png | Bin 156789 -> 0 bytes .../S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin | 15 --- .../S60-QVGA-Candybar.skin/defaultbuttons.conf | 78 ----------- tools/qvfb/S60-nHD-Touchscreen.qrc | 5 - .../S60-nHD-Touchscreen-down.png | Bin 241501 -> 0 bytes .../S60-nHD-Touchscreen.png | Bin 240615 -> 0 bytes .../S60-nHD-Touchscreen.skin | 10 -- .../S60-nHD-Touchscreen.skin/defaultbuttons.conf | 53 -------- tools/qvfb/SmartPhone.qrc | 5 - tools/qvfb/SmartPhone.skin/SmartPhone-pressed.png | Bin 111515 -> 0 bytes tools/qvfb/SmartPhone.skin/SmartPhone.png | Bin 101750 -> 0 bytes tools/qvfb/SmartPhone.skin/SmartPhone.skin | 28 ---- tools/qvfb/SmartPhone.skin/defaultbuttons.conf | 78 ----------- tools/qvfb/SmartPhone2.qrc | 5 - .../qvfb/SmartPhone2.skin/SmartPhone2-pressed.png | Bin 134749 -> 0 bytes tools/qvfb/SmartPhone2.skin/SmartPhone2.png | Bin 121915 -> 0 bytes tools/qvfb/SmartPhone2.skin/SmartPhone2.skin | 25 ---- tools/qvfb/SmartPhone2.skin/defaultbuttons.conf | 52 -------- tools/qvfb/SmartPhoneWithButtons.qrc | 5 - .../SmartPhoneWithButtons-pressed.png | Bin 103838 -> 0 bytes .../SmartPhoneWithButtons.png | Bin 88470 -> 0 bytes .../SmartPhoneWithButtons.skin | 31 ----- .../SmartPhoneWithButtons.skin/defaultbuttons.conf | 103 --------------- tools/qvfb/TouchscreenPhone.qrc | 5 - .../TouchscreenPhone-pressed.png | Bin 88599 -> 0 bytes .../TouchscreenPhone.skin/TouchscreenPhone.png | Bin 61809 -> 0 bytes .../TouchscreenPhone.skin/TouchscreenPhone.skin | 16 --- .../qvfb/TouchscreenPhone.skin/defaultbuttons.conf | 45 ------- tools/qvfb/Trolltech-Keypad.qrc | 5 - .../Trolltech-Keypad-closed.png | Bin 69447 -> 0 bytes .../Trolltech-Keypad-down.png | Bin 242107 -> 0 bytes .../Trolltech-Keypad.skin/Trolltech-Keypad.png | Bin 230638 -> 0 bytes .../Trolltech-Keypad.skin/Trolltech-Keypad.skin | 35 ----- .../qvfb/Trolltech-Keypad.skin/defaultbuttons.conf | 142 --------------------- tools/qvfb/Trolltech-Touchscreen.qrc | 5 - .../Trolltech-Touchscreen-down.png | Bin 133117 -> 0 bytes .../Trolltech-Touchscreen.png | Bin 133180 -> 0 bytes .../Trolltech-Touchscreen.skin | 17 --- .../Trolltech-Touchscreen.skin/defaultbuttons.conf | 53 -------- tools/qvfb/pda.qrc | 5 - tools/qvfb/pda.skin | 14 -- tools/qvfb/pda_down.png | Bin 102655 -> 0 bytes tools/qvfb/pda_up.png | Bin 100615 -> 0 bytes tools/qvfb/qvfb.pro | 13 +- tools/shared/deviceskin/deviceskin.pri | 12 ++ tools/shared/deviceskin/skins/ClamshellPhone.qrc | 5 + .../skins/ClamshellPhone.skin/ClamshellPhone.skin | 30 +++++ .../ClamshellPhone1-5-closed.png | Bin 0 -> 68200 bytes .../ClamshellPhone1-5-pressed.png | Bin 0 -> 113907 bytes .../ClamshellPhone.skin/ClamshellPhone1-5.png | Bin 0 -> 113450 bytes .../skins/ClamshellPhone.skin/defaultbuttons.conf | 78 +++++++++++ .../DualScreenPhone.skin/DualScreen-pressed.png | Bin 0 -> 115575 bytes .../skins/DualScreenPhone.skin/DualScreen.png | Bin 0 -> 104711 bytes .../DualScreenPhone.skin/DualScreenPhone.skin | 29 +++++ .../skins/DualScreenPhone.skin/defaultbuttons.conf | 78 +++++++++++ tools/shared/deviceskin/skins/PDAPhone.qrc | 5 + .../deviceskin/skins/PDAPhone.skin/PDAPhone.skin | 18 +++ .../skins/PDAPhone.skin/defaultbuttons.conf | 36 ++++++ .../deviceskin/skins/PDAPhone.skin/finger.png | Bin 0 -> 40343 bytes .../deviceskin/skins/PDAPhone.skin/pda_down.png | Bin 0 -> 52037 bytes .../deviceskin/skins/PDAPhone.skin/pda_up.png | Bin 0 -> 100615 bytes tools/shared/deviceskin/skins/PortableMedia.qrc | 5 + .../skins/PortableMedia.skin/PortableMedia.skin | 14 ++ .../skins/PortableMedia.skin/defaultbuttons.conf | 23 ++++ .../PortableMedia.skin/portablemedia-pressed.png | Bin 0 -> 6183 bytes .../skins/PortableMedia.skin/portablemedia.png | Bin 0 -> 6182 bytes .../skins/PortableMedia.skin/portablemedia.xcf | Bin 0 -> 41592 bytes .../shared/deviceskin/skins/S60-QVGA-Candybar.qrc | 5 + .../S60-QVGA-Candybar-down.png | Bin 0 -> 161184 bytes .../S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png | Bin 0 -> 156789 bytes .../S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin | 15 +++ .../S60-QVGA-Candybar.skin/defaultbuttons.conf | 78 +++++++++++ .../deviceskin/skins/S60-nHD-Touchscreen.qrc | 5 + .../S60-nHD-Touchscreen-down.png | Bin 0 -> 241501 bytes .../S60-nHD-Touchscreen.png | Bin 0 -> 240615 bytes .../S60-nHD-Touchscreen.skin | 10 ++ .../S60-nHD-Touchscreen.skin/defaultbuttons.conf | 53 ++++++++ tools/shared/deviceskin/skins/SmartPhone.qrc | 5 + .../skins/SmartPhone.skin/SmartPhone-pressed.png | Bin 0 -> 111515 bytes .../skins/SmartPhone.skin/SmartPhone.png | Bin 0 -> 101750 bytes .../skins/SmartPhone.skin/SmartPhone.skin | 28 ++++ .../skins/SmartPhone.skin/defaultbuttons.conf | 78 +++++++++++ tools/shared/deviceskin/skins/SmartPhone2.qrc | 5 + .../skins/SmartPhone2.skin/SmartPhone2-pressed.png | Bin 0 -> 134749 bytes .../skins/SmartPhone2.skin/SmartPhone2.png | Bin 0 -> 121915 bytes .../skins/SmartPhone2.skin/SmartPhone2.skin | 25 ++++ .../skins/SmartPhone2.skin/defaultbuttons.conf | 52 ++++++++ .../deviceskin/skins/SmartPhoneWithButtons.qrc | 5 + .../SmartPhoneWithButtons-pressed.png | Bin 0 -> 103838 bytes .../SmartPhoneWithButtons.png | Bin 0 -> 88470 bytes .../SmartPhoneWithButtons.skin | 31 +++++ .../SmartPhoneWithButtons.skin/defaultbuttons.conf | 103 +++++++++++++++ tools/shared/deviceskin/skins/TouchscreenPhone.qrc | 5 + .../TouchscreenPhone-pressed.png | Bin 0 -> 88599 bytes .../TouchscreenPhone.skin/TouchscreenPhone.png | Bin 0 -> 61809 bytes .../TouchscreenPhone.skin/TouchscreenPhone.skin | 16 +++ .../TouchscreenPhone.skin/defaultbuttons.conf | 45 +++++++ tools/shared/deviceskin/skins/Trolltech-Keypad.qrc | 5 + .../Trolltech-Keypad-closed.png | Bin 0 -> 69447 bytes .../Trolltech-Keypad-down.png | Bin 0 -> 242107 bytes .../Trolltech-Keypad.skin/Trolltech-Keypad.png | Bin 0 -> 230638 bytes .../Trolltech-Keypad.skin/Trolltech-Keypad.skin | 35 +++++ .../Trolltech-Keypad.skin/defaultbuttons.conf | 142 +++++++++++++++++++++ .../deviceskin/skins/Trolltech-Touchscreen.qrc | 5 + .../Trolltech-Touchscreen-down.png | Bin 0 -> 133117 bytes .../Trolltech-Touchscreen.png | Bin 0 -> 133180 bytes .../Trolltech-Touchscreen.skin | 17 +++ .../Trolltech-Touchscreen.skin/defaultbuttons.conf | 53 ++++++++ 134 files changed, 1156 insertions(+), 1188 deletions(-) delete mode 100644 tools/qvfb/ClamshellPhone.qrc delete mode 100644 tools/qvfb/ClamshellPhone.skin/ClamshellPhone.skin delete mode 100644 tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-closed.png delete mode 100644 tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png delete mode 100644 tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5.png delete mode 100644 tools/qvfb/ClamshellPhone.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/DualScreenPhone.skin/DualScreen-pressed.png delete mode 100644 tools/qvfb/DualScreenPhone.skin/DualScreen.png delete mode 100644 tools/qvfb/DualScreenPhone.skin/DualScreenPhone.skin delete mode 100644 tools/qvfb/DualScreenPhone.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/PDAPhone.qrc delete mode 100644 tools/qvfb/PDAPhone.skin/PDAPhone.skin delete mode 100644 tools/qvfb/PDAPhone.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/PDAPhone.skin/finger.png delete mode 100644 tools/qvfb/PDAPhone.skin/pda_down.png delete mode 100644 tools/qvfb/PDAPhone.skin/pda_up.png delete mode 100644 tools/qvfb/PortableMedia.qrc delete mode 100644 tools/qvfb/PortableMedia.skin/PortableMedia.skin delete mode 100644 tools/qvfb/PortableMedia.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/PortableMedia.skin/portablemedia-pressed.png delete mode 100644 tools/qvfb/PortableMedia.skin/portablemedia.png delete mode 100644 tools/qvfb/PortableMedia.skin/portablemedia.xcf delete mode 100644 tools/qvfb/S60-QVGA-Candybar.qrc delete mode 100644 tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png delete mode 100644 tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png delete mode 100644 tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin delete mode 100644 tools/qvfb/S60-QVGA-Candybar.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/S60-nHD-Touchscreen.qrc delete mode 100644 tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png delete mode 100644 tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png delete mode 100644 tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin delete mode 100644 tools/qvfb/S60-nHD-Touchscreen.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/SmartPhone.qrc delete mode 100644 tools/qvfb/SmartPhone.skin/SmartPhone-pressed.png delete mode 100644 tools/qvfb/SmartPhone.skin/SmartPhone.png delete mode 100644 tools/qvfb/SmartPhone.skin/SmartPhone.skin delete mode 100644 tools/qvfb/SmartPhone.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/SmartPhone2.qrc delete mode 100644 tools/qvfb/SmartPhone2.skin/SmartPhone2-pressed.png delete mode 100644 tools/qvfb/SmartPhone2.skin/SmartPhone2.png delete mode 100644 tools/qvfb/SmartPhone2.skin/SmartPhone2.skin delete mode 100644 tools/qvfb/SmartPhone2.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/SmartPhoneWithButtons.qrc delete mode 100644 tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png delete mode 100644 tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png delete mode 100644 tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin delete mode 100644 tools/qvfb/SmartPhoneWithButtons.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/TouchscreenPhone.qrc delete mode 100644 tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone-pressed.png delete mode 100644 tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.png delete mode 100644 tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.skin delete mode 100644 tools/qvfb/TouchscreenPhone.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/Trolltech-Keypad.qrc delete mode 100644 tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png delete mode 100644 tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-down.png delete mode 100644 tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.png delete mode 100644 tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.skin delete mode 100644 tools/qvfb/Trolltech-Keypad.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/Trolltech-Touchscreen.qrc delete mode 100644 tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png delete mode 100644 tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png delete mode 100644 tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin delete mode 100644 tools/qvfb/Trolltech-Touchscreen.skin/defaultbuttons.conf delete mode 100644 tools/qvfb/pda.qrc delete mode 100644 tools/qvfb/pda.skin delete mode 100644 tools/qvfb/pda_down.png delete mode 100644 tools/qvfb/pda_up.png create mode 100644 tools/shared/deviceskin/skins/ClamshellPhone.qrc create mode 100644 tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone.skin create mode 100644 tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-closed.png create mode 100644 tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png create mode 100644 tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5.png create mode 100644 tools/shared/deviceskin/skins/ClamshellPhone.skin/defaultbuttons.conf create mode 100644 tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen-pressed.png create mode 100644 tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen.png create mode 100644 tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreenPhone.skin create mode 100644 tools/shared/deviceskin/skins/DualScreenPhone.skin/defaultbuttons.conf create mode 100644 tools/shared/deviceskin/skins/PDAPhone.qrc create mode 100644 tools/shared/deviceskin/skins/PDAPhone.skin/PDAPhone.skin create mode 100644 tools/shared/deviceskin/skins/PDAPhone.skin/defaultbuttons.conf create mode 100644 tools/shared/deviceskin/skins/PDAPhone.skin/finger.png create mode 100644 tools/shared/deviceskin/skins/PDAPhone.skin/pda_down.png create mode 100644 tools/shared/deviceskin/skins/PDAPhone.skin/pda_up.png create mode 100644 tools/shared/deviceskin/skins/PortableMedia.qrc create mode 100644 tools/shared/deviceskin/skins/PortableMedia.skin/PortableMedia.skin create mode 100644 tools/shared/deviceskin/skins/PortableMedia.skin/defaultbuttons.conf create mode 100644 tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia-pressed.png create mode 100644 tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.png create mode 100644 tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.xcf create mode 100644 tools/shared/deviceskin/skins/S60-QVGA-Candybar.qrc create mode 100644 tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png create mode 100644 tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png create mode 100644 tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin create mode 100644 tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/defaultbuttons.conf create mode 100644 tools/shared/deviceskin/skins/S60-nHD-Touchscreen.qrc create mode 100644 tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png create mode 100644 tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png create mode 100644 tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin create mode 100644 tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/defaultbuttons.conf create mode 100644 tools/shared/deviceskin/skins/SmartPhone.qrc create mode 100644 tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone-pressed.png create mode 100644 tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.png create mode 100644 tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.skin create mode 100644 tools/shared/deviceskin/skins/SmartPhone.skin/defaultbuttons.conf create mode 100644 tools/shared/deviceskin/skins/SmartPhone2.qrc create mode 100644 tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2-pressed.png create mode 100644 tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.png create mode 100644 tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.skin create mode 100644 tools/shared/deviceskin/skins/SmartPhone2.skin/defaultbuttons.conf create mode 100644 tools/shared/deviceskin/skins/SmartPhoneWithButtons.qrc create mode 100644 tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png create mode 100644 tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png create mode 100644 tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin create mode 100644 tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/defaultbuttons.conf create mode 100644 tools/shared/deviceskin/skins/TouchscreenPhone.qrc create mode 100644 tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone-pressed.png create mode 100644 tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.png create mode 100644 tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.skin create mode 100644 tools/shared/deviceskin/skins/TouchscreenPhone.skin/defaultbuttons.conf create mode 100644 tools/shared/deviceskin/skins/Trolltech-Keypad.qrc create mode 100644 tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png create mode 100644 tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-down.png create mode 100644 tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.png create mode 100644 tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.skin create mode 100644 tools/shared/deviceskin/skins/Trolltech-Keypad.skin/defaultbuttons.conf create mode 100644 tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc create mode 100644 tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png create mode 100644 tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png create mode 100644 tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin create mode 100644 tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/defaultbuttons.conf diff --git a/tools/designer/src/lib/sdk/abstractformeditor.cpp b/tools/designer/src/lib/sdk/abstractformeditor.cpp index e6debd5..09d6976 100644 --- a/tools/designer/src/lib/sdk/abstractformeditor.cpp +++ b/tools/designer/src/lib/sdk/abstractformeditor.cpp @@ -72,7 +72,6 @@ static void initResources() Q_INIT_RESOURCE(shared); Q_INIT_RESOURCE(ClamshellPhone); Q_INIT_RESOURCE(PDAPhone); - Q_INIT_RESOURCE(pda); Q_INIT_RESOURCE(PortableMedia); Q_INIT_RESOURCE(S60_nHD_Touchscreen); Q_INIT_RESOURCE(S60_QVGA_Candybar); diff --git a/tools/designer/src/lib/shared/shared.pri b/tools/designer/src/lib/shared/shared.pri index 0424a41..8ed051a 100644 --- a/tools/designer/src/lib/shared/shared.pri +++ b/tools/designer/src/lib/shared/shared.pri @@ -186,17 +186,4 @@ SOURCES += \ $$PWD/filterwidget.cpp \ $$PWD/plugindialog.cpp -RESOURCES += $$PWD/shared.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/ClamshellPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/PDAPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/pda.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/PortableMedia.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/qvfb.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/S60-nHD-Touchscreen.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/S60-QVGA-Candybar.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/SmartPhone2.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/SmartPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/SmartPhoneWithButtons.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/TouchscreenPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/Trolltech-Keypad.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/Trolltech-Touchscreen.qrc +RESOURCES += $$PWD/shared.qrc diff --git a/tools/qvfb/ClamshellPhone.qrc b/tools/qvfb/ClamshellPhone.qrc deleted file mode 100644 index 39cd422..0000000 --- a/tools/qvfb/ClamshellPhone.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - ClamshellPhone.skin - - diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone.skin b/tools/qvfb/ClamshellPhone.skin/ClamshellPhone.skin deleted file mode 100644 index cb24a8e..0000000 --- a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone.skin +++ /dev/null @@ -1,30 +0,0 @@ -[SkinFile] -Up=ClamshellPhone1-5.png -Down=ClamshellPhone1-5-pressed.png -Closed=ClamshellPhone1-5-closed.png -Screen=72 84 176 208 -Areas=22 -HasMouseHover=false - -"Power" 0x0100000a 205 563 249 586 -"1" 0x0031 62 414 119 438 -"2" 0x0032 130 414 189 438 -"3" 0x0033 198 413 257 438 -"4" 0x0034 54 444 117 470 -"5" 0x0035 128 444 189 471 -"6" 0x0036 202 444 264 471 -"7" 0x0037 47 477 113 507 -"8" 0x0038 126 477 190 507 -"9" 0x0039 205 478 270 509 -"*" 0x002a 39 515 110 552 -"0" 0x0030 122 515 195 553 -"#" 0x0023 207 516 280 553 -"Context1" 0x01100000 137 360 108 383 123 410 90 409 60 387 63 378 100 362 -"Back" 0x01000061 184 361 206 376 213 387 197 410 226 410 256 392 258 381 244 369 -"Backspace" 0x01000003 68 563 113 587 -"Select" 0x01010000 160 391 172 390 181 386 184 381 180 377 173 373 165 372 155 372 145 375 138 378 136 382 138 387 147 390 -"Left" 0x1000012 141 390 136 385 136 381 143 375 132 371 120 380 121 393 129 401 -"Down" 0x1000015 143 389 130 402 162 412 191 404 175 390 -"Right" 0x1000014 186 370 176 375 184 382 182 387 175 390 190 404 201 396 202 375 -"Up" 0x1000013 133 370 143 374 176 374 185 370 169 362 149 362 -"Flip" 0x01100006 98 325 225 353 diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-closed.png b/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-closed.png deleted file mode 100644 index 88ba3a1..0000000 Binary files a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-closed.png and /dev/null differ diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png b/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png deleted file mode 100644 index 971cdef..0000000 Binary files a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png and /dev/null differ diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5.png b/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5.png deleted file mode 100644 index f3550ee..0000000 Binary files a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5.png and /dev/null differ diff --git a/tools/qvfb/ClamshellPhone.skin/defaultbuttons.conf b/tools/qvfb/ClamshellPhone.skin/defaultbuttons.conf deleted file mode 100644 index e349dbc..0000000 --- a/tools/qvfb/ClamshellPhone.skin/defaultbuttons.conf +++ /dev/null @@ -1,78 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/datebook.desktop -3=Applications -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Games -7=Settings/Beaming.desktop -8=Applications/simapp.desktop,Applications/calculator.desktop -9=Settings -*=Applications/mediarecorder.desktop -0=Applications/todolist.desktop -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Select -Key2=Back -Key3=Flip -Key4=Backspace -[TextButtons] -Buttons=0123456789*# -Hold0='0 -Hold1='1 -Hold2='2 -Hold3='3 -Hold4='4 -Hold5='5 -Hold6='6 -Hold7='7 -Hold8='8 -Hold9='9 -Hold*=symbol -Hold#=mode -Tap0=space -Tap1="\".,'?!-@:1" -Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" -Tap3="\"de\xe8\xe9\xea\x66\x33" -Tap4="\"ghi\xec\xed\xee\x34" -Tap5="\"jkl5" -Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" -Tap7="\"pqrs\xdf\x37" -Tap8="\"tu\xfc\xf9\xfav8" -Tap9="\"wxyz9" -Tap*=modify -Tap#=shift -[LocaleTextButtons] -Buttons=23456789 -Tap2[]='abc -Tap3[]='def -Tap4[]='ghi -Tap5[]='jkl -Tap6[]='mno -Tap7[]='pqrs -Tap8[]='tuv -Tap9[]='wxyz -[PhoneTextButtons] -Buttons=*# -Tap*='*+pw -Hold*=+ -Tap#=# -Hold#=mode -[Device] -PrimaryInput=Keypad diff --git a/tools/qvfb/DualScreenPhone.skin/DualScreen-pressed.png b/tools/qvfb/DualScreenPhone.skin/DualScreen-pressed.png deleted file mode 100644 index d62ef4a..0000000 Binary files a/tools/qvfb/DualScreenPhone.skin/DualScreen-pressed.png and /dev/null differ diff --git a/tools/qvfb/DualScreenPhone.skin/DualScreen.png b/tools/qvfb/DualScreenPhone.skin/DualScreen.png deleted file mode 100644 index cb3d1a7..0000000 Binary files a/tools/qvfb/DualScreenPhone.skin/DualScreen.png and /dev/null differ diff --git a/tools/qvfb/DualScreenPhone.skin/DualScreenPhone.skin b/tools/qvfb/DualScreenPhone.skin/DualScreenPhone.skin deleted file mode 100644 index a82ef23..0000000 --- a/tools/qvfb/DualScreenPhone.skin/DualScreenPhone.skin +++ /dev/null @@ -1,29 +0,0 @@ -[SkinFile] -Up=DualScreen.png -Down=DualScreen-pressed.png -Screen=128 155 176 208 -BackScreen=18 44 98 119 -Areas=21 -HasMouseHover=false - -"Context1" 0x1100000 144 368 189 368 168 396 176 427 150 398 -"Back" 0x1000061 245 365 291 366 283 398 258 424 265 394 -"Select" 0x1010000 202 401 210 389 224 388 233 402 224 415 208 415 -"Up" 0x1000013 202 381 196 374 218 363 239 373 229 382 -"Left" 0x1000012 199 385 189 375 176 403 185 426 197 415 194 401 -"Right" 0x1000014 235 390 248 379 253 402 246 421 238 413 -"Down" 0x1000015 204 421 233 422 241 432 214 443 191 430 -"Call" 0x1100004 163 452 137 450 125 465 136 484 159 485 169 467 -"Hangup" 0x1100005 266 475 279 448 295 447 309 460 301 480 289 487 -"1" 0x31 175 514 147 504 133 518 161 532 180 534 -"2" 0x32 199 515 229 519 238 533 222 540 195 538 -"2" 0x32 260 512 286 506 299 513 284 527 264 535 248 525 -"4" 0x34 164 541 177 546 182 560 164 565 146 560 135 545 154 539 -"5" 0x35 204 546 225 546 243 560 231 574 205 573 191 558 -"6" 0x36 257 547 281 537 294 540 287 555 274 566 254 561 -"7" 0x37 145 569 176 578 177 595 156 597 138 584 -"8" 0x38 197 582 229 584 241 593 226 604 201 603 189 594 -"9" 0x39 253 577 288 564 301 578 283 593 259 597 251 586 -"*" 0x2a 145 598 181 611 182 623 163 632 144 623 138 607 -"0" 0x30 196 611 233 613 240 630 220 642 193 637 191 622 -"#" 0x23 255 610 286 600 302 615 279 625 258 629 247 616 diff --git a/tools/qvfb/DualScreenPhone.skin/defaultbuttons.conf b/tools/qvfb/DualScreenPhone.skin/defaultbuttons.conf deleted file mode 100644 index 1103350..0000000 --- a/tools/qvfb/DualScreenPhone.skin/defaultbuttons.conf +++ /dev/null @@ -1,78 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/datebook.desktop -3=Applications -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Games -7=Settings/Beaming.desktop -8=Applications/simapp.desktop,Applications/calculator.desktop -9=Settings -*=Applications/mediarecorder.desktop -0=Applications/todolist.desktop -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Select -Key2=Back -Key3=Call -Key4=Hangup -[TextButtons] -Buttons=0123456789*# -Hold0='0 -Hold1='1 -Hold2='2 -Hold3='3 -Hold4='4 -Hold5='5 -Hold6='6 -Hold7='7 -Hold8='8 -Hold9='9 -Hold*=symbol -Hold#=mode -Tap0=space -Tap1="\".,'?!-@:1" -Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" -Tap3="\"de\xe8\xe9\xea\x66\x33" -Tap4="\"ghi\xec\xed\xee\x34" -Tap5="\"jkl5" -Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" -Tap7="\"pqrs\xdf\x37" -Tap8="\"tu\xfc\xf9\xfav8" -Tap9="\"wxyz9" -Tap*=modify -Tap#=shift -[LocaleTextButtons] -Buttons=23456789 -Tap2[]='abc -Tap3[]='def -Tap4[]='ghi -Tap5[]='jkl -Tap6[]='mno -Tap7[]='pqrs -Tap8[]='tuv -Tap9[]='wxyz -[PhoneTextButtons] -Buttons=*# -Tap*='*+pw -Hold*=+ -Tap#='# -Hold#=mode -[Device] -PrimaryInput=Keypad diff --git a/tools/qvfb/PDAPhone.qrc b/tools/qvfb/PDAPhone.qrc deleted file mode 100644 index 1a1c35a..0000000 --- a/tools/qvfb/PDAPhone.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - PDAPhone.skin - - diff --git a/tools/qvfb/PDAPhone.skin/PDAPhone.skin b/tools/qvfb/PDAPhone.skin/PDAPhone.skin deleted file mode 100644 index d6a1966..0000000 --- a/tools/qvfb/PDAPhone.skin/PDAPhone.skin +++ /dev/null @@ -1,18 +0,0 @@ -[SkinFile] -Up=pda_up.png -Down=pda_down.png -Screen=42 59 176 220 -Cursor=finger.png 20 20 -Areas=10 -HasMouseHover=false - -"Power" 0x0100000a 117 21 141 42 -"Context1" 0x01100000 43 284 74 315 -"Call" 0x01100004 74 284 104 315 -"Hangup" 0x01100005 154 284 184 315 -"Back" 0x01000061 184 284 214 315 -"Left" 0x1000012 123 315 110 326 106 307 113 288 123 300 120 307 -"Down" 0x1000015 123 315 130 318 138 315 150 326 129 335 111 325 -"Right" 0x1000014 137 301 149 290 155 308 150 324 138 315 140 308 -"Up" 0x1000013 123 300 112 289 130 282 149 290 137 300 130 298 -"Select" 0x01010000 131 298 137 300 140 307 138 315 130 318 123 316 120 307 123 300 diff --git a/tools/qvfb/PDAPhone.skin/defaultbuttons.conf b/tools/qvfb/PDAPhone.skin/defaultbuttons.conf deleted file mode 100644 index e3ae813..0000000 --- a/tools/qvfb/PDAPhone.skin/defaultbuttons.conf +++ /dev/null @@ -1,36 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/datebook.desktop -3=Applications -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Games -7=Settings/Beaming.desktop -8=Applications/simapp.desktop,Applications/calculator.desktop -9=Settings -*=Applications/mediarecorder.desktop -0=Applications/todolist.desktop -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Back -Key2=Select -Key3=Call -Key4=Hangup -[Device] -PrimaryInput=Touchscreen diff --git a/tools/qvfb/PDAPhone.skin/finger.png b/tools/qvfb/PDAPhone.skin/finger.png deleted file mode 100644 index 24cf0cb..0000000 Binary files a/tools/qvfb/PDAPhone.skin/finger.png and /dev/null differ diff --git a/tools/qvfb/PDAPhone.skin/pda_down.png b/tools/qvfb/PDAPhone.skin/pda_down.png deleted file mode 100644 index f65c059..0000000 Binary files a/tools/qvfb/PDAPhone.skin/pda_down.png and /dev/null differ diff --git a/tools/qvfb/PDAPhone.skin/pda_up.png b/tools/qvfb/PDAPhone.skin/pda_up.png deleted file mode 100644 index 541e3c4..0000000 Binary files a/tools/qvfb/PDAPhone.skin/pda_up.png and /dev/null differ diff --git a/tools/qvfb/PortableMedia.qrc b/tools/qvfb/PortableMedia.qrc deleted file mode 100644 index a902f1a..0000000 --- a/tools/qvfb/PortableMedia.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - PortableMedia.skin - - diff --git a/tools/qvfb/PortableMedia.skin/PortableMedia.skin b/tools/qvfb/PortableMedia.skin/PortableMedia.skin deleted file mode 100644 index b76e5cf..0000000 --- a/tools/qvfb/PortableMedia.skin/PortableMedia.skin +++ /dev/null @@ -1,14 +0,0 @@ -[SkinFile] -Up=portablemedia.png -Down=portablemedia-pressed.png -Screen=18 20 480 272 -Areas=7 -HasMouseHover=false - -"Context1" 0x01100000 530 192 565 223 -"Back" 0x01000061 530 138 565 173 -"Select" 0x01010000 530 65 565 98 -"Left" 0x1000012 529 67 519 57 511 65 511 104 519 110 529 100 529 98 -"Down" 0x1000015 530 102 520 111 529 120 569 120 577 114 566 103 564 103 -"Right" 0x1000014 565 65 576 52 585 67 585 102 578 113 567 104 -"Up" 0x1000013 530 65 519 55 528 48 567 48 573 51 564 66 diff --git a/tools/qvfb/PortableMedia.skin/defaultbuttons.conf b/tools/qvfb/PortableMedia.skin/defaultbuttons.conf deleted file mode 100644 index 514e881..0000000 --- a/tools/qvfb/PortableMedia.skin/defaultbuttons.conf +++ /dev/null @@ -1,23 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Map=123 -Default=1 -1=Applications/mediaplayer.desktop -2=Applications/photoedit.desktop -3=Settings -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Select -Key2=Back -[Device] -PrimaryInput=Keypad diff --git a/tools/qvfb/PortableMedia.skin/portablemedia-pressed.png b/tools/qvfb/PortableMedia.skin/portablemedia-pressed.png deleted file mode 100644 index 730e762..0000000 Binary files a/tools/qvfb/PortableMedia.skin/portablemedia-pressed.png and /dev/null differ diff --git a/tools/qvfb/PortableMedia.skin/portablemedia.png b/tools/qvfb/PortableMedia.skin/portablemedia.png deleted file mode 100644 index e44cbe1..0000000 Binary files a/tools/qvfb/PortableMedia.skin/portablemedia.png and /dev/null differ diff --git a/tools/qvfb/PortableMedia.skin/portablemedia.xcf b/tools/qvfb/PortableMedia.skin/portablemedia.xcf deleted file mode 100644 index 127e07c..0000000 Binary files a/tools/qvfb/PortableMedia.skin/portablemedia.xcf and /dev/null differ diff --git a/tools/qvfb/S60-QVGA-Candybar.qrc b/tools/qvfb/S60-QVGA-Candybar.qrc deleted file mode 100644 index 8138484..0000000 --- a/tools/qvfb/S60-QVGA-Candybar.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - S60-QVGA-Candybar.skin - - diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png b/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png deleted file mode 100644 index 89d40cb..0000000 Binary files a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png and /dev/null differ diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png b/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png deleted file mode 100644 index 0d0e598..0000000 Binary files a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png and /dev/null differ diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin b/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin deleted file mode 100644 index 4f8fe5d..0000000 --- a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin +++ /dev/null @@ -1,15 +0,0 @@ -[SkinFile] -Up=S60-QVGA-Candybar.png -Down=S60-QVGA-Candybar-down.png -Screen=61 93 240 320 -Areas=7 -HasMouseHover=false - - -"Context1" 0x01100000 54 469 151 469 140 483 88 485 81 496 54 498 -"Back" 0x01000061 211 468 307 467 307 498 278 497 219 486 -"Select" 0x01010000 165 491 196 522 -"Left" 0x1000012 149 474 166 492 163 519 143 538 142 481 -"Down" 0x1000015 164 521 195 522 212 539 204 545 154 544 145 536 -"Right" 0x1000014 214 475 219 487 219 528 212 539 196 522 197 492 -"Up" 0x1000013 150 474 156 467 209 467 213 476 197 489 165 489 diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/defaultbuttons.conf b/tools/qvfb/S60-QVGA-Candybar.skin/defaultbuttons.conf deleted file mode 100644 index e349dbc..0000000 --- a/tools/qvfb/S60-QVGA-Candybar.skin/defaultbuttons.conf +++ /dev/null @@ -1,78 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/datebook.desktop -3=Applications -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Games -7=Settings/Beaming.desktop -8=Applications/simapp.desktop,Applications/calculator.desktop -9=Settings -*=Applications/mediarecorder.desktop -0=Applications/todolist.desktop -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Select -Key2=Back -Key3=Flip -Key4=Backspace -[TextButtons] -Buttons=0123456789*# -Hold0='0 -Hold1='1 -Hold2='2 -Hold3='3 -Hold4='4 -Hold5='5 -Hold6='6 -Hold7='7 -Hold8='8 -Hold9='9 -Hold*=symbol -Hold#=mode -Tap0=space -Tap1="\".,'?!-@:1" -Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" -Tap3="\"de\xe8\xe9\xea\x66\x33" -Tap4="\"ghi\xec\xed\xee\x34" -Tap5="\"jkl5" -Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" -Tap7="\"pqrs\xdf\x37" -Tap8="\"tu\xfc\xf9\xfav8" -Tap9="\"wxyz9" -Tap*=modify -Tap#=shift -[LocaleTextButtons] -Buttons=23456789 -Tap2[]='abc -Tap3[]='def -Tap4[]='ghi -Tap5[]='jkl -Tap6[]='mno -Tap7[]='pqrs -Tap8[]='tuv -Tap9[]='wxyz -[PhoneTextButtons] -Buttons=*# -Tap*='*+pw -Hold*=+ -Tap#=# -Hold#=mode -[Device] -PrimaryInput=Keypad diff --git a/tools/qvfb/S60-nHD-Touchscreen.qrc b/tools/qvfb/S60-nHD-Touchscreen.qrc deleted file mode 100644 index daf0cc3..0000000 --- a/tools/qvfb/S60-nHD-Touchscreen.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - S60-nHD-Touchscreen.skin - - diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png b/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png deleted file mode 100644 index 7253e38..0000000 Binary files a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png and /dev/null differ diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png b/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png deleted file mode 100644 index 675563e..0000000 Binary files a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png and /dev/null differ diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin b/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin deleted file mode 100644 index ed25d0e..0000000 --- a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin +++ /dev/null @@ -1,10 +0,0 @@ -[SkinFile] -Up=S60-nHD-Touchscreen.png -Down=S60-nHD-Touchscreen-down.png -Screen=53 183 360 640 -Areas=3 -HasMouseHover=false - -"Call" 0x01100004 76 874 171 899 -"Hangup" 0x01100005 300 876 393 899 -"Home" 0x1000010 174 878 298 899 diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/defaultbuttons.conf b/tools/qvfb/S60-nHD-Touchscreen.skin/defaultbuttons.conf deleted file mode 100644 index 6665125..0000000 --- a/tools/qvfb/S60-nHD-Touchscreen.skin/defaultbuttons.conf +++ /dev/null @@ -1,53 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/mediaplayer.desktop -3=Applications/simapp.desktop,Applications/calculator.desktop -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Applications/datebook.desktop -7=Games -8=Settings/beaming.desktop -9=Applications/todolist.desktop -*=Settings -0=Applications -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Back -Key2=Select -Key3=Call -Key4=Hangup -[Device] -PrimaryInput=Touchscreen -[Button] -Count=2 -[Button0] -Name[]=Home Button -Key=Home -PressedActionMappable=0 -PressedActionService=TaskManager -PressedActionMessage=multitask() -HeldActionMappable=0 -HeldActionService=TaskManager -HeldActionMessage=showRunningTasks() -[Button1] -Name=Power Button -Key=Hangup -HeldActionService=Launcher -HeldActionMessage=execute(QString) -HeldActionArgs=@ByteArray(\0\0\0\x1\0\0\0\n\0\0\0\0\x10\0s\0h\0u\0t\0\x64\0o\0w\0n) diff --git a/tools/qvfb/SmartPhone.qrc b/tools/qvfb/SmartPhone.qrc deleted file mode 100644 index 8bb5325..0000000 --- a/tools/qvfb/SmartPhone.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - SmartPhone.skin - - diff --git a/tools/qvfb/SmartPhone.skin/SmartPhone-pressed.png b/tools/qvfb/SmartPhone.skin/SmartPhone-pressed.png deleted file mode 100644 index d0db2ed..0000000 Binary files a/tools/qvfb/SmartPhone.skin/SmartPhone-pressed.png and /dev/null differ diff --git a/tools/qvfb/SmartPhone.skin/SmartPhone.png b/tools/qvfb/SmartPhone.skin/SmartPhone.png deleted file mode 100644 index e6ac5a0..0000000 Binary files a/tools/qvfb/SmartPhone.skin/SmartPhone.png and /dev/null differ diff --git a/tools/qvfb/SmartPhone.skin/SmartPhone.skin b/tools/qvfb/SmartPhone.skin/SmartPhone.skin deleted file mode 100644 index 2f44c5a..0000000 --- a/tools/qvfb/SmartPhone.skin/SmartPhone.skin +++ /dev/null @@ -1,28 +0,0 @@ -[SkinFile] -Up=SmartPhone.png -Down=SmartPhone-pressed.png -Screen=90 107 176 208 -Areas=21 -HasMouseHover=false - -"1" 0x0031 138 459 149 473 142 483 120 484 102 477 95 464 99 457 121 454 -"2" 0x0032 153 467 202 492 -"3" 0x0033 258 457 260 470 243 483 215 484 207 474 218 460 248 453 -"4" 0x0034 138 492 149 506 142 516 120 517 102 510 95 497 99 490 121 487 -"5" 0x0035 153 499 202 524 -"6" 0x0036 258 489 260 502 243 515 215 516 207 506 218 492 248 485 -"7" 0x0037 138 524 149 538 142 548 120 549 102 542 95 529 99 522 121 519 -"8" 0x0038 153 531 202 556 -"9" 0x0039 258 521 260 534 243 547 215 548 207 538 218 524 248 517 -"*" 0x002a 138 556 149 570 142 580 120 581 102 574 95 561 99 554 121 551 -"0" 0x0030 153 564 202 589 -"#" 0x0023 258 554 260 567 243 580 215 581 207 571 218 557 248 550 -"Call" 0x01100004 88 395 130 439 -"Hangup" 0x01100005 227 395 269 439 -"Context1" 0x01100000 145 321 134 333 132 361 134 374 110 343 109 318 -"Back" 0x01000061 249 322 240 354 219 373 223 344 216 325 208 318 -"Select" 0x01010000 160 338 195 371 -"Left" 0x1000012 159 338 149 328 141 336 141 373 149 381 159 371 159 369 -"Down" 0x1000015 160 373 150 382 159 391 199 391 207 385 196 374 194 374 -"Right" 0x1000014 195 336 206 323 215 338 215 373 208 384 197 375 -"Up" 0x1000013 160 336 149 326 158 319 197 319 203 322 194 337 diff --git a/tools/qvfb/SmartPhone.skin/defaultbuttons.conf b/tools/qvfb/SmartPhone.skin/defaultbuttons.conf deleted file mode 100644 index 1103350..0000000 --- a/tools/qvfb/SmartPhone.skin/defaultbuttons.conf +++ /dev/null @@ -1,78 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/datebook.desktop -3=Applications -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Games -7=Settings/Beaming.desktop -8=Applications/simapp.desktop,Applications/calculator.desktop -9=Settings -*=Applications/mediarecorder.desktop -0=Applications/todolist.desktop -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Select -Key2=Back -Key3=Call -Key4=Hangup -[TextButtons] -Buttons=0123456789*# -Hold0='0 -Hold1='1 -Hold2='2 -Hold3='3 -Hold4='4 -Hold5='5 -Hold6='6 -Hold7='7 -Hold8='8 -Hold9='9 -Hold*=symbol -Hold#=mode -Tap0=space -Tap1="\".,'?!-@:1" -Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" -Tap3="\"de\xe8\xe9\xea\x66\x33" -Tap4="\"ghi\xec\xed\xee\x34" -Tap5="\"jkl5" -Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" -Tap7="\"pqrs\xdf\x37" -Tap8="\"tu\xfc\xf9\xfav8" -Tap9="\"wxyz9" -Tap*=modify -Tap#=shift -[LocaleTextButtons] -Buttons=23456789 -Tap2[]='abc -Tap3[]='def -Tap4[]='ghi -Tap5[]='jkl -Tap6[]='mno -Tap7[]='pqrs -Tap8[]='tuv -Tap9[]='wxyz -[PhoneTextButtons] -Buttons=*# -Tap*='*+pw -Hold*=+ -Tap#='# -Hold#=mode -[Device] -PrimaryInput=Keypad diff --git a/tools/qvfb/SmartPhone2.qrc b/tools/qvfb/SmartPhone2.qrc deleted file mode 100644 index 751e985..0000000 --- a/tools/qvfb/SmartPhone2.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - SmartPhone2.skin - - diff --git a/tools/qvfb/SmartPhone2.skin/SmartPhone2-pressed.png b/tools/qvfb/SmartPhone2.skin/SmartPhone2-pressed.png deleted file mode 100644 index d4eb5b0..0000000 Binary files a/tools/qvfb/SmartPhone2.skin/SmartPhone2-pressed.png and /dev/null differ diff --git a/tools/qvfb/SmartPhone2.skin/SmartPhone2.png b/tools/qvfb/SmartPhone2.skin/SmartPhone2.png deleted file mode 100644 index 48ccc1c..0000000 Binary files a/tools/qvfb/SmartPhone2.skin/SmartPhone2.png and /dev/null differ diff --git a/tools/qvfb/SmartPhone2.skin/SmartPhone2.skin b/tools/qvfb/SmartPhone2.skin/SmartPhone2.skin deleted file mode 100644 index 16884bf..0000000 --- a/tools/qvfb/SmartPhone2.skin/SmartPhone2.skin +++ /dev/null @@ -1,25 +0,0 @@ -SmartPhone2.png SmartPhone2-pressed.png -90 107 -176 220 -21 -"Menu" 0x01100000 70 400 115 427 -"Backspace" 0x01000003 238 400 285 427 -"1" 0x0031 138 437 149 451 142 461 120 462 102 455 95 442 99 435 121 432 -"2" 0x0032 153 445 202 470 -"3" 0x0033 258 435 260 448 243 461 215 462 207 452 218 438 248 431 -"4" 0x0034 138 470 149 484 142 494 120 495 102 488 95 475 99 468 121 465 -"5" 0x0035 153 477 202 502 -"6" 0x0036 258 467 260 480 243 493 215 494 207 484 218 470 248 463 -"7" 0x0037 138 502 149 516 142 526 120 527 102 520 95 507 99 500 121 497 -"8" 0x0038 153 509 202 534 -"9" 0x0039 258 499 260 512 243 525 215 526 207 516 218 502 248 495 -"*" 0x002a 138 534 149 548 142 558 120 559 102 552 95 539 99 532 121 529 -"0" 0x0030 153 542 202 567 -"#" 0x0023 258 532 260 545 243 558 215 559 207 549 218 535 248 528 -"Yes" 0x01010001 91 343 141 393 -"No" 0x01010002 219 343 269 393 -"Select" 0x01010000 160 356 195 389 -"Left" 0x1000012 159 356 149 346 141 354 141 391 149 399 159 389 159 387 -"Down" 0x1000015 160 391 150 400 159 409 199 409 207 403 196 392 194 392 -"Right" 0x1000014 195 354 206 341 215 356 215 391 208 402 197 393 -"Up" 0x1000013 160 354 149 344 158 337 197 337 203 340 194 355 diff --git a/tools/qvfb/SmartPhone2.skin/defaultbuttons.conf b/tools/qvfb/SmartPhone2.skin/defaultbuttons.conf deleted file mode 100644 index b083203..0000000 --- a/tools/qvfb/SmartPhone2.skin/defaultbuttons.conf +++ /dev/null @@ -1,52 +0,0 @@ -[Button] -[IMethod] -key_count = 5 -key_hold_action_1 = insertText -key_hold_action_2 = insertText -key_hold_action_3 = insertSymbol -key_hold_action_4 = changeMode -key_hold_arg_1 = 1 -key_hold_arg_2 = 0 -key_id_1 = 1 -key_id_2 = 0 -key_id_3 = * -key_id_4 = # -key_id_5 = * -key_mode_1 = Abc -key_mode_2 = Abc -key_mode_3 = Abc -key_mode_4 = Abc -key_mode_5 = Phone -key_tap_action_1 = insertText -key_tap_action_2 = insertSpace -key_tap_action_3 = modifyText -key_tap_action_4 = changeShift -key_tap_action_5 = insertText -key_tap_arg_1 = .,'?!-@:〓 -key_tap_arg_5 = *+pw -[Menu] -1 = Applications/camera.desktop -2 = Applications/datebook.desktop -3 = Games -4 = Applications/qtmail.desktop -5 = Applications/addressbook.desktop -6 = Settings -7 = Settings/Beaming.desktop -8 = Applications -9 = Documents -Columns = 3 -Default = 5 -Map = 123456789 -Rows = 3 -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -[SystemButtons] -Count=5 -Key0=Yes -Key1=Select -Key2=No -Key3=Menu -Key4=Backspace -[Device] -PrimaryInput=Keypad diff --git a/tools/qvfb/SmartPhoneWithButtons.qrc b/tools/qvfb/SmartPhoneWithButtons.qrc deleted file mode 100644 index f3393ba..0000000 --- a/tools/qvfb/SmartPhoneWithButtons.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - SmartPhoneWithButtons.skin - - diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png b/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png deleted file mode 100644 index 456a068..0000000 Binary files a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png and /dev/null differ diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png b/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png deleted file mode 100644 index 5ffbd6e..0000000 Binary files a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png and /dev/null differ diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin b/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin deleted file mode 100644 index 9afa67f..0000000 --- a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin +++ /dev/null @@ -1,31 +0,0 @@ -[SkinFile] -Up=SmartPhoneWithButtons.png -Down=SmartPhoneWithButtons-pressed.png -Screen=90 107 176 208 -Areas=24 -HasMouseHover=false - -"1" 0x0031 138 459 149 473 142 483 120 484 102 477 95 464 99 457 121 454 -"2" 0x0032 153 467 202 492 -"3" 0x0033 258 457 260 470 243 483 215 484 207 474 218 460 248 453 -"4" 0x0034 138 492 149 506 142 516 120 517 102 510 95 497 99 490 121 487 -"5" 0x0035 153 499 202 524 -"6" 0x0036 258 489 260 502 243 515 215 516 207 506 218 492 248 485 -"7" 0x0037 138 524 149 538 142 548 120 549 102 542 95 529 99 522 121 519 -"8" 0x0038 153 531 202 556 -"9" 0x0039 258 521 260 534 243 547 215 548 207 538 218 524 248 517 -"*" 0x002a 138 556 149 570 142 580 120 581 102 574 95 561 99 554 121 551 -"0" 0x0030 153 564 202 589 -"#" 0x0023 258 554 260 567 243 580 215 581 207 571 218 557 248 550 -"Call" 0x01100004 88 395 130 439 -"Hangup" 0x01100005 227 395 269 439 -"Context1" 0x01100000 145 321 134 333 132 361 134 374 110 343 109 318 -"Back" 0x01000061 249 322 240 354 219 373 223 344 216 325 208 318 -"Select" 0x01010000 160 338 195 371 -"Left" 0x1000012 159 338 149 328 141 336 141 373 149 381 159 371 159 369 -"Down" 0x1000015 160 373 150 382 159 391 199 391 207 385 196 374 194 374 -"Right" 0x1000014 195 336 206 323 215 338 215 373 208 384 197 375 -"Up" 0x1000013 160 336 149 326 158 319 197 319 203 322 194 337 -"Home" 0x1000010 164 402 195 434 -"F1" 0x1000030 138 422 163 448 -"F2" 0x1000031 196 422 220 448 diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/defaultbuttons.conf b/tools/qvfb/SmartPhoneWithButtons.skin/defaultbuttons.conf deleted file mode 100644 index ebd6926..0000000 --- a/tools/qvfb/SmartPhoneWithButtons.skin/defaultbuttons.conf +++ /dev/null @@ -1,103 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Button] -Count=3 -[Button0] -Name[]=Calendar Button -Key=F1 -PressedActionService=Calendar -PressedActionMessage=raiseToday() -HeldActionService=Calendar -HeldActionMessage=newEvent() -[Button1] -Name[]=Tasks Button -Key=F2 -PressedActionService=Tasks -PressedActionMessage=raise() -HeldActionService=Tasks -HeldActionMessage=newTask() -[Button2] -Name[]=Home Button -Key=Home -PressedActionMappable=0 -PressedActionService=TaskManager -PressedActionMessage=multitask() -HeldActionMappable=0 -HeldActionService=TaskManager -HeldActionMessage=showRunningTasks() -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/datebook.desktop -3=Applications -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Games -7=Settings/Beaming.desktop -8=Applications/simapp.desktop,Applications/calculator.desktop -9=Settings -*=Applications/mediarecorder.desktop -0=Applications/todolist.desktop -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Select -Key2=Back -Key3=Call -Key4=Hangup -[TextButtons] -Buttons=0123456789*# -Hold0='0 -Hold1='1 -Hold2='2 -Hold3='3 -Hold4='4 -Hold5='5 -Hold6='6 -Hold7='7 -Hold8='8 -Hold9='9 -Hold*=symbol -Hold#=mode -Tap0=space -Tap1="\".,'?!-@:1" -Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" -Tap3="\"de\xe8\xe9\xea\x66\x33" -Tap4="\"ghi\xec\xed\xee\x34" -Tap5="\"jkl5" -Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" -Tap7="\"pqrs\xdf\x37" -Tap8="\"tu\xfc\xf9\xfav8" -Tap9="\"wxyz9" -Tap*=modify -Tap#=shift -[LocaleTextButtons] -Buttons=23456789 -Tap2[]='abc -Tap3[]='def -Tap4[]='ghi -Tap5[]='jkl -Tap6[]='mno -Tap7[]='pqrs -Tap8[]='tuv -Tap9[]='wxyz -[PhoneTextButtons] -Buttons=*# -Tap*='*+pw -Hold*=+ -Tap#='# -Hold#=mode -[Device] -PrimaryInput=Keypad diff --git a/tools/qvfb/TouchscreenPhone.qrc b/tools/qvfb/TouchscreenPhone.qrc deleted file mode 100644 index 023144d..0000000 --- a/tools/qvfb/TouchscreenPhone.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - TouchscreenPhone.skin - - diff --git a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone-pressed.png b/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone-pressed.png deleted file mode 100644 index 01acb86..0000000 Binary files a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone-pressed.png and /dev/null differ diff --git a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.png b/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.png deleted file mode 100644 index e90de0d..0000000 Binary files a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.png and /dev/null differ diff --git a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.skin b/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.skin deleted file mode 100644 index 24316a1..0000000 --- a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.skin +++ /dev/null @@ -1,16 +0,0 @@ -[SkinFile] -Up=TouchscreenPhone.png -Down=TouchscreenPhone-pressed.png -Screen=90 107 176 208 -Areas=9 -HasMouseHover=false - -"Context1" 0x01100000 145 321 134 333 132 361 134 374 110 343 109 318 -"Call" 0x01100004 88 395 130 439 -"Hangup" 0x01100005 227 395 269 439 -"Back" 0x01000061 249 322 240 354 219 373 223 344 216 325 208 318 -"Left" 0x1000012 159 338 149 328 141 336 141 373 149 381 159 371 159 369 -"Down" 0x1000015 160 373 150 382 159 391 199 391 207 385 196 374 194 374 -"Right" 0x1000014 195 336 206 323 215 338 215 373 208 384 197 375 -"Up" 0x1000013 160 336 149 326 158 319 197 319 203 322 194 337 -"Select" 0x01010000 160 338 195 371 diff --git a/tools/qvfb/TouchscreenPhone.skin/defaultbuttons.conf b/tools/qvfb/TouchscreenPhone.skin/defaultbuttons.conf deleted file mode 100644 index a13dfdc..0000000 --- a/tools/qvfb/TouchscreenPhone.skin/defaultbuttons.conf +++ /dev/null @@ -1,45 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/datebook.desktop -3=Applications -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Games -7=Settings/Beaming.desktop -8=Applications/simapp.desktop,Applications/calculator.desktop -9=Settings -*=Applications/mediarecorder.desktop -0=Applications/todolist.desktop -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Back -Key2=Select -Key3=Call -Key4=Hangup -[Button] -Count=1 -[Button0] -Name=Power Button -Key=Hangup -HeldActionService=Launcher -HeldActionMessage=execute(QString) -HeldActionArgs=@ByteArray(\0\0\0\x1\0\0\0\n\0\0\0\0\x10\0s\0h\0u\0t\0\x64\0o\0w\0n) -[Device] -PrimaryInput=Touchscreen - diff --git a/tools/qvfb/Trolltech-Keypad.qrc b/tools/qvfb/Trolltech-Keypad.qrc deleted file mode 100644 index 4775068..0000000 --- a/tools/qvfb/Trolltech-Keypad.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - Trolltech-Keypad.skin - - diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png b/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png deleted file mode 100644 index 8dd5719..0000000 Binary files a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png and /dev/null differ diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-down.png b/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-down.png deleted file mode 100644 index 5e1e6be..0000000 Binary files a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-down.png and /dev/null differ diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.png b/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.png deleted file mode 100644 index fb3d549..0000000 Binary files a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.png and /dev/null differ diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.skin b/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.skin deleted file mode 100644 index 4d90321..0000000 --- a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.skin +++ /dev/null @@ -1,35 +0,0 @@ -[SkinFile] -Up=Trolltech-Keypad.png -Down=Trolltech-Keypad-down.png -Closed=Trolltech-Keypad-closed.png -ClosedAreas=F1 F2 F3 Flip -ClosedScreen=95 456 128 96 -Screen=75 85 176 220 -Areas=25 -HasMouseHover=false -"1" 0x0031 65 542 68 536 76 532 114 536 114 573 64 568 -"2" 0x0032 133 537 188 574 -"3" 0x0033 206 536 246 532 252 536 256 542 258 569 205 572 -"4" 0x0034 64 578 114 618 -"5" 0x0035 133 581 188 618 -"6" 0x0036 206 580 256 577 258 613 206 616 -"7" 0x0037 66 622 116 625 114 662 66 658 -"8" 0x0038 133 626 188 662 -"9" 0x0039 206 625 256 622 256 658 206 661 -"*" 0x002a 68 667 116 670 114 705 86 699 76 693 69 686 -"0" 0x0030 133 671 188 708 -"#" 0x0023 206 670 254 665 254 684 245 692 232 699 206 704 -"Context1" 0x01100000 69 420 75 410 85 404 101 404 102 458 69 458 -"Back" 0x01000061 218 404 234 404 240 408 248 418 248 456 218 457 -"Home" 0x1000010 140 494 180 514 -"Hangup" 0x01100005 218 457 248 456 248 496 243 507 230 514 194 514 194 494 206 492 213 486 218 478 -"Call" 0x01100004 68 458 102 460 102 479 108 487 118 492 126 494 126 514 86 514 77 507 72 496 -"Select" 0x01010000 138 426 182 458 -"Up" 0x1000013 118 406 201 402 184 423 134 422 -"Right" 0x1000014 184 424 201 402 202 476 184 460 -"Down" 0x1000015 135 462 184 461 199 477 118 477 -"Left" 0x1000012 118 406 134 424 134 461 117 476 -"F1" 0x1000030 0 408 45 456 -"F2" 0x1000031 0 456 45 509 -"F3" 0x1000032 0 545 45 582 -"Flip" 0x1100006 32 353 293 386 diff --git a/tools/qvfb/Trolltech-Keypad.skin/defaultbuttons.conf b/tools/qvfb/Trolltech-Keypad.skin/defaultbuttons.conf deleted file mode 100644 index 6a78e67..0000000 --- a/tools/qvfb/Trolltech-Keypad.skin/defaultbuttons.conf +++ /dev/null @@ -1,142 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Button] -Count=8 -[Button7] -Name[]=Home Down Button -Key=Down -Context=HomeScreen -PressedActionMappable=0 -HeldActionService=Messaging -HeldActionMessage=raise() -[Button6] -Name[]=Home Up Button -Key=Up -Context=HomeScreen -PressedActionMappable=0 -HeldActionService=Contacts -HeldActionMessage=raise() -[Button5] -Name[]=Home Right Button -Key=Right -Context=HomeScreen -PressedActionMappable=0 -HeldActionService=mediaplayer -HeldActionMessage=raise() -[Button4] -Name[]=Calender Button -Key=Left -Context=HomeScreen -PressedActionMappable=0 -HeldActionService=Calendar -HeldActionMessage=raiseToday() -[Button3] -Name[]=Left Soft Key -Key=Context1 -HeldActionService=TaskManager -HeldActionMessage=showRunningTasks() -HeldActionMappable=0 -PressActionMappable=0 -[Button2] -Name[]=VoiceNotes Button -Key=F1 -PressedActionService=mediarecorder -PressedActionMessage=raise() -HeldActionService=mediarecorder -HeldActionMessage=newEvent() -[Button1] -Name[]=Camera Button -Key=F2 -PressedActionService=Camera -PressedActionMessage=raise() -HeldActionService=Tasks -HeldActionMessage=newTask() -[Button0] -Name[]=Home Button -Key=Home -PressedActionMappable=0 -PressedActionService=TaskManager -PressedActionMessage=multitask() -HeldActionMappable=0 -HeldActionService=TaskManager -HeldActionMessage=showRunningTasks() -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/mediaplayer.desktop -3=Applications/simapp.desktop,Applications/calculator.desktop -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Applications/datebook.desktop -7=Games -8=Settings/Beaming.desktop -9=Applications/todolist.desktop -*=Settings -0=Applications -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=6 -Key0=Context1 -Key1=Select -Key2=Back -Key3=Call -Key4=Hangup -Key5=Flip -[TextButtons] -Buttons=0123456789*# -Hold0='0 -Hold1='1 -Hold2='2 -Hold3='3 -Hold4='4 -Hold5='5 -Hold6='6 -Hold7='7 -Hold8='8 -Hold9='9 -Hold*=symbol -Hold#=mode -Tap0=space -Tap0=space -Tap1="\".,'?!-@:1" -Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" -Tap3="\"de\xe8\xe9\xea\x66\x33" -Tap4="\"ghi\xec\xed\xee\x34" -Tap5="\"jkl5" -Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" -Tap7="\"pqrs\xdf\x37" -Tap8="\"tu\xfc\xf9\xfav8" -Tap9="\"wxyz9" -Tap*=modify -Tap#=shift -[LocaleTextButtons] -Buttons=23456789 -Tap2[]='abc -Tap3[]='def -Tap4[]='ghi -Tap5[]='jkl -Tap6[]='mno -Tap7[]='pqrs -Tap8[]='tuv -Tap9[]='wxyz -[PhoneTextButtons] -Buttons=*# -Tap*='*+pw -Hold*=+ -Tap#='# -Hold#=mode -[Device] -PrimaryInput=Keypad -[Environment] -QWS_DISPLAY=Multi: LinuxFb:mmHeight57:0 LinuxFb:offset=0,320:1 :0 diff --git a/tools/qvfb/Trolltech-Touchscreen.qrc b/tools/qvfb/Trolltech-Touchscreen.qrc deleted file mode 100644 index 40fafeb..0000000 --- a/tools/qvfb/Trolltech-Touchscreen.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - Trolltech-Touchscreen.skin - - diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png b/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png deleted file mode 100644 index c1a422f..0000000 Binary files a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png and /dev/null differ diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png b/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png deleted file mode 100644 index 544a425..0000000 Binary files a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png and /dev/null differ diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin b/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin deleted file mode 100644 index 5de882e..0000000 --- a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin +++ /dev/null @@ -1,17 +0,0 @@ -[SkinFile] -Up=Trolltech-Touchscreen.png -Down=Trolltech-Touchscreen-down.png -Screen=40 109 176 220 -Areas=10 -HasMouseHover=false - -"Context1" 0x01100000 38 420 44 408 52 404 68 403 68 458 40 458 -"Back" 0x01000061 185 42 202 398 211 410 216 418 219 456 186 456 -"Call" 0x01100004 38 458 70 458 71 478 75 486 83 492 94 494 94 516 56 516 45 507 38 498 -"Hangup" 0x01100005 186 458 220 458 220 496 214 508 200 516 162 516 161 494 172 492 180 486 185 478 -"Left" 0x1000012 86 405 106 426 106 461 85 478 -"Down" 0x1000015 106 460 151 460 170 480 85 480 -"Right" 0x1000014 151 424 170 404 170 480 151 460 -"Up" 0x1000013 85 403 168 403 150 424 106 424 -"Select" 0x01010000 106 426 150 456 -"Home" 0x1000010 105 493 145 512 diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/defaultbuttons.conf b/tools/qvfb/Trolltech-Touchscreen.skin/defaultbuttons.conf deleted file mode 100644 index 6665125..0000000 --- a/tools/qvfb/Trolltech-Touchscreen.skin/defaultbuttons.conf +++ /dev/null @@ -1,53 +0,0 @@ -[Translation] -File=QtopiaDefaults -Context=Buttons -[Menu] -Rows=4 -Columns=3 -Map=123456789*0# -Default=5 -1=Applications/camera.desktop -2=Applications/mediaplayer.desktop -3=Applications/simapp.desktop,Applications/calculator.desktop -4=Applications/qtmail.desktop -5=Applications/addressbook.desktop -6=Applications/datebook.desktop -7=Games -8=Settings/beaming.desktop -9=Applications/todolist.desktop -*=Settings -0=Applications -#=Documents -Animator=Bounce -AnimatorBackground=Radial -[SoftKeys] -Count=3 -Key0=Context1 -Key1=Select -Key2=Back -[SystemButtons] -Count=5 -Key0=Context1 -Key1=Back -Key2=Select -Key3=Call -Key4=Hangup -[Device] -PrimaryInput=Touchscreen -[Button] -Count=2 -[Button0] -Name[]=Home Button -Key=Home -PressedActionMappable=0 -PressedActionService=TaskManager -PressedActionMessage=multitask() -HeldActionMappable=0 -HeldActionService=TaskManager -HeldActionMessage=showRunningTasks() -[Button1] -Name=Power Button -Key=Hangup -HeldActionService=Launcher -HeldActionMessage=execute(QString) -HeldActionArgs=@ByteArray(\0\0\0\x1\0\0\0\n\0\0\0\0\x10\0s\0h\0u\0t\0\x64\0o\0w\0n) diff --git a/tools/qvfb/pda.qrc b/tools/qvfb/pda.qrc deleted file mode 100644 index b14e7b3..0000000 --- a/tools/qvfb/pda.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - pda.skin - - diff --git a/tools/qvfb/pda.skin b/tools/qvfb/pda.skin deleted file mode 100644 index 037f750..0000000 --- a/tools/qvfb/pda.skin +++ /dev/null @@ -1,14 +0,0 @@ -pda_up.png pda_down.png -57 81 -240 320 -11 -"Power" 0x0100000a 277 36 302 57 -"F1" 0x01000030 52 439 81 470 -"F2" 0x01000031 101 422 130 451 -"F3" 0x01000032 232 423 260 452 -"F4" 0x01000033 279 445 309 473 -"Left" 0x01000012 155 438 176 472 -"Down" 0x01000015 169 471 203 486 -"Right" 0x01000014 193 448 215 472 -"Up" 0x01000013 166 427 199 451 -"Enter" 0x01000005 177 448 193 468 diff --git a/tools/qvfb/pda_down.png b/tools/qvfb/pda_down.png deleted file mode 100644 index 0ea157d..0000000 Binary files a/tools/qvfb/pda_down.png and /dev/null differ diff --git a/tools/qvfb/pda_up.png b/tools/qvfb/pda_up.png deleted file mode 100644 index 541e3c4..0000000 Binary files a/tools/qvfb/pda_up.png and /dev/null differ diff --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro index 85c4d96..247337a 100644 --- a/tools/qvfb/qvfb.pro +++ b/tools/qvfb/qvfb.pro @@ -60,15 +60,4 @@ unix:x11 { LIBS += -lXtst } -RESOURCES += qvfb.qrc \ - ClamshellPhone.qrc \ - PDAPhone.qrc \ - SmartPhone2.qrc \ - SmartPhone.qrc \ - SmartPhoneWithButtons.qrc \ - TouchscreenPhone.qrc \ - Trolltech-Keypad.qrc \ - Trolltech-Touchscreen.qrc \ - PortableMedia.qrc \ - S60-QVGA-Candybar.qrc \ - S60-nHD-Touchscreen.qrc +RESOURCES += qvfb.qrc diff --git a/tools/shared/deviceskin/deviceskin.pri b/tools/shared/deviceskin/deviceskin.pri index e4c9ef7..2552c92 100644 --- a/tools/shared/deviceskin/deviceskin.pri +++ b/tools/shared/deviceskin/deviceskin.pri @@ -1,3 +1,15 @@ INCLUDEPATH += $$PWD HEADERS += $$PWD/deviceskin.h SOURCES += $$PWD/deviceskin.cpp +RESOURCES += $$PWD/skins/ClamshellPhone.qrc \ + $$PWD/skins/PDAPhone.qrc \ + $$PWD/skins/SmartPhone2.qrc \ + $$PWD/skins/SmartPhone.qrc \ + $$PWD/skins/SmartPhoneWithButtons.qrc \ + $$PWD/skins/TouchscreenPhone.qrc \ + $$PWD/skins/Trolltech-Keypad.qrc \ + $$PWD/skins/Trolltech-Touchscreen.qrc \ + $$PWD/skins/PortableMedia.qrc \ + $$PWD/skins/S60-QVGA-Candybar.qrc \ + $$PWD/skins/S60-nHD-Touchscreen.qrc + diff --git a/tools/shared/deviceskin/skins/ClamshellPhone.qrc b/tools/shared/deviceskin/skins/ClamshellPhone.qrc new file mode 100644 index 0000000..39cd422 --- /dev/null +++ b/tools/shared/deviceskin/skins/ClamshellPhone.qrc @@ -0,0 +1,5 @@ + + + ClamshellPhone.skin + + diff --git a/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone.skin b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone.skin new file mode 100644 index 0000000..cb24a8e --- /dev/null +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone.skin @@ -0,0 +1,30 @@ +[SkinFile] +Up=ClamshellPhone1-5.png +Down=ClamshellPhone1-5-pressed.png +Closed=ClamshellPhone1-5-closed.png +Screen=72 84 176 208 +Areas=22 +HasMouseHover=false + +"Power" 0x0100000a 205 563 249 586 +"1" 0x0031 62 414 119 438 +"2" 0x0032 130 414 189 438 +"3" 0x0033 198 413 257 438 +"4" 0x0034 54 444 117 470 +"5" 0x0035 128 444 189 471 +"6" 0x0036 202 444 264 471 +"7" 0x0037 47 477 113 507 +"8" 0x0038 126 477 190 507 +"9" 0x0039 205 478 270 509 +"*" 0x002a 39 515 110 552 +"0" 0x0030 122 515 195 553 +"#" 0x0023 207 516 280 553 +"Context1" 0x01100000 137 360 108 383 123 410 90 409 60 387 63 378 100 362 +"Back" 0x01000061 184 361 206 376 213 387 197 410 226 410 256 392 258 381 244 369 +"Backspace" 0x01000003 68 563 113 587 +"Select" 0x01010000 160 391 172 390 181 386 184 381 180 377 173 373 165 372 155 372 145 375 138 378 136 382 138 387 147 390 +"Left" 0x1000012 141 390 136 385 136 381 143 375 132 371 120 380 121 393 129 401 +"Down" 0x1000015 143 389 130 402 162 412 191 404 175 390 +"Right" 0x1000014 186 370 176 375 184 382 182 387 175 390 190 404 201 396 202 375 +"Up" 0x1000013 133 370 143 374 176 374 185 370 169 362 149 362 +"Flip" 0x01100006 98 325 225 353 diff --git a/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-closed.png b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-closed.png new file mode 100644 index 0000000..88ba3a1 Binary files /dev/null and b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-closed.png differ diff --git a/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png new file mode 100644 index 0000000..971cdef Binary files /dev/null and b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png differ diff --git a/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5.png b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5.png new file mode 100644 index 0000000..f3550ee Binary files /dev/null and b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5.png differ diff --git a/tools/shared/deviceskin/skins/ClamshellPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/ClamshellPhone.skin/defaultbuttons.conf new file mode 100644 index 0000000..e349dbc --- /dev/null +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/defaultbuttons.conf @@ -0,0 +1,78 @@ +[Translation] +File=QtopiaDefaults +Context=Buttons +[Menu] +Rows=4 +Columns=3 +Map=123456789*0# +Default=5 +1=Applications/camera.desktop +2=Applications/datebook.desktop +3=Applications +4=Applications/qtmail.desktop +5=Applications/addressbook.desktop +6=Games +7=Settings/Beaming.desktop +8=Applications/simapp.desktop,Applications/calculator.desktop +9=Settings +*=Applications/mediarecorder.desktop +0=Applications/todolist.desktop +#=Documents +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +Count=3 +Key0=Context1 +Key1=Select +Key2=Back +[SystemButtons] +Count=5 +Key0=Context1 +Key1=Select +Key2=Back +Key3=Flip +Key4=Backspace +[TextButtons] +Buttons=0123456789*# +Hold0='0 +Hold1='1 +Hold2='2 +Hold3='3 +Hold4='4 +Hold5='5 +Hold6='6 +Hold7='7 +Hold8='8 +Hold9='9 +Hold*=symbol +Hold#=mode +Tap0=space +Tap1="\".,'?!-@:1" +Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" +Tap3="\"de\xe8\xe9\xea\x66\x33" +Tap4="\"ghi\xec\xed\xee\x34" +Tap5="\"jkl5" +Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" +Tap7="\"pqrs\xdf\x37" +Tap8="\"tu\xfc\xf9\xfav8" +Tap9="\"wxyz9" +Tap*=modify +Tap#=shift +[LocaleTextButtons] +Buttons=23456789 +Tap2[]='abc +Tap3[]='def +Tap4[]='ghi +Tap5[]='jkl +Tap6[]='mno +Tap7[]='pqrs +Tap8[]='tuv +Tap9[]='wxyz +[PhoneTextButtons] +Buttons=*# +Tap*='*+pw +Hold*=+ +Tap#=# +Hold#=mode +[Device] +PrimaryInput=Keypad diff --git a/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen-pressed.png b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen-pressed.png new file mode 100644 index 0000000..d62ef4a Binary files /dev/null and b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen-pressed.png differ diff --git a/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen.png b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen.png new file mode 100644 index 0000000..cb3d1a7 Binary files /dev/null and b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen.png differ diff --git a/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreenPhone.skin b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreenPhone.skin new file mode 100644 index 0000000..a82ef23 --- /dev/null +++ b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreenPhone.skin @@ -0,0 +1,29 @@ +[SkinFile] +Up=DualScreen.png +Down=DualScreen-pressed.png +Screen=128 155 176 208 +BackScreen=18 44 98 119 +Areas=21 +HasMouseHover=false + +"Context1" 0x1100000 144 368 189 368 168 396 176 427 150 398 +"Back" 0x1000061 245 365 291 366 283 398 258 424 265 394 +"Select" 0x1010000 202 401 210 389 224 388 233 402 224 415 208 415 +"Up" 0x1000013 202 381 196 374 218 363 239 373 229 382 +"Left" 0x1000012 199 385 189 375 176 403 185 426 197 415 194 401 +"Right" 0x1000014 235 390 248 379 253 402 246 421 238 413 +"Down" 0x1000015 204 421 233 422 241 432 214 443 191 430 +"Call" 0x1100004 163 452 137 450 125 465 136 484 159 485 169 467 +"Hangup" 0x1100005 266 475 279 448 295 447 309 460 301 480 289 487 +"1" 0x31 175 514 147 504 133 518 161 532 180 534 +"2" 0x32 199 515 229 519 238 533 222 540 195 538 +"2" 0x32 260 512 286 506 299 513 284 527 264 535 248 525 +"4" 0x34 164 541 177 546 182 560 164 565 146 560 135 545 154 539 +"5" 0x35 204 546 225 546 243 560 231 574 205 573 191 558 +"6" 0x36 257 547 281 537 294 540 287 555 274 566 254 561 +"7" 0x37 145 569 176 578 177 595 156 597 138 584 +"8" 0x38 197 582 229 584 241 593 226 604 201 603 189 594 +"9" 0x39 253 577 288 564 301 578 283 593 259 597 251 586 +"*" 0x2a 145 598 181 611 182 623 163 632 144 623 138 607 +"0" 0x30 196 611 233 613 240 630 220 642 193 637 191 622 +"#" 0x23 255 610 286 600 302 615 279 625 258 629 247 616 diff --git a/tools/shared/deviceskin/skins/DualScreenPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/DualScreenPhone.skin/defaultbuttons.conf new file mode 100644 index 0000000..1103350 --- /dev/null +++ b/tools/shared/deviceskin/skins/DualScreenPhone.skin/defaultbuttons.conf @@ -0,0 +1,78 @@ +[Translation] +File=QtopiaDefaults +Context=Buttons +[Menu] +Rows=4 +Columns=3 +Map=123456789*0# +Default=5 +1=Applications/camera.desktop +2=Applications/datebook.desktop +3=Applications +4=Applications/qtmail.desktop +5=Applications/addressbook.desktop +6=Games +7=Settings/Beaming.desktop +8=Applications/simapp.desktop,Applications/calculator.desktop +9=Settings +*=Applications/mediarecorder.desktop +0=Applications/todolist.desktop +#=Documents +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +Count=3 +Key0=Context1 +Key1=Select +Key2=Back +[SystemButtons] +Count=5 +Key0=Context1 +Key1=Select +Key2=Back +Key3=Call +Key4=Hangup +[TextButtons] +Buttons=0123456789*# +Hold0='0 +Hold1='1 +Hold2='2 +Hold3='3 +Hold4='4 +Hold5='5 +Hold6='6 +Hold7='7 +Hold8='8 +Hold9='9 +Hold*=symbol +Hold#=mode +Tap0=space +Tap1="\".,'?!-@:1" +Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" +Tap3="\"de\xe8\xe9\xea\x66\x33" +Tap4="\"ghi\xec\xed\xee\x34" +Tap5="\"jkl5" +Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" +Tap7="\"pqrs\xdf\x37" +Tap8="\"tu\xfc\xf9\xfav8" +Tap9="\"wxyz9" +Tap*=modify +Tap#=shift +[LocaleTextButtons] +Buttons=23456789 +Tap2[]='abc +Tap3[]='def +Tap4[]='ghi +Tap5[]='jkl +Tap6[]='mno +Tap7[]='pqrs +Tap8[]='tuv +Tap9[]='wxyz +[PhoneTextButtons] +Buttons=*# +Tap*='*+pw +Hold*=+ +Tap#='# +Hold#=mode +[Device] +PrimaryInput=Keypad diff --git a/tools/shared/deviceskin/skins/PDAPhone.qrc b/tools/shared/deviceskin/skins/PDAPhone.qrc new file mode 100644 index 0000000..1a1c35a --- /dev/null +++ b/tools/shared/deviceskin/skins/PDAPhone.qrc @@ -0,0 +1,5 @@ + + + PDAPhone.skin + + diff --git a/tools/shared/deviceskin/skins/PDAPhone.skin/PDAPhone.skin b/tools/shared/deviceskin/skins/PDAPhone.skin/PDAPhone.skin new file mode 100644 index 0000000..d6a1966 --- /dev/null +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/PDAPhone.skin @@ -0,0 +1,18 @@ +[SkinFile] +Up=pda_up.png +Down=pda_down.png +Screen=42 59 176 220 +Cursor=finger.png 20 20 +Areas=10 +HasMouseHover=false + +"Power" 0x0100000a 117 21 141 42 +"Context1" 0x01100000 43 284 74 315 +"Call" 0x01100004 74 284 104 315 +"Hangup" 0x01100005 154 284 184 315 +"Back" 0x01000061 184 284 214 315 +"Left" 0x1000012 123 315 110 326 106 307 113 288 123 300 120 307 +"Down" 0x1000015 123 315 130 318 138 315 150 326 129 335 111 325 +"Right" 0x1000014 137 301 149 290 155 308 150 324 138 315 140 308 +"Up" 0x1000013 123 300 112 289 130 282 149 290 137 300 130 298 +"Select" 0x01010000 131 298 137 300 140 307 138 315 130 318 123 316 120 307 123 300 diff --git a/tools/shared/deviceskin/skins/PDAPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/PDAPhone.skin/defaultbuttons.conf new file mode 100644 index 0000000..e3ae813 --- /dev/null +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/defaultbuttons.conf @@ -0,0 +1,36 @@ +[Translation] +File=QtopiaDefaults +Context=Buttons +[Menu] +Rows=4 +Columns=3 +Map=123456789*0# +Default=5 +1=Applications/camera.desktop +2=Applications/datebook.desktop +3=Applications +4=Applications/qtmail.desktop +5=Applications/addressbook.desktop +6=Games +7=Settings/Beaming.desktop +8=Applications/simapp.desktop,Applications/calculator.desktop +9=Settings +*=Applications/mediarecorder.desktop +0=Applications/todolist.desktop +#=Documents +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +Count=3 +Key0=Context1 +Key1=Select +Key2=Back +[SystemButtons] +Count=5 +Key0=Context1 +Key1=Back +Key2=Select +Key3=Call +Key4=Hangup +[Device] +PrimaryInput=Touchscreen diff --git a/tools/shared/deviceskin/skins/PDAPhone.skin/finger.png b/tools/shared/deviceskin/skins/PDAPhone.skin/finger.png new file mode 100644 index 0000000..24cf0cb Binary files /dev/null and b/tools/shared/deviceskin/skins/PDAPhone.skin/finger.png differ diff --git a/tools/shared/deviceskin/skins/PDAPhone.skin/pda_down.png b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_down.png new file mode 100644 index 0000000..f65c059 Binary files /dev/null and b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_down.png differ diff --git a/tools/shared/deviceskin/skins/PDAPhone.skin/pda_up.png b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_up.png new file mode 100644 index 0000000..541e3c4 Binary files /dev/null and b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_up.png differ diff --git a/tools/shared/deviceskin/skins/PortableMedia.qrc b/tools/shared/deviceskin/skins/PortableMedia.qrc new file mode 100644 index 0000000..a902f1a --- /dev/null +++ b/tools/shared/deviceskin/skins/PortableMedia.qrc @@ -0,0 +1,5 @@ + + + PortableMedia.skin + + diff --git a/tools/shared/deviceskin/skins/PortableMedia.skin/PortableMedia.skin b/tools/shared/deviceskin/skins/PortableMedia.skin/PortableMedia.skin new file mode 100644 index 0000000..b76e5cf --- /dev/null +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/PortableMedia.skin @@ -0,0 +1,14 @@ +[SkinFile] +Up=portablemedia.png +Down=portablemedia-pressed.png +Screen=18 20 480 272 +Areas=7 +HasMouseHover=false + +"Context1" 0x01100000 530 192 565 223 +"Back" 0x01000061 530 138 565 173 +"Select" 0x01010000 530 65 565 98 +"Left" 0x1000012 529 67 519 57 511 65 511 104 519 110 529 100 529 98 +"Down" 0x1000015 530 102 520 111 529 120 569 120 577 114 566 103 564 103 +"Right" 0x1000014 565 65 576 52 585 67 585 102 578 113 567 104 +"Up" 0x1000013 530 65 519 55 528 48 567 48 573 51 564 66 diff --git a/tools/shared/deviceskin/skins/PortableMedia.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/PortableMedia.skin/defaultbuttons.conf new file mode 100644 index 0000000..514e881 --- /dev/null +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/defaultbuttons.conf @@ -0,0 +1,23 @@ +[Translation] +File=QtopiaDefaults +Context=Buttons +[Menu] +Map=123 +Default=1 +1=Applications/mediaplayer.desktop +2=Applications/photoedit.desktop +3=Settings +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +Count=3 +Key0=Context1 +Key1=Select +Key2=Back +[SystemButtons] +Count=5 +Key0=Context1 +Key1=Select +Key2=Back +[Device] +PrimaryInput=Keypad diff --git a/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia-pressed.png b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia-pressed.png new file mode 100644 index 0000000..730e762 Binary files /dev/null and b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia-pressed.png differ diff --git a/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.png b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.png new file mode 100644 index 0000000..e44cbe1 Binary files /dev/null and b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.png differ diff --git a/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.xcf b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.xcf new file mode 100644 index 0000000..127e07c Binary files /dev/null and b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.xcf differ diff --git a/tools/shared/deviceskin/skins/S60-QVGA-Candybar.qrc b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.qrc new file mode 100644 index 0000000..8138484 --- /dev/null +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.qrc @@ -0,0 +1,5 @@ + + + S60-QVGA-Candybar.skin + + diff --git a/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png new file mode 100644 index 0000000..89d40cb Binary files /dev/null and b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png differ diff --git a/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png new file mode 100644 index 0000000..0d0e598 Binary files /dev/null and b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png differ diff --git a/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin new file mode 100644 index 0000000..4f8fe5d --- /dev/null +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin @@ -0,0 +1,15 @@ +[SkinFile] +Up=S60-QVGA-Candybar.png +Down=S60-QVGA-Candybar-down.png +Screen=61 93 240 320 +Areas=7 +HasMouseHover=false + + +"Context1" 0x01100000 54 469 151 469 140 483 88 485 81 496 54 498 +"Back" 0x01000061 211 468 307 467 307 498 278 497 219 486 +"Select" 0x01010000 165 491 196 522 +"Left" 0x1000012 149 474 166 492 163 519 143 538 142 481 +"Down" 0x1000015 164 521 195 522 212 539 204 545 154 544 145 536 +"Right" 0x1000014 214 475 219 487 219 528 212 539 196 522 197 492 +"Up" 0x1000013 150 474 156 467 209 467 213 476 197 489 165 489 diff --git a/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/defaultbuttons.conf new file mode 100644 index 0000000..e349dbc --- /dev/null +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/defaultbuttons.conf @@ -0,0 +1,78 @@ +[Translation] +File=QtopiaDefaults +Context=Buttons +[Menu] +Rows=4 +Columns=3 +Map=123456789*0# +Default=5 +1=Applications/camera.desktop +2=Applications/datebook.desktop +3=Applications +4=Applications/qtmail.desktop +5=Applications/addressbook.desktop +6=Games +7=Settings/Beaming.desktop +8=Applications/simapp.desktop,Applications/calculator.desktop +9=Settings +*=Applications/mediarecorder.desktop +0=Applications/todolist.desktop +#=Documents +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +Count=3 +Key0=Context1 +Key1=Select +Key2=Back +[SystemButtons] +Count=5 +Key0=Context1 +Key1=Select +Key2=Back +Key3=Flip +Key4=Backspace +[TextButtons] +Buttons=0123456789*# +Hold0='0 +Hold1='1 +Hold2='2 +Hold3='3 +Hold4='4 +Hold5='5 +Hold6='6 +Hold7='7 +Hold8='8 +Hold9='9 +Hold*=symbol +Hold#=mode +Tap0=space +Tap1="\".,'?!-@:1" +Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" +Tap3="\"de\xe8\xe9\xea\x66\x33" +Tap4="\"ghi\xec\xed\xee\x34" +Tap5="\"jkl5" +Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" +Tap7="\"pqrs\xdf\x37" +Tap8="\"tu\xfc\xf9\xfav8" +Tap9="\"wxyz9" +Tap*=modify +Tap#=shift +[LocaleTextButtons] +Buttons=23456789 +Tap2[]='abc +Tap3[]='def +Tap4[]='ghi +Tap5[]='jkl +Tap6[]='mno +Tap7[]='pqrs +Tap8[]='tuv +Tap9[]='wxyz +[PhoneTextButtons] +Buttons=*# +Tap*='*+pw +Hold*=+ +Tap#=# +Hold#=mode +[Device] +PrimaryInput=Keypad diff --git a/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.qrc b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.qrc new file mode 100644 index 0000000..daf0cc3 --- /dev/null +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.qrc @@ -0,0 +1,5 @@ + + + S60-nHD-Touchscreen.skin + + diff --git a/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png new file mode 100644 index 0000000..7253e38 Binary files /dev/null and b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png differ diff --git a/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png new file mode 100644 index 0000000..675563e Binary files /dev/null and b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png differ diff --git a/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin new file mode 100644 index 0000000..ed25d0e --- /dev/null +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin @@ -0,0 +1,10 @@ +[SkinFile] +Up=S60-nHD-Touchscreen.png +Down=S60-nHD-Touchscreen-down.png +Screen=53 183 360 640 +Areas=3 +HasMouseHover=false + +"Call" 0x01100004 76 874 171 899 +"Hangup" 0x01100005 300 876 393 899 +"Home" 0x1000010 174 878 298 899 diff --git a/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/defaultbuttons.conf new file mode 100644 index 0000000..6665125 --- /dev/null +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/defaultbuttons.conf @@ -0,0 +1,53 @@ +[Translation] +File=QtopiaDefaults +Context=Buttons +[Menu] +Rows=4 +Columns=3 +Map=123456789*0# +Default=5 +1=Applications/camera.desktop +2=Applications/mediaplayer.desktop +3=Applications/simapp.desktop,Applications/calculator.desktop +4=Applications/qtmail.desktop +5=Applications/addressbook.desktop +6=Applications/datebook.desktop +7=Games +8=Settings/beaming.desktop +9=Applications/todolist.desktop +*=Settings +0=Applications +#=Documents +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +Count=3 +Key0=Context1 +Key1=Select +Key2=Back +[SystemButtons] +Count=5 +Key0=Context1 +Key1=Back +Key2=Select +Key3=Call +Key4=Hangup +[Device] +PrimaryInput=Touchscreen +[Button] +Count=2 +[Button0] +Name[]=Home Button +Key=Home +PressedActionMappable=0 +PressedActionService=TaskManager +PressedActionMessage=multitask() +HeldActionMappable=0 +HeldActionService=TaskManager +HeldActionMessage=showRunningTasks() +[Button1] +Name=Power Button +Key=Hangup +HeldActionService=Launcher +HeldActionMessage=execute(QString) +HeldActionArgs=@ByteArray(\0\0\0\x1\0\0\0\n\0\0\0\0\x10\0s\0h\0u\0t\0\x64\0o\0w\0n) diff --git a/tools/shared/deviceskin/skins/SmartPhone.qrc b/tools/shared/deviceskin/skins/SmartPhone.qrc new file mode 100644 index 0000000..8bb5325 --- /dev/null +++ b/tools/shared/deviceskin/skins/SmartPhone.qrc @@ -0,0 +1,5 @@ + + + SmartPhone.skin + + diff --git a/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone-pressed.png b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone-pressed.png new file mode 100644 index 0000000..d0db2ed Binary files /dev/null and b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone-pressed.png differ diff --git a/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.png b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.png new file mode 100644 index 0000000..e6ac5a0 Binary files /dev/null and b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.png differ diff --git a/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.skin b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.skin new file mode 100644 index 0000000..2f44c5a --- /dev/null +++ b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.skin @@ -0,0 +1,28 @@ +[SkinFile] +Up=SmartPhone.png +Down=SmartPhone-pressed.png +Screen=90 107 176 208 +Areas=21 +HasMouseHover=false + +"1" 0x0031 138 459 149 473 142 483 120 484 102 477 95 464 99 457 121 454 +"2" 0x0032 153 467 202 492 +"3" 0x0033 258 457 260 470 243 483 215 484 207 474 218 460 248 453 +"4" 0x0034 138 492 149 506 142 516 120 517 102 510 95 497 99 490 121 487 +"5" 0x0035 153 499 202 524 +"6" 0x0036 258 489 260 502 243 515 215 516 207 506 218 492 248 485 +"7" 0x0037 138 524 149 538 142 548 120 549 102 542 95 529 99 522 121 519 +"8" 0x0038 153 531 202 556 +"9" 0x0039 258 521 260 534 243 547 215 548 207 538 218 524 248 517 +"*" 0x002a 138 556 149 570 142 580 120 581 102 574 95 561 99 554 121 551 +"0" 0x0030 153 564 202 589 +"#" 0x0023 258 554 260 567 243 580 215 581 207 571 218 557 248 550 +"Call" 0x01100004 88 395 130 439 +"Hangup" 0x01100005 227 395 269 439 +"Context1" 0x01100000 145 321 134 333 132 361 134 374 110 343 109 318 +"Back" 0x01000061 249 322 240 354 219 373 223 344 216 325 208 318 +"Select" 0x01010000 160 338 195 371 +"Left" 0x1000012 159 338 149 328 141 336 141 373 149 381 159 371 159 369 +"Down" 0x1000015 160 373 150 382 159 391 199 391 207 385 196 374 194 374 +"Right" 0x1000014 195 336 206 323 215 338 215 373 208 384 197 375 +"Up" 0x1000013 160 336 149 326 158 319 197 319 203 322 194 337 diff --git a/tools/shared/deviceskin/skins/SmartPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/SmartPhone.skin/defaultbuttons.conf new file mode 100644 index 0000000..1103350 --- /dev/null +++ b/tools/shared/deviceskin/skins/SmartPhone.skin/defaultbuttons.conf @@ -0,0 +1,78 @@ +[Translation] +File=QtopiaDefaults +Context=Buttons +[Menu] +Rows=4 +Columns=3 +Map=123456789*0# +Default=5 +1=Applications/camera.desktop +2=Applications/datebook.desktop +3=Applications +4=Applications/qtmail.desktop +5=Applications/addressbook.desktop +6=Games +7=Settings/Beaming.desktop +8=Applications/simapp.desktop,Applications/calculator.desktop +9=Settings +*=Applications/mediarecorder.desktop +0=Applications/todolist.desktop +#=Documents +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +Count=3 +Key0=Context1 +Key1=Select +Key2=Back +[SystemButtons] +Count=5 +Key0=Context1 +Key1=Select +Key2=Back +Key3=Call +Key4=Hangup +[TextButtons] +Buttons=0123456789*# +Hold0='0 +Hold1='1 +Hold2='2 +Hold3='3 +Hold4='4 +Hold5='5 +Hold6='6 +Hold7='7 +Hold8='8 +Hold9='9 +Hold*=symbol +Hold#=mode +Tap0=space +Tap1="\".,'?!-@:1" +Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" +Tap3="\"de\xe8\xe9\xea\x66\x33" +Tap4="\"ghi\xec\xed\xee\x34" +Tap5="\"jkl5" +Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" +Tap7="\"pqrs\xdf\x37" +Tap8="\"tu\xfc\xf9\xfav8" +Tap9="\"wxyz9" +Tap*=modify +Tap#=shift +[LocaleTextButtons] +Buttons=23456789 +Tap2[]='abc +Tap3[]='def +Tap4[]='ghi +Tap5[]='jkl +Tap6[]='mno +Tap7[]='pqrs +Tap8[]='tuv +Tap9[]='wxyz +[PhoneTextButtons] +Buttons=*# +Tap*='*+pw +Hold*=+ +Tap#='# +Hold#=mode +[Device] +PrimaryInput=Keypad diff --git a/tools/shared/deviceskin/skins/SmartPhone2.qrc b/tools/shared/deviceskin/skins/SmartPhone2.qrc new file mode 100644 index 0000000..751e985 --- /dev/null +++ b/tools/shared/deviceskin/skins/SmartPhone2.qrc @@ -0,0 +1,5 @@ + + + SmartPhone2.skin + + diff --git a/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2-pressed.png b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2-pressed.png new file mode 100644 index 0000000..d4eb5b0 Binary files /dev/null and b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2-pressed.png differ diff --git a/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.png b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.png new file mode 100644 index 0000000..48ccc1c Binary files /dev/null and b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.png differ diff --git a/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.skin b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.skin new file mode 100644 index 0000000..16884bf --- /dev/null +++ b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.skin @@ -0,0 +1,25 @@ +SmartPhone2.png SmartPhone2-pressed.png +90 107 +176 220 +21 +"Menu" 0x01100000 70 400 115 427 +"Backspace" 0x01000003 238 400 285 427 +"1" 0x0031 138 437 149 451 142 461 120 462 102 455 95 442 99 435 121 432 +"2" 0x0032 153 445 202 470 +"3" 0x0033 258 435 260 448 243 461 215 462 207 452 218 438 248 431 +"4" 0x0034 138 470 149 484 142 494 120 495 102 488 95 475 99 468 121 465 +"5" 0x0035 153 477 202 502 +"6" 0x0036 258 467 260 480 243 493 215 494 207 484 218 470 248 463 +"7" 0x0037 138 502 149 516 142 526 120 527 102 520 95 507 99 500 121 497 +"8" 0x0038 153 509 202 534 +"9" 0x0039 258 499 260 512 243 525 215 526 207 516 218 502 248 495 +"*" 0x002a 138 534 149 548 142 558 120 559 102 552 95 539 99 532 121 529 +"0" 0x0030 153 542 202 567 +"#" 0x0023 258 532 260 545 243 558 215 559 207 549 218 535 248 528 +"Yes" 0x01010001 91 343 141 393 +"No" 0x01010002 219 343 269 393 +"Select" 0x01010000 160 356 195 389 +"Left" 0x1000012 159 356 149 346 141 354 141 391 149 399 159 389 159 387 +"Down" 0x1000015 160 391 150 400 159 409 199 409 207 403 196 392 194 392 +"Right" 0x1000014 195 354 206 341 215 356 215 391 208 402 197 393 +"Up" 0x1000013 160 354 149 344 158 337 197 337 203 340 194 355 diff --git a/tools/shared/deviceskin/skins/SmartPhone2.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/SmartPhone2.skin/defaultbuttons.conf new file mode 100644 index 0000000..b083203 --- /dev/null +++ b/tools/shared/deviceskin/skins/SmartPhone2.skin/defaultbuttons.conf @@ -0,0 +1,52 @@ +[Button] +[IMethod] +key_count = 5 +key_hold_action_1 = insertText +key_hold_action_2 = insertText +key_hold_action_3 = insertSymbol +key_hold_action_4 = changeMode +key_hold_arg_1 = 1 +key_hold_arg_2 = 0 +key_id_1 = 1 +key_id_2 = 0 +key_id_3 = * +key_id_4 = # +key_id_5 = * +key_mode_1 = Abc +key_mode_2 = Abc +key_mode_3 = Abc +key_mode_4 = Abc +key_mode_5 = Phone +key_tap_action_1 = insertText +key_tap_action_2 = insertSpace +key_tap_action_3 = modifyText +key_tap_action_4 = changeShift +key_tap_action_5 = insertText +key_tap_arg_1 = .,'?!-@:〓 +key_tap_arg_5 = *+pw +[Menu] +1 = Applications/camera.desktop +2 = Applications/datebook.desktop +3 = Games +4 = Applications/qtmail.desktop +5 = Applications/addressbook.desktop +6 = Settings +7 = Settings/Beaming.desktop +8 = Applications +9 = Documents +Columns = 3 +Default = 5 +Map = 123456789 +Rows = 3 +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +[SystemButtons] +Count=5 +Key0=Yes +Key1=Select +Key2=No +Key3=Menu +Key4=Backspace +[Device] +PrimaryInput=Keypad diff --git a/tools/shared/deviceskin/skins/SmartPhoneWithButtons.qrc b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.qrc new file mode 100644 index 0000000..f3393ba --- /dev/null +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.qrc @@ -0,0 +1,5 @@ + + + SmartPhoneWithButtons.skin + + diff --git a/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png new file mode 100644 index 0000000..456a068 Binary files /dev/null and b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png differ diff --git a/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png new file mode 100644 index 0000000..5ffbd6e Binary files /dev/null and b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png differ diff --git a/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin new file mode 100644 index 0000000..9afa67f --- /dev/null +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin @@ -0,0 +1,31 @@ +[SkinFile] +Up=SmartPhoneWithButtons.png +Down=SmartPhoneWithButtons-pressed.png +Screen=90 107 176 208 +Areas=24 +HasMouseHover=false + +"1" 0x0031 138 459 149 473 142 483 120 484 102 477 95 464 99 457 121 454 +"2" 0x0032 153 467 202 492 +"3" 0x0033 258 457 260 470 243 483 215 484 207 474 218 460 248 453 +"4" 0x0034 138 492 149 506 142 516 120 517 102 510 95 497 99 490 121 487 +"5" 0x0035 153 499 202 524 +"6" 0x0036 258 489 260 502 243 515 215 516 207 506 218 492 248 485 +"7" 0x0037 138 524 149 538 142 548 120 549 102 542 95 529 99 522 121 519 +"8" 0x0038 153 531 202 556 +"9" 0x0039 258 521 260 534 243 547 215 548 207 538 218 524 248 517 +"*" 0x002a 138 556 149 570 142 580 120 581 102 574 95 561 99 554 121 551 +"0" 0x0030 153 564 202 589 +"#" 0x0023 258 554 260 567 243 580 215 581 207 571 218 557 248 550 +"Call" 0x01100004 88 395 130 439 +"Hangup" 0x01100005 227 395 269 439 +"Context1" 0x01100000 145 321 134 333 132 361 134 374 110 343 109 318 +"Back" 0x01000061 249 322 240 354 219 373 223 344 216 325 208 318 +"Select" 0x01010000 160 338 195 371 +"Left" 0x1000012 159 338 149 328 141 336 141 373 149 381 159 371 159 369 +"Down" 0x1000015 160 373 150 382 159 391 199 391 207 385 196 374 194 374 +"Right" 0x1000014 195 336 206 323 215 338 215 373 208 384 197 375 +"Up" 0x1000013 160 336 149 326 158 319 197 319 203 322 194 337 +"Home" 0x1000010 164 402 195 434 +"F1" 0x1000030 138 422 163 448 +"F2" 0x1000031 196 422 220 448 diff --git a/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/defaultbuttons.conf new file mode 100644 index 0000000..ebd6926 --- /dev/null +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/defaultbuttons.conf @@ -0,0 +1,103 @@ +[Translation] +File=QtopiaDefaults +Context=Buttons +[Button] +Count=3 +[Button0] +Name[]=Calendar Button +Key=F1 +PressedActionService=Calendar +PressedActionMessage=raiseToday() +HeldActionService=Calendar +HeldActionMessage=newEvent() +[Button1] +Name[]=Tasks Button +Key=F2 +PressedActionService=Tasks +PressedActionMessage=raise() +HeldActionService=Tasks +HeldActionMessage=newTask() +[Button2] +Name[]=Home Button +Key=Home +PressedActionMappable=0 +PressedActionService=TaskManager +PressedActionMessage=multitask() +HeldActionMappable=0 +HeldActionService=TaskManager +HeldActionMessage=showRunningTasks() +[Menu] +Rows=4 +Columns=3 +Map=123456789*0# +Default=5 +1=Applications/camera.desktop +2=Applications/datebook.desktop +3=Applications +4=Applications/qtmail.desktop +5=Applications/addressbook.desktop +6=Games +7=Settings/Beaming.desktop +8=Applications/simapp.desktop,Applications/calculator.desktop +9=Settings +*=Applications/mediarecorder.desktop +0=Applications/todolist.desktop +#=Documents +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +Count=3 +Key0=Context1 +Key1=Select +Key2=Back +[SystemButtons] +Count=5 +Key0=Context1 +Key1=Select +Key2=Back +Key3=Call +Key4=Hangup +[TextButtons] +Buttons=0123456789*# +Hold0='0 +Hold1='1 +Hold2='2 +Hold3='3 +Hold4='4 +Hold5='5 +Hold6='6 +Hold7='7 +Hold8='8 +Hold9='9 +Hold*=symbol +Hold#=mode +Tap0=space +Tap1="\".,'?!-@:1" +Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" +Tap3="\"de\xe8\xe9\xea\x66\x33" +Tap4="\"ghi\xec\xed\xee\x34" +Tap5="\"jkl5" +Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" +Tap7="\"pqrs\xdf\x37" +Tap8="\"tu\xfc\xf9\xfav8" +Tap9="\"wxyz9" +Tap*=modify +Tap#=shift +[LocaleTextButtons] +Buttons=23456789 +Tap2[]='abc +Tap3[]='def +Tap4[]='ghi +Tap5[]='jkl +Tap6[]='mno +Tap7[]='pqrs +Tap8[]='tuv +Tap9[]='wxyz +[PhoneTextButtons] +Buttons=*# +Tap*='*+pw +Hold*=+ +Tap#='# +Hold#=mode +[Device] +PrimaryInput=Keypad diff --git a/tools/shared/deviceskin/skins/TouchscreenPhone.qrc b/tools/shared/deviceskin/skins/TouchscreenPhone.qrc new file mode 100644 index 0000000..023144d --- /dev/null +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.qrc @@ -0,0 +1,5 @@ + + + TouchscreenPhone.skin + + diff --git a/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone-pressed.png b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone-pressed.png new file mode 100644 index 0000000..01acb86 Binary files /dev/null and b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone-pressed.png differ diff --git a/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.png b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.png new file mode 100644 index 0000000..e90de0d Binary files /dev/null and b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.png differ diff --git a/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.skin b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.skin new file mode 100644 index 0000000..24316a1 --- /dev/null +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.skin @@ -0,0 +1,16 @@ +[SkinFile] +Up=TouchscreenPhone.png +Down=TouchscreenPhone-pressed.png +Screen=90 107 176 208 +Areas=9 +HasMouseHover=false + +"Context1" 0x01100000 145 321 134 333 132 361 134 374 110 343 109 318 +"Call" 0x01100004 88 395 130 439 +"Hangup" 0x01100005 227 395 269 439 +"Back" 0x01000061 249 322 240 354 219 373 223 344 216 325 208 318 +"Left" 0x1000012 159 338 149 328 141 336 141 373 149 381 159 371 159 369 +"Down" 0x1000015 160 373 150 382 159 391 199 391 207 385 196 374 194 374 +"Right" 0x1000014 195 336 206 323 215 338 215 373 208 384 197 375 +"Up" 0x1000013 160 336 149 326 158 319 197 319 203 322 194 337 +"Select" 0x01010000 160 338 195 371 diff --git a/tools/shared/deviceskin/skins/TouchscreenPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/defaultbuttons.conf new file mode 100644 index 0000000..a13dfdc --- /dev/null +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/defaultbuttons.conf @@ -0,0 +1,45 @@ +[Translation] +File=QtopiaDefaults +Context=Buttons +[Menu] +Rows=4 +Columns=3 +Map=123456789*0# +Default=5 +1=Applications/camera.desktop +2=Applications/datebook.desktop +3=Applications +4=Applications/qtmail.desktop +5=Applications/addressbook.desktop +6=Games +7=Settings/Beaming.desktop +8=Applications/simapp.desktop,Applications/calculator.desktop +9=Settings +*=Applications/mediarecorder.desktop +0=Applications/todolist.desktop +#=Documents +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +Count=3 +Key0=Context1 +Key1=Select +Key2=Back +[SystemButtons] +Count=5 +Key0=Context1 +Key1=Back +Key2=Select +Key3=Call +Key4=Hangup +[Button] +Count=1 +[Button0] +Name=Power Button +Key=Hangup +HeldActionService=Launcher +HeldActionMessage=execute(QString) +HeldActionArgs=@ByteArray(\0\0\0\x1\0\0\0\n\0\0\0\0\x10\0s\0h\0u\0t\0\x64\0o\0w\0n) +[Device] +PrimaryInput=Touchscreen + diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc b/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc new file mode 100644 index 0000000..4775068 --- /dev/null +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc @@ -0,0 +1,5 @@ + + + Trolltech-Keypad.skin + + diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png new file mode 100644 index 0000000..8dd5719 Binary files /dev/null and b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png differ diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-down.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-down.png new file mode 100644 index 0000000..5e1e6be Binary files /dev/null and b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-down.png differ diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.png new file mode 100644 index 0000000..fb3d549 Binary files /dev/null and b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.png differ diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.skin b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.skin new file mode 100644 index 0000000..4d90321 --- /dev/null +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.skin @@ -0,0 +1,35 @@ +[SkinFile] +Up=Trolltech-Keypad.png +Down=Trolltech-Keypad-down.png +Closed=Trolltech-Keypad-closed.png +ClosedAreas=F1 F2 F3 Flip +ClosedScreen=95 456 128 96 +Screen=75 85 176 220 +Areas=25 +HasMouseHover=false +"1" 0x0031 65 542 68 536 76 532 114 536 114 573 64 568 +"2" 0x0032 133 537 188 574 +"3" 0x0033 206 536 246 532 252 536 256 542 258 569 205 572 +"4" 0x0034 64 578 114 618 +"5" 0x0035 133 581 188 618 +"6" 0x0036 206 580 256 577 258 613 206 616 +"7" 0x0037 66 622 116 625 114 662 66 658 +"8" 0x0038 133 626 188 662 +"9" 0x0039 206 625 256 622 256 658 206 661 +"*" 0x002a 68 667 116 670 114 705 86 699 76 693 69 686 +"0" 0x0030 133 671 188 708 +"#" 0x0023 206 670 254 665 254 684 245 692 232 699 206 704 +"Context1" 0x01100000 69 420 75 410 85 404 101 404 102 458 69 458 +"Back" 0x01000061 218 404 234 404 240 408 248 418 248 456 218 457 +"Home" 0x1000010 140 494 180 514 +"Hangup" 0x01100005 218 457 248 456 248 496 243 507 230 514 194 514 194 494 206 492 213 486 218 478 +"Call" 0x01100004 68 458 102 460 102 479 108 487 118 492 126 494 126 514 86 514 77 507 72 496 +"Select" 0x01010000 138 426 182 458 +"Up" 0x1000013 118 406 201 402 184 423 134 422 +"Right" 0x1000014 184 424 201 402 202 476 184 460 +"Down" 0x1000015 135 462 184 461 199 477 118 477 +"Left" 0x1000012 118 406 134 424 134 461 117 476 +"F1" 0x1000030 0 408 45 456 +"F2" 0x1000031 0 456 45 509 +"F3" 0x1000032 0 545 45 582 +"Flip" 0x1100006 32 353 293 386 diff --git a/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/defaultbuttons.conf new file mode 100644 index 0000000..6a78e67 --- /dev/null +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/defaultbuttons.conf @@ -0,0 +1,142 @@ +[Translation] +File=QtopiaDefaults +Context=Buttons +[Button] +Count=8 +[Button7] +Name[]=Home Down Button +Key=Down +Context=HomeScreen +PressedActionMappable=0 +HeldActionService=Messaging +HeldActionMessage=raise() +[Button6] +Name[]=Home Up Button +Key=Up +Context=HomeScreen +PressedActionMappable=0 +HeldActionService=Contacts +HeldActionMessage=raise() +[Button5] +Name[]=Home Right Button +Key=Right +Context=HomeScreen +PressedActionMappable=0 +HeldActionService=mediaplayer +HeldActionMessage=raise() +[Button4] +Name[]=Calender Button +Key=Left +Context=HomeScreen +PressedActionMappable=0 +HeldActionService=Calendar +HeldActionMessage=raiseToday() +[Button3] +Name[]=Left Soft Key +Key=Context1 +HeldActionService=TaskManager +HeldActionMessage=showRunningTasks() +HeldActionMappable=0 +PressActionMappable=0 +[Button2] +Name[]=VoiceNotes Button +Key=F1 +PressedActionService=mediarecorder +PressedActionMessage=raise() +HeldActionService=mediarecorder +HeldActionMessage=newEvent() +[Button1] +Name[]=Camera Button +Key=F2 +PressedActionService=Camera +PressedActionMessage=raise() +HeldActionService=Tasks +HeldActionMessage=newTask() +[Button0] +Name[]=Home Button +Key=Home +PressedActionMappable=0 +PressedActionService=TaskManager +PressedActionMessage=multitask() +HeldActionMappable=0 +HeldActionService=TaskManager +HeldActionMessage=showRunningTasks() +[Menu] +Rows=4 +Columns=3 +Map=123456789*0# +Default=5 +1=Applications/camera.desktop +2=Applications/mediaplayer.desktop +3=Applications/simapp.desktop,Applications/calculator.desktop +4=Applications/qtmail.desktop +5=Applications/addressbook.desktop +6=Applications/datebook.desktop +7=Games +8=Settings/Beaming.desktop +9=Applications/todolist.desktop +*=Settings +0=Applications +#=Documents +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +Count=3 +Key0=Context1 +Key1=Select +Key2=Back +[SystemButtons] +Count=6 +Key0=Context1 +Key1=Select +Key2=Back +Key3=Call +Key4=Hangup +Key5=Flip +[TextButtons] +Buttons=0123456789*# +Hold0='0 +Hold1='1 +Hold2='2 +Hold3='3 +Hold4='4 +Hold5='5 +Hold6='6 +Hold7='7 +Hold8='8 +Hold9='9 +Hold*=symbol +Hold#=mode +Tap0=space +Tap0=space +Tap1="\".,'?!-@:1" +Tap2="\"a\xe4\xe5\xe6\xe0\xe1\xe2\x62\x63\xe7\x32" +Tap3="\"de\xe8\xe9\xea\x66\x33" +Tap4="\"ghi\xec\xed\xee\x34" +Tap5="\"jkl5" +Tap6="\"mn\xf1o\xf6\xf8\xf2\xf3\x36" +Tap7="\"pqrs\xdf\x37" +Tap8="\"tu\xfc\xf9\xfav8" +Tap9="\"wxyz9" +Tap*=modify +Tap#=shift +[LocaleTextButtons] +Buttons=23456789 +Tap2[]='abc +Tap3[]='def +Tap4[]='ghi +Tap5[]='jkl +Tap6[]='mno +Tap7[]='pqrs +Tap8[]='tuv +Tap9[]='wxyz +[PhoneTextButtons] +Buttons=*# +Tap*='*+pw +Hold*=+ +Tap#='# +Hold#=mode +[Device] +PrimaryInput=Keypad +[Environment] +QWS_DISPLAY=Multi: LinuxFb:mmHeight57:0 LinuxFb:offset=0,320:1 :0 diff --git a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc new file mode 100644 index 0000000..40fafeb --- /dev/null +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc @@ -0,0 +1,5 @@ + + + Trolltech-Touchscreen.skin + + diff --git a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png new file mode 100644 index 0000000..c1a422f Binary files /dev/null and b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png differ diff --git a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png new file mode 100644 index 0000000..544a425 Binary files /dev/null and b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png differ diff --git a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin new file mode 100644 index 0000000..5de882e --- /dev/null +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin @@ -0,0 +1,17 @@ +[SkinFile] +Up=Trolltech-Touchscreen.png +Down=Trolltech-Touchscreen-down.png +Screen=40 109 176 220 +Areas=10 +HasMouseHover=false + +"Context1" 0x01100000 38 420 44 408 52 404 68 403 68 458 40 458 +"Back" 0x01000061 185 42 202 398 211 410 216 418 219 456 186 456 +"Call" 0x01100004 38 458 70 458 71 478 75 486 83 492 94 494 94 516 56 516 45 507 38 498 +"Hangup" 0x01100005 186 458 220 458 220 496 214 508 200 516 162 516 161 494 172 492 180 486 185 478 +"Left" 0x1000012 86 405 106 426 106 461 85 478 +"Down" 0x1000015 106 460 151 460 170 480 85 480 +"Right" 0x1000014 151 424 170 404 170 480 151 460 +"Up" 0x1000013 85 403 168 403 150 424 106 424 +"Select" 0x01010000 106 426 150 456 +"Home" 0x1000010 105 493 145 512 diff --git a/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/defaultbuttons.conf new file mode 100644 index 0000000..6665125 --- /dev/null +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/defaultbuttons.conf @@ -0,0 +1,53 @@ +[Translation] +File=QtopiaDefaults +Context=Buttons +[Menu] +Rows=4 +Columns=3 +Map=123456789*0# +Default=5 +1=Applications/camera.desktop +2=Applications/mediaplayer.desktop +3=Applications/simapp.desktop,Applications/calculator.desktop +4=Applications/qtmail.desktop +5=Applications/addressbook.desktop +6=Applications/datebook.desktop +7=Games +8=Settings/beaming.desktop +9=Applications/todolist.desktop +*=Settings +0=Applications +#=Documents +Animator=Bounce +AnimatorBackground=Radial +[SoftKeys] +Count=3 +Key0=Context1 +Key1=Select +Key2=Back +[SystemButtons] +Count=5 +Key0=Context1 +Key1=Back +Key2=Select +Key3=Call +Key4=Hangup +[Device] +PrimaryInput=Touchscreen +[Button] +Count=2 +[Button0] +Name[]=Home Button +Key=Home +PressedActionMappable=0 +PressedActionService=TaskManager +PressedActionMessage=multitask() +HeldActionMappable=0 +HeldActionService=TaskManager +HeldActionMessage=showRunningTasks() +[Button1] +Name=Power Button +Key=Hangup +HeldActionService=Launcher +HeldActionMessage=execute(QString) +HeldActionArgs=@ByteArray(\0\0\0\x1\0\0\0\n\0\0\0\0\x10\0s\0h\0u\0t\0\x64\0o\0w\0n) -- cgit v0.12 From f1d1be98036ea4d03c505d54e7adb408491434d4 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Tue, 12 May 2009 15:30:46 +0200 Subject: Remove unused file qfileinfo_p.h The private class was already declared and defined in the qfileinfo.cpp file. Reviewed-by: thiago --- qmake/qmake.pri | 1 - src/corelib/io/io.pri | 1 - src/corelib/io/qfileinfo_p.h | 145 ------------------------------------------- 3 files changed, 147 deletions(-) delete mode 100644 src/corelib/io/qfileinfo_p.h diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 02ff38e..9147ee8 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -79,7 +79,6 @@ bootstrap { #Qt code qfile.h \ qabstractfileengine.h \ qfileinfo.h \ - qfileinfo_p.h \ qglobal.h \ qnumeric.h \ qhash.h \ diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 3690d4b..c62959d 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -10,7 +10,6 @@ HEADERS += \ io/qdiriterator.h \ io/qfile.h \ io/qfileinfo.h \ - io/qfileinfo_p.h \ io/qiodevice.h \ io/qiodevice_p.h \ io/qprocess.h \ diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h deleted file mode 100644 index 7d66581..0000000 --- a/src/corelib/io/qfileinfo_p.h +++ /dev/null @@ -1,145 +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 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 QFILEINFO_P_H -#define QFILEINFO_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of QIODevice. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qfileinfo.h" - -QT_BEGIN_NAMESPACE - -class QFileInfoPrivate -{ -public: - QFileInfoPrivate(const QFileInfo *copy=0); - ~QFileInfoPrivate(); - - void initFileEngine(const QString &); - - enum Access { - ReadAccess, - WriteAccess, - ExecuteAccess - }; - bool hasAccess(Access access) const; - - uint getFileFlags(QAbstractFileEngine::FileFlags) const; - QDateTime &getFileTime(QAbstractFileEngine::FileTime) const; - QString getFileName(QAbstractFileEngine::FileName) const; - - enum { - CachedFileFlags = 0x01, - CachedLinkTypeFlag = 0x02, - CachedBundleTypeFlag= 0x04, - CachedMTime = 0x10, - CachedCTime = 0x20, - CachedATime = 0x40, - CachedSize = 0x08 - }; - - struct Data - { - inline Data() - : ref(1), fileEngine(0), cache_enabled(1) - { - clear(); - } - - inline Data(const Data ©) - : ref(1), fileEngine(QAbstractFileEngine::create(copy.fileName)), - fileName(copy.fileName), cache_enabled(copy.cache_enabled) - { - clear(); - } - - inline ~Data() - { - delete fileEngine; - } - - inline void clear() - { - fileNames.clear(); - fileFlags = 0; - cachedFlags = 0; - } - - mutable QAtomicInt ref; - - QAbstractFileEngine *fileEngine; - mutable QString fileName; - mutable QHash fileNames; - mutable uint cachedFlags : 31; - mutable uint cache_enabled : 1; - mutable uint fileFlags; - mutable qint64 fileSize; - mutable QDateTime fileTimes[3]; - - inline bool getCachedFlag(uint c) const - { return cache_enabled ? (cachedFlags & c) : 0; } - - inline void setCachedFlag(uint c) - { if (cache_enabled) cachedFlags |= c; } - } *data; - - inline void reset() { - detach(); - data->clear(); - } - - void detach(); -}; - - -QT_END_NAMESPACE -#endif - -- cgit v0.12 From 8589b7c526f8c7d436c6a7c3bfb39dc505eff78e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 12 May 2009 18:52:58 +0200 Subject: doc: Add documentation for Tank Game example --- doc/src/examples.qdoc | 1 + doc/src/examples/tankgame.qdoc | 115 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 doc/src/examples/tankgame.qdoc diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc index 0153252..6fb903c 100644 --- a/doc/src/examples.qdoc +++ b/doc/src/examples.qdoc @@ -315,6 +315,7 @@ \o \l{statemachine/pingpong}{Ping Pong States}\raisedaster \o \l{statemachine/trafficlight}{Traffic Light}\raisedaster \o \l{statemachine/twowaybutton}{Two-way Button}\raisedaster + \o \l{statemachine/tankgame}{Tank Game}\raisedaster \endlist \section1 Threads diff --git a/doc/src/examples/tankgame.qdoc b/doc/src/examples/tankgame.qdoc new file mode 100644 index 0000000..e10161c --- /dev/null +++ b/doc/src/examples/tankgame.qdoc @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** 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 statemachine/tankgame + \title Tank Game Example + + The Tank Game example is part of the in \l{The State Machine Framework}. It shows how to use + parallel states to implement artificial intelligence controllers that run in parallel, and error + states to handle run-time errors in parts of the state graph created by external plugins. + + \image tankgame-example.png + + In this example we write a simple game. The application runs a state machine with two main + states: A "stopped" state and a "running" state. The user can load plugins from the disk by + selecting the "Add tank" menu item. + + When the "Add tank" menu item is selected, the "plugins" subdirectory in the example's + directory is searched for compatible plugins. If any are found, they will be listed in a + dialog box created using QInputDialog::getItem(). + + \snippet examples/statemachine/tankgame/mainwindow.cpp 1 + + If the user selects a plugin, the application will construct a TankItem object, which inherits + from QGraphicsItem and QObject, and which implements an agreed-upon interface using the + meta-object mechanism. + + \snippet examples/statemachine/tankgame/tankitem.h 0 + + The tank item will be passed to the plugin's create() function. This will in turn return a + QState object which is expected to implement an artificial intelligence which controls the + tank and attempts to destroy other tanks it detects. + + \snippet examples/statemachine/tankgame/mainwindow.cpp 2 + + Each returned QState object becomes a descendant of a \c region in the "running" state, which is + defined as a parallel state. This means that entering the "running" state will cause each of the + plugged-in QState objects to be entered simultaneously, allowing the tanks to run independently + of each other. + + \snippet examples/statemachine/tankgame/mainwindow.cpp 0 + + The maximum number of tanks on the map is four, and when this number is reached, the + "Add tank" menu item should be disabled. This is implemented by giving the "stopped" state two + children which define whether the map is full or not. + + To make sure that we go into the correct child state when returning from the "running" state + (if the "Stop game" menu item is selected while the game is running) we also give the "stopped" + state a history state which we make the initial state of "stopped" state. + + \snippet examples/statemachine/tankgame/mainwindow.cpp 3 + + Since part of the state graph is defined by external plugins, we have no way of controlling + whether they contain errors. By default, run-time errors are handled in the state machine by + entering a top level state which prints out an error message and never exits. If we were to + use this default behavior, a run-time error in any of the plugins would cause the "running" + state to exit, and thus all the other tanks to stop running as well. A better solution would + be if the broken plugin was disabled and the rest of the tanks allowed to continue as before. + + This is done by setting the error state of the plugin's top-most state to a special error state + defined specifically for the plugin in question. + + \snippet examples/statemachine/tankgame/mainwindow.cpp 3 + + If a run-time error occurs in \c pluginState or any of its descendants, the state machine will + search the hierarchy of ancestors until it finds a state whose error state is different from + \c null. (Note that if we are worried that a plugin could inadvertedly be overriding our + error state, we could search the descendants of \c pluginState and verify that their error + states are set to \c null before accepting the plugin.) + + The specialized \c errorState sets the "enabled" property of the tank item in question to false, + causing it to be painted with a red cross over it to indicate that it is no longer running. + Since the error state is a child of the same region in the parallel "running" state as + \c pluginState, it will not exit the "running" state, and the other tanks will continue running + without disruption. + +*/ -- cgit v0.12 From 288de11968d4b71c97fc5d1a175d4c4ac7023552 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 13 May 2009 11:01:32 +0200 Subject: doc: Correct names of snippets in docs for Tank Game example --- doc/src/examples/tankgame.qdoc | 2 +- examples/statemachine/tankgame/mainwindow.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/src/examples/tankgame.qdoc b/doc/src/examples/tankgame.qdoc index e10161c..1501a99 100644 --- a/doc/src/examples/tankgame.qdoc +++ b/doc/src/examples/tankgame.qdoc @@ -98,7 +98,7 @@ This is done by setting the error state of the plugin's top-most state to a special error state defined specifically for the plugin in question. - \snippet examples/statemachine/tankgame/mainwindow.cpp 3 + \snippet examples/statemachine/tankgame/mainwindow.cpp 4 If a run-time error occurs in \c pluginState or any of its descendants, the state machine will search the hierarchy of ancestors until it finds a state whose error state is different from diff --git a/examples/statemachine/tankgame/mainwindow.cpp b/examples/statemachine/tankgame/mainwindow.cpp index 3bc9bbe..870bc9c 100644 --- a/examples/statemachine/tankgame/mainwindow.cpp +++ b/examples/statemachine/tankgame/mainwindow.cpp @@ -135,8 +135,10 @@ void MainWindow::init() spawnsAvailable->addTransition(this, SIGNAL(mapFull()), noSpawnsAvailable); +//! [3] QHistoryState *hs = new QHistoryState(stoppedState); hs->setDefaultState(spawnsAvailable); +//! [3] stoppedState->setInitialState(hs); @@ -255,9 +257,11 @@ void MainWindow::addTank() // If the plugin has an error it is disabled +//! [4] QState *errorState = new QState(region); errorState->assignProperty(tankItem, "enabled", false); pluginState->setErrorState(errorState); +//! [4] } } } -- cgit v0.12 From 5c7c8208c559d82e96aa7aa8c753c224d89022a2 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 13 May 2009 11:20:14 +0200 Subject: document statemachine/factorial example --- doc/src/examples.qdoc | 1 + doc/src/examples/factorial.qdoc | 102 +++++++++++++++++++++++++++++++ doc/src/images/factorial-example.png | Bin 0 -> 4032 bytes examples/statemachine/factorial/main.cpp | 64 +++++++++++-------- 4 files changed, 141 insertions(+), 26 deletions(-) create mode 100644 doc/src/examples/factorial.qdoc create mode 100644 doc/src/images/factorial-example.png diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc index 6fb903c..6603390 100644 --- a/doc/src/examples.qdoc +++ b/doc/src/examples.qdoc @@ -312,6 +312,7 @@ \list \o \l{statemachine/eventtransitions}{Event Transitions}\raisedaster + \o \l{statemachine/factorial}{Factorial States}\raisedaster \o \l{statemachine/pingpong}{Ping Pong States}\raisedaster \o \l{statemachine/trafficlight}{Traffic Light}\raisedaster \o \l{statemachine/twowaybutton}{Two-way Button}\raisedaster diff --git a/doc/src/examples/factorial.qdoc b/doc/src/examples/factorial.qdoc new file mode 100644 index 0000000..2a72e0a --- /dev/null +++ b/doc/src/examples/factorial.qdoc @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** 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 statemachine/factorial + \title Factorial States Example + + The Factorial States example shows how to use \l{The State Machine + Framework} to calculate the factorial of an integer. + + The statechart for calculating the factorial looks as follows: + + \img factorial-example.png + \omit + \caption This is a caption + \endomit + + In other words, the state machine calculates the factorial of 6 and prints + the result. + + \snippet examples/statemachine/factorial/main.cpp 0 + + The Factorial class is used to hold the data of the computation, \c x and + \c fac. It also provides a signal that's emitted whenever the value of \c + x changes. + + \snippet examples/statemachine/factorial/main.cpp 1 + + The FactorialLoopTransition class implements the guard (\c x > 1) and + calculations (\c fac = \c x * \c fac; \c x = \c x - 1) of the factorial + loop. + + \snippet examples/statemachine/factorial/main.cpp 2 + + The FactorialDoneTransition class implements the guard (\c x <= 1) that + terminates the factorial computation. It also prints the final result to + standard output. + + \snippet examples/statemachine/factorial/main.cpp 3 + + The application's main() function first creates the application object, a + Factorial object and a state machine. + + \snippet examples/statemachine/factorial/main.cpp 4 + + The \c compute state is created, and the initial values of \c x and \c fac + are defined. A FactorialLoopTransition object is created and added to the + state. + + \snippet examples/statemachine/factorial/main.cpp 5 + + A final state, \c done, is created, and a FactorialDoneTransition object + is created with \c done as its target state. The transition is then added + to the \c compute state. + + \snippet examples/statemachine/factorial/main.cpp 6 + + The machine's initial state is set to be the \c compute state. We connect + the QStateMachine::finished() signal to the QCoreApplication::quit() slot, + so the application will quit when the state machine's work is + done. Finally, the state machine is started, and the application's event + loop is entered. + + */ diff --git a/doc/src/images/factorial-example.png b/doc/src/images/factorial-example.png new file mode 100644 index 0000000..8fb1cc6 Binary files /dev/null and b/doc/src/images/factorial-example.png differ diff --git a/examples/statemachine/factorial/main.cpp b/examples/statemachine/factorial/main.cpp index 2b63690..ae5928f 100644 --- a/examples/statemachine/factorial/main.cpp +++ b/examples/statemachine/factorial/main.cpp @@ -48,6 +48,7 @@ #include #endif +//! [0] class Factorial : public QObject { Q_OBJECT @@ -55,10 +56,8 @@ class Factorial : public QObject Q_PROPERTY(int fac READ fac WRITE setFac) public: Factorial(QObject *parent = 0) - : QObject(parent) + : QObject(parent), m_x(-1), m_fac(1) { - m_fac = 1; - m_x = -1; } int x() const @@ -71,7 +70,7 @@ public: if (x == m_x) return; m_x = x; - emit xChanged(); + emit xChanged(x); } int fac() const @@ -85,28 +84,34 @@ public: } Q_SIGNALS: - void xChanged(); + void xChanged(int value); private: int m_x; int m_fac; }; +//! [0] +//! [1] class FactorialLoopTransition : public QSignalTransition { public: FactorialLoopTransition(Factorial *fact) - : QSignalTransition(fact, SIGNAL(xChanged())), m_fact(fact) + : QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact) {} - virtual bool eventTest(QEvent *) const + virtual bool eventTest(QEvent *e) const { - return m_fact->property("x").toInt() > 1; + if (!QSignalTransition::eventTest(e)) + return false; + QSignalEvent *se = static_cast(e); + return se->arguments().at(0).toInt() > 1; } - virtual void onTransition(QEvent *) + virtual void onTransition(QEvent *e) { - int x = m_fact->property("x").toInt(); + QSignalEvent *se = static_cast(e); + int x = se->arguments().at(0).toInt(); int fac = m_fact->property("fac").toInt(); m_fact->setProperty("fac", x * fac); m_fact->setProperty("x", x - 1); @@ -115,17 +120,22 @@ public: private: Factorial *m_fact; }; +//! [1] +//! [2] class FactorialDoneTransition : public QSignalTransition { public: FactorialDoneTransition(Factorial *fact) - : QSignalTransition(fact, SIGNAL(xChanged())), m_fact(fact) + : QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact) {} - virtual bool eventTest(QEvent *) const + virtual bool eventTest(QEvent *e) const { - return m_fact->property("x").toInt() <= 1; + if (!QSignalTransition::eventTest(e)) + return false; + QSignalEvent *se = static_cast(e); + return se->arguments().at(0).toInt() <= 1; } virtual void onTransition(QEvent *) @@ -136,35 +146,37 @@ public: private: Factorial *m_fact; }; +//! [2] +//! [3] int main(int argc, char **argv) { QCoreApplication app(argc, argv); - Factorial factorial; - QStateMachine machine; +//! [3] - QState *computing = new QState(machine.rootState()); - computing->addTransition(new FactorialLoopTransition(&factorial)); +//! [4] + QState *compute = new QState(machine.rootState()); + compute->assignProperty(&factorial, "fac", 1); + compute->assignProperty(&factorial, "x", 6); + compute->addTransition(new FactorialLoopTransition(&factorial)); +//! [4] +//! [5] QFinalState *done = new QFinalState(machine.rootState()); FactorialDoneTransition *doneTransition = new FactorialDoneTransition(&factorial); doneTransition->setTargetState(done); - computing->addTransition(doneTransition); - - QState *initialize = new QState(machine.rootState()); - initialize->assignProperty(&factorial, "x", 6); - FactorialLoopTransition *enterLoopTransition = new FactorialLoopTransition(&factorial); - enterLoopTransition->setTargetState(computing); - initialize->addTransition(enterLoopTransition); + compute->addTransition(doneTransition); +//! [5] +//! [6] + machine.setInitialState(compute); QObject::connect(&machine, SIGNAL(finished()), &app, SLOT(quit())); - - machine.setInitialState(initialize); machine.start(); return app.exec(); } +//! [6] #include "main.moc" -- cgit v0.12 From 55829ebc5664a65fcef158e7ccd3579aaffa8d20 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Mon, 11 May 2009 17:37:37 +0200 Subject: Reset the 'connectedToScene' flag when changing the scene of a view In QGraphicsScene::_q_emitUpdated() the slot QGrpahicsView::updateScene(QList) gets connected and a boolean (connectedToScene) is set to prevent double connections. The problem is that this boolean was not reset when the view gets a new scene. Task-number: 253415 Reviewed-by: andreas --- src/gui/graphicsview/qgraphicsview.cpp | 1 + tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 05e4907..8b133f3 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1681,6 +1681,7 @@ void QGraphicsView::setScene(QGraphicsScene *scene) disconnect(d->scene, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(updateSceneRect(QRectF))); d->scene->d_func()->views.removeAll(this); + d->connectedToScene = false; } // Assign the new scene and update the contents (scrollbars, etc.)). diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index b5af115..db1e4c3 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -200,6 +200,7 @@ private slots: void task239729_noViewUpdate(); void task239047_fitInViewSmallViewport(); void task245469_itemsAtPointWithClip(); + void task253415_reconnectUpdateSceneOnSceneChanged(); }; void tst_QGraphicsView::initTestCase() @@ -3044,5 +3045,28 @@ void tst_QGraphicsView::centerOnDirtyItem() QCOMPARE(before, after); } +void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() +{ + QGraphicsView view; + QGraphicsView dummyView; + view.setWindowFlags(view.windowFlags() | Qt::WindowStaysOnTopHint); + view.resize(200, 200); + + QGraphicsScene scene1; + QObject::connect(&scene1, SIGNAL(changed(QList)), &dummyView, SLOT(updateScene(QList))); + view.setScene(&scene1); + + QTest::qWait(125); + + QGraphicsScene scene2; + QObject::connect(&scene2, SIGNAL(changed(QList)), &dummyView, SLOT(updateScene(QList))); + view.setScene(&scene2); + + QTest::qWait(125); + + bool wasConnected2 = QObject::disconnect(&scene2, SIGNAL(changed(QList)), &view, 0); + QVERIFY(wasConnected2); +} + QTEST_MAIN(tst_QGraphicsView) #include "tst_qgraphicsview.moc" -- cgit v0.12 From 6b2d3e437bf1632191f62c603f754f895d4122eb Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 13 May 2009 12:39:11 +0200 Subject: kill the QT_STATEMACHINE_SOLUTION define We won't release another Qt Solution, so the define is no longer needed. --- src/corelib/statemachine/qabstractstate.cpp | 27 +------- src/corelib/statemachine/qabstractstate.h | 3 - src/corelib/statemachine/qabstractstate_p.h | 8 --- src/corelib/statemachine/qabstracttransition.cpp | 51 ++------------- src/corelib/statemachine/qabstracttransition.h | 3 - src/corelib/statemachine/qabstracttransition_p.h | 8 --- src/corelib/statemachine/qeventtransition.cpp | 4 -- src/corelib/statemachine/qeventtransition.h | 6 -- src/corelib/statemachine/qfinalstate.h | 4 -- src/corelib/statemachine/qhistorystate.h | 4 -- src/corelib/statemachine/qsignaleventgenerator_p.h | 9 +-- src/corelib/statemachine/qsignaltransition.cpp | 4 -- src/corelib/statemachine/qsignaltransition.h | 4 -- src/corelib/statemachine/qstate.cpp | 9 --- src/corelib/statemachine/qstate.h | 4 -- src/corelib/statemachine/qstatemachine.cpp | 76 ++-------------------- src/corelib/statemachine/qstatemachine.h | 9 +-- src/corelib/statemachine/qstatemachine_p.h | 11 +--- src/gui/statemachine/qguistatemachine.cpp | 5 -- 19 files changed, 16 insertions(+), 233 deletions(-) diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp index 3f84314..7e59a7d 100644 --- a/src/corelib/statemachine/qabstractstate.cpp +++ b/src/corelib/statemachine/qabstractstate.cpp @@ -129,36 +129,16 @@ void QAbstractStatePrivate::emitExited() Constructs a new state with the given \a parent state. */ QAbstractState::QAbstractState(QState *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - *new QAbstractStatePrivate, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(new QAbstractStatePrivate) -#endif + : QObject(*new QAbstractStatePrivate, parent) { -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif } /*! \internal */ QAbstractState::QAbstractState(QAbstractStatePrivate &dd, QState *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - dd, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(&dd) -#endif + : QObject(dd, parent) { -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif } /*! @@ -166,9 +146,6 @@ QAbstractState::QAbstractState(QAbstractStatePrivate &dd, QState *parent) */ QAbstractState::~QAbstractState() { -#ifdef QT_STATEMACHINE_SOLUTION - delete d_ptr; -#endif } /*! diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h index f6b4b21..d0ebb52 100644 --- a/src/corelib/statemachine/qabstractstate.h +++ b/src/corelib/statemachine/qabstractstate.h @@ -76,9 +76,6 @@ protected: bool event(QEvent *e); protected: -#ifdef QT_STATEMACHINE_SOLUTION - QAbstractStatePrivate *d_ptr; -#endif QAbstractState(QAbstractStatePrivate &dd, QState *parent); private: diff --git a/src/corelib/statemachine/qabstractstate_p.h b/src/corelib/statemachine/qabstractstate_p.h index 6c09696..1a99d6c 100644 --- a/src/corelib/statemachine/qabstractstate_p.h +++ b/src/corelib/statemachine/qabstractstate_p.h @@ -53,9 +53,7 @@ // We mean it. // -#ifndef QT_STATEMACHINE_SOLUTION #include -#endif QT_BEGIN_NAMESPACE @@ -63,9 +61,7 @@ class QStateMachine; class QAbstractState; class Q_CORE_EXPORT QAbstractStatePrivate -#ifndef QT_STATEMACHINE_SOLUTION : public QObjectPrivate -#endif { Q_DECLARE_PUBLIC(QAbstractState) @@ -82,10 +78,6 @@ public: void emitEntered(); void emitExited(); - -#ifdef QT_STATEMACHINE_SOLUTION - QAbstractState *q_ptr; -#endif }; QT_END_NAMESPACE diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp index 6ddb416..f7a7d34 100644 --- a/src/corelib/statemachine/qabstracttransition.cpp +++ b/src/corelib/statemachine/qabstracttransition.cpp @@ -147,18 +147,8 @@ QState *QAbstractTransitionPrivate::sourceState() const Constructs a new QAbstractTransition object with the given \a sourceState. */ QAbstractTransition::QAbstractTransition(QState *sourceState) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - *new QAbstractTransitionPrivate, -#endif - sourceState) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(new QAbstractTransitionPrivate) -#endif + : QObject(*new QAbstractTransitionPrivate, sourceState) { -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif } /*! @@ -167,18 +157,8 @@ QAbstractTransition::QAbstractTransition(QState *sourceState) */ QAbstractTransition::QAbstractTransition(const QList &targets, QState *sourceState) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - *new QAbstractTransitionPrivate, -#endif - sourceState) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(new QAbstractTransitionPrivate) -#endif + : QObject(*new QAbstractTransitionPrivate, sourceState) { -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif setTargetStates(targets); } @@ -187,18 +167,8 @@ QAbstractTransition::QAbstractTransition(const QList &targets, */ QAbstractTransition::QAbstractTransition(QAbstractTransitionPrivate &dd, QState *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - dd, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(&dd) -#endif + : QObject(dd, parent) { -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif } /*! @@ -207,18 +177,8 @@ QAbstractTransition::QAbstractTransition(QAbstractTransitionPrivate &dd, QAbstractTransition::QAbstractTransition(QAbstractTransitionPrivate &dd, const QList &targets, QState *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - dd, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(&dd) -#endif + : QObject(dd, parent) { -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif setTargetStates(targets); } @@ -227,9 +187,6 @@ QAbstractTransition::QAbstractTransition(QAbstractTransitionPrivate &dd, */ QAbstractTransition::~QAbstractTransition() { -#ifdef QT_STATEMACHINE_SOLUTION - delete d_ptr; -#endif } /*! diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h index e207944..8f0cefa 100644 --- a/src/corelib/statemachine/qabstracttransition.h +++ b/src/corelib/statemachine/qabstracttransition.h @@ -95,9 +95,6 @@ protected: bool event(QEvent *e); protected: -#ifdef QT_STATEMACHINE_SOLUTION - QAbstractTransitionPrivate *d_ptr; -#endif QAbstractTransition(QAbstractTransitionPrivate &dd, QState *parent); QAbstractTransition(QAbstractTransitionPrivate &dd, const QList &targets, QState *parent); diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h index eb0ec21..156e70e 100644 --- a/src/corelib/statemachine/qabstracttransition_p.h +++ b/src/corelib/statemachine/qabstracttransition_p.h @@ -53,9 +53,7 @@ // We mean it. // -#ifndef QT_STATEMACHINE_SOLUTION #include -#endif #include #include @@ -68,9 +66,7 @@ class QStateMachine; class QAbstractTransition; class Q_CORE_EXPORT QAbstractTransitionPrivate -#ifndef QT_STATEMACHINE_SOLUTION : public QObjectPrivate -#endif { Q_DECLARE_PUBLIC(QAbstractTransition) public: @@ -89,10 +85,6 @@ public: #ifndef QT_NO_ANIMATION QList animations; #endif - -#ifdef QT_STATEMACHINE_SOLUTION - QAbstractTransition *q_ptr; -#endif }; QT_END_NAMESPACE diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp index 86259e4..3ae3ed9 100644 --- a/src/corelib/statemachine/qeventtransition.cpp +++ b/src/corelib/statemachine/qeventtransition.cpp @@ -255,11 +255,7 @@ void QEventTransition::setEventObject(QObject *object) bool QEventTransition::eventTest(QEvent *event) const { Q_D(const QEventTransition); -#ifdef QT_STATEMACHINE_SOLUTION - if (event->type() == QEvent::Type(QEvent::User-3)) { -#else if (event->type() == QEvent::Wrapped) { -#endif QWrappedEvent *we = static_cast(event); return (we->object() == d->object) && (we->event()->type() == d->eventType); diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h index a128cee..68ee4fc 100644 --- a/src/corelib/statemachine/qeventtransition.h +++ b/src/corelib/statemachine/qeventtransition.h @@ -42,11 +42,7 @@ #ifndef QEVENTTRANSITION_H #define QEVENTTRANSITION_H -#ifndef QT_STATEMACHINE_SOLUTION #include -#else -#include "qabstracttransition.h" -#endif #include QT_BEGIN_HEADER @@ -60,9 +56,7 @@ class Q_CORE_EXPORT QEventTransition : public QAbstractTransition { Q_OBJECT Q_PROPERTY(QObject* eventObject READ eventObject WRITE setEventObject) -#ifndef QT_STATEMACHINE_SOLUTION Q_PROPERTY(QEvent::Type eventType READ eventType WRITE setEventType) -#endif public: QEventTransition(QState *sourceState = 0); QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = 0); diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h index eb8aa0f..fa68394 100644 --- a/src/corelib/statemachine/qfinalstate.h +++ b/src/corelib/statemachine/qfinalstate.h @@ -42,11 +42,7 @@ #ifndef QFINALSTATE_H #define QFINALSTATE_H -#ifndef QT_STATEMACHINE_SOLUTION #include -#else -#include "qabstractstate.h" -#endif QT_BEGIN_HEADER diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h index d0f75de..a0682bd 100644 --- a/src/corelib/statemachine/qhistorystate.h +++ b/src/corelib/statemachine/qhistorystate.h @@ -42,11 +42,7 @@ #ifndef QHISTORYSTATE_H #define QHISTORYSTATE_H -#ifndef QT_STATEMACHINE_SOLUTION #include -#else -#include "qabstractstate.h" -#endif QT_BEGIN_HEADER diff --git a/src/corelib/statemachine/qsignaleventgenerator_p.h b/src/corelib/statemachine/qsignaleventgenerator_p.h index d18def8..cf0ea1e 100644 --- a/src/corelib/statemachine/qsignaleventgenerator_p.h +++ b/src/corelib/statemachine/qsignaleventgenerator_p.h @@ -62,11 +62,7 @@ class QStateMachine; class QSignalEventGenerator : public QObject { public: - QSignalEventGenerator( -#ifdef QT_STATEMACHINE_SOLUTION - int signalIndex, -#endif - QStateMachine *parent); + QSignalEventGenerator(QStateMachine *parent); static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; @@ -74,9 +70,6 @@ public: virtual int qt_metacall(QMetaObject::Call, int, void **argv); private: -#ifdef QT_STATEMACHINE_SOLUTION - int signalIndex; -#endif Q_DISABLE_COPY(QSignalEventGenerator) }; diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp index d5833bd..fd17292 100644 --- a/src/corelib/statemachine/qsignaltransition.cpp +++ b/src/corelib/statemachine/qsignaltransition.cpp @@ -228,11 +228,7 @@ void QSignalTransition::setSignal(const QByteArray &signal) bool QSignalTransition::eventTest(QEvent *event) const { Q_D(const QSignalTransition); -#ifndef QT_STATEMACHINE_SOLUTION if (event->type() == QEvent::Signal) { -#else - if (event->type() == QEvent::Type(QEvent::User-1)) { -#endif if (d->signalIndex == -1) return false; QSignalEvent *se = static_cast(event); diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h index 98a9ae7..7f457b8 100644 --- a/src/corelib/statemachine/qsignaltransition.h +++ b/src/corelib/statemachine/qsignaltransition.h @@ -42,11 +42,7 @@ #ifndef QSIGNALTRANSITION_H #define QSIGNALTRANSITION_H -#ifndef QT_STATEMACHINE_SOLUTION #include -#else -#include "qabstracttransition.h" -#endif QT_BEGIN_HEADER diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index f1528b8..8893bfe 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -193,9 +193,6 @@ QList QStatePrivate::childStates() const { QList result; QList::const_iterator it; -#ifdef QT_STATEMACHINE_SOLUTION - const QObjectList &children = q_func()->children(); -#endif for (it = children.constBegin(); it != children.constEnd(); ++it) { QAbstractState *s = qobject_cast(*it); if (!s || qobject_cast(s)) @@ -209,9 +206,6 @@ QList QStatePrivate::historyStates() const { QList result; QList::const_iterator it; -#ifdef QT_STATEMACHINE_SOLUTION - const QObjectList &children = q_func()->children(); -#endif for (it = children.constBegin(); it != children.constEnd(); ++it) { QHistoryState *h = qobject_cast(*it); if (h) @@ -224,9 +218,6 @@ QList QStatePrivate::transitions() const { QList result; QList::const_iterator it; -#ifdef QT_STATEMACHINE_SOLUTION - const QObjectList &children = q_func()->children(); -#endif for (it = children.constBegin(); it != children.constEnd(); ++it) { QAbstractTransition *t = qobject_cast(*it); if (t) diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index 73955d7..6729c69 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -42,11 +42,7 @@ #ifndef QSTATE_H #define QSTATE_H -#ifndef QT_STATEMACHINE_SOLUTION #include -#else -#include "qabstractstate.h" -#endif QT_BEGIN_HEADER diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 40a465a..c2b2696 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -54,10 +54,8 @@ #include "qfinalstate.h" #include "qhistorystate.h" #include "qhistorystate_p.h" -#ifndef QT_STATEMACHINE_SOLUTION #include "private/qobject_p.h" #include "private/qthread_p.h" -#endif #ifndef QT_NO_STATEMACHINE_EVENTFILTER #include "qeventtransition.h" @@ -68,11 +66,7 @@ #ifndef QT_NO_ANIMATION #include "qpropertyanimation.h" #include "qanimationgroup.h" -# ifndef QT_STATEMACHINE_SOLUTION -# include -# else -# include "qvariantanimation_p.h" -# endif +#include #endif #include @@ -212,9 +206,7 @@ QStateMachinePrivate::QStateMachinePrivate() globalRestorePolicy = QStateMachine::DoNotRestoreProperties; rootState = 0; initialErrorStateForRoot = 0; -#ifndef QT_STATEMACHINE_SOLUTION signalEventGenerator = 0; -#endif #ifndef QT_NO_ANIMATION animationsEnabled = true; #endif @@ -1274,8 +1266,6 @@ void QStateMachinePrivate::unregisterTransition(QAbstractTransition *transition) #endif } -#ifndef QT_STATEMACHINE_SOLUTION - static int senderSignalIndex(const QObject *sender) { QObjectPrivate *d = QObjectPrivate::get(const_cast(sender)); @@ -1292,8 +1282,6 @@ static int senderSignalIndex(const QObject *sender) return d->currentSender->signal; } -#endif - void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transition) { Q_Q(QStateMachine); @@ -1315,12 +1303,8 @@ void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transitio if (connectedSignalIndexes.size() <= signalIndex) connectedSignalIndexes.resize(signalIndex+1); if (connectedSignalIndexes.at(signalIndex) == 0) { -#ifndef QT_STATEMACHINE_SOLUTION if (!signalEventGenerator) signalEventGenerator = new QSignalEventGenerator(q); -#else - QSignalEventGenerator *signalEventGenerator = new QSignalEventGenerator(signalIndex, q); -#endif bool ok = QMetaObject::connect(sender, signalIndex, signalEventGenerator, signalEventGenerator->metaObject()->methodOffset()); if (!ok) { @@ -1346,7 +1330,6 @@ void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transit int signalIndex = QSignalTransitionPrivate::get(transition)->signalIndex; if (signalIndex == -1) return; // not registered -#ifndef QT_STATEMACHINE_SOLUTION QSignalTransitionPrivate::get(transition)->signalIndex = -1; const QObject *sender = QSignalTransitionPrivate::get(transition)->sender; QVector &connectedSignalIndexes = connections[sender]; @@ -1362,7 +1345,6 @@ void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transit if (sum == 0) connections.remove(sender); } -#endif } void QStateMachinePrivate::unregisterAllTransitions() @@ -1392,10 +1374,8 @@ void QStateMachinePrivate::registerEventTransition(QEventTransition *transition) QObject *object = QEventTransitionPrivate::get(transition)->object; if (!object) return; -#ifndef QT_STATEMACHINE_SOLUTION QObjectPrivate *od = QObjectPrivate::get(object); if (!od->eventFilters.contains(q)) -#endif object->installEventFilter(q); qobjectEvents[object].insert(transition->eventType()); QEventTransitionPrivate::get(transition)->registered = true; @@ -1449,36 +1429,16 @@ void QStateMachinePrivate::handleTransitionSignal(const QObject *sender, int sig Constructs a new state machine with the given \a parent. */ QStateMachine::QStateMachine(QObject *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - *new QStateMachinePrivate, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(new QStateMachinePrivate) -#endif + : QObject(*new QStateMachinePrivate, parent) { -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif } /*! \internal */ QStateMachine::QStateMachine(QStateMachinePrivate &dd, QObject *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - dd, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(&dd) -#endif + : QObject(dd, parent) { -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif } /*! @@ -1486,9 +1446,6 @@ QStateMachine::QStateMachine(QStateMachinePrivate &dd, QObject *parent) */ QStateMachine::~QStateMachine() { -#ifdef QT_STATEMACHINE_SOLUTION - delete d_ptr; -#endif } namespace { @@ -2088,11 +2045,9 @@ int QSignalEventGenerator::qt_metacall(QMetaObject::Call _c, int _id, void **_a) if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: { -#ifndef QT_STATEMACHINE_SOLUTION // ### in Qt 4.6 we can use QObject::senderSignalIndex() int signalIndex = senderSignalIndex(this); Q_ASSERT(signalIndex != -1); -#endif QStateMachine *machine = qobject_cast(parent()); QStateMachinePrivate::get(machine)->handleTransitionSignal(sender(), signalIndex, _a); break; @@ -2104,15 +2059,8 @@ int QSignalEventGenerator::qt_metacall(QMetaObject::Call _c, int _id, void **_a) return _id; } -QSignalEventGenerator::QSignalEventGenerator( -#ifdef QT_STATEMACHINE_SOLUTION - int sigIdx, -#endif - QStateMachine *parent) +QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent) : QObject(parent) -#ifdef QT_STATEMACHINE_SOLUTION - , signalIndex(sigIdx) -#endif { } @@ -2143,13 +2091,8 @@ QSignalEventGenerator::QSignalEventGenerator( */ QSignalEvent::QSignalEvent(const QObject *sender, int signalIndex, const QList &arguments) - : -#ifndef QT_STATEMACHINE_SOLUTION - QEvent(QEvent::Signal) -#else - QEvent(QEvent::Type(QEvent::User-1)) -#endif - , m_sender(sender), m_signalIndex(signalIndex), m_arguments(arguments) + : QEvent(QEvent::Signal), m_sender(sender), + m_signalIndex(signalIndex), m_arguments(arguments) { } @@ -2208,12 +2151,7 @@ QSignalEvent::~QSignalEvent() and \a event. */ QWrappedEvent::QWrappedEvent(QObject *object, QEvent *event) -#ifdef QT_STATEMACHINE_SOLUTION - : QEvent(QEvent::Type(QEvent::User-3)) -#else - : QEvent(QEvent::Wrapped) -#endif - , m_object(object), m_event(event) + : QEvent(QEvent::Wrapped), m_object(object), m_event(event) { } diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index 5dc6c0b..2a98a9a 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -42,11 +42,7 @@ #ifndef QSTATEMACHINE_H #define QSTATEMACHINE_H -#ifndef QT_STATEMACHINE_SOLUTION -# include -#else -# include "qabstractstate.h" -#endif +#include #include #include @@ -151,9 +147,6 @@ protected: bool event(QEvent *e); protected: -#ifdef QT_STATEMACHINE_SOLUTION - QStateMachinePrivate *d_ptr; -#endif QStateMachine(QStateMachinePrivate &dd, QObject *parent); private: diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h index 4bf9ce2..9b4b861 100644 --- a/src/corelib/statemachine/qstatemachine_p.h +++ b/src/corelib/statemachine/qstatemachine_p.h @@ -53,9 +53,7 @@ // We mean it. // -#ifndef QT_STATEMACHINE_SOLUTION #include -#endif #include #include #include @@ -84,9 +82,7 @@ class QAbstractAnimation; class QStateMachine; class Q_CORE_EXPORT QStateMachinePrivate -#ifndef QT_STATEMACHINE_SOLUTION : public QObjectPrivate -#endif { Q_DECLARE_PUBLIC(QStateMachine) public: @@ -200,9 +196,8 @@ public: #endif // QT_NO_ANIMATION -#ifndef QT_STATEMACHINE_SOLUTION QSignalEventGenerator *signalEventGenerator; -#endif + QHash > connections; #ifndef QT_NO_STATEMACHINE_EVENTFILTER QHash > qobjectEvents; @@ -215,10 +210,6 @@ public: }; static const Handler *handler; - -#ifdef QT_STATEMACHINE_SOLUTION - QStateMachine *q_ptr; -#endif }; QT_END_NAMESPACE diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp index d30265a..b7563d7 100644 --- a/src/gui/statemachine/qguistatemachine.cpp +++ b/src/gui/statemachine/qguistatemachine.cpp @@ -9,13 +9,8 @@ ** ****************************************************************************/ -#ifdef QT_STATEMACHINE_SOLUTION -#include "qstatemachine.h" -#include "qstatemachine_p.h" -#else #include #include -#endif #include #include -- cgit v0.12 From c89557db5b643eb8018de8ca87e5e56140ed6d2d Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Wed, 13 May 2009 12:40:27 +0200 Subject: Doc: Work on QStateMachine class description Reviewed-by: Kent Hansen --- src/corelib/statemachine/qstatemachine.cpp | 140 +++++++++++++++++------------ 1 file changed, 85 insertions(+), 55 deletions(-) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 24af8e4..42e965a 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -89,68 +89,98 @@ QT_BEGIN_NAMESPACE \since 4.6 \ingroup statemachine - The QStateMachine class provides a hierarchical finite state machine based - on \l{Statecharts: A visual formalism for complex systems}{Statecharts} - concepts and notation. QStateMachine is part of \l{The State Machine - Framework}. - - A state machine manages a set of states (QAbstractState objects) and - transitions (QAbstractTransition objects) between those states; the states - and the transitions collectively define a state graph. Once a state graph - has been defined, the state machine can execute it. QStateMachine's - execution algorithm is based on the \l{State Chart XML: State Machine - Notation for Control Abstraction}{State Chart XML (SCXML)} algorithm. - - The QState class provides a state that you can use to set properties and - invoke methods on QObjects when the state is entered or exited. This is + QStateMachine is based on the concepts and notation of + \l{Statecharts: A visual formalism for complex + systems}{Statecharts}. QStateMachine is part of \l{The State + Machine Framework}. + + A state machine manages a set of states (classes that inherit from + QAbstractState) and transitions (descendants of + QAbstractTransition) between those states; these states and + transitions define a state graph. Once a state graph has been + built, the state machine can execute it. \l{QStateMachine}'s + execution algorithm is based on the \l{State Chart XML: State + Machine Notation for Control Abstraction}{State Chart XML (SCXML)} + algorithm. The framework's \l{The State Machine + Framework}{overview} gives several state graphs and the code to + build them. + + The rootState() is the parent of all top-level states in the + machine; it is used, for instance, when the state graph is + deleted. It is created by the machine. + + Use the addState() function to add a state to the state machine. + All top-level states are added to the root state. States are + removed with the removeState() function. Removing states while the + machine is running is discouraged. + + Before the machine can be started, the \l{initialState}{initial + state} must be set. The initial state is the state that the + machine enters when started. You can then start() the state + machine. The started() signal is emitted when the initial state is + entered. + + The machine is event driven and keeps its own event loop. Events + are posted to the machine through postEvent(). Note that this + means that it executes asynchronously, and that it will not + progress without a running event loop. You will normally not have + to post events to the machine directly as Qt's transitions, e.g., + QEventTransition and its subclasses, handle this. But for custom + transitions triggered by events, postEvent() is useful. + + The state machine processes events and takes transitions until a + top-level final state is entered; the state machine then emits the + finished() signal. You can also stop() the state machine + explicitly. The stopped() signal is emitted in this case. + + The following snippet shows a state machine that will finish when a button + is clicked: + + \code + QPushButton button; + + QStateMachine machine; + QState *s1 = new QState(); + s1->assignProperty(&button, "text", "Click me"); + + QFinalState *s2 = new QFinalState(); + s1->addTransition(&button, SIGNAL(clicked()), s2); + + machine.addState(s1); + machine.addState(s2); + machine.setInitialState(s1); + machine.start(); + \endcode + + This code example uses QState, which inherits QAbstractState. The + QState class provides a state that you can use to set properties + and invoke methods on \l{QObject}s when the state is entered or + exited. It also contains convenience functions for adding + transitions, e.g., \l{QSignalTransition}s as in this example. See + the QState class description for further details. + + If an error is encountered, the machine will enter the + \l{errorState}{error state}, which is a special state created by + the machine. The types of errors possible are described by the + \l{QStateMachine::}{Error} enum. After the error state is entered, + the type of the error can be retrieved with error(). The execution + of the state graph will not stop when the error state is entered. + So it is possible to handle the error, for instance, by connecting + to the \l{QAbstractState::}{entered()} signal of the error state. + It is also possible to set a custom error state with + setErrorState(). + + \omit This stuff will be moved elsewhere +This is typically used in conjunction with \l{Signals and Slots}{signals}; the signals determine the flow of the state graph, whereas the states' property assignments and method invocations are the actions. - Use the addState() function to add a state to the state machine; - alternatively, pass the machine's rootState() to the state constructor. Use - the removeState() function to remove a state from the state machine. - - The following snippet shows a state machine that will finish when a button - is clicked: - - \code - QPushButton button; - - QStateMachine machine; - QState *s1 = new QState(); - s1->assignProperty(&button, "text", "Click me"); - - QFinalState *s2 = new QFinalState(); - s1->addTransition(&button, SIGNAL(clicked()), s2); - - machine.addState(s1); - machine.addState(s2); - machine.setInitialState(s1); - machine.start(); - \endcode - - The setInitialState() function sets the state machine's initial state; this - state is entered when the state machine is started. - - The start() function starts the state machine. The state machine executes - asynchronously, i.e. you need to run an event loop in order for it to make - progress. The started() signal is emitted when the state machine has entered - the initial state. - - The state machine processes events and takes transitions until a top-level - final state is entered; the state machine then emits the finished() signal. - - The stop() function stops the state machine. The stopped() signal is emitted - when the state machine has stopped. - The postEvent() function posts an event to the state machine. This is useful when you are using custom events to trigger transitions. + \endomit - The rootState() function returns the state machine's root state. All - top-level states have the root state as their parent. - - \sa QAbstractState, QAbstractTransition + \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework} */ /*! -- cgit v0.12 From 589dfd480d6158aaa59ab56c8be6a6bfc41da3ef Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 13 May 2009 12:59:07 +0200 Subject: qdoc: Fixed some qdoc errors. --- doc/src/examples/fancybrowser.qdoc | 14 +++++++------- src/corelib/tools/qhash.cpp | 6 +++--- tools/designer/src/uitools/quiloader.cpp | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/src/examples/fancybrowser.qdoc b/doc/src/examples/fancybrowser.qdoc index ea4da71..631aff9 100644 --- a/doc/src/examples/fancybrowser.qdoc +++ b/doc/src/examples/fancybrowser.qdoc @@ -123,7 +123,7 @@ The first jQuery-based function, \c highlightAllLinks(), is designed to highlight all links in the current webpage. The JavaScript code looks - for web elements named \i {a}, which is the tag for a hyperlink. + for web elements named \e {a}, which is the tag for a hyperlink. For each such element, the background color is set to be yellow by using CSS. @@ -131,18 +131,18 @@ The \c rotateImages() function rotates the images on the current web page. Webkit supports CSS transforms and this JavaScript code - looks up all \i {img} elements and rotates the images 180 degrees + looks up all \e {img} elements and rotates the images 180 degrees and then back again. \snippet examples/webkit/fancybrowser/mainwindow.cpp 9 The remaining four methods remove different elements from the current web page. \c removeGifImages() removes all Gif images on the page by looking up - the \i {src} attribute of all the elements on the web page. Any element with - a \i {gif} file as its source is removed. \c removeInlineFrames() removes all - \i {iframe} or inline elements. \c removeObjectElements() removes all - \i {object} elements, and \c removeEmbeddedElements() removes any elements - such as plugins embedded on the page using the \i {embed} tag. + the \e {src} attribute of all the elements on the web page. Any element with + a \e {gif} file as its source is removed. \c removeInlineFrames() removes all + \e {iframe} or inline elements. \c removeObjectElements() removes all + \e {object} elements, and \c removeEmbeddedElements() removes any elements + such as plugins embedded on the page using the \e {embed} tag. */ diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index b2512e1..6c4a3ba 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -379,8 +379,7 @@ void QHashData::checkSanity() #endif /*! - \fn uint qHash(const QPair &key) - \relates QHash + \ \since 4.3 Returns the hash value for the \a key. @@ -502,7 +501,8 @@ void QHashData::checkSanity() key. With QHash, the items are arbitrarily ordered. \i The key type of a QMap must provide operator<(). The key type of a QHash must provide operator==() and a global - \l{qHash()} {hash} function. + hash function called qHash() (see the related non-member + functions). \endlist Here's an example QHash with QString keys and \c int values: diff --git a/tools/designer/src/uitools/quiloader.cpp b/tools/designer/src/uitools/quiloader.cpp index 548f07e..2a66095 100644 --- a/tools/designer/src/uitools/quiloader.cpp +++ b/tools/designer/src/uitools/quiloader.cpp @@ -572,9 +572,9 @@ void QUiLoaderPrivate::setupWidgetMap() const \class QUiLoader \inmodule QtUiTools - \brief enables standalone applications to dynamically create user - interfaces at run-time using the information stored in .ui files or - specified in plugin paths. + \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. In addition, you can customize or create your own user interface by deriving your own loader class. -- cgit v0.12 From 8a7f9857350c50dc77d2a39a864b22cdaffa78ff Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 13 May 2009 12:48:22 +0200 Subject: Fix warning Reviewed-by: Denis --- src/gui/kernel/qdnd_x11.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index ed93b34..9b2305d 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -543,7 +543,7 @@ bool QX11Data::xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data (dm->xdndMimeTransferedPixmapIndex + 1) % 2; } } else { - DEBUG("QClipboard: xdndMimeDataForAtom(): converting to type '%s' is not supported", atomName); + DEBUG("QClipboard: xdndMimeDataForAtom(): converting to type '%s' is not supported", qPrintable(atomName)); } } return data; @@ -624,7 +624,6 @@ QVariant QX11Data::xdndMimeConvertToFormat(Atom a, const QByteArray &data, const if (format == QLatin1String("image/ppm")) { if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { Pixmap xpm = *((Pixmap*)data.data()); - Display *dpy = display; if (!xpm) return QByteArray(); QPixmap qpm = QPixmap::fromX11Pixmap(xpm); -- cgit v0.12 From db5c26f49d86d195306273038a84a48b3ea62719 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 13 May 2009 13:18:00 +0200 Subject: doc: Add screenshot for Tank Game Example --- doc/src/images/tankgame-example.png | Bin 0 -> 16089 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 doc/src/images/tankgame-example.png diff --git a/doc/src/images/tankgame-example.png b/doc/src/images/tankgame-example.png new file mode 100644 index 0000000..9e17e30 Binary files /dev/null and b/doc/src/images/tankgame-example.png differ -- cgit v0.12 From d1f79472826577406a675de61122cd4fc9413c52 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 13 May 2009 13:31:34 +0200 Subject: more statemachine docs --- doc/src/images/statemachine-customevents2.png | Bin 0 -> 6713 bytes doc/src/statemachine.qdoc | 45 +++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 doc/src/images/statemachine-customevents2.png diff --git a/doc/src/images/statemachine-customevents2.png b/doc/src/images/statemachine-customevents2.png new file mode 100644 index 0000000..57b37ef Binary files /dev/null and b/doc/src/images/statemachine-customevents2.png differ diff --git a/doc/src/statemachine.qdoc b/doc/src/statemachine.qdoc index 27bd4f8..5a89f4d 100644 --- a/doc/src/statemachine.qdoc +++ b/doc/src/statemachine.qdoc @@ -147,6 +147,9 @@ QObject::connect(s3, SIGNAL(exited()), button, SLOT(showMinimized())); \endcode + Custom states can reimplement QAbstractState::onEntry() and + QAbstractState::onExit(). + \section1 State Machines That Finish The state machine defined in the previous section never finishes. In order @@ -155,6 +158,9 @@ final state, the machine will emit the QStateMachine::finished() signal and halt. + All you need to do to introduce a final state in the graph is create a + QFinalState object and use it as the target of one or more transitions. + \section1 Sharing Transitions By Grouping States Assume we wanted the user to be able to quit the application at any time by @@ -315,16 +321,32 @@ \section1 Detecting that a Composite State has Finished A child state can be final (a QFinalState object); when a final child state - is entered, the parent state emits the QState::finished() signal. + is entered, the parent state emits the QState::finished() signal. The + following diagram shows a composite state \c s1 which does some processing + before entering a final state: \img statemachine-finished.png \omit \caption This is a caption \endomit - This is useful when you want to hide the internal details of a state; - i.e. the only thing the outside world should be able to do is enter the - state, and get a notification when the state has completed its work. + When \c s1 's final state is entered, \c s1 will automatically emit + finished(). We use a signal transition to cause this event to trigger a + state change: + + \code + s1->addTransition(s1, SIGNAL(finished()), s2); + \endcode + + Using final states in composite states is useful when you want to hide the + internal details of a composite state; i.e. the only thing the outside world + should be able to do is enter the state, and get a notification when the + state has completed its work. This is a very powerful abstraction and + encapsulation mechanism when building complex (deeply nested) state + machines. (In the above example, you could of course create a transition + directly from \c s1 's \c done state rather than relying on \c s1 's + finished() signal, but with the consequence that implementation details of + \c s1 are exposed and depended on). For parallel state groups, the QState::finished() signal is emitted when \e all the child states have entered final states. @@ -425,7 +447,20 @@ machine.postEvent(new StringEvent("Hello")); machine.postEvent(new StringEvent("world")); \endcode - + + An event that is not handled by any relevant transition will be silently + consumed by the state machine. It can be useful to group states and provide + a default handling of such events; for example, as illustrated in the + following statechart: + + \img statemachine-customevents2.png + \omit + \caption This is a caption + \endomit + + For deeply nested statecharts, you can add such "fallback" transitions at + the level of granularity that's most appropriate. + \section1 Using Restore Policy To Automatically Restore Properties In some state machines it can be useful to focus the attention on assigning properties in states, -- cgit v0.12 From 0076f04c3637aaebb4d70d7c7e5fd0a78527c260 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 13 May 2009 11:00:40 +0200 Subject: QRingBuffer: Enanced with readPointerAtPosition Ability to read from a QRingBuffer at any position without modifying it. --- src/corelib/tools/qringbuffer_p.h | 46 +++++++ tests/auto/auto.pro | 1 + tests/auto/qringbuffer/qringbuffer.pro | 6 + tests/auto/qringbuffer/tst_qringbuffer.cpp | 200 +++++++++++++++++++++++++++++ 4 files changed, 253 insertions(+) create mode 100644 tests/auto/qringbuffer/qringbuffer.pro create mode 100644 tests/auto/qringbuffer/tst_qringbuffer.cpp diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index eed4ba9..02cc497 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -74,6 +74,52 @@ public: return buffers.isEmpty() ? 0 : (buffers.first().constData() + head); } + // access the bytes at a specified position + // the out-variable length will contain the amount of bytes readable + // from there, e.g. the amount still the same QByteArray + inline const char *readPointerAtPosition(qint64 pos, qint64 &length) const { + if (buffers.isEmpty()) { + length = 0; + return 0; + } + + if (pos >= bufferSize) { + length = 0; + return 0; + } + + // special case: it is in the first buffer + int nextDataBlockSizeValue = nextDataBlockSize(); + if (pos - head < nextDataBlockSizeValue) { + length = nextDataBlockSizeValue - pos; + return buffers.at(0).constData() + head + pos; + } + + // special case: we only had one buffer and tried to read over it + if (buffers.length() == 1) { + length = 0; + return 0; + } + + // skip the first + pos -= nextDataBlockSizeValue; + + // normal case: it is somewhere in the second to the-one-before-the-tailBuffer + for (int i = 1; i < tailBuffer; i++) { + if (pos >= buffers[i].size()) { + pos -= buffers[i].size(); + continue; + } + + length = buffers[i].length() - pos; + return buffers[i].constData() + pos; + } + + // it is in the tail buffer + length = tail - pos; + return buffers[tailBuffer].constData() + pos; + } + inline void free(int bytes) { bufferSize -= bytes; if (bufferSize < 0) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 443ee7e..a3a6916 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -238,6 +238,7 @@ SUBDIRS += bic \ qregexpvalidator \ qregion \ qresourceengine \ + qringbuffer \ qscriptable \ qscriptclass \ qscriptcontext \ diff --git a/tests/auto/qringbuffer/qringbuffer.pro b/tests/auto/qringbuffer/qringbuffer.pro new file mode 100644 index 0000000..91fb0a0 --- /dev/null +++ b/tests/auto/qringbuffer/qringbuffer.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +SOURCES += tst_qringbuffer.cpp + +QT = core + + diff --git a/tests/auto/qringbuffer/tst_qringbuffer.cpp b/tests/auto/qringbuffer/tst_qringbuffer.cpp new file mode 100644 index 0000000..c741c2e --- /dev/null +++ b/tests/auto/qringbuffer/tst_qringbuffer.cpp @@ -0,0 +1,200 @@ +/**************************************************************************** +** +** 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 + +class tst_QRingBuffer : public QObject +{ + Q_OBJECT + +public: + tst_QRingBuffer(); + virtual ~tst_QRingBuffer(); +public slots: + void initTestCase(); + void cleanupTestCase(); +private slots: + void readPointerAtPositionWriteRead(); + void readPointerAtPositionEmptyRead(); + void readPointerAtPositionWithHead(); + void readPointerAtPositionReadTooMuch(); + void sizeWhenEmpty(); + void sizeWhenReservedAndChopped(); + void sizeWhenReserved(); +}; + +tst_QRingBuffer::tst_QRingBuffer() +{ +} + +tst_QRingBuffer::~tst_QRingBuffer() +{ +} + +void tst_QRingBuffer::initTestCase() +{ +} + +void tst_QRingBuffer::cleanupTestCase() +{ +} + +void tst_QRingBuffer::sizeWhenReserved() +{ + QRingBuffer ringBuffer; + ringBuffer.reserve(5); + + QCOMPARE(ringBuffer.size(), 5); +} + +void tst_QRingBuffer::sizeWhenReservedAndChopped() +{ + QRingBuffer ringBuffer; + ringBuffer.reserve(31337); + ringBuffer.chop(31337); + + QCOMPARE(ringBuffer.size(), 0); +} + +void tst_QRingBuffer::sizeWhenEmpty() +{ + QRingBuffer ringBuffer; + + QCOMPARE(ringBuffer.size(), 0); +} + +void tst_QRingBuffer::readPointerAtPositionReadTooMuch() +{ + QRingBuffer ringBuffer; + + qint64 length; + const char *buf = ringBuffer.readPointerAtPosition(42, length); + QVERIFY(buf == 0); + QVERIFY(length == 0); +} + +void tst_QRingBuffer::readPointerAtPositionWithHead() +{ + QRingBuffer ringBuffer; + char *buf = ringBuffer.reserve(4); + memcpy (buf, "0123", 4); + ringBuffer.free(2); + + // ringBuffer should have stayed the same except + // its head it had moved to position 2 + qint64 length; + const char* buf2 = ringBuffer.readPointerAtPosition(0, length); + + QCOMPARE(length, qint64(2)); + QVERIFY(*buf2 == '2'); + QVERIFY(*(buf2+1) == '3'); + + // advance 2 more, ringBuffer should be empty then + ringBuffer.free(2); + buf2 = ringBuffer.readPointerAtPosition(0, length); + QCOMPARE(length, qint64(0)); + QVERIFY(buf2 == 0); +} + +void tst_QRingBuffer::readPointerAtPositionEmptyRead() +{ + QRingBuffer ringBuffer; + + qint64 length; + const char *buf = ringBuffer.readPointerAtPosition(0, length); + QVERIFY(buf == 0); + QVERIFY(length == 0); +} + +void tst_QRingBuffer::readPointerAtPositionWriteRead() +{ + //create some data + QBuffer inData; + inData.open(QIODevice::ReadWrite); + inData.putChar(0x42); + inData.putChar(0x23); + inData.write("Qt rocks!"); + for (int i = 0; i < 5000; i++) + inData.write(QString("Number %1").arg(i).toUtf8()); + inData.reset(); + QVERIFY(inData.size() > 0); + + //put the inData in the QRingBuffer + QRingBuffer ringBuffer; + qint64 remaining = inData.size(); + while (remaining > 0) { + // write in chunks of 50 bytes + // this ensures there will be multiple QByteArrays inside the QRingBuffer + // since QRingBuffer is then only using individual arrays of around 4000 bytes + qint64 thisWrite = qMin(remaining, qint64(50)); + char *pos = ringBuffer.reserve(thisWrite); + inData.read(pos, thisWrite); + remaining -= thisWrite; + } + // was data put into it? + QVERIFY(ringBuffer.size() > 0); + QCOMPARE(qint64(ringBuffer.size()), inData.size()); + + //read from the QRingBuffer in loop, put back into another QBuffer + QBuffer outData; + outData.open(QIODevice::ReadWrite); + remaining = ringBuffer.size(); + while (remaining > 0) { + qint64 thisRead; + // always try to read as much as possible + const char *buf = ringBuffer.readPointerAtPosition(ringBuffer.size() - remaining, thisRead); + outData.write(buf, thisRead); + remaining -= thisRead; + } + outData.reset(); + + QVERIFY(outData.size() > 0); + + // was the data read from the QRingBuffer the same as the one written into it? + QCOMPARE(outData.size(), inData.size()); + QVERIFY(outData.buffer().startsWith(inData.buffer())); +} + + +QTEST_APPLESS_MAIN(tst_QRingBuffer) +#include "tst_qringbuffer.moc" -- cgit v0.12 From 78866bec190ca56f977d5a4b5130bbd3d2e8c412 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 13 May 2009 11:03:03 +0200 Subject: QNonContiguousByteDevice: An wrapper around QByteArray, QIODevice, ... New private class, needed for the rewrite of the upload side of QNetworkAccessManager. Allows to have a "byte pointer view" on stuff like QRingBuffer, QByteArray, QFile and any QIODevice. Reviewed-by: Thiago Macieira Reviewed-by: Peter Hartmann --- src/corelib/io/io.pri | 2 + src/corelib/io/qnoncontiguousbytedevice.cpp | 542 ++++++++++++++++++++++++++++ src/corelib/io/qnoncontiguousbytedevice_p.h | 189 ++++++++++ 3 files changed, 733 insertions(+) create mode 100644 src/corelib/io/qnoncontiguousbytedevice.cpp create mode 100644 src/corelib/io/qnoncontiguousbytedevice_p.h diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index c62959d..8f37e25 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -12,6 +12,7 @@ HEADERS += \ io/qfileinfo.h \ io/qiodevice.h \ io/qiodevice_p.h \ + io/qnoncontiguousbytedevice_p.h \ io/qprocess.h \ io/qprocess_p.h \ io/qtextstream.h \ @@ -37,6 +38,7 @@ SOURCES += \ io/qfile.cpp \ io/qfileinfo.cpp \ io/qiodevice.cpp \ + io/qnoncontiguousbytedevice.cpp \ io/qprocess.cpp \ io/qtextstream.cpp \ io/qtemporaryfile.cpp \ diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp new file mode 100644 index 0000000..6233fde --- /dev/null +++ b/src/corelib/io/qnoncontiguousbytedevice.cpp @@ -0,0 +1,542 @@ +/**************************************************************************** +** +** 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 "qnoncontiguousbytedevice_p.h" +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QNonContiguousByteDevice + \brief A QNonContiguousByteDevice is a representation of a + file, array or buffer that allows access with a read pointer. + \since 4.6 + + \inmodule QtCore + + The goal of this class is to have a data representation that + allows us to avoid doing a memcpy as we have to do with QIODevice. + + \sa QNonContiguousByteDeviceFactory + + \internal +*/ +/*! + \fn virtual const char* QNonContiguousByteDevice::readPointer(qint64 maximumLength, qint64 &len) + + Return a byte pointer for at most \a maximumLength bytes of that device. + if \a maximumLength is -1, the caller does not care about the length and + the device may return what it desires to. + The actual number of bytes the pointer is valid for is returned in + the \a len variable. + \a len will be -1 if EOF or an error occurs. + If it was really EOF can then afterwards be checked with atEnd() + Returns 0 if it is not possible to read at that position. + + \sa atEnd() + + \internal +*/ +/*! + \fn virtual bool QNonContiguousByteDevice::advanceReadPointer(qint64 amount) + + will advance the internal read pointer by \a amount bytes. + The old readPointer is invalid after this call. + + \sa readPointer() + + \internal +*/ +/*! + \fn virtual bool QNonContiguousByteDevice::atEnd() + + Returns true if everything has been read and the read + pointer cannot be advanced anymore. + + \sa readPointer(), advanceReadPointer(), reset() + + \internal +*/ +/*! + \fn virtual bool QNonContiguousByteDevice::reset() + + Moves the internal read pointer back to the beginning. + Returns false if this was not possible. + + \sa atEnd(), disableReset() + + \internal +*/ +/*! + \fn void QNonContiguousByteDevice::disableReset() + + Disable the reset() call, e.g. it will always + do nothing and return false. + + \sa reset() + + \internal +*/ +/*! + \fn virtual qint64 QNonContiguousByteDevice::size() + + Returns the size of the complete device or -1 if unknown. + May also return less/more than what can be actually read with readPointer() + + \internal +*/ +/*! + \fn void QNonContiguousByteDevice::readyRead() + + Emitted when there is data available + + \internal +*/ +/*! + \fn void QNonContiguousByteDevice::readProgress(qint64 current, qint64 total) + + Emitted when data has been "read" by advancing the read pointer + + \internal +*/ + +QNonContiguousByteDevice::QNonContiguousByteDevice() : QObject((QObject*)0), resetDisabled(false) +{ +}; + +QNonContiguousByteDevice::~QNonContiguousByteDevice() +{ +}; + +void QNonContiguousByteDevice::disableReset() +{ + resetDisabled = true; +} + +QNonContiguousByteDeviceBufferImpl::QNonContiguousByteDeviceBufferImpl(QBuffer *b) : QNonContiguousByteDevice() +{ + buffer = b; + byteArray = QByteArray::fromRawData(buffer->buffer().constData() + buffer->pos(), buffer->size() - buffer->pos()); + arrayImpl = new QNonContiguousByteDeviceByteArrayImpl(&byteArray); + arrayImpl->setParent(this); + connect(arrayImpl, SIGNAL(readyRead()), SIGNAL(readyRead())); + connect(arrayImpl, SIGNAL(readProgress(qint64,qint64)), SIGNAL(readProgress(qint64,qint64))); +} + +QNonContiguousByteDeviceBufferImpl::~QNonContiguousByteDeviceBufferImpl() +{ +} + +const char* QNonContiguousByteDeviceBufferImpl::readPointer(qint64 maximumLength, qint64 &len) +{ + return arrayImpl->readPointer(maximumLength, len); +} + +bool QNonContiguousByteDeviceBufferImpl::advanceReadPointer(qint64 amount) +{ + return arrayImpl->advanceReadPointer(amount); +} + +bool QNonContiguousByteDeviceBufferImpl::atEnd() +{ + return arrayImpl->atEnd(); +} + +bool QNonContiguousByteDeviceBufferImpl::reset() +{ + if (resetDisabled) + return false; + return arrayImpl->reset(); +} + +qint64 QNonContiguousByteDeviceBufferImpl::size() +{ + return arrayImpl->size(); +} + +QNonContiguousByteDeviceByteArrayImpl::QNonContiguousByteDeviceByteArrayImpl(QByteArray *ba) : QNonContiguousByteDevice(), currentPosition(0) +{ + byteArray = ba; +} + +QNonContiguousByteDeviceByteArrayImpl::~QNonContiguousByteDeviceByteArrayImpl() +{ +} + +const char* QNonContiguousByteDeviceByteArrayImpl::readPointer(qint64 maximumLength, qint64 &len) +{ + if (atEnd()) { + len = -1; + return 0; + } + + if (maximumLength != -1) + len = qMin(maximumLength, size() - currentPosition); + else + len = size() - currentPosition; + + return byteArray->constData() + currentPosition; +} + +bool QNonContiguousByteDeviceByteArrayImpl::advanceReadPointer(qint64 amount) +{ + currentPosition += amount; + emit readProgress(currentPosition, size()); + return true; +} + +bool QNonContiguousByteDeviceByteArrayImpl::atEnd() +{ + return currentPosition >= size(); +} + +bool QNonContiguousByteDeviceByteArrayImpl::reset() +{ + if (resetDisabled) + return false; + + currentPosition = 0; + return true; +} + +qint64 QNonContiguousByteDeviceByteArrayImpl::size() +{ + return byteArray->size(); +} + +QNonContiguousByteDeviceRingBufferImpl::QNonContiguousByteDeviceRingBufferImpl(QRingBuffer *rb) + : QNonContiguousByteDevice(), currentPosition(0) +{ + ringBuffer = rb; +} + +QNonContiguousByteDeviceRingBufferImpl::~QNonContiguousByteDeviceRingBufferImpl() +{ +}; + +const char* QNonContiguousByteDeviceRingBufferImpl::readPointer(qint64 maximumLength, qint64 &len) +{ + if (atEnd()) { + len = -1; + return 0; + } + + const char *returnValue = ringBuffer->readPointerAtPosition(currentPosition, len); + + if (maximumLength != -1) + len = qMin(len, maximumLength); + + return returnValue; +}; + +bool QNonContiguousByteDeviceRingBufferImpl::advanceReadPointer(qint64 amount) +{ + currentPosition += amount; + emit readProgress(currentPosition, size()); + return true; +}; + +bool QNonContiguousByteDeviceRingBufferImpl::atEnd() +{ + return currentPosition >= size(); +}; + +bool QNonContiguousByteDeviceRingBufferImpl::reset() +{ + if (resetDisabled) + return false; + + currentPosition = 0; + return true; +}; + +qint64 QNonContiguousByteDeviceRingBufferImpl::size() +{ + return ringBuffer->size(); +}; + +QNonContiguousByteDeviceIoDeviceImpl::QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d) + : QNonContiguousByteDevice(), + currentReadBuffer(0), currentReadBufferSize(16*1024), + currentReadBufferAmount(0), currentReadBufferPosition(0), totalAdvancements(0), + eof(false) +{ + device = d; + initialPosition = d->pos(); + connect(device, SIGNAL(readyRead()), this, SIGNAL(readyRead()), Qt::QueuedConnection); + connect(device, SIGNAL(readChannelFinished()), this, SIGNAL(readyRead()), Qt::QueuedConnection); +}; + +QNonContiguousByteDeviceIoDeviceImpl::~QNonContiguousByteDeviceIoDeviceImpl() +{ + delete currentReadBuffer; +}; + +const char* QNonContiguousByteDeviceIoDeviceImpl::readPointer(qint64 maximumLength, qint64 &len) +{ + if (eof == true) { + len = -1; + return 0; + } + + if (currentReadBuffer == 0) + currentReadBuffer = new QByteArray(currentReadBufferSize, '\0'); // lazy alloc + + if (maximumLength == -1) + maximumLength = currentReadBufferSize; + + if (currentReadBufferAmount - currentReadBufferPosition > 0) { + len = currentReadBufferAmount - currentReadBufferPosition; + return currentReadBuffer->data() + currentReadBufferPosition; + } + + qint64 haveRead = device->read(currentReadBuffer->data(), qMin(maximumLength, currentReadBufferSize)); + + if ((haveRead == -1) || (haveRead == 0 && device->atEnd() && !device->isSequential())) { + eof = true; + len = -1; + // size was unknown before, emit a readProgress with the final size + if (size() == -1) + emit readProgress(totalAdvancements, totalAdvancements); + return 0; + } + + currentReadBufferAmount = haveRead; + currentReadBufferPosition = 0; + + len = haveRead; + return currentReadBuffer->data(); +}; + +bool QNonContiguousByteDeviceIoDeviceImpl::advanceReadPointer(qint64 amount) +{ + totalAdvancements += amount; + + // normal advancement + currentReadBufferPosition += amount; + + // advancing over that what has actually been read before + if (currentReadBufferPosition > currentReadBufferAmount) { + qint64 i = currentReadBufferPosition - currentReadBufferAmount; + while (i > 0) { + if (device->getChar(0) == false) { + emit readProgress(totalAdvancements - i, size()); + return false; // ### FIXME handle eof + } + i--; + } + + currentReadBufferPosition = 0; + currentReadBufferAmount = 0; + } + + if (size() == -1) + emit readProgress(totalAdvancements, totalAdvancements); + else + emit readProgress(totalAdvancements, size()); + + return true; +}; + +bool QNonContiguousByteDeviceIoDeviceImpl::atEnd() +{ + return eof == true; +}; + +bool QNonContiguousByteDeviceIoDeviceImpl::reset() +{ + if (resetDisabled) + return false; + + if (device->seek(initialPosition)) { + eof = false; // assume eof is false, it will be true after a read has been attempted + return true; + } + + return false; +}; + +qint64 QNonContiguousByteDeviceIoDeviceImpl::size() +{ + // note that this is different from the size() implementation of QIODevice! + + if (device->isSequential()) + return -1; + + return device->size() - initialPosition; +}; + +QByteDeviceWrappingIoDevice::QByteDeviceWrappingIoDevice(QNonContiguousByteDevice *bd) : QIODevice((QObject*)0) +{ + byteDevice = bd; + connect(bd, SIGNAL(readyRead()), SIGNAL(readyRead())); + + open(ReadOnly); +} + +QByteDeviceWrappingIoDevice::~QByteDeviceWrappingIoDevice() +{ + +} + +bool QByteDeviceWrappingIoDevice::isSequential() const +{ + return (byteDevice->size() == -1); +} + +bool QByteDeviceWrappingIoDevice::atEnd() const +{ + return byteDevice->atEnd(); +} + +bool QByteDeviceWrappingIoDevice::reset() +{ + return byteDevice->reset(); +} + +qint64 QByteDeviceWrappingIoDevice::size() const +{ + if (isSequential()) + return 0; + + return byteDevice->size(); +} + + +qint64 QByteDeviceWrappingIoDevice::readData( char * data, qint64 maxSize) +{ + qint64 len; + const char *readPointer = byteDevice->readPointer(maxSize, len); + if (len == -1) + return -1; + + memcpy(data, readPointer, len); + byteDevice->advanceReadPointer(len); + return len; +} + +qint64 QByteDeviceWrappingIoDevice::writeData( const char* data, qint64 maxSize) +{ + return -1; +} + +/*! + \class QNonContiguousByteDeviceFactory + \since 4.6 + + \inmodule QtCore + + Creates a QNonContiguousByteDevice out of a QIODevice, + QByteArray etc. + + \sa QNonContiguousByteDevice + + \internal +*/ + +/*! + \fn static QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QIODevice *device); + + Create a QNonContiguousByteDevice out of a QIODevice. + For QFile, QBuffer and all other QIoDevice, sequential or not. + + \internal +*/ +QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QIODevice *device) +{ + // shortcut if it is a QBuffer + if (QBuffer* buffer = qobject_cast(device)) { + return new QNonContiguousByteDeviceBufferImpl(buffer); + } + + // ### FIXME special case if device is a QFile that supports map() + // then we can actually deal with the file without using read/peek + + // generic QIODevice + return new QNonContiguousByteDeviceIoDeviceImpl(device); // FIXME +}; + +/*! + \fn static QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QRingBuffer *ringBuffer); + + Create a QNonContiguousByteDevice out of a QRingBuffer. + + \internal +*/ +QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QRingBuffer *ringBuffer) +{ + return new QNonContiguousByteDeviceRingBufferImpl(ringBuffer); +}; + +/*! + \fn static QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QByteArray *byteArray); + + Create a QNonContiguousByteDevice out of a QByteArray. + + \internal +*/ +QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QByteArray *byteArray) +{ + return new QNonContiguousByteDeviceByteArrayImpl(byteArray); +}; + +/*! + \fn static QIODevice* QNonContiguousByteDeviceFactory::wrap(QNonContiguousByteDevice* byteDevice); + + Wrap the \a byteDevice (possibly again) into a QIODevice. + + \internal +*/ +QIODevice* QNonContiguousByteDeviceFactory::wrap(QNonContiguousByteDevice* byteDevice) +{ + // ### FIXME if it already has been based on QIoDevice, we could that one out again + // and save some calling + + // needed for FTP backend + + return new QByteDeviceWrappingIoDevice(byteDevice); +} + +QT_END_NAMESPACE + diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h new file mode 100644 index 0000000..2a7e40b --- /dev/null +++ b/src/corelib/io/qnoncontiguousbytedevice_p.h @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** 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 QNONCONTIGUOUSBYTEDEVICE_H +#define QNONCONTIGUOUSBYTEDEVICE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of a number of Qt sources files. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include +#include "private/qringbuffer_p.h" + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QNonContiguousByteDevice : public QObject +{ + Q_OBJECT +public: + virtual const char* readPointer(qint64 maximumLength, qint64 &len) = 0; + virtual bool advanceReadPointer(qint64 amount) = 0; + virtual bool atEnd() = 0; + virtual bool reset() = 0; + void disableReset(); + virtual qint64 size() = 0; + +protected: + QNonContiguousByteDevice(); + virtual ~QNonContiguousByteDevice(); + + bool resetDisabled; +signals: + void readyRead(); + void readProgress(qint64 current, qint64 total); +}; + +class Q_CORE_EXPORT QNonContiguousByteDeviceFactory +{ +public: + static QNonContiguousByteDevice* create(QIODevice *device); + static QNonContiguousByteDevice* create(QByteArray *byteArray); + static QNonContiguousByteDevice* create(QRingBuffer *ringBuffer); + static QIODevice* wrap(QNonContiguousByteDevice* byteDevice); +}; + +// the actual implementations +// + +class QNonContiguousByteDeviceByteArrayImpl : public QNonContiguousByteDevice +{ + Q_OBJECT +public: + QNonContiguousByteDeviceByteArrayImpl(QByteArray *ba); + ~QNonContiguousByteDeviceByteArrayImpl(); + const char* readPointer(qint64 maximumLength, qint64 &len); + bool advanceReadPointer(qint64 amount); + bool atEnd(); + bool reset(); + qint64 size(); +protected: + QByteArray* byteArray; + qint64 currentPosition; +}; + +class QNonContiguousByteDeviceRingBufferImpl : public QNonContiguousByteDevice +{ + Q_OBJECT +public: + QNonContiguousByteDeviceRingBufferImpl(QRingBuffer *rb); + ~QNonContiguousByteDeviceRingBufferImpl(); + const char* readPointer(qint64 maximumLength, qint64 &len); + bool advanceReadPointer(qint64 amount); + bool atEnd(); + bool reset(); + qint64 size(); +protected: + QRingBuffer* ringBuffer; + qint64 currentPosition; +}; + + +class QNonContiguousByteDeviceIoDeviceImpl : public QNonContiguousByteDevice +{ + Q_OBJECT +public: + QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d); + ~QNonContiguousByteDeviceIoDeviceImpl(); + const char* readPointer(qint64 maximumLength, qint64 &len); + bool advanceReadPointer(qint64 amount); + bool atEnd(); + bool reset(); + qint64 size(); +protected: + QIODevice* device; + QByteArray* currentReadBuffer; + qint64 currentReadBufferSize; + qint64 currentReadBufferAmount; + qint64 currentReadBufferPosition; + qint64 totalAdvancements; + bool eof; + qint64 initialPosition; +}; + +class QNonContiguousByteDeviceBufferImpl : public QNonContiguousByteDevice +{ + Q_OBJECT +public: + QNonContiguousByteDeviceBufferImpl(QBuffer *b); + ~QNonContiguousByteDeviceBufferImpl(); + const char* readPointer(qint64 maximumLength, qint64 &len); + bool advanceReadPointer(qint64 amount); + bool atEnd(); + bool reset(); + qint64 size(); +protected: + QBuffer* buffer; + QByteArray byteArray; + QNonContiguousByteDeviceByteArrayImpl* arrayImpl; +}; + +// ... and the reverse thing +class QByteDeviceWrappingIoDevice : public QIODevice +{ + Q_OBJECT +public: + QByteDeviceWrappingIoDevice (QNonContiguousByteDevice *bd); + ~QByteDeviceWrappingIoDevice (); + virtual bool isSequential () const; + virtual bool atEnd () const; + virtual bool reset (); + virtual qint64 size () const; +protected: + virtual qint64 readData ( char * data, qint64 maxSize ); + virtual qint64 writeData ( const char * data, qint64 maxSize ); + + QNonContiguousByteDevice *byteDevice; +}; + +QT_END_NAMESPACE + +#endif -- cgit v0.12 From 66534102f76c89c6f07f42dab0a47b0d2debec97 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 13 May 2009 13:06:43 +0200 Subject: QNAM: Added DoNotBufferUploadDataAttribute Reviewed-by: Thiago Macieira --- src/network/access/qnetworkrequest.cpp | 7 +++++++ src/network/access/qnetworkrequest.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 56b793d..8b1afba 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -162,6 +162,13 @@ QT_BEGIN_NAMESPACE Indicates whether the data was obtained from cache or not. + \value DoNotBufferUploadDataAttribute + Requests only, type: QVariant::Bool (default: false) + Indicates whether the QNetworkAccessManager code is + allowed to buffer the upload data, e.g. when doing a HTTP POST. + When using this flag with sequential upload data, the ContentLengthHeader + header must be set. + \value User Special type. Additional information can be passed in QVariants with types ranging from User to UserMax. The default diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h index 6f34bce..5dea1df 100644 --- a/src/network/access/qnetworkrequest.h +++ b/src/network/access/qnetworkrequest.h @@ -75,6 +75,7 @@ public: CacheLoadControlAttribute, CacheSaveControlAttribute, SourceIsFromCacheAttribute, + DoNotBufferUploadDataAttribute, User = 1000, UserMax = 32767 -- cgit v0.12 From 9d827648b7618cd3bdad6548e83b1d16453c96bf Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 13 May 2009 13:12:25 +0200 Subject: QNAM: Upload architecture change: HTTP implementation Reviewed-by: Peter Hartmann Reviewed-by: Thiago Macieira --- src/network/access/qhttpnetworkconnection.cpp | 215 ++++++++++++++------------ src/network/access/qhttpnetworkconnection_p.h | 8 +- src/network/access/qhttpnetworkreply.cpp | 12 +- src/network/access/qhttpnetworkreply_p.h | 7 +- src/network/access/qhttpnetworkrequest.cpp | 19 +-- src/network/access/qhttpnetworkrequest_p.h | 9 +- 6 files changed, 144 insertions(+), 126 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 5940fba..af0ac84 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qhttpnetworkconnection_p.h" +#include "private/qnoncontiguousbytedevice_p.h" #include #include #include @@ -71,6 +72,7 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host #ifndef QT_NO_NETWORKPROXY , networkProxy(QNetworkProxy::NoProxy) #endif + { } @@ -205,12 +207,19 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) // add missing fields for the request QByteArray value; // check if Content-Length is provided - QIODevice *data = request.data(); - if (data && request.contentLength() == -1) { - if (!data->isSequential()) - request.setContentLength(data->size()); - else - bufferData(messagePair); // ### or do chunked upload + QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); + if (uploadByteDevice) { + if (request.contentLength() != -1 && uploadByteDevice->size() != -1) { + // both values known, take the smaller one. + request.setContentLength(qMin(uploadByteDevice->size(), request.contentLength())); + } else if (request.contentLength() == -1 && uploadByteDevice->size() != -1) { + // content length not supplied by user, but the upload device knows it + request.setContentLength(uploadByteDevice->size()); + } else if (request.contentLength() != -1 && uploadByteDevice->size() == -1) { + // everything OK, the user supplied us the contentLength + } else if (request.contentLength() == -1 && uploadByteDevice->size() == -1) { + qFatal("QHttpNetworkConnectionPrivate: Neither content-length nor upload device size were given"); + } } // set the Connection/Proxy-Connection: Keep-Alive headers #ifndef QT_NO_NETWORKPROXY @@ -361,18 +370,12 @@ bool QHttpNetworkConnectionPrivate::sendRequest(QAbstractSocket *socket) false); #endif socket->write(header); - QIODevice *data = channels[i].request.d->data; - QHttpNetworkReply *reply = channels[i].reply; - if (reply && reply->d_func()->requestDataBuffer.size()) - data = &channels[i].reply->d_func()->requestDataBuffer; - if (data && (data->isOpen() || data->open(QIODevice::ReadOnly))) { - if (data->isSequential()) { - channels[i].bytesTotal = -1; - QObject::connect(data, SIGNAL(readyRead()), q, SLOT(_q_dataReadyReadNoBuffer())); - QObject::connect(data, SIGNAL(readChannelFinished()), q, SLOT(_q_dataReadyReadNoBuffer())); - } else { - channels[i].bytesTotal = data->size(); - } + QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice(); + if (uploadByteDevice) { + // connect the signals so this function gets called again + QObject::connect(uploadByteDevice, SIGNAL(readyRead()), q, SLOT(_q_uploadDataReadyRead())); + + channels[i].bytesTotal = channels[i].request.contentLength(); } else { channels[i].state = WaitingState; break; @@ -380,30 +383,81 @@ bool QHttpNetworkConnectionPrivate::sendRequest(QAbstractSocket *socket) // write the initial chunk together with the headers // fall through } - case WritingState: { // write the data - QIODevice *data = channels[i].request.d->data; - if (channels[i].reply->d_func()->requestDataBuffer.size()) - data = &channels[i].reply->d_func()->requestDataBuffer; - if (!data || channels[i].bytesTotal == channels[i].written) { + case WritingState: + { + // write the data + QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice(); + if (!uploadByteDevice || channels[i].bytesTotal == channels[i].written) { + if (uploadByteDevice) + emit channels[i].reply->dataSendProgress(channels[i].written, channels[i].bytesTotal); channels[i].state = WaitingState; // now wait for response + sendRequest(socket); break; } - QByteArray chunk; - chunk.resize(ChunkSize); - qint64 readSize = data->read(chunk.data(), ChunkSize); - if (readSize == -1) { - // source has reached EOF - channels[i].state = WaitingState; // now wait for response - } else if (readSize > 0) { - // source gave us something useful - channels[i].written += socket->write(chunk.data(), readSize); - if (channels[i].reply) - emit channels[i].reply->dataSendProgress(channels[i].written, channels[i].bytesTotal); + // only feed the QTcpSocket buffer when there is less than 32 kB in it + const qint64 socketBufferFill = 32*1024; + const qint64 socketWriteMaxSize = 16*1024; + + +#ifndef QT_NO_OPENSSL + QSslSocket *sslSocket = qobject_cast(socket); + while ((sslSocket->encryptedBytesToWrite() + sslSocket->bytesToWrite()) <= socketBufferFill + && channels[i].bytesTotal != channels[i].written) +#else + while (socket->bytesToWrite() <= socketBufferFill + && channels[i].bytesTotal != channels[i].written) +#endif + { + // get pointer to upload data + qint64 currentReadSize; + qint64 desiredReadSize = qMin(socketWriteMaxSize, channels[i].bytesTotal - channels[i].written); + const char *readPointer = uploadByteDevice->readPointer(desiredReadSize, currentReadSize); + + if (currentReadSize == -1) { + // premature eof happened + emitReplyError(socket, channels[i].reply, QNetworkReply::UnknownNetworkError); + return false; + break; + } else if (readPointer == 0 || currentReadSize == 0) { + // nothing to read currently, break the loop + break; + } else { + qint64 currentWriteSize = socket->write(readPointer, currentReadSize); + if (currentWriteSize == -1 || currentWriteSize != currentReadSize) { + // socket broke down + emitReplyError(socket, channels[i].reply, QNetworkReply::UnknownNetworkError); + return false; + } else { + channels[i].written += currentWriteSize; + uploadByteDevice->advanceReadPointer(currentWriteSize); + + emit channels[i].reply->dataSendProgress(channels[i].written, channels[i].bytesTotal); + + if (channels[i].written == channels[i].bytesTotal) { + // make sure this function is called once again + channels[i].state = WaitingState; + sendRequest(socket); + break; + } + } + } } break; } + case WaitingState: + { + QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice(); + if (uploadByteDevice) { + QObject::disconnect(uploadByteDevice, SIGNAL(readyRead()), q, SLOT(_q_uploadDataReadyRead())); + } + // ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called + // this is needed if the sends an reply before we have finished sending the request. In that + // case receiveReply had been called before but ignored the server reply + receiveReply(socket, channels[i].reply); + break; + } case ReadingState: case Wait4AuthState: // ignore _q_bytesWritten in these states @@ -479,6 +533,9 @@ bool QHttpNetworkConnectionPrivate::expand(QAbstractSocket *socket, QHttpNetwork // make sure that the reply is valid if (channels[i].reply != reply) return true; + // emit dataReadProgress signal (signal is currently not connected + // to the rest of QNAM) since readProgress of the + // QNonContiguousByteDevice is used emit reply->dataReadProgress(reply->d_func()->totalProgress, 0); // make sure that the reply is valid if (channels[i].reply != reply) @@ -569,6 +626,9 @@ void QHttpNetworkConnectionPrivate::receiveReply(QAbstractSocket *socket, QHttpN // make sure that the reply is valid if (channels[i].reply != reply) return; + // emit dataReadProgress signal (signal is currently not connected + // to the rest of QNAM) since readProgress of the + // QNonContiguousByteDevice is used emit reply->dataReadProgress(reply->d_func()->totalProgress, reply->d_func()->bodyLength); // make sure that the reply is valid if (channels[i].reply != reply) @@ -635,8 +695,25 @@ void QHttpNetworkConnectionPrivate::handleStatus(QAbstractSocket *socket, QHttpN case 407: handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend); if (resend) { + int i = indexOf(socket); + + QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice(); + if (uploadByteDevice) { + if (uploadByteDevice->reset()) { + channels[i].written = 0; + } else { + emitReplyError(socket, reply, QNetworkReply::ContentReSendError); + break; + } + } + eraseData(reply); - sendRequest(socket); + + // also use async _q_startNextRequest so we dont break with closed + // proxy or server connections.. + channels[i].resendCurrent = true; + QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); + } break; default: @@ -970,6 +1047,7 @@ void QHttpNetworkConnectionPrivate::_q_bytesWritten(qint64 bytes) QAbstractSocket *socket = qobject_cast(q->sender()); if (!socket) return; // ### error + // bytes have been written to the socket. write even more of them :) if (isSocketWriting(socket)) sendRequest(socket); // otherwise we do nothing @@ -1128,80 +1206,21 @@ void QHttpNetworkConnectionPrivate::_q_proxyAuthenticationRequired(const QNetwor } #endif -void QHttpNetworkConnectionPrivate::_q_dataReadyReadNoBuffer() +void QHttpNetworkConnectionPrivate::_q_uploadDataReadyRead() { Q_Q(QHttpNetworkConnection); - // data emitted either readyRead() + // upload data emitted readyRead() // find out which channel it is for - QIODevice *sender = qobject_cast(q->sender()); + QObject *sender = q->sender(); - // won't match anything if the qobject_cast above failed for (int i = 0; i < channelCount; ++i) { - if (sender == channels[i].request.data()) { + if (sender == channels[i].request.uploadByteDevice()) { sendRequest(channels[i].socket); break; } } } -void QHttpNetworkConnectionPrivate::_q_dataReadyReadBuffer() -{ - Q_Q(QHttpNetworkConnection); - QIODevice *sender = qobject_cast(q->sender()); - HttpMessagePair *thePair = 0; - for (int i = 0; !thePair && i < lowPriorityQueue.size(); ++i) - if (lowPriorityQueue.at(i).first.data() == sender) - thePair = &lowPriorityQueue[i]; - - for (int i = 0; !thePair && i < highPriorityQueue.size(); ++i) - if (highPriorityQueue.at(i).first.data() == sender) - thePair = &highPriorityQueue[i]; - - if (thePair) { - bufferData(*thePair); - - // are we finished buffering? - if (!thePair->second->d_func()->requestIsBuffering) - _q_startNextRequest(); - } -} - -void QHttpNetworkConnectionPrivate::bufferData(HttpMessagePair &messagePair) -{ - Q_Q(QHttpNetworkConnection); - QHttpNetworkRequest &request = messagePair.first; - QHttpNetworkReply *reply = messagePair.second; - Q_ASSERT(request.data()); - if (!reply->d_func()->requestIsBuffering) { // first time - QObject::connect(request.data(), SIGNAL(readyRead()), q, SLOT(_q_dataReadyReadBuffer())); - QObject::connect(request.data(), SIGNAL(readChannelFinished()), q, SLOT(_q_dataReadyReadBuffer())); - reply->d_func()->requestIsBuffering = true; - reply->d_func()->requestDataBuffer.open(QIODevice::ReadWrite); - } - - // always try to read at least one byte - // ### FIXME! use a QRingBuffer - qint64 bytesToRead = qMax(1, request.data()->bytesAvailable()); - QByteArray newData; - newData.resize(bytesToRead); - qint64 bytesActuallyRead = request.data()->read(newData.data(), bytesToRead); - - if (bytesActuallyRead > 0) { - // we read something - newData.chop(bytesToRead - bytesActuallyRead); - reply->d_func()->requestDataBuffer.write(newData); - } else if (bytesActuallyRead == -1) { // last time - QObject::disconnect(request.data(), SIGNAL(readyRead()), q, SLOT(_q_dataReadyReadBuffer())); - QObject::disconnect(request.data(), SIGNAL(readChannelFinished()), q, SLOT(_q_dataReadyReadBuffer())); - - request.setContentLength(reply->d_func()->requestDataBuffer.size()); - reply->d_func()->requestDataBuffer.seek(0); - reply->d_func()->requestIsBuffering = false; - } -} - -// QHttpNetworkConnection - QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt, QObject *parent) : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt)), parent) { diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 09bd459..9b127dd 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -146,8 +146,7 @@ private: #ifndef QT_NO_NETWORKPROXY Q_PRIVATE_SLOT(d_func(), void _q_proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)) #endif - Q_PRIVATE_SLOT(d_func(), void _q_dataReadyReadBuffer()) - Q_PRIVATE_SLOT(d_func(), void _q_dataReadyReadNoBuffer()) + Q_PRIVATE_SLOT(d_func(), void _q_uploadDataReadyRead()) #ifndef QT_NO_OPENSSL Q_PRIVATE_SLOT(d_func(), void _q_encrypted()) @@ -209,8 +208,8 @@ public: #ifndef QT_NO_NETWORKPROXY void _q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth); // from transparent proxy #endif - void _q_dataReadyReadNoBuffer(); - void _q_dataReadyReadBuffer(); + + void _q_uploadDataReadyRead(); void createAuthorization(QAbstractSocket *socket, QHttpNetworkRequest &request); bool ensureConnection(QAbstractSocket *socket); @@ -219,7 +218,6 @@ public: #ifndef QT_NO_COMPRESS bool expand(QAbstractSocket *socket, QHttpNetworkReply *reply, bool dataComplete); #endif - void bufferData(HttpMessagePair &request); void removeReply(QHttpNetworkReply *reply); QString hostName; diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index fe3f6af..4485485 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -521,13 +521,13 @@ qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QIODevice *ou { qint64 bytes = 0; if (isChunked()) { - bytes += transferChunked(socket, out); // chunked transfer encoding (rfc 2616, sec 3.6) + bytes += readReplyBodyChunked(socket, out); // chunked transfer encoding (rfc 2616, sec 3.6) } else if (bodyLength > 0) { // we have a Content-Length - bytes += transferRaw(socket, out, bodyLength - contentRead); + bytes += readReplyBodyRaw(socket, out, bodyLength - contentRead); if (contentRead + bytes == bodyLength) state = AllDoneState; } else { - bytes += transferRaw(socket, out, socket->bytesAvailable()); + bytes += readReplyBodyRaw(socket, out, socket->bytesAvailable()); } if (state == AllDoneState) socket->readAll(); // Read the rest to clean (CRLF) @@ -535,7 +535,7 @@ qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QIODevice *ou return bytes; } -qint64 QHttpNetworkReplyPrivate::transferRaw(QIODevice *in, QIODevice *out, qint64 size) +qint64 QHttpNetworkReplyPrivate::readReplyBodyRaw(QIODevice *in, QIODevice *out, qint64 size) { qint64 bytes = 0; Q_ASSERT(in); @@ -561,7 +561,7 @@ qint64 QHttpNetworkReplyPrivate::transferRaw(QIODevice *in, QIODevice *out, qint } -qint64 QHttpNetworkReplyPrivate::transferChunked(QIODevice *in, QIODevice *out) +qint64 QHttpNetworkReplyPrivate::readReplyBodyChunked(QIODevice *in, QIODevice *out) { qint64 bytes = 0; while (in->bytesAvailable()) { // while we can read from input @@ -660,4 +660,4 @@ void QHttpNetworkReply::ignoreSslErrors() QT_END_NAMESPACE -#endif // QT_NO_HTTP \ No newline at end of file +#endif // QT_NO_HTTP diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index c17c65c..238a1da 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -139,7 +139,7 @@ Q_SIGNALS: void finishedWithError(QNetworkReply::NetworkError errorCode, const QString &detail = QString()); void headerChanged(); void dataReadProgress(int done, int total); - void dataSendProgress(int done, int total); + void dataSendProgress(qint64 done, qint64 total); private: Q_DECLARE_PRIVATE(QHttpNetworkReply) @@ -162,8 +162,8 @@ public: QAuthenticatorPrivate::Method authenticationMethod(bool isProxy) const; void clear(); - qint64 transferRaw(QIODevice *in, QIODevice *out, qint64 size); - qint64 transferChunked(QIODevice *in, QIODevice *out); + qint64 readReplyBodyRaw(QIODevice *in, QIODevice *out, qint64 size); + qint64 readReplyBodyChunked(QIODevice *in, QIODevice *out); qint64 getChunkSize(QIODevice *in, qint64 *chunkSize); qint64 bytesAvailable() const; @@ -206,7 +206,6 @@ public: QByteArray responseData; // uncompressed body QByteArray compressedData; // compressed body (temporary) - QBuffer requestDataBuffer; bool requestIsBuffering; bool requestIsPrepared; }; diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index 420cb69..7df68fc 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -40,12 +40,13 @@ ****************************************************************************/ #include "qhttpnetworkrequest_p.h" +#include "private/qnoncontiguousbytedevice_p.h" QT_BEGIN_NAMESPACE QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op, QHttpNetworkRequest::Priority pri, const QUrl &newUrl) - : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), data(0), + : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0), autoDecompress(false) { } @@ -55,7 +56,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest { operation = other.operation; priority = other.priority; - data = other.data; + uploadByteDevice = other.uploadByteDevice; autoDecompress = other.autoDecompress; } @@ -67,7 +68,7 @@ bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &ot { return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) - && (data == other.data); + && (uploadByteDevice == other.uploadByteDevice); } QByteArray QHttpNetworkRequestPrivate::methodName() const @@ -109,7 +110,7 @@ QByteArray QHttpNetworkRequestPrivate::uri(bool throughProxy) const QUrl::FormattingOptions format(QUrl::RemoveFragment); // for POST, query data is send as content - if (operation == QHttpNetworkRequest::Post && !data) + if (operation == QHttpNetworkRequest::Post && !uploadByteDevice) format |= QUrl::RemoveQuery; // for requests through proxy, the Request-URI contains full url if (throughProxy) @@ -140,7 +141,7 @@ QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request // add content type, if not set in the request if (request.headerField("content-type").isEmpty()) ba += "Content-Type: application/x-www-form-urlencoded\r\n"; - if (!request.d->data && request.d->url.hasQuery()) { + if (!request.d->uploadByteDevice && request.d->url.hasQuery()) { QByteArray query = request.d->url.encodedQuery(); ba += "Content-Length: "+ QByteArray::number(query.size()) + "\r\n"; ba += "\r\n"; @@ -236,14 +237,14 @@ void QHttpNetworkRequest::setPriority(Priority priority) d->priority = priority; } -QIODevice *QHttpNetworkRequest::data() const +void QHttpNetworkRequest::setUploadByteDevice(QNonContiguousByteDevice *bd) { - return d->data; + d->uploadByteDevice = bd; } -void QHttpNetworkRequest::setData(QIODevice *data) +QNonContiguousByteDevice* QHttpNetworkRequest::uploadByteDevice() const { - d->data = data; + return d->uploadByteDevice; } int QHttpNetworkRequest::majorVersion() const diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h index d18e116..ed4325a 100644 --- a/src/network/access/qhttpnetworkrequest_p.h +++ b/src/network/access/qhttpnetworkrequest_p.h @@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE +class QNonContiguousByteDevice; + class QHttpNetworkRequestPrivate; class Q_AUTOTEST_EXPORT QHttpNetworkRequest: public QHttpNetworkHeader { @@ -104,8 +106,8 @@ public: Priority priority() const; void setPriority(Priority priority); - QIODevice *data() const; - void setData(QIODevice *data); + void setUploadByteDevice(QNonContiguousByteDevice *bd); + QNonContiguousByteDevice* uploadByteDevice() const; private: QSharedDataPointer d; @@ -113,7 +115,6 @@ private: friend class QHttpNetworkConnectionPrivate; }; - class QHttpNetworkRequestPrivate : public QHttpNetworkHeaderPrivate { public: @@ -129,7 +130,7 @@ public: QHttpNetworkRequest::Operation operation; QHttpNetworkRequest::Priority priority; - mutable QIODevice *data; + mutable QNonContiguousByteDevice* uploadByteDevice; bool autoDecompress; }; -- cgit v0.12 From 21199a2bb0b5d6c4d419157656c975c16c947b8f Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 13 May 2009 13:16:04 +0200 Subject: QNAM: Upload architecture change: Backend and QNetworkReplyImpl changes Reviewed-by: Thiago Macieira Reviewed-by: Peter Hartmann --- src/network/access/qnetworkaccessbackend.cpp | 57 +++++--- src/network/access/qnetworkaccessbackend_p.h | 38 ++--- src/network/access/qnetworkaccessmanager.cpp | 8 +- src/network/access/qnetworkreplyimpl.cpp | 202 ++++++++++++++++----------- src/network/access/qnetworkreplyimpl_p.h | 17 ++- 5 files changed, 188 insertions(+), 134 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index df468b8..b9d1b85 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -50,6 +50,8 @@ #include "qnetworkaccesscachebackend_p.h" #include "qabstractnetworkcache.h" +#include "private/qnoncontiguousbytedevice_p.h" + QT_BEGIN_NAMESPACE static bool factoryDataShutdown = false; @@ -109,17 +111,43 @@ QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessM return 0; } -QNetworkAccessBackend::QNetworkAccessBackend() + +QNonContiguousByteDevice* QNetworkAccessBackend::createUploadByteDevice() { + QNonContiguousByteDevice* device = 0; + + if (reply->outgoingDataBuffer) + device = QNonContiguousByteDeviceFactory::create(reply->outgoingDataBuffer); + else + device = QNonContiguousByteDeviceFactory::create(reply->outgoingData); + + bool bufferDisallowed = + reply->request.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute, + QVariant(false)) == QVariant(true); + if (bufferDisallowed) + device->disableReset(); + + // make sure we delete this later + device->setParent(this); + + connect(device, SIGNAL(readProgress(qint64,qint64)), this, SLOT(emitReplyUploadProgress(qint64,qint64))); + + return device; } -QNetworkAccessBackend::~QNetworkAccessBackend() +// need to have this function since the reply is a private member variable +// and the special backends need to access this. +void QNetworkAccessBackend::emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal) { + reply->emitUploadProgress(bytesSent, bytesTotal); } -void QNetworkAccessBackend::upstreamReadyRead() +QNetworkAccessBackend::QNetworkAccessBackend() +{ +} + +QNetworkAccessBackend::~QNetworkAccessBackend() { - // do nothing } void QNetworkAccessBackend::downstreamReadyWrite() @@ -184,23 +212,6 @@ bool QNetworkAccessBackend::isCachingEnabled() const return reply->isCachingEnabled(); } -qint64 QNetworkAccessBackend::upstreamBytesAvailable() const -{ - return reply->writeBuffer.size(); -} - -void QNetworkAccessBackend::upstreamBytesConsumed(qint64 count) -{ - // remove count bytes from the write buffer - reply->consume(count); -} - -QByteArray QNetworkAccessBackend::readUpstream() -{ - // ### this is expensive. Consider making QRingBuffer::peekAll keep the buffer it returns - return reply->writeBuffer.peek(upstreamBytesAvailable()); -} - qint64 QNetworkAccessBackend::nextDownstreamBlockSize() const { return reply->nextDownstreamBlockSize(); @@ -213,12 +224,12 @@ qint64 QNetworkAccessBackend::downstreamBytesToConsume() const void QNetworkAccessBackend::writeDownstreamData(const QByteArray &data) { - reply->feed(data); + reply->appendDownstreamData(data); } void QNetworkAccessBackend::writeDownstreamData(QIODevice *data) { - reply->feed(data); + reply->appendDownstreamData(data); } QVariant QNetworkAccessBackend::header(QNetworkRequest::KnownHeaders header) const diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 9012396..6035f3a 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -70,6 +70,8 @@ class QNetworkAccessManagerPrivate; class QNetworkReplyImplPrivate; class QAbstractNetworkCache; class QNetworkCacheMetaData; +class QNetworkAccessBackendUploadIODevice; +class QNonContiguousByteDevice; // Should support direct file upload from disk or download to disk. // @@ -86,14 +88,13 @@ public: // have different names. The Connection has two streams: // // - Upstream: - // Upstream is data that is being written into this connection, - // from the user. Upstream operates in a "pull" mechanism: the - // connection will be notified that there is more data available - // by a call to "upstreamReadyRead". The number of bytes - // available is given by upstreamBytesAvailable(). A call to - // readUpstream() always yields the entire upstream buffer. When - // the connection has processed a certain amount of bytes from - // that buffer, it should call upstreamBytesConsumed(). + // The upstream uses a QNonContiguousByteDevice provided + // by the backend. This device emits the usual readyRead() + // signal when the backend has data available for the connection + // to write. The different backends can listen on this signal + // and then pull upload data from the QNonContiguousByteDevice and + // deal with it. + // // // - Downstream: // Downstream is the data that is being read from this @@ -111,12 +112,9 @@ public: virtual void open() = 0; virtual void closeDownstreamChannel() = 0; - virtual void closeUpstreamChannel() = 0; virtual bool waitForDownstreamReadyRead(int msecs) = 0; - virtual bool waitForUpstreamBytesWritten(int msecs) = 0; // slot-like: - virtual void upstreamReadyRead(); virtual void downstreamReadyWrite(); virtual void copyFinished(QIODevice *); virtual void ignoreSslErrors(); @@ -155,18 +153,24 @@ public: QVariant attribute(QNetworkRequest::Attribute code) const; void setAttribute(QNetworkRequest::Attribute code, const QVariant &value); + // return true if the QNonContiguousByteDevice of the upload + // data needs to support reset(). Currently needed for HTTP. + // This will possibly enable buffering of the upload data. + virtual bool needsResetableUploadData() {return false;}; + protected: - // these functions control the upstream mechanism - // that is, data coming into the backend and out via the connection - qint64 upstreamBytesAvailable() const; - void upstreamBytesConsumed(qint64 count); - QByteArray readUpstream(); + // Create the device used for reading the upload data + QNonContiguousByteDevice* createUploadByteDevice(); + // these functions control the downstream mechanism // that is, data that has come via the connection and is going out the backend qint64 nextDownstreamBlockSize() const; qint64 downstreamBytesToConsume() const; void writeDownstreamData(const QByteArray &data); + +public slots: + // for task 251801, needs to be a slot to be called asynchronously void writeDownstreamData(QIODevice *data); protected slots: @@ -179,10 +183,12 @@ protected slots: void metaDataChanged(); void redirectionRequested(const QUrl &destination); void sslErrors(const QList &errors); + void emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal); private: friend class QNetworkAccessManager; friend class QNetworkAccessManagerPrivate; + friend class QNetworkAccessBackendUploadIODevice; QNetworkAccessManagerPrivate *manager; QNetworkReplyImplPrivate *reply; }; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index bcbeef1..bf06ede 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -686,7 +686,10 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera priv->urlForLastAuthentication = url; } - // third step: setup the reply + // third step: find a backend + priv->backend = d->findBackend(op, request); + + // fourth step: setup the reply priv->setup(op, request, outgoingData); if (request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt() != QNetworkRequest::AlwaysNetwork) @@ -695,9 +698,6 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera QList proxyList = d->queryProxy(QNetworkProxyQuery(request.url())); priv->proxyList = proxyList; #endif - - // fourth step: find a backend - priv->backend = d->findBackend(op, request); if (priv->backend) { priv->backend->setParent(reply); priv->backend->reply = priv; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 79c3d1a..749a462 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -46,13 +46,15 @@ #include "QtCore/qcoreapplication.h" #include "QtCore/qdatetime.h" #include "QtNetwork/qsslconfiguration.h" +#include "qnetworkaccesshttpbackend_p.h" #include QT_BEGIN_NAMESPACE inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() - : copyDevice(0), networkCache(0), + : backend(0), outgoingData(0), outgoingDataBuffer(0), + copyDevice(0), networkCache(0), cacheEnabled(false), cacheSaveDevice(0), bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), state(Idle) @@ -61,8 +63,13 @@ inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() void QNetworkReplyImplPrivate::_q_startOperation() { - // This function is called exactly once + // ensure this function is only being called once + if (state == Working) { + qDebug("QNetworkReplyImpl::_q_startOperation was called more than once"); + return; + } state = Working; + if (!backend) { error(QNetworkReplyImpl::ProtocolUnknownError, QCoreApplication::translate("QNetworkReply", "Protocol \"%1\" is unknown").arg(url.scheme())); // not really true!; @@ -74,57 +81,11 @@ void QNetworkReplyImplPrivate::_q_startOperation() if (state != Finished) { if (operation == QNetworkAccessManager::GetOperation) pendingNotifications.append(NotifyDownstreamReadyWrite); - if (outgoingData) { - _q_sourceReadyRead(); -#if 0 // ### FIXME - if (outgoingData->atEndOfStream() && writeBuffer.isEmpty()) - // empty upload - emit q->uploadProgress(0, 0); -#endif - } handleNotifications(); } } -void QNetworkReplyImplPrivate::_q_sourceReadyRead() -{ - // read data from the outgoingData QIODevice into our internal buffer - enum { DesiredBufferSize = 32 * 1024 }; - - if (writeBuffer.size() >= DesiredBufferSize) - return; // don't grow the buffer too much - - // read as many bytes are available or up until we fill up the buffer - // but always read at least one byte - qint64 bytesToRead = qBound(1, outgoingData->bytesAvailable(), - DesiredBufferSize - writeBuffer.size()); - char *ptr = writeBuffer.reserve(bytesToRead); - qint64 bytesActuallyRead = outgoingData->read(ptr, bytesToRead); - if (bytesActuallyRead == -1) { - // EOF - writeBuffer.chop(bytesToRead); - backendNotify(NotifyCloseUpstreamChannel); - return; - } - - if (bytesActuallyRead < bytesToRead) - writeBuffer.chop(bytesToRead - bytesActuallyRead); - - // if we did read anything, let the backend know and handle it - if (bytesActuallyRead) - backendNotify(NotifyUpstreamReadyRead); - - // check for EOF again - if (!outgoingData->isSequential() && outgoingData->atEnd()) - backendNotify(NotifyCloseUpstreamChannel); -} - -void QNetworkReplyImplPrivate::_q_sourceReadChannelFinished() -{ - _q_sourceReadyRead(); -} - void QNetworkReplyImplPrivate::_q_copyReadyRead() { Q_Q(QNetworkReplyImpl); @@ -143,7 +104,7 @@ void QNetworkReplyImplPrivate::_q_copyReadyRead() if (bytesActuallyRead == -1) { readBuffer.chop(bytesToRead); backendNotify(NotifyCopyFinished); - return; + break; } if (bytesActuallyRead != bytesToRead) @@ -151,6 +112,7 @@ void QNetworkReplyImplPrivate::_q_copyReadyRead() if (!copyDevice->isSequential() && copyDevice->atEnd()) { backendNotify(NotifyCopyFinished); + bytesDownloaded += bytesActuallyRead; break; } @@ -174,6 +136,67 @@ void QNetworkReplyImplPrivate::_q_copyReadChannelFinished() _q_copyReadyRead(); } +void QNetworkReplyImplPrivate::_q_bufferOutgoingDataFinished() +{ + Q_Q(QNetworkReplyImpl); + + // make sure this is only called once, ever. + //_q_bufferOutgoingData may call it or the readChannelFinished emission + if (state != Buffering) + return; + + // disconnect signals + QObject::disconnect(outgoingData, SIGNAL(readyRead()), q, SLOT(_q_bufferOutgoingData())); + QObject::disconnect(outgoingData, SIGNAL(readChannelFinished()), q, SLOT(_q_bufferOutgoingDataFinished())); + + // finally, start the request + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); +} + +void QNetworkReplyImplPrivate::_q_bufferOutgoingData() +{ + Q_Q(QNetworkReplyImpl); + + if (!outgoingDataBuffer) { + // first call, create our buffer + outgoingDataBuffer = new QRingBuffer(); + + QObject::connect(outgoingData, SIGNAL(readyRead()), q, SLOT(_q_bufferOutgoingData())); + QObject::connect(outgoingData, SIGNAL(readChannelFinished()), q, SLOT(_q_bufferOutgoingDataFinished())); + } + + qint64 bytesBuffered = 0; + qint64 bytesToBuffer = 0; + + // read data into our buffer + forever { + bytesToBuffer = outgoingData->bytesAvailable(); + // unknown? just try 2 kB, this also ensures we always try to read the EOF + if (bytesToBuffer <= 0) + bytesToBuffer = 2*1024; + + char *dst = outgoingDataBuffer->reserve(bytesToBuffer); + bytesBuffered = outgoingData->read(dst, bytesToBuffer); + + if (bytesBuffered == -1) { + // EOF has been reached. + outgoingDataBuffer->chop(bytesToBuffer); + + _q_bufferOutgoingDataFinished(); + break; + } else if (bytesBuffered == 0) { + // nothing read right now, just wait until we get called again + outgoingDataBuffer->chop(bytesToBuffer); + + break; + } else { + // don't break, try to read() again + outgoingDataBuffer->chop(bytesToBuffer - bytesBuffered); + } + } +} + + void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *data) { @@ -184,13 +207,42 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const url = request.url(); operation = op; - if (outgoingData) { - q->connect(outgoingData, SIGNAL(readyRead()), SLOT(_q_sourceReadyRead())); - q->connect(outgoingData, SIGNAL(readChannelFinished()), SLOT(_q_sourceReadChannelFinished())); + if (outgoingData && backend) { + // there is data to be uploaded, e.g. HTTP POST. + + if (!backend->needsResetableUploadData() || !outgoingData->isSequential()) { + // backend does not need upload buffering or + // fixed size non-sequential + // just start the operation + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); + } else { + bool bufferingDisallowed = + req.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute, + false).toBool(); + + if (bufferingDisallowed) { + // if a valid content-length header for the request was supplied, we can disable buffering + // if not, we will buffer anyway + if (req.header(QNetworkRequest::ContentLengthHeader).isValid()) { + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); + } else { + state = Buffering; + QMetaObject::invokeMethod(q, "_q_bufferOutgoingData", Qt::QueuedConnection); + } + } else { + // _q_startOperation will be called when the buffering has finished. + state = Buffering; + QMetaObject::invokeMethod(q, "_q_bufferOutgoingData", Qt::QueuedConnection); + } + } + } else { + // No outgoing data (e.g. HTTP GET request) + // or no backend + // if no backend, _q_startOperation will handle the error of this + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); } q->QIODevice::open(QIODevice::ReadOnly); - QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); } void QNetworkReplyImplPrivate::setNetworkCache(QAbstractNetworkCache *nc) @@ -226,18 +278,10 @@ void QNetworkReplyImplPrivate::handleNotifications() backend->downstreamReadyWrite(); break; - case NotifyUpstreamReadyRead: - backend->upstreamReadyRead(); - break; - case NotifyCloseDownstreamChannel: backend->closeDownstreamChannel(); break; - case NotifyCloseUpstreamChannel: - backend->closeUpstreamChannel(); - break; - case NotifyCopyFinished: { QIODevice *dev = copyDevice; copyDevice = 0; @@ -299,29 +343,14 @@ void QNetworkReplyImplPrivate::completeCacheSave() cacheEnabled = false; } -void QNetworkReplyImplPrivate::consume(qint64 count) +void QNetworkReplyImplPrivate::emitUploadProgress(qint64 bytesSent, qint64 bytesTotal) { Q_Q(QNetworkReplyImpl); - if (count <= 0) { - qWarning("QNetworkConnection: backend signalled that it consumed %ld bytes", long(count)); - return; - } - - if (outgoingData) - // schedule another read from the source - QMetaObject::invokeMethod(q_func(), "_q_sourceReadyRead", Qt::QueuedConnection); - - writeBuffer.skip(count); - if (bytesUploaded == -1) - bytesUploaded = count; - else - bytesUploaded += count; - - QVariant totalSize = request.header(QNetworkRequest::ContentLengthHeader); - emit q->uploadProgress(bytesUploaded, - totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); + bytesUploaded = bytesSent; + emit q->uploadProgress(bytesSent, bytesTotal); } + qint64 QNetworkReplyImplPrivate::nextDownstreamBlockSize() const { enum { DesiredBufferSize = 32 * 1024 }; @@ -331,7 +360,9 @@ qint64 QNetworkReplyImplPrivate::nextDownstreamBlockSize() const return qMax(0, readBufferMaxSize - readBuffer.size()); } -void QNetworkReplyImplPrivate::feed(const QByteArray &data) +// we received downstream data and send this to the cache +// and to our readBuffer (which in turn gets read by the user of QNetworkReply) +void QNetworkReplyImplPrivate::appendDownstreamData(const QByteArray &data) { Q_Q(QNetworkReplyImpl); if (!q->isOpen()) @@ -379,7 +410,8 @@ void QNetworkReplyImplPrivate::feed(const QByteArray &data) } } -void QNetworkReplyImplPrivate::feed(QIODevice *data) +// this is used when it was fetched from the cache, right? +void QNetworkReplyImplPrivate::appendDownstreamData(QIODevice *data) { Q_Q(QNetworkReplyImpl); Q_ASSERT(q->isOpen()); @@ -409,9 +441,11 @@ void QNetworkReplyImplPrivate::finished() pendingNotifications.clear(); QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); - if (bytesDownloaded != lastBytesDownloaded || totalSize.isNull()) + if (totalSize.isNull() || totalSize == -1) { emit q->downloadProgress(bytesDownloaded, bytesDownloaded); - if (bytesUploaded == -1 && outgoingData) + } + + if (bytesUploaded == -1 && (outgoingData || outgoingDataBuffer)) emit q->uploadProgress(0, 0); completeCacheSave(); diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index ad06f78..8d3c90e 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -59,6 +59,7 @@ #include "qnetworkproxy.h" #include "QtCore/qmap.h" #include "QtCore/qqueue.h" +#include "QtCore/qbuffer.h" #include "private/qringbuffer_p.h" QT_BEGIN_NAMESPACE @@ -91,10 +92,10 @@ public: Q_DECLARE_PRIVATE(QNetworkReplyImpl) Q_PRIVATE_SLOT(d_func(), void _q_startOperation()) - Q_PRIVATE_SLOT(d_func(), void _q_sourceReadyRead()) - Q_PRIVATE_SLOT(d_func(), void _q_sourceReadChannelFinished()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadyRead()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished()) + Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData()) + Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished()) }; class QNetworkReplyImplPrivate: public QNetworkReplyPrivate @@ -102,15 +103,13 @@ class QNetworkReplyImplPrivate: public QNetworkReplyPrivate public: enum InternalNotifications { NotifyDownstreamReadyWrite, - NotifyUpstreamReadyRead, NotifyCloseDownstreamChannel, - NotifyCloseUpstreamChannel, NotifyCopyFinished }; enum State { Idle, - Opening, + Buffering, Working, Finished, Aborted @@ -125,6 +124,8 @@ public: void _q_sourceReadChannelFinished(); void _q_copyReadyRead(); void _q_copyReadChannelFinished(); + void _q_bufferOutgoingData(); + void _q_bufferOutgoingDataFinished(); void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData); @@ -138,9 +139,10 @@ public: void setCachingEnabled(bool enable); bool isCachingEnabled() const; void consume(qint64 count); + void emitUploadProgress(qint64 bytesSent, qint64 bytesTotal); qint64 nextDownstreamBlockSize() const; - void feed(const QByteArray &data); - void feed(QIODevice *data); + void appendDownstreamData(const QByteArray &data); + void appendDownstreamData(QIODevice *data); void finished(); void error(QNetworkReply::NetworkError code, const QString &errorString); void metaDataChanged(); @@ -149,6 +151,7 @@ public: QNetworkAccessBackend *backend; QIODevice *outgoingData; + QRingBuffer *outgoingDataBuffer; QIODevice *copyDevice; QAbstractNetworkCache *networkCache; -- cgit v0.12 From ccf5680b2e9746b5b70c2311e66c9dcde92cc462 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 13 May 2009 13:17:43 +0200 Subject: QNAM: ContentReSendError Reviewed-by: Peter Hartmann Reviewed-by: Thiago Macieira --- src/network/access/qnetworkreply.cpp | 4 ++++ src/network/access/qnetworkreply.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index f4dad3c..0990b17 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -151,6 +151,10 @@ QNetworkReplyPrivate::QNetworkReplyPrivate() authentication to serve the content but the credentials provided were not accepted (if any) + \value ContentReSendError the request needed to be sent + again, but this failed for example because the upload data + could not be read a second time. + \value ProtocolUnknownError the Network Access API cannot honor the request because the protocol is not known diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index 6f763b3..2f864fe 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -92,6 +92,7 @@ public: ContentOperationNotPermittedError, ContentNotFoundError, AuthenticationRequiredError, + ContentReSendError, UnknownContentError = 299, // protocol errors -- cgit v0.12 From 51ad9b25af4379d80ba1992994beffca548194a7 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 13 May 2009 13:18:57 +0200 Subject: QNAM: Upload architecture change: Auto test Reviewed-by: Thiago Macieira Reviewed-by: Peter Hartmann --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 532 ++++++++++++++++++++++++- 1 file changed, 516 insertions(+), 16 deletions(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 104b788..a8ba36f 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -91,6 +92,15 @@ class tst_QNetworkReply: public QObject { Q_OBJECT + struct ProxyData { + ProxyData(const QNetworkProxy &p, const QByteArray &t, bool auth) + : tag(t), proxy(p), requiresAuthentication(auth) + { } + QByteArray tag; + QNetworkProxy proxy; + bool requiresAuthentication; + }; + QEventLoop *loop; enum RunSimpleRequestReturn { Timeout = 0, Success, Failure }; int returnCode; @@ -99,6 +109,7 @@ class tst_QNetworkReply: public QObject QString wronlyFileName; #endif QString uniqueExtension; + QList proxies; QNetworkAccessManager manager; MyCookieJar *cookieJar; #ifndef QT_NO_OPENSSL @@ -190,11 +201,20 @@ private Q_SLOTS: void ioPutToHttpFromFile(); void ioPostToHttpFromFile_data(); void ioPostToHttpFromFile(); + void ioPostToHttpFromSocket_data(); + void ioPostToHttpFromSocket(); + void ioPostToHttpFromMiddleOfFileToEnd(); + void ioPostToHttpFromMiddleOfFileFiveBytes(); + void ioPostToHttpFromMiddleOfQBufferFiveBytes(); + void ioPostToHttpNoBufferFlag(); + void ioPostToHttpUploadProgress(); + void ioPostToHttpEmtpyUploadProgress(); void rateControl_data(); void rateControl(); void downloadPerformance(); void uploadPerformance(); + void httpUploadPerformance(); void performanceControlRate(); void downloadProgress_data(); @@ -364,6 +384,63 @@ public slots: } }; +class FixedSizeDataGenerator : public QIODevice +{ + Q_OBJECT + enum { Idle, Started, Stopped } state; +public: + FixedSizeDataGenerator(qint64 size) : state(Idle) + { open(ReadOnly | Unbuffered); + toBeGeneratedTotalCount = toBeGeneratedCount = size; + } + + virtual qint64 bytesAvailable() const + { + return state == Started ? toBeGeneratedCount + QIODevice::bytesAvailable() : 0; + } + + virtual bool isSequential() const{ + return false; + } + + virtual bool reset() const{ + return false; + } + + qint64 size() const { + return toBeGeneratedTotalCount; + } + +public slots: + void start() { state = Started; emit readyRead(); } + +protected: + virtual qint64 readData(char *data, qint64 maxlen) + { + memset(data, '@', maxlen); + + if (toBeGeneratedCount <= 0) { + return -1; + } + + qint64 n = qMin(maxlen, toBeGeneratedCount); + toBeGeneratedCount -= n; + + if (toBeGeneratedCount <= 0) { + // make sure this is a queued connection! + emit readChannelFinished(); + } + + return n; + } + virtual qint64 writeData(const char *, qint64) + { return -1; } + + qint64 toBeGeneratedCount; + qint64 toBeGeneratedTotalCount; +}; + + class DataGenerator: public QIODevice { Q_OBJECT @@ -384,6 +461,7 @@ protected: { if (state == Stopped) return -1; // EOF + // return as many bytes as are wanted memset(data, '@', maxlen); return maxlen; @@ -392,6 +470,8 @@ protected: { return -1; } }; + + class SocketPair: public QObject { Q_OBJECT @@ -629,7 +709,7 @@ protected: return; transferRate = totalBytes * 1000 / timer.elapsed(); - qDebug() << "receive rate:" << (transferRate / 1024) << "kB/s in" + qDebug() << "TimedSender::run" << "receive rate:" << (transferRate / 1024) << "kB/s in" << timer.elapsed() << "ms"; } @@ -643,12 +723,13 @@ protected: class ThreadedDataReader: public QThread { Q_OBJECT + // used to make the constructor only return after the tcp server started listening QSemaphore ready; QTcpSocket *client; int timeout; int port; public: - int transferRate; + qint64 transferRate; ThreadedDataReader() : port(-1), transferRate(-1) { @@ -676,12 +757,65 @@ protected: QTime timer; timer.start(); eventLoop.exec(); + qint64 elapsed = timer.elapsed(); + + transferRate = reader.totalBytes * 1000 / elapsed; + qDebug() << "ThreadedDataReader::run" << "send rate:" << (transferRate / 1024) << "kB/s in" << elapsed << "msec"; + } +}; + +class ThreadedDataReaderHttpServer: public QThread +{ + Q_OBJECT + // used to make the constructor only return after the tcp server started listening + QSemaphore ready; + QTcpSocket *client; + int timeout; + int port; +public: + qint64 transferRate; + ThreadedDataReaderHttpServer() + : port(-1), transferRate(-1) + { + start(); + ready.acquire(); + } + + inline int serverPort() const { return port; } + +protected: + void run() + { + QTcpServer server; + server.listen(); + port = server.serverPort(); + ready.release(); + + server.waitForNewConnection(-1); + client = server.nextPendingConnection(); + client->write("HTTP/1.0 200 OK\r\n"); + client->write("Content-length: 0\r\n"); + client->write("\r\n"); + client->flush(); + + QCoreApplication::processEvents(); + + QEventLoop eventLoop; + DataReader reader(client, false); + QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit())); + + QTime timer; + timer.start(); + eventLoop.exec(); + qint64 elapsed = timer.elapsed(); - transferRate = reader.totalBytes * 1000 / timer.elapsed(); - qDebug() << "send rate:" << (transferRate / 1024) << "kB/s"; + transferRate = reader.totalBytes * 1000 / elapsed; + qDebug() << "ThreadedDataReaderHttpServer::run" << "send rate:" << (transferRate / 1024) << "kB/s in" << elapsed << "msec"; } }; + + tst_QNetworkReply::tst_QNetworkReply() { testFileName = QDir::currentPath() + "/testfile"; @@ -692,8 +826,28 @@ tst_QNetworkReply::tst_QNetworkReply() #endif cookieJar = new MyCookieJar; manager.setCookieJar(cookieJar); + + QHostInfo hostInfo = QHostInfo::fromName(QtNetworkSettings::serverName()); + + proxies << ProxyData(QNetworkProxy::NoProxy, "", false); + + if (hostInfo.error() == QHostInfo::NoError && !hostInfo.addresses().isEmpty()) { + QString proxyserver = hostInfo.addresses().first().toString(); + proxies << ProxyData(QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3128), "+proxy", false) + << ProxyData(QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3129), "+proxyauth", true) + // currently unsupported + // << ProxyData(QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3130), "+proxyauth-ntlm", true); + << ProxyData(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1080), "+socks", false) + << ProxyData(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1081), "+socksauth", true); + } else { + printf("==================================================================\n"); + printf("Proxy could not be looked up. No proxy will be used while testing!\n"); + printf("==================================================================\n"); + } } + + void tst_QNetworkReply::authenticationRequired(QNetworkReply*, QAuthenticator* auth) { auth->setUser("httptest"); @@ -2452,6 +2606,320 @@ void tst_QNetworkReply::ioPostToHttpFromFile() QCOMPARE(reply->readAll().trimmed(), md5sum(sourceFile.readAll()).toHex()); } +void tst_QNetworkReply::ioPostToHttpFromSocket_data() +{ + QTest::addColumn("data"); + QTest::addColumn("md5sum"); + QTest::addColumn("url"); + QTest::addColumn("proxy"); + QTest::addColumn("authenticationRequiredCount"); + QTest::addColumn("proxyAuthenticationRequiredCount"); + + for (int i = 0; i < proxies.count(); ++i) + for (int auth = 0; auth < 2; ++auth) { + QUrl url; + if (auth) + url = "http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"; + else + url = "http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/md5sum.cgi"; + + QNetworkProxy proxy = proxies.at(i).proxy; + QByteArray testsuffix = QByteArray(auth ? "+auth" : "") + proxies.at(i).tag; + int proxyauthcount = proxies.at(i).requiresAuthentication; + + QByteArray data; + data = ""; + QTest::newRow("empty" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + + data = "This is a normal message."; + QTest::newRow("generic" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + + data = "This is a message to show that Qt rocks!\r\n\n"; + QTest::newRow("small" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + + data = QByteArray("abcd\0\1\2\abcd",12); + QTest::newRow("with-nul" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + + data = QByteArray(4097, '\4'); + QTest::newRow("4k+1" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + + data = QByteArray(128*1024+1, '\177'); + QTest::newRow("128k+1" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + } +} + +void tst_QNetworkReply::ioPostToHttpFromSocket() +{ + qRegisterMetaType(); // for QSignalSpy + qRegisterMetaType(); + qRegisterMetaType(); + + QFETCH(QByteArray, data); + QFETCH(QUrl, url); + QFETCH(QNetworkProxy, proxy); + SocketPair socketpair; + socketpair.create(); + QVERIFY(socketpair.endPoints[0] && socketpair.endPoints[1]); + + socketpair.endPoints[0]->write(data); + + QNetworkRequest request(url); + manager.setProxy(proxy); + QNetworkReplyPtr reply = manager.post(QNetworkRequest(url), socketpair.endPoints[1]); + socketpair.endPoints[0]->close(); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + connect(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), + SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); + connect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + QSignalSpy authenticationRequiredSpy(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*))); + QSignalSpy proxyAuthenticationRequiredSpy(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); + + QTestEventLoop::instance().enterLoop(1); + + disconnect(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), + this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); + disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(reply->url(), url); + QCOMPARE(reply->error(), QNetworkReply::NoError); + // verify that the HTTP status code is 200 Ok + QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); + + QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); + + QTEST(authenticationRequiredSpy.count(), "authenticationRequiredCount"); + QTEST(proxyAuthenticationRequiredSpy.count(), "proxyAuthenticationRequiredCount"); + } + +// this tests checks if rewinding the POST-data to some place in the middle +// worked. +void tst_QNetworkReply::ioPostToHttpFromMiddleOfFileToEnd() +{ + QFile sourceFile(SRCDIR "/rfc3252.txt"); + QVERIFY(sourceFile.open(QIODevice::ReadOnly)); + // seeking to the middle + sourceFile.seek(sourceFile.size() / 2); + + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"; + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.post(QNetworkRequest(url), &sourceFile); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + connect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + QTestEventLoop::instance().enterLoop(2); + disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // compare half data + sourceFile.seek(sourceFile.size() / 2); + QByteArray data = sourceFile.readAll(); + QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); +} + +void tst_QNetworkReply::ioPostToHttpFromMiddleOfFileFiveBytes() +{ + QFile sourceFile(SRCDIR "/rfc3252.txt"); + QVERIFY(sourceFile.open(QIODevice::ReadOnly)); + // seeking to the middle + sourceFile.seek(sourceFile.size() / 2); + + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"; + QNetworkRequest request(url); + // only send 5 bytes + request.setHeader(QNetworkRequest::ContentLengthHeader, 5); + QVERIFY(request.header(QNetworkRequest::ContentLengthHeader).isValid()); + QNetworkReplyPtr reply = manager.post(request, &sourceFile); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + connect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + QTestEventLoop::instance().enterLoop(2); + disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // compare half data + sourceFile.seek(sourceFile.size() / 2); + QByteArray data = sourceFile.read(5); + QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); +} + +void tst_QNetworkReply::ioPostToHttpFromMiddleOfQBufferFiveBytes() +{ + // test needed since a QBuffer goes with a different codepath than the QFile + // tested in ioPostToHttpFromMiddleOfFileFiveBytes + QBuffer uploadBuffer; + uploadBuffer.open(QIODevice::ReadWrite); + uploadBuffer.write("1234567890"); + uploadBuffer.seek(5); + + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"; + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.post(request, &uploadBuffer); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + connect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + QTestEventLoop::instance().enterLoop(2); + disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // compare half data + uploadBuffer.seek(5); + QByteArray data = uploadBuffer.read(5); + QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); +} + + +void tst_QNetworkReply::ioPostToHttpNoBufferFlag() +{ + QByteArray data = QByteArray("daaaaaaataaaaaaa"); + // create a sequential QIODevice by feeding the data into a local TCP server + SocketPair socketpair; + socketpair.create(); + QVERIFY(socketpair.endPoints[0] && socketpair.endPoints[1]); + socketpair.endPoints[0]->write(data); + + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"; + QNetworkRequest request(url); + // disallow buffering + request.setAttribute(QNetworkRequest::DoNotBufferUploadDataAttribute, true); + request.setHeader(QNetworkRequest::ContentLengthHeader, data.size()); + QNetworkReplyPtr reply = manager.post(request, socketpair.endPoints[1]); + socketpair.endPoints[0]->close(); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + connect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + QTestEventLoop::instance().enterLoop(2); + disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + // verify: error code is QNetworkReply::ContentReSendError + QCOMPARE(reply->error(), QNetworkReply::ContentReSendError); +} + + +void tst_QNetworkReply::ioPostToHttpUploadProgress() +{ + QFile sourceFile(SRCDIR "/bigfile"); + QVERIFY(sourceFile.open(QIODevice::ReadOnly)); + + // emulate a minimal http server + QTcpServer server; + server.listen(QHostAddress(QHostAddress::LocalHost), 0); + + // create the request + QUrl url = QUrl(QString("http://127.0.0.1:%1/").arg(server.serverPort())); + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.post(request, &sourceFile); + QSignalSpy spy(reply, SIGNAL(uploadProgress(qint64,qint64))); + connect(&server, SIGNAL(newConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + // get the request started and the incoming socket connected + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QTcpSocket *incomingSocket = server.nextPendingConnection(); + QVERIFY(incomingSocket); + disconnect(&server, SIGNAL(newConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + incomingSocket->setReadBufferSize(1*1024); + QTestEventLoop::instance().enterLoop(2); + // some progress should have been made + QList args = spy.last(); + QVERIFY(!args.isEmpty()); + QVERIFY(args.at(0).toLongLong() > 0); + + incomingSocket->setReadBufferSize(32*1024); + incomingSocket->read(16*1024); + QTestEventLoop::instance().enterLoop(2); + // some more progress than before + QList args2 = spy.last(); + QVERIFY(!args2.isEmpty()); + QVERIFY(args2.at(0).toLongLong() > args.at(0).toLongLong()); + + // set the read buffer to unlimited + incomingSocket->setReadBufferSize(0); + QTestEventLoop::instance().enterLoop(10); + // progress should be finished + QList args3 = spy.last(); + QVERIFY(!args3.isEmpty()); + QVERIFY(args3.at(0).toLongLong() > args2.at(0).toLongLong()); + QCOMPARE(args3.at(0).toLongLong(), args3.at(1).toLongLong()); + QCOMPARE(args3.at(0).toLongLong(), sourceFile.size()); + + // after sending this, the QNAM should emit finished() + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + incomingSocket->write("HTTP/1.0 200 OK\r\n"); + incomingSocket->write("Content-Length: 0\r\n"); + incomingSocket->write("\r\n"); + QTestEventLoop::instance().enterLoop(10); + // not timeouted -> finished() was emitted + QVERIFY(!QTestEventLoop::instance().timeout()); + + incomingSocket->close(); + server.close(); +} + +void tst_QNetworkReply::ioPostToHttpEmtpyUploadProgress() +{ + QByteArray ba; + ba.resize(0); + QBuffer buffer(&ba,0); + QVERIFY(buffer.open(QIODevice::ReadOnly)); + + // emulate a minimal http server + QTcpServer server; + server.listen(QHostAddress(QHostAddress::LocalHost), 0); + + // create the request + QUrl url = QUrl(QString("http://127.0.0.1:%1/").arg(server.serverPort())); + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.post(request, &buffer); + QSignalSpy spy(reply, SIGNAL(uploadProgress(qint64,qint64))); + connect(&server, SIGNAL(newConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + + // get the request started and the incoming socket connected + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QTcpSocket *incomingSocket = server.nextPendingConnection(); + QVERIFY(incomingSocket); + + // after sending this, the QNAM should emit finished() + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + incomingSocket->write("HTTP/1.0 200 OK\r\n"); + incomingSocket->write("Content-Length: 0\r\n"); + incomingSocket->write("\r\n"); + incomingSocket->flush(); + QTestEventLoop::instance().enterLoop(10); + // not timeouted -> finished() was emitted + QVERIFY(!QTestEventLoop::instance().timeout()); + + // final check: only 1 uploadProgress has been emitted + QVERIFY(spy.length() == 1); + QList args = spy.last(); + QVERIFY(!args.isEmpty()); + QCOMPARE(args.at(0).toLongLong(), buffer.size()); + QCOMPARE(args.at(0).toLongLong(), buffer.size()); + + incomingSocket->close(); + server.close(); +} + + void tst_QNetworkReply::rateControl_data() { QTest::addColumn("rate"); @@ -2488,8 +2956,8 @@ void tst_QNetworkReply::rateControl() QTestEventLoop::instance().enterLoop(40); int elapsedTime = loopTime.elapsed(); - qDebug() << "send rate:" << sender.transferRate; - qDebug() << "receive rate:" << reader.totalBytesRead * 1000 / elapsedTime + qDebug() << "tst_QNetworkReply::rateControl" << "send rate:" << sender.transferRate; + qDebug() << "tst_QNetworkReply::rateControl" << "receive rate:" << reader.totalBytesRead * 1000 / elapsedTime << "(it received" << reader.totalBytesRead << "bytes in" << elapsedTime << "ms)"; sender.wait(); @@ -2523,23 +2991,54 @@ void tst_QNetworkReply::downloadPerformance() sender.wait(); qint64 receivedBytes = reader.totalBytes; - qDebug() << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" + qDebug() << "tst_QNetworkReply::downloadPerformance" << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" << elapsedTime << "ms"; } void tst_QNetworkReply::uploadPerformance() { - ThreadedDataReader reader; - DataGenerator generator; - QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1"); - QNetworkReplyPtr reply = manager.put(request, &generator); + ThreadedDataReader reader; + DataGenerator generator; - connect(&reader, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - QTimer::singleShot(5000, &generator, SLOT(stop())); - generator.start(); - QTestEventLoop::instance().enterLoop(40); + + QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1"); + QNetworkReplyPtr reply = manager.put(request, &generator); + generator.start(); + connect(&reader, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTimer::singleShot(5000, &generator, SLOT(stop())); + + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); } +void tst_QNetworkReply::httpUploadPerformance() +{ + enum {UploadSize = 1000*1024*1024}; // 1000 MB + ThreadedDataReaderHttpServer reader; + FixedSizeDataGenerator generator(UploadSize); + + QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1")); + request.setHeader(QNetworkRequest::ContentLengthHeader,UploadSize); + + QNetworkReplyPtr reply = manager.put(request, &generator); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + QTime time; + generator.start(); + time.start(); + QTestEventLoop::instance().enterLoop(40); + QVERIFY(!QTestEventLoop::instance().timeout()); + + qint64 elapsed = time.elapsed(); + qWarning() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, " + << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; + + reader.exit(); + reader.wait(3000); +} + + void tst_QNetworkReply::performanceControlRate() { // this is a control comparison for the other two above @@ -2560,7 +3059,7 @@ void tst_QNetworkReply::performanceControlRate() sender.wait(); qint64 receivedBytes = reader.totalBytes; - qDebug() << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" + qDebug() << "tst_QNetworkReply::performanceControlRate" << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" << elapsedTime << "ms"; } @@ -2592,6 +3091,7 @@ void tst_QNetworkReply::downloadProgress() QByteArray data(128, 'a'); QTcpSocket *sender = server.nextPendingConnection(); + QVERIFY(sender); QFETCH(int, loopCount); for (int i = 1; i <= loopCount; ++i) { -- cgit v0.12 From c2c69c117407990e5c2d8900f4aa27979273084a Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 13 May 2009 13:19:24 +0200 Subject: QNAM: Upload architecture change: Changed all QNAM backends Reviewed-by: Peter Hartmann Reviewed-by: Thiago Macieira --- .../access/qnetworkaccessdebugpipebackend.cpp | 283 ++++++++------------- .../access/qnetworkaccessdebugpipebackend_p.h | 23 +- src/network/access/qnetworkaccessfilebackend.cpp | 85 ++++--- src/network/access/qnetworkaccessfilebackend_p.h | 9 +- src/network/access/qnetworkaccessftpbackend.cpp | 64 +---- src/network/access/qnetworkaccessftpbackend_p.h | 5 +- src/network/access/qnetworkaccesshttpbackend.cpp | 89 +------ src/network/access/qnetworkaccesshttpbackend_p.h | 11 +- 8 files changed, 198 insertions(+), 371 deletions(-) diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp index 2e5f1b1..d4bda9a 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend.cpp +++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp @@ -41,6 +41,8 @@ #include "qnetworkaccessdebugpipebackend_p.h" #include "QtCore/qdatastream.h" +#include +#include "private/qnoncontiguousbytedevice_p.h" QT_BEGIN_NAMESPACE @@ -51,12 +53,6 @@ enum { WriteBufferSize = ReadBufferSize }; -struct QNetworkAccessDebugPipeBackend::DataPacket -{ - QList > headers; - QByteArray data; -}; - QNetworkAccessBackend * QNetworkAccessDebugPipeBackendFactory::create(QNetworkAccessManager::Operation op, const QNetworkRequest &request) const @@ -79,12 +75,14 @@ QNetworkAccessDebugPipeBackendFactory::create(QNetworkAccessManager::Operation o } QNetworkAccessDebugPipeBackend::QNetworkAccessDebugPipeBackend() - : incomingPacketSize(0), bareProtocol(false) + : bareProtocol(false), hasUploadFinished(false), hasDownloadFinished(false), + hasEverythingFinished(false), bytesDownloaded(0), bytesUploaded(0) { } QNetworkAccessDebugPipeBackend::~QNetworkAccessDebugPipeBackend() { + // this is signals disconnect, not network! socket.disconnect(this); // we're not interested in the signals at this point } @@ -92,160 +90,150 @@ void QNetworkAccessDebugPipeBackend::open() { socket.connectToHost(url().host(), url().port(12345)); socket.setReadBufferSize(ReadBufferSize); + + // socket ready read -> we can push from socket to downstream connect(&socket, SIGNAL(readyRead()), SLOT(socketReadyRead())); - connect(&socket, SIGNAL(bytesWritten(qint64)), SLOT(socketBytesWritten(qint64))); connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError())); connect(&socket, SIGNAL(disconnected()), SLOT(socketDisconnected())); + connect(&socket, SIGNAL(connected()), SLOT(socketConnected())); + // socket bytes written -> we can push more from upstream to socket + connect(&socket, SIGNAL(bytesWritten(qint64)), SLOT(socketBytesWritten(qint64))); bareProtocol = url().queryItemValue(QLatin1String("bare")) == QLatin1String("1"); - if (!bareProtocol) { - // "Handshake": - // send outgoing metadata and the URL being requested - DataPacket packet; - //packet.metaData = request().metaData(); - packet.data = url().toEncoded(); - send(packet); + if (operation() == QNetworkAccessManager::PutOperation) { + uploadByteDevice = createUploadByteDevice(); + QObject::connect(uploadByteDevice, SIGNAL(readyRead()), this, SLOT(uploadReadyReadSlot())); + QMetaObject::invokeMethod(this, "uploadReadyReadSlot", Qt::QueuedConnection); } } -void QNetworkAccessDebugPipeBackend::closeDownstreamChannel() +void QNetworkAccessDebugPipeBackend::socketReadyRead() { - if (operation() == QNetworkAccessManager::GetOperation) - socket.disconnectFromHost(); + pushFromSocketToDownstream(); } -void QNetworkAccessDebugPipeBackend::closeUpstreamChannel() +void QNetworkAccessDebugPipeBackend::downstreamReadyWrite() { - if (operation() == QNetworkAccessManager::PutOperation) - socket.disconnectFromHost(); - else if (operation() == QNetworkAccessManager::PostOperation) { - send(DataPacket()); - } + pushFromSocketToDownstream(); } -bool QNetworkAccessDebugPipeBackend::waitForDownstreamReadyRead(int ms) +void QNetworkAccessDebugPipeBackend::socketBytesWritten(qint64) { - readyReadEmitted = false; - if (socket.bytesAvailable()) { - socketReadyRead(); - if (readyReadEmitted) - return true; - } - socket.waitForReadyRead(ms); - return readyReadEmitted; + pushFromUpstreamToSocket(); } -bool QNetworkAccessDebugPipeBackend::waitForUpstreamBytesWritten(int ms) +void QNetworkAccessDebugPipeBackend::uploadReadyReadSlot() { - bytesWrittenEmitted = false; - upstreamReadyRead(); - if (bytesWrittenEmitted) - return true; - - socket.waitForBytesWritten(ms); - return bytesWrittenEmitted; + pushFromUpstreamToSocket(); } -void QNetworkAccessDebugPipeBackend::upstreamReadyRead() +void QNetworkAccessDebugPipeBackend::pushFromSocketToDownstream() { - int maxWrite = WriteBufferSize - socket.bytesToWrite(); - if (maxWrite <= 0) - return; // can't write yet, wait for the socket to write - - if (bareProtocol) { - QByteArray data = readUpstream(); - if (data.isEmpty()) - return; + QByteArray buffer; - socket.write(data); - upstreamBytesConsumed(data.size()); - bytesWrittenEmitted = true; + if (socket.state() == QAbstractSocket::ConnectingState) { return; } - DataPacket packet; - packet.data = readUpstream(); - if (packet.data.isEmpty()) - return; // we'll be called again when there's data - if (packet.data.size() > maxWrite) - packet.data.truncate(maxWrite); - - if (!send(packet)) { - QString msg = QObject::tr("Write error writing to %1: %2") - .arg(url().toString(), socket.errorString()); - error(QNetworkReply::ProtocolFailure, msg); + forever { + if (hasDownloadFinished) + return; - finished(); - return; + buffer.resize(ReadBufferSize); + qint64 haveRead = socket.read(buffer.data(), ReadBufferSize); + + if (haveRead == -1) { + hasDownloadFinished = true; + // this ensures a good last downloadProgress is emitted + setHeader(QNetworkRequest::ContentLengthHeader, QVariant()); + possiblyFinish(); + break; + } else if (haveRead == 0) { + break; + } else { + // have read something + buffer.resize(haveRead); + bytesDownloaded += haveRead; + writeDownstreamData(buffer); + } } - upstreamBytesConsumed(packet.data.size()); - bytesWrittenEmitted = true; } -void QNetworkAccessDebugPipeBackend::downstreamReadyWrite() +void QNetworkAccessDebugPipeBackend::pushFromUpstreamToSocket() { - socketReadyRead(); -} + // FIXME + if (operation() == QNetworkAccessManager::PutOperation) { + if (hasUploadFinished) + return; -void QNetworkAccessDebugPipeBackend::socketReadyRead() -{ - if (bareProtocol) { - qint64 bytesToRead = socket.bytesAvailable(); - if (bytesToRead) { - QByteArray buffer; - buffer.resize(bytesToRead); - qint64 bytesRead = socket.read(buffer.data(), bytesToRead); - if (bytesRead < bytesToRead) - buffer.truncate(bytesRead); - writeDownstreamData(buffer); - readyReadEmitted = true; + forever { + if (socket.bytesToWrite() >= WriteBufferSize) + return; + + qint64 haveRead; + const char *readPointer = uploadByteDevice->readPointer(WriteBufferSize, haveRead); + if (haveRead == -1) { + // EOF + hasUploadFinished = true; + emitReplyUploadProgress(bytesUploaded, bytesUploaded); + possiblyFinish(); + break; + } else if (haveRead == 0 || readPointer == 0) { + // nothing to read right now, we will be called again later + break; + } else { + qint64 haveWritten; + haveWritten = socket.write(readPointer, haveRead); + + if (haveWritten < 0) { + // write error! + QString msg = QCoreApplication::translate("QNetworkAccessDebugPipeBackend", "Write error writing to %1: %2") + .arg(url().toString(), socket.errorString()); + error(QNetworkReply::ProtocolFailure, msg); + finished(); + return; + } else { + uploadByteDevice->advanceReadPointer(haveWritten); + bytesUploaded += haveWritten; + emitReplyUploadProgress(bytesUploaded, -1); + } + + //QCoreApplication::processEvents(); + + } } - return; } +} - while (canReceive() && - (socket.state() == QAbstractSocket::UnconnectedState || nextDownstreamBlockSize())) { - DataPacket packet; - if (receive(packet)) { - if (!packet.headers.isEmpty()) { - QList >::ConstIterator - it = packet.headers.constBegin(), - end = packet.headers.constEnd(); - for ( ; it != end; ++it) - setRawHeader(it->first, it->second); - metaDataChanged(); - } +void QNetworkAccessDebugPipeBackend::possiblyFinish() +{ + if (hasEverythingFinished) + return; + hasEverythingFinished = true; - if (!packet.data.isEmpty()) { - writeDownstreamData(packet.data); - readyReadEmitted = true; - } + if ((operation() == QNetworkAccessManager::GetOperation) && hasDownloadFinished) { + socket.close(); + finished(); + } else if ((operation() == QNetworkAccessManager::PutOperation) && hasUploadFinished) { + socket.close(); + finished(); + } - if (packet.headers.isEmpty() && packet.data.isEmpty()) { - // it's an eof - socket.close(); - readyReadEmitted = true; - } - } else { - // got an error - QString msg = QObject::tr("Read error reading from %1: %2") - .arg(url().toString(), socket.errorString()); - error(QNetworkReply::ProtocolFailure, msg); - finished(); - return; - } - } } -void QNetworkAccessDebugPipeBackend::socketBytesWritten(qint64) +void QNetworkAccessDebugPipeBackend::closeDownstreamChannel() { - upstreamReadyRead(); + qWarning() << "QNetworkAccessDebugPipeBackend::closeDownstreamChannel()" << operation(); + //if (operation() == QNetworkAccessManager::GetOperation) + // socket.disconnectFromHost(); } + void QNetworkAccessDebugPipeBackend::socketError() { + qWarning() << "QNetworkAccessDebugPipeBackend::socketError()" << socket.error(); QNetworkReply::NetworkError code; switch (socket.error()) { case QAbstractSocket::RemoteHostClosedError: @@ -269,76 +257,27 @@ void QNetworkAccessDebugPipeBackend::socketError() void QNetworkAccessDebugPipeBackend::socketDisconnected() { - socketReadyRead(); - if (incomingPacketSize == 0 && socket.bytesToWrite() == 0) { + pushFromSocketToDownstream(); + + if (socket.bytesToWrite() == 0) { // normal close - finished(); } else { // abnormal close QString msg = QObject::tr("Remote host closed the connection prematurely on %1") .arg(url().toString()); error(QNetworkReply::RemoteHostClosedError, msg); - finished(); } } -bool QNetworkAccessDebugPipeBackend::send(const DataPacket &packet) -{ - QByteArray ba; - { - QDataStream stream(&ba, QIODevice::WriteOnly); - stream.setVersion(QDataStream::Qt_4_4); - - stream << packet.headers << packet.data; - } - - qint32 outgoingPacketSize = ba.size(); - qint64 written = socket.write((const char*)&outgoingPacketSize, sizeof outgoingPacketSize); - written += socket.write(ba); - return quint64(written) == (outgoingPacketSize + sizeof outgoingPacketSize); -} - -bool QNetworkAccessDebugPipeBackend::receive(DataPacket &packet) +void QNetworkAccessDebugPipeBackend::socketConnected() { - if (!canReceive()) - return false; - - // canReceive() does the setting up for us - Q_ASSERT(socket.bytesAvailable() >= incomingPacketSize); - QByteArray incomingPacket = socket.read(incomingPacketSize); - QDataStream stream(&incomingPacket, QIODevice::ReadOnly); - stream.setVersion(QDataStream::Qt_4_4); - stream >> packet.headers >> packet.data; - - // reset for next packet: - incomingPacketSize = 0; - socket.setReadBufferSize(ReadBufferSize); - return true; } -bool QNetworkAccessDebugPipeBackend::canReceive() +bool QNetworkAccessDebugPipeBackend::waitForDownstreamReadyRead(int ms) { - if (incomingPacketSize == 0) { - // read the packet size - if (quint64(socket.bytesAvailable()) >= sizeof incomingPacketSize) - socket.read((char*)&incomingPacketSize, sizeof incomingPacketSize); - else - return false; - } - - if (incomingPacketSize == 0) { - QString msg = QObject::tr("Protocol error: packet of size 0 received"); - error(QNetworkReply::ProtocolFailure, msg); - finished(); - - socket.blockSignals(true); - socket.abort(); - socket.blockSignals(false); - return false; - } - - return socket.bytesAvailable() >= incomingPacketSize; + qCritical("QNetworkAccess: Debug pipe backend does not support waitForReadyRead()"); + return false; } #endif diff --git a/src/network/access/qnetworkaccessdebugpipebackend_p.h b/src/network/access/qnetworkaccessdebugpipebackend_p.h index 73a35cf..a13edc4 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend_p.h +++ b/src/network/access/qnetworkaccessdebugpipebackend_p.h @@ -66,35 +66,38 @@ class QNetworkAccessDebugPipeBackend: public QNetworkAccessBackend { Q_OBJECT public: - struct DataPacket; QNetworkAccessDebugPipeBackend(); virtual ~QNetworkAccessDebugPipeBackend(); virtual void open(); virtual void closeDownstreamChannel(); - virtual void closeUpstreamChannel(); virtual bool waitForDownstreamReadyRead(int msecs); - virtual bool waitForUpstreamBytesWritten(int msecs); - virtual void upstreamReadyRead(); virtual void downstreamReadyWrite(); +protected: + void pushFromSocketToDownstream(); + void pushFromUpstreamToSocket(); + void possiblyFinish(); + QNonContiguousByteDevice *uploadByteDevice; + private slots: + void uploadReadyReadSlot(); void socketReadyRead(); void socketBytesWritten(qint64 bytes); void socketError(); void socketDisconnected(); + void socketConnected(); private: QTcpSocket socket; - qint32 incomingPacketSize; - bool readyReadEmitted; - bool bytesWrittenEmitted; bool bareProtocol; + bool hasUploadFinished; + bool hasDownloadFinished; + bool hasEverythingFinished; - bool send(const DataPacket &packet); - bool canReceive(); - bool receive(DataPacket &packet); + qint64 bytesDownloaded; + qint64 bytesUploaded; }; class QNetworkAccessDebugPipeBackendFactory: public QNetworkAccessBackendFactory diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 8a5a665..6374fde 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -43,6 +43,7 @@ #include "qfileinfo.h" #include "qurlinfo.h" #include "qdir.h" +#include "private/qnoncontiguousbytedevice_p.h" #include @@ -77,7 +78,7 @@ QNetworkAccessFileBackendFactory::create(QNetworkAccessManager::Operation op, } QNetworkAccessFileBackend::QNetworkAccessFileBackend() - : totalBytes(0) + : uploadByteDevice(0), totalBytes(0), hasUploadFinished(false) { } @@ -126,6 +127,9 @@ void QNetworkAccessFileBackend::open() break; case QNetworkAccessManager::PutOperation: mode = QIODevice::WriteOnly | QIODevice::Truncate; + uploadByteDevice = createUploadByteDevice(); + QObject::connect(uploadByteDevice, SIGNAL(readyRead()), this, SLOT(uploadReadyReadSlot())); + QMetaObject::invokeMethod(this, "uploadReadyReadSlot", Qt::QueuedConnection); break; default: Q_ASSERT_X(false, "QNetworkAccessFileBackend::open", @@ -152,19 +156,50 @@ void QNetworkAccessFileBackend::open() } } -void QNetworkAccessFileBackend::closeDownstreamChannel() +void QNetworkAccessFileBackend::uploadReadyReadSlot() { - if (operation() == QNetworkAccessManager::GetOperation) { - file.close(); - //downstreamChannelClosed(); + if (hasUploadFinished) + return; + + forever { + qint64 haveRead; + const char *readPointer = uploadByteDevice->readPointer(-1, haveRead); + if (haveRead == -1) { + // EOF + hasUploadFinished = true; + file.flush(); + file.close(); + finished(); + break; + } else if (haveRead == 0 || readPointer == 0) { + // nothing to read right now, we will be called again later + break; + } else { + qint64 haveWritten; + haveWritten = file.write(readPointer, haveRead); + + if (haveWritten < 0) { + // write error! + QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Write error writing to %1: %2") + .arg(url().toString(), file.errorString()); + error(QNetworkReply::ProtocolFailure, msg); + + finished(); + return; + } else { + uploadByteDevice->advanceReadPointer(haveWritten); + } + + + file.flush(); + } } } -void QNetworkAccessFileBackend::closeUpstreamChannel() +void QNetworkAccessFileBackend::closeDownstreamChannel() { - if (operation() == QNetworkAccessManager::PutOperation) { + if (operation() == QNetworkAccessManager::GetOperation) { file.close(); - finished(); } } @@ -174,40 +209,6 @@ bool QNetworkAccessFileBackend::waitForDownstreamReadyRead(int) return readMoreFromFile(); } -bool QNetworkAccessFileBackend::waitForUpstreamBytesWritten(int) -{ - Q_ASSERT_X(false, "QNetworkAccessFileBackend::waitForUpstreamBytesWritten", - "This function should never have been called, since there is never anything " - "left to be written!"); - return false; -} - -void QNetworkAccessFileBackend::upstreamReadyRead() -{ - Q_ASSERT_X(operation() == QNetworkAccessManager::PutOperation, "QNetworkAccessFileBackend", - "We're being told to upload data but operation isn't PUT!"); - - // there's more data to be written to the file - while (upstreamBytesAvailable()) { - // write everything and let QFile handle it - int written = file.write(readUpstream()); - - if (written < 0) { - // write error! - QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Write error writing to %1: %2") - .arg(url().toString(), file.errorString()); - error(QNetworkReply::ProtocolFailure, msg); - - finished(); - return; - } - - // successful write - file.flush(); - upstreamBytesConsumed(written); - } -} - void QNetworkAccessFileBackend::downstreamReadyWrite() { Q_ASSERT_X(operation() == QNetworkAccessManager::GetOperation, "QNetworkAccessFileBackend", diff --git a/src/network/access/qnetworkaccessfilebackend_p.h b/src/network/access/qnetworkaccessfilebackend_p.h index ce7d351..4615c5f 100644 --- a/src/network/access/qnetworkaccessfilebackend_p.h +++ b/src/network/access/qnetworkaccessfilebackend_p.h @@ -62,22 +62,25 @@ QT_BEGIN_NAMESPACE class QNetworkAccessFileBackend: public QNetworkAccessBackend { + Q_OBJECT public: QNetworkAccessFileBackend(); virtual ~QNetworkAccessFileBackend(); virtual void open(); virtual void closeDownstreamChannel(); - virtual void closeUpstreamChannel(); virtual bool waitForDownstreamReadyRead(int msecs); - virtual bool waitForUpstreamBytesWritten(int msecs); - virtual void upstreamReadyRead(); virtual void downstreamReadyWrite(); +public slots: + void uploadReadyReadSlot(); +protected: + QNonContiguousByteDevice *uploadByteDevice; private: QFile file; qint64 totalBytes; + bool hasUploadFinished; bool loadFileInfo(); bool readMoreFromFile(); diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index ea39dec..ad55b85 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -42,6 +42,7 @@ #include "qnetworkaccessftpbackend_p.h" #include "qnetworkaccessmanager_p.h" #include "QtNetwork/qauthenticator.h" +#include "private/qnoncontiguousbytedevice_p.h" #ifndef QT_NO_FTP @@ -81,41 +82,6 @@ QNetworkAccessFtpBackendFactory::create(QNetworkAccessManager::Operation op, return 0; } -class QNetworkAccessFtpIODevice: public QIODevice -{ - //Q_OBJECT -public: - QNetworkAccessFtpBackend *backend; - bool eof; - - inline QNetworkAccessFtpIODevice(QNetworkAccessFtpBackend *parent) - : QIODevice(parent), backend(parent), eof(false) - { open(ReadOnly); } - - bool isSequential() const { return true; } - bool atEnd() const { return backend->upstreamBytesAvailable() == 0; } - - qint64 bytesAvailable() const { return backend->upstreamBytesAvailable(); } - qint64 bytesToWrite() const { return backend->downstreamBytesToConsume(); } -protected: - qint64 readData(char *data, qint64 maxlen) - { - const QByteArray toSend = backend->readUpstream(); - maxlen = qMin(maxlen, toSend.size()); - if (!maxlen) - return eof ? -1 : 0; - - backend->upstreamBytesConsumed(maxlen); - memcpy(data, toSend.constData(), maxlen); - return maxlen; - } - - qint64 writeData(const char *, qint64) - { return -1; } - - friend class QNetworkAccessFtpBackend; -}; - class QNetworkAccessFtpFtp: public QFtp, public QNetworkAccessCache::CacheableObject { // Q_OBJECT @@ -198,7 +164,11 @@ void QNetworkAccessFtpBackend::open() ftpConnectionReady(ftp); } - uploadDevice = new QNetworkAccessFtpIODevice(this); + // Put operation + if (operation() == QNetworkAccessManager::PutOperation) { + uploadDevice = QNonContiguousByteDeviceFactory::wrap(createUploadByteDevice()); + uploadDevice->setParent(this); + } } void QNetworkAccessFtpBackend::closeDownstreamChannel() @@ -212,16 +182,6 @@ void QNetworkAccessFtpBackend::closeDownstreamChannel() #endif } -void QNetworkAccessFtpBackend::closeUpstreamChannel() -{ - if (operation() == QNetworkAccessManager::PutOperation) { - Q_ASSERT(uploadDevice); - uploadDevice->eof = true; - if (!upstreamBytesAvailable()) - emit uploadDevice->readyRead(); - } -} - bool QNetworkAccessFtpBackend::waitForDownstreamReadyRead(int ms) { if (!ftp) @@ -239,18 +199,6 @@ bool QNetworkAccessFtpBackend::waitForDownstreamReadyRead(int ms) return false; } -bool QNetworkAccessFtpBackend::waitForUpstreamBytesWritten(int ms) -{ - Q_UNUSED(ms); - qCritical("QNetworkAccess: FTP backend does not support waitForBytesWritten()"); - return false; -} - -void QNetworkAccessFtpBackend::upstreamReadyRead() -{ - // uh... how does QFtp operate? -} - void QNetworkAccessFtpBackend::downstreamReadyWrite() { if (state == Transferring && ftp && ftp->bytesAvailable()) diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h index 9ec2dd8..1bb7ff2 100644 --- a/src/network/access/qnetworkaccessftpbackend_p.h +++ b/src/network/access/qnetworkaccessftpbackend_p.h @@ -87,11 +87,8 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual void closeUpstreamChannel(); virtual bool waitForDownstreamReadyRead(int msecs); - virtual bool waitForUpstreamBytesWritten(int msecs); - virtual void upstreamReadyRead(); virtual void downstreamReadyWrite(); void disconnectFromFtp(); @@ -105,7 +102,7 @@ public slots: private: friend class QNetworkAccessFtpIODevice; QPointer ftp; - QNetworkAccessFtpIODevice *uploadDevice; + QIODevice *uploadDevice; qint64 totalBytes; int helpId, sizeId, mdtmId; bool supportsSize, supportsMdtm; diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index a52b5a0..7d0438e 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -286,37 +286,6 @@ public: } }; -class QNetworkAccessHttpBackendIODevice: public QIODevice -{ - // Q_OBJECT -public: - bool eof; - QNetworkAccessHttpBackendIODevice(QNetworkAccessHttpBackend *parent) - : QIODevice(parent), eof(false) - { - setOpenMode(ReadOnly); - } - bool isSequential() const { return true; } - qint64 bytesAvailable() const - { return static_cast(parent())->upstreamBytesAvailable(); } - -protected: - virtual qint64 readData(char *buffer, qint64 maxlen) - { - qint64 ret = static_cast(parent())->deviceReadData(buffer, maxlen); - if (!ret && eof) - return -1; - return ret; - } - - virtual qint64 writeData(const char *, qint64) - { - return -1; // cannot write - } - - friend class QNetworkAccessHttpBackend; -}; - QNetworkAccessHttpBackend::QNetworkAccessHttpBackend() : QNetworkAccessBackend(), httpReply(0), http(0), uploadDevice(0) #ifndef QT_NO_OPENSSL @@ -507,20 +476,19 @@ void QNetworkAccessHttpBackend::postRequest() case QNetworkAccessManager::PostOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Post); - uploadDevice = new QNetworkAccessHttpBackendIODevice(this); + httpRequest.setUploadByteDevice(createUploadByteDevice()); break; case QNetworkAccessManager::PutOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Put); - uploadDevice = new QNetworkAccessHttpBackendIODevice(this); + httpRequest.setUploadByteDevice(createUploadByteDevice()); break; default: break; // can't happen } - httpRequest.setData(uploadDevice); httpRequest.setUrl(url()); QList headers = request().rawHeaderList(); @@ -528,7 +496,9 @@ void QNetworkAccessHttpBackend::postRequest() httpRequest.setHeaderField(header, request().rawHeader(header)); if (loadedFromCache) { - QNetworkAccessBackend::finished(); + // commented this out since it will be called later anyway + // by copyFinished() + //QNetworkAccessBackend::finished(); return; // no need to send the request! :) } @@ -624,14 +594,6 @@ void QNetworkAccessHttpBackend::closeDownstreamChannel() // this indicates that the user closed the stream while the reply isn't finished yet } -void QNetworkAccessHttpBackend::closeUpstreamChannel() -{ - // this indicates that the user finished uploading the data for POST - Q_ASSERT(uploadDevice); - uploadDevice->eof = true; - emit uploadDevice->readChannelFinished(); -} - bool QNetworkAccessHttpBackend::waitForDownstreamReadyRead(int msecs) { Q_ASSERT(http); @@ -651,38 +613,6 @@ bool QNetworkAccessHttpBackend::waitForDownstreamReadyRead(int msecs) return false; } -bool QNetworkAccessHttpBackend::waitForUpstreamBytesWritten(int msecs) -{ - - // ### FIXME: not implemented in QHttpNetworkAccess - Q_UNUSED(msecs); - qCritical("QNetworkAccess: HTTP backend does not support waitForBytesWritten()"); - return false; -} - -void QNetworkAccessHttpBackend::upstreamReadyRead() -{ - // There is more data available from the user to be uploaded - // QHttpNetworkAccess implements the upload rate control: - // we simply tell QHttpNetworkAccess that there is more data available - // it'll pull from us when it can (through uploadDevice) - - Q_ASSERT(uploadDevice); - emit uploadDevice->readyRead(); -} - -qint64 QNetworkAccessHttpBackend::deviceReadData(char *buffer, qint64 maxlen) -{ - QByteArray toBeUploaded = readUpstream(); - if (toBeUploaded.isEmpty()) - return 0; // nothing to be uploaded - - maxlen = qMin(maxlen, toBeUploaded.length()); - - memcpy(buffer, toBeUploaded.constData(), maxlen); - upstreamBytesConsumed(maxlen); - return maxlen; -} void QNetworkAccessHttpBackend::downstreamReadyWrite() { @@ -904,7 +834,14 @@ bool QNetworkAccessHttpBackend::sendCacheContents(const QNetworkCacheMetaData &m checkForRedirect(status); - writeDownstreamData(contents); + emit metaDataChanged(); + + // invoke this asynchronously, else Arora/QtDemoBrowser don't like cached downloads + // see task 250221 / 251801 + qRegisterMetaType("QIODevice*"); + QMetaObject::invokeMethod(this, "writeDownstreamData", Qt::QueuedConnection, Q_ARG(QIODevice*, contents)); + + #if defined(QNETWORKACCESSHTTPBACKEND_DEBUG) qDebug() << "Successfully sent cache:" << url() << contents->size() << "bytes"; #endif diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h index 02915e7..225f944 100644 --- a/src/network/access/qnetworkaccesshttpbackend_p.h +++ b/src/network/access/qnetworkaccesshttpbackend_p.h @@ -79,11 +79,8 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual void closeUpstreamChannel(); virtual bool waitForDownstreamReadyRead(int msecs); - virtual bool waitForUpstreamBytesWritten(int msecs); - virtual void upstreamReadyRead(); virtual void downstreamReadyWrite(); virtual void copyFinished(QIODevice *); #ifndef QT_NO_OPENSSL @@ -96,6 +93,9 @@ public: qint64 deviceReadData(char *buffer, qint64 maxlen); + // we return true since HTTP needs to send PUT/POST data again after having authenticated + bool needsResetableUploadData() {return true;}; + private slots: void replyReadyRead(); void replyFinished(); @@ -108,7 +108,8 @@ private: QHttpNetworkReply *httpReply; QPointer http; QByteArray cacheKey; - QNetworkAccessHttpBackendIODevice *uploadDevice; + QNetworkAccessBackendUploadIODevice *uploadDevice; + #ifndef QT_NO_OPENSSL QSslConfiguration *pendingSslConfiguration; bool pendingIgnoreSslErrors; @@ -122,8 +123,6 @@ private: void postRequest(); void readFromHttp(); void checkForRedirect(const int statusCode); - - friend class QNetworkAccessHttpBackendIODevice; }; class QNetworkAccessHttpBackendFactory : public QNetworkAccessBackendFactory -- cgit v0.12 From ad7b21dd57d20cd55774d7a62db117905637e950 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 13 May 2009 13:44:03 +0200 Subject: qdoc: Fixed some qdoc errors. --- src/corelib/tools/qhash.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 6c4a3ba..2313e0e 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -379,9 +379,10 @@ void QHashData::checkSanity() #endif /*! - \ + \fn uint qHash(const QPair &key) \since 4.3 - + \relates QHash + Returns the hash value for the \a key. Types \c T1 and \c T2 must be supported by qHash(). -- cgit v0.12 From 4910404284b1bb4fdde89d4fd8a420767ee52069 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 13 May 2009 13:48:13 +0200 Subject: Clearifying docs QSet::insert Chaning the sentence to clearify where the iterator points to. Task-number: 202656 Rev-by: Geir Vattekar --- doc/src/qset.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/qset.qdoc b/doc/src/qset.qdoc index 7fbf97a..afbedc3 100644 --- a/doc/src/qset.qdoc +++ b/doc/src/qset.qdoc @@ -437,7 +437,7 @@ \fn QSet::const_iterator QSet::insert(const T &value) Inserts item \a value into the set, if \a value isn't already - in the set, and returns an iterator positioned at the inserted + in the set, and returns an iterator pointing at the inserted item. \sa operator<<(), remove(), contains() -- cgit v0.12 From 87022c9a4ab00a9faaf6bcdaa8d5884962ccf305 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 13 May 2009 12:25:36 +0200 Subject: Fix handling of garbage data sent by the HTTP server instead of a proper HTTP reply. If the server's reply doesn't start with "HTTP/", then the reply is not valid. This could happen if we connected via HTTP to an HTTPS server. It could also happen with an Icecast server (reply ICY/x.y). Task-number: 248838 Reviewed-by: Markus Goetz --- src/network/access/qhttpnetworkconnection.cpp | 14 +++++++-- src/network/access/qhttpnetworkreply.cpp | 11 ++++++- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 42 ++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 5940fba..f558f2b 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -529,10 +529,20 @@ void QHttpNetworkConnectionPrivate::receiveReply(QAbstractSocket *socket, QHttpN QHttpNetworkReplyPrivate::ReplyState state = reply ? reply->d_func()->state : QHttpNetworkReplyPrivate::AllDoneState; switch (state) { case QHttpNetworkReplyPrivate::NothingDoneState: - case QHttpNetworkReplyPrivate::ReadingStatusState: - bytes += reply->d_func()->readStatus(socket); + case QHttpNetworkReplyPrivate::ReadingStatusState: { + qint64 statusBytes = reply->d_func()->readStatus(socket); + if (statusBytes == -1) { + // error reading the status, close the socket and emit error + socket->close(); + reply->d_func()->errorString = errorDetail(QNetworkReply::ProtocolFailure, socket); + emit reply->finishedWithError(QNetworkReply::ProtocolFailure, reply->d_func()->errorString); + QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); + break; + } + bytes += statusBytes; channels[i].lastStatus = reply->d_func()->statusCode; break; + } case QHttpNetworkReplyPrivate::ReadingHeaderState: bytes += reply->d_func()->readHeader(socket); if (reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) { diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index fe3f6af..1b41e1e 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -409,6 +409,9 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) if (fragment.endsWith('\r')) { fragment.truncate(fragment.length()-1); } + if (!fragment.startsWith("HTTP/")) + return -1; + parseStatus(fragment); state = ReadingHeaderState; fragment.clear(); // next fragment @@ -418,7 +421,13 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) bytes += socket->read(&c, 1); fragment.append(c); } + + // is this a valid reply? + if (fragment.length() >= 5 && !fragment.startsWith("HTTP/")) + return -1; + } + return bytes; } @@ -660,4 +669,4 @@ void QHttpNetworkReply::ignoreSslErrors() QT_END_NAMESPACE -#endif // QT_NO_HTTP \ No newline at end of file +#endif // QT_NO_HTTP diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 104b788..c97fcf3 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -172,6 +172,8 @@ private Q_SLOTS: void ioGetFromHttpsWithIgnoreSslErrors(); void ioGetFromHttpsWithSslHandshakeError(); #endif + void ioGetFromHttpBrokenServer_data(); + void ioGetFromHttpBrokenServer(); void ioGetWithManyProxies_data(); void ioGetWithManyProxies(); @@ -1887,6 +1889,46 @@ void tst_QNetworkReply::ioGetFromHttpsWithSslHandshakeError() } #endif +void tst_QNetworkReply::ioGetFromHttpBrokenServer_data() +{ + QTest::addColumn("dataToSend"); + QTest::addColumn("doDisconnect"); + + QTest::newRow("no-newline") << QByteArray("Hello World") << false; + QTest::newRow("just-newline") << QByteArray("\r\n") << false; + QTest::newRow("just-2newline") << QByteArray("\r\n\r\n") << false; + QTest::newRow("with-newlines") << QByteArray("Long first line\r\nLong second line") << false; + QTest::newRow("with-newlines2") << QByteArray("\r\nSecond line") << false; + QTest::newRow("with-newlines3") << QByteArray("ICY\r\nSecond line") << false; + + QTest::newRow("empty+disconnect") << QByteArray() << true; + + QTest::newRow("no-newline+disconnect") << QByteArray("Hello World") << true; + QTest::newRow("just-newline+disconnect") << QByteArray("\r\n") << true; + QTest::newRow("just-2newline+disconnect") << QByteArray("\r\n\r\n") << true; + QTest::newRow("with-newlines+disconnect") << QByteArray("Long first line\r\nLong second line") << true; + QTest::newRow("with-newlines2+disconnect") << QByteArray("\r\nSecond line") << true; + QTest::newRow("with-newlines3+disconnect") << QByteArray("ICY\r\nSecond line") << true; +} + +void tst_QNetworkReply::ioGetFromHttpBrokenServer() +{ + QFETCH(QByteArray, dataToSend); + QFETCH(bool, doDisconnect); + MiniHttpServer server(dataToSend); + server.doClose = doDisconnect; + + QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(reply->url(), request.url()); + QVERIFY(reply->error() != QNetworkReply::NoError); +} + void tst_QNetworkReply::ioGetWithManyProxies_data() { QTest::addColumn >("proxyList"); -- cgit v0.12 From a18ebd2a70e83863bc9a8cc64a65791a6d879f02 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 13 May 2009 13:27:01 +0200 Subject: Improve the HTTP status line parsing and catch more errors. There's no need for using QByteArrayMatcher for one single character, so avoid the overhead. Also validate the message header a bit more: we require the status line to start with "HTTP/n.m " where n and m are positive integers less than 10. Task-number: 248838 Reviewed-by: Markus Goetz --- src/network/access/qhttpnetworkreply.cpp | 58 ++++++++++++++++---------- src/network/access/qhttpnetworkreply_p.h | 2 +- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 7 ++++ 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 1b41e1e..69e0a4c 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -409,12 +409,12 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) if (fragment.endsWith('\r')) { fragment.truncate(fragment.length()-1); } - if (!fragment.startsWith("HTTP/")) - return -1; - - parseStatus(fragment); + bool ok = parseStatus(fragment); state = ReadingHeaderState; fragment.clear(); // next fragment + + if (!ok) + return -1; break; } else { c = 0; @@ -431,26 +431,40 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) return bytes; } -void QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status) +bool QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status) { - const QByteArrayMatcher sp(" "); - int i = sp.indexIn(status); - const QByteArray version = status.mid(0, i); - int j = sp.indexIn(status, i + 1); + // from RFC 2616: + // Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF + // HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT + // that makes: 'HTTP/n.n xxx Message' + // byte count: 0123456789012 + + static const int minLength = 11; + static const int dotPos = 6; + static const int spacePos = 8; + static const char httpMagic[] = "HTTP/"; + + if (status.length() < minLength + || !status.startsWith(httpMagic) + || status.at(dotPos) != '.' + || status.at(spacePos) != ' ') { + // I don't know how to parse this status line + return false; + } + + // optimize for the valid case: defer checking until the end + majorVersion = status.at(dotPos - 1) - '0'; + minorVersion = status.at(dotPos + 1) - '0'; + + int i = spacePos; + int j = status.indexOf(' ', i + 1); // j == -1 || at(j) == ' ' so j+1 == 0 && j+1 <= length() const QByteArray code = status.mid(i + 1, j - i - 1); - const QByteArray reason = status.mid(j + 1, status.count() - j); - - const QByteArrayMatcher slash("/"); - int k = slash.indexIn(version); - const QByteArrayMatcher dot("."); - int l = dot.indexIn(version, k); - const QByteArray major = version.mid(k + 1, l - k - 1); - const QByteArray minor = version.mid(l + 1, version.count() - l); - - majorVersion = QString::fromAscii(major.constData()).toInt(); - minorVersion = QString::fromAscii(minor.constData()).toInt(); - statusCode = QString::fromAscii(code.constData()).toInt(); - reasonPhrase = QString::fromAscii(reason.constData()); + + bool ok; + statusCode = code.toInt(&ok); + reasonPhrase = QString::fromLatin1(status.constData() + j + 1); + + return ok && uint(majorVersion) <= 9 && uint(minorVersion) <= 9; } qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index c17c65c..cb4d34f 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -154,7 +154,7 @@ public: QHttpNetworkReplyPrivate(const QUrl &newUrl = QUrl()); ~QHttpNetworkReplyPrivate(); qint64 readStatus(QAbstractSocket *socket); - void parseStatus(const QByteArray &status); + bool parseStatus(const QByteArray &status); qint64 readHeader(QAbstractSocket *socket); void parseHeader(const QByteArray &header); qint64 readBody(QAbstractSocket *socket, QIODevice *out); diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index c97fcf3..4be0863 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -1900,6 +1900,9 @@ void tst_QNetworkReply::ioGetFromHttpBrokenServer_data() QTest::newRow("with-newlines") << QByteArray("Long first line\r\nLong second line") << false; QTest::newRow("with-newlines2") << QByteArray("\r\nSecond line") << false; QTest::newRow("with-newlines3") << QByteArray("ICY\r\nSecond line") << false; + QTest::newRow("invalid-version") << QByteArray("HTTP/123 200 \r\n") << false; + QTest::newRow("invalid-version2") << QByteArray("HTTP/a.\033 200 \r\n") << false; + QTest::newRow("invalid-reply-code") << QByteArray("HTTP/1.0 fuu \r\n") << false; QTest::newRow("empty+disconnect") << QByteArray() << true; @@ -1909,6 +1912,10 @@ void tst_QNetworkReply::ioGetFromHttpBrokenServer_data() QTest::newRow("with-newlines+disconnect") << QByteArray("Long first line\r\nLong second line") << true; QTest::newRow("with-newlines2+disconnect") << QByteArray("\r\nSecond line") << true; QTest::newRow("with-newlines3+disconnect") << QByteArray("ICY\r\nSecond line") << true; + + QTest::newRow("invalid-version+disconnect") << QByteArray("HTTP/123 200 ") << true; + QTest::newRow("invalid-version2+disconnect") << QByteArray("HTTP/a.\033 200 ") << true; + QTest::newRow("invalid-reply-code+disconnect") << QByteArray("HTTP/1.0 fuu ") << true; } void tst_QNetworkReply::ioGetFromHttpBrokenServer() -- cgit v0.12 From 3cd4b6e00e3448d880ae2335bd50f70d9a5d0fca Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 13 May 2009 13:56:44 +0200 Subject: correctly handle multiple event transitions for same (object,event) The event filter was not removed at the right time. We now store the number of active event transitions for a particular (object,event) and only remove the filtering when the count drops to zero. --- src/corelib/statemachine/qstatemachine.cpp | 19 ++++++---- src/corelib/statemachine/qstatemachine_p.h | 2 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 48 ++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 2f620c7..046fbb4 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1407,7 +1407,7 @@ void QStateMachinePrivate::registerEventTransition(QEventTransition *transition) QObjectPrivate *od = QObjectPrivate::get(object); if (!od->eventFilters.contains(q)) object->installEventFilter(q); - qobjectEvents[object].insert(transition->eventType()); + ++qobjectEvents[object][transition->eventType()]; QEventTransitionPrivate::get(transition)->registered = true; #ifdef QSTATEMACHINE_DEBUG qDebug() << q << ": added event transition from" << transition->sourceState() @@ -1422,11 +1422,18 @@ void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transitio if (!QEventTransitionPrivate::get(transition)->registered) return; QObject *object = QEventTransitionPrivate::get(transition)->object; - QSet &events = qobjectEvents[object]; - events.remove(transition->eventType()); - if (events.isEmpty()) { - qobjectEvents.remove(object); - object->removeEventFilter(q); + QHash &events = qobjectEvents[object]; + Q_ASSERT(events.value(transition->eventType()) > 0); + if (--events[transition->eventType()] == 0) { + events.remove(transition->eventType()); + int sum = 0; + QHash::const_iterator it; + for (it = events.constBegin(); it != events.constEnd(); ++it) + sum += it.value(); + if (sum == 0) { + qobjectEvents.remove(object); + object->removeEventFilter(q); + } } QEventTransitionPrivate::get(transition)->registered = false; } diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h index 9b4b861..dfa5575 100644 --- a/src/corelib/statemachine/qstatemachine_p.h +++ b/src/corelib/statemachine/qstatemachine_p.h @@ -200,7 +200,7 @@ public: QHash > connections; #ifndef QT_NO_STATEMACHINE_EVENTFILTER - QHash > qobjectEvents; + QHash > qobjectEvents; #endif QHash delayedEvents; diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 3f94ad9..f8a778a 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1881,6 +1881,54 @@ void tst_QStateMachine::eventTransitions() QTRY_COMPARE(finishedSpy.count(), 1); } + // Multiple transitions for same (object,event) + { + QStateMachine machine; + QState *s0 = new QState(machine.rootState()); + QState *s1 = new QState(machine.rootState()); + QEventTransition *t0 = new QEventTransition(&button, QEvent::MouseButtonPress); + t0->setTargetState(s1); + s0->addTransition(t0); + QEventTransition *t1 = new QEventTransition(&button, QEvent::MouseButtonPress); + t1->setTargetState(s0); + s1->addTransition(t1); + + QSignalSpy finishedSpy(&machine, SIGNAL(finished())); + machine.setInitialState(s0); + machine.start(); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + QTest::mousePress(&button, Qt::LeftButton); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s1)); + + s0->removeTransition(t0); + QTest::mousePress(&button, Qt::LeftButton); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + QTest::mousePress(&button, Qt::LeftButton); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + s1->removeTransition(t1); + QTest::mousePress(&button, Qt::LeftButton); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + s0->addTransition(t0); + s1->addTransition(t1); + QTest::mousePress(&button, Qt::LeftButton); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s1)); + } } void tst_QStateMachine::historyStates() -- cgit v0.12 From a82714c6c82f682e02969d9afa551f37f8132653 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 13 May 2009 13:56:44 +0200 Subject: correctly handle multiple event transitions for same (object,event) The event filter was not removed at the right time. We now store the number of active event transitions for a particular (object,event) and only remove the filtering when the count drops to zero. --- src/corelib/statemachine/qstatemachine.cpp | 19 ++++++---- src/corelib/statemachine/qstatemachine_p.h | 2 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 48 ++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 2f620c7..046fbb4 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1407,7 +1407,7 @@ void QStateMachinePrivate::registerEventTransition(QEventTransition *transition) QObjectPrivate *od = QObjectPrivate::get(object); if (!od->eventFilters.contains(q)) object->installEventFilter(q); - qobjectEvents[object].insert(transition->eventType()); + ++qobjectEvents[object][transition->eventType()]; QEventTransitionPrivate::get(transition)->registered = true; #ifdef QSTATEMACHINE_DEBUG qDebug() << q << ": added event transition from" << transition->sourceState() @@ -1422,11 +1422,18 @@ void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transitio if (!QEventTransitionPrivate::get(transition)->registered) return; QObject *object = QEventTransitionPrivate::get(transition)->object; - QSet &events = qobjectEvents[object]; - events.remove(transition->eventType()); - if (events.isEmpty()) { - qobjectEvents.remove(object); - object->removeEventFilter(q); + QHash &events = qobjectEvents[object]; + Q_ASSERT(events.value(transition->eventType()) > 0); + if (--events[transition->eventType()] == 0) { + events.remove(transition->eventType()); + int sum = 0; + QHash::const_iterator it; + for (it = events.constBegin(); it != events.constEnd(); ++it) + sum += it.value(); + if (sum == 0) { + qobjectEvents.remove(object); + object->removeEventFilter(q); + } } QEventTransitionPrivate::get(transition)->registered = false; } diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h index 9b4b861..dfa5575 100644 --- a/src/corelib/statemachine/qstatemachine_p.h +++ b/src/corelib/statemachine/qstatemachine_p.h @@ -200,7 +200,7 @@ public: QHash > connections; #ifndef QT_NO_STATEMACHINE_EVENTFILTER - QHash > qobjectEvents; + QHash > qobjectEvents; #endif QHash delayedEvents; diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 3f94ad9..f8a778a 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1881,6 +1881,54 @@ void tst_QStateMachine::eventTransitions() QTRY_COMPARE(finishedSpy.count(), 1); } + // Multiple transitions for same (object,event) + { + QStateMachine machine; + QState *s0 = new QState(machine.rootState()); + QState *s1 = new QState(machine.rootState()); + QEventTransition *t0 = new QEventTransition(&button, QEvent::MouseButtonPress); + t0->setTargetState(s1); + s0->addTransition(t0); + QEventTransition *t1 = new QEventTransition(&button, QEvent::MouseButtonPress); + t1->setTargetState(s0); + s1->addTransition(t1); + + QSignalSpy finishedSpy(&machine, SIGNAL(finished())); + machine.setInitialState(s0); + machine.start(); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + QTest::mousePress(&button, Qt::LeftButton); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s1)); + + s0->removeTransition(t0); + QTest::mousePress(&button, Qt::LeftButton); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + QTest::mousePress(&button, Qt::LeftButton); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + s1->removeTransition(t1); + QTest::mousePress(&button, Qt::LeftButton); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s0)); + + s0->addTransition(t0); + s1->addTransition(t1); + QTest::mousePress(&button, Qt::LeftButton); + QCoreApplication::processEvents(); + QCOMPARE(machine.configuration().size(), 1); + QVERIFY(machine.configuration().contains(s1)); + } } void tst_QStateMachine::historyStates() -- cgit v0.12 From 56191830cdad9cbaa81c2ed8f22f1b2650a5608a Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 13 May 2009 13:58:18 +0200 Subject: Turn off Link Time Code Generation (/LTCG) by default Turning on LTCG affected too many projects, where customers applications would take a long time linking, severly affecting their development time (even though it was only added for release builds) We turn it off by default, and add a -ltcg configuration option, and the possibility to also do CONFIG+=ltcg in projects, should they not want it for Qt, but in their own projects. (Same, they can build Qt with it, and do CONFIG-=ltcg for their project) Reviewed-by: andy --- configure.exe | Bin 860160 -> 856064 bytes mkspecs/features/win32/ltcg.prf | 5 +++++ mkspecs/win32-msvc2005/qmake.conf | 7 +++++-- mkspecs/win32-msvc2008/qmake.conf | 7 +++++-- tools/configure/configureapp.cpp | 13 +++++++++++++ 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 mkspecs/features/win32/ltcg.prf diff --git a/configure.exe b/configure.exe index ff71f08..40843b4 100644 Binary files a/configure.exe and b/configure.exe differ diff --git a/mkspecs/features/win32/ltcg.prf b/mkspecs/features/win32/ltcg.prf new file mode 100644 index 0000000..f6f1299 --- /dev/null +++ b/mkspecs/features/win32/ltcg.prf @@ -0,0 +1,5 @@ +CONFIG(release, debug|release) { + QMAKE_CFLAGS *= $$QMAKE_CFLAGS_LTCG + QMAKE_CXXFLAGS *= $$QMAKE_CXXFLAGS_LTCG + QMAKE_LFLAGS *= $$QMAKE_LFLAGS_LTCG +} diff --git a/mkspecs/win32-msvc2005/qmake.conf b/mkspecs/win32-msvc2005/qmake.conf index 00287cb..5ed8e01 100644 --- a/mkspecs/win32-msvc2005/qmake.conf +++ b/mkspecs/win32-msvc2005/qmake.conf @@ -19,9 +19,10 @@ QMAKE_YACCFLAGS = -d QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 -QMAKE_CFLAGS_RELEASE = -O2 -MD -GL +QMAKE_CFLAGS_RELEASE = -O2 -MD QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = +QMAKE_CFLAGS_LTCG = -GL QMAKE_CXX = $$QMAKE_CC QMAKE_CXXFLAGS = $$QMAKE_CFLAGS @@ -30,6 +31,7 @@ QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG QMAKE_CXXFLAGS_STL_ON = -EHsc QMAKE_CXXFLAGS_STL_OFF = QMAKE_CXXFLAGS_RTTI_ON = -GR @@ -50,11 +52,12 @@ QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link QMAKE_LFLAGS = /NOLOGO -QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO /LTCG +QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO QMAKE_LFLAGS_DEBUG = /DEBUG QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" QMAKE_LFLAGS_DLL = /DLL +QMAKE_LFLAGS_LTCG = /LTCG QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib advapi32.lib diff --git a/mkspecs/win32-msvc2008/qmake.conf b/mkspecs/win32-msvc2008/qmake.conf index b56b41c..373a36d 100644 --- a/mkspecs/win32-msvc2008/qmake.conf +++ b/mkspecs/win32-msvc2008/qmake.conf @@ -19,9 +19,10 @@ QMAKE_YACCFLAGS = -d QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 -QMAKE_CFLAGS_RELEASE = -O2 -MD -GL +QMAKE_CFLAGS_RELEASE = -O2 -MD QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = +QMAKE_CFLAGS_LTCG = -GL QMAKE_CXX = $$QMAKE_CC QMAKE_CXXFLAGS = $$QMAKE_CFLAGS @@ -30,6 +31,7 @@ QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG QMAKE_CXXFLAGS_STL_ON = -EHsc QMAKE_CXXFLAGS_STL_OFF = QMAKE_CXXFLAGS_RTTI_ON = -GR @@ -50,11 +52,12 @@ QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link QMAKE_LFLAGS = /NOLOGO -QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO /LTCG +QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO QMAKE_LFLAGS_DEBUG = /DEBUG QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" QMAKE_LFLAGS_DLL = /DLL +QMAKE_LFLAGS_LTCG = /LTCG QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib advapi32.lib diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index bcbf557..91344c8 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -351,6 +351,7 @@ Configure::Configure( int& argc, char** argv ) dictionary[ "QMAKESPEC" ] = tmp; dictionary[ "INCREDIBUILD_XGE" ] = "auto"; + dictionary[ "LTCG" ] = "no"; } Configure::~Configure() @@ -487,6 +488,12 @@ void Configure::parseCmdLine() else if( configCmdLine.at(i) == "-commercial" ) { dictionary[ "BUILDTYPE" ] = "commercial"; } + else if( configCmdLine.at(i) == "-ltcg" ) { + dictionary[ "LTCG" ] = "yes"; + } + else if( configCmdLine.at(i) == "-no-ltcg" ) { + dictionary[ "LTCG" ] = "no"; + } #endif else if( configCmdLine.at(i) == "-platform" ) { @@ -1465,6 +1472,9 @@ bool Configure::displayHelp() desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries."); desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n"); + desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)"); + desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n"); + desc("FAST", "no", "-no-fast", "Configure Qt normally by generating Makefiles for all project files."); desc("FAST", "yes", "-fast", "Configure Qt quickly by generating Makefiles only for library and " "subdirectory targets. All other Makefiles are created as wrappers " @@ -2494,6 +2504,8 @@ void Configure::generateCachefile() else configStream << " static"; + if( dictionary[ "LTCG" ] == "yes" ) + configStream << " ltcg"; if( dictionary[ "STL" ] == "yes" ) configStream << " stl"; if ( dictionary[ "EXCEPTIONS" ] == "yes" ) @@ -2916,6 +2928,7 @@ void Configure::displayConfig() cout << "Architecture................" << dictionary[ "ARCHITECTURE" ] << endl; cout << "Maketool...................." << dictionary[ "MAKE" ] << endl; cout << "Debug symbols..............." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl; + cout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl; cout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl; cout << "STL support................." << dictionary[ "STL" ] << endl; cout << "Exception support..........." << dictionary[ "EXCEPTIONS" ] << endl; -- cgit v0.12 From bb000e03fc1e876eb6ee0d02de15a0bc9a6ea1b8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 13 May 2009 14:53:24 +0200 Subject: Added API for quietly saving a form. Task-number: 163220 Added to FormWindowBase. Required among other things for Qt Creator code completion for uic-generated-headers. Acked-by: dt --- tools/designer/src/lib/shared/formwindowbase.cpp | 10 +++++++++- tools/designer/src/lib/shared/formwindowbase_p.h | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/designer/src/lib/shared/formwindowbase.cpp b/tools/designer/src/lib/shared/formwindowbase.cpp index 3e7e17b..b569b51 100644 --- a/tools/designer/src/lib/shared/formwindowbase.cpp +++ b/tools/designer/src/lib/shared/formwindowbase.cpp @@ -55,7 +55,7 @@ TRANSLATOR qdesigner_internal::FormWindowBase #include "deviceprofile_p.h" #include "qdesigner_utils_p.h" -#include +#include "qsimpleresource_p.h" #include #include @@ -482,6 +482,14 @@ void FormWindowBase::setupDefaultAction(QDesignerFormWindowInterface *fw) QObject::connect(fw, SIGNAL(activated(QWidget*)), fw, SLOT(triggerDefaultAction(QWidget*))); } +QString FormWindowBase::fileContents() const +{ + const bool oldValue = QSimpleResource::setWarningsEnabled(false); + const QString rc = contents(); + QSimpleResource::setWarningsEnabled(oldValue); + return rc; +} + } // namespace qdesigner_internal QT_END_NAMESPACE diff --git a/tools/designer/src/lib/shared/formwindowbase_p.h b/tools/designer/src/lib/shared/formwindowbase_p.h index 68e977e..0891f6e 100644 --- a/tools/designer/src/lib/shared/formwindowbase_p.h +++ b/tools/designer/src/lib/shared/formwindowbase_p.h @@ -90,6 +90,9 @@ public: QVariantMap formData(); void setFormData(const QVariantMap &vm); + // Return contents without warnings. Should be 'contents(bool quiet)' + QString fileContents() const; + // Return the widget containing the form. This is used to // apply embedded design settings to that are inherited (for example font). // These are meant to be applied to the form only and not to the other editors -- cgit v0.12 From 960d2a7639062b6582d460aaae140b4d2e0a8b70 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 13 May 2009 14:59:52 +0200 Subject: Adding details to QVariant docs Adding note about requriements for converting QVariants Task-number: 192607 Rev-by: David Boddie --- src/corelib/kernel/qvariant.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index b4427c0..0a0500d 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1187,8 +1187,9 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler; and versatile, but may prove less memory and speed efficient than storing specific types in standard data structures. - QVariant also supports the notion of null values, where you have - a defined type with no value set. + QVariant also supports the notion of null values, where you can + have a defined type with no value set. However, note that QVariant + types can only be cast when they have had a value set. \snippet doc/src/snippets/code/src_corelib_kernel_qvariant.cpp 1 -- cgit v0.12 From 62677589caf8b2f45f369cfc9df30ded323c4155 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 13 May 2009 15:13:10 +0200 Subject: Cleaning docs Highlight part of the general description in QTimeLine Task-number: 218487 Rev-by: Geir Vattekar --- src/corelib/tools/qtimeline.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp index 2979a09..3a03558 100644 --- a/src/corelib/tools/qtimeline.cpp +++ b/src/corelib/tools/qtimeline.cpp @@ -225,7 +225,9 @@ void QTimeLinePrivate::setCurrentTime(int msecs) valueForTime() and emitting valueChanged(). By default, valueForTime() applies an interpolation algorithm to generate these value. You can choose from a set of predefined timeline algorithms by calling - setCurveShape(). By default, QTimeLine uses the EaseInOut curve shape, + setCurveShape(). + + Note that by default, QTimeLine uses the EaseInOut curve shape, which provides a value that grows slowly, then grows steadily, and finally grows slowly. For a custom timeline, you can reimplement valueForTime(), in which case QTimeLine's curveShape property is ignored. -- cgit v0.12 From 9820412d2551b655fec24ffde7b2a56e3ad168ea Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Wed, 13 May 2009 15:34:34 +0200 Subject: Ensure that sheets are hidden if the parents are hidden in Carbon. Seems to work correctly in Cocoa, but we need to handle this special case in Carbon ourselves. Task-number: 253324 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget_mac.mm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 6d3da61..6524bc9 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -728,6 +728,7 @@ static OSWindowRef qt_mac_create_window(QWidget *, WindowClass wclass, WindowAtt static EventTypeSpec window_events[] = { { kEventClassWindow, kEventWindowClose }, { kEventClassWindow, kEventWindowExpanded }, + { kEventClassWindow, kEventWindowHidden }, { kEventClassWindow, kEventWindowZoomed }, { kEventClassWindow, kEventWindowCollapsed }, { kEventClassWindow, kEventWindowToolbarSwitchMode }, @@ -997,6 +998,19 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, } } } + } else if (ekind == kEventWindowHidden) { + // Make sure that we also hide any visible sheets on our window. + // Cocoa does the right thing for us. + const QObjectList children = widget->children(); + const int childCount = children.count(); + for (int i = 0; i < childCount; ++i) { + QObject *obj = children.at(i); + if (obj->isWidgetType()) { + QWidget *widget = static_cast(obj); + if (qt_mac_is_macsheet(widget) && widget->isVisible()) + widget->hide(); + } + } } else { handled_event = false; } -- cgit v0.12 From 1c22d96f15d46c222bf5f1720e3e49e202a6c941 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 12 May 2009 17:58:27 +0200 Subject: HTTP backend / network cache: only cache responses to GET by default responses to POST might be cacheable, but are not cacheable by default; responses to PUT or DELETE are never cacheable. Reviewed-by: Thiago Macieira Task-number: 252281 --- src/network/access/qnetworkaccesshttpbackend.cpp | 42 +++++++++++++++++------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index a52b5a0..f214699 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -1036,21 +1036,39 @@ QNetworkCacheMetaData QNetworkAccessHttpBackend::fetchCacheMetaData(const QNetwo if (it != cacheHeaders.rawHeaders.constEnd()) metaData.setLastModified(QNetworkHeadersPrivate::fromHttpDate(it->second)); - bool canDiskCache = true; // Everything defaults to being cacheable on disk - - // 14.32 - // HTTP/1.1 caches SHOULD treat "Pragma: no-cache" as if the client - // had sent "Cache-Control: no-cache". - it = cacheHeaders.findRawHeader("pragma"); - if (it != cacheHeaders.rawHeaders.constEnd() - && it->second == "no-cache") - canDiskCache = false; + bool canDiskCache; + // only cache GET replies by default, all other replies (POST, PUT, DELETE) + // are not cacheable by default (according to RFC 2616 section 9) + if (httpReply->request().operation() == QHttpNetworkRequest::Get) { + + canDiskCache = true; + // 14.32 + // HTTP/1.1 caches SHOULD treat "Pragma: no-cache" as if the client + // had sent "Cache-Control: no-cache". + it = cacheHeaders.findRawHeader("pragma"); + if (it != cacheHeaders.rawHeaders.constEnd() + && it->second == "no-cache") + canDiskCache = false; + + // HTTP/1.1. Check the Cache-Control header + if (cacheControl.contains("no-cache")) + canDiskCache = false; + else if (cacheControl.contains("no-store")) + canDiskCache = false; + + // responses to POST might be cacheable + } else if (httpReply->request().operation() == QHttpNetworkRequest::Post) { - // HTTP/1.1. Check the Cache-Control header - if (cacheControl.contains("no-cache")) canDiskCache = false; - else if (cacheControl.contains("no-store")) + // some pages contain "expires:" and "cache-control: no-cache" field, + // so we only might cache POST requests if we get "cache-control: max-age ..." + if (cacheControl.contains("max-age")) + canDiskCache = true; + + // responses to PUT and DELETE are not cacheable + } else { canDiskCache = false; + } metaData.setSaveToDisk(canDiskCache); int statusCode = httpReply->statusCode(); -- cgit v0.12 From 484ad0eccc84488b57d58a1223760623c70389a5 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 13 May 2009 17:10:43 +0200 Subject: Correcting bug in cardLayout example Adding the count() function to the example. Task-number: 220766 Rev-by: Geir Vattekar --- doc/src/layout.qdoc | 16 +++++++----- doc/src/snippets/code/doc_src_layout.qdoc | 41 +++++++++++++++++-------------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/doc/src/layout.qdoc b/doc/src/layout.qdoc index 55dfd8b..196999b 100644 --- a/doc/src/layout.qdoc +++ b/doc/src/layout.qdoc @@ -315,7 +315,11 @@ \snippet doc/src/snippets/code/doc_src_layout.qdoc 1 - First we define two functions that iterate over the layout: \c{itemAt()} + First we define \c{count()} to fetch the number of items in the list. + + \snippet doc/src/snippets/code/doc_src_layout.qdoc 2 + + Then we define two functions that iterate over the layout: \c{itemAt()} and \c{takeAt()}. These functions are used internally by the layout system to handle deletion of widgets. They are also available for application programmers. @@ -326,7 +330,7 @@ structure, we may have to spend more effort defining a linear order for the items. - \snippet doc/src/snippets/code/doc_src_layout.qdoc 2 + \snippet doc/src/snippets/code/doc_src_layout.qdoc 3 \c{addItem()} implements the default placement strategy for layout items. This function must be implemented. It is used by QLayout::add(), by the @@ -336,26 +340,26 @@ QGridLayout::addItem(), QGridLayout::addWidget(), and QGridLayout::addLayout(). - \snippet doc/src/snippets/code/doc_src_layout.qdoc 3 + \snippet doc/src/snippets/code/doc_src_layout.qdoc 4 The layout takes over responsibility of the items added. Since QLayoutItem does not inherit QObject, we must delete the items manually. The function QLayout::deleteAllItems() uses \c{takeAt()} defined above to delete all the items in the layout. - \snippet doc/src/snippets/code/doc_src_layout.qdoc 4 + \snippet doc/src/snippets/code/doc_src_layout.qdoc 5 The \c{setGeometry()} function actually performs the layout. The rectangle supplied as an argument does not include \c{margin()}. If relevant, use \c{spacing()} as the distance between items. - \snippet doc/src/snippets/code/doc_src_layout.qdoc 5 + \snippet doc/src/snippets/code/doc_src_layout.qdoc 6 \c{sizeHint()} and \c{minimumSize()} are normally very similar in implementation. The sizes returned by both functions should include \c{spacing()}, but not \c{margin()}. - \snippet doc/src/snippets/code/doc_src_layout.qdoc 6 + \snippet doc/src/snippets/code/doc_src_layout.qdoc 7 \section2 Further Notes diff --git a/doc/src/snippets/code/doc_src_layout.qdoc b/doc/src/snippets/code/doc_src_layout.qdoc index 48e10e9..fedcf0c 100644 --- a/doc/src/snippets/code/doc_src_layout.qdoc +++ b/doc/src/snippets/code/doc_src_layout.qdoc @@ -2,23 +2,21 @@ #ifndef CARD_H #define CARD_H -#include +#include #include class CardLayout : public QLayout { public: - CardLayout(QWidget *parent, int dist) - : QLayout(parent, 0, dist) {} - CardLayout(QLayout *parent, int dist) - : QLayout(parent, dist) {} - CardLayout(int dist) - : QLayout(dist) {} + CardLayout(QWidget *parent, int dist): QLayout(parent, 0, dist) {} + CardLayout(QLayout *parent, int dist): QLayout(parent, dist) {} + CardLayout(int dist): QLayout(dist) {} ~CardLayout(); void addItem(QLayoutItem *item); QSize sizeHint() const; QSize minimumSize() const; + QLayoutItem *count() const; QLayoutItem *itemAt(int) const; QLayoutItem *takeAt(int); void setGeometry(const QRect &rect); @@ -31,11 +29,18 @@ private: //! [1] -#include "card.h" +//#include "card.h" //! [1] - //! [2] +QLayoutItem *CardLayout::count() const +{ + // QList::size() returns the number of QLayoutItems in the list + return list.size(); +} +//! [2] + +//! [3] QLayoutItem *CardLayout::itemAt(int idx) const { // QList::value() performs index checking, and returns 0 if we are @@ -48,26 +53,26 @@ QLayoutItem *CardLayout::takeAt(int idx) // QList::take does not do index checking return idx >= 0 && idx < list.size() ? list.takeAt(idx) : 0; } -//! [2] +//! [3] -//! [3] +//! [4] void CardLayout::addItem(QLayoutItem *item) { list.append(item); } -//! [3] +//! [4] -//! [4] +//! [5] CardLayout::~CardLayout() { deleteAllItems(); } -//! [4] +//! [5] -//! [5] +//! [6] void CardLayout::setGeometry(const QRect &r) { QLayout::setGeometry(r); @@ -85,10 +90,10 @@ void CardLayout::setGeometry(const QRect &r) ++i; } } -//! [5] +//! [6] -//! [6] +//! [7] QSize CardLayout::sizeHint() const { QSize s(0,0); @@ -116,4 +121,4 @@ QSize CardLayout::minimumSize() const } return s + n*QSize(spacing(), spacing()); } -//! [6] +//! [7] \ No newline at end of file -- cgit v0.12 From 54ad50c99fee0db0dc9a64ee16dfcc4315b9d86d Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 14 May 2009 09:41:08 +1000 Subject: Fix broken wince build. The WinCE build was failing due to a spelling error in an #ifdef directive. Reviewed-by: Trust Me --- src/gui/widgets/qmenu_wince.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp index fbe54fe..42a4e0b 100644 --- a/src/gui/widgets/qmenu_wince.cpp +++ b/src/gui/widgets/qmenu_wince.cpp @@ -214,7 +214,7 @@ static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, i mbi.nToolBarId = toolbarID; if (ptrCreateMenuBar(&mbi)) { -#ifdef Q_WS_WINCE_WM +#ifdef Q_OS_WINCE_WM // Tell the menu bar that we want to override hot key behaviour. LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, SHMBOF_NODEFAULT | SHMBOF_NOTIFY); -- cgit v0.12 From 594bc93fc36e2d0aada9c11a7957db7fd4b11c15 Mon Sep 17 00:00:00 2001 From: Andre Haupt Date: Thu, 14 May 2009 04:34:01 +0200 Subject: doc: fix two typos in tthe style sheet documentation Signed-off-by: Andre Haupt --- doc/src/stylesheet.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/stylesheet.qdoc b/doc/src/stylesheet.qdoc index c0d13da..0f99688 100644 --- a/doc/src/stylesheet.qdoc +++ b/doc/src/stylesheet.qdoc @@ -398,7 +398,7 @@ (usually) refers to a single object, not to all instances of a class. - Similarly, selectors with pseudo-states are more specific that + Similarly, selectors with pseudo-states are more specific than ones that do not specify pseudo-states. Thus, the following style sheet specifies that a \l{QPushButton} should have white text when the mouse is hovering over it, otherwise red text: @@ -653,7 +653,7 @@ \target sub controls \section1 Sub-controls - A widget is considered as a heirarchy (tree) of subcontrols drawn on top + A widget is considered as a hierarchy (tree) of subcontrols drawn on top of each other. For example, the QComboBox draws the drop-down sub-control followed by the down-arrow sub-control. A QComboBox is thus rendered as follows: -- cgit v0.12 From dd20c403fa6ec99cf4aec02655a16a97320734c3 Mon Sep 17 00:00:00 2001 From: Andre Haupt Date: Thu, 14 May 2009 04:44:19 +0200 Subject: replace all occurences of "heirarchy" with "hierarchy" Signed-off-by: Andre Haupt --- src/corelib/io/qresource.cpp | 2 +- src/gui/widgets/qmenu_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 779a742..3b704f6 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -449,7 +449,7 @@ QString QResource::absoluteFilePath() const } /*! - Returns true if the resource really exists in the resource heirarchy, + Returns true if the resource really exists in the resource hierarchy, false otherwise. */ diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index dddd83e..edfeee7 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -208,7 +208,7 @@ public: QString searchBuffer; QBasicTimer searchBufferTimer; - //passing of mouse events up the parent heirarchy + //passing of mouse events up the parent hierarchy QPointer activeMenu; bool mouseEventTaken(QMouseEvent *); -- cgit v0.12 From 514fff516a1b4a6f2cb0d648c5fcfa29514ea211 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 14 May 2009 13:12:32 +1000 Subject: Add gcov flags --- tests/auto/declarative/qmlbindengine/qmlbindengine.pro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/declarative/qmlbindengine/qmlbindengine.pro b/tests/auto/declarative/qmlbindengine/qmlbindengine.pro index 6d84931..800d9a0 100644 --- a/tests/auto/declarative/qmlbindengine/qmlbindengine.pro +++ b/tests/auto/declarative/qmlbindengine/qmlbindengine.pro @@ -1,3 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle SOURCES += tst_qmlbindengine.cpp + +# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage +# LIBS += -lgcov -- cgit v0.12 From 875c4af96f094dad9158d77e926049dbf9a75475 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 14 May 2009 13:38:20 +1000 Subject: GridView shall not crash when given a broken delegate. --- src/declarative/fx/qfxgridview.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 5156d06..e745b24 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -409,7 +409,8 @@ void QFxGridViewPrivate::refill(qreal from, qreal to) FxGridItem *item = 0; while (modelIndex < model->count() && rowPos <= to) { //qDebug() << "refill: append item" << modelIndex; - item = getItem(modelIndex); + if (!(item = getItem(modelIndex))) + break; item->setPosition(colPos, rowPos); visibleItems.append(item); colPos += colSize(); @@ -431,7 +432,8 @@ void QFxGridViewPrivate::refill(qreal from, qreal to) } while (visibleIndex > 0 && rowPos + rowSize() - 1 >= from){ //qDebug() << "refill: prepend item" << visibleIndex-1 << "top pos" << rowPos << colPos; - item = getItem(visibleIndex-1); + if (!(item = getItem(visibleIndex-1))) + break; --visibleIndex; item->setPosition(colPos, rowPos); visibleItems.prepend(item); @@ -629,14 +631,17 @@ void QFxGridViewPrivate::updateCurrent(int modelIndex) currentItem = visibleItem(modelIndex); if (!currentItem) { currentItem = getItem(modelIndex); - currentItem->setPosition(colPosAt(modelIndex), rowPosAt(modelIndex)); + if (currentItem) + currentItem->setPosition(colPosAt(modelIndex), rowPosAt(modelIndex)); } currentIndex = modelIndex; fixCurrentVisibility = true; - if (oldCurrentItem && oldCurrentItem->item != currentItem->item) + if (oldCurrentItem && (!currentItem || oldCurrentItem->item != currentItem->item)) oldCurrentItem->attached->setIsCurrentItem(false); - currentItem->item->setFocus(true); - currentItem->attached->setIsCurrentItem(true); + if (currentItem) { + currentItem->item->setFocus(true); + currentItem->attached->setIsCurrentItem(true); + } updateHighlight(); emit q->currentIndexChanged(); // Release the old current item -- cgit v0.12 From 8ac395b4293433d3d98e4e8d9825f86d6a351d69 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 14 May 2009 13:38:25 +1000 Subject: Cleanup testcase --- .../auto/declarative/qmlbindengine/bindingLoop.txt | 12 ++++++++++++ .../boolPropertiesEvaluateAsBool.1.txt | 3 +++ .../boolPropertiesEvaluateAsBool.2.txt | 3 +++ tests/auto/declarative/qmlbindengine/methods.1.txt | 4 ++++ tests/auto/declarative/qmlbindengine/methods.2.txt | 4 ++++ .../qmlbindengine/signalAssignment.1.txt | 3 +++ .../qmlbindengine/signalAssignment.2.txt | 3 +++ .../qmlbindengine/tst_qmlbindengine.cpp | 22 +++++++++++----------- 8 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 tests/auto/declarative/qmlbindengine/bindingLoop.txt create mode 100644 tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.1.txt create mode 100644 tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.2.txt create mode 100644 tests/auto/declarative/qmlbindengine/methods.1.txt create mode 100644 tests/auto/declarative/qmlbindengine/methods.2.txt create mode 100644 tests/auto/declarative/qmlbindengine/signalAssignment.1.txt create mode 100644 tests/auto/declarative/qmlbindengine/signalAssignment.2.txt diff --git a/tests/auto/declarative/qmlbindengine/bindingLoop.txt b/tests/auto/declarative/qmlbindengine/bindingLoop.txt new file mode 100644 index 0000000..e27a76c --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/bindingLoop.txt @@ -0,0 +1,12 @@ +MyQmlContainer { + children : [ + MyQmlObject { + id: Object1 + stringProperty: "hello" + Object2.stringProperty + }, + MyQmlObject { + id: Object2 + stringProperty: "hello" + Object1.stringProperty + } + ] +} diff --git a/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.1.txt b/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.1.txt new file mode 100644 index 0000000..7368ff6 --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.1.txt @@ -0,0 +1,3 @@ +MyQmlObject { + stringProperty: trueProperty?'pass':'fail' +} diff --git a/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.2.txt b/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.2.txt new file mode 100644 index 0000000..c74493e --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.2.txt @@ -0,0 +1,3 @@ +MyQmlObject { + stringProperty: falseProperty?'fail':'pass' +} diff --git a/tests/auto/declarative/qmlbindengine/methods.1.txt b/tests/auto/declarative/qmlbindengine/methods.1.txt new file mode 100644 index 0000000..35279e0 --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/methods.1.txt @@ -0,0 +1,4 @@ +MyQmlObject { + id: MyObject + onBasicSignal: MyObject.method() +} diff --git a/tests/auto/declarative/qmlbindengine/methods.2.txt b/tests/auto/declarative/qmlbindengine/methods.2.txt new file mode 100644 index 0000000..352913a --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/methods.2.txt @@ -0,0 +1,4 @@ +MyQmlObject { + id: MyObject + onBasicSignal: MyObject.method(163) +} diff --git a/tests/auto/declarative/qmlbindengine/signalAssignment.1.txt b/tests/auto/declarative/qmlbindengine/signalAssignment.1.txt new file mode 100644 index 0000000..ca682fa --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/signalAssignment.1.txt @@ -0,0 +1,3 @@ +MyQmlObject { + onBasicSignal: setString('pass') +} diff --git a/tests/auto/declarative/qmlbindengine/signalAssignment.2.txt b/tests/auto/declarative/qmlbindengine/signalAssignment.2.txt new file mode 100644 index 0000000..5efd583 --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/signalAssignment.2.txt @@ -0,0 +1,3 @@ +MyQmlObject { + onArgumentSignal: setString('pass ' + a + ' ' + b + ' ' + c) +} diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp index 9a14abb..251bce4 100644 --- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp +++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp @@ -66,6 +66,9 @@ private: QML_DECLARE_TYPE(MyQmlContainer); QML_DEFINE_TYPE(MyQmlContainer,MyQmlContainer); +#define TEST_FILE(filename) \ + QUrl::fromLocalFile(QApplication::applicationDirPath() + "/" + filename) + class tst_qmlbindengine : public QObject { Q_OBJECT @@ -86,13 +89,13 @@ private: void tst_qmlbindengine::boolPropertiesEvaluateAsBool() { { - QmlComponent component(&engine, "MyQmlObject { stringProperty: trueProperty?'pass':'fail' }"); + QmlComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.1.txt")); MyQmlObject *object = qobject_cast(component.create()); QVERIFY(object != 0); QCOMPARE(object->stringProperty(), QLatin1String("pass")); } { - QmlComponent component(&engine, "MyQmlObject { stringProperty: falseProperty?'fail':'pass' }"); + QmlComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.2.txt")); MyQmlObject *object = qobject_cast(component.create()); QVERIFY(object != 0); QCOMPARE(object->stringProperty(), QLatin1String("pass")); @@ -102,7 +105,7 @@ void tst_qmlbindengine::boolPropertiesEvaluateAsBool() void tst_qmlbindengine::signalAssignment() { { - QmlComponent component(&engine, "MyQmlObject { onBasicSignal: setString('pass') }"); + QmlComponent component(&engine, TEST_FILE("signalAssignment.1.txt")); MyQmlObject *object = qobject_cast(component.create()); QVERIFY(object != 0); QCOMPARE(object->string(), QString()); @@ -111,7 +114,7 @@ void tst_qmlbindengine::signalAssignment() } { - QmlComponent component(&engine, "MyQmlObject { onArgumentSignal: setString('pass ' + a + ' ' + b + ' ' + c) }"); + QmlComponent component(&engine, TEST_FILE("signalAssignment.2.txt")); MyQmlObject *object = qobject_cast(component.create()); QVERIFY(object != 0); QCOMPARE(object->string(), QString()); @@ -123,7 +126,7 @@ void tst_qmlbindengine::signalAssignment() void tst_qmlbindengine::methods() { { - QmlComponent component(&engine, "MyQmlObject { id: MyObject; onBasicSignal: MyObject.method() }"); + QmlComponent component(&engine, TEST_FILE("methods.1.txt")); MyQmlObject *object = qobject_cast(component.create()); QVERIFY(object != 0); QCOMPARE(object->methodCalled(), false); @@ -134,7 +137,7 @@ void tst_qmlbindengine::methods() } { - QmlComponent component(&engine, "MyQmlObject { id: MyObject; onBasicSignal: MyObject.method(163) }"); + QmlComponent component(&engine, TEST_FILE("methods.2.txt")); MyQmlObject *object = qobject_cast(component.create()); QVERIFY(object != 0); QCOMPARE(object->methodCalled(), false); @@ -147,11 +150,8 @@ void tst_qmlbindengine::methods() void tst_qmlbindengine::bindingLoop() { - QmlComponent component(&engine, "MyQmlContainer { children : [ "\ - "MyQmlObject { id: Object1; stringProperty: \"hello\" + Object2.stringProperty }, "\ - "MyQmlObject { id: Object2; stringProperty: \"hello\" + Object1.stringProperty } ] }"); - //### ignoreMessage doesn't seem to work here - //QTest::ignoreMessage(QtWarningMsg, "QML MyQmlObject (unknown location): Binding loop detected for property \"stringProperty\""); + QmlComponent component(&engine, TEST_FILE("bindingLoop.txt")); + QTest::ignoreMessage(QtWarningMsg, "QML MyQmlObject (unknown location): Binding loop detected for property \"stringProperty\" "); QObject *object = component.create(); QVERIFY(object != 0); } -- cgit v0.12 From b1008e6a4f660866265083f6f4bd321a85cff377 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 14 May 2009 14:12:29 +1000 Subject: Add some expression tests --- .../qmlbindengine/tst_qmlbindengine.cpp | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp index 251bce4..72c8953 100644 --- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp +++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp @@ -80,6 +80,8 @@ private slots: void methods(); void signalAssignment(); void bindingLoop(); + void basicExpressions(); + void basicExpressions_data(); void contextPropertiesTriggerReeval(); private: @@ -170,6 +172,99 @@ public: bool changed; }; + +class MyDefaultObject1 : public QObject +{ + Q_OBJECT + Q_PROPERTY(int horseLegs READ horseLegs); + Q_PROPERTY(int antLegs READ antLegs); +public: + int horseLegs() const { return 4; } + int antLegs() const { return 6; } +}; + +class MyDefaultObject2 : public QObject +{ + Q_OBJECT + Q_PROPERTY(int antLegs READ antLegs); + Q_PROPERTY(int emuLegs READ emuLegs); +public: + int antLegs() const { return 5; } // Had an accident + int emuLegs() const { return 2; } +}; + +class MyDefaultObject3 : public QObject +{ + Q_OBJECT + Q_PROPERTY(int antLegs READ antLegs); + Q_PROPERTY(int humanLegs READ humanLegs); +public: + int antLegs() const { return 7; } // Mutant + int humanLegs() const { return 2; } + int millipedeLegs() const { return 1000; } +}; + +void tst_qmlbindengine::basicExpressions_data() +{ + QTest::addColumn("expression"); + QTest::addColumn("result"); + QTest::addColumn("nest"); + + QTest::newRow("Context property") << "a" << QVariant(1944) << false; + QTest::newRow("Context property") << "a" << QVariant(1944) << true; + QTest::newRow("Context property expression") << "a * 2" << QVariant(3888) << false; + QTest::newRow("Context property expression") << "a * 2" << QVariant(3888) << true; + QTest::newRow("Overridden context property") << "b" << QVariant("Milk") << false; + QTest::newRow("Overridden context property") << "b" << QVariant("Cow") << true; + QTest::newRow("Object property") << "object.stringProperty" << QVariant("Object1") << false; + QTest::newRow("Object property") << "object.stringProperty" << QVariant("Object1") << true; + QTest::newRow("Overridden object property") << "objectOverride.stringProperty" << QVariant("Object2") << false; + QTest::newRow("Overridden object property") << "objectOverride.stringProperty" << QVariant("Object3") << true; + QTest::newRow("Default object property") << "horseLegs" << QVariant(4) << false; + QTest::newRow("Default object property") << "antLegs" << QVariant(6) << false; + QTest::newRow("Default object property") << "emuLegs" << QVariant(2) << false; + QTest::newRow("Nested default object property") << "horseLegs" << QVariant(4) << true; + QTest::newRow("Nested default object property") << "antLegs" << QVariant(7) << true; + QTest::newRow("Nested default object property") << "emuLegs" << QVariant(2) << true; + QTest::newRow("Nested default object property") << "humanLegs" << QVariant(2) << true; + QTest::newRow("Context property override default object property") << "millipedeLegs" << QVariant(100) << true; +} + +void tst_qmlbindengine::basicExpressions() +{ + QFETCH(QString, expression); + QFETCH(QVariant, result); + QFETCH(bool, nest); + + MyQmlObject object1; + MyQmlObject object2; + MyQmlObject object3; + MyDefaultObject1 default1; + MyDefaultObject2 default2; + MyDefaultObject3 default3; + object1.setStringProperty("Object1"); + object2.setStringProperty("Object2"); + object3.setStringProperty("Object3"); + + QmlContext context(engine.rootContext()); + QmlContext nestedContext(&context); + + context.addDefaultObject(&default1); + context.addDefaultObject(&default2); + context.setContextProperty("a", QVariant(1944)); + context.setContextProperty("b", QVariant("Milk")); + context.setContextProperty("object", &object1); + context.setContextProperty("objectOverride", &object2); + nestedContext.addDefaultObject(&default3); + nestedContext.setContextProperty("b", QVariant("Cow")); + nestedContext.setContextProperty("objectOverride", &object3); + nestedContext.setContextProperty("millipedeLegs", QVariant(100)); + + MyExpression expr(nest?&nestedContext:&context, expression); + QCOMPARE(expr.value(), result); +} + +// Tests that modifying a context property will reevaluate expressions void tst_qmlbindengine::contextPropertiesTriggerReeval() { QmlContext context(engine.rootContext()); -- cgit v0.12 From 4cfe2b57d97488b4f312ad2ec2985f619b4984b6 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 14 May 2009 14:15:21 +1000 Subject: Use newer safer error function if available. Uses fb_interpret instead of isc_interprete if using firebird. Closes a potential security hole/buffer overrun. Reviewed-by: Justin McPherson --- src/sql/drivers/ibase/qsql_ibase.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 6834d9a..4f3d79d 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -66,8 +66,11 @@ QT_BEGIN_NAMESPACE enum { QIBaseChunkSize = SHRT_MAX / 2 }; -static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode, - QTextCodec *tc) +#if defined(FB_API_VER) && FB_API_VER >= 20 +static bool getIBaseError(QString& msg, const ISC_STATUS* status, ISC_LONG &sqlcode, QTextCodec *tc) +#else +static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode, QTextCodec *tc) +#endif { if (status[0] != 1 || status[1] <= 0) return false; @@ -75,7 +78,11 @@ static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode, msg.clear(); sqlcode = isc_sqlcode(status); char buf[512]; +#if defined(FB_API_VER) && FB_API_VER >= 20 + while(fb_interpret(buf, 512, &status)) { +#else while(isc_interprete(buf, &status)) { +#endif if(!msg.isEmpty()) msg += QLatin1String(" - "); if (tc) -- cgit v0.12 From df69dfe0ec549a259ed78cf48dff898d8a044c41 Mon Sep 17 00:00:00 2001 From: Ian Walters Date: Thu, 14 May 2009 14:23:40 +1000 Subject: Grammer fix, 'be be' to 'be' --- src/corelib/tools/qcontiguouscache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp index 6671982..7db3a5a 100644 --- a/src/corelib/tools/qcontiguouscache.cpp +++ b/src/corelib/tools/qcontiguouscache.cpp @@ -105,7 +105,7 @@ MyRecord record(int row) const behavior. The indexes can be checked by using areIndexesValid() In most cases the indexes will not exceed 0 to INT_MAX, and - normalizeIndexes() will not need to be be used. + normalizeIndexes() will not need to be used. See the \l{Contiguous Cache Example}{Contiguous Cache} example. */ -- cgit v0.12 From a598867353ed121e0b55e82af69253d0e94bb487 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 14 May 2009 14:49:39 +1000 Subject: Array expressions test --- src/declarative/qml/qmlengine.cpp | 4 +- .../declarative/qmlbindengine/qmlbindengine.pro | 4 +- tests/auto/declarative/qmlbindengine/testtypes.cpp | 4 + tests/auto/declarative/qmlbindengine/testtypes.h | 116 ++++++++++++++++++ .../qmlbindengine/tst_qmlbindengine.cpp | 133 ++++----------------- 5 files changed, 149 insertions(+), 112 deletions(-) create mode 100644 tests/auto/declarative/qmlbindengine/testtypes.cpp create mode 100644 tests/auto/declarative/qmlbindengine/testtypes.h diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 227aeb0..b2d3a9c 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -1027,9 +1027,7 @@ QVariant QmlExpression::value() } rv = QVariant::fromValue(list); } - } /*else if (svalue.isVariant()) { - rv = svalue.toVariant(); - }*/ else if (svalue.isObject()) { + } else if (svalue.isObject()) { QScriptValue objValue = svalue.data(); if (objValue.isValid()) rv = objValue.toVariant(); diff --git a/tests/auto/declarative/qmlbindengine/qmlbindengine.pro b/tests/auto/declarative/qmlbindengine/qmlbindengine.pro index 800d9a0..4a38ac9 100644 --- a/tests/auto/declarative/qmlbindengine/qmlbindengine.pro +++ b/tests/auto/declarative/qmlbindengine/qmlbindengine.pro @@ -1,7 +1,9 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative macx:CONFIG -= app_bundle -SOURCES += tst_qmlbindengine.cpp +SOURCES += tst_qmlbindengine.cpp \ + testtypes.cpp +HEADERS += testtypes.h # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov diff --git a/tests/auto/declarative/qmlbindengine/testtypes.cpp b/tests/auto/declarative/qmlbindengine/testtypes.cpp new file mode 100644 index 0000000..4bb0dc8 --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/testtypes.cpp @@ -0,0 +1,4 @@ +#include "testtypes.h" + +QML_DEFINE_TYPE(MyQmlObject,MyQmlObject); +QML_DEFINE_TYPE(MyQmlContainer,MyQmlContainer); diff --git a/tests/auto/declarative/qmlbindengine/testtypes.h b/tests/auto/declarative/qmlbindengine/testtypes.h new file mode 100644 index 0000000..5ba6216 --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/testtypes.h @@ -0,0 +1,116 @@ +#ifndef TESTTYPES_H +#define TESTTYPES_H + +#include +#include +#include + +class MyQmlObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool trueProperty READ trueProperty) + Q_PROPERTY(bool falseProperty READ falseProperty) + Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringChanged) +public: + MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false) {} + + bool trueProperty() const { return true; } + bool falseProperty() const { return false; } + + QString stringProperty() const { return m_string; } + void setStringProperty(const QString &s) + { + if (s == m_string) + return; + m_string = s; + emit stringChanged(); + } + + bool methodCalled() const { return m_methodCalled; } + bool methodIntCalled() const { return m_methodIntCalled; } + + QString string() const { return m_string; } +signals: + void basicSignal(); + void argumentSignal(int a, QString b, qreal c); + void stringChanged(); + +public slots: + void method() { m_methodCalled = true; } + void method(int a) { if(a == 163) m_methodIntCalled = true; } + void setString(const QString &s) { m_string = s; } + +private: + friend class tst_qmlbindengine; + bool m_methodCalled; + bool m_methodIntCalled; + + QString m_string; +}; + +QML_DECLARE_TYPE(MyQmlObject); + +class MyQmlContainer : public QObject +{ + Q_OBJECT + Q_PROPERTY(QList* children READ children) +public: + MyQmlContainer() {} + + QList *children() { return &m_children; } + +private: + QList m_children; +}; + +QML_DECLARE_TYPE(MyQmlContainer); + +class MyExpression : public QmlExpression +{ +public: + MyExpression(QmlContext *ctxt, const QString &expr) + : QmlExpression(ctxt, expr, 0), changed(false) + { + } + + virtual void valueChanged() { + changed = true; + } + bool changed; +}; + + +class MyDefaultObject1 : public QObject +{ + Q_OBJECT + Q_PROPERTY(int horseLegs READ horseLegs); + Q_PROPERTY(int antLegs READ antLegs); +public: + int horseLegs() const { return 4; } + int antLegs() const { return 6; } +}; + +class MyDefaultObject2 : public QObject +{ + Q_OBJECT + Q_PROPERTY(int antLegs READ antLegs); + Q_PROPERTY(int emuLegs READ emuLegs); +public: + int antLegs() const { return 5; } // Had an accident + int emuLegs() const { return 2; } +}; + +class MyDefaultObject3 : public QObject +{ + Q_OBJECT + Q_PROPERTY(int antLegs READ antLegs); + Q_PROPERTY(int humanLegs READ humanLegs); +public: + int antLegs() const { return 7; } // Mutant + int humanLegs() const { return 2; } + int millipedeLegs() const { return 1000; } +}; + + +#endif // TESTTYPES_H + diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp index 72c8953..16f52c5 100644 --- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp +++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp @@ -3,68 +3,7 @@ #include #include #include - -class MyQmlObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool trueProperty READ trueProperty) - Q_PROPERTY(bool falseProperty READ falseProperty) - Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringChanged) -public: - MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false) {} - - bool trueProperty() const { return true; } - bool falseProperty() const { return false; } - - QString stringProperty() const { return m_string; } - void setStringProperty(const QString &s) - { - if (s == m_string) - return; - m_string = s; - emit stringChanged(); - } - - bool methodCalled() const { return m_methodCalled; } - bool methodIntCalled() const { return m_methodIntCalled; } - - QString string() const { return m_string; } -signals: - void basicSignal(); - void argumentSignal(int a, QString b, qreal c); - void stringChanged(); - -public slots: - void method() { m_methodCalled = true; } - void method(int a) { if(a == 163) m_methodIntCalled = true; } - void setString(const QString &s) { m_string = s; } - -private: - friend class tst_qmlbindengine; - bool m_methodCalled; - bool m_methodIntCalled; - - QString m_string; -}; - -QML_DECLARE_TYPE(MyQmlObject); -QML_DEFINE_TYPE(MyQmlObject,MyQmlObject); - -class MyQmlContainer : public QObject -{ - Q_OBJECT - Q_PROPERTY(QList* children READ children) -public: - MyQmlContainer() {} - - QList *children() { return &m_children; } - -private: - QList m_children; -}; - -QML_DECLARE_TYPE(MyQmlContainer); -QML_DEFINE_TYPE(MyQmlContainer,MyQmlContainer); +#include "testtypes.h" #define TEST_FILE(filename) \ QUrl::fromLocalFile(QApplication::applicationDirPath() + "/" + filename) @@ -82,6 +21,7 @@ private slots: void bindingLoop(); void basicExpressions(); void basicExpressions_data(); + void arrayExpressions(); void contextPropertiesTriggerReeval(); private: @@ -158,52 +98,6 @@ void tst_qmlbindengine::bindingLoop() QVERIFY(object != 0); } -class MyExpression : public QmlExpression -{ -public: - MyExpression(QmlContext *ctxt, const QString &expr) - : QmlExpression(ctxt, expr, 0), changed(false) - { - } - - virtual void valueChanged() { - changed = true; - } - bool changed; -}; - - -class MyDefaultObject1 : public QObject -{ - Q_OBJECT - Q_PROPERTY(int horseLegs READ horseLegs); - Q_PROPERTY(int antLegs READ antLegs); -public: - int horseLegs() const { return 4; } - int antLegs() const { return 6; } -}; - -class MyDefaultObject2 : public QObject -{ - Q_OBJECT - Q_PROPERTY(int antLegs READ antLegs); - Q_PROPERTY(int emuLegs READ emuLegs); -public: - int antLegs() const { return 5; } // Had an accident - int emuLegs() const { return 2; } -}; - -class MyDefaultObject3 : public QObject -{ - Q_OBJECT - Q_PROPERTY(int antLegs READ antLegs); - Q_PROPERTY(int humanLegs READ humanLegs); -public: - int antLegs() const { return 7; } // Mutant - int humanLegs() const { return 2; } - int millipedeLegs() const { return 1000; } -}; - void tst_qmlbindengine::basicExpressions_data() { QTest::addColumn("expression"); @@ -264,6 +158,29 @@ void tst_qmlbindengine::basicExpressions() QCOMPARE(expr.value(), result); } +Q_DECLARE_METATYPE(QList); +void tst_qmlbindengine::arrayExpressions() +{ + QObject obj1; + QObject obj2; + QObject obj3; + + QmlContext context(engine.rootContext()); + context.setContextProperty("a", &obj1); + context.setContextProperty("b", &obj2); + context.setContextProperty("c", &obj3); + + MyExpression expr(&context, "[a, b, c, 10]"); + QVariant result = expr.value(); + QCOMPARE(result.userType(), qMetaTypeId >()); + QList list = qvariant_cast >(result); + QCOMPARE(list.count(), 4); + QCOMPARE(list.at(0), &obj1); + QCOMPARE(list.at(1), &obj2); + QCOMPARE(list.at(2), &obj3); + QCOMPARE(list.at(3), (QObject *)0); +} + // Tests that modifying a context property will reevaluate expressions void tst_qmlbindengine::contextPropertiesTriggerReeval() { -- cgit v0.12 From efc9a552d6d3f03b962ce0df260fb2c61b8b8ec1 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 14 May 2009 15:38:27 +1000 Subject: Make compile on arm. --- src/declarative/fx/qfxgridview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 5156d06..0f848d6 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -472,7 +472,7 @@ void QFxGridViewPrivate::refill(qreal from, qreal to) void QFxGridViewPrivate::updateGrid() { Q_Q(QFxGridView); - columns = (int)qMax((flow == QFxGridView::LeftToRight ? q->width() : q->height()) / colSize(), 1.); + columns = (int)qMax((flow == QFxGridView::LeftToRight ? q->width() : q->height()) / colSize(), qreal(1.)); if (isValid()) { if (flow == QFxGridView::LeftToRight) q->setViewportHeight(endPosition() - startPosition()); -- cgit v0.12 From 309e8a96af899c612ea26b73fc97d9d377bc9819 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 14 May 2009 15:41:14 +1000 Subject: Flickr demo: Scale the image about the center of the visible area. --- demos/declarative/flickr/content/ImageDetails.qml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/demos/declarative/flickr/content/ImageDetails.qml b/demos/declarative/flickr/content/ImageDetails.qml index d575be9..b8091f2 100644 --- a/demos/declarative/flickr/content/ImageDetails.qml +++ b/demos/declarative/flickr/content/ImageDetails.qml @@ -12,6 +12,7 @@ Flipable { property string photoDate property string photoUrl property int rating: 2 + property var prevScale: 1.0 signal closed @@ -93,7 +94,8 @@ Flipable { // Default scale shows the entire image. if (status == 0 && width != 0) { Slider.minimum = Math.min(Flick.width / width, Flick.height / height); - Slider.value = Math.min(Slider.minimum, 1); + prevScale = Math.min(Slider.minimum, 1); + Slider.value = prevScale; } } } @@ -109,7 +111,20 @@ Flipable { anchors.centeredIn: parent; color: "white"; font.bold: true } - Slider { id: Slider; x: 25; y: 374; visible: { BigImage.status == 0 && maximum > minimum } } + Slider { + id: Slider; x: 25; y: 374; visible: { BigImage.status == 0 && maximum > minimum } + onValueChanged: { + if (BigImage.width * value > Flick.width) { + var xoff = (Flick.width/2 + Flick.xPosition) * value / prevScale; + Flick.xPosition = xoff - Flick.width/2; + } + if (BigImage.height * value > Flick.height) { + var yoff = (Flick.height/2 + Flick.yPosition) * value / prevScale; + Flick.yPosition = yoff - Flick.height/2; + } + prevScale = value; + } + } } states: [ -- cgit v0.12 From b7f710a79b3d5f529dde8ad43ee4e0b78100674f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 14 May 2009 15:41:45 +1000 Subject: Have scale grid images degrade a bit nicer. If a scale grid image has offsets that add up to bigger than the size, we don't paint the middle bits at all. --- src/declarative/fx/qfximage.cpp | 4 ++-- src/declarative/fx/qfxrect.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index dfd6915..9d7a36a 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -365,8 +365,8 @@ void QFxImage::paintContents(QPainter &p) const int sgr = d->_scaleGrid->right(); const int sgt = d->_scaleGrid->top(); const int sgb = d->_scaleGrid->bottom(); - const int xSide = sgl + sgr; - const int ySide = sgt + sgb; + const int xSide = qMin(sgl + sgr, int(width())); + const int ySide = qMin(sgt + sgb, int(height())); // Upper left if (sgt && sgl) diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index 371aa0c..dafd8a2 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -486,8 +486,8 @@ void QFxRect::drawRect(QPainter &p) } //basically same code as QFxImage uses to paint sci images - int xSide = offset * 2; - int ySide = offset * 2; + int xSide = qMin(offset * 2, int(width())); + int ySide = qMin(offset * 2, int(height()));; // Upper left p.drawImage(QRect(0, 0, offset, offset), d->_rectImage, QRect(0, 0, offset, offset)); -- cgit v0.12 From 16e8a17e7b99e7ff9f818fce79285218141821a1 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 14 May 2009 17:27:38 +1000 Subject: Deleted context property test --- tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp index 16f52c5..deaac00 100644 --- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp +++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp @@ -187,12 +187,14 @@ void tst_qmlbindengine::contextPropertiesTriggerReeval() QmlContext context(engine.rootContext()); MyQmlObject object1; MyQmlObject object2; + MyQmlObject *object3 = new MyQmlObject; object1.setStringProperty("Hello"); object2.setStringProperty("World"); context.setContextProperty("testProp", QVariant(1)); context.setContextProperty("testObj", &object1); + context.setContextProperty("testObj2", object3); { MyExpression expr(&context, "testProp + 1"); @@ -233,6 +235,18 @@ void tst_qmlbindengine::contextPropertiesTriggerReeval() QCOMPARE(expr.changed, true); QCOMPARE(expr.value(), QVariant("Hello")); } + + { + MyExpression expr(&context, "testObj2"); + QCOMPARE(expr.changed, false); + QCOMPARE(expr.value(), QVariant::fromValue((QObject *)object3)); + + delete object3; + + QCOMPARE(expr.changed, true); + QCOMPARE(expr.value(), QVariant()); + } + } QTEST_MAIN(tst_qmlbindengine) -- cgit v0.12 From f6d5b57a759133f20d9c74bf9770b1bcacbef6aa Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 14 May 2009 17:58:38 +1000 Subject: Add another binding test --- tests/auto/declarative/qmlbindengine/testtypes.h | 13 ++++- .../qmlbindengine/tst_qmlbindengine.cpp | 55 ++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/tests/auto/declarative/qmlbindengine/testtypes.h b/tests/auto/declarative/qmlbindengine/testtypes.h index 5ba6216..6a4bda6 100644 --- a/tests/auto/declarative/qmlbindengine/testtypes.h +++ b/tests/auto/declarative/qmlbindengine/testtypes.h @@ -11,8 +11,9 @@ class MyQmlObject : public QObject Q_PROPERTY(bool trueProperty READ trueProperty) Q_PROPERTY(bool falseProperty READ falseProperty) Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringChanged) + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty NOTIFY objectChanged); public: - MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false) {} + MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0) {} bool trueProperty() const { return true; } bool falseProperty() const { return false; } @@ -26,6 +27,14 @@ public: emit stringChanged(); } + QObject *objectProperty() const { return m_object; } + void setObjectProperty(QObject *obj) { + if (obj == m_object) + return; + m_object = obj; + emit objectChanged(); + } + bool methodCalled() const { return m_methodCalled; } bool methodIntCalled() const { return m_methodIntCalled; } @@ -34,6 +43,7 @@ signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c); void stringChanged(); + void objectChanged(); public slots: void method() { m_methodCalled = true; } @@ -45,6 +55,7 @@ private: bool m_methodCalled; bool m_methodIntCalled; + QObject *m_object; QString m_string; }; diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp index deaac00..dd82d4f 100644 --- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp +++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp @@ -23,6 +23,7 @@ private slots: void basicExpressions_data(); void arrayExpressions(); void contextPropertiesTriggerReeval(); + void objectPropertiesTriggerReeval(); private: QmlEngine engine; @@ -249,6 +250,60 @@ void tst_qmlbindengine::contextPropertiesTriggerReeval() } +void tst_qmlbindengine::objectPropertiesTriggerReeval() +{ + QmlContext context(engine.rootContext()); + MyQmlObject object1; + MyQmlObject object2; + MyQmlObject object3; + context.setContextProperty("testObj", &object1); + + object1.setStringProperty(QLatin1String("Hello")); + object2.setStringProperty(QLatin1String("Dog")); + object3.setStringProperty(QLatin1String("Cat")); + + { + MyExpression expr(&context, "testObj.stringProperty"); + QCOMPARE(expr.changed, false); + QCOMPARE(expr.value(), QVariant("Hello")); + + object1.setStringProperty(QLatin1String("World")); + QCOMPARE(expr.changed, true); + QCOMPARE(expr.value(), QVariant("World")); + } + + { + MyExpression expr(&context, "testObj.objectProperty.stringProperty"); + QCOMPARE(expr.changed, false); + QCOMPARE(expr.value(), QVariant()); + + object1.setObjectProperty(&object2); + QCOMPARE(expr.changed, true); + expr.changed = false; + QCOMPARE(expr.value(), QVariant("Dog")); + + object1.setObjectProperty(&object3); + QCOMPARE(expr.changed, true); + expr.changed = false; + QCOMPARE(expr.value(), QVariant("Cat")); + + object1.setObjectProperty(0); + QCOMPARE(expr.changed, true); + expr.changed = false; + QCOMPARE(expr.value(), QVariant()); + + object1.setObjectProperty(&object3); + QCOMPARE(expr.changed, true); + expr.changed = false; + QCOMPARE(expr.value(), QVariant("Cat")); + + object3.setStringProperty("Donkey"); + QCOMPARE(expr.changed, true); + expr.changed = false; + QCOMPARE(expr.value(), QVariant("Donkey")); + } +} + QTEST_MAIN(tst_qmlbindengine) #include "tst_qmlbindengine.moc" -- cgit v0.12 From 572d57b255227f74c7ce61ab67476d4971955ea9 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 14 May 2009 10:03:42 +0200 Subject: Fixes missing translations in QFileIconProvider While lupdate ignores ifdefs, it cannot handle ifdefs inside the translate statement itself. Task-number: 188337 Reviewed-by: janarve --- src/gui/itemviews/qfileiconprovider.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp index 9f33af3..054f4cf 100644 --- a/src/gui/itemviews/qfileiconprovider.cpp +++ b/src/gui/itemviews/qfileiconprovider.cpp @@ -416,26 +416,22 @@ QString QFileIconProvider::type(const QFileInfo &info) const } if (info.isDir()) - return QApplication::translate("QFileDialog", #ifdef Q_WS_WIN - "File Folder", "Match Windows Explorer" + return QApplication::translate("QFileDialog", "File Folder", "Match Windows Explorer"); #else - "Folder", "All other platforms" + return QApplication::translate("QFileDialog", "Folder", "All other platforms"); #endif - ); // Windows - "File Folder" // OS X - "Folder" // Konqueror - "Folder" // Nautilus - "folder" if (info.isSymLink()) - return QApplication::translate("QFileDialog", #ifdef Q_OS_MAC - "Alias", "Mac OS X Finder" + return QApplication::translate("QFileDialog", "Alias", "Mac OS X Finder"); #else - "Shortcut", "All other platforms" + return QApplication::translate("QFileDialog", "Shortcut", "All other platforms"); #endif - ); // OS X - "Alias" // Windows - "Shortcut" // Konqueror - "Folder" or "TXT File" i.e. what it is pointing to -- cgit v0.12 From 5f50a7b7e40acada275a39ddadd80da7a75ed2b6 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 14 May 2009 18:14:28 +1000 Subject: Add id shortcut test --- .../qmlbindengine/idShortcutInvalidates.1.txt | 10 ++++++++++ .../qmlbindengine/idShortcutInvalidates.txt | 9 +++++++++ .../qmlbindengine/tst_qmlbindengine.cpp | 22 ++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt create mode 100644 tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt diff --git a/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt new file mode 100644 index 0000000..2687465 --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt @@ -0,0 +1,10 @@ +MyQmlObject { + objectProperty: if(1) OtherObject + + property var obj + + obj: Object { + id: OtherObject + } +} + diff --git a/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt new file mode 100644 index 0000000..4aa20ae --- /dev/null +++ b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt @@ -0,0 +1,9 @@ +MyQmlObject { + objectProperty: OtherObject + + property var obj + + obj: Object { + id: OtherObject + } +} diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp index dd82d4f..a0554f3 100644 --- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp +++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp @@ -15,6 +15,7 @@ public: tst_qmlbindengine() {} private slots: + void idShortcutInvalidates(); void boolPropertiesEvaluateAsBool(); void methods(); void signalAssignment(); @@ -29,6 +30,27 @@ private: QmlEngine engine; }; +void tst_qmlbindengine::idShortcutInvalidates() +{ + { + QmlComponent component(&engine, TEST_FILE("idShortcutInvalidates.txt")); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QVERIFY(object->objectProperty() != 0); + delete object->objectProperty(); + QVERIFY(object->objectProperty() == 0); + } + + { + QmlComponent component(&engine, TEST_FILE("idShortcutInvalidates.1.txt")); + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QVERIFY(object->objectProperty() != 0); + delete object->objectProperty(); + QVERIFY(object->objectProperty() == 0); + } +} + void tst_qmlbindengine::boolPropertiesEvaluateAsBool() { { -- cgit v0.12 From ffecdf0bf9f25f7ab9aa4f69e37507dd595fecea Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Tue, 12 May 2009 14:18:58 +0200 Subject: Makes the layout of many of the areas be in aligned columns to immensely increase readability Unfortunately the patch causes quite some regressions and I think some refectoring of this class would be needed. I didn't do that since there is no API docs, the variable naming is not very clarifying and the code is hard to read due to it not using the coding style and mixing tabs as well as spaces. --- tools/qdoc3/htmlgenerator.cpp | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 13d52bf..7702628 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -2079,17 +2079,7 @@ void HtmlGenerator::generateSectionList(const Section& section, const Node *rela CodeMarker *marker, CodeMarker::SynopsisStyle style) { if (!section.members.isEmpty()) { - bool twoColumn = false; - if (style == CodeMarker::SeparateList) { - twoColumn = (section.members.count() >= 16); - } else if (section.members.first()->type() == Node::Property) { - twoColumn = (section.members.count() >= 5); - } - if (twoColumn) - out() << "

\n" - << "
"; - out() << "
    \n"; + out() << "\n"; int i = 0; NodeList::ConstIterator m = section.members.begin(); @@ -2099,22 +2089,17 @@ void HtmlGenerator::generateSectionList(const Section& section, const Node *rela continue; } - if (twoColumn && i == (int) (section.members.count() + 1) / 2) - out() << "\n"; i++; ++m; } - out() << "\n"; - if (twoColumn) - out() << "\n
      \n"; - - out() << "
    • "; + out() << "
    "; if (style == CodeMarker::Accessors) out() << ""; generateSynopsis(*m, relative, marker, style); if (style == CodeMarker::Accessors) out() << ""; - out() << "\n"; + out() << "

    \n"; + out() << "
\n"; } if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { @@ -2129,7 +2114,7 @@ void HtmlGenerator::generateSectionInheritedList(const Section& section, const N { QList >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { - out() << "

  • "; + out() << "
  • "; out() << (*p).second << " "; if ((*p).second == 1) { out() << section.singularMember; @@ -2425,7 +2410,9 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*()" static const QString linkTag("link"); for (int i = 0, n = src.size(); i < n;) { - if (src.at(i) == charLangle && src.at(i + 1) == charAt) { + if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { + if (i != 0) + html += " "; i += 2; if (parseArg(src, linkTag, &i, n, &arg, &par1)) { QString link = linkForNode( -- cgit v0.12 From 66d8ad206cca48d8193785bdf685f5d1fba80f02 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 14 May 2009 10:33:05 +0200 Subject: Fix SpinState in Tank Game Example to spin more than 180 degrees This was a leftover from when the setDirection() semantics were broken. --- examples/statemachine/tankgameplugins/spin_ai/spin_ai.h | 7 ++++++- .../tankgameplugins/spin_ai_with_error/spin_ai_with_error.h | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h index a331a3e..d8d3d73 100644 --- a/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h +++ b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h @@ -18,7 +18,7 @@ public: public slots: void spin() { - m_tank->setProperty("direction", 90.0); + m_tank->setProperty("direction", m_tank->property("direction").toDouble() + 90.0); } protected: @@ -28,6 +28,11 @@ protected: spin(); } + void onExit(QEvent *) + { + disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin())); + } + private: QObject *m_tank; diff --git a/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h index 5cfb364..456ba01 100644 --- a/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h +++ b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h @@ -18,7 +18,7 @@ public: public slots: void spin() { - m_tank->setProperty("direction", 90.0); + m_tank->setProperty("direction", m_tank->property("direction").toDouble() + 90.0); } protected: @@ -28,6 +28,11 @@ protected: spin(); } + void onExit(QEvent *) + { + disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin())); + } + private: QObject *m_tank; -- cgit v0.12 From 8a97b3b9e506580b4a89c1277068b274794a858c Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 14 May 2009 10:37:37 +0200 Subject: Sheets misbehaviour on Carbon - Mac OS X Seems like some old legacy code was left behind when sheets behaved as application modal. This is not the case anymore, so this patch just removes the special case code for enforcing the old behaviour, and let carbon do the correct thing instead. Task-number: 252379 Reviewed-by: Trenton Schulz --- src/gui/kernel/qwidget_mac.mm | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index b315eaf..0e021dc 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -786,16 +786,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, // By also setting the current modal window back into the event, we // help Carbon determining which window is supposed to be raised. handled_event = qApp->activePopupWidget() ? true : false; - QWidget *top = 0; - if (!QApplicationPrivate::tryModalHelper(widget, &top) && top && top != widget){ - if(!qt_mac_is_macsheet(top) || top->parentWidget() != widget) { - handled_event = true; - WindowPtr topWindowRef = qt_mac_window_for(top); - SetEventParameter(event, kEventParamModalWindow, typeWindowRef, sizeof(topWindowRef), &topWindowRef); - HIModalClickResult clickResult = kHIModalClickIsModal; - SetEventParameter(event, kEventParamModalClickResult, typeModalClickResult, sizeof(clickResult), &clickResult); - } - } #endif } else if(ekind == kEventWindowClose) { widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); -- cgit v0.12 From 8a0272a37aa44ed7583cce40eeff1b030c07741e Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Thu, 14 May 2009 10:57:22 +0200 Subject: Small updates to the .hgignore file. This is handy in cases where you are maybe using something like the hg-git extension in Mercurial or just storing release in Mercurial for patch queues or what have you. --- .hgignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.hgignore b/.hgignore index 784d507..eb6ff05 100755 --- a/.hgignore +++ b/.hgignore @@ -5,6 +5,8 @@ syntax: glob *~ *.a +*.la +*.pc *.core *.moc *.o @@ -45,7 +47,9 @@ bin/rcc* bin/uic* bin/qcollectiongenerator bin/qhelpgenerator +bin/macdeployqt tools/qdoc3/qdoc3* +tools/macdeployqt/macchangeqt/macchangeqt #configure.cache mkspecs/default mkspecs/qconfig.pri -- cgit v0.12 From fa99a2ab12f646d73498b69fae0020da1abf9685 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 14 May 2009 10:59:00 +0200 Subject: Fix run-time error in Seek AI's state machine Passed parent as 'tank', thus getting a null parent in the GoToLocation state, which breaks the machine when you transition into the state. --- examples/statemachine/tankgameplugins/seek_ai/seek_ai.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h index 2835988..597f8595 100644 --- a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h +++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h @@ -137,16 +137,20 @@ public: ChaseState(QObject *tank, QState *parentState = 0) : QState(parentState), m_tank(tank) { QState *fireCannon = new QState(this); + fireCannon->setObjectName("fireCannon"); connect(fireCannon, SIGNAL(entered()), tank, SLOT(fireCannon())); setInitialState(fireCannon); - m_goToLocation = new GoToLocationState(this); + m_goToLocation = new GoToLocationState(tank, this); + m_goToLocation->setObjectName("goToLocation"); fireCannon->addTransition(tank, SIGNAL(actionCompleted()), m_goToLocation); m_turnToDirection = new QState(this); + m_turnToDirection->setObjectName("turnToDirection"); m_goToLocation->addTransition(tank, SIGNAL(actionCompleted()), m_turnToDirection); QFinalState *finalState = new QFinalState(this); + finalState->setObjectName("finalState"); m_turnToDirection->addTransition(tank, SIGNAL(actionCompleted()), finalState); } -- cgit v0.12 From e83bf531362a9626ad41b97dd3fbfa39d6665c85 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 14 May 2009 11:09:07 +0200 Subject: Removed javascriptvalue.h --- src/declarative/qml/parser/javascriptengine_p.cpp | 13 ++++++------- src/declarative/qml/parser/javascriptengine_p.h | 1 - src/declarative/qml/parser/javascriptlexer.cpp | 2 +- src/declarative/qml/parser/javascriptprettypretty.cpp | 2 +- src/declarative/qml/parser/javascriptvalue.h | 6 ------ src/declarative/qml/parser/parser.pri | 3 +-- 6 files changed, 9 insertions(+), 18 deletions(-) delete mode 100644 src/declarative/qml/parser/javascriptvalue.h diff --git a/src/declarative/qml/parser/javascriptengine_p.cpp b/src/declarative/qml/parser/javascriptengine_p.cpp index ca15b75..56ee76c 100644 --- a/src/declarative/qml/parser/javascriptengine_p.cpp +++ b/src/declarative/qml/parser/javascriptengine_p.cpp @@ -29,7 +29,6 @@ #include "javascriptengine_p.h" #include "javascriptnodepool_p.h" -#include "javascriptvalue.h" #include #include @@ -37,7 +36,7 @@ QT_BEGIN_NAMESPACE namespace JavaScript { -QString numberToString(qjsreal value) +QString numberToString(double value) { return QString::number(value); } int Ecma::RegExp::flagFromChar(const QChar &ch) @@ -93,12 +92,12 @@ static int toDigit(char c) return -1; } -qjsreal integerFromString(const char *buf, int size, int radix) +double integerFromString(const char *buf, int size, int radix) { if (size == 0) return qSNaN(); - qjsreal sign = 1.0; + double sign = 1.0; int i = 0; if (buf[0] == '+') { ++i; @@ -130,7 +129,7 @@ qjsreal integerFromString(const char *buf, int size, int radix) if ((d == -1) || (d >= radix)) break; } - qjsreal result; + double result; if (j == i) { if (!qstrcmp(buf, "Infinity")) result = qInf(); @@ -138,7 +137,7 @@ qjsreal integerFromString(const char *buf, int size, int radix) result = qSNaN(); } else { result = 0; - qjsreal multiplier = 1; + double multiplier = 1; for (--i ; i >= j; --i, multiplier *= radix) result += toDigit(buf[i]) * multiplier; } @@ -146,7 +145,7 @@ qjsreal integerFromString(const char *buf, int size, int radix) return result; } -qjsreal integerFromString(const QString &str, int radix) +double integerFromString(const QString &str, int radix) { QByteArray ba = str.trimmed().toUtf8(); return integerFromString(ba.constData(), ba.size(), radix); diff --git a/src/declarative/qml/parser/javascriptengine_p.h b/src/declarative/qml/parser/javascriptengine_p.h index 1e6e568..7941b27 100644 --- a/src/declarative/qml/parser/javascriptengine_p.h +++ b/src/declarative/qml/parser/javascriptengine_p.h @@ -30,7 +30,6 @@ #ifndef JAVASCRIPTENGINE_P_H #define JAVASCRIPTENGINE_P_H -#include "javascriptvalue.h" #include #include diff --git a/src/declarative/qml/parser/javascriptlexer.cpp b/src/declarative/qml/parser/javascriptlexer.cpp index c0a4b63..dbb7351 100644 --- a/src/declarative/qml/parser/javascriptlexer.cpp +++ b/src/declarative/qml/parser/javascriptlexer.cpp @@ -73,7 +73,7 @@ extern double qstrtod(const char *s00, char const **se, bool *ok); while (0) namespace JavaScript { -extern qjsreal integerFromString(const char *buf, int size, int radix); +extern double integerFromString(const char *buf, int size, int radix); } JavaScript::Lexer::Lexer(JavaScriptEnginePrivate *eng) diff --git a/src/declarative/qml/parser/javascriptprettypretty.cpp b/src/declarative/qml/parser/javascriptprettypretty.cpp index 6e632b7..9685de5 100644 --- a/src/declarative/qml/parser/javascriptprettypretty.cpp +++ b/src/declarative/qml/parser/javascriptprettypretty.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE namespace JavaScript { -QString numberToString(qjsreal value); +QString numberToString(double value); } using namespace JavaScript; diff --git a/src/declarative/qml/parser/javascriptvalue.h b/src/declarative/qml/parser/javascriptvalue.h deleted file mode 100644 index c68b817..0000000 --- a/src/declarative/qml/parser/javascriptvalue.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef JAVASCRIPTVALUE_H -#define JAVASCRIPTVALUE_H - -typedef double qjsreal; - -#endif // JAVASCRIPTVALUE_H diff --git a/src/declarative/qml/parser/parser.pri b/src/declarative/qml/parser/parser.pri index 130aeaf..b4d226a 100644 --- a/src/declarative/qml/parser/parser.pri +++ b/src/declarative/qml/parser/parser.pri @@ -8,8 +8,7 @@ HEADERS += $$PWD/javascriptast_p.h \ $$PWD/javascriptmemorypool_p.h \ $$PWD/javascriptnodepool_p.h \ $$PWD/javascriptparser_p.h \ - $$PWD/javascriptprettypretty_p.h \ - $$PWD/javascriptvalue.h \ + $$PWD/javascriptprettypretty_p.h SOURCES += $$PWD/javascriptast.cpp \ $$PWD/javascriptastvisitor.cpp \ -- cgit v0.12 From e7ea80161aa91369cf700b79e96e97367ecf0ff6 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 14 May 2009 11:03:35 +0200 Subject: Fix Toolbutton font with pseudo-states So now QToolButton:pressed {text-decoration: underline} will works The change in QCommonStyle is to make it consistant with the setFont few lines later. Reveiwed-by: jbache --- src/gui/styles/qcommonstyle.cpp | 1 + src/gui/styles/qstylesheetstyle.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index c0899f8..6972803 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1664,6 +1664,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (!styleHint(SH_UnderlineShortcut, opt, widget)) alignment |= Qt::TextHideMnemonic; rect.translate(shiftX, shiftY); + p->setFont(toolbutton->font); drawItemText(p, rect, alignment, toolbutton->palette, opt->state & State_Enabled, toolbutton->text, QPalette::ButtonText); diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index dcc11b8..cd44bfd 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3030,6 +3030,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC if (const QStyleOptionToolButton *tool = qstyleoption_cast(opt)) { QStyleOptionToolButton toolOpt(*tool); rule.configurePalette(&toolOpt.palette, QPalette::ButtonText, QPalette::Button); + toolOpt.font = rule.font.resolve(toolOpt.font); toolOpt.rect = rule.borderRect(opt->rect); bool customArrow = (tool->features & (QStyleOptionToolButton::HasMenu | QStyleOptionToolButton::MenuButtonPopup)); bool customDropDown = tool->features & QStyleOptionToolButton::MenuButtonPopup; -- cgit v0.12 From cf9277b5e9e20d47681ab084e4410c3566425c3c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 14 May 2009 11:19:46 +0200 Subject: Remove useless code and comment in QTreeView In 8cd19116ae81c99fe28fbf91aa7f4c1c08163fe0 we changed viewItems to always contains the index to the columns 0, even if this columns is hidden. So this code and comment are now useless. --- src/gui/itemviews/qtreeview.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index f6c5cf0..d742698 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -3086,10 +3086,6 @@ void QTreeViewPrivate::layout(int i) Q_Q(QTreeView); QModelIndex current; QModelIndex parent = (i < 0) ? (QModelIndex)root : modelIndex(i); - // modelIndex() will return an index that don't have a parent if column 0 is hidden, - // so we must make sure that parent points to the actual parent that has children. - if (parent != root) - parent = model->index(parent.row(), 0, parent.parent()); if (i>=0 && !parent.isValid()) { //modelIndex() should never return something invalid for the real items. -- cgit v0.12 From 5db3e40ca796f29cbd7bfc5f7f88823f6e27c16f Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Thu, 14 May 2009 11:04:42 +0200 Subject: Fix sending of double-click events after explicit grab-ungrab. The bug report came from the Declarative UI project as part of Kinetic. In FxFlickable the mouse is explicitly grabbed inside the mouse press event handler, and it's (explicitly) released in the release handler. When doing this, lastMouseGrabber is 0, and the double-click is delivered as a press. The fix is to not convert the double-click to a press if the receiver is the first and only mouse grabber (i.e., lastMouseGrabber is 0). The fix isn't entirely correct, as it can in theory allow an item to receive a double-click event as the first received event. This seems to only be possible in the case of using explicit mouse grabbing in combinations with the press and release event handlers so it's quite a corner case. Reviewed-by: Alexis --- src/gui/graphicsview/qgraphicsscene.cpp | 3 +- tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 99 ++++++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 69e08d1..9892d36 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1329,7 +1329,8 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou // check if the item we are sending to are disabled (before we send the event) bool disabled = !item->isEnabled(); bool isWindow = item->isWindow(); - if (mouseEvent->type() == QEvent::GraphicsSceneMouseDoubleClick && item != lastMouseGrabberItem) { + if (mouseEvent->type() == QEvent::GraphicsSceneMouseDoubleClick + && item != lastMouseGrabberItem && lastMouseGrabberItem) { // If this item is different from the item that received the last // mouse event, and mouseEvent is a doubleclick event, then the // event is converted to a press. Known limitation: diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 343aac6..a23ada9 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -149,6 +149,7 @@ private slots: void defaultSize(); void explicitMouseGrabber(); void implicitMouseGrabber(); + void doubleClickAfterExplicitMouseGrab(); void popupMouseGrabber(); void windowFlags_data(); void windowFlags(); @@ -1998,6 +1999,104 @@ void tst_QGraphicsWidget::implicitMouseGrabber() QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); } +class GrabOnPressItem : public QGraphicsRectItem +{ +public: + GrabOnPressItem(const QRectF &rect) + : QGraphicsRectItem(rect), + npress(0), nrelease(0), ndoubleClick(0), + ngrab(0), nungrab(0) + { + } + int npress; + int nrelease; + int ndoubleClick; + int ngrab; + int nungrab; +protected: + bool sceneEvent(QEvent *event) + { + switch (event->type()) { + case QEvent::GrabMouse: + ++ngrab; + break; + case QEvent::UngrabMouse: + ++nungrab; + break; + default: + break; + } + return QGraphicsRectItem::sceneEvent(event); + } + + void mousePressEvent(QGraphicsSceneMouseEvent *) + { + grabMouse(); + ++npress; + } + void mouseReleaseEvent(QGraphicsSceneMouseEvent *) + { + ungrabMouse(); + ++nrelease; + } + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) + { + ++ndoubleClick; + } +}; + +void tst_QGraphicsWidget::doubleClickAfterExplicitMouseGrab() +{ + QGraphicsScene scene; + GrabOnPressItem *item = new GrabOnPressItem(QRectF(0, 0, 100, 100)); + scene.addItem(item); + + { + QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); + event.setButton(Qt::LeftButton); + event.setButtons(Qt::LeftButton); + event.ignore(); + event.setScenePos(QPointF(50, 50)); + qApp->sendEvent(&scene, &event); + } + QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item); + QCOMPARE(item->npress, 1); + QCOMPARE(item->ngrab, 1); + { + QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseRelease); + event.setButton(Qt::LeftButton); + event.setButtons(0); + event.ignore(); + event.setScenePos(QPointF(50, 50)); + qApp->sendEvent(&scene, &event); + } + QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(item->nrelease, 1); + QCOMPARE(item->nungrab, 1); + { + QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseDoubleClick); + event.setButton(Qt::LeftButton); + event.setButtons(Qt::LeftButton); + event.ignore(); + event.setScenePos(QPointF(50, 50)); + qApp->sendEvent(&scene, &event); + } + QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item); + QCOMPARE(item->ndoubleClick, 1); + QCOMPARE(item->ngrab, 2); + { + QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseRelease); + event.setButton(Qt::LeftButton); + event.setButtons(0); + event.ignore(); + event.setScenePos(QPointF(50, 50)); + qApp->sendEvent(&scene, &event); + } + QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); + QCOMPARE(item->nrelease, 2); + QCOMPARE(item->nungrab, 2); +} + void tst_QGraphicsWidget::popupMouseGrabber() { QGraphicsScene scene; -- cgit v0.12 From 96bf1dee730651afa4f763fd5d7d52e49921d214 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 14 May 2009 11:30:40 +0200 Subject: Protect the QML front-end using the namespace JavaScript. --- src/declarative/qml/parser/javascript.g | 132 +++++++++++----------- src/declarative/qml/parser/javascriptast_p.h | 88 +++++++-------- src/declarative/qml/parser/javascriptengine_p.cpp | 3 + src/declarative/qml/parser/javascriptengine_p.h | 56 ++++----- src/declarative/qml/parser/javascriptlexer_p.h | 12 +- src/declarative/qml/parser/javascriptnodepool_p.h | 3 +- src/declarative/qml/parser/javascriptparser.cpp | 26 ++--- src/declarative/qml/parser/javascriptparser_p.h | 106 +++++++++-------- src/declarative/qml/qmlscriptparser.cpp | 4 +- 9 files changed, 222 insertions(+), 208 deletions(-) diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g index 48e8244..b70774b 100644 --- a/src/declarative/qml/parser/javascript.g +++ b/src/declarative/qml/parser/javascript.g @@ -212,52 +212,55 @@ QT_BEGIN_NAMESPACE class QString; + +namespace JavaScript { + class JavaScriptEnginePrivate; -class JavaScriptNameIdImpl; +class NameId; -class JavaScriptParser: protected $table +class Parser: protected $table { public: union Value { int ival; double dval; - JavaScriptNameIdImpl *sval; - JavaScript::AST::ArgumentList *ArgumentList; - JavaScript::AST::CaseBlock *CaseBlock; - JavaScript::AST::CaseClause *CaseClause; - JavaScript::AST::CaseClauses *CaseClauses; - JavaScript::AST::Catch *Catch; - JavaScript::AST::DefaultClause *DefaultClause; - JavaScript::AST::ElementList *ElementList; - JavaScript::AST::Elision *Elision; - JavaScript::AST::ExpressionNode *Expression; - JavaScript::AST::Finally *Finally; - JavaScript::AST::FormalParameterList *FormalParameterList; - JavaScript::AST::FunctionBody *FunctionBody; - JavaScript::AST::FunctionDeclaration *FunctionDeclaration; - JavaScript::AST::Node *Node; - JavaScript::AST::PropertyName *PropertyName; - JavaScript::AST::PropertyNameAndValueList *PropertyNameAndValueList; - JavaScript::AST::SourceElement *SourceElement; - JavaScript::AST::SourceElements *SourceElements; - JavaScript::AST::Statement *Statement; - JavaScript::AST::StatementList *StatementList; - JavaScript::AST::Block *Block; - JavaScript::AST::VariableDeclaration *VariableDeclaration; - JavaScript::AST::VariableDeclarationList *VariableDeclarationList; - - JavaScript::AST::UiProgram *UiProgram; - JavaScript::AST::UiImportList *UiImportList; - JavaScript::AST::UiImport *UiImport; - JavaScript::AST::UiPublicMember *UiPublicMember; - JavaScript::AST::UiObjectDefinition *UiObjectDefinition; - JavaScript::AST::UiObjectInitializer *UiObjectInitializer; - JavaScript::AST::UiObjectBinding *UiObjectBinding; - JavaScript::AST::UiScriptBinding *UiScriptBinding; - JavaScript::AST::UiArrayBinding *UiArrayBinding; - JavaScript::AST::UiObjectMember *UiObjectMember; - JavaScript::AST::UiObjectMemberList *UiObjectMemberList; - JavaScript::AST::UiQualifiedId *UiQualifiedId; + NameId *sval; + AST::ArgumentList *ArgumentList; + AST::CaseBlock *CaseBlock; + AST::CaseClause *CaseClause; + AST::CaseClauses *CaseClauses; + AST::Catch *Catch; + AST::DefaultClause *DefaultClause; + AST::ElementList *ElementList; + AST::Elision *Elision; + AST::ExpressionNode *Expression; + AST::Finally *Finally; + AST::FormalParameterList *FormalParameterList; + AST::FunctionBody *FunctionBody; + AST::FunctionDeclaration *FunctionDeclaration; + AST::Node *Node; + AST::PropertyName *PropertyName; + AST::PropertyNameAndValueList *PropertyNameAndValueList; + AST::SourceElement *SourceElement; + AST::SourceElements *SourceElements; + AST::Statement *Statement; + AST::StatementList *StatementList; + AST::Block *Block; + AST::VariableDeclaration *VariableDeclaration; + AST::VariableDeclarationList *VariableDeclarationList; + + AST::UiProgram *UiProgram; + AST::UiImportList *UiImportList; + AST::UiImport *UiImport; + AST::UiPublicMember *UiPublicMember; + AST::UiObjectDefinition *UiObjectDefinition; + AST::UiObjectInitializer *UiObjectInitializer; + AST::UiObjectBinding *UiObjectBinding; + AST::UiScriptBinding *UiScriptBinding; + AST::UiArrayBinding *UiArrayBinding; + AST::UiObjectMember *UiObjectMember; + AST::UiObjectMemberList *UiObjectMemberList; + AST::UiQualifiedId *UiQualifiedId; }; struct DiagnosticMessage { @@ -266,7 +269,7 @@ public: DiagnosticMessage() : kind(Error) {} - DiagnosticMessage(Kind kind, const JavaScript::AST::SourceLocation &loc, const QString &message) + DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, const QString &message) : kind(kind), loc(loc), message(message) {} bool isWarning() const @@ -276,17 +279,17 @@ public: { return kind == Error; } Kind kind; - JavaScript::AST::SourceLocation loc; + AST::SourceLocation loc; QString message; }; public: - JavaScriptParser(); - ~JavaScriptParser(); + Parser(); + ~Parser(); bool parse(JavaScriptEnginePrivate *driver); - JavaScript::AST::UiProgram *ast() + AST::UiProgram *ast() { return program; } QList diagnosticMessages() const @@ -317,7 +320,7 @@ protected: inline Value &sym(int index) { return sym_stack [tos + index - 1]; } - inline JavaScript::AST::SourceLocation &loc(int index) + inline AST::SourceLocation &loc(int index) { return location_stack [tos + index - 1]; } protected: @@ -325,9 +328,9 @@ protected: int stack_size; Value *sym_stack; int *state_stack; - JavaScript::AST::SourceLocation *location_stack; + AST::SourceLocation *location_stack; - JavaScript::AST::UiProgram *program; + AST::UiProgram *program; // error recovery enum { TOKEN_BUFFER_SIZE = 3 }; @@ -335,12 +338,12 @@ protected: struct SavedToken { int token; double dval; - JavaScript::AST::SourceLocation loc; + AST::SourceLocation loc; }; double yylval; - JavaScript::AST::SourceLocation yylloc; - JavaScript::AST::SourceLocation yyprevlloc; + AST::SourceLocation yylloc; + AST::SourceLocation yyprevlloc; SavedToken token_buffer[TOKEN_BUFFER_SIZE]; SavedToken *first_token; @@ -349,6 +352,9 @@ protected: QList diagnostic_messages; }; +} // end of namespace JavaScript + + :/ @@ -365,7 +371,7 @@ using namespace JavaScript; QT_BEGIN_NAMESPACE -void JavaScriptParser::reallocateStack() +void Parser::reallocateStack() { if (! stack_size) stack_size = 128; @@ -385,7 +391,7 @@ inline static bool automatic(JavaScriptEnginePrivate *driver, int token) } -JavaScriptParser::JavaScriptParser(): +Parser::Parser(): tos(0), stack_size(0), sym_stack(0), @@ -396,7 +402,7 @@ JavaScriptParser::JavaScriptParser(): { } -JavaScriptParser::~JavaScriptParser() +Parser::~Parser() { if (stack_size) { qFree(sym_stack); @@ -415,7 +421,7 @@ static inline AST::SourceLocation location(Lexer *lexer) return loc; } -bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver) +bool Parser::parse(JavaScriptEnginePrivate *driver) { Lexer *lexer = driver->lexer(); bool hadErrors = false; @@ -475,7 +481,7 @@ UiProgram: UiImportListOpt UiRootMember ; case $rule_number: { program = makeAstNode (driver->nodePool(), sym(1).UiImportList, sym(2).UiObjectMemberList->finish()); - sym(1).UiProgram = program; + sym(1).UiProgram = program; } break; ./ @@ -648,7 +654,7 @@ case $rule_number: { UiPropertyType: T_VAR ; /. -case $rule_number: +case $rule_number: ./ UiPropertyType: T_RESERVED_WORD ; /. @@ -663,7 +669,7 @@ UiPropertyType: T_IDENTIFIER ; UiObjectMember: T_SIGNAL T_IDENTIFIER ; /. case $rule_number: { - AST::UiPublicMember *node = makeAstNode (driver->nodePool(), (JavaScriptNameIdImpl *)0, sym(2).sval); + AST::UiPublicMember *node = makeAstNode (driver->nodePool(), (NameId *)0, sym(2).sval); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); node->typeToken = loc(2); @@ -1038,7 +1044,7 @@ case $rule_number: { sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); node->colonToken = loc(4); - sym(1).Node = node; + sym(1).Node = node; } break; ./ @@ -1047,7 +1053,7 @@ PropertyName: T_IDENTIFIER %prec REDUCE_HERE ; case $rule_number: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); - sym(1).Node = node; + sym(1).Node = node; } break; ./ @@ -1059,7 +1065,7 @@ PropertyName: T_PROPERTY ; case $rule_number: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->propertyNameToken = loc(1); - sym(1).Node = node; + sym(1).Node = node; } break; ./ @@ -1068,7 +1074,7 @@ PropertyName: T_STRING_LITERAL ; case $rule_number: { AST::StringLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); - sym(1).Node = node; + sym(1).Node = node; } break; ./ @@ -1077,7 +1083,7 @@ PropertyName: T_NUMERIC_LITERAL ; case $rule_number: { AST::NumericLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).dval); node->propertyNameToken = loc(1); - sym(1).Node = node; + sym(1).Node = node; } break; ./ @@ -1086,7 +1092,7 @@ PropertyName: ReservedIdentifier ; case $rule_number: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); - sym(1).Node = node; + sym(1).Node = node; } break; ./ diff --git a/src/declarative/qml/parser/javascriptast_p.h b/src/declarative/qml/parser/javascriptast_p.h index cd47e42..816835e 100644 --- a/src/declarative/qml/parser/javascriptast_p.h +++ b/src/declarative/qml/parser/javascriptast_p.h @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE #define JAVASCRIPT_DECLARE_AST_NODE(name) \ enum { K = Kind_##name }; -class JavaScriptNameIdImpl; +class NameId; namespace QSOperator // ### rename { @@ -339,7 +339,7 @@ class IdentifierExpression: public ExpressionNode public: JAVASCRIPT_DECLARE_AST_NODE(IdentifierExpression) - IdentifierExpression(JavaScriptNameIdImpl *n): + IdentifierExpression(NameId *n): name (n) { kind = K; } virtual ~IdentifierExpression() {} @@ -353,7 +353,7 @@ public: { return identifierToken; } // attributes - JavaScriptNameIdImpl *name; + NameId *name; SourceLocation identifierToken; }; @@ -444,7 +444,7 @@ class StringLiteral: public ExpressionNode public: JAVASCRIPT_DECLARE_AST_NODE(StringLiteral) - StringLiteral(JavaScriptNameIdImpl *v): + StringLiteral(NameId *v): value (v) { kind = K; } virtual ~StringLiteral() {} @@ -458,7 +458,7 @@ public: { return literalToken; } // attributes: - JavaScriptNameIdImpl *value; + NameId *value; SourceLocation literalToken; }; @@ -467,7 +467,7 @@ class RegExpLiteral: public ExpressionNode public: JAVASCRIPT_DECLARE_AST_NODE(RegExpLiteral) - RegExpLiteral(JavaScriptNameIdImpl *p, int f): + RegExpLiteral(NameId *p, int f): pattern (p), flags (f) { kind = K; } virtual ~RegExpLiteral() {} @@ -481,7 +481,7 @@ public: { return literalToken; } // attributes: - JavaScriptNameIdImpl *pattern; + NameId *pattern; int flags; SourceLocation literalToken; }; @@ -667,7 +667,7 @@ class IdentifierPropertyName: public PropertyName public: JAVASCRIPT_DECLARE_AST_NODE(IdentifierPropertyName) - IdentifierPropertyName(JavaScriptNameIdImpl *n): + IdentifierPropertyName(NameId *n): id (n) { kind = K; } virtual ~IdentifierPropertyName() {} @@ -675,7 +675,7 @@ public: virtual void accept0(Visitor *visitor); // attributes - JavaScriptNameIdImpl *id; + NameId *id; }; class StringLiteralPropertyName: public PropertyName @@ -683,14 +683,14 @@ class StringLiteralPropertyName: public PropertyName public: JAVASCRIPT_DECLARE_AST_NODE(StringLiteralPropertyName) - StringLiteralPropertyName(JavaScriptNameIdImpl *n): + StringLiteralPropertyName(NameId *n): id (n) { kind = K; } virtual ~StringLiteralPropertyName() {} virtual void accept0(Visitor *visitor); // attributes - JavaScriptNameIdImpl *id; + NameId *id; }; class NumericLiteralPropertyName: public PropertyName @@ -739,7 +739,7 @@ class FieldMemberExpression: public ExpressionNode public: JAVASCRIPT_DECLARE_AST_NODE(FieldMemberExpression) - FieldMemberExpression(ExpressionNode *b, JavaScriptNameIdImpl *n): + FieldMemberExpression(ExpressionNode *b, NameId *n): base (b), name (n) { kind = K; } @@ -755,7 +755,7 @@ public: // attributes ExpressionNode *base; - JavaScriptNameIdImpl *name; + NameId *name; SourceLocation dotToken; SourceLocation identifierToken; }; @@ -1288,7 +1288,7 @@ class VariableDeclaration: public Node public: JAVASCRIPT_DECLARE_AST_NODE(VariableDeclaration) - VariableDeclaration(JavaScriptNameIdImpl *n, ExpressionNode *e): + VariableDeclaration(NameId *n, ExpressionNode *e): name (n), expression (e), readOnly(false) { kind = K; } @@ -1297,7 +1297,7 @@ public: virtual void accept0(Visitor *visitor); // attributes - JavaScriptNameIdImpl *name; + NameId *name; ExpressionNode *expression; bool readOnly; SourceLocation identifierToken; @@ -1602,7 +1602,7 @@ class ContinueStatement: public Statement public: JAVASCRIPT_DECLARE_AST_NODE(ContinueStatement) - ContinueStatement(JavaScriptNameIdImpl *l = 0): + ContinueStatement(NameId *l = 0): label (l) { kind = K; } virtual ~ContinueStatement() {} @@ -1616,7 +1616,7 @@ public: { return semicolonToken; } // attributes - JavaScriptNameIdImpl *label; + NameId *label; SourceLocation continueToken; SourceLocation identifierToken; SourceLocation semicolonToken; @@ -1627,7 +1627,7 @@ class BreakStatement: public Statement public: JAVASCRIPT_DECLARE_AST_NODE(BreakStatement) - BreakStatement(JavaScriptNameIdImpl *l = 0): + BreakStatement(NameId *l = 0): label (l) { kind = K; } virtual ~BreakStatement() {} @@ -1641,7 +1641,7 @@ public: { return semicolonToken; } // attributes - JavaScriptNameIdImpl *label; + NameId *label; SourceLocation breakToken; SourceLocation identifierToken; SourceLocation semicolonToken; @@ -1823,7 +1823,7 @@ class LabelledStatement: public Statement public: JAVASCRIPT_DECLARE_AST_NODE(LabelledStatement) - LabelledStatement(JavaScriptNameIdImpl *l, Statement *stmt): + LabelledStatement(NameId *l, Statement *stmt): label (l), statement (stmt) { kind = K; } @@ -1838,7 +1838,7 @@ public: { return statement->lastSourceLocation(); } // attributes - JavaScriptNameIdImpl *label; + NameId *label; Statement *statement; SourceLocation identifierToken; SourceLocation colonToken; @@ -1873,7 +1873,7 @@ class Catch: public Node public: JAVASCRIPT_DECLARE_AST_NODE(Catch) - Catch(JavaScriptNameIdImpl *n, Block *stmt): + Catch(NameId *n, Block *stmt): name (n), statement (stmt) { kind = K; } @@ -1882,7 +1882,7 @@ public: virtual void accept0(Visitor *visitor); // attributes - JavaScriptNameIdImpl *name; + NameId *name; Block *statement; SourceLocation catchToken; SourceLocation lparenToken; @@ -1954,7 +1954,7 @@ class FunctionExpression: public ExpressionNode public: JAVASCRIPT_DECLARE_AST_NODE(FunctionExpression) - FunctionExpression(JavaScriptNameIdImpl *n, FormalParameterList *f, FunctionBody *b): + FunctionExpression(NameId *n, FormalParameterList *f, FunctionBody *b): name (n), formals (f), body (b) { kind = K; } @@ -1969,7 +1969,7 @@ public: { return rbraceToken; } // attributes - JavaScriptNameIdImpl *name; + NameId *name; FormalParameterList *formals; FunctionBody *body; SourceLocation functionToken; @@ -1985,7 +1985,7 @@ class FunctionDeclaration: public FunctionExpression public: JAVASCRIPT_DECLARE_AST_NODE(FunctionDeclaration) - FunctionDeclaration(JavaScriptNameIdImpl *n, FormalParameterList *f, FunctionBody *b): + FunctionDeclaration(NameId *n, FormalParameterList *f, FunctionBody *b): FunctionExpression(n, f, b) { kind = K; } @@ -1999,11 +1999,11 @@ class FormalParameterList: public Node public: JAVASCRIPT_DECLARE_AST_NODE(FormalParameterList) - FormalParameterList(JavaScriptNameIdImpl *n): + FormalParameterList(NameId *n): name (n), next (this) { kind = K; } - FormalParameterList(FormalParameterList *previous, JavaScriptNameIdImpl *n): + FormalParameterList(FormalParameterList *previous, NameId *n): name (n) { kind = K; @@ -2023,7 +2023,7 @@ public: } // attributes - JavaScriptNameIdImpl *name; + NameId *name; FormalParameterList *next; SourceLocation commaToken; SourceLocation identifierToken; @@ -2185,11 +2185,11 @@ class UiQualifiedId: public Node public: JAVASCRIPT_DECLARE_AST_NODE(UiQualifiedId) - UiQualifiedId(JavaScriptNameIdImpl *name) + UiQualifiedId(NameId *name) : next(this), name(name) { kind = K; } - UiQualifiedId(UiQualifiedId *previous, JavaScriptNameIdImpl *name) + UiQualifiedId(UiQualifiedId *previous, NameId *name) : name(name) { kind = K; @@ -2210,7 +2210,7 @@ public: // attributes UiQualifiedId *next; - JavaScriptNameIdImpl *name; + NameId *name; SourceLocation identifierToken; }; @@ -2219,14 +2219,14 @@ class UiImport: public Node public: JAVASCRIPT_DECLARE_AST_NODE(UiImport) - UiImport(JavaScriptNameIdImpl *fileName) + UiImport(NameId *fileName) : fileName(fileName) { kind = K; } virtual void accept0(Visitor *visitor); // attributes - JavaScriptNameIdImpl *fileName; + NameId *fileName; SourceLocation importToken; SourceLocation fileNameToken; SourceLocation semicolonToken; @@ -2324,13 +2324,13 @@ class UiPublicMember: public UiObjectMember public: JAVASCRIPT_DECLARE_AST_NODE(UiPublicMember) - UiPublicMember(JavaScriptNameIdImpl *memberType, - JavaScriptNameIdImpl *name) + UiPublicMember(NameId *memberType, + NameId *name) : type(Property), memberType(memberType), name(name), expression(0), isDefaultMember(false) { kind = K; } - UiPublicMember(JavaScriptNameIdImpl *memberType, - JavaScriptNameIdImpl *name, + UiPublicMember(NameId *memberType, + NameId *name, ExpressionNode *expression) : type(Property), memberType(memberType), name(name), expression(expression), isDefaultMember(false) { kind = K; } @@ -2352,8 +2352,8 @@ public: // attributes enum { Signal, Property } type; - JavaScriptNameIdImpl *memberType; - JavaScriptNameIdImpl *name; + NameId *memberType; + NameId *name; ExpressionNode *expression; bool isDefaultMember; SourceLocation defaultToken; @@ -2369,7 +2369,7 @@ class UiObjectDefinition: public UiObjectMember public: JAVASCRIPT_DECLARE_AST_NODE(UiObjectDefinition) - UiObjectDefinition(JavaScriptNameIdImpl *name, + UiObjectDefinition(NameId *name, UiObjectInitializer *initializer) : name(name), initializer(initializer) { kind = K; } @@ -2388,7 +2388,7 @@ public: virtual void accept0(Visitor *visitor); // attributes - JavaScriptNameIdImpl *name; + NameId *name; UiObjectInitializer *initializer; SourceLocation identifierToken; }; @@ -2435,7 +2435,7 @@ public: JAVASCRIPT_DECLARE_AST_NODE(UiObjectBinding) UiObjectBinding(UiQualifiedId *qualifiedId, - JavaScriptNameIdImpl *name, + NameId *name, UiObjectInitializer *initializer) : qualifiedId(qualifiedId), name(name), @@ -2452,7 +2452,7 @@ public: // attributes UiQualifiedId *qualifiedId; - JavaScriptNameIdImpl *name; + NameId *name; UiObjectInitializer *initializer; SourceLocation colonToken; SourceLocation identifierToken; diff --git a/src/declarative/qml/parser/javascriptengine_p.cpp b/src/declarative/qml/parser/javascriptengine_p.cpp index 56ee76c..ab1e370 100644 --- a/src/declarative/qml/parser/javascriptengine_p.cpp +++ b/src/declarative/qml/parser/javascriptengine_p.cpp @@ -34,6 +34,9 @@ QT_BEGIN_NAMESPACE +uint qHash(const JavaScript::NameId &id) +{ return qHash(id.asString()); } + namespace JavaScript { QString numberToString(double value) diff --git a/src/declarative/qml/parser/javascriptengine_p.h b/src/declarative/qml/parser/javascriptengine_p.h index 7941b27..b768f5e 100644 --- a/src/declarative/qml/parser/javascriptengine_p.h +++ b/src/declarative/qml/parser/javascriptengine_p.h @@ -36,15 +36,19 @@ QT_BEGIN_NAMESPACE namespace JavaScript { +class NameId; +} + +uint qHash(const JavaScript::NameId &id); + +namespace JavaScript { class Node; class Lexer; class NodePool; namespace AST { - class Node; - } // end of namespace AST namespace Ecma { @@ -65,79 +69,75 @@ public: } // end of namespace Ecma -} // end of namespace JavaScript - - -class JavaScriptNameIdImpl +class NameId { QString _text; public: - JavaScriptNameIdImpl(const QChar *u, int s) + NameId(const QChar *u, int s) : _text(u, s) { } const QString asString() const { return _text; } - bool operator == (const JavaScriptNameIdImpl &other) const + bool operator == (const NameId &other) const { return _text == other._text; } - bool operator != (const JavaScriptNameIdImpl &other) const + bool operator != (const NameId &other) const { return _text != other._text; } - bool operator < (const JavaScriptNameIdImpl &other) const + bool operator < (const NameId &other) const { return _text < other._text; } }; -inline uint qHash(const JavaScriptNameIdImpl &id) -{ return qHash(id.asString()); } - class JavaScriptEnginePrivate { - JavaScript::Lexer *_lexer; - JavaScript::NodePool *_nodePool; - JavaScript::AST::Node *_ast; - QSet _literals; + Lexer *_lexer; + NodePool *_nodePool; + AST::Node *_ast; + QSet _literals; public: JavaScriptEnginePrivate() : _lexer(0), _nodePool(0), _ast(0) { } - QSet literals() const + QSet literals() const { return _literals; } - JavaScriptNameIdImpl *intern(const QChar *u, int s) - { return const_cast(&*_literals.insert(JavaScriptNameIdImpl(u, s))); } + NameId *intern(const QChar *u, int s) + { return const_cast(&*_literals.insert(NameId(u, s))); } - static QString toString(JavaScriptNameIdImpl *id) + static QString toString(NameId *id) { return id->asString(); } - JavaScript::Lexer *lexer() const + Lexer *lexer() const { return _lexer; } - void setLexer(JavaScript::Lexer *lexer) + void setLexer(Lexer *lexer) { _lexer = lexer; } - JavaScript::NodePool *nodePool() const + NodePool *nodePool() const { return _nodePool; } - void setNodePool(JavaScript::NodePool *nodePool) + void setNodePool(NodePool *nodePool) { _nodePool = nodePool; } - JavaScript::AST::Node *ast() const + AST::Node *ast() const { return _ast; } - JavaScript::AST::Node *changeAbstractSyntaxTree(JavaScript::AST::Node *node) + AST::Node *changeAbstractSyntaxTree(AST::Node *node) { - JavaScript::AST::Node *previousAST = _ast; + AST::Node *previousAST = _ast; _ast = node; return previousAST; } }; +} // end of namespace JavaScript + QT_END_NAMESPACE #endif // JAVASCRIPTENGINE_P_H diff --git a/src/declarative/qml/parser/javascriptlexer_p.h b/src/declarative/qml/parser/javascriptlexer_p.h index e71c10c..55351c4 100644 --- a/src/declarative/qml/parser/javascriptlexer_p.h +++ b/src/declarative/qml/parser/javascriptlexer_p.h @@ -59,11 +59,11 @@ QT_BEGIN_NAMESPACE -class JavaScriptEnginePrivate; -class JavaScriptNameIdImpl; - namespace JavaScript { +class JavaScriptEnginePrivate; +class NameId; + class Lexer { public: @@ -136,7 +136,7 @@ public: bool scanRegExp(RegExpBodyPrefix prefix = NoPrefix); - JavaScriptNameIdImpl *pattern; + NameId *pattern; int flags; State lexerState() const @@ -194,7 +194,7 @@ public: inline int ival() const { return qsyylval.ival; } inline double dval() const { return qsyylval.dval; } - inline JavaScriptNameIdImpl *ustr() const { return qsyylval.ustr; } + inline NameId *ustr() const { return qsyylval.ustr; } const QChar *characterBuffer() const { return buffer16; } int characterCount() const { return pos16; } @@ -219,7 +219,7 @@ private: union { int ival; double dval; - JavaScriptNameIdImpl *ustr; + NameId *ustr; } qsyylval; // current and following unicode characters diff --git a/src/declarative/qml/parser/javascriptnodepool_p.h b/src/declarative/qml/parser/javascriptnodepool_p.h index 3f59123..91b9132 100644 --- a/src/declarative/qml/parser/javascriptnodepool_p.h +++ b/src/declarative/qml/parser/javascriptnodepool_p.h @@ -60,8 +60,6 @@ QT_BEGIN_NAMESPACE -class JavaScriptEnginePrivate; - namespace JavaScript { namespace AST { @@ -70,6 +68,7 @@ class Node; class Code; class CompilationUnit; +class JavaScriptEnginePrivate; template inline NodeType *makeAstNode(MemoryPool *storage) diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp index ed791c8..39e7aba 100644 --- a/src/declarative/qml/parser/javascriptparser.cpp +++ b/src/declarative/qml/parser/javascriptparser.cpp @@ -63,7 +63,7 @@ using namespace JavaScript; QT_BEGIN_NAMESPACE -void JavaScriptParser::reallocateStack() +void Parser::reallocateStack() { if (! stack_size) stack_size = 128; @@ -83,7 +83,7 @@ inline static bool automatic(JavaScriptEnginePrivate *driver, int token) } -JavaScriptParser::JavaScriptParser(): +Parser::Parser(): tos(0), stack_size(0), sym_stack(0), @@ -94,7 +94,7 @@ JavaScriptParser::JavaScriptParser(): { } -JavaScriptParser::~JavaScriptParser() +Parser::~Parser() { if (stack_size) { qFree(sym_stack); @@ -113,7 +113,7 @@ static inline AST::SourceLocation location(Lexer *lexer) return loc; } -bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver) +bool Parser::parse(JavaScriptEnginePrivate *driver) { Lexer *lexer = driver->lexer(); bool hadErrors = false; @@ -166,7 +166,7 @@ bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver) case 0: { program = makeAstNode (driver->nodePool(), sym(1).UiImportList, sym(2).UiObjectMemberList->finish()); - sym(1).UiProgram = program; + sym(1).UiProgram = program; } break; case 2: { @@ -275,7 +275,7 @@ case 23: { sym(1).Node = node; } break; -case 24: +case 24: case 25: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); @@ -283,7 +283,7 @@ case 25: { } case 27: { - AST::UiPublicMember *node = makeAstNode (driver->nodePool(), (JavaScriptNameIdImpl *)0, sym(2).sval); + AST::UiPublicMember *node = makeAstNode (driver->nodePool(), (NameId *)0, sym(2).sval); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); node->typeToken = loc(2); @@ -529,37 +529,37 @@ case 67: { sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); node->colonToken = loc(4); - sym(1).Node = node; + sym(1).Node = node; } break; case 68: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); - sym(1).Node = node; + sym(1).Node = node; } break; case 69: case 70: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->propertyNameToken = loc(1); - sym(1).Node = node; + sym(1).Node = node; } break; case 71: { AST::StringLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); - sym(1).Node = node; + sym(1).Node = node; } break; case 72: { AST::NumericLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).dval); node->propertyNameToken = loc(1); - sym(1).Node = node; + sym(1).Node = node; } break; case 73: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); - sym(1).Node = node; + sym(1).Node = node; } break; case 74: diff --git a/src/declarative/qml/parser/javascriptparser_p.h b/src/declarative/qml/parser/javascriptparser_p.h index 5e68fe7..e3e08cb 100644 --- a/src/declarative/qml/parser/javascriptparser_p.h +++ b/src/declarative/qml/parser/javascriptparser_p.h @@ -67,52 +67,55 @@ QT_BEGIN_NAMESPACE class QString; + +namespace JavaScript { + class JavaScriptEnginePrivate; -class JavaScriptNameIdImpl; +class NameId; -class JavaScriptParser: protected JavaScriptGrammar +class Parser: protected JavaScriptGrammar { public: union Value { int ival; double dval; - JavaScriptNameIdImpl *sval; - JavaScript::AST::ArgumentList *ArgumentList; - JavaScript::AST::CaseBlock *CaseBlock; - JavaScript::AST::CaseClause *CaseClause; - JavaScript::AST::CaseClauses *CaseClauses; - JavaScript::AST::Catch *Catch; - JavaScript::AST::DefaultClause *DefaultClause; - JavaScript::AST::ElementList *ElementList; - JavaScript::AST::Elision *Elision; - JavaScript::AST::ExpressionNode *Expression; - JavaScript::AST::Finally *Finally; - JavaScript::AST::FormalParameterList *FormalParameterList; - JavaScript::AST::FunctionBody *FunctionBody; - JavaScript::AST::FunctionDeclaration *FunctionDeclaration; - JavaScript::AST::Node *Node; - JavaScript::AST::PropertyName *PropertyName; - JavaScript::AST::PropertyNameAndValueList *PropertyNameAndValueList; - JavaScript::AST::SourceElement *SourceElement; - JavaScript::AST::SourceElements *SourceElements; - JavaScript::AST::Statement *Statement; - JavaScript::AST::StatementList *StatementList; - JavaScript::AST::Block *Block; - JavaScript::AST::VariableDeclaration *VariableDeclaration; - JavaScript::AST::VariableDeclarationList *VariableDeclarationList; - - JavaScript::AST::UiProgram *UiProgram; - JavaScript::AST::UiImportList *UiImportList; - JavaScript::AST::UiImport *UiImport; - JavaScript::AST::UiPublicMember *UiPublicMember; - JavaScript::AST::UiObjectDefinition *UiObjectDefinition; - JavaScript::AST::UiObjectInitializer *UiObjectInitializer; - JavaScript::AST::UiObjectBinding *UiObjectBinding; - JavaScript::AST::UiScriptBinding *UiScriptBinding; - JavaScript::AST::UiArrayBinding *UiArrayBinding; - JavaScript::AST::UiObjectMember *UiObjectMember; - JavaScript::AST::UiObjectMemberList *UiObjectMemberList; - JavaScript::AST::UiQualifiedId *UiQualifiedId; + NameId *sval; + AST::ArgumentList *ArgumentList; + AST::CaseBlock *CaseBlock; + AST::CaseClause *CaseClause; + AST::CaseClauses *CaseClauses; + AST::Catch *Catch; + AST::DefaultClause *DefaultClause; + AST::ElementList *ElementList; + AST::Elision *Elision; + AST::ExpressionNode *Expression; + AST::Finally *Finally; + AST::FormalParameterList *FormalParameterList; + AST::FunctionBody *FunctionBody; + AST::FunctionDeclaration *FunctionDeclaration; + AST::Node *Node; + AST::PropertyName *PropertyName; + AST::PropertyNameAndValueList *PropertyNameAndValueList; + AST::SourceElement *SourceElement; + AST::SourceElements *SourceElements; + AST::Statement *Statement; + AST::StatementList *StatementList; + AST::Block *Block; + AST::VariableDeclaration *VariableDeclaration; + AST::VariableDeclarationList *VariableDeclarationList; + + AST::UiProgram *UiProgram; + AST::UiImportList *UiImportList; + AST::UiImport *UiImport; + AST::UiPublicMember *UiPublicMember; + AST::UiObjectDefinition *UiObjectDefinition; + AST::UiObjectInitializer *UiObjectInitializer; + AST::UiObjectBinding *UiObjectBinding; + AST::UiScriptBinding *UiScriptBinding; + AST::UiArrayBinding *UiArrayBinding; + AST::UiObjectMember *UiObjectMember; + AST::UiObjectMemberList *UiObjectMemberList; + AST::UiQualifiedId *UiQualifiedId; }; struct DiagnosticMessage { @@ -121,7 +124,7 @@ public: DiagnosticMessage() : kind(Error) {} - DiagnosticMessage(Kind kind, const JavaScript::AST::SourceLocation &loc, const QString &message) + DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, const QString &message) : kind(kind), loc(loc), message(message) {} bool isWarning() const @@ -131,17 +134,17 @@ public: { return kind == Error; } Kind kind; - JavaScript::AST::SourceLocation loc; + AST::SourceLocation loc; QString message; }; public: - JavaScriptParser(); - ~JavaScriptParser(); + Parser(); + ~Parser(); bool parse(JavaScriptEnginePrivate *driver); - JavaScript::AST::UiProgram *ast() + AST::UiProgram *ast() { return program; } QList diagnosticMessages() const @@ -172,7 +175,7 @@ protected: inline Value &sym(int index) { return sym_stack [tos + index - 1]; } - inline JavaScript::AST::SourceLocation &loc(int index) + inline AST::SourceLocation &loc(int index) { return location_stack [tos + index - 1]; } protected: @@ -180,9 +183,9 @@ protected: int stack_size; Value *sym_stack; int *state_stack; - JavaScript::AST::SourceLocation *location_stack; + AST::SourceLocation *location_stack; - JavaScript::AST::UiProgram *program; + AST::UiProgram *program; // error recovery enum { TOKEN_BUFFER_SIZE = 3 }; @@ -190,12 +193,12 @@ protected: struct SavedToken { int token; double dval; - JavaScript::AST::SourceLocation loc; + AST::SourceLocation loc; }; double yylval; - JavaScript::AST::SourceLocation yylloc; - JavaScript::AST::SourceLocation yyprevlloc; + AST::SourceLocation yylloc; + AST::SourceLocation yyprevlloc; SavedToken token_buffer[TOKEN_BUFFER_SIZE]; SavedToken *first_token; @@ -204,6 +207,9 @@ protected: QList diagnostic_messages; }; +} // end of namespace JavaScript + + #define J_SCRIPT_REGEXPLITERAL_RULE1 52 diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index ff19d25..cd33624 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -632,7 +632,7 @@ bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url) QTextStream stream(data, QIODevice::ReadOnly); const QString code = stream.readAll(); - JavaScriptParser parser; + Parser parser; JavaScriptEnginePrivate driver; NodePool nodePool(fileName, &driver); @@ -645,7 +645,7 @@ bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url) if (! parser.parse(&driver) || !_errors.isEmpty()) { // Extract errors from the parser - foreach (const JavaScriptParser::DiagnosticMessage &m, parser.diagnosticMessages()) { + foreach (const Parser::DiagnosticMessage &m, parser.diagnosticMessages()) { if (m.isWarning()) continue; -- cgit v0.12 From 699e4ebfca621d4a009221b4304c3773cb783f7b Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 14 May 2009 11:43:12 +0200 Subject: Renamed JavaScriptEnginePrivate in Engine. --- src/declarative/qml/parser/javascript.g | 8 +++--- src/declarative/qml/parser/javascriptengine_p.cpp | 2 +- src/declarative/qml/parser/javascriptengine_p.h | 4 +-- src/declarative/qml/parser/javascriptlexer.cpp | 2 +- src/declarative/qml/parser/javascriptlexer_p.h | 6 ++--- src/declarative/qml/parser/javascriptnodepool_p.h | 8 +++--- src/declarative/qml/parser/javascriptparser.cpp | 4 +-- src/declarative/qml/parser/javascriptparser_p.h | 4 +-- .../qml/parser/javascriptprettypretty.cpp | 30 +++++++++++----------- src/declarative/qml/qmlscriptparser.cpp | 12 ++++----- 10 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g index b70774b..53d10b6 100644 --- a/src/declarative/qml/parser/javascript.g +++ b/src/declarative/qml/parser/javascript.g @@ -215,7 +215,7 @@ class QString; namespace JavaScript { -class JavaScriptEnginePrivate; +class Engine; class NameId; class Parser: protected $table @@ -287,7 +287,7 @@ public: Parser(); ~Parser(); - bool parse(JavaScriptEnginePrivate *driver); + bool parse(Engine *driver); AST::UiProgram *ast() { return program; } @@ -383,7 +383,7 @@ void Parser::reallocateStack() location_stack = reinterpret_cast (qRealloc(location_stack, stack_size * sizeof(AST::SourceLocation))); } -inline static bool automatic(JavaScriptEnginePrivate *driver, int token) +inline static bool automatic(Engine *driver, int token) { return token == $table::T_RBRACE || token == 0 @@ -421,7 +421,7 @@ static inline AST::SourceLocation location(Lexer *lexer) return loc; } -bool Parser::parse(JavaScriptEnginePrivate *driver) +bool Parser::parse(Engine *driver) { Lexer *lexer = driver->lexer(); bool hadErrors = false; diff --git a/src/declarative/qml/parser/javascriptengine_p.cpp b/src/declarative/qml/parser/javascriptengine_p.cpp index ab1e370..679202c 100644 --- a/src/declarative/qml/parser/javascriptengine_p.cpp +++ b/src/declarative/qml/parser/javascriptengine_p.cpp @@ -69,7 +69,7 @@ QString Ecma::RegExp::flagsToString(int flags) return result; } -NodePool::NodePool(const QString &fileName, JavaScriptEnginePrivate *engine) +NodePool::NodePool(const QString &fileName, Engine *engine) : m_fileName(fileName), m_engine(engine) { } diff --git a/src/declarative/qml/parser/javascriptengine_p.h b/src/declarative/qml/parser/javascriptengine_p.h index b768f5e..6aa4a76 100644 --- a/src/declarative/qml/parser/javascriptengine_p.h +++ b/src/declarative/qml/parser/javascriptengine_p.h @@ -92,7 +92,7 @@ public: { return _text < other._text; } }; -class JavaScriptEnginePrivate +class Engine { Lexer *_lexer; NodePool *_nodePool; @@ -100,7 +100,7 @@ class JavaScriptEnginePrivate QSet _literals; public: - JavaScriptEnginePrivate() + Engine() : _lexer(0), _nodePool(0), _ast(0) { } diff --git a/src/declarative/qml/parser/javascriptlexer.cpp b/src/declarative/qml/parser/javascriptlexer.cpp index dbb7351..a0081c7 100644 --- a/src/declarative/qml/parser/javascriptlexer.cpp +++ b/src/declarative/qml/parser/javascriptlexer.cpp @@ -76,7 +76,7 @@ namespace JavaScript { extern double integerFromString(const char *buf, int size, int radix); } -JavaScript::Lexer::Lexer(JavaScriptEnginePrivate *eng) +JavaScript::Lexer::Lexer(Engine *eng) : driver(eng), yylineno(0), done(false), diff --git a/src/declarative/qml/parser/javascriptlexer_p.h b/src/declarative/qml/parser/javascriptlexer_p.h index 55351c4..092609c 100644 --- a/src/declarative/qml/parser/javascriptlexer_p.h +++ b/src/declarative/qml/parser/javascriptlexer_p.h @@ -61,13 +61,13 @@ QT_BEGIN_NAMESPACE namespace JavaScript { -class JavaScriptEnginePrivate; +class Engine; class NameId; class Lexer { public: - Lexer(JavaScriptEnginePrivate *eng); + Lexer(Engine *eng); ~Lexer(); void setCode(const QString &c, int lineno); @@ -155,7 +155,7 @@ public: { err = NoError; } private: - JavaScriptEnginePrivate *driver; + Engine *driver; int yylineno; bool done; char *buffer8; diff --git a/src/declarative/qml/parser/javascriptnodepool_p.h b/src/declarative/qml/parser/javascriptnodepool_p.h index 91b9132..cb56fbb 100644 --- a/src/declarative/qml/parser/javascriptnodepool_p.h +++ b/src/declarative/qml/parser/javascriptnodepool_p.h @@ -68,7 +68,7 @@ class Node; class Code; class CompilationUnit; -class JavaScriptEnginePrivate; +class Engine; template inline NodeType *makeAstNode(MemoryPool *storage) @@ -108,13 +108,13 @@ inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1, Arg2 arg2, Arg3 arg class NodePool : public MemoryPool { public: - NodePool(const QString &fileName, JavaScriptEnginePrivate *engine); + NodePool(const QString &fileName, Engine *engine); virtual ~NodePool(); Code *createCompiledCode(AST::Node *node, CompilationUnit &compilation); inline QString fileName() const { return m_fileName; } - inline JavaScriptEnginePrivate *engine() const { return m_engine; } + inline Engine *engine() const { return m_engine; } #ifndef J_SCRIPT_NO_EVENT_NOTIFY inline qint64 id() const { return m_id; } #endif @@ -122,7 +122,7 @@ public: private: QHash m_codeCache; QString m_fileName; - JavaScriptEnginePrivate *m_engine; + Engine *m_engine; #ifndef J_SCRIPT_NO_EVENT_NOTIFY qint64 m_id; #endif diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp index 39e7aba..3c853cb 100644 --- a/src/declarative/qml/parser/javascriptparser.cpp +++ b/src/declarative/qml/parser/javascriptparser.cpp @@ -75,7 +75,7 @@ void Parser::reallocateStack() location_stack = reinterpret_cast (qRealloc(location_stack, stack_size * sizeof(AST::SourceLocation))); } -inline static bool automatic(JavaScriptEnginePrivate *driver, int token) +inline static bool automatic(Engine *driver, int token) { return token == JavaScriptGrammar::T_RBRACE || token == 0 @@ -113,7 +113,7 @@ static inline AST::SourceLocation location(Lexer *lexer) return loc; } -bool Parser::parse(JavaScriptEnginePrivate *driver) +bool Parser::parse(Engine *driver) { Lexer *lexer = driver->lexer(); bool hadErrors = false; diff --git a/src/declarative/qml/parser/javascriptparser_p.h b/src/declarative/qml/parser/javascriptparser_p.h index e3e08cb..deb6176 100644 --- a/src/declarative/qml/parser/javascriptparser_p.h +++ b/src/declarative/qml/parser/javascriptparser_p.h @@ -70,7 +70,7 @@ class QString; namespace JavaScript { -class JavaScriptEnginePrivate; +class Engine; class NameId; class Parser: protected JavaScriptGrammar @@ -142,7 +142,7 @@ public: Parser(); ~Parser(); - bool parse(JavaScriptEnginePrivate *driver); + bool parse(Engine *driver); AST::UiProgram *ast() { return program; } diff --git a/src/declarative/qml/parser/javascriptprettypretty.cpp b/src/declarative/qml/parser/javascriptprettypretty.cpp index 9685de5..0342b39 100644 --- a/src/declarative/qml/parser/javascriptprettypretty.cpp +++ b/src/declarative/qml/parser/javascriptprettypretty.cpp @@ -182,7 +182,7 @@ void PrettyPretty::endVisit(AST::ThisExpression *node) bool PrettyPretty::visit(AST::IdentifierExpression *node) { - out << JavaScriptEnginePrivate::toString(node->name); + out << Engine::toString(node->name); return true; } @@ -229,7 +229,7 @@ void PrettyPretty::endVisit(AST::FalseLiteral *node) bool PrettyPretty::visit(AST::StringLiteral *node) { - QString lit = JavaScriptEnginePrivate::toString(node->value); + QString lit = Engine::toString(node->value); lit.replace(QLatin1String("\\"), QLatin1String("\\\\")); out << "\"" << lit << "\""; return false; @@ -253,7 +253,7 @@ void PrettyPretty::endVisit(AST::NumericLiteral *node) bool PrettyPretty::visit(AST::RegExpLiteral *node) { - out << "/" << JavaScriptEnginePrivate::toString(node->pattern) << "/"; + out << "/" << Engine::toString(node->pattern) << "/"; if (node->flags) out << JavaScript::Ecma::RegExp::flagsToString(node->flags); @@ -348,7 +348,7 @@ void PrettyPretty::endVisit(AST::PropertyNameAndValueList *node) bool PrettyPretty::visit(AST::IdentifierPropertyName *node) { - out << JavaScriptEnginePrivate::toString(node->id); + out << Engine::toString(node->id); return false; } @@ -359,7 +359,7 @@ void PrettyPretty::endVisit(AST::IdentifierPropertyName *node) bool PrettyPretty::visit(AST::StringLiteralPropertyName *node) { - QString lit = JavaScriptEnginePrivate::toString(node->id); + QString lit = Engine::toString(node->id); lit.replace(QLatin1String("\\"), QLatin1String("\\\\")); out << lit; return false; @@ -398,7 +398,7 @@ void PrettyPretty::endVisit(AST::ArrayMemberExpression *node) bool PrettyPretty::visit(AST::FieldMemberExpression *node) { accept(node->base); - out << "." << JavaScriptEnginePrivate::toString(node->name); + out << "." << Engine::toString(node->name); return false; } @@ -803,7 +803,7 @@ void PrettyPretty::endVisit(AST::VariableStatement *node) bool PrettyPretty::visit(AST::VariableDeclaration *node) { - out << JavaScriptEnginePrivate::toString(node->name); + out << Engine::toString(node->name); if (node->expression) { out << " = "; accept(node->expression); @@ -959,7 +959,7 @@ bool PrettyPretty::visit(AST::ContinueStatement *node) { out << "continue"; if (node->label) { - out << " " << JavaScriptEnginePrivate::toString(node->label); + out << " " << Engine::toString(node->label); } out << ";"; return false; @@ -974,7 +974,7 @@ bool PrettyPretty::visit(AST::BreakStatement *node) { out << "break"; if (node->label) { - out << " " << JavaScriptEnginePrivate::toString(node->label); + out << " " << Engine::toString(node->label); } out << ";"; return false; @@ -1095,7 +1095,7 @@ void PrettyPretty::endVisit(AST::DefaultClause *node) bool PrettyPretty::visit(AST::LabelledStatement *node) { - out << JavaScriptEnginePrivate::toString(node->label) << ": "; + out << Engine::toString(node->label) << ": "; return true; } @@ -1123,7 +1123,7 @@ bool PrettyPretty::visit(AST::TryStatement *node) out << "try "; acceptAsBlock(node->statement); if (node->catchExpression) { - out << " catch (" << JavaScriptEnginePrivate::toString(node->catchExpression->name) << ") "; + out << " catch (" << Engine::toString(node->catchExpression->name) << ") "; acceptAsBlock(node->catchExpression->statement); } if (node->finallyExpression) { @@ -1166,13 +1166,13 @@ bool PrettyPretty::visit(AST::FunctionDeclaration *node) out << "function"; if (node->name) - out << " " << JavaScriptEnginePrivate::toString(node->name); + out << " " << Engine::toString(node->name); // the arguments out << "("; for (AST::FormalParameterList *it = node->formals; it; it = it->next) { if (it->name) - out << JavaScriptEnginePrivate::toString(it->name); + out << Engine::toString(it->name); if (it->next) out << ", "; @@ -1205,13 +1205,13 @@ bool PrettyPretty::visit(AST::FunctionExpression *node) out << "function"; if (node->name) - out << " " << JavaScriptEnginePrivate::toString(node->name); + out << " " << Engine::toString(node->name); // the arguments out << "("; for (AST::FormalParameterList *it = node->formals; it; it = it->next) { if (it->name) - out << JavaScriptEnginePrivate::toString(it->name); + out << Engine::toString(it->name); if (it->next) out << ", "; diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index cd33624..6f29d17 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -633,16 +633,16 @@ bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url) const QString code = stream.readAll(); Parser parser; - JavaScriptEnginePrivate driver; + Engine engine; - NodePool nodePool(fileName, &driver); - driver.setNodePool(&nodePool); + NodePool nodePool(fileName, &engine); + engine.setNodePool(&nodePool); - Lexer lexer(&driver); + Lexer lexer(&engine); lexer.setCode(code, /*line = */ 1); - driver.setLexer(&lexer); + engine.setLexer(&lexer); - if (! parser.parse(&driver) || !_errors.isEmpty()) { + if (! parser.parse(&engine) || !_errors.isEmpty()) { // Extract errors from the parser foreach (const Parser::DiagnosticMessage &m, parser.diagnosticMessages()) { -- cgit v0.12 From 3bf4db673c3e74ab9a4c3319fd7a1df15ff52ea9 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 14 May 2009 11:50:46 +0200 Subject: Moved Parser::DiagnosticMessage and AST::SourceLocation --- src/declarative/qml/parser/javascript.g | 22 ++----------------- src/declarative/qml/parser/javascriptast_p.h | 26 +--------------------- src/declarative/qml/parser/javascriptastfwd_p.h | 21 +++++++++++++++++- src/declarative/qml/parser/javascriptengine_p.h | 29 ++++++++++++++++++++----- src/declarative/qml/parser/javascriptparser_p.h | 22 ++----------------- src/declarative/qml/qmlscriptparser.cpp | 2 +- 6 files changed, 50 insertions(+), 72 deletions(-) diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g index 53d10b6..53db3d9 100644 --- a/src/declarative/qml/parser/javascript.g +++ b/src/declarative/qml/parser/javascript.g @@ -207,6 +207,8 @@ #include "javascriptgrammar_p.h" #include "javascriptast_p.h" +#include "javascriptengine_p.h" + #include QT_BEGIN_NAMESPACE @@ -263,26 +265,6 @@ public: AST::UiQualifiedId *UiQualifiedId; }; - struct DiagnosticMessage { - enum Kind { Warning, Error }; - - DiagnosticMessage() - : kind(Error) {} - - DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, const QString &message) - : kind(kind), loc(loc), message(message) {} - - bool isWarning() const - { return kind == Warning; } - - bool isError() const - { return kind == Error; } - - Kind kind; - AST::SourceLocation loc; - QString message; - }; - public: Parser(); ~Parser(); diff --git a/src/declarative/qml/parser/javascriptast_p.h b/src/declarative/qml/parser/javascriptast_p.h index 816835e..571fdff 100644 --- a/src/declarative/qml/parser/javascriptast_p.h +++ b/src/declarative/qml/parser/javascriptast_p.h @@ -53,11 +53,8 @@ // We mean it. // -#include - - - #include "javascriptastvisitor_p.h" +#include QT_BEGIN_NAMESPACE @@ -120,27 +117,6 @@ _T1 cast(_T2 *ast) return 0; } -class SourceLocation -{ -public: - SourceLocation(quint32 offset = 0, quint32 length = 0) - : offset(offset), length(length), - startLine(0), startColumn(0) - { } - - bool isValid() const { return length != 0; } - - quint32 begin() const { return offset; } - quint32 end() const { return offset + length; } - -// attributes - // ### encode - quint32 offset; - quint32 length; - quint32 startLine; - quint32 startColumn; -}; - class Node { public: diff --git a/src/declarative/qml/parser/javascriptastfwd_p.h b/src/declarative/qml/parser/javascriptastfwd_p.h index 858e393..822a2d7 100644 --- a/src/declarative/qml/parser/javascriptastfwd_p.h +++ b/src/declarative/qml/parser/javascriptastfwd_p.h @@ -59,7 +59,26 @@ QT_BEGIN_NAMESPACE namespace JavaScript { namespace AST { -class SourceLocation; +class SourceLocation +{ +public: + SourceLocation(quint32 offset = 0, quint32 length = 0) + : offset(offset), length(length), + startLine(0), startColumn(0) + { } + + bool isValid() const { return length != 0; } + + quint32 begin() const { return offset; } + quint32 end() const { return offset + length; } + +// attributes + // ### encode + quint32 offset; + quint32 length; + quint32 startLine; + quint32 startColumn; +}; class Visitor; class Node; diff --git a/src/declarative/qml/parser/javascriptengine_p.h b/src/declarative/qml/parser/javascriptengine_p.h index 6aa4a76..966349b 100644 --- a/src/declarative/qml/parser/javascriptengine_p.h +++ b/src/declarative/qml/parser/javascriptengine_p.h @@ -33,6 +33,8 @@ #include #include +#include "javascriptastfwd_p.h" + QT_BEGIN_NAMESPACE namespace JavaScript { @@ -43,14 +45,9 @@ uint qHash(const JavaScript::NameId &id); namespace JavaScript { -class Node; class Lexer; class NodePool; -namespace AST { -class Node; -} // end of namespace AST - namespace Ecma { class RegExp @@ -92,6 +89,28 @@ public: { return _text < other._text; } }; +class DiagnosticMessage +{ +public: + enum Kind { Warning, Error }; + + DiagnosticMessage() + : kind(Error) {} + + DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, const QString &message) + : kind(kind), loc(loc), message(message) {} + + bool isWarning() const + { return kind == Warning; } + + bool isError() const + { return kind == Error; } + + Kind kind; + AST::SourceLocation loc; + QString message; +}; + class Engine { Lexer *_lexer; diff --git a/src/declarative/qml/parser/javascriptparser_p.h b/src/declarative/qml/parser/javascriptparser_p.h index deb6176..6980cc8 100644 --- a/src/declarative/qml/parser/javascriptparser_p.h +++ b/src/declarative/qml/parser/javascriptparser_p.h @@ -62,6 +62,8 @@ #include "javascriptgrammar_p.h" #include "javascriptast_p.h" +#include "javascriptengine_p.h" + #include QT_BEGIN_NAMESPACE @@ -118,26 +120,6 @@ public: AST::UiQualifiedId *UiQualifiedId; }; - struct DiagnosticMessage { - enum Kind { Warning, Error }; - - DiagnosticMessage() - : kind(Error) {} - - DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, const QString &message) - : kind(kind), loc(loc), message(message) {} - - bool isWarning() const - { return kind == Warning; } - - bool isError() const - { return kind == Error; } - - Kind kind; - AST::SourceLocation loc; - QString message; - }; - public: Parser(); ~Parser(); diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index 6f29d17..10518d7 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -645,7 +645,7 @@ bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url) if (! parser.parse(&engine) || !_errors.isEmpty()) { // Extract errors from the parser - foreach (const Parser::DiagnosticMessage &m, parser.diagnosticMessages()) { + foreach (const DiagnosticMessage &m, parser.diagnosticMessages()) { if (m.isWarning()) continue; -- cgit v0.12 From e3ea232cdb9116914df533b423f25ffd7384a78b Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 14 May 2009 12:29:45 +0200 Subject: Some (internal) API cleanup. --- src/declarative/qml/parser/javascript.g | 10 ++-- src/declarative/qml/parser/javascriptengine_p.cpp | 1 + src/declarative/qml/parser/javascriptlexer.cpp | 64 +++++++++++------------ src/declarative/qml/parser/javascriptparser.cpp | 5 +- src/declarative/qml/parser/javascriptparser_p.h | 5 +- src/declarative/qml/qmlscriptparser.cpp | 7 ++- 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g index 53db3d9..14ab6b3 100644 --- a/src/declarative/qml/parser/javascript.g +++ b/src/declarative/qml/parser/javascript.g @@ -266,10 +266,10 @@ public: }; public: - Parser(); + Parser(Engine *engine); ~Parser(); - bool parse(Engine *driver); + bool parse(); AST::UiProgram *ast() { return program; } @@ -306,6 +306,7 @@ protected: { return location_stack [tos + index - 1]; } protected: + Engine *driver; int tos; int stack_size; Value *sym_stack; @@ -373,7 +374,8 @@ inline static bool automatic(Engine *driver, int token) } -Parser::Parser(): +Parser::Parser(Engine *engine): + driver(engine), tos(0), stack_size(0), sym_stack(0), @@ -403,7 +405,7 @@ static inline AST::SourceLocation location(Lexer *lexer) return loc; } -bool Parser::parse(Engine *driver) +bool Parser::parse() { Lexer *lexer = driver->lexer(); bool hadErrors = false; diff --git a/src/declarative/qml/parser/javascriptengine_p.cpp b/src/declarative/qml/parser/javascriptengine_p.cpp index 679202c..5debfd3 100644 --- a/src/declarative/qml/parser/javascriptengine_p.cpp +++ b/src/declarative/qml/parser/javascriptengine_p.cpp @@ -72,6 +72,7 @@ QString Ecma::RegExp::flagsToString(int flags) NodePool::NodePool(const QString &fileName, Engine *engine) : m_fileName(fileName), m_engine(engine) { + m_engine->setNodePool(this); } NodePool::~NodePool() diff --git a/src/declarative/qml/parser/javascriptlexer.cpp b/src/declarative/qml/parser/javascriptlexer.cpp index a0081c7..7455b87 100644 --- a/src/declarative/qml/parser/javascriptlexer.cpp +++ b/src/declarative/qml/parser/javascriptlexer.cpp @@ -44,13 +44,6 @@ #endif #include "javascriptengine_p.h" - - - - - - - #include "javascriptlexer_p.h" #include "javascriptgrammar_p.h" @@ -76,7 +69,9 @@ namespace JavaScript { extern double integerFromString(const char *buf, int size, int radix); } -JavaScript::Lexer::Lexer(Engine *eng) +using namespace JavaScript; + +Lexer::Lexer(Engine *eng) : driver(eng), yylineno(0), done(false), @@ -101,6 +96,7 @@ JavaScript::Lexer::Lexer(Engine *eng) parenthesesCount(0), prohibitAutomaticSemicolon(false) { + driver->setLexer(this); // allocate space for read buffers buffer8 = new char[size8]; buffer16 = new QChar[size16]; @@ -109,13 +105,13 @@ JavaScript::Lexer::Lexer(Engine *eng) } -JavaScript::Lexer::~Lexer() +Lexer::~Lexer() { delete [] buffer8; delete [] buffer16; } -void JavaScript::Lexer::setCode(const QString &c, int lineno) +void Lexer::setCode(const QString &c, int lineno) { errmsg = QString(); yylineno = lineno; @@ -135,7 +131,7 @@ void JavaScript::Lexer::setCode(const QString &c, int lineno) next3 = (length > 3) ? code[3].unicode() : 0; } -void JavaScript::Lexer::shift(uint p) +void Lexer::shift(uint p) { while (p--) { ++pos; @@ -147,13 +143,13 @@ void JavaScript::Lexer::shift(uint p) } } -void JavaScript::Lexer::setDone(State s) +void Lexer::setDone(State s) { state = s; done = true; } -int JavaScript::Lexer::findReservedWord(const QChar *c, int size) const +int Lexer::findReservedWord(const QChar *c, int size) const { switch (size) { case 2: { @@ -454,7 +450,7 @@ int JavaScript::Lexer::findReservedWord(const QChar *c, int size) const return -1; } -int JavaScript::Lexer::lex() +int Lexer::lex() { int token = 0; state = Start; @@ -772,10 +768,10 @@ int JavaScript::Lexer::lex() if (state == Number) { dval = qstrtod(buffer8, 0, 0); } else if (state == Hex) { // scan hex numbers - dval = JavaScript::integerFromString(buffer8, pos8, 16); + dval = integerFromString(buffer8, pos8, 16); state = Number; } else if (state == Octal) { // scan octal number - dval = JavaScript::integerFromString(buffer8, pos8, 8); + dval = integerFromString(buffer8, pos8, 8); state = Number; } @@ -843,18 +839,18 @@ int JavaScript::Lexer::lex() } } -bool JavaScript::Lexer::isWhiteSpace() const +bool Lexer::isWhiteSpace() const { return (current == ' ' || current == '\t' || current == 0x0b || current == 0x0c); } -bool JavaScript::Lexer::isLineTerminator() const +bool Lexer::isLineTerminator() const { return (current == '\n' || current == '\r'); } -bool JavaScript::Lexer::isIdentLetter(ushort c) +bool Lexer::isIdentLetter(ushort c) { /* TODO: allow other legitimate unicode chars */ return ((c >= 'a' && c <= 'z') @@ -863,24 +859,24 @@ bool JavaScript::Lexer::isIdentLetter(ushort c) || c == '_'); } -bool JavaScript::Lexer::isDecimalDigit(ushort c) +bool Lexer::isDecimalDigit(ushort c) { return (c >= '0' && c <= '9'); } -bool JavaScript::Lexer::isHexDigit(ushort c) const +bool Lexer::isHexDigit(ushort c) const { return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')); } -bool JavaScript::Lexer::isOctalDigit(ushort c) const +bool Lexer::isOctalDigit(ushort c) const { return (c >= '0' && c <= '7'); } -int JavaScript::Lexer::matchPunctuator(ushort c1, ushort c2, +int Lexer::matchPunctuator(ushort c1, ushort c2, ushort c3, ushort c4) { if (c1 == '>' && c2 == '>' && c3 == '>' && c4 == '=') { @@ -987,7 +983,7 @@ int JavaScript::Lexer::matchPunctuator(ushort c1, ushort c2, } } -ushort JavaScript::Lexer::singleEscape(ushort c) const +ushort Lexer::singleEscape(ushort c) const { switch(c) { case 'b': @@ -1013,13 +1009,13 @@ ushort JavaScript::Lexer::singleEscape(ushort c) const } } -ushort JavaScript::Lexer::convertOctal(ushort c1, ushort c2, +ushort Lexer::convertOctal(ushort c1, ushort c2, ushort c3) const { return ((c1 - '0') * 64 + (c2 - '0') * 8 + c3 - '0'); } -unsigned char JavaScript::Lexer::convertHex(ushort c) +unsigned char Lexer::convertHex(ushort c) { if (c >= '0' && c <= '9') return (c - '0'); @@ -1029,19 +1025,19 @@ unsigned char JavaScript::Lexer::convertHex(ushort c) return (c - 'A' + 10); } -unsigned char JavaScript::Lexer::convertHex(ushort c1, ushort c2) +unsigned char Lexer::convertHex(ushort c1, ushort c2) { return ((convertHex(c1) << 4) + convertHex(c2)); } -QChar JavaScript::Lexer::convertUnicode(ushort c1, ushort c2, +QChar Lexer::convertUnicode(ushort c1, ushort c2, ushort c3, ushort c4) { return QChar((convertHex(c3) << 4) + convertHex(c4), (convertHex(c1) << 4) + convertHex(c2)); } -void JavaScript::Lexer::record8(ushort c) +void Lexer::record8(ushort c) { Q_ASSERT(c <= 0xff); @@ -1057,7 +1053,7 @@ void JavaScript::Lexer::record8(ushort c) buffer8[pos8++] = (char) c; } -void JavaScript::Lexer::record16(QChar c) +void Lexer::record16(QChar c) { // enlarge buffer if full if (pos16 >= size16 - 1) { @@ -1071,14 +1067,14 @@ void JavaScript::Lexer::record16(QChar c) buffer16[pos16++] = c; } -void JavaScript::Lexer::recordStartPos() +void Lexer::recordStartPos() { startpos = pos; startlineno = yylineno; startcolumn = yycolumn; } -bool JavaScript::Lexer::scanRegExp(RegExpBodyPrefix prefix) +bool Lexer::scanRegExp(RegExpBodyPrefix prefix) { pos16 = 0; bool lastWasEscape = false; @@ -1110,7 +1106,7 @@ bool JavaScript::Lexer::scanRegExp(RegExpBodyPrefix prefix) flags = 0; while (isIdentLetter(current)) { - int flag = JavaScript::Ecma::RegExp::flagFromChar(current); + int flag = Ecma::RegExp::flagFromChar(current); if (flag == 0) { errmsg = QString::fromLatin1("Invalid regular expression flag '%0'") .arg(QChar(current)); @@ -1124,7 +1120,7 @@ bool JavaScript::Lexer::scanRegExp(RegExpBodyPrefix prefix) return true; } -void JavaScript::Lexer::syncProhibitAutomaticSemicolon() +void Lexer::syncProhibitAutomaticSemicolon() { if (parenthesesState == BalancedParentheses) { // we have seen something like "if (foo)", which means we should diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp index 3c853cb..49a4181 100644 --- a/src/declarative/qml/parser/javascriptparser.cpp +++ b/src/declarative/qml/parser/javascriptparser.cpp @@ -83,7 +83,8 @@ inline static bool automatic(Engine *driver, int token) } -Parser::Parser(): +Parser::Parser(Engine *engine): + driver(engine), tos(0), stack_size(0), sym_stack(0), @@ -113,7 +114,7 @@ static inline AST::SourceLocation location(Lexer *lexer) return loc; } -bool Parser::parse(Engine *driver) +bool Parser::parse() { Lexer *lexer = driver->lexer(); bool hadErrors = false; diff --git a/src/declarative/qml/parser/javascriptparser_p.h b/src/declarative/qml/parser/javascriptparser_p.h index 6980cc8..a9f8593 100644 --- a/src/declarative/qml/parser/javascriptparser_p.h +++ b/src/declarative/qml/parser/javascriptparser_p.h @@ -121,10 +121,10 @@ public: }; public: - Parser(); + Parser(Engine *engine); ~Parser(); - bool parse(Engine *driver); + bool parse(); AST::UiProgram *ast() { return program; } @@ -161,6 +161,7 @@ protected: { return location_stack [tos + index - 1]; } protected: + Engine *driver; int tos; int stack_size; Value *sym_stack; diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index 10518d7..9d6b018 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -632,17 +632,16 @@ bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url) QTextStream stream(data, QIODevice::ReadOnly); const QString code = stream.readAll(); - Parser parser; Engine engine; NodePool nodePool(fileName, &engine); - engine.setNodePool(&nodePool); Lexer lexer(&engine); lexer.setCode(code, /*line = */ 1); - engine.setLexer(&lexer); - if (! parser.parse(&engine) || !_errors.isEmpty()) { + Parser parser(&engine); + + if (! parser.parse() || !_errors.isEmpty()) { // Extract errors from the parser foreach (const DiagnosticMessage &m, parser.diagnosticMessages()) { -- cgit v0.12 From ededfad305258f9f450b314d9e2d53a6905bc6d0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 14 May 2009 13:12:12 +0200 Subject: Pop up message when a tank wins the game Also fixed: Added some docs and moved the tanks a little so they don't start partly outside the scene rect. --- doc/src/examples/tankgame.qdoc | 2 + .../statemachine/tankgame/gameovertransition.cpp | 39 ++++++++++++++++ .../statemachine/tankgame/gameovertransition.h | 22 +++++++++ examples/statemachine/tankgame/mainwindow.cpp | 53 ++++++++++++++++++---- examples/statemachine/tankgame/mainwindow.h | 3 ++ examples/statemachine/tankgame/tankgame.pro | 4 +- examples/statemachine/tankgame/tankitem.cpp | 1 + examples/statemachine/tankgame/tankitem.h | 1 + 8 files changed, 113 insertions(+), 12 deletions(-) create mode 100644 examples/statemachine/tankgame/gameovertransition.cpp create mode 100644 examples/statemachine/tankgame/gameovertransition.h diff --git a/doc/src/examples/tankgame.qdoc b/doc/src/examples/tankgame.qdoc index 1501a99..ab3e0f4 100644 --- a/doc/src/examples/tankgame.qdoc +++ b/doc/src/examples/tankgame.qdoc @@ -82,6 +82,8 @@ "Add tank" menu item should be disabled. This is implemented by giving the "stopped" state two children which define whether the map is full or not. + \snippet examples/statemachine/tankgame/mainwindow.cpp 5 + To make sure that we go into the correct child state when returning from the "running" state (if the "Stop game" menu item is selected while the game is running) we also give the "stopped" state a history state which we make the initial state of "stopped" state. diff --git a/examples/statemachine/tankgame/gameovertransition.cpp b/examples/statemachine/tankgame/gameovertransition.cpp new file mode 100644 index 0000000..21c3510 --- /dev/null +++ b/examples/statemachine/tankgame/gameovertransition.cpp @@ -0,0 +1,39 @@ +#include "gameovertransition.h" +#include "tankitem.h" + +#include +#include + +GameOverTransition::GameOverTransition(QAbstractState *targetState) + : QSignalTransition(new QSignalMapper(), SIGNAL(mapped(QObject*))) +{ + setTargetState(targetState); + + QSignalMapper *mapper = qobject_cast(senderObject()); + mapper->setParent(this); +} + +void GameOverTransition::addTankItem(TankItem *tankItem) +{ + m_tankItems.append(tankItem); + + QSignalMapper *mapper = qobject_cast(senderObject()); + mapper->setMapping(tankItem, tankItem); + connect(tankItem, SIGNAL(aboutToBeDestroyed()), mapper, SLOT(map())); +} + +bool GameOverTransition::eventTest(QEvent *e) const +{ + bool ret = QSignalTransition::eventTest(e); + + if (ret) { + QSignalEvent *signalEvent = static_cast(e); + QObject *sender = qvariant_cast(signalEvent->arguments().at(0)); + TankItem *tankItem = qobject_cast(sender); + m_tankItems.removeAll(tankItem); + + return m_tankItems.size() <= 1; + } else { + return false; + } +} \ No newline at end of file diff --git a/examples/statemachine/tankgame/gameovertransition.h b/examples/statemachine/tankgame/gameovertransition.h new file mode 100644 index 0000000..53c9b86 --- /dev/null +++ b/examples/statemachine/tankgame/gameovertransition.h @@ -0,0 +1,22 @@ +#ifndef GAMEOVERTRANSITION_H +#define GAMEOVERTRANSITION_H + +#include + +class TankItem; +class GameOverTransition: public QSignalTransition +{ + Q_OBJECT +public: + GameOverTransition(QAbstractState *targetState); + + void addTankItem(TankItem *tankItem); + +protected: + bool eventTest(QEvent *event) const; + +private: + mutable QList m_tankItems; +}; + +#endif diff --git a/examples/statemachine/tankgame/mainwindow.cpp b/examples/statemachine/tankgame/mainwindow.cpp index 870bc9c..fcc0325 100644 --- a/examples/statemachine/tankgame/mainwindow.cpp +++ b/examples/statemachine/tankgame/mainwindow.cpp @@ -2,6 +2,7 @@ #include "tankitem.h" #include "rocketitem.h" #include "plugin.h" +#include "gameovertransition.h" #include #include @@ -53,7 +54,7 @@ void MainWindow::init() { TankItem *item = new TankItem(this); - item->setPos(m_scene->sceneRect().topLeft() + QPointF(15.0, 15.0)); + item->setPos(m_scene->sceneRect().topLeft() + QPointF(30.0, 30.0)); item->setDirection(45.0); item->setColor(Qt::red); @@ -63,7 +64,7 @@ void MainWindow::init() { TankItem *item = new TankItem(this); - item->setPos(m_scene->sceneRect().topRight() + QPointF(-15.0, 15.0)); + item->setPos(m_scene->sceneRect().topRight() + QPointF(-30.0, 30.0)); item->setDirection(135.0); item->setColor(Qt::green); @@ -73,7 +74,7 @@ void MainWindow::init() { TankItem *item = new TankItem(this); - item->setPos(m_scene->sceneRect().bottomRight() + QPointF(-15.0, -15.0)); + item->setPos(m_scene->sceneRect().bottomRight() + QPointF(-30.0, -30.0)); item->setDirection(225.0); item->setColor(Qt::blue); @@ -83,7 +84,7 @@ void MainWindow::init() { TankItem *item = new TankItem(this); - item->setPos(m_scene->sceneRect().bottomLeft() + QPointF(15.0, -15.0)); + item->setPos(m_scene->sceneRect().bottomLeft() + QPointF(30.0, -30.0)); item->setDirection(315.0); item->setColor(Qt::yellow); @@ -125,20 +126,23 @@ void MainWindow::init() stoppedState->assignProperty(this, "started", false); m_machine->setInitialState(stoppedState); - QState *spawnsAvailable = new QState(stoppedState); - spawnsAvailable->setObjectName("spawnsAvailable"); +//! [5] + QState *spawnsAvailable = new QState(stoppedState); spawnsAvailable->assignProperty(addTankAction, "enabled", true); - QState *noSpawnsAvailable = new QState(stoppedState); - noSpawnsAvailable->setObjectName("noSpawnsAvailable"); + QState *noSpawnsAvailable = new QState(stoppedState); noSpawnsAvailable->assignProperty(addTankAction, "enabled", false); +//! [5] + spawnsAvailable->setObjectName("spawnsAvailable"); + noSpawnsAvailable->setObjectName("noSpawnsAvailable"); spawnsAvailable->addTransition(this, SIGNAL(mapFull()), noSpawnsAvailable); //! [3] - QHistoryState *hs = new QHistoryState(stoppedState); + QHistoryState *hs = new QHistoryState(stoppedState); hs->setDefaultState(spawnsAvailable); //! [3] + hs->setObjectName("hs"); stoppedState->setInitialState(hs); @@ -149,10 +153,18 @@ void MainWindow::init() m_runningState->assignProperty(addTankAction, "enabled", false); m_runningState->assignProperty(runGameAction, "enabled", false); m_runningState->assignProperty(stopGameAction, "enabled", true); + + QState *gameOverState = new QState(m_machine->rootState()); + gameOverState->setObjectName("gameOverState"); + gameOverState->assignProperty(stopGameAction, "enabled", false); + connect(gameOverState, SIGNAL(entered()), this, SLOT(gameOver())); stoppedState->addTransition(runGameAction, SIGNAL(triggered()), m_runningState); m_runningState->addTransition(stopGameAction, SIGNAL(triggered()), stoppedState); + m_gameOverTransition = new GameOverTransition(gameOverState); + m_runningState->addTransition(m_gameOverTransition); + QTimer *timer = new QTimer(this); timer->setInterval(100); connect(timer, SIGNAL(timeout()), this, SLOT(runStep())); @@ -182,6 +194,22 @@ void MainWindow::runStep() } } +void MainWindow::gameOver() +{ + QList items = m_scene->items(); + + TankItem *lastTankStanding = 0; + foreach (QGraphicsItem *item, items) { + if (GameItem *gameItem = qgraphicsitem_cast(item)) { + if (lastTankStanding = qobject_cast(gameItem)) + break; + } + } + + QMessageBox::information(this, "Game over!", + QString::fromLatin1("The tank played by '%1' has won!").arg(lastTankStanding->objectName())); +} + void MainWindow::addRocket() { TankItem *tankItem = qobject_cast(sender()); @@ -244,21 +272,26 @@ void MainWindow::addTank() int idx = itemNames.indexOf(selectedName); if (Plugin *plugin = idx >= 0 ? items.at(idx) : 0) { TankItem *tankItem = m_spawns.takeLast(); + tankItem->setObjectName(selectedName); + tankItem->setToolTip(selectedName); m_scene->addItem(tankItem); connect(tankItem, SIGNAL(cannonFired()), this, SLOT(addRocket())); if (m_spawns.isEmpty()) emit mapFull(); + + m_gameOverTransition->addTankItem(tankItem); QState *region = new QState(m_runningState); + region->setObjectName(QString::fromLatin1("region%1").arg(m_spawns.size())); //! [2] QState *pluginState = plugin->create(region, tankItem); //! [2] region->setInitialState(pluginState); - // If the plugin has an error it is disabled //! [4] QState *errorState = new QState(region); + errorState->setObjectName(QString::fromLatin1("errorState%1").arg(m_spawns.size())); errorState->assignProperty(tankItem, "enabled", false); pluginState->setErrorState(errorState); //! [4] diff --git a/examples/statemachine/tankgame/mainwindow.h b/examples/statemachine/tankgame/mainwindow.h index 622dabe..40e1595 100644 --- a/examples/statemachine/tankgame/mainwindow.h +++ b/examples/statemachine/tankgame/mainwindow.h @@ -7,6 +7,7 @@ class QGraphicsScene; class QStateMachine; class QState; +class GameOverTransition; class TankItem; class MainWindow: public QMainWindow { @@ -23,6 +24,7 @@ public slots: void addTank(); void addRocket(); void runStep(); + void gameOver(); signals: void mapFull(); @@ -35,6 +37,7 @@ private: QStateMachine *m_machine; QState *m_runningState; + GameOverTransition *m_gameOverTransition; QList m_spawns; QTime m_time; diff --git a/examples/statemachine/tankgame/tankgame.pro b/examples/statemachine/tankgame/tankgame.pro index f7b0760..46cfe2e 100644 --- a/examples/statemachine/tankgame/tankgame.pro +++ b/examples/statemachine/tankgame/tankgame.pro @@ -8,6 +8,6 @@ DEPENDPATH += . INCLUDEPATH += C:/dev/kinetic/examples/statemachine/tankgame/. . # Input -HEADERS += mainwindow.h plugin.h tankitem.h rocketitem.h gameitem.h -SOURCES += main.cpp mainwindow.cpp tankitem.cpp rocketitem.cpp gameitem.cpp +HEADERS += mainwindow.h plugin.h tankitem.h rocketitem.h gameitem.h gameovertransition.h +SOURCES += main.cpp mainwindow.cpp tankitem.cpp rocketitem.cpp gameitem.cpp gameovertransition.cpp CONFIG += console diff --git a/examples/statemachine/tankgame/tankitem.cpp b/examples/statemachine/tankgame/tankitem.cpp index 5506a7e..c322d21 100644 --- a/examples/statemachine/tankgame/tankitem.cpp +++ b/examples/statemachine/tankgame/tankitem.cpp @@ -113,6 +113,7 @@ void TankItem::idle(qreal elapsed) void TankItem::hitByRocket() { + emit aboutToBeDestroyed(); deleteLater(); } diff --git a/examples/statemachine/tankgame/tankitem.h b/examples/statemachine/tankgame/tankitem.h index 66f05aa..9475397 100644 --- a/examples/statemachine/tankgame/tankitem.h +++ b/examples/statemachine/tankgame/tankitem.h @@ -41,6 +41,7 @@ signals: void collision(const QLineF &collidedLine); void actionCompleted(); void cannonFired(); + void aboutToBeDestroyed(); public slots: void moveForwards(qreal length = 10.0); -- cgit v0.12 From b038c1ac6bdac15b123946821bbff3ee25bfad2b Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 14 May 2009 05:09:58 -0700 Subject: Fixes combobox menu separator on XP While the delegate is somewhat abusing the ToolbarSeparator here, we should make sure we draw something for small heights as well. It seems microsoft requires us to allocate a few more pixels for the separator to actually be visible. Task-number: 249192 Reviewed-by: ogoffart --- src/gui/styles/qwindowsxpstyle.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 639eff0..3dac9f5 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -1792,7 +1792,12 @@ case PE_Frame: return; case PE_IndicatorToolBarSeparator: - + if (option->rect.height() < 3) { + // XP style requires a few pixels for the separator + // to be visible. + QWindowsStyle::drawPrimitive(pe, option, p, widget); + return; + } name = QLatin1String("TOOLBAR"); partId = TP_SEPARATOR; -- cgit v0.12 From c041a09b0243d7b2dfbb02bafec6ea29520ef578 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 14 May 2009 14:14:22 +0200 Subject: There's no need to record the current AST in the QML/JS engine. --- src/declarative/qml/parser/javascriptengine_p.h | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/declarative/qml/parser/javascriptengine_p.h b/src/declarative/qml/parser/javascriptengine_p.h index 966349b..933487f 100644 --- a/src/declarative/qml/parser/javascriptengine_p.h +++ b/src/declarative/qml/parser/javascriptengine_p.h @@ -115,12 +115,11 @@ class Engine { Lexer *_lexer; NodePool *_nodePool; - AST::Node *_ast; QSet _literals; public: Engine() - : _lexer(0), _nodePool(0), _ast(0) + : _lexer(0), _nodePool(0) { } QSet literals() const @@ -143,16 +142,6 @@ public: void setNodePool(NodePool *nodePool) { _nodePool = nodePool; } - - AST::Node *ast() const - { return _ast; } - - AST::Node *changeAbstractSyntaxTree(AST::Node *node) - { - AST::Node *previousAST = _ast; - _ast = node; - return previousAST; - } }; } // end of namespace JavaScript -- cgit v0.12 From 2a4f5a1b4e6e9632ab18c81c3e06ebf2061cd765 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 14 May 2009 14:17:18 +0200 Subject: Doc: Marked up a link correctly. Reviewed-by: David Boddie --- doc/src/groups.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/groups.qdoc b/doc/src/groups.qdoc index fda54dc..3c4da53 100644 --- a/doc/src/groups.qdoc +++ b/doc/src/groups.qdoc @@ -76,7 +76,7 @@ \brief Classes for animations, states and transitions. These classes provide a framework for creating both simple and complex - animations. The Animation Framework also provides states and animated + animations. \l{The Animation Framework} also provides states and animated transitions, making it easy to create animated stateful forms. */ -- cgit v0.12 From ce4e9004d23f4cb5bb03292436db81934c85921f Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 14 May 2009 14:25:27 +0200 Subject: Introduced UiStatement in the QML grammar. UiStatement is a small subset of the JavaScript statements. We don't really want our users to use control flow statements in the left hand side of a binding (e.g. Item { x: return 42 }). --- src/declarative/qml/parser/javascript.g | 13 +- src/declarative/qml/parser/javascriptgrammar.cpp | 1194 +++++++++++----------- src/declarative/qml/parser/javascriptgrammar_p.h | 14 +- src/declarative/qml/parser/javascriptparser.cpp | 406 ++++---- src/declarative/qml/parser/javascriptparser_p.h | 4 +- 5 files changed, 827 insertions(+), 804 deletions(-) diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g index 14ab6b3..af4fb74 100644 --- a/src/declarative/qml/parser/javascript.g +++ b/src/declarative/qml/parser/javascript.g @@ -624,9 +624,16 @@ case $rule_number: { } break; ./ -UiObjectMember: UiQualifiedId T_COLON UiMultilineStringStatement ; -/. case $rule_number: ./ -UiObjectMember: UiQualifiedId T_COLON Statement ; + +UiStatement: Block ; +UiStatement: EmptyStatement ; +UiStatement: ExpressionStatement ; +UiStatement: DebuggerStatement ; +UiStatement: UiMultilineStringStatement ; +UiStatement: IfStatement ; --- ### do we really want if statement in a binding? + + +UiObjectMember: UiQualifiedId T_COLON UiStatement ; /. case $rule_number: { AST::UiScriptBinding *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId->finish(), diff --git a/src/declarative/qml/parser/javascriptgrammar.cpp b/src/declarative/qml/parser/javascriptgrammar.cpp index abe3f1c..2d50da8 100644 --- a/src/declarative/qml/parser/javascriptgrammar.cpp +++ b/src/declarative/qml/parser/javascriptgrammar.cpp @@ -57,360 +57,330 @@ const char *const JavaScriptGrammar::spell [] = { const int JavaScriptGrammar::lhs [] = { 91, 92, 92, 95, 95, 96, 96, 94, 93, 98, 98, 100, 100, 101, 101, 99, 97, 99, 99, 103, - 104, 104, 99, 99, 106, 106, 106, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 102, 102, - 110, 110, 110, 102, 102, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 113, 113, 117, 117, 112, 112, 115, 115, 118, 118, - 118, 118, 118, 118, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 120, 120, 121, 121, 121, - 121, 121, 124, 124, 125, 125, 125, 125, 123, 123, - 126, 126, 127, 127, 128, 128, 128, 129, 129, 129, - 129, 129, 129, 129, 129, 129, 129, 130, 130, 130, - 130, 131, 131, 131, 132, 132, 132, 132, 133, 133, - 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, - 134, 135, 135, 135, 135, 135, 136, 136, 136, 136, - 136, 137, 137, 138, 138, 139, 139, 140, 140, 141, - 141, 142, 142, 143, 143, 144, 144, 145, 145, 146, - 146, 147, 147, 148, 148, 116, 116, 149, 149, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 107, 107, 151, 151, 152, 152, 153, 153, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 154, 169, 169, 168, 168, 109, - 109, 170, 170, 171, 171, 173, 173, 172, 174, 177, - 175, 175, 178, 176, 176, 155, 156, 156, 157, 157, - 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, - 159, 160, 160, 160, 160, 161, 161, 162, 164, 179, - 179, 182, 182, 180, 180, 183, 181, 163, 163, 163, - 165, 165, 166, 166, 166, 184, 185, 167, 167, 108, - 122, 189, 189, 186, 186, 187, 187, 190, 191, 191, - 192, 192, 188, 188, 114, 114, 193}; + 104, 104, 105, 105, 105, 105, 105, 105, 99, 111, + 111, 111, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 102, 102, 115, 115, 115, 102, 102, + 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, + 116, 116, 116, 116, 116, 118, 118, 122, 122, 117, + 117, 120, 120, 123, 123, 123, 123, 123, 123, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, + 125, 125, 126, 126, 126, 126, 126, 129, 129, 130, + 130, 130, 130, 128, 128, 131, 131, 132, 132, 133, + 133, 133, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 135, 135, 135, 135, 136, 136, 136, 137, + 137, 137, 137, 138, 138, 138, 138, 138, 138, 138, + 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, + 140, 141, 141, 141, 141, 141, 142, 142, 143, 143, + 144, 144, 145, 145, 146, 146, 147, 147, 148, 148, + 149, 149, 150, 150, 151, 151, 152, 152, 153, 153, + 121, 121, 154, 154, 155, 155, 155, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 112, 112, 156, 156, + 157, 157, 158, 158, 159, 159, 159, 159, 159, 159, + 159, 159, 159, 159, 159, 159, 159, 159, 159, 106, + 170, 170, 169, 169, 114, 114, 171, 171, 172, 172, + 174, 174, 173, 175, 178, 176, 176, 179, 177, 177, + 107, 108, 108, 110, 110, 160, 160, 160, 160, 160, + 160, 160, 161, 161, 161, 161, 162, 162, 162, 162, + 163, 163, 164, 166, 180, 180, 183, 183, 181, 181, + 184, 182, 165, 165, 165, 167, 167, 168, 168, 168, + 185, 186, 109, 109, 113, 127, 190, 190, 187, 187, + 188, 188, 191, 192, 192, 193, 193, 189, 189, 119, + 119, 194}; const int JavaScriptGrammar:: rhs[] = { 2, 1, 1, 1, 2, 3, 3, 0, 1, 1, 2, 1, 3, 2, 3, 4, 2, 1, 5, 1, - 2, 2, 3, 3, 1, 1, 1, 2, 4, 4, - 5, 5, 6, 6, 7, 7, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 3, 5, 3, 4, 3, - 2, 4, 1, 2, 0, 1, 3, 5, 1, 1, + 2, 2, 1, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 2, 4, 4, 5, 5, 6, 6, 7, + 7, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 3, 5, 3, 4, 3, 2, 4, 1, 2, 0, + 1, 3, 5, 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, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, - 3, 5, 1, 2, 4, 4, 4, 3, 0, 1, - 1, 3, 1, 1, 1, 2, 2, 1, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 1, 3, 3, - 3, 1, 3, 3, 1, 3, 3, 3, 1, 3, - 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, - 3, 1, 3, 3, 3, 3, 1, 3, 3, 3, - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 5, 1, 5, 1, 3, 1, 3, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 3, 0, 1, 1, 3, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 1, 2, 0, 1, 3, - 3, 1, 1, 1, 3, 1, 3, 2, 2, 2, - 0, 1, 2, 0, 1, 1, 2, 2, 7, 5, - 7, 7, 5, 9, 10, 7, 8, 2, 2, 3, - 3, 2, 2, 3, 3, 3, 3, 5, 5, 3, - 5, 1, 2, 0, 1, 4, 3, 3, 3, 3, - 3, 3, 3, 3, 4, 5, 2, 2, 2, 8, - 8, 1, 3, 0, 1, 0, 1, 1, 1, 2, - 1, 1, 0, 1, 0, 1, 2}; + 1, 1, 1, 1, 4, 3, 5, 1, 2, 4, + 4, 4, 3, 0, 1, 1, 3, 1, 1, 1, + 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 1, 3, 3, 3, 1, 3, 3, 1, + 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, + 1, 3, 3, 3, 3, 3, 1, 3, 3, 3, + 3, 1, 3, 3, 3, 3, 1, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 5, 1, 5, + 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 0, 1, + 1, 3, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 1, 2, 0, 1, 3, 3, 1, 1, 1, 3, + 1, 3, 2, 2, 2, 0, 1, 2, 0, 1, + 1, 2, 2, 7, 5, 7, 7, 5, 9, 10, + 7, 8, 2, 2, 3, 3, 2, 2, 3, 3, + 3, 3, 5, 5, 3, 5, 1, 2, 0, 1, + 4, 3, 3, 3, 3, 3, 3, 3, 3, 4, + 5, 2, 2, 2, 8, 8, 1, 3, 0, 1, + 0, 1, 1, 1, 2, 1, 1, 0, 1, 0, + 1, 2}; const int JavaScriptGrammar::action_default [] = { 8, 2, 0, 4, 3, 0, 0, 0, 6, 7, - 5, 0, 9, 1, 0, 17, 37, 44, 242, 0, - 0, 41, 42, 14, 39, 40, 43, 243, 18, 10, - 0, 0, 0, 38, 0, 27, 26, 25, 0, 0, - 31, 0, 32, 145, 212, 176, 184, 180, 124, 196, - 172, 0, 109, 47, 125, 188, 192, 113, 142, 123, - 128, 108, 162, 149, 0, 53, 54, 50, 313, 41, - 315, 65, 0, 0, 0, 0, 0, 48, 51, 0, - 0, 42, 43, 52, 46, 0, 49, 0, 0, 138, - 0, 0, 125, 144, 127, 126, 0, 0, 0, 140, - 141, 139, 143, 0, 173, 0, 0, 0, 0, 163, - 0, 0, 0, 0, 0, 0, 153, 0, 0, 0, - 147, 148, 146, 151, 155, 154, 152, 150, 165, 164, - 166, 0, 181, 0, 177, 0, 0, 119, 106, 118, - 107, 75, 76, 77, 102, 78, 103, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 104, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 105, 0, 0, 117, 213, 120, 0, 121, 0, - 122, 116, 35, 36, 0, 209, 202, 200, 207, 208, - 206, 205, 211, 204, 203, 201, 210, 197, 0, 185, - 0, 0, 189, 0, 0, 193, 0, 0, 119, 111, - 0, 110, 0, 115, 129, 0, 314, 304, 305, 0, - 302, 0, 303, 0, 306, 220, 227, 226, 234, 222, - 0, 223, 307, 0, 312, 224, 225, 230, 228, 309, - 308, 311, 231, 0, 0, 0, 0, 0, 313, 41, - 0, 315, 42, 214, 256, 43, 0, 0, 0, 0, - 0, 232, 233, 221, 229, 257, 258, 301, 310, 0, - 272, 273, 274, 275, 0, 268, 269, 270, 271, 298, - 299, 0, 0, 0, 0, 0, 261, 262, 218, 216, - 178, 186, 182, 198, 174, 219, 0, 125, 190, 194, - 167, 156, 0, 0, 175, 0, 0, 0, 0, 168, - 0, 0, 0, 0, 0, 160, 158, 161, 159, 157, - 170, 169, 171, 0, 183, 0, 179, 0, 217, 125, - 0, 199, 214, 215, 0, 214, 0, 0, 264, 0, - 0, 0, 266, 0, 187, 0, 0, 191, 0, 0, - 195, 254, 0, 246, 255, 249, 0, 253, 0, 214, - 247, 0, 214, 0, 0, 265, 0, 0, 0, 267, - 314, 304, 0, 0, 306, 0, 300, 0, 290, 0, - 0, 0, 260, 0, 259, 0, 316, 0, 74, 236, - 239, 0, 75, 242, 78, 103, 80, 81, 50, 85, - 86, 41, 87, 90, 48, 51, 42, 214, 43, 52, - 93, 46, 95, 49, 97, 98, 243, 100, 101, 105, - 0, 67, 0, 0, 69, 73, 71, 59, 70, 72, - 0, 68, 58, 237, 235, 113, 114, 119, 0, 112, - 0, 289, 0, 276, 277, 0, 288, 0, 0, 0, - 279, 284, 282, 285, 0, 0, 283, 284, 0, 280, - 0, 281, 238, 287, 0, 238, 286, 0, 291, 292, - 0, 238, 293, 294, 0, 0, 295, 0, 0, 0, - 296, 297, 131, 130, 0, 0, 0, 263, 0, 0, - 0, 278, 0, 66, 0, 63, 65, 56, 0, 62, - 57, 64, 61, 55, 0, 60, 135, 133, 137, 134, - 132, 136, 0, 0, 0, 29, 0, 30, 0, 33, - 34, 28, 15, 11, 0, 0, 24, 41, 65, 20, - 0, 23, 16, 0, 12, 0, 19, 13, 21, 22, - 45, 251, 244, 0, 252, 248, 0, 250, 240, 0, - 241, 245, 317}; + 5, 0, 9, 1, 0, 17, 42, 49, 247, 0, + 0, 46, 47, 14, 44, 45, 48, 248, 18, 10, + 0, 0, 0, 43, 0, 32, 31, 30, 0, 0, + 36, 0, 37, 150, 217, 181, 189, 185, 129, 201, + 177, 0, 114, 52, 130, 193, 197, 118, 147, 128, + 133, 113, 167, 154, 0, 58, 59, 55, 318, 46, + 320, 70, 0, 0, 0, 0, 0, 53, 56, 0, + 0, 47, 48, 57, 51, 0, 54, 0, 0, 143, + 0, 0, 130, 149, 132, 131, 0, 0, 0, 145, + 146, 144, 148, 0, 178, 0, 0, 0, 0, 168, + 0, 0, 0, 0, 0, 0, 158, 0, 0, 0, + 152, 153, 151, 156, 160, 159, 157, 155, 170, 169, + 171, 0, 186, 0, 182, 0, 0, 124, 111, 123, + 112, 80, 81, 82, 107, 83, 108, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 109, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 110, 0, 0, 122, 218, 125, 0, 126, 0, + 127, 121, 40, 41, 0, 214, 207, 205, 212, 213, + 211, 210, 216, 209, 208, 206, 215, 202, 0, 190, + 0, 0, 194, 0, 0, 198, 0, 0, 124, 116, + 0, 115, 0, 120, 134, 0, 319, 309, 310, 0, + 307, 0, 308, 0, 311, 225, 232, 231, 239, 227, + 0, 228, 312, 0, 317, 229, 230, 235, 233, 314, + 313, 316, 236, 0, 0, 0, 0, 0, 318, 46, + 0, 320, 47, 219, 261, 48, 0, 0, 0, 0, + 0, 237, 238, 226, 234, 262, 263, 306, 315, 0, + 277, 278, 279, 280, 0, 273, 274, 275, 276, 303, + 304, 0, 0, 0, 0, 0, 266, 267, 223, 221, + 183, 191, 187, 203, 179, 224, 0, 130, 195, 199, + 172, 161, 0, 0, 180, 0, 0, 0, 0, 173, + 0, 0, 0, 0, 0, 165, 163, 166, 164, 162, + 175, 174, 176, 0, 188, 0, 184, 0, 222, 130, + 0, 204, 219, 220, 0, 219, 0, 0, 269, 0, + 0, 0, 271, 0, 192, 0, 0, 196, 0, 0, + 200, 259, 0, 251, 260, 254, 0, 258, 0, 219, + 252, 0, 219, 0, 0, 270, 0, 0, 0, 272, + 319, 309, 0, 0, 311, 0, 305, 0, 295, 0, + 0, 0, 265, 0, 264, 0, 321, 0, 79, 241, + 244, 0, 80, 247, 83, 108, 85, 86, 55, 90, + 91, 46, 92, 95, 53, 56, 47, 219, 48, 57, + 98, 51, 100, 54, 102, 103, 248, 105, 106, 110, + 0, 72, 0, 0, 74, 78, 76, 64, 75, 77, + 0, 73, 63, 242, 240, 118, 119, 124, 0, 117, + 0, 294, 0, 281, 282, 0, 293, 0, 0, 0, + 284, 289, 287, 290, 0, 0, 288, 289, 0, 285, + 0, 286, 243, 292, 0, 243, 291, 0, 296, 297, + 0, 243, 298, 299, 0, 0, 300, 0, 0, 0, + 301, 302, 136, 135, 0, 0, 0, 268, 0, 0, + 0, 283, 0, 71, 0, 68, 70, 61, 0, 67, + 62, 69, 66, 60, 0, 65, 140, 138, 142, 139, + 137, 141, 0, 0, 0, 34, 0, 35, 0, 38, + 39, 33, 15, 11, 0, 0, 23, 26, 24, 25, + 28, 46, 70, 20, 0, 27, 29, 16, 0, 12, + 0, 19, 13, 21, 22, 50, 256, 249, 0, 257, + 253, 0, 255, 245, 0, 246, 250, 322}; const int JavaScriptGrammar::goto_default [] = { - 6, 5, 13, 1, 4, 3, 28, 30, 29, 533, - 15, 31, 530, 531, 389, 513, 230, 234, 263, 53, - 61, 494, 492, 387, 386, 44, 493, 385, 388, 139, - 57, 52, 177, 59, 48, 176, 54, 60, 89, 58, - 43, 63, 62, 300, 50, 294, 45, 290, 47, 292, - 46, 291, 55, 298, 56, 299, 49, 293, 289, 330, - 442, 295, 296, 225, 229, 231, 235, 236, 227, 226, - 238, 264, 237, 242, 261, 262, 228, 391, 390, 32, - 543, 542, 352, 353, 545, 355, 544, 354, 450, 454, - 457, 453, 452, 472, 473, 219, 233, 215, 218, 232, - 240, 239, 0}; + 6, 5, 13, 1, 4, 3, 28, 30, 29, 538, + 15, 31, 534, 535, 536, 225, 229, 231, 228, 235, + 513, 230, 234, 263, 53, 61, 494, 492, 387, 386, + 44, 493, 385, 388, 139, 57, 52, 177, 59, 48, + 176, 54, 60, 89, 58, 43, 63, 62, 300, 50, + 294, 45, 290, 47, 292, 46, 291, 55, 298, 56, + 299, 49, 293, 289, 330, 442, 295, 296, 389, 236, + 227, 226, 238, 264, 237, 242, 261, 262, 391, 390, + 32, 548, 547, 352, 353, 550, 355, 549, 354, 450, + 454, 457, 453, 452, 472, 473, 219, 233, 215, 218, + 232, 240, 239, 0}; const int JavaScriptGrammar::action_index [] = { - -23, -91, 10, -91, -19, 50, 77, 56, -91, -91, - -91, 67, -91, -91, 383, -91, -91, -91, -91, -4, - 213, 20, 186, -91, -91, -91, -18, -91, -91, -91, - 370, 129, 203, -91, 204, -91, -91, -91, -17, 192, - -91, 693, -91, 87, -91, 42, 9, -20, 191, -91, - 310, 140, -91, -91, 534, 17, 114, 160, 125, -91, - -91, -91, 344, 162, 693, -91, -91, -91, 157, -91, - 1191, 34, 693, 693, 693, 613, 693, -91, -91, 693, - 693, -91, -91, -91, -91, 693, -91, 693, 693, -91, - 693, 693, 119, 227, -91, -91, 693, 693, 693, -91, - -91, -91, 193, 693, 310, 693, 693, 693, 693, 446, - 693, 693, 693, 693, 693, 693, 237, 693, 693, 693, - 88, 106, 107, 237, 237, 166, 237, 237, 354, 372, - 334, 693, -11, 693, 19, 1104, 693, 693, -91, -91, + 60, -91, -21, -91, -47, 22, 43, 76, -91, -91, + -91, 20, -91, -91, 394, -91, -91, -91, -91, -31, + 199, 6, 185, -91, -91, -91, 11, -91, -91, -91, + 381, 157, 180, -91, 182, -91, -91, -91, 19, 183, + -91, 697, -91, 66, -91, 54, 32, -19, 174, -91, + 257, 211, -91, -91, 538, 63, 69, 248, 170, -91, + -91, -91, 345, 154, 697, -91, -91, -91, 158, -91, + 1275, 55, 697, 697, 697, 617, 697, -91, -91, 697, + 697, -91, -91, -91, -91, 697, -91, 697, 697, -91, + 697, 697, 100, 217, -91, -91, 697, 697, 697, -91, + -91, -91, 131, 697, 267, 697, 697, 697, 697, 355, + 697, 697, 697, 697, 697, 697, 188, 697, 697, 697, + 101, 118, 105, 314, 224, 210, 205, 153, 450, 365, + 450, 697, -8, 697, 172, 1188, 697, 697, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, 98, 693, -91, -91, 0, -43, -91, 693, - -91, -91, -91, -91, 693, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, 693, 6, - 693, 693, -2, 82, 693, -91, 1104, 693, 693, -91, - 96, -91, 8, -91, -91, 61, -91, 147, 80, 33, - -91, 154, -91, 63, 1452, -91, -91, -91, -91, -91, - 169, -91, -91, 23, -91, -91, -91, -91, -91, -91, - 1452, -91, -91, 285, 287, 68, 1365, 55, 112, 79, - 46, 1626, 66, 693, -91, 65, 47, 693, 52, 58, - 59, -91, -91, -91, -91, -91, -91, -91, -91, 64, - -91, -91, -91, -91, 73, -91, -91, -91, -91, -91, - -91, -5, 45, 693, 137, 81, -91, -91, 1017, -91, - 69, 28, 14, -91, 240, 76, 53, 476, 171, 120, - 308, 237, 180, 693, 264, 693, 693, 693, 693, 298, - 693, 693, 693, 693, 693, 230, 237, 237, 237, 237, - 288, 268, 378, 693, -68, 693, 12, 693, -91, 445, - 693, -91, 693, 7, -47, 693, -44, 1365, -91, 693, - 100, 1365, -91, 693, -25, 693, 693, 22, 15, 693, - -91, -8, 108, -13, -91, -91, 693, -91, 178, 693, - -91, -60, 693, -58, 1365, -91, 693, 99, 1365, -91, - -33, 199, -53, -27, 1452, -26, -91, 1365, -91, 693, - 95, 1365, 32, 1365, -91, 43, 41, 4, -91, -91, - 1365, 5, 232, 54, 275, 70, 693, 1365, 49, 27, - 252, 48, 30, 613, 40, 39, -91, 777, -91, 25, - -1, 26, 693, 24, -3, 693, 21, 693, 1, 2, - 693, -91, 1278, 37, -91, -91, -91, -91, -91, -91, - 693, -91, -91, -91, -91, 156, -91, 693, -21, -91, - 1365, -91, 60, -91, -91, 1365, -91, 693, 102, 3, - -91, 29, -91, 35, 101, 693, -91, 36, 38, -91, - -30, -91, 1365, -91, 94, 1365, -91, 176, -91, -91, - 143, 1365, 44, -91, 16, -6, -91, 207, -9, -29, - -91, -91, -91, -91, 693, 90, 1365, -91, 693, 91, - 1365, -91, 111, 13, 857, -91, 18, -91, 937, -91, - -91, -91, -91, -91, 105, -91, -91, -91, -91, -91, - -91, -91, -33, -24, 215, -91, 693, -91, 187, -91, - -91, -91, -91, -91, 1539, 174, -91, 133, 104, -91, - 62, -91, -91, 97, -91, 51, -91, -91, -91, -91, - -91, 57, -91, 173, -91, -91, 693, -91, -91, 151, - -91, -91, -91, + -91, -91, 103, 697, -91, -91, 42, -22, -91, 697, + -91, -91, -91, -91, 697, -91, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, 697, 25, + 697, 697, -2, 82, 697, -91, 1188, 697, 697, -91, + 119, -91, 44, -91, -91, -9, -91, 132, 73, 50, + -91, 134, -91, 62, 1449, -91, -91, -91, -91, -91, + 122, -91, -91, 37, -91, -91, -91, -91, -91, -91, + 1449, -91, -91, 298, 300, 109, 1536, 41, 194, 75, + 47, 1623, 68, 697, -91, 65, 49, 697, 45, 40, + 38, -91, -91, -91, -91, -91, -91, -91, -91, 72, + -91, -91, -91, -91, 115, -91, -91, -91, -91, -91, + -91, 56, 58, 697, 95, 67, -91, -91, 1021, -91, + 86, 59, -12, -91, 259, 61, 39, 467, 77, 70, + 382, 314, 223, 697, 276, 697, 697, 697, 697, 274, + 697, 697, 697, 697, 697, 314, 314, 314, 168, 314, + 382, 291, 301, 697, -20, 697, 17, 697, -91, 538, + 697, -91, 697, 12, -37, 697, -39, 1536, -91, 697, + 106, 1536, -91, 697, -25, 697, 697, 15, 8, 697, + -91, 2, 113, -15, -91, -91, 697, -91, 225, 697, + -91, -36, 697, -38, 1536, -91, 697, 80, 1536, -91, + -7, 202, -23, 3, 1449, -42, -91, 1536, -91, 697, + 97, 1536, 14, 1536, -91, 21, 18, 36, -91, -91, + 1536, -24, 288, 7, 281, 74, 697, 1536, -5, -32, + 264, -4, -26, 617, 0, -1, -91, 781, -91, 5, + -27, 1, 697, 4, -28, 697, -6, 697, -3, 9, + 697, -91, 1362, 53, -91, -91, -91, -91, -91, -91, + 697, -91, -91, -91, -91, 171, -91, 697, 24, -91, + 1536, -91, 64, -91, -91, 1536, -91, 697, 91, 28, + -91, 51, -91, 52, 99, 697, -91, 27, 57, -91, + 31, -91, 1536, -91, 94, 1536, -91, 226, -91, -91, + 102, 1536, 48, -91, 35, 34, -91, 175, 33, 29, + -91, -91, -91, -91, 697, 90, 1536, -91, 697, 89, + 1536, -91, 88, 46, 941, -91, 26, -91, 861, -91, + -91, -91, -91, -91, 107, -91, -91, -91, -91, -91, + -91, -91, 10, 13, 155, -91, 697, -91, 177, -91, + -91, -91, -91, -91, 1101, 191, -91, -91, -91, -91, + -91, 16, 110, -91, 85, -91, -91, -91, 104, -91, + 23, -91, -91, -91, -91, -91, 30, -91, 160, -91, + -91, 697, -91, -91, 136, -91, -91, -91, - -103, -103, -103, -103, 15, 16, -103, -103, -103, -103, - -103, -103, -103, -103, 208, -103, -103, -103, -103, -103, - -1, -103, -103, -103, -103, -103, -103, -103, -103, -103, - 237, -103, 26, -103, 31, -103, -103, -103, -103, -103, - -103, 28, -103, -103, -103, -103, -103, -103, -103, -103, - -103, -103, -103, -103, -46, -103, -103, -103, -103, -103, - -103, -103, -103, -103, 98, -103, -103, -103, 7, -103, - -103, -103, -10, 118, 111, 67, 112, -103, -103, 119, - 123, -103, -103, -103, -103, 124, -103, 115, 97, -103, - 32, 106, -103, -103, -103, -103, 128, 171, 101, -103, - -103, -103, -103, 156, -103, 157, 159, 81, 131, -103, - 127, 136, 145, 139, 102, 91, -103, 59, 50, 72, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, 70, -103, 80, -103, 85, 61, 51, -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, -103, -103, -103, - -103, -103, -103, 54, -103, -103, -103, -103, -103, -24, - -103, -103, -103, -103, -23, -103, -103, -103, -103, -103, - -103, -103, -103, -103, -103, -103, -103, -103, 134, -103, - 138, 17, -103, -103, 23, -103, 255, -4, 73, -103, - -103, -103, -103, -103, -103, -103, -103, 11, -103, -103, - -103, 8, -103, -103, 9, -103, -103, -103, -103, -103, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - 77, -103, -103, 10, 2, -103, 5, -103, -3, -103, - -103, -103, -103, 19, -103, -103, -103, 27, -31, -103, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, -103, -103, -5, -103, -103, -103, -103, 105, -103, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, -103, 34, 205, -103, 193, 169, 181, 201, -103, - 147, 66, 78, 79, 89, -103, -103, -103, -103, -103, - -103, -103, -103, 202, -103, 192, -103, 212, -103, -103, - 182, -103, 68, -103, -103, 62, -103, 56, -103, 33, - -103, 55, -103, 170, -103, 161, 162, -103, -103, 172, - -103, -103, -103, -103, -103, -103, 211, -103, 69, 71, - -103, -103, 64, -103, 60, -103, 41, -103, 42, -103, - -103, 74, -103, -103, 75, -103, -103, 38, -103, 35, - -103, 36, -103, 44, -103, -103, -103, -103, -103, -103, - 52, -103, 45, -103, 43, -103, 65, 46, -103, -103, - 40, -103, -103, 146, -103, -103, -103, 49, -103, -103, - -103, -103, 47, -103, -22, 149, -103, 153, -103, -103, - 30, -103, 48, -103, -103, -103, -103, -103, -103, -103, - 29, -103, -103, -103, -103, -103, -103, 133, -103, -103, - 53, -103, -103, -103, -103, 58, -103, 57, -103, -103, - -103, -103, -103, -56, -103, -6, -103, -82, -103, -103, - -103, -103, -77, -103, -103, -68, -103, -103, -103, -103, - -103, -103, -90, -103, -103, -58, -103, -11, -103, -60, - -103, -103, -103, -103, 21, -103, 25, -103, 22, -103, - 20, -103, -103, -103, 6, -103, 12, -103, 3, -103, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, -103, -103, -103, -103, -103, 24, -103, -103, -103, - -103, -103, -103, -103, 1, -2, -103, 4, 104, -103, - -103, -103, -103, -103, -103, 18, -103, -103, -103, -103, - -103, -103, -103, -103, -103, -103, 0, -103, -103, 63, - -103, -103, -103}; + -104, -104, -104, -104, 98, 6, -104, -104, -104, -104, + -104, -104, -104, -104, 212, -104, -104, -104, -104, -104, + 0, -104, -104, -104, -104, -104, -104, -104, -104, -104, + 320, -104, 3, -104, -3, -104, -104, -104, -104, -104, + -104, 11, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -43, -104, -104, -104, -104, -104, + -104, -104, -104, -104, 108, -104, -104, -104, -16, -104, + -104, -104, -11, 116, 103, 79, 92, -104, -104, 48, + 143, -104, -104, -104, -104, 112, -104, 99, 93, -104, + 161, 106, -104, -104, -104, -104, 81, 87, 96, -104, + -104, -104, -104, 77, -104, 147, 134, 148, 121, -104, + 124, 132, 136, 130, 75, 44, -104, 43, 35, 53, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, 55, -104, 64, -104, 73, 21, 23, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, 24, -104, -104, -104, -104, -104, 22, + -104, -104, -104, -104, -26, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, 119, -104, + 123, 19, -104, -104, 17, -104, 214, 9, 56, -104, + -104, -104, -104, -104, -104, -104, -104, 1, -104, -104, + -104, -4, -104, -104, -37, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + 52, -104, -104, 12, 10, -104, -35, -104, -2, -104, + -104, -104, -104, 5, -104, -104, -104, 7, 14, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -20, -104, -104, -104, -104, 97, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, 41, 191, -104, 203, 162, 185, 182, -104, + 117, 146, 120, 61, 63, -104, -104, -104, -104, -104, + -104, -104, -104, 170, -104, 168, -104, 176, -104, -104, + 166, -104, 58, -104, -104, 66, -104, 32, -104, 45, + -104, 33, -104, 224, -104, 160, 152, -104, -104, 158, + -104, -104, -104, -104, -104, -104, 150, -104, 88, 54, + -104, -104, 60, -104, 42, -104, 47, -104, 31, -104, + -104, 49, -104, -104, 59, -104, -104, -22, -104, 34, + -104, -27, -104, -28, -104, -104, -104, -104, -104, -104, + -30, -104, 38, -104, 40, -104, 70, -24, -104, -104, + 39, -104, -104, 57, -104, -104, -104, 36, -104, -104, + -104, -104, 37, -104, 28, 126, -104, 142, -104, -104, + 30, -104, 27, -104, -104, -104, -104, -104, -104, -104, + 26, -104, -104, -104, -104, -104, -104, 111, -104, -104, + 4, -104, -104, -104, -104, -7, -104, 46, -104, -104, + -104, -104, -104, -48, -104, -5, -104, -90, -104, -104, + -104, -104, -73, -104, -104, -75, -104, -104, -104, -104, + -104, -104, -84, -104, -104, -6, -104, -18, -104, -1, + -104, -104, -104, -104, -19, -104, -53, -104, 16, -104, + -55, -104, -104, -104, 18, -104, 25, -104, 20, -104, + -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -104, -104, -104, -104, -104, 2, -104, -104, -104, + -104, -104, -104, -104, 237, 15, -104, -104, -104, -104, + -104, 8, 13, -104, -104, -104, -104, -104, -104, -104, + 29, -104, -104, -104, -104, -104, -104, -104, -104, -104, + -104, -23, -104, -104, 50, -104, -104, -104}; const int JavaScriptGrammar::action_info [] = { - 198, 362, 364, 371, 471, 514, 374, 373, 179, 356, - 325, 521, 39, 303, 335, 173, 337, 181, 366, 198, - 103, 501, 349, 323, 343, 461, 495, 471, -99, 376, - 471, -96, -72, -94, 455, 447, 451, 484, 488, 439, - 455, 455, 495, 103, 430, 462, -73, -91, 383, 422, - 420, 479, 477, 14, 131, -69, -83, 131, 133, 432, - 434, -102, 34, 288, 475, 2, 379, 133, 213, 2, - 303, 282, 445, 440, 546, 7, 323, 552, 267, 11, - 11, 283, 379, 447, 327, 471, 377, 0, 221, 204, - 0, 288, 325, 223, 484, 488, 224, 217, 173, 173, - 14, 465, 173, 173, 173, 535, 173, 173, 173, 0, - 173, 458, 495, 173, 332, 0, 358, 9, 8, 496, - 0, 444, 443, 539, 538, 273, 272, 90, 90, 280, - 279, 280, 279, 11, 278, 277, 524, 96, 91, 91, - 377, 69, 287, 286, 525, 173, 90, 90, 173, 474, - 486, 490, 211, 536, 174, 381, 459, 91, 91, 368, - 341, 94, 449, 475, 200, 505, 14, 497, 201, 359, - 345, 206, 95, 343, 346, 206, 69, 173, 81, 82, - 69, 549, 97, 69, 173, 0, 69, 117, 98, 118, - 207, 117, 437, 118, 207, 173, 208, 285, 0, 41, - 119, 183, 182, 69, 119, 96, 135, 69, 0, 69, - 0, 0, 0, 81, 82, 35, 0, 81, 82, 0, - 81, 82, 516, 81, 82, 136, 0, 137, 69, 0, - 266, 265, 69, 35, 550, 548, 69, 469, 468, 96, - 81, 82, 69, 0, 81, 82, 81, 82, 520, 519, - 97, 0, 0, 42, 40, 117, 98, 118, 305, 306, - 37, 69, 117, 0, 118, 81, 82, 0, 119, 81, - 82, 36, 0, 81, 82, 119, 517, 515, 37, 81, - 82, 69, 305, 306, 97, 307, 308, 0, -313, 36, - 98, 310, 311, 271, 270, 0, 0, 0, 81, 82, - 312, 0, 0, 313, 69, 314, 0, 0, 0, 307, - 308, 310, 311, 0, 69, 0, 69, 0, 81, 82, - 312, 310, 311, 313, 0, 314, 0, 0, 105, 106, - 312, 310, 311, 313, 0, 314, 276, 275, 0, 0, - 312, 81, 82, 313, 0, 314, 271, 270, 276, 275, - 0, 81, 82, 81, 82, 107, 108, 110, 111, 0, - 0, 0, 0, 0, 0, 112, 113, 110, 111, 114, - 0, 115, 0, 0, 0, 112, 113, 110, 111, 114, - 19, 115, 0, 0, 0, 112, 113, 0, 0, 114, - 0, 115, 20, 19, 0, 110, 111, 0, 0, 21, - 0, 310, 311, 112, 113, 20, 0, 114, 0, 115, - 312, 0, 21, 313, 0, 314, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 522, 0, 0, 0, 25, - 0, 0, 0, 0, 0, 0, 22, 26, 23, 0, - 0, 0, 25, 0, 27, 0, 0, 0, 185, 22, - 26, 0, 0, 18, 0, 24, 0, 27, 186, 0, - 0, 0, 187, 0, 0, 0, 18, 0, 24, 110, - 111, 188, 0, 189, 0, 0, 0, 112, 113, 185, - 0, 114, 0, 115, 190, 0, 191, 94, 0, 186, - 0, 0, 0, 187, 192, 0, 0, 193, 95, 0, - 0, 0, 188, 194, 189, 0, 0, 339, 0, 195, - 0, 0, 0, 0, 0, 190, 0, 191, 94, 0, - 0, 0, 0, 0, 196, 192, 0, 0, 193, 95, - 0, 0, 0, 0, 194, 0, 0, 185, 0, 0, - 195, 0, 0, 0, 0, 0, 0, 186, 0, 0, - 0, 187, 0, 0, 0, 196, 0, 0, 0, 0, - 188, 0, 189, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 190, 0, 191, 94, 0, 0, 0, - 0, 0, 0, 192, 0, 0, 193, 95, 0, 0, - 0, 0, 194, 0, 0, 0, 0, 0, 195, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 196, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 65, 66, 0, 0, 0, - 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, - 0, 0, 69, 0, 0, 0, 70, 71, 0, 72, - 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, - 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 83, 81, - 82, 0, 84, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 77, 86, 67, 0, 0, 0, 0, - 0, 0, 0, 0, 64, 65, 66, 0, 0, 0, - 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, - 0, 0, 69, 0, 0, 0, 70, 71, 0, 72, - 0, 0, 0, 73, 0, 74, 75, 76, 0, 0, - 78, 0, 0, 0, 79, 0, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 83, 81, - 82, 0, 84, 0, 85, 0, 87, 0, 88, 0, - 0, 0, 0, 77, 86, 67, 0, 0, 0, 0, - 0, 0, 0, 0, -92, 0, 0, 0, 64, 65, - 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, - 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, - 70, 71, 0, 72, 0, 0, 0, 73, 0, 74, - 75, 76, 0, 0, 78, 0, 0, 0, 79, 0, - 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 83, 81, 82, 0, 84, 0, 85, 0, - 87, 0, 88, 0, 0, 0, 0, 77, 86, 67, - 0, 0, 0, 0, 0, 0, 0, 0, 64, 65, + 198, -104, -88, -74, 288, 471, -78, -96, -99, 447, + 379, -101, -77, 376, -107, 349, 366, 343, 303, 356, + 173, 337, 364, 323, 335, 362, 422, 217, 420, 371, + 383, 434, 455, 484, 495, 34, 374, 373, 181, 14, + 521, 2, 514, 557, 7, 488, 371, 551, 39, 14, + 179, 11, 11, 14, 501, 103, 455, 455, 325, 133, + 430, 451, 471, 495, 462, 198, 325, 471, 475, 327, + 133, 477, 445, 131, 488, 440, 484, 288, 471, 343, + 131, 221, 377, 379, 439, 447, 461, 303, 173, 204, + 0, 432, 267, 479, 283, 224, 496, 173, 173, 173, + 332, 465, 173, 173, 213, 173, 90, 323, 474, 458, + 223, 173, 540, 0, 173, 173, 0, 91, 495, 200, + 345, 358, 475, 201, 346, 444, 443, 173, 287, 286, + 173, 0, 282, 273, 272, 280, 279, 9, 8, 11, + 368, 90, 94, 96, 497, 90, 544, 543, 2, 490, + 486, 449, 91, 95, 459, 285, 91, 381, 90, 174, + 541, 69, 516, 69, 524, 69, 341, 505, 554, 91, + 280, 279, 525, 103, 359, 211, 278, 277, 117, 117, + 118, 118, 96, 266, 265, 173, 206, 69, 97, 135, + 41, 119, 119, 117, 98, 118, 0, 0, 81, 82, + 81, 82, 81, 82, 69, 207, 119, 437, 136, 69, + 137, 35, 0, 117, 35, 118, 517, 515, 0, 173, + 69, 555, 553, 69, 81, 82, 119, 97, 69, 96, + 117, 69, 118, 98, 173, 117, 0, 118, 520, 519, + 0, 81, 82, 119, 42, 40, 81, 82, 119, 117, + 0, 118, 69, 0, 69, 0, 37, 81, 82, 37, + 81, 82, 119, 206, 0, 81, 82, 36, 81, 82, + 36, 0, 183, 182, 97, 105, 106, 305, 306, 0, + 98, 0, 207, 0, 208, 105, 106, 469, 468, 81, + 82, 81, 82, 69, 305, 306, 0, 310, 311, 0, + -318, 0, 107, 108, 307, 308, 312, 0, 0, 313, + 69, 314, 107, 108, 310, 311, 0, 69, 0, 0, + 0, 307, 308, 312, 310, 311, 313, 69, 314, 69, + 81, 82, 0, 312, 0, 0, 313, 0, 314, 117, + 0, 118, 276, 275, 0, 0, 0, 81, 82, 271, + 270, 0, 119, 0, 81, 82, 0, 0, 0, 271, + 270, 276, 275, 0, 81, 82, 81, 82, 110, 111, + 0, 0, 0, 0, 0, 0, 112, 113, 110, 111, + 114, 0, 115, 0, 0, 0, 112, 113, 110, 111, + 114, 19, 115, 0, 0, 0, 112, 113, 0, 0, + 114, 0, 115, 20, 19, 310, 311, 0, 0, 0, + 21, 0, 0, 0, 312, 0, 20, 313, 0, 314, + 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 522, 0, 0, 0, + 25, 0, 0, 0, 0, 0, 0, 22, 26, 23, + 0, 0, 0, 25, 0, 27, 0, 0, 0, 0, + 22, 26, 0, 0, 18, 0, 24, 0, 27, 0, + 185, 0, 0, 110, 111, 0, 0, 18, 0, 24, + 186, 112, 113, 0, 187, 114, 0, 115, 0, 0, + 0, 0, 0, 188, 0, 189, 0, 0, 339, 0, + 0, 0, 0, 0, 0, 0, 190, 0, 191, 94, + 0, 0, 0, 0, 0, 0, 192, 0, 0, 193, + 95, 0, 0, 0, 0, 194, 0, 0, 0, 0, + 0, 195, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 185, 0, 0, 0, 0, 196, 0, 0, 0, + 0, 186, 0, 0, 0, 187, 0, 0, 0, 0, + 0, 0, 0, 0, 188, 0, 189, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 190, 0, 191, + 94, 0, 0, 0, 0, 0, 0, 192, 0, 0, + 193, 95, 0, 0, 0, 0, 194, 0, 0, 0, + 0, 0, 195, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 196, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, - 70, 71, 0, 72, 0, 0, 0, 73, 0, 74, - 75, 76, 0, 0, 78, 0, 0, 0, 79, 0, - 80, 0, 0, 503, 0, 0, 0, 0, 0, 0, - 0, 0, 83, 81, 82, 0, 84, 0, 85, 0, - 87, 0, 88, 0, 0, 0, 0, 77, 86, 67, - 0, 0, 0, 0, 0, 0, 0, 0, 64, 65, - 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, - 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, - 70, 71, 0, 72, 0, 0, 0, 73, 0, 74, - 75, 76, 0, 0, 78, 0, 0, 0, 79, 0, - 80, 0, 0, 500, 0, 0, 0, 0, 0, 0, - 0, 0, 83, 81, 82, 0, 84, 0, 85, 0, - 87, 0, 88, 0, 0, 0, 0, 77, 86, 67, + 70, 71, 0, 72, 0, 0, 0, 0, 0, 0, + 75, 0, 0, 0, 78, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 83, 81, 82, 0, 84, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 77, 86, 67, 0, 0, 0, 0, 0, 0, 0, 0, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, @@ -418,210 +388,217 @@ const int JavaScriptGrammar::action_info [] = { 75, 76, 0, 0, 78, 0, 0, 0, 79, 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 81, 82, 0, 84, 0, 85, 0, - 87, 302, 88, 0, 0, 0, 0, 77, 86, 67, - 0, 0, 0, 0, 0, 0, 0, 0, 141, 142, - 143, 0, 0, 145, 147, 148, 0, 0, 149, 0, - 150, 0, 0, 0, 152, 153, 154, 0, 0, 0, - 0, 0, 0, 69, 155, 156, 157, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 158, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 161, 0, 0, 0, 0, 0, 0, - 81, 82, 162, 163, 164, 0, 166, 167, 168, 169, - 170, 171, 0, 0, 159, 165, 151, 144, 146, 160, - 0, 0, 0, 0, 0, 141, 142, 143, 0, 0, - 145, 147, 148, 0, 0, 149, 0, 150, 0, 0, - 0, 152, 153, 154, 0, 0, 0, 0, 0, 0, - 424, 155, 156, 157, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 158, 0, 0, 0, 425, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 161, 0, 0, 0, 0, 0, 429, 426, 428, 162, - 163, 164, 0, 166, 167, 168, 169, 170, 171, 0, - 0, 159, 165, 151, 144, 146, 160, 0, 0, 0, + 87, 0, 88, 0, 0, 0, 0, 77, 86, 67, + 0, 0, 0, 0, 0, 0, 0, 0, -97, 0, + 0, 0, 64, 65, 66, 0, 0, 0, 0, 0, + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, + 69, 0, 0, 0, 70, 71, 0, 72, 0, 0, + 0, 73, 0, 74, 75, 76, 0, 0, 78, 0, + 0, 0, 79, 0, 80, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 83, 81, 82, 0, + 84, 0, 85, 0, 87, 0, 88, 0, 0, 0, + 0, 77, 86, 67, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 65, 66, 0, 0, 0, 0, 0, + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, + 69, 0, 0, 0, 70, 71, 0, 72, 0, 0, + 0, 73, 0, 74, 75, 76, 0, 0, 78, 0, + 0, 0, 79, 0, 80, 0, 0, 500, 0, 0, + 0, 0, 0, 0, 0, 0, 83, 81, 82, 0, + 84, 0, 85, 0, 87, 0, 88, 0, 0, 0, + 0, 77, 86, 67, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 65, 66, 0, 0, 0, 0, 0, + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, + 69, 0, 0, 0, 70, 71, 0, 72, 0, 0, + 0, 73, 0, 74, 75, 76, 0, 0, 78, 0, + 0, 0, 79, 0, 80, 0, 0, 503, 0, 0, + 0, 0, 0, 0, 0, 0, 83, 81, 82, 0, + 84, 0, 85, 0, 87, 0, 88, 0, 0, 0, + 0, 77, 86, 67, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 65, 66, 0, 0, 0, 0, 0, + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, + 69, 0, 0, 0, 70, 71, 0, 72, 0, 0, + 0, 73, 0, 74, 75, 76, 0, 0, 78, 0, + 0, 0, 79, 0, 80, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 83, 81, 82, 0, + 84, 0, 85, 0, 87, 302, 88, 0, 0, 0, + 0, 77, 86, 67, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 65, 66, 0, 0, 0, 0, 0, + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, + 531, 250, 0, 0, 251, 532, 0, 72, 0, 0, + 0, 73, 0, 74, 75, 76, 0, 0, 78, 0, + 0, 0, 79, 0, 80, 0, 0, 0, 0, 0, + 0, 0, 254, 0, 0, 0, 83, 81, 82, 0, + 84, 0, 85, 0, 87, 0, 88, 0, 0, 0, + 0, 77, 86, 67, 0, 245, 0, 533, 0, 0, 0, 0, 141, 142, 143, 0, 0, 145, 147, 148, 0, 0, 149, 0, 150, 0, 0, 0, 152, 153, - 154, 0, 0, 0, 0, 0, 0, 424, 155, 156, + 154, 0, 0, 0, 0, 0, 0, 69, 155, 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 158, 0, 0, 0, 425, 0, 0, 0, 0, - 0, 0, 0, 427, 0, 0, 0, 161, 0, 0, - 0, 0, 0, 429, 426, 428, 162, 163, 164, 0, + 0, 158, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 161, 0, 0, + 0, 0, 0, 0, 81, 82, 162, 163, 164, 0, 166, 167, 168, 169, 170, 171, 0, 0, 159, 165, - 151, 144, 146, 160, 0, 0, 0, 0, 0, 243, - 0, 0, 0, 0, 244, 0, 64, 65, 66, 246, - 0, 0, 0, 0, 0, 0, 247, 68, 0, 0, - 0, 0, 0, 0, 249, 250, 0, 0, 251, 71, - 0, 72, 0, 0, 0, 73, 0, 74, 75, 76, - 0, 0, 78, 0, 0, 0, 79, 0, 80, 0, - 0, 0, 0, 0, 253, 0, 254, 0, 0, 0, - 83, 252, 255, 256, 84, 257, 85, 258, 87, 27, - 88, 259, 260, 0, 0, 77, 86, 67, 18, 245, - 0, 0, 0, 0, 0, 0, 243, 0, 0, 0, - 0, 244, 0, 64, 65, 66, 246, 0, 0, 0, - 0, 0, 0, 247, 248, 0, 0, 0, 0, 0, - 0, 249, 250, 0, 0, 251, 71, 0, 72, 0, - 0, 0, 73, 0, 74, 75, 76, 0, 0, 78, - 0, 0, 0, 79, 0, 80, 0, 0, 0, 0, - 0, 253, 0, 254, 0, 0, 0, 83, 252, 255, - 256, 84, 257, 85, 258, 87, 27, 88, 259, 260, - 0, 0, 77, 86, 67, 18, 245, 0, 0, 0, + 151, 144, 146, 160, 0, 0, 0, 0, 0, 141, + 142, 143, 0, 0, 145, 147, 148, 0, 0, 149, + 0, 150, 0, 0, 0, 152, 153, 154, 0, 0, + 0, 0, 0, 0, 424, 155, 156, 157, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 158, 0, + 0, 0, 425, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 161, 0, 0, 0, 0, 0, + 429, 426, 428, 162, 163, 164, 0, 166, 167, 168, + 169, 170, 171, 0, 0, 159, 165, 151, 144, 146, + 160, 0, 0, 0, 0, 0, 141, 142, 143, 0, + 0, 145, 147, 148, 0, 0, 149, 0, 150, 0, + 0, 0, 152, 153, 154, 0, 0, 0, 0, 0, + 0, 424, 155, 156, 157, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 158, 0, 0, 0, 425, + 0, 0, 0, 0, 0, 0, 0, 427, 0, 0, + 0, 161, 0, 0, 0, 0, 0, 429, 426, 428, + 162, 163, 164, 0, 166, 167, 168, 169, 170, 171, + 0, 0, 159, 165, 151, 144, 146, 160, 0, 0, 0, 0, 0, 243, 0, 0, 0, 0, 244, 0, 64, 65, 66, 246, 0, 0, 0, 0, 0, 0, - 247, 68, 0, 0, 0, 0, 0, 0, 527, 250, - 0, 0, 251, 528, 0, 72, 0, 0, 0, 73, + 247, 248, 0, 0, 0, 0, 0, 0, 249, 250, + 0, 0, 251, 71, 0, 72, 0, 0, 0, 73, 0, 74, 75, 76, 0, 0, 78, 0, 0, 0, 79, 0, 80, 0, 0, 0, 0, 0, 253, 0, 254, 0, 0, 0, 83, 252, 255, 256, 84, 257, 85, 258, 87, 27, 88, 259, 260, 0, 0, 77, - 86, 67, 18, 245, 0, 529, 0, 0, 0, 0, - 392, 142, 143, 0, 0, 394, 147, 396, 65, 66, - 397, 0, 150, 0, 0, 0, 152, 399, 400, 0, - 0, 0, 0, 0, 0, 401, 402, 156, 157, 251, - 71, 0, 72, 0, 0, 0, 73, 0, 74, 403, - 76, 0, 0, 405, 0, 0, 0, 79, 0, 80, - 0, -238, 0, 0, 0, 407, 0, 254, 0, 0, - 0, 409, 406, 408, 410, 411, 412, 85, 414, 415, - 416, 417, 418, 419, 0, 0, 404, 413, 398, 393, - 395, 160, 0, 0, 0, 0, 0, + 86, 67, 18, 245, 0, 0, 0, 0, 0, 0, + 243, 0, 0, 0, 0, 244, 0, 64, 65, 66, + 246, 0, 0, 0, 0, 0, 0, 247, 68, 0, + 0, 0, 0, 0, 0, 249, 250, 0, 0, 251, + 71, 0, 72, 0, 0, 0, 73, 0, 74, 75, + 76, 0, 0, 78, 0, 0, 0, 79, 0, 80, + 0, 0, 0, 0, 0, 253, 0, 254, 0, 0, + 0, 83, 252, 255, 256, 84, 257, 85, 258, 87, + 27, 88, 259, 260, 0, 0, 77, 86, 67, 18, + 245, 0, 0, 0, 0, 0, 0, 392, 142, 143, + 0, 0, 394, 147, 396, 65, 66, 397, 0, 150, + 0, 0, 0, 152, 399, 400, 0, 0, 0, 0, + 0, 0, 401, 402, 156, 157, 251, 71, 0, 72, + 0, 0, 0, 73, 0, 74, 403, 76, 0, 0, + 405, 0, 0, 0, 79, 0, 80, 0, -243, 0, + 0, 0, 407, 0, 254, 0, 0, 0, 409, 406, + 408, 410, 411, 412, 85, 414, 415, 416, 417, 418, + 419, 0, 0, 404, 413, 398, 393, 395, 160, 0, + 0, 0, 0, 0, - 463, 180, 197, 480, 476, 481, 504, 460, 478, 466, - 464, 284, 210, 184, 532, 526, 370, 540, 512, 281, - 10, 274, 12, 241, 537, 547, 216, 222, 499, 269, - 220, 502, 470, 498, 491, 333, 456, 485, 489, 487, - 518, 470, 203, 467, 51, 541, 38, 0, 205, 340, - 382, 380, 378, 351, 431, 421, 369, 367, 384, 216, - 281, 0, 274, 467, 269, 333, 433, 441, 92, 342, - 338, 93, 446, 448, 365, 423, 178, 172, 333, 175, - 333, 0, 541, 0, 333, 0, 92, 333, 351, 241, - 121, 241, 0, 220, 0, 92, 0, 435, 178, 120, - 436, 92, 92, 214, 138, 212, 92, 316, 92, 0, - 534, 0, 122, 140, 92, 92, 92, 92, 132, 317, - 318, 0, 336, 129, 363, 92, 134, 92, 334, 0, - 319, 361, 127, 92, 92, 483, 214, 92, 92, 101, - 0, 297, 92, 126, 551, 102, 301, 92, 92, 507, - 508, 92, 360, 482, 92, 92, 506, 509, 178, 92, - 92, 510, 511, 92, 92, 438, 99, 92, 116, 372, - 92, 375, 92, 130, 92, 92, 435, 123, 268, 436, - 125, 92, 0, 92, 199, 92, 124, 482, 315, 92, - 202, 483, 92, 92, 0, 92, 0, 92, 329, 109, - 104, 128, 301, 301, 0, 92, 92, 92, 329, 100, - 301, 301, 320, 301, 347, 0, 0, 92, 329, 0, - 348, 344, 301, 301, 321, 16, 33, 17, 92, 92, - 350, 0, 0, 301, 301, 0, 309, 92, 92, 326, - 331, 92, 301, 301, 322, 523, 301, 329, 329, 0, - 304, 324, 301, 301, 16, 33, 17, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 357, - 328, 0, 0, 0, 138, 0, 0, 0, 0, 0, - 0, 0, 0, 140, 209, 0, 0, 0, 0, 0, + 460, 284, 485, 466, 197, 463, 478, 552, 216, 481, + 504, 476, 12, 491, 480, 487, 464, 38, 537, 539, + 222, 184, 370, 518, 512, 220, 333, 546, 467, 470, + 210, 241, 51, 281, 274, 542, 269, 489, 433, 545, + 384, 382, 172, 470, 281, 456, 378, 205, 502, 203, + 499, 498, 180, 178, 175, 380, 431, 333, 467, 423, + 421, 446, 269, 216, 274, 351, 340, 448, 367, 0, + 0, 0, 441, 220, 546, 333, 92, 0, 0, 333, + 121, 333, 0, 0, 92, 92, 178, 333, 120, 92, + 127, 509, 435, 212, 92, 436, 92, 138, 122, 369, + 338, 342, 92, 10, 92, 92, 140, 318, 132, 319, + 365, 92, 351, 214, 435, 134, 92, 436, 92, 361, + 241, 126, 92, 334, 99, 363, 104, 241, 92, 0, + 100, 336, 556, 92, 92, 508, 483, 92, 297, 101, + 92, 178, 482, 301, 92, 372, 507, 92, 438, 92, + 102, 214, 0, 92, 268, 511, 375, 92, 92, 506, + 92, 92, 92, 315, 92, 92, 317, 92, 130, 482, + 116, 92, 360, 92, 199, 92, 125, 92, 123, 0, + 202, 128, 124, 92, 92, 483, 510, 92, 92, 92, + 0, 329, 316, 329, 109, 129, 301, 0, 301, 329, + 0, 92, 92, 92, 301, 93, 301, 329, 301, 92, + 320, 92, 301, 357, 301, 348, 301, 329, 347, 0, + 326, 350, 301, 92, 324, 0, 92, 0, 301, 331, + 322, 301, 92, 321, 16, 33, 17, 301, 138, 328, + 0, 304, 0, 0, 92, 0, 0, 140, 209, 301, + 0, 309, 526, 528, 529, 527, 530, 0, 0, 0, + 0, 0, 0, 0, 0, 92, 0, 0, 0, 0, + 301, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 344, 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, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 523, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 16, 33, 17, 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, 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, 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, 0, 0, 0, 0, 0}; + 0, 0, 0, 0}; const int JavaScriptGrammar::action_check [] = { - 2, 61, 60, 36, 33, 29, 33, 60, 8, 17, - 78, 29, 29, 1, 61, 8, 60, 60, 31, 2, - 1, 8, 7, 48, 2, 55, 8, 33, 7, 55, - 33, 7, 7, 7, 5, 36, 33, 36, 36, 60, - 5, 5, 8, 1, 7, 7, 7, 7, 16, 8, - 7, 60, 36, 33, 48, 7, 7, 48, 78, 55, - 55, 7, 66, 36, 20, 88, 36, 78, 60, 88, - 1, 76, 7, 7, 17, 65, 48, 0, 55, 29, - 29, 36, 36, 36, 8, 33, 7, -1, 8, 7, - -1, 36, 78, 60, 36, 36, 33, 36, 8, 8, - 33, 7, 8, 8, 8, 8, 8, 8, 8, -1, - 8, 10, 8, 8, 61, -1, 8, 61, 62, 8, - -1, 61, 62, 61, 62, 61, 62, 40, 40, 61, - 62, 61, 62, 29, 61, 62, 7, 12, 51, 51, - 7, 29, 61, 62, 15, 8, 40, 40, 8, 6, - 60, 60, 56, 56, 56, 60, 55, 51, 51, 60, - 60, 42, 60, 20, 50, 60, 33, 56, 54, 61, - 50, 15, 53, 2, 54, 15, 29, 8, 66, 67, - 29, 8, 57, 29, 8, -1, 29, 25, 63, 27, - 34, 25, 36, 27, 34, 8, 36, 60, -1, 7, - 38, 61, 62, 29, 38, 12, 15, 29, -1, 29, - -1, -1, -1, 66, 67, 29, -1, 66, 67, -1, - 66, 67, 7, 66, 67, 34, -1, 36, 29, -1, - 61, 62, 29, 29, 61, 62, 29, 61, 62, 12, - 66, 67, 29, -1, 66, 67, 66, 67, 61, 62, - 57, -1, -1, 61, 62, 25, 63, 27, 18, 19, - 74, 29, 25, -1, 27, 66, 67, -1, 38, 66, - 67, 85, -1, 66, 67, 38, 61, 62, 74, 66, - 67, 29, 18, 19, 57, 45, 46, -1, 36, 85, - 63, 23, 24, 61, 62, -1, -1, -1, 66, 67, - 32, -1, -1, 35, 29, 37, -1, -1, -1, 45, - 46, 23, 24, -1, 29, -1, 29, -1, 66, 67, - 32, 23, 24, 35, -1, 37, -1, -1, 18, 19, - 32, 23, 24, 35, -1, 37, 61, 62, -1, -1, - 32, 66, 67, 35, -1, 37, 61, 62, 61, 62, - -1, 66, 67, 66, 67, 45, 46, 23, 24, -1, - -1, -1, -1, -1, -1, 31, 32, 23, 24, 35, - -1, 37, -1, -1, -1, 31, 32, 23, 24, 35, - 10, 37, -1, -1, -1, 31, 32, -1, -1, 35, - -1, 37, 22, 10, -1, 23, 24, -1, -1, 29, - -1, 23, 24, 31, 32, 22, -1, 35, -1, 37, - 32, -1, 29, 35, -1, 37, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 55, -1, -1, -1, 59, - -1, -1, -1, -1, -1, -1, 66, 67, 55, -1, - -1, -1, 59, -1, 74, -1, -1, -1, 3, 66, - 67, -1, -1, 83, -1, 85, -1, 74, 13, -1, - -1, -1, 17, -1, -1, -1, 83, -1, 85, 23, - 24, 26, -1, 28, -1, -1, -1, 31, 32, 3, - -1, 35, -1, 37, 39, -1, 41, 42, -1, 13, - -1, -1, -1, 17, 49, -1, -1, 52, 53, -1, - -1, -1, 26, 58, 28, -1, -1, 31, -1, 64, - -1, -1, -1, -1, -1, 39, -1, 41, 42, -1, - -1, -1, -1, -1, 79, 49, -1, -1, 52, 53, - -1, -1, -1, -1, 58, -1, -1, 3, -1, -1, - 64, -1, -1, -1, -1, -1, -1, 13, -1, -1, - -1, 17, -1, -1, -1, 79, -1, -1, -1, -1, - 26, -1, 28, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 39, -1, 41, 42, -1, -1, -1, - -1, -1, -1, 49, -1, -1, 52, 53, -1, -1, - -1, -1, 58, -1, -1, -1, -1, -1, 64, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 12, 13, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, - -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, - -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, - 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, - 67, -1, 69, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, - -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, - -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, - -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, - 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, - 67, -1, 69, -1, 71, -1, 73, -1, 75, -1, - -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, - -1, -1, -1, -1, 7, -1, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, - 73, -1, 75, -1, -1, -1, -1, 80, 81, 82, - -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, + 2, 7, 7, 7, 36, 33, 7, 7, 7, 36, + 36, 7, 7, 55, 7, 7, 31, 2, 1, 17, + 8, 60, 60, 48, 61, 61, 8, 36, 7, 36, + 16, 55, 5, 36, 8, 66, 33, 60, 60, 33, + 29, 88, 29, 0, 65, 36, 36, 17, 29, 33, + 8, 29, 29, 33, 8, 1, 5, 5, 78, 78, + 7, 33, 33, 8, 7, 2, 78, 33, 20, 8, + 78, 36, 7, 48, 36, 7, 36, 36, 33, 2, + 48, 8, 7, 36, 60, 36, 55, 1, 8, 7, + -1, 55, 55, 60, 36, 33, 8, 8, 8, 8, + 61, 7, 8, 8, 60, 8, 40, 48, 6, 10, + 60, 8, 8, -1, 8, 8, -1, 51, 8, 50, + 50, 8, 20, 54, 54, 61, 62, 8, 61, 62, + 8, -1, 76, 61, 62, 61, 62, 61, 62, 29, + 60, 40, 42, 12, 56, 40, 61, 62, 88, 60, + 60, 60, 51, 53, 55, 60, 51, 60, 40, 56, + 56, 29, 7, 29, 7, 29, 60, 60, 8, 51, + 61, 62, 15, 1, 61, 56, 61, 62, 25, 25, + 27, 27, 12, 61, 62, 8, 15, 29, 57, 15, + 7, 38, 38, 25, 63, 27, -1, -1, 66, 67, + 66, 67, 66, 67, 29, 34, 38, 36, 34, 29, + 36, 29, -1, 25, 29, 27, 61, 62, -1, 8, + 29, 61, 62, 29, 66, 67, 38, 57, 29, 12, + 25, 29, 27, 63, 8, 25, -1, 27, 61, 62, + -1, 66, 67, 38, 61, 62, 66, 67, 38, 25, + -1, 27, 29, -1, 29, -1, 74, 66, 67, 74, + 66, 67, 38, 15, -1, 66, 67, 85, 66, 67, + 85, -1, 61, 62, 57, 18, 19, 18, 19, -1, + 63, -1, 34, -1, 36, 18, 19, 61, 62, 66, + 67, 66, 67, 29, 18, 19, -1, 23, 24, -1, + 36, -1, 45, 46, 45, 46, 32, -1, -1, 35, + 29, 37, 45, 46, 23, 24, -1, 29, -1, -1, + -1, 45, 46, 32, 23, 24, 35, 29, 37, 29, + 66, 67, -1, 32, -1, -1, 35, -1, 37, 25, + -1, 27, 61, 62, -1, -1, -1, 66, 67, 61, + 62, -1, 38, -1, 66, 67, -1, -1, -1, 61, + 62, 61, 62, -1, 66, 67, 66, 67, 23, 24, + -1, -1, -1, -1, -1, -1, 31, 32, 23, 24, + 35, -1, 37, -1, -1, -1, 31, 32, 23, 24, + 35, 10, 37, -1, -1, -1, 31, 32, -1, -1, + 35, -1, 37, 22, 10, 23, 24, -1, -1, -1, + 29, -1, -1, -1, 32, -1, 22, 35, -1, 37, + -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, + 59, -1, -1, -1, -1, -1, -1, 66, 67, 55, + -1, -1, -1, 59, -1, 74, -1, -1, -1, -1, + 66, 67, -1, -1, 83, -1, 85, -1, 74, -1, + 3, -1, -1, 23, 24, -1, -1, 83, -1, 85, + 13, 31, 32, -1, 17, 35, -1, 37, -1, -1, + -1, -1, -1, 26, -1, 28, -1, -1, 31, -1, + -1, -1, -1, -1, -1, -1, 39, -1, 41, 42, + -1, -1, -1, -1, -1, -1, 49, -1, -1, 52, + 53, -1, -1, -1, -1, 58, -1, -1, -1, -1, + -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 3, -1, -1, -1, -1, 79, -1, -1, -1, + -1, 13, -1, -1, -1, 17, -1, -1, -1, -1, + -1, -1, -1, -1, 26, -1, 28, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 39, -1, 41, + 42, -1, -1, -1, -1, -1, -1, 49, -1, -1, + 52, 53, -1, -1, -1, -1, 58, -1, -1, -1, + -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, 56, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, - 73, -1, 75, -1, -1, -1, -1, 80, 81, 82, - -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, 56, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, - 73, -1, 75, -1, -1, -1, -1, 80, 81, 82, + 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, + 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 65, 66, 67, -1, 69, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, @@ -629,51 +606,74 @@ const int JavaScriptGrammar::action_check [] = { 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, - 73, 74, 75, -1, -1, -1, -1, 80, 81, 82, - -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, - 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, - 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, - -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, - 66, 67, 68, 69, 70, -1, 72, 73, 74, 75, - 76, 77, -1, -1, 80, 81, 82, 83, 84, 85, - -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, - 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, - -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, - 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 59, -1, -1, -1, -1, -1, 65, 66, 67, 68, - 69, 70, -1, 72, 73, 74, 75, 76, 77, -1, - -1, 80, 81, 82, 83, 84, 85, -1, -1, -1, + 73, -1, 75, -1, -1, -1, -1, 80, 81, 82, + -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, + -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, + -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, + 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, + -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, + 69, -1, 71, -1, 73, -1, 75, -1, -1, -1, + -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, + -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, + -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, + 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, + -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, + -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, + 69, -1, 71, -1, 73, -1, 75, -1, -1, -1, + -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, + -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, + -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, + 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, + -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, + -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, + 69, -1, 71, -1, 73, -1, 75, -1, -1, -1, + -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, + -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, + -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, + 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, + -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, + 69, -1, 71, -1, 73, 74, 75, -1, -1, -1, + -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, + -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, + -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, + 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, + -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, + -1, -1, 61, -1, -1, -1, 65, 66, 67, -1, + 69, -1, 71, -1, 73, -1, 75, -1, -1, -1, + -1, 80, 81, 82, -1, 84, -1, 86, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, - -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, - -1, -1, -1, 65, 66, 67, 68, 69, 70, -1, + -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, + -1, -1, -1, -1, 66, 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, 84, 85, -1, -1, -1, -1, -1, 4, - -1, -1, -1, -1, 9, -1, 11, 12, 13, 14, - -1, -1, -1, -1, -1, -1, 21, 22, -1, -1, - -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, - -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, - -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, - -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, + -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, + -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, + -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, + 65, 66, 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, 84, - -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, - -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, - -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, - -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, - -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, - -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, - -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - -1, -1, 80, 81, 82, 83, 84, -1, -1, -1, + 85, -1, -1, -1, -1, -1, 4, 5, 6, -1, + -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, + -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, + -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, + -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, + -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, + 68, 69, 70, -1, 72, 73, 74, 75, 76, 77, + -1, -1, 80, 81, 82, 83, 84, 85, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, @@ -682,51 +682,67 @@ const int JavaScriptGrammar::action_check [] = { 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, - 81, 82, 83, 84, -1, 86, -1, -1, -1, -1, - 4, 5, 6, -1, -1, 9, 10, 11, 12, 13, - 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, - -1, -1, -1, -1, -1, 29, 30, 31, 32, 33, + 81, 82, 83, 84, -1, -1, -1, -1, -1, -1, + 4, -1, -1, -1, -1, 9, -1, 11, 12, 13, + 14, -1, -1, -1, -1, -1, -1, 21, 22, -1, + -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, - -1, 55, -1, -1, -1, 59, -1, 61, -1, -1, + -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, - 84, 85, -1, -1, -1, -1, -1, + 84, -1, -1, -1, -1, -1, -1, 4, 5, 6, + -1, -1, 9, 10, 11, 12, 13, 14, -1, 16, + -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, + -1, -1, 29, 30, 31, 32, 33, 34, -1, 36, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, 55, -1, + -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, -1, -1, 80, 81, 82, 83, 84, 85, -1, + -1, -1, -1, -1, - 77, 25, 25, 63, 94, 63, 16, 89, 19, 77, - 16, 16, 16, 59, 10, 14, 19, 19, 19, 14, - 5, 19, 6, 14, 6, 25, 19, 19, 25, 19, - 19, 25, 63, 21, 14, 16, 92, 16, 16, 14, - 16, 63, 25, 16, 16, 19, 15, -1, 25, 16, - 14, 16, 14, 19, 25, 25, 14, 16, 14, 19, - 14, -1, 19, 16, 19, 16, 14, 14, 36, 14, - 14, 39, 14, 16, 14, 27, 25, 16, 16, 25, - 16, -1, 19, -1, 16, -1, 36, 16, 19, 14, - 40, 14, -1, 19, -1, 36, -1, 30, 25, 40, - 33, 36, 36, 38, 19, 32, 36, 41, 36, -1, - 6, -1, 40, 28, 36, 36, 36, 36, 48, 41, - 41, -1, 60, 42, 60, 36, 46, 36, 60, -1, - 41, 60, 41, 36, 36, 38, 38, 36, 36, 38, - -1, 36, 36, 41, 81, 39, 41, 36, 36, 38, - 38, 36, 83, 38, 36, 36, 38, 38, 25, 36, - 36, 38, 38, 36, 36, 32, 38, 36, 41, 95, - 36, 96, 36, 42, 36, 36, 30, 41, 101, 33, - 41, 36, -1, 36, 50, 36, 41, 38, 41, 36, - 52, 38, 36, 36, -1, 36, -1, 36, 36, 42, - 44, 42, 41, 41, -1, 36, 36, 36, 36, 38, - 41, 41, 43, 41, 53, -1, -1, 36, 36, -1, - 58, 51, 41, 41, 43, 17, 18, 19, 36, 36, - 58, -1, -1, 41, 41, -1, 43, 36, 36, 47, - 58, 36, 41, 41, 43, 8, 41, 36, 36, -1, - 45, 49, 41, 41, 17, 18, 19, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, - 58, -1, -1, -1, 19, -1, -1, -1, -1, -1, - -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, + 90, 21, 21, 78, 30, 78, 24, 30, 24, 15, + 21, 95, 6, 68, 15, 68, 21, 20, 10, 6, + 24, 64, 24, 21, 24, 24, 21, 24, 21, 15, + 21, 68, 21, 68, 24, 6, 24, 21, 68, 24, + 68, 68, 21, 15, 68, 93, 68, 30, 30, 30, + 30, 26, 30, 30, 30, 21, 30, 21, 21, 32, + 30, 68, 24, 24, 24, 24, 21, 21, 21, -1, + -1, -1, 68, 24, 24, 21, 41, -1, -1, 21, + 45, 21, -1, -1, 41, 41, 30, 21, 45, 41, + 46, 43, 35, 37, 41, 38, 41, 24, 45, 68, + 68, 68, 41, 5, 41, 41, 33, 46, 53, 46, + 68, 41, 24, 43, 35, 51, 41, 38, 41, 65, + 68, 46, 41, 65, 43, 65, 49, 68, 41, -1, + 43, 65, 82, 41, 41, 43, 43, 41, 41, 43, + 41, 30, 43, 46, 41, 96, 43, 41, 37, 41, + 44, 43, -1, 41, 102, 43, 97, 41, 41, 43, + 41, 41, 41, 46, 41, 41, 46, 41, 47, 43, + 46, 41, 84, 41, 55, 41, 46, 41, 46, -1, + 57, 47, 46, 41, 41, 43, 43, 41, 41, 41, + -1, 41, 46, 41, 47, 47, 46, -1, 46, 41, + -1, 41, 41, 41, 46, 44, 46, 41, 46, 41, + 48, 41, 46, 63, 46, 63, 46, 41, 58, -1, + 52, 63, 46, 41, 54, -1, 41, -1, 46, 63, + 48, 46, 41, 48, 22, 23, 24, 46, 24, 63, + -1, 50, -1, -1, 41, -1, -1, 33, 34, 46, + -1, 48, 15, 16, 17, 18, 19, -1, -1, -1, + -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, + 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 56, -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, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 22, 23, 24, -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, -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, -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}; diff --git a/src/declarative/qml/parser/javascriptgrammar_p.h b/src/declarative/qml/parser/javascriptgrammar_p.h index 70c9766..2e78a77 100644 --- a/src/declarative/qml/parser/javascriptgrammar_p.h +++ b/src/declarative/qml/parser/javascriptgrammar_p.h @@ -150,15 +150,15 @@ public: T_XOR = 78, T_XOR_EQ = 79, - ACCEPT_STATE = 552, - RULE_COUNT = 317, - STATE_COUNT = 553, + ACCEPT_STATE = 557, + RULE_COUNT = 322, + STATE_COUNT = 558, TERMINAL_COUNT = 91, - NON_TERMINAL_COUNT = 103, + NON_TERMINAL_COUNT = 104, - GOTO_INDEX_OFFSET = 553, - GOTO_INFO_OFFSET = 1717, - GOTO_CHECK_OFFSET = 1717 + GOTO_INDEX_OFFSET = 558, + GOTO_INFO_OFFSET = 1714, + GOTO_CHECK_OFFSET = 1714 }; static const char *const spell []; diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp index 49a4181..4369771 100644 --- a/src/declarative/qml/parser/javascriptparser.cpp +++ b/src/declarative/qml/parser/javascriptparser.cpp @@ -268,22 +268,22 @@ case 21: { node->semicolonToken = loc(2); sym(1).Node = node; } break; - case 22: -case 23: { + +case 28: { AST::UiScriptBinding *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId->finish(), sym(3).Statement); node->colonToken = loc(2); sym(1).Node = node; } break; -case 24: +case 29: -case 25: { +case 30: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); break; } -case 27: { +case 32: { AST::UiPublicMember *node = makeAstNode (driver->nodePool(), (NameId *)0, sym(2).sval); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); @@ -292,7 +292,7 @@ case 27: { sym(1).Node = node; } break; -case 29: { +case 34: { AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(3).sval); node->propertyToken = loc(1); node->typeToken = loc(2); @@ -301,7 +301,7 @@ case 29: { sym(1).Node = node; } break; -case 31: { +case 36: { AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(4).sval); node->isDefaultMember = true; node->defaultToken = loc(1); @@ -312,7 +312,7 @@ case 31: { sym(1).Node = node; } break; -case 33: { +case 38: { AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(3).sval, sym(5).Expression); node->propertyToken = loc(1); @@ -323,7 +323,7 @@ case 33: { sym(1).Node = node; } break; -case 35: { +case 40: { AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(4).sval, sym(6).Expression); node->isDefaultMember = true; @@ -336,88 +336,88 @@ case 35: { sym(1).Node = node; } break; -case 36: { +case 41: { sym(1).Node = makeAstNode(driver->nodePool(), sym(1).Node); } break; -case 37: { +case 42: { sym(1).Node = makeAstNode(driver->nodePool(), sym(1).Node); } break; -case 38: -case 39: +case 43: +case 44: { AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 41: { +case 46: { QString s = QLatin1String(JavaScriptGrammar::spell[T_PROPERTY]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 42: { +case 47: { QString s = QLatin1String(JavaScriptGrammar::spell[T_SIGNAL]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 43: { +case 48: { AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 44: { +case 49: { AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 45: { +case 50: { AST::ThisExpression *node = makeAstNode (driver->nodePool()); node->thisToken = loc(1); sym(1).Node = node; } break; -case 46: { +case 51: { AST::IdentifierExpression *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 47: { +case 52: { AST::NullExpression *node = makeAstNode (driver->nodePool()); node->nullToken = loc(1); sym(1).Node = node; } break; -case 48: { +case 53: { AST::TrueLiteral *node = makeAstNode (driver->nodePool()); node->trueToken = loc(1); sym(1).Node = node; } break; -case 49: { +case 54: { AST::FalseLiteral *node = makeAstNode (driver->nodePool()); node->falseToken = loc(1); sym(1).Node = node; } break; -case 50: { +case 55: { AST::NumericLiteral *node = makeAstNode (driver->nodePool(), sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 51: { +case 56: { AST::StringLiteral *node = makeAstNode (driver->nodePool(), sym(1).sval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 52: { +case 57: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -428,7 +428,7 @@ case 52: { sym(1).Node = node; } break; -case 53: { +case 58: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -439,21 +439,21 @@ case 53: { sym(1).Node = node; } break; -case 54: { +case 59: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).Elision); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 55: { +case 60: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 56: { +case 61: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision); node->lbracketToken = loc(1); node->commaToken = loc(3); @@ -461,7 +461,7 @@ case 56: { sym(1).Node = node; } break; -case 57: { +case 62: { AST::ObjectLiteral *node = 0; if (sym(2).Node) node = makeAstNode (driver->nodePool(), @@ -473,7 +473,7 @@ case 57: { sym(1).Node = node; } break; -case 58: { +case 63: { AST::ObjectLiteral *node = makeAstNode (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); @@ -481,51 +481,51 @@ case 58: { sym(1).Node = node; } break; -case 59: { +case 64: { AST::NestedExpression *node = makeAstNode(driver->nodePool(), sym(2).Expression); node->lparenToken = loc(1); node->rparenToken = loc(3); sym(1).Node = node; } break; -case 60: { +case 65: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Elision, sym(2).Expression); } break; -case 61: { +case 66: { AST::ElementList *node = makeAstNode (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 62: { +case 67: { AST::Elision *node = makeAstNode (driver->nodePool()); node->commaToken = loc(1); sym(1).Node = node; } break; -case 63: { +case 68: { AST::Elision *node = makeAstNode (driver->nodePool(), sym(1).Elision); node->commaToken = loc(2); sym(1).Node = node; } break; -case 64: { +case 69: { sym(1).Node = 0; } break; -case 65: { +case 70: { sym(1).Elision = sym(1).Elision->finish (); } break; -case 66: { +case 71: { AST::PropertyNameAndValueList *node = makeAstNode (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; -case 67: { +case 72: { AST::PropertyNameAndValueList *node = makeAstNode (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); @@ -533,46 +533,36 @@ case 67: { sym(1).Node = node; } break; -case 68: { +case 73: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 69: -case 70: { +case 74: +case 75: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 71: { +case 76: { AST::StringLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 72: { +case 77: { AST::NumericLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 73: { +case 78: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 74: - -case 75: - -case 76: - -case 77: - -case 78: - case 79: case 80: @@ -624,25 +614,35 @@ case 102: case 103: case 104: + +case 105: + +case 106: + +case 107: + +case 108: + +case 109: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); } break; -case 109: { +case 114: { AST::ArrayMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 110: { +case 115: { AST::FieldMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 111: { +case 116: { AST::NewMemberExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); @@ -650,384 +650,384 @@ case 111: { sym(1).Node = node; } break; -case 113: { +case 118: { AST::NewExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; -case 114: { +case 119: { AST::CallExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 115: { +case 120: { AST::CallExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 116: { +case 121: { AST::ArrayMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 117: { +case 122: { AST::FieldMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 118: { +case 123: { sym(1).Node = 0; } break; -case 119: { +case 124: { sym(1).Node = sym(1).ArgumentList->finish(); } break; -case 120: { +case 125: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Expression); } break; -case 121: { +case 126: { AST::ArgumentList *node = makeAstNode (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 125: { +case 130: { AST::PostIncrementExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; -case 126: { +case 131: { AST::PostDecrementExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; -case 128: { +case 133: { AST::DeleteExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; -case 129: { +case 134: { AST::VoidExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; -case 130: { +case 135: { AST::TypeOfExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; -case 131: { +case 136: { AST::PreIncrementExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; -case 132: { +case 137: { AST::PreDecrementExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; -case 133: { +case 138: { AST::UnaryPlusExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; -case 134: { +case 139: { AST::UnaryMinusExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; -case 135: { +case 140: { AST::TildeExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; -case 136: { +case 141: { AST::NotExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; -case 138: { +case 143: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 139: { +case 144: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 140: { +case 145: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 142: { +case 147: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 143: { +case 148: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 145: { +case 150: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 146: { +case 151: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 147: { +case 152: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 149: { +case 154: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 150: { +case 155: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 151: { +case 156: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 152: { +case 157: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 153: { +case 158: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 154: { +case 159: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 156: { +case 161: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 157: { +case 162: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 158: { +case 163: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 159: { +case 164: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 160: { +case 165: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 162: { +case 167: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 163: { +case 168: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 164: { +case 169: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 165: { +case 170: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 167: { +case 172: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 168: { +case 173: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 169: { +case 174: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 170: { +case 175: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 172: { +case 177: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 174: { +case 179: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 176: { +case 181: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 178: { +case 183: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 180: { +case 185: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 182: { +case 187: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 184: { +case 189: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 186: { +case 191: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 188: { +case 193: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 190: { +case 195: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 192: { +case 197: { AST::ConditionalExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1035,7 +1035,7 @@ case 192: { sym(1).Node = node; } break; -case 194: { +case 199: { AST::ConditionalExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1043,112 +1043,112 @@ case 194: { sym(1).Node = node; } break; -case 196: { +case 201: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 198: { +case 203: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 199: { +case 204: { sym(1).ival = QSOperator::Assign; } break; -case 200: { +case 205: { sym(1).ival = QSOperator::InplaceMul; } break; -case 201: { +case 206: { sym(1).ival = QSOperator::InplaceDiv; } break; -case 202: { +case 207: { sym(1).ival = QSOperator::InplaceMod; } break; -case 203: { +case 208: { sym(1).ival = QSOperator::InplaceAdd; } break; -case 204: { +case 209: { sym(1).ival = QSOperator::InplaceSub; } break; -case 205: { +case 210: { sym(1).ival = QSOperator::InplaceLeftShift; } break; -case 206: { +case 211: { sym(1).ival = QSOperator::InplaceRightShift; } break; -case 207: { +case 212: { sym(1).ival = QSOperator::InplaceURightShift; } break; -case 208: { +case 213: { sym(1).ival = QSOperator::InplaceAnd; } break; -case 209: { +case 214: { sym(1).ival = QSOperator::InplaceXor; } break; -case 210: { +case 215: { sym(1).ival = QSOperator::InplaceOr; } break; -case 212: { +case 217: { AST::Expression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 213: { +case 218: { sym(1).Node = 0; } break; -case 216: { +case 221: { AST::Expression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 217: { +case 222: { sym(1).Node = 0; } break; -case 234: { +case 239: { AST::Block *node = makeAstNode (driver->nodePool(), sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 235: { +case 240: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Statement); } break; -case 236: { +case 241: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).StatementList, sym(2).Statement); } break; -case 237: { +case 242: { sym(1).Node = 0; } break; -case 238: { +case 243: { sym(1).Node = sym(1).StatementList->finish (); } break; -case 240: { +case 245: { AST::VariableStatement *node = makeAstNode (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); @@ -1156,76 +1156,76 @@ case 240: { sym(1).Node = node; } break; -case 241: { +case 246: { sym(1).ival = T_CONST; } break; -case 242: { +case 247: { sym(1).ival = T_VAR; } break; -case 243: { +case 248: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 244: { +case 249: { AST::VariableDeclarationList *node = makeAstNode (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; -case 245: { +case 250: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 246: { +case 251: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; -case 247: { +case 252: { AST::VariableDeclaration *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 248: { +case 253: { AST::VariableDeclaration *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 249: { +case 254: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 250: { +case 255: { sym(1).Node = 0; } break; -case 252: { +case 257: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 253: { +case 258: { sym(1).Node = 0; } break; -case 255: { +case 260: { AST::EmptyStatement *node = makeAstNode (driver->nodePool()); node->semicolonToken = loc(1); sym(1).Node = node; } break; -case 257: { +case 262: { AST::ExpressionStatement *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 258: { +case 263: { AST::IfStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1234,7 +1234,7 @@ case 258: { sym(1).Node = node; } break; -case 259: { +case 264: { AST::IfStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1242,7 +1242,7 @@ case 259: { sym(1).Node = node; } break; -case 261: { +case 266: { AST::DoWhileStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); @@ -1252,7 +1252,7 @@ case 261: { sym(1).Node = node; } break; -case 262: { +case 267: { AST::WhileStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); @@ -1260,7 +1260,7 @@ case 262: { sym(1).Node = node; } break; -case 263: { +case 268: { AST::ForStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); @@ -1271,7 +1271,7 @@ case 263: { sym(1).Node = node; } break; -case 264: { +case 269: { AST::LocalForStatement *node = makeAstNode (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); @@ -1284,7 +1284,7 @@ case 264: { sym(1).Node = node; } break; -case 265: { +case 270: { AST:: ForEachStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); @@ -1294,7 +1294,7 @@ case 265: { sym(1).Node = node; } break; -case 266: { +case 271: { AST::LocalForEachStatement *node = makeAstNode (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); @@ -1305,14 +1305,14 @@ case 266: { sym(1).Node = node; } break; -case 268: { +case 273: { AST::ContinueStatement *node = makeAstNode (driver->nodePool()); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 270: { +case 275: { AST::ContinueStatement *node = makeAstNode (driver->nodePool(), sym(2).sval); node->continueToken = loc(1); node->identifierToken = loc(2); @@ -1320,14 +1320,14 @@ case 270: { sym(1).Node = node; } break; -case 272: { +case 277: { AST::BreakStatement *node = makeAstNode (driver->nodePool()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 274: { +case 279: { AST::BreakStatement *node = makeAstNode (driver->nodePool(), sym(2).sval); node->breakToken = loc(1); node->identifierToken = loc(2); @@ -1335,14 +1335,14 @@ case 274: { sym(1).Node = node; } break; -case 276: { +case 281: { AST::ReturnStatement *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 277: { +case 282: { AST::WithStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); @@ -1350,7 +1350,7 @@ case 277: { sym(1).Node = node; } break; -case 278: { +case 283: { AST::SwitchStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); @@ -1358,90 +1358,90 @@ case 278: { sym(1).Node = node; } break; -case 279: { +case 284: { AST::CaseBlock *node = makeAstNode (driver->nodePool(), sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 280: { +case 285: { AST::CaseBlock *node = makeAstNode (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(5); sym(1).Node = node; } break; -case 281: { +case 286: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).CaseClause); } break; -case 282: { +case 287: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); } break; -case 283: { +case 288: { sym(1).Node = 0; } break; -case 284: { +case 289: { sym(1).Node = sym(1).CaseClauses->finish (); } break; -case 285: { +case 290: { AST::CaseClause *node = makeAstNode (driver->nodePool(), sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; -case 286: { +case 291: { AST::DefaultClause *node = makeAstNode (driver->nodePool(), sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 287: -case 288: { +case 292: +case 293: { AST::LabelledStatement *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 289: { +case 294: { AST::LabelledStatement *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 291: { +case 296: { AST::ThrowStatement *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 292: { +case 297: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; -case 293: { +case 298: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 294: { +case 299: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 295: { +case 300: { AST::Catch *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); @@ -1450,20 +1450,20 @@ case 295: { sym(1).Node = node; } break; -case 296: { +case 301: { AST::Finally *node = makeAstNode (driver->nodePool(), sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; -case 298: { +case 303: { AST::DebuggerStatement *node = makeAstNode (driver->nodePool()); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 299: { +case 304: { AST::FunctionDeclaration *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); @@ -1474,7 +1474,7 @@ case 299: { sym(1).Node = node; } break; -case 300: { +case 305: { AST::FunctionExpression *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (sym(2).sval) @@ -1486,56 +1486,56 @@ case 300: { sym(1).Node = node; } break; -case 301: { +case 306: { AST::FormalParameterList *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 302: { +case 307: { AST::FormalParameterList *node = makeAstNode (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 303: { +case 308: { sym(1).Node = 0; } break; -case 304: { +case 309: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; -case 305: { +case 310: { sym(1).Node = 0; } break; -case 307: { +case 312: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElements->finish ()); } break; -case 308: { +case 313: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElement); } break; -case 309: { +case 314: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); } break; -case 310: { +case 315: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Statement); } break; -case 311: { +case 316: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).FunctionDeclaration); } break; -case 312: { +case 317: { sym(1).sval = 0; } break; -case 314: { +case 319: { sym(1).Node = 0; } break; diff --git a/src/declarative/qml/parser/javascriptparser_p.h b/src/declarative/qml/parser/javascriptparser_p.h index a9f8593..aa29ff3 100644 --- a/src/declarative/qml/parser/javascriptparser_p.h +++ b/src/declarative/qml/parser/javascriptparser_p.h @@ -194,9 +194,9 @@ protected: -#define J_SCRIPT_REGEXPLITERAL_RULE1 52 +#define J_SCRIPT_REGEXPLITERAL_RULE1 57 -#define J_SCRIPT_REGEXPLITERAL_RULE2 53 +#define J_SCRIPT_REGEXPLITERAL_RULE2 58 QT_END_NAMESPACE -- cgit v0.12 From d6e87c332c721bbcb86bebc6f4daa8a3125e80c6 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 14 May 2009 15:07:25 +0200 Subject: Fixes build issue with WinCE and MSVC 2008 and MIPS-II Reviewed-by: Maurice --- mkspecs/wince50standard-mipsii-msvc2008/default_post.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/wince50standard-mipsii-msvc2008/default_post.prf b/mkspecs/wince50standard-mipsii-msvc2008/default_post.prf index a232ba3..d423784 100644 --- a/mkspecs/wince50standard-mipsii-msvc2008/default_post.prf +++ b/mkspecs/wince50standard-mipsii-msvc2008/default_post.prf @@ -1 +1 @@ -include(../wince50standard-mipsii-msvc2005/qmake.conf) +include(../wince50standard-mipsii-msvc2005/default_post.prf) -- cgit v0.12 From 17d8f734c038705f7f8196dfe5e8902c808a4945 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 14 May 2009 15:08:03 +0200 Subject: Make QAbstractTransition::eventTest() non-const We decided to remove the const of the eventTest() since some transitions have dynamic conditions and need to update when eventTest() is called. --- examples/animation/moveblocks/main.cpp | 2 +- examples/animation/stickman/lifecycle.cpp | 4 ++-- examples/animation/sub-attaq/boat_p.h | 6 +++--- examples/animation/sub-attaq/states.cpp | 6 +++--- examples/animation/sub-attaq/states.h | 6 +++--- examples/statemachine/factorial/main.cpp | 4 ++-- examples/statemachine/pingpong/main.cpp | 4 ++-- examples/statemachine/tankgame/gameovertransition.cpp | 2 +- examples/statemachine/tankgame/gameovertransition.h | 4 ++-- examples/statemachine/tankgameplugins/seek_ai/seek_ai.h | 6 +++--- src/corelib/statemachine/qabstracttransition.cpp | 4 ++-- src/corelib/statemachine/qabstracttransition.h | 2 +- src/corelib/statemachine/qabstracttransition_p.h | 2 +- src/corelib/statemachine/qeventtransition.cpp | 2 +- src/corelib/statemachine/qeventtransition.h | 2 +- src/corelib/statemachine/qsignaltransition.cpp | 2 +- src/corelib/statemachine/qsignaltransition.h | 2 +- src/corelib/statemachine/qstate.cpp | 2 +- src/corelib/statemachine/qstatemachine.cpp | 2 +- src/gui/statemachine/qbasickeyeventtransition.cpp | 2 +- src/gui/statemachine/qbasickeyeventtransition_p.h | 2 +- src/gui/statemachine/qbasicmouseeventtransition.cpp | 2 +- src/gui/statemachine/qbasicmouseeventtransition_p.h | 2 +- src/gui/statemachine/qkeyeventtransition.cpp | 2 +- src/gui/statemachine/qkeyeventtransition.h | 2 +- src/gui/statemachine/qmouseeventtransition.cpp | 2 +- src/gui/statemachine/qmouseeventtransition.h | 2 +- tests/auto/qstate/tst_qstate.cpp | 2 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 8 ++++---- 29 files changed, 45 insertions(+), 45 deletions(-) diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp index 06ed3dd..0ce07fc 100644 --- a/examples/animation/moveblocks/main.cpp +++ b/examples/animation/moveblocks/main.cpp @@ -95,7 +95,7 @@ public: } protected: - virtual bool eventTest(QEvent *event) const + virtual bool eventTest(QEvent *event) { return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType)) && (static_cast(event)->rand() == m_rand); diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index b22af55..423d7ad 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -69,7 +69,7 @@ public: { } - virtual bool eventTest(QEvent *e) const + virtual bool eventTest(QEvent *e) { if (QSignalTransition::eventTest(e)) { QVariant key = static_cast(e)->arguments().at(0); @@ -92,7 +92,7 @@ public: startTimer(1000); } - virtual bool eventTest(QEvent *e) const + virtual bool eventTest(QEvent *e) { return QEventTransition::eventTest(e) && ((qrand() % 50) == 0); } diff --git a/examples/animation/sub-attaq/boat_p.h b/examples/animation/sub-attaq/boat_p.h index 17fbe5c..6f03e48 100644 --- a/examples/animation/sub-attaq/boat_p.h +++ b/examples/animation/sub-attaq/boat_p.h @@ -67,7 +67,7 @@ public: this->key = key; } protected: - virtual bool eventTest(QEvent *event) const + virtual bool eventTest(QEvent *event) { Q_UNUSED(event); if (!QKeyEventTransition::eventTest(event)) @@ -93,7 +93,7 @@ public: this->key = key; } protected: - virtual bool eventTest(QEvent *event) const + virtual bool eventTest(QEvent *event) { Q_UNUSED(event); if (!QKeyEventTransition::eventTest(event)) @@ -131,7 +131,7 @@ public: this->key = key; } protected: - virtual bool eventTest(QEvent *event) const + virtual bool eventTest(QEvent *event) { Q_UNUSED(event); if (!QKeyEventTransition::eventTest(event)) diff --git a/examples/animation/sub-attaq/states.cpp b/examples/animation/sub-attaq/states.cpp index c6af924..7650b0f 100644 --- a/examples/animation/sub-attaq/states.cpp +++ b/examples/animation/sub-attaq/states.cpp @@ -281,7 +281,7 @@ UpdateScoreTransition::UpdateScoreTransition(GraphicsScene *scene, PlayState *ga { } -bool UpdateScoreTransition::eventTest(QEvent *event) const +bool UpdateScoreTransition::eventTest(QEvent *event) { if (!QSignalTransition::eventTest(event)) return false; @@ -300,7 +300,7 @@ WinTransition::WinTransition(GraphicsScene *scene, PlayState *game, QAbstractSta { } -bool WinTransition::eventTest(QEvent *event) const +bool WinTransition::eventTest(QEvent *event) { if (!QSignalTransition::eventTest(event)) return false; @@ -319,7 +319,7 @@ CustomSpaceTransition::CustomSpaceTransition(QWidget *widget, PlayState *game, Q { } -bool CustomSpaceTransition::eventTest(QEvent *event) const +bool CustomSpaceTransition::eventTest(QEvent *event) { Q_UNUSED(event); if (!QKeyEventTransition::eventTest(event)) diff --git a/examples/animation/sub-attaq/states.h b/examples/animation/sub-attaq/states.h index 27beb71..a1cb5ff 100644 --- a/examples/animation/sub-attaq/states.h +++ b/examples/animation/sub-attaq/states.h @@ -152,7 +152,7 @@ class UpdateScoreTransition : public QSignalTransition public: UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target); protected: - virtual bool eventTest(QEvent *event) const; + virtual bool eventTest(QEvent *event); private: PlayState * game; GraphicsScene *scene; @@ -164,7 +164,7 @@ class WinTransition : public QSignalTransition public: WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target); protected: - virtual bool eventTest(QEvent *event) const; + virtual bool eventTest(QEvent *event); private: PlayState * game; GraphicsScene *scene; @@ -176,7 +176,7 @@ private: public: CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key); protected: - virtual bool eventTest(QEvent *event) const; + virtual bool eventTest(QEvent *event); private: PlayState *game; int key; diff --git a/examples/statemachine/factorial/main.cpp b/examples/statemachine/factorial/main.cpp index ae5928f..1065eb8 100644 --- a/examples/statemachine/factorial/main.cpp +++ b/examples/statemachine/factorial/main.cpp @@ -100,7 +100,7 @@ public: : QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact) {} - virtual bool eventTest(QEvent *e) const + virtual bool eventTest(QEvent *e) { if (!QSignalTransition::eventTest(e)) return false; @@ -130,7 +130,7 @@ public: : QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact) {} - virtual bool eventTest(QEvent *e) const + virtual bool eventTest(QEvent *e) { if (!QSignalTransition::eventTest(e)) return false; diff --git a/examples/statemachine/pingpong/main.cpp b/examples/statemachine/pingpong/main.cpp index db66bfd..331627e 100644 --- a/examples/statemachine/pingpong/main.cpp +++ b/examples/statemachine/pingpong/main.cpp @@ -86,7 +86,7 @@ public: PongTransition() {} protected: - virtual bool eventTest(QEvent *e) const { + virtual bool eventTest(QEvent *e) { return (e->type() == QEvent::User+3); } virtual void onTransition(QEvent *) @@ -104,7 +104,7 @@ public: PingTransition() {} protected: - virtual bool eventTest(QEvent *e) const { + virtual bool eventTest(QEvent *e) { return (e->type() == QEvent::User+2); } virtual void onTransition(QEvent *) diff --git a/examples/statemachine/tankgame/gameovertransition.cpp b/examples/statemachine/tankgame/gameovertransition.cpp index 21c3510..cec786e 100644 --- a/examples/statemachine/tankgame/gameovertransition.cpp +++ b/examples/statemachine/tankgame/gameovertransition.cpp @@ -22,7 +22,7 @@ void GameOverTransition::addTankItem(TankItem *tankItem) connect(tankItem, SIGNAL(aboutToBeDestroyed()), mapper, SLOT(map())); } -bool GameOverTransition::eventTest(QEvent *e) const +bool GameOverTransition::eventTest(QEvent *e) { bool ret = QSignalTransition::eventTest(e); diff --git a/examples/statemachine/tankgame/gameovertransition.h b/examples/statemachine/tankgame/gameovertransition.h index 53c9b86..9a86b83 100644 --- a/examples/statemachine/tankgame/gameovertransition.h +++ b/examples/statemachine/tankgame/gameovertransition.h @@ -13,10 +13,10 @@ public: void addTankItem(TankItem *tankItem); protected: - bool eventTest(QEvent *event) const; + bool eventTest(QEvent *event); private: - mutable QList m_tankItems; + QList m_tankItems; }; #endif diff --git a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h index 597f8595..9d4aabc 100644 --- a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h +++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h @@ -81,7 +81,7 @@ public: } protected: - bool eventTest(QEvent *event) const + bool eventTest(QEvent *event) { bool b = QSignalTransition::eventTest(event); if (b) { @@ -105,7 +105,7 @@ protected: } private: - mutable QLineF m_lastLine; + QLineF m_lastLine; QObject *m_tank; QState *m_turnTo; }; @@ -180,7 +180,7 @@ public: } protected: - bool eventTest(QEvent *event) const + bool eventTest(QEvent *event) { bool b = QSignalTransition::eventTest(event); if (b) { diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp index f7a7d34..a930581 100644 --- a/src/corelib/statemachine/qabstracttransition.cpp +++ b/src/corelib/statemachine/qabstracttransition.cpp @@ -125,9 +125,9 @@ QStateMachine *QAbstractTransitionPrivate::machine() const return 0; } -bool QAbstractTransitionPrivate::callEventTest(QEvent *e) const +bool QAbstractTransitionPrivate::callEventTest(QEvent *e) { - Q_Q(const QAbstractTransition); + Q_Q(QAbstractTransition); return q->eventTest(e); } diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h index 8f0cefa..c63d55a 100644 --- a/src/corelib/statemachine/qabstracttransition.h +++ b/src/corelib/statemachine/qabstracttransition.h @@ -88,7 +88,7 @@ public: #endif protected: - virtual bool eventTest(QEvent *event) const = 0; + virtual bool eventTest(QEvent *event) = 0; virtual void onTransition(QEvent *event) = 0; diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h index 156e70e..a6db220 100644 --- a/src/corelib/statemachine/qabstracttransition_p.h +++ b/src/corelib/statemachine/qabstracttransition_p.h @@ -75,7 +75,7 @@ public: static QAbstractTransitionPrivate *get(QAbstractTransition *q); static const QAbstractTransitionPrivate *get(const QAbstractTransition *q); - bool callEventTest(QEvent *e) const; + bool callEventTest(QEvent *e); void callOnTransition(QEvent *e); QState *sourceState() const; QStateMachine *machine() const; diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp index 3ae3ed9..74eb577 100644 --- a/src/corelib/statemachine/qeventtransition.cpp +++ b/src/corelib/statemachine/qeventtransition.cpp @@ -252,7 +252,7 @@ void QEventTransition::setEventObject(QObject *object) /*! \reimp */ -bool QEventTransition::eventTest(QEvent *event) const +bool QEventTransition::eventTest(QEvent *event) { Q_D(const QEventTransition); if (event->type() == QEvent::Wrapped) { diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h index 68ee4fc..3530bdd 100644 --- a/src/corelib/statemachine/qeventtransition.h +++ b/src/corelib/statemachine/qeventtransition.h @@ -71,7 +71,7 @@ public: void setEventType(QEvent::Type type); protected: - bool eventTest(QEvent *event) const; + bool eventTest(QEvent *event); void onTransition(QEvent *event); bool event(QEvent *e); diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp index fd17292..4caa917 100644 --- a/src/corelib/statemachine/qsignaltransition.cpp +++ b/src/corelib/statemachine/qsignaltransition.cpp @@ -225,7 +225,7 @@ void QSignalTransition::setSignal(const QByteArray &signal) true if the event's sender and signal index match this transition, and returns false otherwise. */ -bool QSignalTransition::eventTest(QEvent *event) const +bool QSignalTransition::eventTest(QEvent *event) { Q_D(const QSignalTransition); if (event->type() == QEvent::Signal) { diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h index 7f457b8..b485785 100644 --- a/src/corelib/statemachine/qsignaltransition.h +++ b/src/corelib/statemachine/qsignaltransition.h @@ -72,7 +72,7 @@ public: void setSignal(const QByteArray &signal); protected: - bool eventTest(QEvent *event) const; + bool eventTest(QEvent *event); void onTransition(QEvent *event); bool event(QEvent *e); diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 8893bfe..e42e463 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -363,7 +363,7 @@ public: : QAbstractTransition(QList() << target) {} protected: void onTransition(QEvent *) {} - bool eventTest(QEvent *) const { return true; } + bool eventTest(QEvent *) { return true; } }; } // namespace diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 046fbb4..65f49ae 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1124,7 +1124,7 @@ public: InitialTransition(QAbstractState *target) : QAbstractTransition(QList() << target) {} protected: - virtual bool eventTest(QEvent *) const { return true; } + virtual bool eventTest(QEvent *) { return true; } virtual void onTransition(QEvent *) {} }; diff --git a/src/gui/statemachine/qbasickeyeventtransition.cpp b/src/gui/statemachine/qbasickeyeventtransition.cpp index 7821feb..7336612 100644 --- a/src/gui/statemachine/qbasickeyeventtransition.cpp +++ b/src/gui/statemachine/qbasickeyeventtransition.cpp @@ -156,7 +156,7 @@ void QBasicKeyEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersM /*! \reimp */ -bool QBasicKeyEventTransition::eventTest(QEvent *event) const +bool QBasicKeyEventTransition::eventTest(QEvent *event) { Q_D(const QBasicKeyEventTransition); if (event->type() == d->eventType) { diff --git a/src/gui/statemachine/qbasickeyeventtransition_p.h b/src/gui/statemachine/qbasickeyeventtransition_p.h index 0d08da0..7506747 100644 --- a/src/gui/statemachine/qbasickeyeventtransition_p.h +++ b/src/gui/statemachine/qbasickeyeventtransition_p.h @@ -55,7 +55,7 @@ public: void setModifiersMask(Qt::KeyboardModifiers modifiers); protected: - bool eventTest(QEvent *event) const; + bool eventTest(QEvent *event); void onTransition(QEvent *); private: diff --git a/src/gui/statemachine/qbasicmouseeventtransition.cpp b/src/gui/statemachine/qbasicmouseeventtransition.cpp index 0cb727e..c4c2302 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition.cpp +++ b/src/gui/statemachine/qbasicmouseeventtransition.cpp @@ -159,7 +159,7 @@ void QBasicMouseEventTransition::setPath(const QPainterPath &path) /*! \reimp */ -bool QBasicMouseEventTransition::eventTest(QEvent *event) const +bool QBasicMouseEventTransition::eventTest(QEvent *event) { Q_D(const QBasicMouseEventTransition); if (event->type() == d->eventType) { diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/gui/statemachine/qbasicmouseeventtransition_p.h index 20c7f8f..57f83c6 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition_p.h +++ b/src/gui/statemachine/qbasicmouseeventtransition_p.h @@ -58,7 +58,7 @@ public: void setPath(const QPainterPath &path); protected: - bool eventTest(QEvent *event) const; + bool eventTest(QEvent *event); void onTransition(QEvent *); private: diff --git a/src/gui/statemachine/qkeyeventtransition.cpp b/src/gui/statemachine/qkeyeventtransition.cpp index e6ab11b..3cf51a3 100644 --- a/src/gui/statemachine/qkeyeventtransition.cpp +++ b/src/gui/statemachine/qkeyeventtransition.cpp @@ -140,7 +140,7 @@ void QKeyEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) /*! \reimp */ -bool QKeyEventTransition::eventTest(QEvent *event) const +bool QKeyEventTransition::eventTest(QEvent *event) { Q_D(const QKeyEventTransition); if (!QEventTransition::eventTest(event)) diff --git a/src/gui/statemachine/qkeyeventtransition.h b/src/gui/statemachine/qkeyeventtransition.h index 3f797f1..08595e8 100644 --- a/src/gui/statemachine/qkeyeventtransition.h +++ b/src/gui/statemachine/qkeyeventtransition.h @@ -46,7 +46,7 @@ public: protected: void onTransition(QEvent *event); - bool eventTest(QEvent *event) const; + bool eventTest(QEvent *event); private: Q_DISABLE_COPY(QKeyEventTransition) diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/gui/statemachine/qmouseeventtransition.cpp index 3191a2f..5ffdab0 100644 --- a/src/gui/statemachine/qmouseeventtransition.cpp +++ b/src/gui/statemachine/qmouseeventtransition.cpp @@ -170,7 +170,7 @@ void QMouseEventTransition::setPath(const QPainterPath &path) /*! \reimp */ -bool QMouseEventTransition::eventTest(QEvent *event) const +bool QMouseEventTransition::eventTest(QEvent *event) { Q_D(const QMouseEventTransition); if (!QEventTransition::eventTest(event)) diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/gui/statemachine/qmouseeventtransition.h index eee971e..e878a58 100644 --- a/src/gui/statemachine/qmouseeventtransition.h +++ b/src/gui/statemachine/qmouseeventtransition.h @@ -52,7 +52,7 @@ public: protected: void onTransition(QEvent *event); - bool eventTest(QEvent *event) const; + bool eventTest(QEvent *event); private: Q_DISABLE_COPY(QMouseEventTransition) diff --git a/tests/auto/qstate/tst_qstate.cpp b/tests/auto/qstate/tst_qstate.cpp index bb7de20..75b1905 100644 --- a/tests/auto/qstate/tst_qstate.cpp +++ b/tests/auto/qstate/tst_qstate.cpp @@ -255,7 +255,7 @@ public: } protected: - bool eventTest(QEvent *e) const + bool eventTest(QEvent *e) { return e->type() == m_type; } diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index f8a778a..7476831 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -204,7 +204,7 @@ public: : QAbstractTransition(QList() << target) {} QList triggers; protected: - virtual bool eventTest(QEvent *) const { + virtual bool eventTest(QEvent *) { return true; } virtual void onTransition(QEvent *) { @@ -246,7 +246,7 @@ public: EventTransition(QEvent::Type type, QAbstractState *target, QState *parent = 0) : QAbstractTransition(QList() << target, parent), m_type(type) {} protected: - virtual bool eventTest(QEvent *e) const { + virtual bool eventTest(QEvent *e) { return (e->type() == m_type); } virtual void onTransition(QEvent *) {} @@ -1394,7 +1394,7 @@ public: : QAbstractTransition(QList() << target), m_value(value) {} protected: - virtual bool eventTest(QEvent *e) const + virtual bool eventTest(QEvent *e) { if (e->type() != QEvent::Type(QEvent::User+2)) return false; @@ -1596,7 +1596,7 @@ public: return m_args; } protected: - bool eventTest(QEvent *e) const { + bool eventTest(QEvent *e) { if (!QSignalTransition::eventTest(e)) return false; QSignalEvent *se = static_cast(e); -- cgit v0.12 From 7179792bbbc34a091bfc18ebc3e5bd2e401faa65 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Thu, 14 May 2009 15:06:48 +0200 Subject: Fix QGraphicsItem::deviceTransform() to also work with normal items. QGraphicsItem::deviceTransform() returns the item-to-device transform, provided with the device-to-scene transform, and combining it with the item's scene transform. This function is meant to handle items that enable ItemIgnoresTransformations, but it happened to not work properly for items that _don't_ enable that flag. Unfortunately this bug is hard to work around for users from the outside, as it requires you to check if the item or any ancestor enables ItemIgnoresTransformations. The fix also removes unnecessary branchs inside QGV so that we use the same function for all items. Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsitem.cpp | 4 + src/gui/graphicsview/qgraphicsscene.cpp | 21 +---- src/gui/graphicsview/qgraphicsview.cpp | 13 +-- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 110 +++++++++++++++++++++++++ 4 files changed, 120 insertions(+), 28 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 30c15bc..4908296 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2572,6 +2572,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; + // Find the topmost item that ignores view transformations. const QGraphicsItem *untransformedAncestor = this; QList parents; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 13f70e5..b89e352 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -2289,12 +2289,7 @@ void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRect // Calculate a simple level-of-detail metric. // ### almost identical code in QGraphicsView::paintEvent() // and QGraphicsView::render() - consider refactoring - QTransform itemToDeviceTransform; - if (item->d_ptr->itemIsUntransformable()) { - itemToDeviceTransform = item->deviceTransform(painterTransform); - } else { - itemToDeviceTransform = item->sceneTransform() * painterTransform; - } + QTransform itemToDeviceTransform = item->deviceTransform(painterTransform); option.levelOfDetail = qSqrt(itemToDeviceTransform.map(v1).length() * itemToDeviceTransform.map(v2).length()); option.matrix = itemToDeviceTransform.toAffine(); //### discards perspective @@ -5078,11 +5073,7 @@ void QGraphicsScene::drawItems(QPainter *painter, // optimization, but it's hit very rarely. for (int i = clippers.size() - 1; i >= 0; --i) { QGraphicsItem *clipper = clippers[i]; - if (clipper->d_ptr->itemIsUntransformable()) { - painter->setWorldTransform(clipper->deviceTransform(viewTransform), false); - } else { - painter->setWorldTransform(clipper->sceneTransform() * viewTransform, false); - } + painter->setWorldTransform(clipper->deviceTransform(viewTransform), false); childClippers.append(clipper); painter->save(); @@ -5093,12 +5084,8 @@ void QGraphicsScene::drawItems(QPainter *painter, } // Set up the painter transform - if (item->d_ptr->itemIsUntransformable()) { - painter->setWorldTransform(item->deviceTransform(viewTransform), false); - } else { - painter->setWorldTransform(item->sceneTransform() * viewTransform, false); - } - + painter->setWorldTransform(item->deviceTransform(viewTransform), false); + // Save painter bool saveState = (d->painterStateProtection || (item->flags() & QGraphicsItem::ItemClipsToShape)); if (saveState) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 8b133f3..a795fb4 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1153,11 +1153,7 @@ void QGraphicsViewPrivate::generateStyleOptions(const QList &it // Calculate a simple level-of-detail metric. // ### almost identical code in QGraphicsScene::render() // and QGraphicsView::render() - consider refactoring - if (item->d_ptr->itemIsUntransformable()) { - itemToViewportTransform = item->deviceTransform(worldTransform); - } else { - itemToViewportTransform = item->sceneTransform() * worldTransform; - } + itemToViewportTransform = item->deviceTransform(worldTransform); if (itemToViewportTransform.type() <= QTransform::TxTranslate) { // Translation and rotation only? The LOD is 1. @@ -2160,12 +2156,7 @@ void QGraphicsView::render(QPainter *painter, const QRectF &target, const QRect // Calculate a simple level-of-detail metric. // ### almost identical code in QGraphicsScene::render() // and QGraphicsView::paintEvent() - consider refactoring - QTransform itemToViewportTransform; - if (item->d_ptr->itemIsUntransformable()) { - itemToViewportTransform = item->deviceTransform(painterMatrix); - } else { - itemToViewportTransform = item->sceneTransform() * painterMatrix; - } + QTransform itemToViewportTransform = item->deviceTransform(painterMatrix); option->levelOfDetail = qSqrt(itemToViewportTransform.map(v1).length() * itemToViewportTransform.map(v2).length()); option->matrix = itemToViewportTransform.toAffine(); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 6d150cb..58a17ea 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -215,6 +215,8 @@ private slots: void tabChangesFocus_data(); void cacheMode(); void updateCachedItemAfterMove(); + void deviceTransform_data(); + void deviceTransform(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -6200,5 +6202,113 @@ void tst_QGraphicsItem::updateCachedItemAfterMove() QCOMPARE(tester->repaints, 1); } +class Track : public QGraphicsRectItem +{ +public: + Track(const QRectF &rect) + : QGraphicsRectItem(rect) + { + setAcceptHoverEvents(true); + } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) + { + QGraphicsRectItem::paint(painter, option, widget); + painter->drawText(boundingRect(), Qt::AlignCenter, QString("%1x%2\n%3x%4").arg(p.x()).arg(p.y()).arg(sp.x()).arg(sp.y())); + } + +protected: + void hoverMoveEvent(QGraphicsSceneHoverEvent *event) + { + p = event->pos(); + sp = event->widget()->mapFromGlobal(event->screenPos()); + update(); + } +private: + QPointF p; + QPoint sp; +}; + +void tst_QGraphicsItem::deviceTransform_data() +{ + QTest::addColumn("untransformable1"); + QTest::addColumn("untransformable2"); + QTest::addColumn("untransformable3"); + QTest::addColumn("rotation1"); + QTest::addColumn("rotation2"); + QTest::addColumn("rotation3"); + QTest::addColumn("deviceX"); + QTest::addColumn("mapResult1"); + QTest::addColumn("mapResult2"); + QTest::addColumn("mapResult3"); + + QTest::newRow("nil") << false << false << false + << qreal(0.0) << qreal(0.0) << qreal(0.0) + << QTransform() + << QPointF(150, 150) << QPointF(250, 250) << QPointF(350, 350); + QTest::newRow("deviceX rot 90") << false << false << false + << qreal(0.0) << qreal(0.0) << qreal(0.0) + << QTransform().rotate(90) + << QPointF(-150, 150) << QPointF(-250, 250) << QPointF(-350, 350); + QTest::newRow("deviceX rot 90 100") << true << false << false + << qreal(0.0) << qreal(0.0) << qreal(0.0) + << QTransform().rotate(90) + << QPointF(-50, 150) << QPointF(50, 250) << QPointF(150, 350); + QTest::newRow("deviceX rot 90 010") << false << true << false + << qreal(0.0) << qreal(0.0) << qreal(0.0) + << QTransform().rotate(90) + << QPointF(-150, 150) << QPointF(-150, 250) << QPointF(-50, 350); + QTest::newRow("deviceX rot 90 001") << false << false << true + << qreal(0.0) << qreal(0.0) << qreal(0.0) + << QTransform().rotate(90) + << QPointF(-150, 150) << QPointF(-250, 250) << QPointF(-250, 350); + QTest::newRow("deviceX rot 90 111") << true << true << true + << qreal(0.0) << qreal(0.0) << qreal(0.0) + << QTransform().rotate(90) + << QPointF(-50, 150) << QPointF(50, 250) << QPointF(150, 350); + QTest::newRow("deviceX rot 90 101") << true << false << true + << qreal(0.0) << qreal(0.0) << qreal(0.0) + << QTransform().rotate(90) + << QPointF(-50, 150) << QPointF(50, 250) << QPointF(150, 350); +} + +void tst_QGraphicsItem::deviceTransform() +{ + QFETCH(bool, untransformable1); + QFETCH(bool, untransformable2); + QFETCH(bool, untransformable3); + QFETCH(qreal, rotation1); + QFETCH(qreal, rotation2); + QFETCH(qreal, rotation3); + QFETCH(QTransform, deviceX); + QFETCH(QPointF, mapResult1); + QFETCH(QPointF, mapResult2); + QFETCH(QPointF, mapResult3); + + QGraphicsScene scene; + Track *rect1 = new Track(QRectF(0, 0, 100, 100)); + Track *rect2 = new Track(QRectF(0, 0, 100, 100)); + Track *rect3 = new Track(QRectF(0, 0, 100, 100)); + rect2->setParentItem(rect1); + rect3->setParentItem(rect2); + rect1->setPos(100, 100); + rect2->setPos(100, 100); + rect3->setPos(100, 100); + rect1->rotate(rotation1); + rect2->rotate(rotation2); + rect3->rotate(rotation3); + rect1->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable1); + rect2->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable2); + rect3->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable3); + rect1->setBrush(Qt::red); + rect2->setBrush(Qt::green); + rect3->setBrush(Qt::blue); + scene.addItem(rect1); + + QCOMPARE(rect1->deviceTransform(deviceX).map(QPointF(50, 50)), mapResult1); + QCOMPARE(rect2->deviceTransform(deviceX).map(QPointF(50, 50)), mapResult2); + QCOMPARE(rect3->deviceTransform(deviceX).map(QPointF(50, 50)), mapResult3); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v0.12 From f3418105d25fe9a9fea5b94715d9ec04ca268ee7 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 14 May 2009 15:11:02 +0200 Subject: Fix top level compile in examples/animation Three examples have been moved. --- examples/animation/animation.pro | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/animation/animation.pro b/examples/animation/animation.pro index d5121a1..0a57d3d 100644 --- a/examples/animation/animation.pro +++ b/examples/animation/animation.pro @@ -7,9 +7,6 @@ SUBDIRS += \ example \ moveblocks \ padnavigator-ng \ - photobrowser \ - piemenu \ - selectbutton \ states \ stickman \ sub-attaq -- cgit v0.12 From ed52c2f402b99541553aac163029d217f1dcd419 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 14 May 2009 06:28:47 -0700 Subject: Remove snapback/maximum drag distance from QSlider This feature was only intended for QScrollBar and was incorrectly inherited by QSlider. The only supported platform that use this feature seems to be Windows so instead of doing a nasty qobject cast in the styling it makes more sense to remove the functionality from QSlider entirely. Task-number: 245681 Reviewed-by: ogoffart --- src/gui/styles/qstyle.cpp | 2 +- src/gui/widgets/qslider.cpp | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp index b73332f..514f67b 100644 --- a/src/gui/styles/qstyle.cpp +++ b/src/gui/styles/qstyle.cpp @@ -1332,7 +1332,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value PM_LayoutVerticalSpacing Default \l{QLayout::spacing}{vertical spacing} for a QLayout. \value PM_MaximumDragDistance The maximum allowed distance between - the mouse and a slider when dragging. Exceeding the specified + the mouse and a scrollbar when dragging. Exceeding the specified distance will cause the slider to jump back to the original position; a value of -1 disables this behavior. diff --git a/src/gui/widgets/qslider.cpp b/src/gui/widgets/qslider.cpp index 32b9021..5b9c8a4 100644 --- a/src/gui/widgets/qslider.cpp +++ b/src/gui/widgets/qslider.cpp @@ -62,7 +62,6 @@ public: int tickInterval; QSlider::TickPosition tickPosition; int clickOffset; - int snapBackPosition; void init(); void resetLayoutItemMargins(); int pixelPosToRangeValue(int pos) const; @@ -493,7 +492,6 @@ void QSlider::mousePressEvent(QMouseEvent *ev) setRepeatAction(SliderNoAction); QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this); d->clickOffset = d->pick(ev->pos() - sr.topLeft()); - d->snapBackPosition = d->position; update(sr); setSliderDown(true); } @@ -513,14 +511,6 @@ void QSlider::mouseMoveEvent(QMouseEvent *ev) int newPosition = d->pixelPosToRangeValue(d->pick(ev->pos()) - d->clickOffset); QStyleOptionSlider opt; initStyleOption(&opt); - int m = style()->pixelMetric(QStyle::PM_MaximumDragDistance, &opt, this); - if (m >= 0) { - QRect r = rect(); - r.adjust(-m, -m, m, m); - if (!r.contains(ev->pos())) { - newPosition = d->snapBackPosition; - } - } setSliderPosition(newPosition); } -- cgit v0.12 From d755bb5e8cfd88d0cd909f32d240d18e856bbd36 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 14 May 2009 15:37:00 +0200 Subject: Prevent duplicate entries in the sidebar when the paths are the same If two urls were added to the sidebar that only differed in how they referenced the added url (i.e. /foo/bar/. and /foo/bar) then only one entry should appear. Task-number: 253532 Reviewed-by: Alexis --- src/gui/dialogs/qsidebar.cpp | 4 ++-- tests/auto/qsidebar/tst_qsidebar.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/dialogs/qsidebar.cpp b/src/gui/dialogs/qsidebar.cpp index 26108d7..9abefdf 100644 --- a/src/gui/dialogs/qsidebar.cpp +++ b/src/gui/dialogs/qsidebar.cpp @@ -249,9 +249,9 @@ void QUrlModel::addUrls(const QList &list, int row, bool move) continue; for (int j = 0; move && j < rowCount(); ++j) { #if defined(Q_OS_WIN) - if (index(j, 0).data(UrlRole).toUrl().toLocalFile().toLower() == url.toLocalFile().toLower()) { + if (QDir::cleanPath(index(j, 0).data(UrlRole).toUrl().toLocalFile()).toLower() == QDir::cleanPath(url.toLocalFile()).toLower()) { #else - if (index(j, 0).data(UrlRole) == url) { + if (QDir::cleanPath(index(j, 0).data(UrlRole)) == QDir::cleanPath(url)) { #endif removeRow(j); if (j <= row) diff --git a/tests/auto/qsidebar/tst_qsidebar.cpp b/tests/auto/qsidebar/tst_qsidebar.cpp index 705e222..1384391 100644 --- a/tests/auto/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/qsidebar/tst_qsidebar.cpp @@ -185,6 +185,13 @@ void tst_QSidebar::addUrls() qsidebar.addUrls(doubleUrls, 1); QCOMPARE(qsidebar.urls().size(), 1); + // Two paths that are effectively pointing to the same location + doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); + doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath() + "/."); + qsidebar.setUrls(emptyUrls); + qsidebar.addUrls(doubleUrls, 1); + QCOMPARE(qsidebar.urls().size(), 1); + #if defined(Q_OS_WIN) //Windows is case insensitive so no duplicate entries in that case doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); @@ -200,8 +207,6 @@ void tst_QSidebar::addUrls() qsidebar.addUrls(doubleUrls, 1); QCOMPARE(qsidebar.urls().size(), 2); #endif - - } void tst_QSidebar::goToUrl() -- cgit v0.12 From d45795809de0d5c4bb7a8c4dfd0b786373350c14 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Thu, 14 May 2009 15:45:20 +0200 Subject: Ensure style option for drawing blank area in scrollarea is initialized. Then you can actually influence it's palette. Task-number: 253495 Reviewed-by: Jens Bache-Wiig --- src/gui/widgets/qabstractscrollarea.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 9886969..0d8b4de 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -873,21 +873,22 @@ bool QAbstractScrollArea::event(QEvent *e) case QEvent::Resize: d->layoutChildren(); break; - case QEvent::Paint: + case QEvent::Paint: { + QStyleOption option; + option.initFrom(this); if (d->cornerPaintingRect.isValid()) { - QStyleOption option; option.rect = d->cornerPaintingRect; QPainter p(this); style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this); } #ifdef Q_WS_MAC if (d->reverseCornerPaintingRect.isValid()) { - QStyleOption option; option.rect = d->reverseCornerPaintingRect; QPainter p(this); style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this); } #endif + } QFrame::paintEvent((QPaintEvent*)e); break; #ifndef QT_NO_CONTEXTMENU -- cgit v0.12 From f09304d46bac91f3e8329cb7147f8df44898d1e0 Mon Sep 17 00:00:00 2001 From: jasplin Date: Thu, 14 May 2009 15:45:21 +0200 Subject: Fixed regression that prevented any widget from having focus when graphics view was disabled. A bug in Commit d5c018f7b014ab794e49d6e1f24e02233555847d prevented any widget from having focus when QT_NO_GRAPHICSVIEW was defined. This patch fixes the bug. Reviewed-by: bnilsen Task-number: 249589 --- src/gui/kernel/qapplication.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index f3bd57b..4cf0ad7 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2032,12 +2032,10 @@ QWidget *QApplication::focusWidget() void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) { - if (focus && focus->window() #ifndef QT_NO_GRAPHICSVIEW - && focus->window()->graphicsProxyWidget() -#endif - ) + if (focus && focus->window()->graphicsProxyWidget()) return; +#endif hidden_focus_widget = 0; -- cgit v0.12 From 8e9b041f0081cd5af67c5c5f3cee0cf2b70ffe11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20Thomsch=C3=BCtz?= Date: Thu, 14 May 2009 15:48:31 +0200 Subject: Use isNull() for strings instead of comparing against QString(). foo == QString() should be foo.isNull(). Fixes 7 warnings in the Norwegian Breakfast Network Reviewed-by: Samuel --- qmake/generators/xmloutput.cpp | 2 +- src/corelib/concurrent/qfuturewatcher.cpp | 2 +- src/corelib/kernel/qcoreapplication.cpp | 4 ++-- tools/macdeployqt/shared/shared.cpp | 4 ++-- tools/porting/src/portingrules.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/qmake/generators/xmloutput.cpp b/qmake/generators/xmloutput.cpp index 68d22e1..d77dd4b 100644 --- a/qmake/generators/xmloutput.cpp +++ b/qmake/generators/xmloutput.cpp @@ -277,7 +277,7 @@ void XmlOutput::closeTag() void XmlOutput::closeTo(const QString &tag) { bool cont = true; - if (!tagStack.contains(tag) && tag != QString()) { + if (!tagStack.contains(tag) && !tag.isNull()) { //warn_msg(WarnLogic, "<%s>: Cannot close to tag <%s>, not on stack", tagStack.last().latin1(), tag.latin1()); qDebug("<%s>: Cannot close to tag <%s>, not on stack", tagStack.last().toLatin1().constData(), tag.toLatin1().constData()); return; diff --git a/src/corelib/concurrent/qfuturewatcher.cpp b/src/corelib/concurrent/qfuturewatcher.cpp index ea35e9e..39d7698 100644 --- a/src/corelib/concurrent/qfuturewatcher.cpp +++ b/src/corelib/concurrent/qfuturewatcher.cpp @@ -465,7 +465,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event) break; emit q->progressValueChanged(event->index1); - if (event->text != QString()) // ### + if (!event->text.isNull()) // ### q->progressTextChanged(event->text); break; case QFutureCallOutEvent::ProgressRange: diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index a23b2dd..f6ce4b3 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1696,7 +1696,7 @@ QString QCoreApplication::applicationDirPath() } QCoreApplicationPrivate *d = self->d_func(); - if (d->cachedApplicationDirPath == QString()) + if (d->cachedApplicationDirPath.isNull()) d->cachedApplicationDirPath = QFileInfo(applicationFilePath()).path(); return d->cachedApplicationDirPath; } @@ -1724,7 +1724,7 @@ QString QCoreApplication::applicationFilePath() } QCoreApplicationPrivate *d = self->d_func(); - if (d->cachedApplicationFilePath != QString()) + if (!d->cachedApplicationFilePath.isNull()) return d->cachedApplicationFilePath; #if defined( Q_WS_WIN ) diff --git a/tools/macdeployqt/shared/shared.cpp b/tools/macdeployqt/shared/shared.cpp index db76ef2..1faa63a 100644 --- a/tools/macdeployqt/shared/shared.cpp +++ b/tools/macdeployqt/shared/shared.cpp @@ -343,7 +343,7 @@ DeploymentInfo deployQtFrameworks(QList frameworks, const QString copiedFrameworks.append(framework.frameworkName); // Get the qt path from one of the Qt frameworks; - if (deploymenInfo.qtPath == QString() && framework.frameworkName.contains("Qt") + if (deploymenInfo.qtPath.isNull() && framework.frameworkName.contains("Qt") && framework.frameworkDirectory.contains("/lib")) { deploymenInfo.qtPath = framework.frameworkDirectory; @@ -364,7 +364,7 @@ DeploymentInfo deployQtFrameworks(QList frameworks, const QString // Copy farmework to app bundle. const QString deployedBinaryPath = copyFramework(framework, bundlePath); // Skip the rest if already was deployed. - if (deployedBinaryPath == QString()) + if (deployedBinaryPath.isNull()) continue; runStrip(deployedBinaryPath); diff --git a/tools/porting/src/portingrules.cpp b/tools/porting/src/portingrules.cpp index 4931064..cd29403 100644 --- a/tools/porting/src/portingrules.cpp +++ b/tools/porting/src/portingrules.cpp @@ -189,7 +189,7 @@ void PortingRules::parseXml(QString fileName) QString includeFile = xml[QLatin1String("Rules")][QLatin1String("Include")].text(); - if(includeFile != QString()) { + if(!includeFile.isNull()) { QString resolvedIncludeFile = resolveFileName(fileName, includeFile); if (!resolvedIncludeFile.isEmpty()) parseXml(resolvedIncludeFile); -- cgit v0.12 From a896219edac2db3321e5c012bcdb830c698efc1e Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 14 May 2009 16:05:27 +0200 Subject: Compile with gcc 4.2. --- src/declarative/qml/parser/javascriptengine_p.cpp | 35 +++++++++- src/declarative/qml/parser/javascriptengine_p.h | 82 +++++++++++------------ 2 files changed, 71 insertions(+), 46 deletions(-) diff --git a/src/declarative/qml/parser/javascriptengine_p.cpp b/src/declarative/qml/parser/javascriptengine_p.cpp index 5debfd3..d893a90 100644 --- a/src/declarative/qml/parser/javascriptengine_p.cpp +++ b/src/declarative/qml/parser/javascriptengine_p.cpp @@ -34,11 +34,11 @@ QT_BEGIN_NAMESPACE +namespace JavaScript { + uint qHash(const JavaScript::NameId &id) { return qHash(id.asString()); } -namespace JavaScript { - QString numberToString(double value) { return QString::number(value); } @@ -155,6 +155,37 @@ double integerFromString(const QString &str, int radix) return integerFromString(ba.constData(), ba.size(), radix); } + +Engine::Engine() + : _lexer(0), _nodePool(0) +{ } + +Engine::~Engine() +{ } + +QSet Engine::literals() const +{ return _literals; } + +NameId *Engine::intern(const QChar *u, int s) +{ return const_cast(&*_literals.insert(NameId(u, s))); } + +QString Engine::toString(NameId *id) +{ return id->asString(); } + +Lexer *Engine::lexer() const +{ return _lexer; } + +void Engine::setLexer(Lexer *lexer) +{ _lexer = lexer; } + +NodePool *Engine::nodePool() const +{ return _nodePool; } + +void Engine::setNodePool(NodePool *nodePool) +{ _nodePool = nodePool; } + + + } // end of namespace JavaScript QT_END_NAMESPACE diff --git a/src/declarative/qml/parser/javascriptengine_p.h b/src/declarative/qml/parser/javascriptengine_p.h index 933487f..3bd924a 100644 --- a/src/declarative/qml/parser/javascriptengine_p.h +++ b/src/declarative/qml/parser/javascriptengine_p.h @@ -38,11 +38,38 @@ QT_BEGIN_NAMESPACE namespace JavaScript { -class NameId; -} +class NameId +{ + QString _text; + +public: + NameId(const QChar *u, int s) + : _text(u, s) + { } + + const QString asString() const + { return _text; } + + bool operator == (const NameId &other) const + { return _text == other._text; } + + bool operator != (const NameId &other) const + { return _text != other._text; } + + bool operator < (const NameId &other) const + { return _text < other._text; } +}; uint qHash(const JavaScript::NameId &id); +} // end of namespace JavaScript + +#if defined(Q_CC_MSVC) && _MSC_VER <= 1300 +//this ensures that code outside JavaScript can use the hash function +//it also a workaround for some compilers +inline uint qHash(const JavaScript::NameId &nameId) { return JavaScript::qHash(nameId); } +#endif + namespace JavaScript { class Lexer; @@ -66,29 +93,6 @@ public: } // end of namespace Ecma - -class NameId -{ - QString _text; - -public: - NameId(const QChar *u, int s) - : _text(u, s) - { } - - const QString asString() const - { return _text; } - - bool operator == (const NameId &other) const - { return _text == other._text; } - - bool operator != (const NameId &other) const - { return _text != other._text; } - - bool operator < (const NameId &other) const - { return _text < other._text; } -}; - class DiagnosticMessage { public: @@ -118,30 +122,20 @@ class Engine QSet _literals; public: - Engine() - : _lexer(0), _nodePool(0) - { } - - QSet literals() const - { return _literals; } - - NameId *intern(const QChar *u, int s) - { return const_cast(&*_literals.insert(NameId(u, s))); } + Engine(); + ~Engine(); - static QString toString(NameId *id) - { return id->asString(); } + QSet literals() const; - Lexer *lexer() const - { return _lexer; } + NameId *intern(const QChar *u, int s); - void setLexer(Lexer *lexer) - { _lexer = lexer; } + static QString toString(NameId *id); - NodePool *nodePool() const - { return _nodePool; } + Lexer *lexer() const; + void setLexer(Lexer *lexer); - void setNodePool(NodePool *nodePool) - { _nodePool = nodePool; } + NodePool *nodePool() const; + void setNodePool(NodePool *nodePool); }; } // end of namespace JavaScript -- cgit v0.12 From a2f9d610c5cfd80819dc9a11c9452fcadba6ebb4 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 14 May 2009 16:09:41 +0200 Subject: Fix missing update of edit geometry on QSpinBox When showing or hiding spinbox buttons we did not update the child line edit geometry. This would on windows basically mean that the buttons would not show up as they were completely covered by the edit. Task-number: 235747 Reviewed-by: ogoffart --- src/gui/widgets/qabstractspinbox.cpp | 1 + tests/auto/qspinbox/tst_qspinbox.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 347f89a..d640c70 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -193,6 +193,7 @@ void QAbstractSpinBox::setButtonSymbols(ButtonSymbols buttonSymbols) Q_D(QAbstractSpinBox); if (d->buttonSymbols != buttonSymbols) { d->buttonSymbols = buttonSymbols; + d->updateEditFieldGeometry(); update(); } } diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index 1867356..575f261 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -241,6 +241,12 @@ void tst_QSpinBox::getSetCheck() QCOMPARE(0.0, obj2.value()); obj2.setValue(1.0); QCOMPARE(1.0, obj2.value()); + + // Make sure we update line edit geometry when updating + // buttons - see task 235747 + QRect oldEditGeometry = obj1.childrenRect(); + obj1.setButtonSymbols(QAbstractSpinBox::NoButtons); + QVERIFY(obj1.childrenRect() != oldEditGeometry); } tst_QSpinBox::tst_QSpinBox() -- cgit v0.12 From d644a9a89ff4f7bf8866b69af5334ea1c696e4a7 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Thu, 14 May 2009 16:19:22 +0200 Subject: Compile. Need the proper types. Reviewed-by: Andy --- src/gui/dialogs/qsidebar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qsidebar.cpp b/src/gui/dialogs/qsidebar.cpp index 9abefdf..000a06b 100644 --- a/src/gui/dialogs/qsidebar.cpp +++ b/src/gui/dialogs/qsidebar.cpp @@ -251,7 +251,7 @@ void QUrlModel::addUrls(const QList &list, int row, bool move) #if defined(Q_OS_WIN) if (QDir::cleanPath(index(j, 0).data(UrlRole).toUrl().toLocalFile()).toLower() == QDir::cleanPath(url.toLocalFile()).toLower()) { #else - if (QDir::cleanPath(index(j, 0).data(UrlRole)) == QDir::cleanPath(url)) { + if (QDir::cleanPath(index(j, 0).data(UrlRole).toUrl().toLocalFile()) == QDir::cleanPath(url.toLocalFile())) { #endif removeRow(j); if (j <= row) -- cgit v0.12 From d8a5799de2be228c10faaaa3e6f4c7eb07793b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Thu, 14 May 2009 16:45:17 +0200 Subject: Find chart.exe on windows. --- src/testlib/qtestcase.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 8c76c5d..041f2db 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1465,8 +1465,12 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) #if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS) if (QBenchmarkGlobalData::current->createChart) { - QString chartLocation = QLibraryInfo::location(QLibraryInfo::BinariesPath) - + QLatin1String("/../tools/qtestlib/chart/chart"); + QString chartLocation = QLibraryInfo::location(QLibraryInfo::BinariesPath); +#ifdef Q_OS_WIN + chartLocation += QLatin1String("/../tools/qtestlib/chart/release/chart.exe"); +#else + chartLocation += QLatin1String("/../tools/qtestlib/chart/chart"); +#endif if (QFile::exists(chartLocation)) { QProcess p; p.setProcessChannelMode(QProcess::ForwardedChannels); -- cgit v0.12 From bacdcc7d2ed4816688c19ddbffa8d3aab98b2123 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 14 May 2009 16:42:13 +0200 Subject: Fix QSplitter::setHandleWidth to work with motif style Motif style was incorrectly adjusting it's size in sizeFromConents. This is wrong and prevents the function from overriding the huge minimum size on the widget. PM_SplitterWidth already ensures the proper default size for the splitter. Task-number: 194542 Reviewed-by: ogoffart --- src/gui/styles/qmotifstyle.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/styles/qmotifstyle.cpp b/src/gui/styles/qmotifstyle.cpp index 7d4fab8..be0e3eb 100644 --- a/src/gui/styles/qmotifstyle.cpp +++ b/src/gui/styles/qmotifstyle.cpp @@ -2026,10 +2026,6 @@ QMotifStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, QSize sz(contentsSize); switch(ct) { - case CT_Splitter: - sz = QSize(10, 10); - break; - case CT_RadioButton: case CT_CheckBox: sz = QCommonStyle::sizeFromContents(ct, opt, contentsSize, widget); -- cgit v0.12 From 85f98acaa3a38079071bea711e43c9a86edec1f6 Mon Sep 17 00:00:00 2001 From: Trond Kjernaasen Date: Thu, 14 May 2009 17:38:56 +0200 Subject: Fixed an issue with text drawing under Windows. Some text drawn with OpenType fonts where cut off by a pixel or two under certain circumstances. This adds an additional 2 pixel pad margin to the glyph cache entries. The padding behaves slightly different when ClearType is enabled/disabled, hence the general 2 pixel padding. Task-number: 246196 Reviewed-by: Samuel --- src/gui/painting/qtextureglyphcache.cpp | 11 ++++------- src/gui/text/qfontengine_win.cpp | 6 +++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 1ea40ba..3fd1ffb 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -88,11 +88,12 @@ void QTextureGlyphCache::populate(const QTextItemInt &ti, ti.ascent.toReal(), ti.descent.toReal()); #endif - int glyph_width = metrics.width.ceil().toInt() + margin * 2; - int glyph_height = metrics.height.ceil().toInt() + margin * 2; + int glyph_width = metrics.width.ceil().toInt(); + int glyph_height = metrics.height.ceil().toInt(); if (glyph_height == 0 || glyph_width == 0) continue; - + glyph_width += margin * 2 + 2; + glyph_height += margin * 2 + 2; // align to 8-bit boundary if (m_type == QFontEngineGlyphCache::Raster_Mono) glyph_width = (glyph_width+7)&~7; @@ -188,11 +189,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height) int QImageTextureGlyphCache::glyphMargin() const { -#ifdef Q_WS_MAC return 2; -#else - return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0; -#endif } void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g) diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 1996d44..bf3a176 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -1406,8 +1406,8 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin #endif #endif - QNativeImage *ni = new QNativeImage(iw + 2 * margin, - ih + 2 * margin, + QNativeImage *ni = new QNativeImage(iw + 2 * margin + 2, + ih + 2 * margin + 2, QNativeImage::systemFormat(), true); ni->image.fill(0xffffffff); @@ -1449,7 +1449,7 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform) font = CreateFontIndirectW(&lf); } - QNativeImage *mask = drawGDIGlyph(font, glyph, 0, xform); + QNativeImage *mask = drawGDIGlyph(font, glyph, 2, xform); if (mask == 0) return QImage(); -- cgit v0.12 From ae3f20e9ce7f592c22c23e8dea6bb9feb52c8b90 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Thu, 14 May 2009 18:40:03 +0200 Subject: QColor::toCmyk() does not convert the color if it is already in CMYK QColor::toCmyk() converted the color to RGB and then to CMYK. If the color was already in CMYK, this conversion change it. The color is now returned directly if it is in CMYK Reviewed-by: Ariya Task-number: 253625 --- src/gui/painting/qcolor.cpp | 4 ++-- tests/auto/qcolor/tst_qcolor.cpp | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 5d7d4ab..1723a19 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -1369,7 +1369,7 @@ QColor QColor::toRgb() const */ QColor QColor::toHsv() const { - if (!isValid()) + if (!isValid() || cspec == Hsv) return *this; if (cspec != Rgb) @@ -1421,7 +1421,7 @@ QColor QColor::toHsv() const */ QColor QColor::toCmyk() const { - if (!isValid()) + if (!isValid() || cspec == Cmyk) return *this; if (cspec != Rgb) return toRgb().toCmyk(); diff --git a/tests/auto/qcolor/tst_qcolor.cpp b/tests/auto/qcolor/tst_qcolor.cpp index 7608a15..684d5b5 100644 --- a/tests/auto/qcolor/tst_qcolor.cpp +++ b/tests/auto/qcolor/tst_qcolor.cpp @@ -111,12 +111,15 @@ private slots: void toRgb_data(); void toRgb(); + void toRgbNonDestructive(); void toHsv_data(); void toHsv(); + void toHsvNonDestructive(); void toCmyk_data(); void toCmyk(); + void toCmykNonDestructive(); void convertTo(); @@ -1124,6 +1127,12 @@ void tst_QColor::toHsv_data() << QColor::fromCmykF(0., 1., 1., 0.); } +void tst_QColor::toRgbNonDestructive() +{ + QColor aColor = QColor::fromRgbF(0.11, 0.22, 0.33, 0.44); + QCOMPARE(aColor, aColor.toRgb()); +} + void tst_QColor::toHsv() { // invalid should remain invalid @@ -1136,6 +1145,12 @@ void tst_QColor::toHsv() QCOMPARE(cmykColor.toHsv(), expectedColor); } +void tst_QColor::toHsvNonDestructive() +{ + QColor aColor = QColor::fromHsvF(0.11, 0.22, 0.33, 0.44); + QCOMPARE(aColor, aColor.toHsv()); +} + void tst_QColor::toCmyk_data() { QTest::addColumn("expectedColor"); @@ -1165,6 +1180,12 @@ void tst_QColor::toCmyk() QCOMPARE(hsvColor.toCmyk(), expectedColor); } +void tst_QColor::toCmykNonDestructive() +{ + QColor aColor = QColor::fromCmykF(0.11, 0.22, 0.33, 0.44); + QCOMPARE(aColor, aColor.toCmyk()); +} + void tst_QColor::convertTo() { QColor color(Qt::black); -- cgit v0.12 From 38f8b6d63aa88bb4b05c164632e5058beed9a7db Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Thu, 14 May 2009 18:40:03 +0200 Subject: QColor::toCmyk() does not convert the color if it is already in CMYK QColor::toCmyk() converted the color to RGB and then to CMYK. If the color was already in CMYK, this conversion change it. The color is now returned directly if it is in CMYK Reviewed-by: Ariya Task-number: 253625 --- src/gui/painting/qcolor.cpp | 4 ++-- tests/auto/qcolor/tst_qcolor.cpp | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 24d167e..534a425 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -1369,7 +1369,7 @@ QColor QColor::toRgb() const */ QColor QColor::toHsv() const { - if (!isValid()) + if (!isValid() || cspec == Hsv) return *this; if (cspec != Rgb) @@ -1421,7 +1421,7 @@ QColor QColor::toHsv() const */ QColor QColor::toCmyk() const { - if (!isValid()) + if (!isValid() || cspec == Cmyk) return *this; if (cspec != Rgb) return toRgb().toCmyk(); diff --git a/tests/auto/qcolor/tst_qcolor.cpp b/tests/auto/qcolor/tst_qcolor.cpp index 7608a15..684d5b5 100644 --- a/tests/auto/qcolor/tst_qcolor.cpp +++ b/tests/auto/qcolor/tst_qcolor.cpp @@ -111,12 +111,15 @@ private slots: void toRgb_data(); void toRgb(); + void toRgbNonDestructive(); void toHsv_data(); void toHsv(); + void toHsvNonDestructive(); void toCmyk_data(); void toCmyk(); + void toCmykNonDestructive(); void convertTo(); @@ -1124,6 +1127,12 @@ void tst_QColor::toHsv_data() << QColor::fromCmykF(0., 1., 1., 0.); } +void tst_QColor::toRgbNonDestructive() +{ + QColor aColor = QColor::fromRgbF(0.11, 0.22, 0.33, 0.44); + QCOMPARE(aColor, aColor.toRgb()); +} + void tst_QColor::toHsv() { // invalid should remain invalid @@ -1136,6 +1145,12 @@ void tst_QColor::toHsv() QCOMPARE(cmykColor.toHsv(), expectedColor); } +void tst_QColor::toHsvNonDestructive() +{ + QColor aColor = QColor::fromHsvF(0.11, 0.22, 0.33, 0.44); + QCOMPARE(aColor, aColor.toHsv()); +} + void tst_QColor::toCmyk_data() { QTest::addColumn("expectedColor"); @@ -1165,6 +1180,12 @@ void tst_QColor::toCmyk() QCOMPARE(hsvColor.toCmyk(), expectedColor); } +void tst_QColor::toCmykNonDestructive() +{ + QColor aColor = QColor::fromCmykF(0.11, 0.22, 0.33, 0.44); + QCOMPARE(aColor, aColor.toCmyk()); +} + void tst_QColor::convertTo() { QColor color(Qt::black); -- cgit v0.12 From f36d2e5cd0655cee2a1bfb84a66400a4b7a4c454 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Thu, 14 May 2009 23:29:28 +0200 Subject: Only build the QWS keymap converter in embedded builds. Reviewed-by: TrustMe --- tools/tools.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools.pro b/tools/tools.pro index 0a56cfb..d034dcd 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -22,7 +22,7 @@ mac { SUBDIRS += macdeployqt } -SUBDIRS += kmap2qmap +embedded:SUBDIRS += kmap2qmap contains(QT_CONFIG, dbus):SUBDIRS += qdbus !wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns -- cgit v0.12 From e03075954936444feda8670330e94b87d82deb79 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 15 May 2009 10:30:03 +1000 Subject: Fix SetProperties not always setting properties correctly. QmlMetaProperty no longer holds on to a QMetaProperty, as it may become invalidated for a dynamic object built using QmlOpenMetaObject. Reviewed-by: Aaron Kennedy --- src/declarative/qml/qmlmetaproperty.cpp | 108 +++++++++++++++++--------------- src/declarative/qml/qmlmetaproperty.h | 2 +- src/declarative/qml/qmlmetaproperty_p.h | 3 +- 3 files changed, 60 insertions(+), 53 deletions(-) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 59d6b38..e3e9ff5 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -100,9 +100,16 @@ QmlMetaProperty::~QmlMetaProperty() delete d; d = 0; } -// ### not thread safe -static QHash qmlCacheDefProp; +struct CachedPropertyData { + CachedPropertyData(const QString &n, int pt, int ci) + : name(n), propType(pt), coreIdx(ci) {} + QString name; + int propType; + int coreIdx; +}; +// ### not thread safe +static QHash qmlCacheDefProp; /*! Creates a QmlMetaProperty for the default property of \a obj. If there is no @@ -131,23 +138,22 @@ void QmlMetaProperty::initDefault(QObject *obj) return; d->object = obj; - QHash::ConstIterator iter = + QHash::ConstIterator iter = qmlCacheDefProp.find(obj->metaObject()); if (iter != qmlCacheDefProp.end()) { - d->prop = *iter; - d->propType = iter->propertyType; - d->coreIdx = iter->propertyType; + d->name = iter->name; + d->propType = iter->propType; + d->coreIdx = iter->coreIdx; } else { QMetaPropertyEx p(QmlMetaType::defaultProperty(obj)); - d->prop = p; + d->name = QLatin1String(p.name()); d->propType = p.propertyType; - d->coreIdx = d->prop.propertyIndex(); + d->coreIdx = p.propertyIndex(); if (!QObjectPrivate::get(obj)->metaObject) - qmlCacheDefProp.insert(obj->metaObject(), d->prop); + qmlCacheDefProp.insert(obj->metaObject(), CachedPropertyData(d->name, d->propType, d->coreIdx)); } - if (d->prop.name() != 0) { + if (!d->name.isEmpty()) { d->type = Property | Default; - d->name = QLatin1String(d->prop.name()); } } @@ -166,15 +172,14 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, int idx, PropertyCategory cat, Qm d->type = Property; d->category = cat; QMetaPropertyEx p(obj->metaObject()->property(idx)); - d->prop = p; d->propType = p.propertyType; d->coreIdx = idx; - if (d->prop.name() != 0) - d->name = QLatin1String(d->prop.name()); + if (p.name() != 0) + d->name = QLatin1String(p.name()); } // ### Not thread safe!!!! -static QHash > qmlCacheProps; +static QHash > qmlCacheProps; /*! Creates a QmlMetaProperty for the property \a name of \a obj. */ @@ -225,21 +230,21 @@ void QmlMetaProperty::initProperty(QObject *obj, const QString &name) } // Property - QHash &props = qmlCacheProps[obj->metaObject()]; - QHash::ConstIterator iter = props.find(name); + QHash &props = qmlCacheProps[obj->metaObject()]; + QHash::ConstIterator iter = props.find(name); if (iter != props.end()) { - d->prop = *iter; - d->propType = iter->propertyType; - d->coreIdx = iter->propertyIndex(); + d->name = iter->name; + d->propType = iter->propType; + d->coreIdx = iter->coreIdx; } else { QMetaPropertyEx p = QmlMetaType::property(obj, name.toLatin1().constData()); - d->prop = p; + d->name = QLatin1String(p.name()); d->propType = p.propertyType; d->coreIdx = p.propertyIndex(); if (!QObjectPrivate::get(obj)->metaObject) - props.insert(name, p); + props.insert(name, CachedPropertyData(d->name, d->propType, d->coreIdx)); } - if (d->prop.name() != 0) + if (!d->name.isEmpty()) d->type = Property; if (d->type == Invalid) { @@ -352,8 +357,8 @@ QmlMetaProperty::propertyCategory(const QMetaProperty &prop) */ const char *QmlMetaProperty::propertyTypeName() const { - if (d->prop.name()) { - return d->prop.typeName(); + if (!d->name.isEmpty()) { + return d->object->metaObject()->property(d->coreIdx).typeName(); } else { return 0; } @@ -365,7 +370,7 @@ const char *QmlMetaProperty::propertyTypeName() const */ bool QmlMetaProperty::operator==(const QmlMetaProperty &other) const { - return d->prop.name() == other.d->prop.name() && + return d->name == other.d->name && d->signal.signature() == other.d->signal.signature() && d->type == other.d->type && d->object == other.d->object; @@ -384,7 +389,7 @@ int QmlMetaPropertyPrivate::propertyType() const { int rv = QVariant::Invalid; - if (prop.name()) { + if (!name.isEmpty()) { if (propType == (int)QVariant::LastType) rv = qMetaTypeId(); else @@ -434,7 +439,6 @@ QObject *QmlMetaProperty::object() const QmlMetaProperty &QmlMetaProperty::operator=(const QmlMetaProperty &other) { d->name = other.d->name; - d->prop = other.d->prop; d->propType = other.d->propType; d->type = other.d->type; d->signal = other.d->signal; @@ -452,8 +456,8 @@ bool QmlMetaProperty::isWritable() const { if (propertyCategory() == List || propertyCategory() == QmlList) return true; - else if (d->prop.name() != 0) - return d->prop.isWritable(); + else if (!d->name.isEmpty()) + return d->object->metaObject()->property(d->coreIdx).isWritable(); else if (type() & SignalProperty) return true; else @@ -465,8 +469,8 @@ bool QmlMetaProperty::isWritable() const */ bool QmlMetaProperty::isDesignable() const { - if (d->prop.name() != 0) - return d->prop.isDesignable(); + if (!d->name.isEmpty()) + return d->object->metaObject()->property(d->coreIdx).isDesignable(); else return false; } @@ -510,9 +514,9 @@ QString QmlMetaProperty::name() const Returns the \l{QMetaProperty} {Qt property} associated with this QML property. */ -const QMetaProperty &QmlMetaProperty::property() const +QMetaProperty QmlMetaProperty::property() const { - return d->prop; + return d->object->metaObject()->property(d->coreIdx); } /*! @@ -602,7 +606,7 @@ QVariant QmlMetaProperty::read() const if (type() & Attached) return QVariant::fromValue(d->attachedObject()); else - return d->prop.read(object()); + return d->object->metaObject()->property(d->coreIdx).read(object()); } return QVariant(); } @@ -636,6 +640,7 @@ void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value) void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value) { + QMetaProperty prop = object->metaObject()->property(coreIdx); if (prop.isEnumType()) { QVariant v = value; if (value.type() == QVariant::Double) { //enum values come through the script engine as doubles @@ -805,13 +810,14 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value) */ void QmlMetaProperty::write(const QVariant &value) const { + QMetaProperty prop = d->object->metaObject()->property(d->coreIdx); if (type() & SignalProperty) { d->writeSignalProperty(value); - } else if (d->prop.name()) { + } else if (prop.name()) { - if (d->prop.isEnumType()) { + if (prop.isEnumType()) { QVariant v = value; if (value.type() == QVariant::Double) { //enum values come through the script engine as doubles double integral; @@ -819,7 +825,7 @@ void QmlMetaProperty::write(const QVariant &value) const if (qFuzzyCompare(fractional, (double)0.0)) v.convert(QVariant::Int); } - d->prop.write(object(), v); + prop.write(object(), v); } else { if (!value.isValid()) return; @@ -836,13 +842,13 @@ void QmlMetaProperty::write(const QVariant &value) const } else if (qMetaTypeId() == t) { - d->prop.write(object(), value); + prop.write(object(), value); } else if (propertyCategory() == Object) { QObject *o = QmlMetaType::toQObject(value); if (o) - d->prop.write(object(), QmlMetaType::fromObject(o, propertyType())); + prop.write(object(), QmlMetaType::fromObject(o, propertyType())); } else if (propertyCategory() == List) { @@ -850,7 +856,7 @@ void QmlMetaProperty::write(const QVariant &value) const if (value.userType() == qMetaTypeId >()) { const QList &list = qvariant_cast >(value); - QVariant listVar = d->prop.read(object()); + QVariant listVar = prop.read(object()); QmlMetaType::clear(listVar); for (int ii = 0; ii < list.count(); ++ii) { QVariant v = QmlMetaType::fromObject(list.at(ii), listType); @@ -859,14 +865,14 @@ void QmlMetaProperty::write(const QVariant &value) const } else if (vt == listType || value.userType() == listType) { - QVariant listVar = d->prop.read(object()); + QVariant listVar = prop.read(object()); if (!QmlMetaType::append(listVar, value)) { qWarning() << "QmlMetaProperty: Unable to assign object to list"; } } } else if (propertyCategory() == QmlList) { // XXX - optimize! - QVariant list = d->prop.read(object()); + QVariant list = prop.read(object()); QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)list.constData(); @@ -969,7 +975,7 @@ void QmlMetaProperty::write(const QVariant &value) const default: break; } - d->prop.write(object(), value); + prop.write(object(), value); } } @@ -982,7 +988,7 @@ void QmlMetaProperty::write(const QVariant &value) const bool QmlMetaProperty::hasChangedNotifier() const { if (type() & Property && !(type() & Attached)) { - return d->prop.hasNotifySignal(); + return d->object->metaObject()->property(d->coreIdx).hasNotifySignal(); } return false; } @@ -1012,8 +1018,9 @@ bool QmlMetaProperty::connectNotifier(QObject *dest, int method) const if (!(type() & Property) || type() & Attached) return false; - if (d->prop.hasNotifySignal()) { - return QMetaObject::connect(d->object, d->prop.notifySignalIndex(), dest, method, Qt::DirectConnection); + QMetaProperty prop = d->object->metaObject()->property(d->coreIdx); + if (prop.hasNotifySignal()) { + return QMetaObject::connect(d->object, prop.notifySignalIndex(), dest, method, Qt::DirectConnection); } else { return false; } @@ -1032,8 +1039,9 @@ bool QmlMetaProperty::connectNotifier(QObject *dest, const char *slot) const if (!(type() & Property) || type() & Attached) return false; - if (d->prop.hasNotifySignal()) { - QByteArray signal(QByteArray("2") + d->prop.notifySignal().signature()); + QMetaProperty prop = d->object->metaObject()->property(d->coreIdx); + if (prop.hasNotifySignal()) { + QByteArray signal(QByteArray("2") + prop.notifySignal().signature()); return QObject::connect(d->object, signal.constData(), dest, slot); } else { return false; @@ -1098,7 +1106,7 @@ void QmlMetaProperty::restore(quint32 id, QObject *obj) d->attachedFunc = id; } else if (d->type & Property) { QMetaPropertyEx p(obj->metaObject()->property(id)); - d->prop = p; + d->name = QLatin1String(p.name()); d->propType = p.propertyType; d->coreIdx = id; } else if (d->type & SignalProperty || d->type & Signal) { diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qmlmetaproperty.h index 68b06e5..4e59cf7 100644 --- a/src/declarative/qml/qmlmetaproperty.h +++ b/src/declarative/qml/qmlmetaproperty.h @@ -121,7 +121,7 @@ public: bool operator==(const QmlMetaProperty &) const; - const QMetaProperty &property() const; + QMetaProperty property() const; QmlBindableValue *binding(); static int findSignal(const QObject *, const char *); diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h index 1ea38e9..738bfec 100644 --- a/src/declarative/qml/qmlmetaproperty_p.h +++ b/src/declarative/qml/qmlmetaproperty_p.h @@ -54,7 +54,7 @@ public: QmlMetaPropertyPrivate(const QmlMetaPropertyPrivate &other) : name(other.name), signal(other.signal), context(other.context), coreIdx(other.coreIdx), type(other.type), attachedFunc(other.attachedFunc), - object(other.object), prop(other.prop), propType(other.propType), + object(other.object), propType(other.propType), category(other.category) {} QString name; @@ -64,7 +64,6 @@ public: uint type; int attachedFunc; QObject *object; - QMetaProperty prop; int propType; mutable QmlMetaProperty::PropertyCategory category; -- cgit v0.12 From e7104992c731749335466b6ff771ee886af79f1d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 15 May 2009 10:35:53 +1000 Subject: Fix finishPlaying behavior for repeating animations. Make sure we stop at the end of the current loop. --- src/declarative/util/qmlanimation.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index dd4e1eb..24bcac98 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -243,8 +243,12 @@ void QmlAbstractAnimation::setRunning(bool r) d->startOnCompletion = true; emit started(); } else { - if (!d->finishPlaying) + if (d->finishPlaying) { + if (d->repeat) + qtAnimation()->setLoopCount(qtAnimation()->currentLoop()+1); + } else qtAnimation()->stop(); + emit completed(); } @@ -512,7 +516,11 @@ void QmlAbstractAnimation::transition(QmlStateActions &actions, void QmlAbstractAnimation::timelineComplete() { + Q_D(QmlAbstractAnimation); setRunning(false); + if (d->finishPlaying && d->repeat) { + qtAnimation()->setLoopCount(-1); + } } /*! -- cgit v0.12 From 299ce6f43dc8c2f2953f6be551985edc485ea4f9 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 15 May 2009 10:37:09 +1000 Subject: Make test compile. --- tests/auto/declarative/qmlparser/testtypes.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qmlparser/testtypes.h b/tests/auto/declarative/qmlparser/testtypes.h index 0dc91b2..c1f85b9 100644 --- a/tests/auto/declarative/qmlparser/testtypes.h +++ b/tests/auto/declarative/qmlparser/testtypes.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include -- cgit v0.12 From f9fa633257f856f03b6f8323506d1695e1705e5f Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 15 May 2009 11:32:17 +1000 Subject: class exports --- src/declarative/fx/qfxblendedimage.h | 2 +- src/declarative/fx/qfxparticles.h | 8 ++++---- src/declarative/fx/qfxvisualitemmodel.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/declarative/fx/qfxblendedimage.h b/src/declarative/fx/qfxblendedimage.h index 5cc0238..1cf4dc8 100644 --- a/src/declarative/fx/qfxblendedimage.h +++ b/src/declarative/fx/qfxblendedimage.h @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxBlendedImage : public QFxItem +class Q_DECLARATIVE_EXPORT QFxBlendedImage : public QFxItem { Q_OBJECT diff --git a/src/declarative/fx/qfxparticles.h b/src/declarative/fx/qfxparticles.h index 0696e60..a879b2d 100644 --- a/src/declarative/fx/qfxparticles.h +++ b/src/declarative/fx/qfxparticles.h @@ -56,7 +56,7 @@ QT_MODULE(Declarative) class QFxParticle; class QFxParticles; -class QFxParticleMotion : public QObject +class Q_DECLARATIVE_EXPORT QFxParticleMotion : public QObject { Q_OBJECT public: @@ -68,7 +68,7 @@ public: }; QML_DECLARE_TYPE(QFxParticleMotion); -class QFxParticleMotionLinear : public QFxParticleMotion +class Q_DECLARATIVE_EXPORT QFxParticleMotionLinear : public QFxParticleMotion { Q_OBJECT public: @@ -79,7 +79,7 @@ public: }; QML_DECLARE_TYPE(QFxParticleMotionLinear); -class QFxParticleMotionGravity : public QFxParticleMotion +class Q_DECLARATIVE_EXPORT QFxParticleMotionGravity : public QFxParticleMotion { Q_OBJECT @@ -108,7 +108,7 @@ private: }; QML_DECLARE_TYPE(QFxParticleMotionGravity); -class QFxParticleMotionWander : public QFxParticleMotion +class Q_DECLARATIVE_EXPORT QFxParticleMotionWander : public QFxParticleMotion { Q_OBJECT public: diff --git a/src/declarative/fx/qfxvisualitemmodel.h b/src/declarative/fx/qfxvisualitemmodel.h index 33017e2..5db5209 100644 --- a/src/declarative/fx/qfxvisualitemmodel.h +++ b/src/declarative/fx/qfxvisualitemmodel.h @@ -62,7 +62,7 @@ class QFxItem; class QmlComponent; class QmlPackage; class QFxVisualItemModelPrivate; -class QFxVisualItemModel : public QObject +class Q_DECLARATIVE_EXPORT QFxVisualItemModel : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QFxVisualItemModel) -- cgit v0.12 From 15752b9ee436f7c0cb49c3ad29a2d81104d64d5d Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 May 2009 13:06:40 +1000 Subject: Add more resiliant TEST_FILE() method --- .../auto/declarative/qmlbindengine/tst_qmlbindengine.cpp | 15 +++++++++++++-- tests/auto/declarative/qmlparser/tst_qmlparser.cpp | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp index a0554f3..a1efc5f 100644 --- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp +++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp @@ -3,10 +3,21 @@ #include #include #include +#include +#include +#include #include "testtypes.h" -#define TEST_FILE(filename) \ - QUrl::fromLocalFile(QApplication::applicationDirPath() + "/" + filename) +inline QUrl TEST_FILE(const QString &filename) +{ + QFileInfo fileInfo(__FILE__); + return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename)); +} + +inline QUrl TEST_FILE(const char *filename) +{ + return TEST_FILE(QLatin1String(filename)); +} class tst_qmlbindengine : public QObject { diff --git a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp index 65ee5e2..089c116 100644 --- a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp +++ b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include "testtypes.h" class tst_qmlparser : public QObject @@ -73,8 +75,16 @@ private: QCOMPARE(expected, actual); \ } -#define TEST_FILE(filename) \ - QUrl::fromLocalFile(QApplication::applicationDirPath() + "/" + filename) +inline QUrl TEST_FILE(const QString &filename) +{ + QFileInfo fileInfo(__FILE__); + return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename)); +} + +inline QUrl TEST_FILE(const char *filename) +{ + return TEST_FILE(QLatin1String(filename)); +} void tst_qmlparser::errors_data() { -- cgit v0.12 From ac98ab496ecfba9493e93f0e0323822a1c9ed2d6 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 15 May 2009 14:10:44 +1000 Subject: compile (rand()) --- examples/tools/contiguouscache/randomlistmodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/tools/contiguouscache/randomlistmodel.cpp b/examples/tools/contiguouscache/randomlistmodel.cpp index 0f58c0e..b1c7204 100644 --- a/examples/tools/contiguouscache/randomlistmodel.cpp +++ b/examples/tools/contiguouscache/randomlistmodel.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include "randomlistmodel.h" +#include static const int bufferSize(500); static const int lookAhead(100); -- cgit v0.12 From 214b89c2e754c389433ae28889520647b198007d Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 15 May 2009 14:12:53 +1000 Subject: Skins in UI (now that deviceskins includes them as qrc, we may as well use them) --- tools/qmlviewer/main.cpp | 2 +- tools/qmlviewer/qmlviewer.cpp | 101 +++++++++++++++++++++++++++++++++--------- tools/qmlviewer/qmlviewer.h | 2 +- 3 files changed, 82 insertions(+), 23 deletions(-) diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp index f27606e..da13c1a 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qmlviewer/main.cpp @@ -137,7 +137,7 @@ int main(int argc, char ** argv) viewer.setRecordPeriod(period); if (autorecord_to) viewer.setAutoRecord(autorecord_from,autorecord_to); - if (QDir(skin).exists()) + if (!skin.isEmpty() && QDir(skin).exists()) viewer.setSkin(skin); if (devkeys) viewer.setDeviceKeys(true); diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 2eddb6a..97e29f1 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -77,14 +78,16 @@ QSize QmlViewer::sizeHint() const void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) { + QObject *parent = flatmenu ? (QObject*)flatmenu : (QObject*)menu; + QMenu *fileMenu = flatmenu ? flatmenu : menu->addMenu(tr("&File")); - QAction *openAction = new QAction(tr("&Open..."), this); + QAction *openAction = new QAction(tr("&Open..."), parent); openAction->setShortcut(QKeySequence("Ctrl+O")); connect(openAction, SIGNAL(triggered()), this, SLOT(open())); fileMenu->addAction(openAction); - QAction *reloadAction = new QAction(tr("&Reload"), this); + QAction *reloadAction = new QAction(tr("&Reload"), parent); reloadAction->setShortcut(QKeySequence("Ctrl+R")); connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload())); fileMenu->addAction(reloadAction); @@ -93,27 +96,51 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) QMenu *recordMenu = flatmenu ? flatmenu : menu->addMenu(tr("&Recording")); - QAction *snapshotAction = new QAction(tr("&Take Snapsot\tF3"), this); + QAction *snapshotAction = new QAction(tr("&Take Snapsot\tF3"), parent); connect(snapshotAction, SIGNAL(triggered()), this, SLOT(takeSnapShot())); recordMenu->addAction(snapshotAction); - recordAction = new QAction(tr("Start Recording &Video\tF2"), this); + recordAction = new QAction(tr("Start Recording &Video\tF2"), parent); connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecordingWithSelection())); recordMenu->addAction(recordAction); if (flatmenu) flatmenu->addSeparator(); + QActionGroup *skinActions = new QActionGroup(parent); + QSignalMapper *mapper = new QSignalMapper(parent); + QMenu *skinMenu = flatmenu ? flatmenu->addMenu(tr("&Skin")) : menu->addMenu(tr("&Skin")); + QDir dir(":/skins/","*.skin"); + const QFileInfoList l = dir.entryInfoList(); + QAction *skinAction = new QAction(tr("None"), parent); + skinActions->addAction(skinAction); + skinMenu->addAction(skinAction); + mapper->setMapping(skinAction, ""); + connect(skinAction, SIGNAL(triggered()), mapper, SLOT(map())); + skinMenu->addSeparator(); + for (QFileInfoList::const_iterator it = l.begin(); it != l.end(); ++it) { + QString name = (*it).baseName(); // should perhaps be in file + QString file = (*it).filePath(); + skinAction = new QAction(name, parent); + skinActions->addAction(skinAction); + skinMenu->addAction(skinAction); + mapper->setMapping(skinAction, file); + connect(skinAction, SIGNAL(triggered()), mapper, SLOT(map())); + } + //connect(skinActions, SIGNAL(triggered(QAction*)), mapper, SLOT(map(QObject*))); // "incompatible" + connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setSkin(QString))); + + if (flatmenu) flatmenu->addSeparator(); + QMenu *helpMenu = flatmenu ? flatmenu : menu->addMenu(tr("&Help")); - QAction *aboutAction = new QAction(tr("&About Qt..."), this); + QAction *aboutAction = new QAction(tr("&About Qt..."), parent); connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); helpMenu->addAction(aboutAction); - QAction *quitAction = new QAction(tr("&Quit"), this); + QAction *quitAction = new QAction(tr("&Quit"), parent); quitAction->setShortcut(QKeySequence("Ctrl+Q")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); fileMenu->addSeparator(); fileMenu->addAction(quitAction); - } void QmlViewer::takeSnapShot() @@ -217,13 +244,16 @@ void QmlViewer::openQml(const QString& fileName) #endif } -class PreviewDeviceSkin : public DeviceSkin + +class PreviewDeviceSkin : public DeviceSkin { Q_OBJECT public: explicit PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent); void setPreview(QWidget *formWidget); + void setPreviewAndScale(QWidget *formWidget); + void setScreenSize(const QSize& size) { QMatrix fit; @@ -264,6 +294,15 @@ void PreviewDeviceSkin::setPreview(QWidget *formWidget) setView(formWidget); } +void PreviewDeviceSkin::setPreviewAndScale(QWidget *formWidget) +{ + setScreenSize(formWidget->sizeHint()); + formWidget->setFixedSize(formWidget->sizeHint()); + formWidget->setParent(this, Qt::SubWindow); + formWidget->setAutoFillBackground(true); + setView(formWidget); +} + void PreviewDeviceSkin::slotSkinKeyPressEvent(int code, const QString& text, bool autorep) { if (QWidget *focusWidget = QApplication::focusWidget()) { @@ -288,22 +327,43 @@ void PreviewDeviceSkin::slotPopupMenu() void QmlViewer::setSkin(const QString& skinDirectory) { - DeviceSkinParameters parameters; + // XXX QWidget::setMask does not handle changes well, and we may + // XXX have been signalled from an item in a menu we're replacing, + // XXX hence some rather convoluted resetting here... + QString err; - if (parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { - delete skin; + if (skin) { + skin->hide(); + skin->deleteLater(); + } + + DeviceSkinParameters parameters; + if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { + if (menuBar()) + menuBar()->deleteLater(); if (!err.isEmpty()) qWarning() << err; - delete menuBar(); skin = new PreviewDeviceSkin(parameters,this); - skin->setScreenSize(canvas->sizeHint()); - canvas->setParent(skin, Qt::SubWindow); - canvas->setAutoFillBackground(true); - skin->setView(canvas); + skin->setPreviewAndScale(canvas); createMenu(0,skin->menu); - - canvas->show(); + skin->show(); + QApplication::syncX(); + } else { + skin = 0; + clearMask(); + menuBar()->clear(); + canvas->setParent(this, Qt::SubWindow); + createMenu(menuBar(),0); + setMinimumSize(QSize(0,0)); + setMaximumSize(QSize(16777215,16777215)); + QRect g = geometry(); + g.setSize(sizeHint()); + setParent(0,windowFlags()); // recreate + canvas->move(0,menuBar()->sizeHint().height()+1); + setGeometry(g); + show(); } + canvas->show(); } void QmlViewer::setAutoRecord(int from, int to) @@ -335,8 +395,8 @@ void QmlViewer::setRecordPeriod(int ms) void QmlViewer::sceneResized(QSize size) { if (size.width() > 0 && size.height() > 0) { - if (skin) - skin->setScreenSize(size); + //if (skin) + //skin->setScreenSize(size); } } @@ -395,7 +455,6 @@ void QmlViewer::setRecording(bool on) connect(proc, SIGNAL(finished(int)), this, SLOT(ffmpegFinished(int))); frame_stream = proc; -qDebug() << canvas->width() << canvas->height(); QStringList args; args << "-sameq"; // ie. high args << "-y"; diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index 0748de4..8bbe275 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -40,7 +40,6 @@ public: void setRecording(bool on); bool isRecording() const { return recordTimer.isActive(); } void setAutoRecord(int from, int to); - void setSkin(const QString& skinDirectory); void setDeviceKeys(bool); void setCacheEnabled(bool); @@ -55,6 +54,7 @@ public slots: void toggleRecording(); void toggleRecordingWithSelection(); void ffmpegFinished(int code); + void setSkin(const QString& skinDirectory); protected: virtual void keyPressEvent(QKeyEvent *); -- cgit v0.12 From 9861d14de8f77d90a40163298699c86a986b3f6a Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 May 2009 14:14:53 +1000 Subject: Move inside guards --- src/declarative/util/qmlsetproperties.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/declarative/util/qmlsetproperties.h b/src/declarative/util/qmlsetproperties.h index 456b672..f1f59ed 100644 --- a/src/declarative/util/qmlsetproperties.h +++ b/src/declarative/util/qmlsetproperties.h @@ -75,9 +75,8 @@ private: }; QML_DECLARE_TYPE(QmlSetProperties); -#endif // QMLSETPROPERTIES_H - - QT_END_NAMESPACE QT_END_HEADER + +#endif // QMLSETPROPERTIES_H -- cgit v0.12 From 0b36923501e0c5eaf28e25a928cf8aeea11b0062 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 15 May 2009 16:12:34 +1000 Subject: Fix opening new XML when skinned. --- tools/qmlviewer/qmlviewer.cpp | 29 ++++++++++++++++++++++------- tools/qmlviewer/qmlviewer.h | 1 + 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 97e29f1..9bce7ed 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -112,6 +112,9 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) QDir dir(":/skins/","*.skin"); const QFileInfoList l = dir.entryInfoList(); QAction *skinAction = new QAction(tr("None"), parent); + skinAction->setCheckable(true); + if (currentSkin.isEmpty()) + skinAction->setChecked(true); skinActions->addAction(skinAction); skinMenu->addAction(skinAction); mapper->setMapping(skinAction, ""); @@ -123,6 +126,9 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) skinAction = new QAction(name, parent); skinActions->addAction(skinAction); skinMenu->addAction(skinAction); + skinAction->setCheckable(true); + if (file == currentSkin) + skinAction->setChecked(true); mapper->setMapping(skinAction, file); connect(skinAction, SIGNAL(triggered()), mapper, SLOT(map())); } @@ -237,7 +243,10 @@ void QmlViewer::openQml(const QString& fileName) canvas->execute(); qWarning() << "Wall startup time:" << t.elapsed(); - resize(sizeHint()); + canvas->resize(canvas->sizeHint()); + + if (!skin) + resize(sizeHint()); #ifdef QTOPIA show(); @@ -260,6 +269,7 @@ public: fit = fit.scale(qreal(size.width())/m_screenSize.width(), qreal(size.height())/m_screenSize.height()); setTransform(fit); + QApplication::syncX(); } QMenu* menu; @@ -297,7 +307,6 @@ void PreviewDeviceSkin::setPreview(QWidget *formWidget) void PreviewDeviceSkin::setPreviewAndScale(QWidget *formWidget) { setScreenSize(formWidget->sizeHint()); - formWidget->setFixedSize(formWidget->sizeHint()); formWidget->setParent(this, Qt::SubWindow); formWidget->setAutoFillBackground(true); setView(formWidget); @@ -331,6 +340,11 @@ void QmlViewer::setSkin(const QString& skinDirectory) // XXX have been signalled from an item in a menu we're replacing, // XXX hence some rather convoluted resetting here... + if (currentSkin == skinDirectory) + return; + + currentSkin = skinDirectory; + QString err; if (skin) { skin->hide(); @@ -339,15 +353,15 @@ void QmlViewer::setSkin(const QString& skinDirectory) DeviceSkinParameters parameters; if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { - if (menuBar()) - menuBar()->deleteLater(); + layout()->setEnabled(false); + setMenuBar(0); if (!err.isEmpty()) qWarning() << err; skin = new PreviewDeviceSkin(parameters,this); + canvas->resize(canvas->sizeHint()); skin->setPreviewAndScale(canvas); createMenu(0,skin->menu); skin->show(); - QApplication::syncX(); } else { skin = 0; clearMask(); @@ -361,6 +375,7 @@ void QmlViewer::setSkin(const QString& skinDirectory) setParent(0,windowFlags()); // recreate canvas->move(0,menuBar()->sizeHint().height()+1); setGeometry(g); + layout()->setEnabled(true); show(); } canvas->show(); @@ -395,8 +410,8 @@ void QmlViewer::setRecordPeriod(int ms) void QmlViewer::sceneResized(QSize size) { if (size.width() > 0 && size.height() > 0) { - //if (skin) - //skin->setScreenSize(size); + if (skin) + skin->setScreenSize(size); } } diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index 8bbe275..74044b3 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -80,6 +80,7 @@ private: int record_autotime; bool devicemode; QAction *recordAction; + QString currentSkin; QFxTestEngine *testEngine; }; -- cgit v0.12 From 40ae4a41ab449f1d95dbbf2c91ade05cac8348a4 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 May 2009 16:36:30 +1000 Subject: Clip text drawing to bounding rect --- src/declarative/fx/qfxtext.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index a43219d..bc3856d 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -749,7 +749,16 @@ void QFxText::paintContents(QPainter &p) break; } + bool needClip = !clip() && (d->imgCache.width() > width() || + d->imgCache.height() > height()); + + if (needClip) { + p.save(); + p.setClipRect(boundingRect()); + } p.drawImage(x, y, d->imgCache); + if (needClip) + p.restore(); } #elif defined(QFX_RENDER_OPENGL2) -- cgit v0.12 From f3aa702372e749b707ce1d6746dfc2e2aba31306 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 May 2009 17:20:12 +1000 Subject: Move inside the guards --- src/declarative/qml/qmlparser_p.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h index d4f279b..5cc810e 100644 --- a/src/declarative/qml/qmlparser_p.h +++ b/src/declarative/qml/qmlparser_p.h @@ -273,9 +273,8 @@ namespace QmlParser }; } -#endif // QMLPARSER_P_H - - QT_END_NAMESPACE QT_END_HEADER + +#endif // QMLPARSER_P_H -- cgit v0.12 From dc75d22da65984df342809b3c60d41ac08c14459 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 15 May 2009 17:54:47 +1000 Subject: Control resizing of content like QScrollArea::widgetResizable --- src/declarative/util/qfxview.cpp | 65 ++++++++++++++++++++++++++++++++++++---- src/declarative/util/qfxview.h | 2 ++ 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp index 1c24e28..0d5b796 100644 --- a/src/declarative/util/qfxview.cpp +++ b/src/declarative/util/qfxview.cpp @@ -93,7 +93,7 @@ class QFxViewPrivate { public: QFxViewPrivate(QFxView *w) - : q(w), root(0), component(0) {} + : q(w), root(0), component(0), resizable(false) {} QFxView *q; QFxItem *root; @@ -106,6 +106,7 @@ public: QBasicTimer resizetimer; QSize initialSize; + bool resizable; void init(); }; @@ -344,7 +345,18 @@ void QFxView::continueExecute() d->root = item; connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged())); connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged())); - emit sceneResized(QSize(d->root->width(),d->root->height())); + if (d->initialSize.height() <= 0 && d->root->width() > 0) + d->initialSize.setWidth(d->root->width()); + if (d->initialSize.height() <= 0 && d->root->height() > 0) + d->initialSize.setHeight(d->root->height()); + if (d->resizable) { + d->root->setWidth(width()); + d->root->setHeight(height()); + } else { + QSize sz(d->root->width(),d->root->height()); + emit sceneResized(sz); + resize(sz); + } } else if (QWidget *wid = qobject_cast(obj)) { window()->setAttribute(Qt::WA_OpaquePaintEvent, false); window()->setAttribute(Qt::WA_NoSystemBackground, false); @@ -381,14 +393,55 @@ void QFxView::sizeChanged() */ void QFxView::timerEvent(QTimerEvent* e) { - if (e->timerId() == d->resizetimer.timerId()) { - if (d->root) - emit sceneResized(QSize(d->root->width(),d->root->height())); + if (!e || e->timerId() == d->resizetimer.timerId()) { + if (d->root) { + QSize sz(d->root->width(),d->root->height()); + emit sceneResized(sz); + //if (!d->resizable) + //resize(sz); + } d->resizetimer.stop(); updateGeometry(); } } +// modelled on QScrollArea::widgetResizable +/*! + \property QFxView::contentResizable + \brief whether the view should resize the canvas contents + + If this property is set to false (the default), the view + resizes with the root item in the QML. + + If this property is set to true, the view will + automatically resize the root item. + + Regardless of this property, the sizeHint of the view + is the initial size of the root item. +*/ + +void QFxView::setContentResizable(bool on) +{ + if (d->resizable != on) { + d->resizable = on; + if (d->root) { + if (on) { + d->root->setWidth(width()); + d->root->setHeight(height()); + } else { + d->root->setWidth(d->initialSize.width()); + d->root->setHeight(d->initialSize.height()); + } + } + } +} + +bool QFxView::contentResizable() const +{ + return d->resizable; +} + + /*! The size hint is the size of the root item. */ @@ -481,7 +534,7 @@ QFxItem *QFxView::root() const */ void QFxView::resizeEvent(QResizeEvent *e) { - if (d->root) { + if (d->resizable && d->root) { d->root->setWidth(width()); d->root->setHeight(height()); } diff --git a/src/declarative/util/qfxview.h b/src/declarative/util/qfxview.h index d6f786c..8dd9e2c 100644 --- a/src/declarative/util/qfxview.h +++ b/src/declarative/util/qfxview.h @@ -82,6 +82,8 @@ public: virtual QFxItem *root() const; + void setContentResizable(bool); + bool contentResizable() const; QSize sizeHint() const; void dumpRoot(); -- cgit v0.12 From 4fe1dc315385fb8d3ab021b682419312a79c379d Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 15 May 2009 17:55:41 +1000 Subject: Resizing options (scale skin to fit view or reverse) --- tools/qmlviewer/qmlviewer.cpp | 248 ++++++++++++++++++++++++++---------------- tools/qmlviewer/qmlviewer.h | 5 + 2 files changed, 162 insertions(+), 91 deletions(-) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 9bce7ed..97db22e 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -40,8 +40,91 @@ #include #include +class PreviewDeviceSkin : public DeviceSkin +{ + Q_OBJECT +public: + explicit PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent); + + void setPreview(QWidget *formWidget); + void setPreviewAndScale(QWidget *formWidget); + + void setScreenSize(const QSize& size) + { + QMatrix fit; + fit = fit.scale(qreal(size.width())/m_screenSize.width(), + qreal(size.height())/m_screenSize.height()); + setTransform(fit); + QApplication::syncX(); + } + + QSize standardScreenSize() const { return m_screenSize; } + + QMenu* menu; + +private slots: + void slotSkinKeyPressEvent(int code, const QString& text, bool autorep); + void slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep); + void slotPopupMenu(); + +private: + const QSize m_screenSize; +}; + + +PreviewDeviceSkin::PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent) : + DeviceSkin(parameters, parent), + m_screenSize(parameters.screenSize()) +{ + menu = new QMenu(this); + connect(this, SIGNAL(skinKeyPressEvent(int,QString,bool)), + this, SLOT(slotSkinKeyPressEvent(int,QString,bool))); + connect(this, SIGNAL(skinKeyReleaseEvent(int,QString,bool)), + this, SLOT(slotSkinKeyReleaseEvent(int,QString,bool))); + connect(this, SIGNAL(popupMenu()), this, SLOT(slotPopupMenu())); +} + +void PreviewDeviceSkin::setPreview(QWidget *formWidget) +{ + formWidget->setFixedSize(m_screenSize); + formWidget->setParent(this, Qt::SubWindow); + formWidget->setAutoFillBackground(true); + setView(formWidget); +} + +void PreviewDeviceSkin::setPreviewAndScale(QWidget *formWidget) +{ + setScreenSize(formWidget->sizeHint()); + formWidget->setParent(this, Qt::SubWindow); + formWidget->setAutoFillBackground(true); + setView(formWidget); +} + +void PreviewDeviceSkin::slotSkinKeyPressEvent(int code, const QString& text, bool autorep) +{ + if (QWidget *focusWidget = QApplication::focusWidget()) { + QKeyEvent e(QEvent::KeyPress,code,0,text,autorep); + QApplication::sendEvent(focusWidget, &e); + } + +} + +void PreviewDeviceSkin::slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep) +{ + if (QWidget *focusWidget = QApplication::focusWidget()) { + QKeyEvent e(QEvent::KeyRelease,code,0,text,autorep); + QApplication::sendEvent(focusWidget, &e); + } +} + +void PreviewDeviceSkin::slotPopupMenu() +{ + menu->exec(QCursor::pos()); +} + + QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, QWidget *parent, Qt::WindowFlags flags) - : QMainWindow(parent, flags), frame_stream(0) + : QMainWindow(parent, flags), frame_stream(0), scaleSkin(true) { testEngine = 0; devicemode = false; @@ -56,6 +139,8 @@ QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, Q createMenu(menuBar(),0); canvas = new QFxView(this); + canvas->setContentResizable(!skin || !scaleSkin); + if(testMode != QFxTestEngine::NoTest) testEngine = new QFxTestEngine(testMode, testDir, canvas, this); @@ -106,12 +191,29 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) if (flatmenu) flatmenu->addSeparator(); - QActionGroup *skinActions = new QActionGroup(parent); - QSignalMapper *mapper = new QSignalMapper(parent); QMenu *skinMenu = flatmenu ? flatmenu->addMenu(tr("&Skin")) : menu->addMenu(tr("&Skin")); - QDir dir(":/skins/","*.skin"); - const QFileInfoList l = dir.entryInfoList(); - QAction *skinAction = new QAction(tr("None"), parent); + + QActionGroup *skinActions; + QAction *skinAction; + + skinActions = new QActionGroup(parent); + skinAction = new QAction(tr("Scale skin"), parent); + skinAction->setCheckable(true); + skinAction->setChecked(scaleSkin); + skinActions->addAction(skinAction); + skinMenu->addAction(skinAction); + connect(skinAction, SIGNAL(triggered()), this, SLOT(setScaleSkin())); + skinAction = new QAction(tr("Scale view"), parent); + skinAction->setCheckable(true); + skinAction->setChecked(!scaleSkin); + skinActions->addAction(skinAction); + skinMenu->addAction(skinAction); + connect(skinAction, SIGNAL(triggered()), this, SLOT(setScaleView())); + skinMenu->addSeparator(); + + skinActions = new QActionGroup(parent); + QSignalMapper *mapper = new QSignalMapper(parent); + skinAction = new QAction(tr("None"), parent); skinAction->setCheckable(true); if (currentSkin.isEmpty()) skinAction->setChecked(true); @@ -120,6 +222,9 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) mapper->setMapping(skinAction, ""); connect(skinAction, SIGNAL(triggered()), mapper, SLOT(map())); skinMenu->addSeparator(); + + QDir dir(":/skins/","*.skin"); + const QFileInfoList l = dir.entryInfoList(); for (QFileInfoList::const_iterator it = l.begin(); it != l.end(); ++it) { QString name = (*it).baseName(); // should perhaps be in file QString file = (*it).filePath(); @@ -149,6 +254,33 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) fileMenu->addAction(quitAction); } +void QmlViewer::setScaleSkin() +{ + if (scaleSkin) + return; + scaleSkin = true; + canvas->setContentResizable(!skin || !scaleSkin); + if (skin) { + canvas->setFixedSize(canvas->sizeHint()); + skin->setScreenSize(canvas->sizeHint()); + } +} + +void QmlViewer::setScaleView() +{ + if (!scaleSkin) + return; + scaleSkin = false; + if (skin) { + canvas->setContentResizable(!skin || !scaleSkin); + canvas->setMinimumSize(QSize(0,0)); + canvas->setMaximumSize(QSize(16777215,16777215)); + canvas->resize(skin->standardScreenSize()); + skin->setScreenSize(skin->standardScreenSize()); + } +} + + void QmlViewer::takeSnapShot() { static int snapshotcount = 1; @@ -243,10 +375,17 @@ void QmlViewer::openQml(const QString& fileName) canvas->execute(); qWarning() << "Wall startup time:" << t.elapsed(); - canvas->resize(canvas->sizeHint()); - - if (!skin) + if (!skin) { + canvas->resize(canvas->sizeHint()); resize(sizeHint()); + } else { + if (scaleSkin) + canvas->resize(canvas->sizeHint()); + else { + canvas->setFixedSize(skin->standardScreenSize()); + canvas->resize(skin->standardScreenSize()); + } + } #ifdef QTOPIA show(); @@ -254,86 +393,6 @@ void QmlViewer::openQml(const QString& fileName) } -class PreviewDeviceSkin : public DeviceSkin -{ - Q_OBJECT -public: - explicit PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent); - - void setPreview(QWidget *formWidget); - void setPreviewAndScale(QWidget *formWidget); - - void setScreenSize(const QSize& size) - { - QMatrix fit; - fit = fit.scale(qreal(size.width())/m_screenSize.width(), - qreal(size.height())/m_screenSize.height()); - setTransform(fit); - QApplication::syncX(); - } - - QMenu* menu; - -private slots: - void slotSkinKeyPressEvent(int code, const QString& text, bool autorep); - void slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep); - void slotPopupMenu(); - -private: - const QSize m_screenSize; -}; - - -PreviewDeviceSkin::PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent) : - DeviceSkin(parameters, parent), - m_screenSize(parameters.screenSize()) -{ - menu = new QMenu(this); - connect(this, SIGNAL(skinKeyPressEvent(int,QString,bool)), - this, SLOT(slotSkinKeyPressEvent(int,QString,bool))); - connect(this, SIGNAL(skinKeyReleaseEvent(int,QString,bool)), - this, SLOT(slotSkinKeyReleaseEvent(int,QString,bool))); - connect(this, SIGNAL(popupMenu()), this, SLOT(slotPopupMenu())); -} - -void PreviewDeviceSkin::setPreview(QWidget *formWidget) -{ - formWidget->setFixedSize(m_screenSize); - formWidget->setParent(this, Qt::SubWindow); - formWidget->setAutoFillBackground(true); - setView(formWidget); -} - -void PreviewDeviceSkin::setPreviewAndScale(QWidget *formWidget) -{ - setScreenSize(formWidget->sizeHint()); - formWidget->setParent(this, Qt::SubWindow); - formWidget->setAutoFillBackground(true); - setView(formWidget); -} - -void PreviewDeviceSkin::slotSkinKeyPressEvent(int code, const QString& text, bool autorep) -{ - if (QWidget *focusWidget = QApplication::focusWidget()) { - QKeyEvent e(QEvent::KeyPress,code,0,text,autorep); - QApplication::sendEvent(focusWidget, &e); - } - -} - -void PreviewDeviceSkin::slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep) -{ - if (QWidget *focusWidget = QApplication::focusWidget()) { - QKeyEvent e(QEvent::KeyRelease,code,0,text,autorep); - QApplication::sendEvent(focusWidget, &e); - } -} - -void PreviewDeviceSkin::slotPopupMenu() -{ - menu->exec(QCursor::pos()); -} - void QmlViewer::setSkin(const QString& skinDirectory) { // XXX QWidget::setMask does not handle changes well, and we may @@ -351,6 +410,8 @@ void QmlViewer::setSkin(const QString& skinDirectory) skin->deleteLater(); } + canvas->setContentResizable(!skin || !scaleSkin); + DeviceSkinParameters parameters; if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { layout()->setEnabled(false); @@ -359,7 +420,10 @@ void QmlViewer::setSkin(const QString& skinDirectory) qWarning() << err; skin = new PreviewDeviceSkin(parameters,this); canvas->resize(canvas->sizeHint()); - skin->setPreviewAndScale(canvas); + if (scaleSkin) + skin->setPreviewAndScale(canvas); + else + skin->setPreview(canvas); createMenu(0,skin->menu); skin->show(); } else { @@ -370,6 +434,8 @@ void QmlViewer::setSkin(const QString& skinDirectory) createMenu(menuBar(),0); setMinimumSize(QSize(0,0)); setMaximumSize(QSize(16777215,16777215)); + canvas->setMinimumSize(QSize(0,0)); + canvas->setMaximumSize(QSize(16777215,16777215)); QRect g = geometry(); g.setSize(sizeHint()); setParent(0,windowFlags()); // recreate @@ -410,7 +476,7 @@ void QmlViewer::setRecordPeriod(int ms) void QmlViewer::sceneResized(QSize size) { if (size.width() > 0 && size.height() > 0) { - if (skin) + if (skin && scaleSkin) skin->setScreenSize(size); } } diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index 74044b3..09b2b5b 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -62,6 +62,10 @@ protected: void createMenu(QMenuBar *menu, QMenu *flatmenu); +private slots: + void setScaleSkin(); + void setScaleView(); + private: QString currentFileName; PreviewDeviceSkin *skin; @@ -81,6 +85,7 @@ private: bool devicemode; QAction *recordAction; QString currentSkin; + bool scaleSkin; QFxTestEngine *testEngine; }; -- cgit v0.12 From ad679a7993042f1df8da8c2d90d325be3cf0113d Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 15 May 2009 18:51:54 +1000 Subject: Fix syntax error in demos.pro. Reviewed-by: Lincoln Ramsay --- demos/demos.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/demos.pro b/demos/demos.pro index 9248ab8..6084550 100644 --- a/demos/demos.pro +++ b/demos/demos.pro @@ -30,7 +30,7 @@ contains(QT_BUILD_PARTS, tools):{ wince*: SUBDIRS += demos_sqlbrowser } } -contains(QT_CONFIG, phonon)!static:SUBDIRS += demos_mediaplayer +contains(QT_CONFIG, phonon):!static:SUBDIRS += demos_mediaplayer contains(QT_CONFIG, webkit):contains(QT_CONFIG, svg):SUBDIRS += demos_browser # install -- cgit v0.12 From 7c40487dce7c11c93444dc3c74fce84b09901d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Fri, 15 May 2009 11:39:15 +0200 Subject: Make the charts work on internet explorer (tested on IE8) --- tools/qtestlib/chart/benchmark_template.html | 16 +++++++++++++--- tools/qtestlib/chart/reportgenerator.cpp | 3 +-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/qtestlib/chart/benchmark_template.html b/tools/qtestlib/chart/benchmark_template.html index 11efd92..a7e48be 100644 --- a/tools/qtestlib/chart/benchmark_template.html +++ b/tools/qtestlib/chart/benchmark_template.html @@ -108,15 +108,25 @@ function checkform() this.createChart(); } +function createElement(nodeName, name) { + var node; + try { + node = document.createElement("<"+nodeName+" name="+name+">"); + } catch (e) { + node = document.createElement(nodeName); + node.name = name; + } + return node; +} + function createFormSelector(form, value, text, type) { - var selector = document.createElement('input'); - form.appendChild(selector); + var selector = createElement('input', 'list'); selector.type = type; - selector.name = 'list'; selector.defaultChecked = true; selector.value = value; + form.appendChild(selector); form.appendChild(document.createTextNode(text)); form.appendChild(document.createElement("BR")); } diff --git a/tools/qtestlib/chart/reportgenerator.cpp b/tools/qtestlib/chart/reportgenerator.cpp index bf5bf94..94661ba 100644 --- a/tools/qtestlib/chart/reportgenerator.cpp +++ b/tools/qtestlib/chart/reportgenerator.cpp @@ -253,7 +253,7 @@ QByteArray printSeriesLabels(const QString &tableName, const QString &seriesColu output += "["; foreach(const QString &serie, series) { - output += "\"" + serie.toLocal8Bit() + "\", "; + output += "\"" + serie.toLocal8Bit() + "\","; } output.chop(1); //remove last comma output += "]\n"; @@ -446,7 +446,6 @@ void ReportGenerator::writeReports() } */ writeReport("Results", "results.html", false); - qDebug() << "Supported browsers: Firefox, Safari, Opera, Qt Demo Browser (IE and KDE 3 Konqueror are not supported)"; } QString ReportGenerator::fileName() -- cgit v0.12 From 9c3f5040bc9b80619ebe167c352ac8f0394f9b41 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Fri, 15 May 2009 11:43:09 +0200 Subject: Cleaning bug in custom layout example. The example was using deleteAllItems() to delete items from the layout. This method is now part of the QT3_SUPPORT and shold not be used if not needed. Replaced by deleting all items one by one. Task-number: 220656 Rev-by: janarve --- doc/src/layout.qdoc | 6 +++--- doc/src/snippets/code/doc_src_layout.qdoc | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/src/layout.qdoc b/doc/src/layout.qdoc index 196999b..d97fcfc 100644 --- a/doc/src/layout.qdoc +++ b/doc/src/layout.qdoc @@ -343,9 +343,9 @@ \snippet doc/src/snippets/code/doc_src_layout.qdoc 4 The layout takes over responsibility of the items added. Since QLayoutItem - does not inherit QObject, we must delete the items manually. The function - QLayout::deleteAllItems() uses \c{takeAt()} defined above to delete all the - items in the layout. + does not inherit QObject, we must delete the items manually. In the + destructor, we remove each item from the list using \c{takeAt()}, and + then delete it. \snippet doc/src/snippets/code/doc_src_layout.qdoc 5 diff --git a/doc/src/snippets/code/doc_src_layout.qdoc b/doc/src/snippets/code/doc_src_layout.qdoc index fedcf0c..60f36b0 100644 --- a/doc/src/snippets/code/doc_src_layout.qdoc +++ b/doc/src/snippets/code/doc_src_layout.qdoc @@ -67,7 +67,9 @@ void CardLayout::addItem(QLayoutItem *item) //! [5] CardLayout::~CardLayout() { - deleteAllItems(); + QLayoutItem *item; + while ((item = takeAt(0))) + delete item; } //! [5] @@ -121,4 +123,4 @@ QSize CardLayout::minimumSize() const } return s + n*QSize(spacing(), spacing()); } -//! [7] \ No newline at end of file +//! [7] -- cgit v0.12 From 92ff29b161709f4503d628e468c0eec1daf5835a Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 14 May 2009 17:16:11 +0200 Subject: Indentation and whitespace fixes in animation api --- src/corelib/animation/qparallelanimationgroup.cpp | 2 +- src/corelib/animation/qpauseanimation.cpp | 2 +- src/corelib/animation/qpropertyanimation.cpp | 4 ++-- src/corelib/animation/qpropertyanimation_p.h | 1 - src/corelib/animation/qvariantanimation.cpp | 14 ++++++-------- tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp | 4 ++-- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index e4bce6a..48c8b3e 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -62,7 +62,7 @@ group->start(); \endcode - + In this example, \c anim1 and \c anim2 are two \l{QPropertyAnimation}s that have already been set up. diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp index 685fa98..c853745 100644 --- a/src/corelib/animation/qpauseanimation.cpp +++ b/src/corelib/animation/qpauseanimation.cpp @@ -52,7 +52,7 @@ \l{QAbstractAnimation::finished()}{finish} before a specified number of milliseconds have elapsed from when it was started. You specify the duration of the pause in the constructor. It can also - be set directly with setDuration(). + be set directly with setDuration(). It is not necessary to construct a QPauseAnimation yourself. QSequentialAnimationGroup provides the convenience functions diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index 96cfa6b..1755aa7 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -48,14 +48,14 @@ QPropertyAnimation interpolates over \l{Qt's Property System}{Qt properties}. As property values are stored in \l{QVariant}s, the class inherits QVariantAnimation, and supports animation of the - same \l{QVariant::Type}{variant types} as its super class. + same \l{QVariant::Type}{variant types} as its super class. A class declaring properties must be a QObject. To make it possible to animate a property, it must provide a setter (so that QPropertyAnimation can set the property's value). Note that this makes it possible to animate many of Qt's widgets. Let's look at an example: - + \code QPropertyAnimation animation(myWidget, "geometry"); animation.setDuration(10000); diff --git a/src/corelib/animation/qpropertyanimation_p.h b/src/corelib/animation/qpropertyanimation_p.h index ed3666d..9d9dd31 100644 --- a/src/corelib/animation/qpropertyanimation_p.h +++ b/src/corelib/animation/qpropertyanimation_p.h @@ -70,7 +70,6 @@ public: { } - QPointer target; //for the QProperty diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index 73ed0df..58f0e03 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -72,7 +72,7 @@ QT_BEGIN_NAMESPACE animates Qt \l{Qt's Property System}{properties}. See the QPropertyAnimation class description if you wish to animate such properties. - + You can then set start and end values for the property by calling setStartValue() and setEndValue(), and finally call start() to start the animation. QVariantAnimation will interpolate the @@ -111,12 +111,12 @@ QT_BEGIN_NAMESPACE \o \l{QMetaType::}{QSizeF} \o \l{QMetaType::}{QRect} \o \l{QMetaType::}{QRectF} - \endlist + \endlist If you need to interpolate other variant types, including custom types, you have to implement interpolation for these yourself. You do this by reimplementing interpolated(), which returns - interpolation values for the value being interpolated. + interpolation values for the value being interpolated. \omit We need some snippets around here. \endomit @@ -152,7 +152,7 @@ template<> Q_INLINE_TEMPLATE QRectF _q_interpolate(const QRectF &f, const QRectF f.getRect(&x1, &y1, &w1, &h1); qreal x2, y2, w2, h2; t.getRect(&x2, &y2, &w2, &h2); - return QRectF( _q_interpolate(x1, x2, progress), _q_interpolate(y1, y2, progress), + return QRectF(_q_interpolate(x1, x2, progress), _q_interpolate(y1, y2, progress), _q_interpolate(w1, w2, progress), _q_interpolate(h1, h2, progress)); } @@ -227,11 +227,10 @@ void QVariantAnimationPrivate::updateCurrentValue() #endif if (currentValue != ret) { //the value has changed - emit q->valueChanged(currentValue); + emit q->valueChanged(currentValue); } } - QVariant QVariantAnimationPrivate::valueAt(qreal step) const { QVariantAnimation::KeyValues::const_iterator result = @@ -242,7 +241,6 @@ QVariant QVariantAnimationPrivate::valueAt(qreal step) const return QVariant(); } - void QVariantAnimationPrivate::setValueAt(qreal step, const QVariant &value) { if (step < qreal(0.0) || step > qreal(1.0)) { @@ -587,7 +585,7 @@ bool QVariantAnimation::event(QEvent *event) \reimp */ void QVariantAnimation::updateState(QAbstractAnimation::State oldState, - QAbstractAnimation::State newState) + QAbstractAnimation::State newState) { Q_UNUSED(oldState); Q_UNUSED(newState); diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index 2e5fd00..172950f 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -794,9 +794,9 @@ void tst_QPropertyAnimation::operationsInStates() * | pause() |start() |resume() |stop() * ----------+------------+-----------+-----------+-------------------+ * Stopped | Stopped |Running |Stopped |Stopped | - * _| qWarning | |qWarning |- | + * _| qWarning |restart |qWarning | | * Paused | Paused |Running |Running |Stopped | - * _| - | | | | + * _| | | | | * Running | Paused |Running |Running |Stopped | * | |restart |qWarning | | * ----------+------------+-----------+-----------+-------------------+ -- cgit v0.12 From 9227f6249de0e60a2a428549848c875c01dbf4d2 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 14 May 2009 17:52:09 +0200 Subject: Avoid interpolating if we have less than 2 key values in QVariantAnimation If we have less than 2 key values, we should neither try to interpolate nor set the current value. Reviewed-by: janarve --- src/corelib/animation/qvariantanimation.cpp | 14 +++++++--- .../qpropertyanimation/tst_qpropertyanimation.cpp | 31 ++++++++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index 58f0e03..fbce917 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -186,12 +186,20 @@ void QVariantAnimationPrivate::convertValues(int t) void QVariantAnimationPrivate::updateCurrentValue() { + // can't interpolate if we have only 1 key value + if (keyValues.count() <= 1) + return; + Q_Q(QVariantAnimation); + const qreal progress = easing.valueForProgress(((duration == 0) ? qreal(1) : qreal(currentTime) / qreal(duration))); if (progress < currentInterval.start.first || progress > currentInterval.end.first) { //let's update currentInterval - QVariantAnimation::KeyValues::const_iterator itStart = qLowerBound(keyValues.constBegin(), keyValues.constEnd(), qMakePair(progress, QVariant()), animationValueLessThan); + QVariantAnimation::KeyValues::const_iterator itStart = qLowerBound(keyValues.constBegin(), + keyValues.constEnd(), + qMakePair(progress, QVariant()), + animationValueLessThan); QVariantAnimation::KeyValues::const_iterator itEnd = itStart; // If we are at the end we should continue to use the last keyValues in case of extrapolation (progress > 1.0). @@ -199,10 +207,8 @@ void QVariantAnimationPrivate::updateCurrentValue() if (itStart != keyValues.constEnd()) { //this can't happen because we always prepend the default start value there - if (itStart == keyValues.begin()) { + if (itStart == keyValues.constBegin()) { ++itEnd; - if (itEnd == keyValues.constEnd()) - return; //there is no upper bound } else { --itStart; } diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index 172950f..c753477 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -95,6 +95,7 @@ private slots: void zeroDurationStart(); void operationsInStates_data(); void operationsInStates(); + void oneKeyValue(); }; tst_QPropertyAnimation::tst_QPropertyAnimation() @@ -850,5 +851,35 @@ void tst_QPropertyAnimation::operationsInStates() #undef Resume #undef Stop +void tst_QPropertyAnimation::oneKeyValue() +{ + QObject o; + o.setProperty("ole", 42); + QCOMPARE(o.property("ole").toInt(), 42); + + QPropertyAnimation animation(&o, "ole"); + animation.setStartValue(43); + animation.setEndValue(44); + animation.setDuration(100); + + animation.setCurrentTime(0); + + QVERIFY(animation.currentValue().isValid()); + QCOMPARE(animation.currentValue().toInt(), 43); + QCOMPARE(o.property("ole").toInt(), 42); + + // remove the last key value + animation.setKeyValueAt(1.0, QVariant()); + + // we will neither interpolate, nor update the current value + // since there is only one 1 key value defined + animation.setCurrentTime(100); + + // the animation should not have been modified + QVERIFY(animation.currentValue().isValid()); + QCOMPARE(animation.currentValue().toInt(), 43); + QCOMPARE(o.property("ole").toInt(), 42); +} + QTEST_MAIN(tst_QPropertyAnimation) #include "tst_qpropertyanimation.moc" -- cgit v0.12 From 4f07fd724a7cc763d57f4b2e23d407b820bb8880 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Fri, 15 May 2009 12:40:00 +0200 Subject: Update current value on QVariantAnimation::setKeyValues The current value was udpated on setKeyValueAt, but not on setKeyValues and this was leading to a semantic inconsistency. Reviewed-by: janarve --- src/corelib/animation/qvariantanimation.cpp | 1 + .../qpropertyanimation/tst_qpropertyanimation.cpp | 34 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index fbce917..cad9341 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -550,6 +550,7 @@ void QVariantAnimation::setKeyValues(const KeyValues &keyValues) d->keyValues = keyValues; qSort(d->keyValues.begin(), d->keyValues.end(), animationValueLessThan); d->currentInterval.start.first = 2; // this will force the refresh + d->updateCurrentValue(); d->hasStartValue = !d->keyValues.isEmpty() && d->keyValues.at(0).first == 0; } diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index c753477..7e910d4 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -42,6 +42,7 @@ #include #include +#include #include //TESTED_CLASS=QPropertyAnimation @@ -96,6 +97,7 @@ private slots: void operationsInStates_data(); void operationsInStates(); void oneKeyValue(); + void updateOnSetKeyValues(); }; tst_QPropertyAnimation::tst_QPropertyAnimation() @@ -881,5 +883,37 @@ void tst_QPropertyAnimation::oneKeyValue() QCOMPARE(o.property("ole").toInt(), 42); } +void tst_QPropertyAnimation::updateOnSetKeyValues() +{ + QObject o; + o.setProperty("ole", 100); + QCOMPARE(o.property("ole").toInt(), 100); + + QPropertyAnimation animation(&o, "ole"); + animation.setStartValue(100); + animation.setEndValue(200); + animation.setDuration(100); + + animation.setCurrentTime(50); + QCOMPARE(animation.currentValue().toInt(), 150); + animation.setKeyValueAt(0.0, 300); + QCOMPARE(animation.currentValue().toInt(), 250); + + o.setProperty("ole", 100); + QPropertyAnimation animation2(&o, "ole"); + QVariantAnimation::KeyValues kValues; + kValues << QVariantAnimation::KeyValue(0.0, 100) << QVariantAnimation::KeyValue(1.0, 200); + animation2.setKeyValues(kValues); + animation2.setDuration(100); + animation2.setCurrentTime(50); + QCOMPARE(animation2.currentValue().toInt(), 150); + + kValues.clear(); + kValues << QVariantAnimation::KeyValue(0.0, 300) << QVariantAnimation::KeyValue(1.0, 200); + animation2.setKeyValues(kValues); + + QCOMPARE(animation2.currentValue().toInt(), animation.currentValue().toInt()); +} + QTEST_MAIN(tst_QPropertyAnimation) #include "tst_qpropertyanimation.moc" -- cgit v0.12 From a90608bb1827493da578cf9ad41415fc8a7f6e65 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Fri, 15 May 2009 13:31:57 +0200 Subject: General refactors in QVariantAnimation Reviewed-by: janarve --- src/corelib/animation/qvariantanimation.cpp | 58 ++++++++++++++++------------- src/corelib/animation/qvariantanimation_p.h | 4 +- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index cad9341..9b62356 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -174,27 +174,24 @@ void QVariantAnimationPrivate::convertValues(int t) if (pair.second.userType() != t) pair.second.convert(static_cast(t)); } - currentInterval.start.first = 2; // this will force the refresh - interpolator = 0; // if the type changed we need to update the interpolator + interpolator = 0; // if the type changed we need to update the interpolator } /*! - \fn void QVariantAnimation::updateCurrentValue(const QVariant &value) = 0; - This pure virtual function is called when the animated value is changed. - \a value is the new value. + \internal + The goal of this function is to update the currentInterval member. As a consequence, we also + need to update the currentValue. + Set \a force to true to always recalculate the interval. */ - -void QVariantAnimationPrivate::updateCurrentValue() +void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/) { // can't interpolate if we have only 1 key value if (keyValues.count() <= 1) return; - Q_Q(QVariantAnimation); - const qreal progress = easing.valueForProgress(((duration == 0) ? qreal(1) : qreal(currentTime) / qreal(duration))); - if (progress < currentInterval.start.first || progress > currentInterval.end.first) { + if (force || progress < currentInterval.start.first || progress > currentInterval.end.first) { //let's update currentInterval QVariantAnimation::KeyValues::const_iterator itStart = qLowerBound(keyValues.constBegin(), keyValues.constEnd(), @@ -205,22 +202,33 @@ void QVariantAnimationPrivate::updateCurrentValue() // If we are at the end we should continue to use the last keyValues in case of extrapolation (progress > 1.0). // This is because the easing function can return a value slightly outside the range [0, 1] if (itStart != keyValues.constEnd()) { - - //this can't happen because we always prepend the default start value there + // this can't happen because we always prepend the default start value there if (itStart == keyValues.constBegin()) { ++itEnd; } else { --itStart; } - //update all the values of the currentInterval + // update all the values of the currentInterval currentInterval.start = *itStart; currentInterval.end = *itEnd; } } + setCurrentValueForProgress(progress); +} + +void QVariantAnimationPrivate::setCurrentValue() +{ + const qreal progress = easing.valueForProgress(((duration == 0) ? qreal(1) : qreal(currentTime) / qreal(duration))); + setCurrentValueForProgress(progress); +} + +void QVariantAnimationPrivate::setCurrentValueForProgress(const qreal progress) +{ + Q_Q(QVariantAnimation); - const qreal startProgress = currentInterval.start.first, - endProgress = currentInterval.end.first; + const qreal startProgress = currentInterval.start.first; + const qreal endProgress = currentInterval.end.first; const qreal localProgress = (progress - startProgress) / (endProgress - startProgress); QVariant ret = q->interpolated(currentInterval.start.second, @@ -261,15 +269,14 @@ void QVariantAnimationPrivate::setValueAt(qreal step, const QVariant &value) keyValues.insert(result, pair); } else { if (value.isValid()) - result->second = value; //remove the previous value + result->second = value; // replaces the previous value else if (step == 0 && !hasStartValue && defaultStartValue.isValid()) - result->second = defaultStartValue; //we reset to the default start value + result->second = defaultStartValue; // resets to the default start value else - keyValues.erase(result); //replace the previous value + keyValues.erase(result); // removes the previous value } - currentInterval.start.first = 2; // this will force the refresh - updateCurrentValue(); + recalculateCurrentInterval(/*force=*/true); } void QVariantAnimationPrivate::setDefaultStartValue(const QVariant &value) @@ -328,7 +335,7 @@ void QVariantAnimation::setEasingCurve(const QEasingCurve &easing) { Q_D(QVariantAnimation); d->easing = easing; - d->updateCurrentValue(); + d->recalculateCurrentInterval(); } Q_GLOBAL_STATIC(QVector, registeredInterpolators) @@ -439,7 +446,7 @@ void QVariantAnimation::setDuration(int msecs) if (d->duration == msecs) return; d->duration = msecs; - d->updateCurrentValue(); + d->recalculateCurrentInterval(); } /*! @@ -549,9 +556,8 @@ void QVariantAnimation::setKeyValues(const KeyValues &keyValues) Q_D(QVariantAnimation); d->keyValues = keyValues; qSort(d->keyValues.begin(), d->keyValues.end(), animationValueLessThan); - d->currentInterval.start.first = 2; // this will force the refresh - d->updateCurrentValue(); d->hasStartValue = !d->keyValues.isEmpty() && d->keyValues.at(0).first == 0; + d->recalculateCurrentInterval(/*force=*/true); } /*! @@ -576,7 +582,7 @@ QVariant QVariantAnimation::currentValue() const { Q_D(const QVariantAnimation); if (!d->currentValue.isValid()) - const_cast(d)->updateCurrentValue(); + const_cast(d)->recalculateCurrentInterval(); return d->currentValue; } @@ -640,7 +646,7 @@ void QVariantAnimation::updateCurrentTime(int msecs) { Q_D(QVariantAnimation); Q_UNUSED(msecs); - d->updateCurrentValue(); + d->recalculateCurrentInterval(); } QT_END_NAMESPACE diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h index 14a3ef6..9e81649 100644 --- a/src/corelib/animation/qvariantanimation_p.h +++ b/src/corelib/animation/qvariantanimation_p.h @@ -108,7 +108,9 @@ public: quint32 changedSignalMask; - void updateCurrentValue(); + void setCurrentValue(); + void setCurrentValueForProgress(const qreal progress); + void recalculateCurrentInterval(bool force=false); void setValueAt(qreal, const QVariant &); QVariant valueAt(qreal step) const; void convertValues(int t); -- cgit v0.12 From d216c0fd62a879fd1eb84e087f70c7f542d75d58 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 14 May 2009 11:21:25 +0200 Subject: HTTP authentication: return error if authentication cannot be handled return error upon receiving an unknown authentication method (e.g. WSSE); before we were just silently returning. Reviewed-by: Thiago Macieira --- src/network/access/qhttpnetworkconnection.cpp | 20 +++++++--- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 52 ++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index f558f2b..ae518df 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -643,10 +643,21 @@ void QHttpNetworkConnectionPrivate::handleStatus(QAbstractSocket *socket, QHttpN switch (statusCode) { case 401: case 407: - handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend); - if (resend) { - eraseData(reply); - sendRequest(socket); + if (handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend)) { + if (resend) { + eraseData(reply); + sendRequest(socket); + } + } else { + int i = indexOf(socket); + emit channels[i].reply->headerChanged(); + emit channels[i].reply->readyRead(); + QNetworkReply::NetworkError errorCode = (statusCode == 407) + ? QNetworkReply::ProxyAuthenticationRequiredError + : QNetworkReply::AuthenticationRequiredError; + reply->d_func()->errorString = errorDetail(errorCode, socket); + emit q->error(errorCode, reply->d_func()->errorString); + emit channels[i].reply->finished(); } break; default: @@ -749,7 +760,6 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket // authentication is cancelled, send the current contents to the user. emit channels[i].reply->headerChanged(); emit channels[i].reply->readyRead(); - emit channels[i].reply->finished(); QNetworkReply::NetworkError errorCode = isProxy ? QNetworkReply::ProxyAuthenticationRequiredError diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 4be0863..bb199b9 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -217,6 +217,8 @@ private Q_SLOTS: void httpProxyCommands_data(); void httpProxyCommands(); void proxyChange(); + void authorizationError_data(); + void authorizationError(); }; QT_BEGIN_NAMESPACE @@ -3012,5 +3014,55 @@ void tst_QNetworkReply::proxyChange() QVERIFY(int(reply3->error()) > 0); } +void tst_QNetworkReply::authorizationError_data() +{ + + QTest::addColumn("url"); + QTest::addColumn("errorSignalCount"); + QTest::addColumn("finishedSignalCount"); + QTest::addColumn("error"); + QTest::addColumn("httpStatusCode"); + QTest::addColumn("httpBody"); + + QTest::newRow("unknown-authorization-method") << "http://" + QtNetworkSettings::serverName() + + "/cgi-bin/http-unknown-authentication-method.cgi?401-authorization-required" << 1 << 1 + << int(QNetworkReply::AuthenticationRequiredError) << 401 << "authorization required"; + QTest::newRow("unknown-proxy-authorization-method") << "http://" + QtNetworkSettings::serverName() + + "/cgi-bin/http-unknown-authentication-method.cgi?407-proxy-authorization-required" << 1 << 1 + << int(QNetworkReply::ProxyAuthenticationRequiredError) << 407 + << "authorization required"; +} + +void tst_QNetworkReply::authorizationError() +{ + QFETCH(QString, url); + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.get(request); + + QCOMPARE(reply->error(), QNetworkReply::NoError); + + qRegisterMetaType("QNetworkReply::NetworkError"); + QSignalSpy errorSpy(reply, SIGNAL(error(QNetworkReply::NetworkError))); + QSignalSpy finishedSpy(reply, SIGNAL(finished())); + // now run the request: + connect(reply, SIGNAL(finished()), + &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QFETCH(int, errorSignalCount); + QCOMPARE(errorSpy.count(), errorSignalCount); + QFETCH(int, finishedSignalCount); + QCOMPARE(finishedSpy.count(), finishedSignalCount); + QFETCH(int, error); + QCOMPARE(reply->error(), QNetworkReply::NetworkError(error)); + + QFETCH(int, httpStatusCode); + QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), httpStatusCode); + + QFETCH(QString, httpBody); + QCOMPARE(QString(reply->readAll()), httpBody); +} + QTEST_MAIN(tst_QNetworkReply) #include "tst_qnetworkreply.moc" -- cgit v0.12 From 3e280a737607821feeed391d7881baae33f9dcfe Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Fri, 15 May 2009 13:35:58 +0200 Subject: Avoid resetting the QVariantAnimation::currentValue when changing state Reviewed-by: janarve --- src/corelib/animation/qvariantanimation.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index 9b62356..157a321 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -602,8 +602,6 @@ void QVariantAnimation::updateState(QAbstractAnimation::State oldState, { Q_UNUSED(oldState); Q_UNUSED(newState); - Q_D(QVariantAnimation); - d->currentValue = QVariant(); // this will force the refresh } /*! -- cgit v0.12 From 3875cd2b0a81c190939ea2803a2efbe890ae38ec Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 15 May 2009 14:53:23 +0200 Subject: Cocoa: Window flickers when resized with a QTabWidget Seems like we were not using the correct functions for setting the max/min size on a cocoa window. The version we used before included the unified toolbar, which is wrong. The new one does not. Task-number: 252642 Reviewed-by: Trenton Schulz --- src/gui/kernel/qwidget_mac.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 0e021dc..f863428 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4035,8 +4035,8 @@ void QWidgetPrivate::applyMaxAndMinSizeOnWindow() NSSize max = NSMakeSize(SF(extra->maxw), SF(extra->maxh)); NSSize min = NSMakeSize(SF(extra->minw), SF(extra->minh)); #undef SF - [qt_mac_window_for(q) setMinSize:min]; - [qt_mac_window_for(q) setMaxSize:max]; + [qt_mac_window_for(q) setContentMinSize:min]; + [qt_mac_window_for(q) setContentMaxSize:max]; #endif } -- cgit v0.12 From 5be67ef5ad9b2f6020ffe47eecc9fd3338957bb7 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 May 2009 22:56:21 +1000 Subject: Implement SetProperties as a custom parser This will allow us to remove all "Assign*" style instructions from the QML compiler and have it depend only on static data. --- src/declarative/qml/qmlcustomparser.cpp | 28 +-- src/declarative/qml/qmlcustomparser_p.h | 2 + src/declarative/qml/qmlparser_p.h | 1 + src/declarative/util/qmllistmodel.cpp | 6 +- src/declarative/util/qmlsetproperties.cpp | 314 +++++++++++++++++++----------- src/declarative/util/qmlsetproperties.h | 10 +- 6 files changed, 228 insertions(+), 133 deletions(-) diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qmlcustomparser.cpp index e864df9..a60f783 100644 --- a/src/declarative/qml/qmlcustomparser.cpp +++ b/src/declarative/qml/qmlcustomparser.cpp @@ -120,6 +120,7 @@ QmlCustomParserNodePrivate::fromObject(QmlParser::Object *root) return rootNode; } +#include QmlCustomParserProperty QmlCustomParserNodePrivate::fromProperty(QmlParser::Property *p) { @@ -127,20 +128,23 @@ QmlCustomParserNodePrivate::fromProperty(QmlParser::Property *p) prop.d->name = p->name; prop.d->isList = (p->values.count() > 1); - for(int ii = 0; ii < p->values.count(); ++ii) { - Value *v = p->values.at(ii); + if (p->value) { + QmlCustomParserNode node = fromObject(p->value); + QList props = node.properties(); + for (int ii = 0; ii < props.count(); ++ii) + prop.d->values << QVariant::fromValue(props.at(ii)); + } else { + for(int ii = 0; ii < p->values.count(); ++ii) { + Value *v = p->values.at(ii); + + if(v->object) { + QmlCustomParserNode node = fromObject(v->object); + prop.d->values << QVariant::fromValue(node); + } else { + prop.d->values << QVariant::fromValue(v->value); + } - // We skip fetched properties for now - if(v->object && v->object->type == -1) - continue; - - if(v->object) { - QmlCustomParserNode node = fromObject(v->object); - prop.d->values << QVariant::fromValue(node); - } else { - prop.d->values << QVariant::fromValue(v->primitive()); } - } return prop; diff --git a/src/declarative/qml/qmlcustomparser_p.h b/src/declarative/qml/qmlcustomparser_p.h index e4e6089..fd780d6 100644 --- a/src/declarative/qml/qmlcustomparser_p.h +++ b/src/declarative/qml/qmlcustomparser_p.h @@ -65,6 +65,8 @@ public: QByteArray name() const; bool isList() const; + // Will be one of QmlParser::Variant, QmlCustomParserProperty or + // QmlCustomParserNode QList assignedValues() const; private: diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h index 5cc810e..95b21e6 100644 --- a/src/declarative/qml/qmlparser_p.h +++ b/src/declarative/qml/qmlparser_p.h @@ -272,6 +272,7 @@ namespace QmlParser void dump(int = 0) const; }; } +Q_DECLARE_METATYPE(QmlParser::Variant); QT_END_NAMESPACE diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index 8184bda..80eb9c3 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include "qmlopenmetaobject.h" #include #include @@ -414,8 +415,11 @@ bool ListModelParser::compileProperty(const QmlCustomParserProperty &prop, QList } else { + QmlParser::Variant variant = + qvariant_cast(value); + int ref = data.count(); - QByteArray d = value.toString().toLatin1(); + QByteArray d = variant.asScript().toLatin1(); d.append('\0'); data.append(d); diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp index 9b5a58e..9a1095c 100644 --- a/src/declarative/util/qmlsetproperties.cpp +++ b/src/declarative/util/qmlsetproperties.cpp @@ -44,61 +44,12 @@ #include "qmlsetproperties.h" #include #include +#include +#include +#include QT_BEGIN_NAMESPACE -class QmlSetPropertiesMetaObject : public QmlOpenMetaObject -{ -public: - QmlSetPropertiesMetaObject(QObject *); - -protected: - virtual void propertyRead(int); - virtual void propertyWrite(int); -}; - -class QmlSetPropertiesProxyObject : public QObject -{ -Q_OBJECT -public: - QmlSetPropertiesProxyObject(QObject *); - - QmlSetPropertiesMetaObject *fxMetaObject() const { return _mo; } -private: - QmlSetPropertiesMetaObject *_mo; -}; - -QmlSetPropertiesProxyObject::QmlSetPropertiesProxyObject(QObject *parent) -: QObject(parent), _mo(new QmlSetPropertiesMetaObject(this)) -{ -} - -QmlSetPropertiesMetaObject::QmlSetPropertiesMetaObject(QObject *obj) -: QmlOpenMetaObject(obj) -{ -} - -void QmlSetPropertiesMetaObject::propertyRead(int id) -{ - if (!value(id).isValid()) - setValue(id, QVariant::fromValue((QObject *)new QmlSetPropertiesProxyObject(object()))); - - QmlOpenMetaObject::propertyRead(id); -} - -void QmlSetPropertiesMetaObject::propertyWrite(int id) -{ - if (value(id).userType() == qMetaTypeId()) { - QObject *val = qvariant_cast(value(id)); - QmlSetPropertiesProxyObject *proxy = qobject_cast(val); - if (proxy) { - setValue(id, QVariant()); - delete proxy; - } - } - QmlOpenMetaObject::propertyWrite(id); -} - /*! \qmlclass SetProperties QmlSetProperties \brief The SetProperties element describes new property values for a state. @@ -149,109 +100,248 @@ void QmlSetPropertiesMetaObject::propertyWrite(int id) \sa QmlSetProperty */ +/*! + \qmlproperty Object SetProperties::target + This property holds the object that the properties to change belong to +*/ + +/*! + \property QmlSetProperties::target + \brief the object that the properties to change belong to +*/ class QmlSetPropertiesPrivate : public QObjectPrivate { + Q_DECLARE_PUBLIC(QmlSetProperties) public: - QmlSetPropertiesPrivate() : obj(0), mo(0) {} + QmlSetPropertiesPrivate() : object(0), decoded(true) {} - QObject *obj; - QmlSetPropertiesMetaObject *mo; + QObject *object; + QByteArray data; + bool decoded; + void decode(); + + QList > properties; + QList > expressions; + + QmlMetaProperty property(const QByteArray &); }; -QML_DEFINE_TYPE(QmlSetProperties,SetProperties); -QmlSetProperties::QmlSetProperties() - : QmlStateOperation(*(new QmlSetPropertiesPrivate)) +class QmlSetPropertiesParser : public QmlCustomParser { - Q_D(QmlSetProperties); - d->mo = new QmlSetPropertiesMetaObject(this); +public: + void compileList(QList > &list, const QByteArray &pre, const QmlCustomParserProperty &prop); + + virtual QByteArray compile(const QList &, bool *ok); + virtual void setCustomData(QObject *, const QByteArray &); +}; + +void +QmlSetPropertiesParser::compileList(QList > &list, + const QByteArray &pre, + const QmlCustomParserProperty &prop) +{ + QByteArray propName = pre + prop.name(); + + QList values = prop.assignedValues(); + for (int ii = 0; ii < values.count(); ++ii) { + const QVariant &value = values.at(ii); + + if (value.userType() == qMetaTypeId()) { + continue; + } else if(value.userType() == qMetaTypeId()) { + + QmlCustomParserProperty prop = + qvariant_cast(value); + QByteArray pre = propName + "."; + compileList(list, pre, prop); + + } else { + list << qMakePair(propName, value); + } + } } -QmlSetProperties::QmlSetProperties(QObject *parent) - : QmlStateOperation(*(new QmlSetPropertiesPrivate), parent) +QByteArray +QmlSetPropertiesParser::compile(const QList &props, + bool *ok) { - Q_D(QmlSetProperties); - d->mo = new QmlSetPropertiesMetaObject(this); + *ok = true; + + QList > data; + for(int ii = 0; ii < props.count(); ++ii) + compileList(data, QByteArray(), props.at(ii)); + + QByteArray rv; + QDataStream ds(&rv, QIODevice::WriteOnly); + + ds << data.count(); + for(int ii = 0; ii < data.count(); ++ii) { + QmlParser::Variant v = qvariant_cast(data.at(ii).second); + QVariant var; + bool isScript = v.isScript(); + switch(v.type()) { + case QmlParser::Variant::Boolean: + var = QVariant(v.asBoolean()); + break; + case QmlParser::Variant::Number: + var = QVariant(v.asNumber()); + break; + case QmlParser::Variant::String: + var = QVariant(v.asString()); + break; + case QmlParser::Variant::Invalid: + case QmlParser::Variant::Script: + var = QVariant(v.asScript()); + break; + } + + ds << data.at(ii).first << isScript << var; + } + + return rv; } -QmlSetProperties::~QmlSetProperties() +void QmlSetPropertiesPrivate::decode() { + if (decoded) + return; + + QDataStream ds(&data, QIODevice::ReadOnly); + + int count; + ds >> count; + for (int ii = 0; ii < count; ++ii) { + QByteArray name; + bool isScript; + QVariant data; + ds >> name; + ds >> isScript; + ds >> data; + + if (isScript) { + QmlExpression *expression = new QmlExpression(qmlContext(object), data.toString(), object); + expression->setTrackChange(false); + expressions << qMakePair(name, expression); + } else { + properties << qMakePair(name, data); + } + } + + decoded = true; + data.clear(); } -/*! - \qmlproperty Object SetProperties::target - This property holds the object that the properties to change belong to -*/ +void QmlSetPropertiesParser::setCustomData(QObject *object, + const QByteArray &data) +{ + QmlSetPropertiesPrivate *p = + static_cast(QObjectPrivate::get(object)); + p->data = data; + p->decoded = false; +} -/*! - \property QmlSetProperties::target - \brief the object that the properties to change belong to -*/ -QObject *QmlSetProperties::object() +QmlSetProperties::QmlSetProperties() +: QmlStateOperation(*(new QmlSetPropertiesPrivate)) +{ +} + +QmlSetProperties::~QmlSetProperties() { Q_D(QmlSetProperties); - return d->obj; + for(int ii = 0; ii < d->expressions.count(); ++ii) + delete d->expressions.at(ii).second; +} + +QObject *QmlSetProperties::object() const +{ + Q_D(const QmlSetProperties); + return d->object; } void QmlSetProperties::setObject(QObject *o) { Q_D(QmlSetProperties); - d->obj = o; + d->object = o; } -QmlSetProperties::ActionList -QmlSetProperties::doAction(QmlSetPropertiesMetaObject *metaObject, - QObject *object) +QmlMetaProperty +QmlSetPropertiesPrivate::property(const QByteArray &property) { + Q_Q(QmlSetProperties); + QList path = property.split('.'); + + QObject *obj = this->object; + + for (int jj = 0; jj < path.count() - 1; ++jj) { + const QByteArray &pathName = path.at(jj); + QmlMetaProperty prop(obj, QLatin1String(pathName)); + QObject *objVal = QmlMetaType::toQObject(prop.read()); + if (!objVal) { + qmlInfo(q) << obj->metaObject()->className() + << "has no object property named" << pathName; + return QmlMetaProperty(); + } + obj = objVal; + } + + const QByteArray &name = path.last(); + QmlMetaProperty prop(obj, QLatin1String(name)); + if (!prop.isValid()) { + qmlInfo(q) << obj->metaObject()->className() + << "has no property named" << name; + return QmlMetaProperty(); + } else if (!prop.isWritable()) { + qmlInfo(q) << obj->metaObject()->className() + << name << "is not writable, and cannot be set."; + return QmlMetaProperty(); + } else { + return prop; + } +} + +QmlSetProperties::ActionList QmlSetProperties::actions() +{ + Q_D(QmlSetProperties); + + d->decode(); + ActionList list; - for (int ii = 0; ii < metaObject->count(); ++ii) { + for (int ii = 0; ii < d->properties.count(); ++ii) { + + QByteArray property = d->properties.at(ii).first; + QmlMetaProperty prop = d->property(property); - QByteArray name = metaObject->name(ii); - QVariant value = metaObject->value(ii); + if (prop.isValid()) { + Action a; + a.property = prop; + a.fromValue = a.property.read(); + a.toValue = d->properties.at(ii).second; - QmlSetPropertiesProxyObject *po = qobject_cast(qvariant_cast(value)); + list << a; + } + } - QmlMetaProperty prop(object, QLatin1String(name)); + for (int ii = 0; ii < d->expressions.count(); ++ii) { - if (po) { - QObject *objVal = QmlMetaType::toQObject(prop.read()); - if (!objVal) { - qmlInfo(this) << object->metaObject()->className() - << "has no object property named" << name; - continue; - } + QByteArray property = d->expressions.at(ii).first; + QmlMetaProperty prop = d->property(property); - list << doAction(po->fxMetaObject(), objVal); - } else if (!prop.isValid()) { - qmlInfo(this) << object->metaObject()->className() - << "has no property named" << name; - continue; - } else if (!prop.isWritable()) { - qmlInfo(this) << object->metaObject()->className() - << name << "is not writable, and cannot be set."; - continue; - } else { - //append action + if (prop.isValid()) { Action a; a.property = prop; - a.fromValue = prop.read(); - a.toValue = value; + a.fromValue = a.property.read(); + a.toValue = d->expressions.at(ii).second->value(); list << a; } + } return list; } -QmlSetProperties::ActionList QmlSetProperties::actions() -{ - Q_D(QmlSetProperties); - if (!d->obj) - return ActionList(); - - return doAction(d->mo, d->obj); -} +QML_DEFINE_CUSTOM_TYPE(QmlSetProperties,SetProperties,QmlSetPropertiesParser); QT_END_NAMESPACE #include "qmlsetproperties.moc" diff --git a/src/declarative/util/qmlsetproperties.h b/src/declarative/util/qmlsetproperties.h index f1f59ed..bd036c1 100644 --- a/src/declarative/util/qmlsetproperties.h +++ b/src/declarative/util/qmlsetproperties.h @@ -50,7 +50,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QmlSetPropertiesMetaObject; + class QmlSetPropertiesPrivate; class Q_DECLARATIVE_EXPORT QmlSetProperties : public QmlStateOperation { @@ -58,20 +58,14 @@ class Q_DECLARATIVE_EXPORT QmlSetProperties : public QmlStateOperation Q_DECLARE_PRIVATE(QmlSetProperties); Q_PROPERTY(QObject *target READ object WRITE setObject); - public: QmlSetProperties(); - QmlSetProperties(QObject *parent); ~QmlSetProperties(); - QObject *object(); + QObject *object() const; void setObject(QObject *); virtual ActionList actions(); - -private: - ActionList doAction(QmlSetPropertiesMetaObject *, QObject *); - //QmlSetProperties::ActionList appendDotActions(const QVariant &, const QVariant &); }; QML_DECLARE_TYPE(QmlSetProperties); -- cgit v0.12 From b0095f7f8925cf571224d348124f08c56f7f46e9 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 15 May 2009 15:14:09 +0200 Subject: qdoc: Added name alignment for summaries. --- tools/qdoc3/htmlgenerator.cpp | 875 ++++++++++++++++++++++++++++-------------- tools/qdoc3/htmlgenerator.h | 30 +- 2 files changed, 618 insertions(+), 287 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 13d52bf..295cdab 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -61,6 +61,127 @@ QT_BEGIN_NAMESPACE static bool showBrokenLinks = false; +static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*()"); +static QRegExp funcTag("(<@func target=\"([^\"]*)\">)(.*)()"); +static QRegExp typeTag("(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()"); +static QRegExp spanTag(""); +static QRegExp unknownTag("]*>"); + +bool parseArg(const QString &src, + const QString &tag, + int *pos, + int n, + QStringRef *contents, + QStringRef *par1 = 0, + bool debug = false) +{ +#define SKIP_CHAR(c) \ + if (debug) \ + qDebug() << "looking for " << c << " at " << QString(src.data() + i, n - i); \ + if (i >= n || src[i] != c) { \ + if (debug) \ + qDebug() << " char '" << c << "' not found"; \ + return false; \ + } \ + ++i; + + +#define SKIP_SPACE \ + while (i < n && src[i] == ' ') \ + ++i; + + int i = *pos; + int j = i; + + // assume "<@" has been parsed outside + //SKIP_CHAR('<'); + //SKIP_CHAR('@'); + + if (tag != QStringRef(&src, i, tag.length())) { + if (0 && debug) + qDebug() << "tag " << tag << " not found at " << i; + return false; + } + + if (debug) + qDebug() << "haystack:" << src << "needle:" << tag << "i:" <).*()"); + if (par1) { + SKIP_SPACE; + // read parameter name + j = i; + while (i < n && src[i].isLetter()) + ++i; + if (src[i] == '=') { + if (debug) + qDebug() << "read parameter" << QString(src.data() + j, i - j); + SKIP_CHAR('='); + SKIP_CHAR('"'); + // skip parameter name + j = i; + while (i < n && src[i] != '"') + ++i; + *par1 = QStringRef(&src, j, i - j); + SKIP_CHAR('"'); + SKIP_SPACE; + } else { + if (debug) + qDebug() << "no optional parameter found"; + } + } + SKIP_SPACE; + SKIP_CHAR('>'); + + // find contents up to closing " + j = i; + for (; true; ++i) { + if (i + 4 + tag.length() > n) + return false; + if (src[i] != '<') + continue; + if (src[i + 1] != '/') + continue; + if (src[i + 2] != '@') + continue; + if (tag != QStringRef(&src, i + 3, tag.length())) + continue; + if (src[i + 3 + tag.length()] != '>') + continue; + break; + } + + *contents = QStringRef(&src, j, i - j); + + i += tag.length() + 4; + + *pos = i; + if (debug) + qDebug() << " tag " << tag << " found: pos now: " << i; + return true; +#undef SKIP_CHAR +} + +static void addLink(const QString &linkTarget, + const QStringRef &nestedStuff, + QString *res) +{ + if (!linkTarget.isEmpty()) { + *res += ""; + *res += nestedStuff; + *res += ""; + } + else { + *res += nestedStuff; + } +} + + HtmlGenerator::HtmlGenerator() : helpProjectWriter(0), inLink(false), inContents(false), inSectionHeading(false), inTableHeader(false), numTableRows(0), @@ -1928,40 +2049,6 @@ void HtmlGenerator::generateLegaleseList(const Node *relative, CodeMarker *marke } } -void HtmlGenerator::generateSynopsis(const Node *node, const Node *relative, - CodeMarker *marker, CodeMarker::SynopsisStyle style) -{ - QString marked = marker->markedUpSynopsis(node, relative, style); - QRegExp templateTag("(<[^@>]*>)"); - if (marked.indexOf(templateTag) != -1) { - QString contents = protect(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), templateTag.cap(1).length(), - contents); - } - marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), "\\1\\2"); - marked.replace("<@param>", ""); - marked.replace("", ""); - - if (style == CodeMarker::Summary) - marked.replace("@name>", "b>"); - - if (style == CodeMarker::SeparateList) { - QRegExp extraRegExp("<@extra>.*"); - extraRegExp.setMinimal(true); - marked.replace(extraRegExp, ""); - } else { - marked.replace("<@extra>", "  "); - marked.replace("", ""); - } - - if (style != CodeMarker::Detailed) { - marked.replace("<@type>", ""); - marked.replace("", ""); - } - out() << highlightedCode(marked, marker, relative); -} - void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* marker */) { QMap > fakeNodeMap; @@ -2075,21 +2162,35 @@ void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* m } } -void HtmlGenerator::generateSectionList(const Section& section, const Node *relative, - CodeMarker *marker, CodeMarker::SynopsisStyle style) +#ifdef QDOC_NAME_ALIGNMENT +void HtmlGenerator::generateSectionList(const Section& section, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style) { + bool name_alignment = true; if (!section.members.isEmpty()) { bool twoColumn = false; if (style == CodeMarker::SeparateList) { + name_alignment = false; twoColumn = (section.members.count() >= 16); - } else if (section.members.first()->type() == Node::Property) { + } + else if (section.members.first()->type() == Node::Property) { twoColumn = (section.members.count() >= 5); + name_alignment = false; + } + if (name_alignment) { + out() << "\n"; + } + else { + if (twoColumn) + out() << "

    \n" + << "
    "; + out() << "
      \n"; } - if (twoColumn) - out() << "

      \n" - << "\n"; + else + out() << "\n"; i++; ++m; } - out() << "\n"; - if (twoColumn) - out() << "\n
      "; - out() << "
        \n"; int i = 0; NodeList::ConstIterator m = section.members.begin(); @@ -2099,41 +2200,59 @@ void HtmlGenerator::generateSectionList(const Section& section, const Node *rela continue; } - if (twoColumn && i == (int) (section.members.count() + 1) / 2) - out() << "
        \n"; + if (name_alignment) { + out() << "
      "; + } + else { + if (twoColumn && i == (int) (section.members.count() + 1) / 2) + out() << "
        \n"; + out() << "
      • "; + } - out() << "
      • "; if (style == CodeMarker::Accessors) out() << ""; - generateSynopsis(*m, relative, marker, style); + generateSynopsis(*m, relative, marker, style, name_alignment); if (style == CodeMarker::Accessors) out() << ""; - out() << "
      • \n"; + if (name_alignment) + out() << "

      \n"; + if (name_alignment) + out() << "
    \n"; + else { + out() << "\n"; + if (twoColumn) + out() << "\n

    \n"; + } } if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { out() << "
      \n"; - generateSectionInheritedList(section, relative, marker); + generateSectionInheritedList(section, relative, marker, name_alignment); out() << "
    \n"; } } -void HtmlGenerator::generateSectionInheritedList(const Section& section, const Node *relative, - CodeMarker *marker) +void HtmlGenerator::generateSectionInheritedList(const Section& section, + const Node *relative, + CodeMarker *marker, + bool nameAlignment) { QList >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { - out() << "
  • "; - out() << (*p).second << " "; + if (nameAlignment) + out() << "
  • "; + else + out() << (*p).second << " "; if ((*p).second == 1) { out() << section.singularMember; - } else { + } + else { out() << section.pluralMember; } out() << " inherited from markedUpSynopsis(node, relative, style); + QRegExp templateTag("(<[^@>]*>)"); + if (marked.indexOf(templateTag) != -1) { + QString contents = protect(marked.mid(templateTag.pos(1), + templateTag.cap(1).length())); + marked.replace(templateTag.pos(1), templateTag.cap(1).length(), + contents); + } + marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), + "\\1\\2"); + marked.replace("<@param>", ""); + marked.replace("", ""); - if (funcLeftParen.indexIn(atom->string()) != -1 && marker->recognizeLanguage("Cpp")) { - // hack for C++: move () outside of link - int k = funcLeftParen.pos(1); - out() << protect(atom->string().left(k)); - if (link.isEmpty()) { - if (showBrokenLinks) - out() << ""; - } else { - out() << ""; - } - inLink = false; - out() << protect(atom->string().mid(k)); - } else if (marker->recognizeLanguage("Java")) { - // hack for Java: remove () and use when appropriate - bool func = atom->string().endsWith("()"); - bool tt = (func || atom->string().contains(camelCase)); - if (tt) - out() << ""; - if (func) { - out() << protect(atom->string().left(atom->string().length() - 2)); - } else { - out() << protect(atom->string()); - } - out() << ""; + if (style == CodeMarker::Summary) + marked.replace("@name>", "b>"); + + if (style == CodeMarker::SeparateList) { + QRegExp extraRegExp("<@extra>.*"); + extraRegExp.setMinimal(true); + marked.replace(extraRegExp, ""); } else { - out() << protect(atom->string()); + marked.replace("<@extra>", "  "); + marked.replace("", ""); + } + + if (style != CodeMarker::Detailed) { + marked.replace("<@type>", ""); + marked.replace("", ""); } + out() << highlightedCode(marked, marker, relative, nameAlignment); } -QString HtmlGenerator::cleanRef(const QString& ref) +QString HtmlGenerator::highlightedCode(const QString& markedCode, + CodeMarker *marker, + const Node *relative, + bool nameAlignment) { - QString clean; - - if (ref.isEmpty()) - return clean; + QString src = markedCode; + QString html; + QStringRef arg; + QStringRef par1; - clean.reserve(ref.size() + 20); - const QChar c = ref[0]; - const uint u = c.unicode(); + const QChar charLangle = '<'; + const QChar charAt = '@'; - if ((u >= 'a' && u <= 'z') || - (u >= 'A' && u <= 'Z') || - (u >= '0' && u <= '9')) { - clean += c; - } else if (u == '~') { - clean += "dtor."; - } else if (u == '_') { - clean += "underscore."; - } else { - clean += "A"; - } - - for (int i = 1; i < (int) ref.length(); i++) { - const QChar c = ref[i]; - const uint u = c.unicode(); - if ((u >= 'a' && u <= 'z') || - (u >= 'A' && u <= 'Z') || - (u >= '0' && u <= '9') || u == '-' || - u == '_' || u == ':' || u == '.') { - clean += c; - } else if (c.isSpace()) { - clean += "-"; - } else if (u == '!') { - clean += "-not"; - } else if (u == '&') { - clean += "-and"; - } else if (u == '<') { - clean += "-lt"; - } else if (u == '=') { - clean += "-eq"; - } else if (u == '>') { - clean += "-gt"; - } else if (u == '#') { - clean += "#"; - } else { - clean += "-"; - clean += QString::number((int)u, 16); + // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*()" + static const QString linkTag("link"); + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { + if (nameAlignment && (i != 0)) + html += " "; + i += 2; + if (parseArg(src, linkTag, &i, n, &arg, &par1)) { + QString link = linkForNode( + CodeMarker::nodeForString(par1.toString()), relative); + addLink(link, arg, &html); + } + else { + html += charLangle; + html += charAt; + } + } + else { + html += src.at(i++); } } - return clean; -} -QString HtmlGenerator::registerRef(const QString& ref) -{ - QString clean = HtmlGenerator::cleanRef(ref); - for (;;) { - QString& prevRef = refMap[clean.toLower()]; - if (prevRef.isEmpty()) { - prevRef = ref; - break; - } else if (prevRef == ref) { - break; + if (slow) { + // is this block ever used at all? + // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)()" + src = html; + html = QString(); + static const QString funcTag("func"); + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle && src.at(i + 1) == charAt) { + i += 2; + if (parseArg(src, funcTag, &i, n, &arg, &par1)) { + QString link = linkForNode( + marker->resolveTarget(par1.toString(), + tre, + relative), + relative); + addLink(link, arg, &html); + par1 = QStringRef(); + } + else { + html += charLangle; + html += charAt; + } + } + else { + html += src.at(i++); + } } - clean += "x"; } - return clean; -} -QString HtmlGenerator::protect(const QString& string) -{ -#define APPEND(x) \ - if (html.isEmpty()) { \ - html = string; \ - html.truncate(i); \ - } \ - html += (x); - - QString html; - int n = string.length(); - - for (int i = 0; i < n; ++i) { - QChar ch = string.at(i); - - if (ch == QLatin1Char('&')) { - APPEND("&"); - } else if (ch == QLatin1Char('<')) { - APPEND("<"); - } else if (ch == QLatin1Char('>')) { - APPEND(">"); - } else if (ch == QLatin1Char('"')) { - APPEND("""); - } else if (ch.unicode() > 0x007F - || (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/')) - || (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) { - // we escape '*/' and the last dot in 'e.g.' and 'i.e.' for the Javadoc generator - APPEND("&#x"); - html += QString::number(ch.unicode(), 16); - html += QLatin1Char(';'); - } else { - if (!html.isEmpty()) - html += ch; + // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()" tags + src = html; + html = QString(); + static const QString typeTags[] = { "type", "headerfile", "func" }; + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle && src.at(i + 1) == charAt) { + i += 2; + bool handled = false; + for (int k = 0; k != 3; ++k) { + if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) { + par1 = QStringRef(); + QString link = linkForNode( + marker->resolveTarget(arg.toString(), tre, relative), + relative); + addLink(link, arg, &html); + handled = true; + break; + } + } + if (!handled) { + html += charLangle; + html += charAt; + } + } + else { + html += src.at(i++); } } - if (!html.isEmpty()) - return html; - return string; + // replace all + // "<@comment>" -> ""; + // "<@preprocessor>" -> ""; + // "<@string>" -> ""; + // "<@char>" -> ""; + // "" -> "" + src = html; + html = QString(); + static const QString spanTags[] = { + "<@comment>", "", + "<@preprocessor>", "", + "<@string>", "", + "<@char>", "", + "", "", + "","", + "", "", + "", "" + // "<@char>", "", + // "", "", + // "<@func>", "", + // "", "", + // "<@id>", "", + // "", "", + // "<@keyword>", "", + // "", "", + // "<@number>", "", + // "", "", + // "<@op>", "", + // "", "", + // "<@param>", "", + // "", "", + // "<@string>", "", + // "", "", + }; + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle) { + bool handled = false; + for (int k = 0; k != 8; ++k) { + const QString & tag = spanTags[2 * k]; + if (tag == QStringRef(&src, i, tag.length())) { + html += spanTags[2 * k + 1]; + i += tag.length(); + handled = true; + break; + } + } + if (!handled) { + ++i; + if (src.at(i) == charAt || + (src.at(i) == QLatin1Char('/') && src.at(i + 1) == charAt)) { + // drop 'our' unknown tags (the ones still containing '@') + while (i < n && src.at(i) != QLatin1Char('>')) + ++i; + ++i; + } + else { + // retain all others + html += charLangle; + } + } + } + else { + html += src.at(i); + ++i; + } + } -#undef APPEND + return html; } -static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*()"); -static QRegExp funcTag("(<@func target=\"([^\"]*)\">)(.*)()"); -static QRegExp typeTag("(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()"); -static QRegExp spanTag(""); -static QRegExp unknownTag("]*>"); - -bool parseArg(const QString &src, - const QString &tag, - int *pos, - int n, - QStringRef *contents, - QStringRef *par1 = 0, - bool debug = false) +#else +void HtmlGenerator::generateSectionList(const Section& section, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style) { -#define SKIP_CHAR(c) \ - if (debug) \ - qDebug() << "looking for " << c << " at " << QString(src.data() + i, n - i); \ - if (i >= n || src[i] != c) { \ - if (debug) \ - qDebug() << " char '" << c << "' not found"; \ - return false; \ - } \ - ++i; - + if (!section.members.isEmpty()) { + bool twoColumn = false; + if (style == CodeMarker::SeparateList) { + twoColumn = (section.members.count() >= 16); + } else if (section.members.first()->type() == Node::Property) { + twoColumn = (section.members.count() >= 5); + } + if (twoColumn) + out() << "

    \n" + << "\n
    "; + out() << "
      \n"; -#define SKIP_SPACE \ - while (i < n && src[i] == ' ') \ - ++i; + int i = 0; + NodeList::ConstIterator m = section.members.begin(); + while (m != section.members.end()) { + if ((*m)->access() == Node::Private) { + ++m; + continue; + } - int i = *pos; - int j = i; + if (twoColumn && i == (int) (section.members.count() + 1) / 2) + out() << "
      \n"; - // assume "<@" has been parsed outside - //SKIP_CHAR('<'); - //SKIP_CHAR('@'); + out() << "
    • "; + if (style == CodeMarker::Accessors) + out() << ""; + generateSynopsis(*m, relative, marker, style); + if (style == CodeMarker::Accessors) + out() << ""; + out() << "
    • \n"; + i++; + ++m; + } + out() << "
    \n"; + if (twoColumn) + out() << "

    \n"; + } - if (tag != QStringRef(&src, i, tag.length())) { - if (0 && debug) - qDebug() << "tag " << tag << " not found at " << i; - return false; + if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { + out() << "
      \n"; + generateSectionInheritedList(section, relative, marker); + out() << "
    \n"; } +} - if (debug) - qDebug() << "haystack:" << src << "needle:" << tag << "i:" <).*()"); - if (par1) { - SKIP_SPACE; - // read parameter name - j = i; - while (i < n && src[i].isLetter()) - ++i; - if (src[i] == '=') { - if (debug) - qDebug() << "read parameter" << QString(src.data() + j, i - j); - SKIP_CHAR('='); - SKIP_CHAR('"'); - // skip parameter name - j = i; - while (i < n && src[i] != '"') - ++i; - *par1 = QStringRef(&src, j, i - j); - SKIP_CHAR('"'); - SKIP_SPACE; +void HtmlGenerator::generateSectionInheritedList(const Section& section, + const Node *relative, + CodeMarker *marker) +{ + QList >::ConstIterator p = section.inherited.begin(); + while (p != section.inherited.end()) { + out() << "
  • "; + out() << (*p).second << " "; + if ((*p).second == 1) { + out() << section.singularMember; } else { - if (debug) - qDebug() << "no optional parameter found"; + out() << section.pluralMember; } + out() << " inherited from " + << protect(marker->plainFullName((*p).first, relative)) + << "
  • \n"; + ++p; } - SKIP_SPACE; - SKIP_CHAR('>'); +} - // find contents up to closing " - j = i; - for (; true; ++i) { - if (i + 4 + tag.length() > n) - return false; - if (src[i] != '<') - continue; - if (src[i + 1] != '/') - continue; - if (src[i + 2] != '@') - continue; - if (tag != QStringRef(&src, i + 3, tag.length())) - continue; - if (src[i + 3 + tag.length()] != '>') - continue; - break; +void HtmlGenerator::generateSynopsis(const Node *node, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style) +{ + QString marked = marker->markedUpSynopsis(node, relative, style); + QRegExp templateTag("(<[^@>]*>)"); + if (marked.indexOf(templateTag) != -1) { + QString contents = protect(marked.mid(templateTag.pos(1), + templateTag.cap(1).length())); + marked.replace(templateTag.pos(1), templateTag.cap(1).length(), + contents); } + marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), "\\1\\2"); + marked.replace("<@param>", ""); + marked.replace("", ""); - *contents = QStringRef(&src, j, i - j); - - i += tag.length() + 4; - - *pos = i; - if (debug) - qDebug() << " tag " << tag << " found: pos now: " << i; - return true; -#undef SKIP_CHAR -} + if (style == CodeMarker::Summary) + marked.replace("@name>", "b>"); -static void addLink(const QString &linkTarget, - const QStringRef &nestedStuff, - QString *res) -{ - if (!linkTarget.isEmpty()) { - *res += ""; - *res += nestedStuff; - *res += ""; + if (style == CodeMarker::SeparateList) { + QRegExp extraRegExp("<@extra>.*"); + extraRegExp.setMinimal(true); + marked.replace(extraRegExp, ""); + } else { + marked.replace("<@extra>", "  "); + marked.replace("", ""); } - else { - *res += nestedStuff; + + if (style != CodeMarker::Detailed) { + marked.replace("<@type>", ""); + marked.replace("", ""); } + out() << highlightedCode(marked, marker, relative); } QString HtmlGenerator::highlightedCode(const QString& markedCode, @@ -2570,6 +2734,153 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, return html; } +#endif + +void HtmlGenerator::generateLink(const Atom *atom, const Node * /* relative */, CodeMarker *marker) +{ + static QRegExp camelCase("[A-Z][A-Z][a-z]|[a-z][A-Z0-9]|_"); + + if (funcLeftParen.indexIn(atom->string()) != -1 && marker->recognizeLanguage("Cpp")) { + // hack for C++: move () outside of link + int k = funcLeftParen.pos(1); + out() << protect(atom->string().left(k)); + if (link.isEmpty()) { + if (showBrokenLinks) + out() << ""; + } else { + out() << ""; + } + inLink = false; + out() << protect(atom->string().mid(k)); + } else if (marker->recognizeLanguage("Java")) { + // hack for Java: remove () and use when appropriate + bool func = atom->string().endsWith("()"); + bool tt = (func || atom->string().contains(camelCase)); + if (tt) + out() << ""; + if (func) { + out() << protect(atom->string().left(atom->string().length() - 2)); + } else { + out() << protect(atom->string()); + } + out() << ""; + } else { + out() << protect(atom->string()); + } +} + +QString HtmlGenerator::cleanRef(const QString& ref) +{ + QString clean; + + if (ref.isEmpty()) + return clean; + + clean.reserve(ref.size() + 20); + const QChar c = ref[0]; + const uint u = c.unicode(); + + if ((u >= 'a' && u <= 'z') || + (u >= 'A' && u <= 'Z') || + (u >= '0' && u <= '9')) { + clean += c; + } else if (u == '~') { + clean += "dtor."; + } else if (u == '_') { + clean += "underscore."; + } else { + clean += "A"; + } + + for (int i = 1; i < (int) ref.length(); i++) { + const QChar c = ref[i]; + const uint u = c.unicode(); + if ((u >= 'a' && u <= 'z') || + (u >= 'A' && u <= 'Z') || + (u >= '0' && u <= '9') || u == '-' || + u == '_' || u == ':' || u == '.') { + clean += c; + } else if (c.isSpace()) { + clean += "-"; + } else if (u == '!') { + clean += "-not"; + } else if (u == '&') { + clean += "-and"; + } else if (u == '<') { + clean += "-lt"; + } else if (u == '=') { + clean += "-eq"; + } else if (u == '>') { + clean += "-gt"; + } else if (u == '#') { + clean += "#"; + } else { + clean += "-"; + clean += QString::number((int)u, 16); + } + } + return clean; +} + +QString HtmlGenerator::registerRef(const QString& ref) +{ + QString clean = HtmlGenerator::cleanRef(ref); + + for (;;) { + QString& prevRef = refMap[clean.toLower()]; + if (prevRef.isEmpty()) { + prevRef = ref; + break; + } else if (prevRef == ref) { + break; + } + clean += "x"; + } + return clean; +} + +QString HtmlGenerator::protect(const QString& string) +{ +#define APPEND(x) \ + if (html.isEmpty()) { \ + html = string; \ + html.truncate(i); \ + } \ + html += (x); + + QString html; + int n = string.length(); + + for (int i = 0; i < n; ++i) { + QChar ch = string.at(i); + + if (ch == QLatin1Char('&')) { + APPEND("&"); + } else if (ch == QLatin1Char('<')) { + APPEND("<"); + } else if (ch == QLatin1Char('>')) { + APPEND(">"); + } else if (ch == QLatin1Char('"')) { + APPEND("""); + } else if (ch.unicode() > 0x007F + || (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/')) + || (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) { + // we escape '*/' and the last dot in 'e.g.' and 'i.e.' for the Javadoc generator + APPEND("&#x"); + html += QString::number(ch.unicode(), 16); + html += QLatin1Char(';'); + } else { + if (!html.isEmpty()) + html += ch; + } + } + + if (!html.isEmpty()) + return html; + return string; + +#undef APPEND +} QString HtmlGenerator::fileBase(const Node *node) { diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index de64190..ec9532f 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -46,6 +46,8 @@ #ifndef HTMLGENERATOR_H #define HTMLGENERATOR_H +#define QDOC_NAME_ALIGNMENT + #include #include @@ -139,17 +141,36 @@ class HtmlGenerator : public PageGenerator void generateFunctionIndex(const Node *relative, CodeMarker *marker); void generateLegaleseList(const Node *relative, CodeMarker *marker); void generateOverviewList(const Node *relative, CodeMarker *marker); - void generateSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style); void generateSectionList(const Section& section, const Node *relative, CodeMarker *marker, CodeMarker::SynopsisStyle style); +#ifdef QDOC_NAME_ALIGNMENT + void generateSynopsis(const Node *node, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style, + bool nameAlignment = false); + void generateSectionInheritedList(const Section& section, + const Node *relative, + CodeMarker *marker, + bool nameAlignment = false); + QString highlightedCode(const QString& markedCode, + CodeMarker *marker, + const Node *relative, + bool nameAlignment = false); +#else + void generateSynopsis(const Node *node, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style); void generateSectionInheritedList(const Section& section, const Node *relative, CodeMarker *marker); + QString highlightedCode(const QString& markedCode, + CodeMarker *marker, + const Node *relative); +#endif void generateFullName(const Node *apparentNode, const Node *relative, CodeMarker *marker, @@ -159,7 +180,6 @@ class HtmlGenerator : public PageGenerator void generateStatus(const Node *node, CodeMarker *marker); QString registerRef(const QString& ref); - QString highlightedCode(const QString& markedCode, CodeMarker *marker, const Node *relative); QString fileBase(const Node *node); #if 0 QString fileBase(const Node *node, const SectionIterator& section); -- cgit v0.12 From 6648bab32355a1f64b21e6f5394825a9fbef21ea Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 May 2009 23:16:24 +1000 Subject: Remove AssignConstant VME instruction --- src/declarative/qml/qmlcompiler.cpp | 19 ++--------- src/declarative/qml/qmlinstruction.cpp | 3 -- src/declarative/qml/qmlinstruction_p.h | 7 ---- src/declarative/qml/qmlvme.cpp | 58 ---------------------------------- 4 files changed, 3 insertions(+), 84 deletions(-) diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index b205efb..7abd2aa 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -1214,37 +1214,24 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop, QmlInstruction assign; assign.line = v->location.start.line; - bool doassign = true; if (prop->index != -1) { QString value = v->primitive(); StoreInstructionResult r = generateStoreInstruction(*output, assign, obj->metaObject()->property(prop->index), prop->index, -1, &value); if (r == Ok) { - doassign = false; } else if (r == InvalidData) { //### we are restricted to a rather generic message here. If we can find a way to move // the exception into generateStoreInstruction we could potentially have better messages. // (the problem is that both compile and run exceptions can be generated, though) COMPILE_EXCEPTION2(v, "Cannot assign value" << v->primitive() << "to property" << obj->metaObject()->property(prop->index).name()); - doassign = false; } else if (r == ReadOnly) { COMPILE_EXCEPTION2(v, "Cannot assign value" << v->primitive() << "to the read-only property" << obj->metaObject()->property(prop->index).name()); } else { - doassign = true; + COMPILE_EXCEPTION2(prop, "Cannot assign value to property" << obj->metaObject()->property(prop->index).name() << "of unknown type"); } - } - - if (doassign) { - assign.type = QmlInstruction::AssignConstant; - if (prop->isDefault) { - assign.assignConstant.property = -1; - } else { - assign.assignConstant.property = - output->indexForByteArray(prop->name); - } - assign.assignConstant.constant = - output->indexForString(v->primitive()); + } else { + COMPILE_EXCEPTION2(prop, "Cannot assign value to non-existant property" << prop->name); } output->bytecode << assign; diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp index 6b49359..ef333b1 100644 --- a/src/declarative/qml/qmlinstruction.cpp +++ b/src/declarative/qml/qmlinstruction.cpp @@ -124,9 +124,6 @@ void QmlCompiledComponent::dump(QmlInstruction *instr, int idx) case QmlInstruction::StoreSignal: qWarning() << idx << "\t" << line << "\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value); break; - case QmlInstruction::AssignConstant: - qWarning() << idx << "\t" << line << "\t" << "ASSIGN_CONSTANT\t" << instr->assignConstant.property << "\t" << instr->assignConstant.constant << "\t\t" << datas.at(instr->assignConstant.property) << primitives.at(instr->assignConstant.constant); - break; case QmlInstruction::AssignSignalObject: qWarning() << idx << "\t" << line << "\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal); break; diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index f06f0e6..cca99d3 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -110,9 +110,6 @@ public: // // Unresolved single assignment // - // AssignConstant - Store a value in a property. Will resolve into - // a Store* instruction. - AssignConstant, /* assignConstant */ AssignSignalObject, /* assignSignalObject */ AssignCustomType, /* assignCustomType */ @@ -187,10 +184,6 @@ public: } setId; struct { int property; - int constant; - } assignConstant; - struct { - int property; int castValue; } assignObject; struct { diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 51534e7..faee545 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -409,64 +409,6 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in } break; - case QmlInstruction::AssignConstant: - { -#ifdef Q_ENABLE_PERFORMANCE_LOG - QFxCompilerTimer cc; -#endif - // Fixup instruction - QObject *target = stack.top(); - int propIdx = instr.assignConstant.property; - int idx = instr.assignConstant.constant; - QByteArray pr; - if (propIdx == -1) { - pr = QmlMetaType::defaultProperty(target).name(); - if (pr.isEmpty()) - VME_EXCEPTION("Cannot resolve defalt property on type" << target->metaObject()->className()); - } else { - pr = datas.at(propIdx); - } - - int coreIdx = qIndexOfProperty(target, pr); - - if (coreIdx != -1) { - QMetaProperty prop = - target->metaObject()->property(coreIdx); - bool replace = !prop.isDynamic(); - - QmlInstruction *writeInstr = 0; - QmlInstruction dummy; - if (replace) { - writeInstr = &instr; - } else { - writeInstr = &dummy; - dummy = instr; - } - - QmlCompiler::StoreInstructionResult r = QmlCompiler::generateStoreInstruction(*comp, *writeInstr, prop, - coreIdx, idx, &primitives.at(idx)); - if (r != QmlCompiler::Ok) { - if (prop.isEnumType()){ - VME_EXCEPTION(primitives.at(idx) << "is not a valid enumeration value"); - } else if (r == QmlCompiler::UnknownType) { - VME_EXCEPTION("Property" << prop.name() << "is of an unknown type"); - } else if (r == QmlCompiler::InvalidData) { - VME_EXCEPTION("Cannot assign value" << primitives.at(idx) << "to property" << prop.name()); - } else if (r == QmlCompiler::ReadOnly) { - VME_EXCEPTION("Cannot assign value" << primitives.at(idx) << "to read-only property" << prop.name()); - } else { - VME_EXCEPTION("Invalid property assignment for property" << prop.name()); - } - } else { - runStoreInstruction(stack, *writeInstr, comp); - } - - } else { - VME_EXCEPTION("Unknown property" << pr); - } - } - break; - case QmlInstruction::TryBeginObject: { #ifdef Q_ENABLE_PERFORMANCE_LOG -- cgit v0.12 From a830e5f22a42d00b0b92544cfcb56c79b2c3b6cd Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Fri, 15 May 2009 15:20:35 +0200 Subject: Doc: Updated description of QMainWindow::unifiedTitleAndToolBarOnMac to include info on Cocoa. Task-number: 252658 Reviewed-by: Trenton Schulz --- src/gui/widgets/qmainwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 502c1e9..558ba42 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -1408,10 +1408,10 @@ bool QMainWindow::event(QEvent *event) This property is false by default and only has any effect on Mac OS X 10.4 or higher. - If set to true, then the top toolbar area is replaced with a Carbon - HIToolbar and all toolbars in the top toolbar area are moved to that. Any - toolbars added afterwards will also be added to the Carbon HIToolbar. This - means a couple of things. + If set to true, then the top toolbar area is replaced with a Carbon HIToolbar + or a Cocoa NSToolbar (depending on whether Qt was built with Carbon or Cocoa). + All toolbars in the top toolbar area and any toolbars added afterwards are + moved to that. This means a couple of things. \list \i QToolBars in this toolbar area are not movable and you cannot drag other -- cgit v0.12 From deed3896f48d52475bf1585534bca500666d9744 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 May 2009 23:26:07 +1000 Subject: Remove Assign*Binding VME instructions --- src/declarative/qml/qmlcompiler.cpp | 40 +++++++++++++++++----------------- src/declarative/qml/qmlcompiler_p.h | 2 +- src/declarative/qml/qmlinstruction.cpp | 6 ----- src/declarative/qml/qmlinstruction_p.h | 2 -- src/declarative/qml/qmlvme.cpp | 29 ------------------------ 5 files changed, 21 insertions(+), 58 deletions(-) diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 7abd2aa..8990732 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -1050,8 +1050,9 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop, COMPILE_EXCEPTION("Can only assign one binding to lists"); assignedBinding = true; - compileBinding(v->value.asScript(), prop, ctxt, - obj->metaObject(), v->location.start.line); + COMPILE_CHECK(compileBinding(v->value.asScript(), prop, ctxt, + obj->metaObject(), + v->location.start.line)); v->type = Value::PropertyBinding; } else { COMPILE_EXCEPTION("Cannot assign primitives to lists"); @@ -1204,8 +1205,9 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop, { if (v->value.isScript()) { - compileBinding(v->value.asScript(), prop, ctxt, obj->metaObject(), - v->location.start.line); + COMPILE_CHECK(compileBinding(v->value.asScript(), prop, ctxt, + obj->metaObject(), + v->location.start.line)); v->type = Value::PropertyBinding; @@ -1329,7 +1331,7 @@ bool QmlCompiler::compileDynamicMeta(QmlParser::Object *obj) return true; } -void QmlCompiler::compileBinding(const QString &bind, QmlParser::Property *prop, +bool QmlCompiler::compileBinding(const QString &bind, QmlParser::Property *prop, int ctxt, const QMetaObject *mo, qint64 line) { QmlBasicScript bs; @@ -1342,10 +1344,12 @@ void QmlCompiler::compileBinding(const QString &bind, QmlParser::Property *prop, bref = output->indexForString(bind); } - QmlInstruction assign; - assign.assignBinding.context = ctxt; - assign.line = line; if (prop->index != -1) { + + QmlInstruction assign; + assign.assignBinding.context = ctxt; + assign.line = line; + if (bs.isValid()) assign.type = QmlInstruction::StoreCompiledBinding; else @@ -1355,20 +1359,18 @@ void QmlCompiler::compileBinding(const QString &bind, QmlParser::Property *prop, assign.assignBinding.value = bref; assign.assignBinding.category = QmlMetaProperty::Unknown; if (mo) { - //XXX we should generate an exception if the property is read-only + // ### we should generate an exception if the property is read-only QMetaProperty mp = mo->property(assign.assignBinding.property); assign.assignBinding.category = QmlMetaProperty::propertyCategory(mp); } + + output->bytecode << assign; + } else { - if (bs.isValid()) - assign.type = QmlInstruction::AssignCompiledBinding; - else - assign.type = QmlInstruction::AssignBinding; - assign.assignBinding.property = output->indexForByteArray(prop->name); - assign.assignBinding.value = bref; - assign.assignBinding.category = QmlMetaProperty::Unknown; + COMPILE_EXCEPTION2(prop, "Cannot assign binding to non-existant property" << prop->name); } - output->bytecode << assign; + + return true; } int QmlCompiler::optimizeExpressions(int start, int end, int patch) @@ -1401,9 +1403,7 @@ int QmlCompiler::optimizeExpressions(int start, int end, int patch) continue; } - if (instr.type == QmlInstruction::AssignBinding || - instr.type == QmlInstruction::AssignCompiledBinding || - instr.type == QmlInstruction::StoreBinding || + if (instr.type == QmlInstruction::StoreBinding || instr.type == QmlInstruction::StoreCompiledBinding) { ++bindingsCount; } else if (instr.type == QmlInstruction::TryBeginObject || diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index 64400c5..87c1b82 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -164,7 +164,7 @@ private: int ctxt); bool compileDynamicMeta(QmlParser::Object *obj); - void compileBinding(const QString &, QmlParser::Property *prop, + bool compileBinding(const QString &, QmlParser::Property *prop, int ctxt, const QMetaObject *, qint64); int optimizeExpressions(int start, int end, int patch = -1); diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp index ef333b1..923d36f 100644 --- a/src/declarative/qml/qmlinstruction.cpp +++ b/src/declarative/qml/qmlinstruction.cpp @@ -127,12 +127,6 @@ void QmlCompiledComponent::dump(QmlInstruction *instr, int idx) case QmlInstruction::AssignSignalObject: qWarning() << idx << "\t" << line << "\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal); break; - case QmlInstruction::AssignBinding: - qWarning() << idx << "\t" << line << "\t" << "ASSIGN_BINDING\t\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t\t" << instr->assignBinding.context << datas.at(instr->assignBinding.property) << primitives.at(instr->assignBinding.value); - break; - case QmlInstruction::AssignCompiledBinding: - qWarning() << idx << "\t" << line << "\t" << "ASSIGN_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t\t" << instr->assignBinding.context << datas.at(instr->assignBinding.property); - break; case QmlInstruction::AssignValueSource: qWarning() << idx << "\t" << line << "\t" << "ASSIGN_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t\t\t" << datas.at(instr->assignValueSource.property); break; diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index cca99d3..323735b 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -113,8 +113,6 @@ public: AssignSignalObject, /* assignSignalObject */ AssignCustomType, /* assignCustomType */ - AssignBinding, /* assignBinding */ - AssignCompiledBinding, /* assignBinding */ AssignValueSource, /* assignValueSource */ StoreBinding, /* assignBinding */ StoreCompiledBinding, /* assignBinding */ diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index faee545..53ed05a 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -89,8 +89,6 @@ Q_DECLARE_PERFORMANCE_LOG(QFxCompiler) { Q_DECLARE_PERFORMANCE_METRIC(InstrStoreObjectQmlList); Q_DECLARE_PERFORMANCE_METRIC(InstrAssignConstant); Q_DECLARE_PERFORMANCE_METRIC(InstrAssignSignalObject); - Q_DECLARE_PERFORMANCE_METRIC(InstrAssignBinding); - Q_DECLARE_PERFORMANCE_METRIC(InstrAssignCompiledBinding); Q_DECLARE_PERFORMANCE_METRIC(InstrAssignValueSource); Q_DECLARE_PERFORMANCE_METRIC(InstrStoreBinding); Q_DECLARE_PERFORMANCE_METRIC(InstrStoreCompiledBinding); @@ -138,8 +136,6 @@ Q_DEFINE_PERFORMANCE_LOG(QFxCompiler, "QFxCompiler") { Q_DEFINE_PERFORMANCE_METRIC(InstrStoreObjectQmlList, "StoreObjectQmlList"); Q_DEFINE_PERFORMANCE_METRIC(InstrAssignConstant, "AssignConstant"); Q_DEFINE_PERFORMANCE_METRIC(InstrAssignSignalObject, "AssignSignalObject"); - Q_DEFINE_PERFORMANCE_METRIC(InstrAssignBinding, "AssignBinding"); - Q_DEFINE_PERFORMANCE_METRIC(InstrAssignCompiledBinding, "AssignCompiledBinding"); Q_DEFINE_PERFORMANCE_METRIC(InstrAssignValueSource, "AssignValueSource"); Q_DEFINE_PERFORMANCE_METRIC(InstrStoreBinding, "StoreBinding"); Q_DEFINE_PERFORMANCE_METRIC(InstrStoreCompiledBinding, "StoreCompiledBinding"); @@ -472,31 +468,6 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in } break; - case QmlInstruction::AssignCompiledBinding: - case QmlInstruction::AssignBinding: - { -#ifdef Q_ENABLE_PERFORMANCE_LOG - QFxCompilerTimer cc; -#endif - QObject *target = stack.top(); - const QByteArray &pr = datas.at(instr.fetch.property); - int idx = qIndexOfProperty(target, pr); - - // XXX - need to check if the type is QmlBindableValue* - if (idx == -1) { - VME_EXCEPTION("Unknown property" << pr); - } else { - if (QmlInstruction::AssignCompiledBinding == instr.type) - instr.type = QmlInstruction::StoreCompiledBinding; - else - instr.type = QmlInstruction::StoreBinding; - instr.assignBinding.property = idx; - instr.assignBinding.category = QmlMetaProperty::Unknown; - } - ii--; - } - break; - case QmlInstruction::AssignValueSource: { QObject *target = stack.at(stack.count() - 2); -- cgit v0.12 From 4573bc08a280be8f8dfd4659146b6d4b1afc185a Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Fri, 15 May 2009 15:38:35 +0200 Subject: Initialize variable to avoid valgrind error. For some reason it's only sometimes hit and cannot be deterministically reproduced. Task-number: 253722 Reviewed-by: TrustMe --- src/xmlpatterns/expr/qxsltsimplecontentconstructor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xmlpatterns/expr/qxsltsimplecontentconstructor.cpp b/src/xmlpatterns/expr/qxsltsimplecontentconstructor.cpp index ef77c76..104c5cc 100644 --- a/src/xmlpatterns/expr/qxsltsimplecontentconstructor.cpp +++ b/src/xmlpatterns/expr/qxsltsimplecontentconstructor.cpp @@ -105,7 +105,7 @@ Item XSLTSimpleContentConstructor::evaluateSingleton(const DynamicContext::Ptr & QString result; bool previousIsText = false; - bool discard; + bool discard = false; if(next) { -- cgit v0.12 From 80fa08d3e7f109e11e67ef73ff7a98312bbca984 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 15 May 2009 16:03:01 +0200 Subject: Doc: Added a work in progress class hierarchy overview. Reviewed-by: Geir Vattekar --- doc/src/diagrams/animations-architecture.svg | 351 +++++++++++++++++++++++++++ 1 file changed, 351 insertions(+) create mode 100644 doc/src/diagrams/animations-architecture.svg diff --git a/doc/src/diagrams/animations-architecture.svg b/doc/src/diagrams/animations-architecture.svg new file mode 100644 index 0000000..0246510 --- /dev/null +++ b/doc/src/diagrams/animations-architecture.svg @@ -0,0 +1,351 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + QAbstractAnimation + + QVariantAnimation + + QAnimationGroup + + + + QPropertyAnimation + + + QSequentialAnimationGroup + + QParallelAnimationGroup + + + + -- cgit v0.12 From 9aba165d0ca970949bcc5fc590569ea58d992626 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Fri, 15 May 2009 16:30:29 +0200 Subject: Doc: Added architecture image to animation overview. Reviewed-by: David Boddie --- doc/src/animation.qdoc | 5 ++++- doc/src/images/animations-architecture.png | Bin 0 -> 27619 bytes 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 doc/src/images/animations-architecture.png diff --git a/doc/src/animation.qdoc b/doc/src/animation.qdoc index 5eb2eda..f3baf71 100644 --- a/doc/src/animation.qdoc +++ b/doc/src/animation.qdoc @@ -64,7 +64,10 @@ We will in this section take a high-level look at the animation framework's architecture and how it is used to animate Qt - properties. + properties. The following diagram shows the most important classes + in the animation framework. + + \image animations-architecture.png The animation framework foundation consists of the base class QAbstractAnimation, and its two subclasses QVariantAnimation and diff --git a/doc/src/images/animations-architecture.png b/doc/src/images/animations-architecture.png new file mode 100644 index 0000000..9b581af Binary files /dev/null and b/doc/src/images/animations-architecture.png differ -- cgit v0.12 From b3db2368b63f3d7f0a8abbb0620232d8aa079ad7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 15 May 2009 17:01:51 +0200 Subject: Adapted uic test-baseline to the icon generation change 251248) Task-number: 251248 --- tests/auto/uic/baseline/languagesdialog.ui.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/auto/uic/baseline/languagesdialog.ui.h b/tests/auto/uic/baseline/languagesdialog.ui.h index a0b9cae..fbe57ca 100644 --- a/tests/auto/uic/baseline/languagesdialog.ui.h +++ b/tests/auto/uic/baseline/languagesdialog.ui.h @@ -1,8 +1,8 @@ /******************************************************************************** ** Form generated from reading ui file 'languagesdialog.ui' ** -** Created: Mon Jun 16 17:57:32 2008 -** by: Qt User Interface Compiler version 4.5.0 +** Created: Fri May 15 16:58:03 2009 +** by: Qt User Interface Compiler version 4.5.2 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! ********************************************************************************/ @@ -57,7 +57,7 @@ public: upButton->setObjectName(QString::fromUtf8("upButton")); upButton->setEnabled(false); QIcon icon; - icon.addPixmap(QPixmap(QString::fromUtf8(":/images/up.png")), QIcon::Normal, QIcon::Off); + icon.addFile(QString::fromUtf8(":/images/up.png"), QSize(), QIcon::Normal, QIcon::Off); upButton->setIcon(icon); hboxLayout->addWidget(upButton); @@ -66,7 +66,7 @@ public: downButton->setObjectName(QString::fromUtf8("downButton")); downButton->setEnabled(false); QIcon icon1; - icon1.addPixmap(QPixmap(QString::fromUtf8(":/images/down.png")), QIcon::Normal, QIcon::Off); + icon1.addFile(QString::fromUtf8(":/images/down.png"), QSize(), QIcon::Normal, QIcon::Off); downButton->setIcon(icon1); hboxLayout->addWidget(downButton); @@ -75,7 +75,7 @@ public: removeButton->setObjectName(QString::fromUtf8("removeButton")); removeButton->setEnabled(false); QIcon icon2; - icon2.addPixmap(QPixmap(QString::fromUtf8(":/images/editdelete.png")), QIcon::Normal, QIcon::Off); + icon2.addFile(QString::fromUtf8(":/images/editdelete.png"), QSize(), QIcon::Normal, QIcon::Off); removeButton->setIcon(icon2); hboxLayout->addWidget(removeButton); @@ -84,7 +84,7 @@ public: openFileButton->setObjectName(QString::fromUtf8("openFileButton")); openFileButton->setEnabled(true); QIcon icon3; - icon3.addPixmap(QPixmap(QString::fromUtf8(":/images/mac/fileopen.png")), QIcon::Normal, QIcon::Off); + icon3.addFile(QString::fromUtf8(":/images/mac/fileopen.png"), QSize(), QIcon::Normal, QIcon::Off); openFileButton->setIcon(icon3); hboxLayout->addWidget(openFileButton); -- cgit v0.12 From 59cc08796bfb88bc0010006f365f1361462761aa Mon Sep 17 00:00:00 2001 From: Bjoern Erik Nilsen Date: Fri, 8 May 2009 16:00:57 +0200 Subject: Graphics View Optimization: Use a simple style option by default. QStyleOptionGraphicsItem extends QStyleOption with three values: 1) matrix, 2) levelOfDetail, 3) exposedRect, and they all involve expensive QTranform operations when calculated. We pass style option(s) to drawItems() and paint(), but the extended values are usually not in use. We can therefore gain quite some nice speedup by making them opt-in with the QGraphicsItem::ItemUsesExtendedStyleOption flag. Additionally, QStyleOptionGraphicsItem::levelOfDetail has been obsoleted, and a new function QStyleOptionGraphicsItem:: levelOfDetailFromTransform(const QTransform &) has been added. Me and Andreas don't consider this change to be too controversial even though it changes the behavior. Auto tests still pass. Reviewed-by: Andreas --- demos/chip/chip.cpp | 17 ++-- dist/changes-4.6.0 | 12 ++- src/gui/graphicsview/qgraphicsitem.cpp | 67 +++++++++++++- src/gui/graphicsview/qgraphicsitem.h | 4 +- src/gui/graphicsview/qgraphicsitem_p.h | 13 +-- src/gui/graphicsview/qgraphicsscene.cpp | 34 +------ src/gui/graphicsview/qgraphicsview.cpp | 120 +++---------------------- src/gui/graphicsview/qgraphicsview_p.h | 7 -- src/gui/graphicsview/qgraphicswidget_p.cpp | 1 + src/gui/styles/qstyleoption.cpp | 44 ++++++--- src/gui/styles/qstyleoption.h | 1 + tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 13 ++- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 2 +- 13 files changed, 155 insertions(+), 180 deletions(-) diff --git a/demos/chip/chip.cpp b/demos/chip/chip.cpp index c2b22da..4b6579e 100644 --- a/demos/chip/chip.cpp +++ b/demos/chip/chip.cpp @@ -74,8 +74,9 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid if (option->state & QStyle::State_MouseOver) fillColor = fillColor.light(125); - if (option->levelOfDetail < 0.2) { - if (option->levelOfDetail < 0.125) { + const qreal lod = option->levelOfDetailFromTransform(painter->worldTransform()); + if (lod < 0.2) { + if (lod < 0.125) { painter->fillRect(QRectF(0, 0, 110, 70), fillColor); return; } @@ -100,7 +101,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid painter->drawRect(QRect(14, 14, 79, 39)); painter->setBrush(b); - if (option->levelOfDetail >= 1) { + if (lod >= 1) { painter->setPen(QPen(Qt::gray, 1)); painter->drawLine(15, 54, 94, 54); painter->drawLine(94, 53, 94, 15); @@ -108,7 +109,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid } // Draw text - if (option->levelOfDetail >= 2) { + if (lod >= 2) { QFont font("Times", 10); font.setStyleStrategy(QFont::ForceOutline); painter->setFont(font); @@ -122,17 +123,17 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid // Draw lines QVarLengthArray lines; - if (option->levelOfDetail >= 0.5) { - for (int i = 0; i <= 10; i += (option->levelOfDetail > 0.5 ? 1 : 2)) { + if (lod >= 0.5) { + for (int i = 0; i <= 10; i += (lod > 0.5 ? 1 : 2)) { lines.append(QLineF(18 + 7 * i, 13, 18 + 7 * i, 5)); lines.append(QLineF(18 + 7 * i, 54, 18 + 7 * i, 62)); } - for (int i = 0; i <= 6; i += (option->levelOfDetail > 0.5 ? 1 : 2)) { + for (int i = 0; i <= 6; i += (lod > 0.5 ? 1 : 2)) { lines.append(QLineF(5, 18 + i * 5, 13, 18 + i * 5)); lines.append(QLineF(94, 18 + i * 5, 102, 18 + i * 5)); } } - if (option->levelOfDetail >= 0.4) { + if (lod >= 0.4) { const QLineF lineData[] = { QLineF(25, 35, 35, 35), QLineF(35, 30, 35, 40), diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index db4ab5f..6a94f26 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -38,4 +38,14 @@ information about a particular change. - The experimental Direct3D paint engine has been removed. The reasons for this is that Qt Software focuses on OpenGL for desktop - hardware accelerated rendering. \ No newline at end of file + hardware accelerated rendering. + + - QStyleOptionGraphicsItem::exposedRect and QStyleOptionGraphicsItem::matrix + does no longer contain fine-grained values when passed in drawItems()/paint() + unless the QGraphicsItem::ItemUsesExtendedStyleOptions flag is enabled. + By default, exposedRect is initialized to the item's bounding rect + and the matrix is untransformed. + + - QStyleOptionGraphicsItem::levelOfDetails is obsoleted and its value + is always initialized to 1. For a more fine-grained value use + QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &). diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index aa55908..ec08aaf 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -274,6 +274,15 @@ this flag, the child will be stacked behind it. This flag is useful for drop shadow effects and for decoration objects that follow the parent item's geometry without drawing on top of it. + + \value ItemUsesExtendedStyleOption The item makes use of either + QStyleOptionGraphicsItem::exposedRect or QStyleOptionGraphicsItem::matrix. + By default, the exposedRect is initialized to the item's boundingRect and + the matrix is untransformed. Enable this flag for more fine-grained values. + Note that QStyleOptionGraphicsItem::levelOfDetail is unaffected by this flag + and is always initialized to 1. + Use QStyleOptionGraphicsItem::levelOfDetailFromTransform for a more + fine-grained value. */ /*! @@ -914,6 +923,53 @@ void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rec } } +void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, + const QRegion &exposedRegion, bool allItems) const +{ + Q_ASSERT(option); + Q_Q(const QGraphicsItem); + + // Initialize standard QStyleOption values. + const QRectF brect = q->boundingRect(); + option->state = QStyle::State_None; + option->rect = brect.toRect(); + option->levelOfDetail = 1; + option->exposedRect = brect; + if (selected) + option->state |= QStyle::State_Selected; + if (enabled) + option->state |= QStyle::State_Enabled; + if (q->hasFocus()) + option->state |= QStyle::State_HasFocus; + if (scene) { + if (scene->d_func()->hoverItems.contains(q_ptr)) + option->state |= QStyle::State_MouseOver; + if (q == scene->mouseGrabberItem()) + option->state |= QStyle::State_Sunken; + } + + if (!(flags & QGraphicsItem::ItemUsesExtendedStyleOption)) + return; + + // Initialize QStyleOptionGraphicsItem specific values (matrix, exposedRect). + + const QTransform itemToViewportTransform = q->deviceTransform(worldTransform); + option->matrix = itemToViewportTransform.toAffine(); //### discards perspective + + if (!allItems) { + // Determine the item's exposed area + option->exposedRect = QRectF(); + const QTransform reverseMap = itemToViewportTransform.inverted(); + const QVector exposedRects(exposedRegion.rects()); + for (int i = 0; i < exposedRects.size(); ++i) { + option->exposedRect |= reverseMap.mapRect(exposedRects.at(i)); + if (option->exposedRect.contains(brect)) + break; + } + option->exposedRect &= brect; + } +} + /*! \internal @@ -3671,7 +3727,7 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity) All painting is done in local coordinates. - \sa setCacheMode(), QPen::width(), {Item Coordinates} + \sa setCacheMode(), QPen::width(), {Item Coordinates}, ItemUsesExtendedStyleOption */ /*! @@ -7635,9 +7691,7 @@ void QGraphicsPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsIte painter->setRenderHint(QPainter::SmoothPixmapTransform, (d->transformationMode == Qt::SmoothTransformation)); - QRectF exposed = option->exposedRect.adjusted(-1, -1, 1, 1); - exposed &= QRectF(d->offset.x(), d->offset.y(), d->pixmap.width(), d->pixmap.height()); - painter->drawPixmap(exposed, d->pixmap, exposed.translated(-d->offset)); + painter->drawPixmap(d->offset, d->pixmap); if (option->state & QStyle::State_Selected) qt_graphicsItem_highlightSelected(this, painter, option); @@ -7803,6 +7857,7 @@ QGraphicsTextItem::QGraphicsTextItem(const QString &text, QGraphicsItem *parent setPlainText(text); setAcceptDrops(true); setAcceptHoverEvents(true); + setFlags(ItemUsesExtendedStyleOption); } /*! @@ -7822,6 +7877,7 @@ QGraphicsTextItem::QGraphicsTextItem(QGraphicsItem *parent dd->qq = this; setAcceptDrops(true); setAcceptHoverEvents(true); + setFlag(ItemUsesExtendedStyleOption); } /*! @@ -9167,6 +9223,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemStacksBehindParent: str = "ItemStacksBehindParent"; break; + case QGraphicsItem::ItemUsesExtendedStyleOption: + str = "ItemUsesExtendedStyleOption"; + break; } debug << str; return debug; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index b98882d..0a0179e 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -94,7 +94,9 @@ public: ItemIgnoresTransformations = 0x20, ItemIgnoresParentOpacity = 0x40, ItemDoesntPropagateOpacityToChildren = 0x80, - ItemStacksBehindParent = 0x100 + ItemStacksBehindParent = 0x100, + ItemUsesExtendedStyleOption = 0x200 + // 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 2936cf1..82a48fb 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -132,7 +132,6 @@ public: ancestorFlags(0), cacheMode(0), hasBoundingRegionGranularity(0), - flags(0), hasOpacity(0), hasEffectiveOpacity(0), isWidget(0), @@ -142,6 +141,7 @@ public: dirtyClipPath(1), emptyClipPath(0), inSetPosHelper(0), + flags(0), allChildrenCombineOpacity(1), globalStackingOrder(-1), sceneTransformIndex(-1), @@ -178,6 +178,8 @@ public: void removeChild(QGraphicsItem *child); void setParentItemHelper(QGraphicsItem *parent, bool deleting); void childrenBoundingRectHelper(QTransform *x, QRectF *rect); + void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, + const QRegion &exposedRegion, bool allItems = false) const; virtual void resolveFont(uint inheritedMask) { @@ -297,7 +299,7 @@ public: int index; int depth; - // Packed 32 bytes + // Packed 32 bits quint32 acceptedMouseButtons : 5; quint32 visible : 1; quint32 explicitlyHidden : 1; @@ -314,9 +316,6 @@ public: quint32 ancestorFlags : 3; quint32 cacheMode : 2; quint32 hasBoundingRegionGranularity : 1; - quint32 flags : 9; - - // New 32 bytes quint32 hasOpacity : 1; quint32 hasEffectiveOpacity : 1; quint32 isWidget : 1; @@ -326,7 +325,11 @@ public: quint32 dirtyClipPath : 1; quint32 emptyClipPath : 1; quint32 inSetPosHelper : 1; + + // New 32 bits + quint32 flags : 10; quint32 allChildrenCombineOpacity : 1; + quint32 padding : 21; // feel free to use // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index c421f05..7318fa5 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -2247,8 +2247,6 @@ void QGraphicsScene::setSceneRect(const QRectF &rect) void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRectF &source, Qt::AspectRatioMode aspectRatioMode) { - Q_D(QGraphicsScene); - // Default source rect = scene rect QRectF sourceRect = source; if (sourceRect.isNull()) @@ -2305,36 +2303,8 @@ void QGraphicsScene::render(QPainter *painter, const QRectF &target, const QRect // Generate the style options QStyleOptionGraphicsItem *styleOptionArray = new QStyleOptionGraphicsItem[numItems]; - for (int i = 0; i < numItems; ++i) { - QGraphicsItem *item = itemArray[i]; - - QStyleOptionGraphicsItem option; - option.state = QStyle::State_None; - option.rect = item->boundingRect().toRect(); - if (item->isSelected()) - option.state |= QStyle::State_Selected; - if (item->isEnabled()) - option.state |= QStyle::State_Enabled; - if (item->hasFocus()) - option.state |= QStyle::State_HasFocus; - if (d->hoverItems.contains(item)) - option.state |= QStyle::State_MouseOver; - if (item == mouseGrabberItem()) - option.state |= QStyle::State_Sunken; - - // Calculate a simple level-of-detail metric. - // ### almost identical code in QGraphicsView::paintEvent() - // and QGraphicsView::render() - consider refactoring - QTransform itemToDeviceTransform = item->deviceTransform(painterTransform); - - option.levelOfDetail = qSqrt(itemToDeviceTransform.map(v1).length() * itemToDeviceTransform.map(v2).length()); - option.matrix = itemToDeviceTransform.toAffine(); //### discards perspective - - option.exposedRect = item->boundingRect(); - option.exposedRect &= itemToDeviceTransform.inverted().mapRect(targetRect); - - styleOptionArray[i] = option; - } + for (int i = 0; i < numItems; ++i) + itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterTransform, targetRect.toRect()); // Render the scene. drawBackground(painter, sourceRect); diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 7181045..396618c 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1127,69 +1127,6 @@ QList QGraphicsViewPrivate::findItems(const QRegion &exposedReg return itemsInArea(exposedPath, Qt::IntersectsItemBoundingRect, Qt::DescendingOrder); } -void QGraphicsViewPrivate::generateStyleOptions(const QList &itemList, - QGraphicsItem **itemArray, - QStyleOptionGraphicsItem *styleOptionArray, - const QTransform &worldTransform, - bool allItems, - const QRegion &exposedRegion) const -{ - // Two unit vectors. - QLineF v1(0, 0, 1, 0); - QLineF v2(0, 0, 0, 1); - QTransform itemToViewportTransform; - QRectF brect; - QTransform reverseMap; - - for (int i = 0; i < itemList.size(); ++i) { - QGraphicsItem *item = itemArray[i] = itemList[i]; - - QStyleOptionGraphicsItem &option = styleOptionArray[i]; - brect = item->boundingRect(); - option.state = QStyle::State_None; - option.rect = brect.toRect(); - option.exposedRect = QRectF(); - if (item->d_ptr->selected) - option.state |= QStyle::State_Selected; - if (item->d_ptr->enabled) - option.state |= QStyle::State_Enabled; - if (item->hasFocus()) - option.state |= QStyle::State_HasFocus; - if (scene->d_func()->hoverItems.contains(item)) - option.state |= QStyle::State_MouseOver; - if (item == scene->mouseGrabberItem()) - option.state |= QStyle::State_Sunken; - - // Calculate a simple level-of-detail metric. - // ### almost identical code in QGraphicsScene::render() - // and QGraphicsView::render() - consider refactoring - itemToViewportTransform = item->deviceTransform(worldTransform); - - if (itemToViewportTransform.type() <= QTransform::TxTranslate) { - // Translation and rotation only? The LOD is 1. - option.levelOfDetail = 1; - } else { - // LOD is the transformed area of a 1x1 rectangle. - option.levelOfDetail = qSqrt(itemToViewportTransform.map(v1).length() * itemToViewportTransform.map(v2).length()); - } - option.matrix = itemToViewportTransform.toAffine(); //### discards perspective - - if (!allItems) { - // Determine the item's exposed area - reverseMap = itemToViewportTransform.inverted(); - foreach (const QRect &rect, exposedRegion.rects()) { - option.exposedRect |= reverseMap.mapRect(QRectF(rect.adjusted(-1, -1, 1, 1))); - if (option.exposedRect.contains(brect)) - break; - } - option.exposedRect &= brect; - } else { - // The whole item is exposed - option.exposedRect = brect; - } - } -} - /*! Constructs a QGraphicsView. \a parent is passed to QWidget's constructor. */ @@ -2146,40 +2083,10 @@ void QGraphicsView::render(QPainter *painter, const QRectF &target, const QRect .scale(xratio, yratio) .translate(-sourceRect.left(), -sourceRect.top()); - // Two unit vectors. - QLineF v1(0, 0, 1, 0); - QLineF v2(0, 0, 0, 1); - // Generate the style options QStyleOptionGraphicsItem *styleOptionArray = d->allocStyleOptionsArray(numItems); - QStyleOptionGraphicsItem* option = styleOptionArray; - for (int i = 0; i < numItems; ++i, ++option) { - QGraphicsItem *item = itemArray[i]; - - option->state = QStyle::State_None; - option->rect = item->boundingRect().toRect(); - if (item->isSelected()) - option->state |= QStyle::State_Selected; - if (item->isEnabled()) - option->state |= QStyle::State_Enabled; - if (item->hasFocus()) - option->state |= QStyle::State_HasFocus; - if (d->scene->d_func()->hoverItems.contains(item)) - option->state |= QStyle::State_MouseOver; - if (item == d->scene->mouseGrabberItem()) - option->state |= QStyle::State_Sunken; - - // Calculate a simple level-of-detail metric. - // ### almost identical code in QGraphicsScene::render() - // and QGraphicsView::paintEvent() - consider refactoring - QTransform itemToViewportTransform = item->deviceTransform(painterMatrix); - - option->levelOfDetail = qSqrt(itemToViewportTransform.map(v1).length() * itemToViewportTransform.map(v2).length()); - option->matrix = itemToViewportTransform.toAffine(); - - option->exposedRect = item->boundingRect(); - option->exposedRect &= itemToViewportTransform.inverted().mapRect(targetRect); - } + for (int i = 0; i < numItems; ++i) + itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], painterMatrix, targetRect.toRect()); painter->save(); @@ -3538,15 +3445,17 @@ void QGraphicsView::paintEvent(QPaintEvent *event) int backgroundTime = stopWatch.elapsed() - exposedTime; #endif - // Generate the style options - QGraphicsItem **itemArray = new QGraphicsItem *[itemList.size()]; - QStyleOptionGraphicsItem *styleOptionArray = d->allocStyleOptionsArray(itemList.size()); - - d->generateStyleOptions(itemList, itemArray, styleOptionArray, viewTransform, - allItems, exposedRegion); - - // Items - drawItems(&painter, itemList.size(), itemArray, styleOptionArray); + if (!itemList.isEmpty()) { + // Generate the style options. + const int numItems = itemList.size(); + QGraphicsItem **itemArray = &itemList[0]; // Relies on QList internals, but is perfectly valid. + QStyleOptionGraphicsItem *styleOptionArray = d->allocStyleOptionsArray(numItems); + for (int i = 0; i < numItems; ++i) + itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], viewTransform, exposedRegion, allItems); + // Draw the items. + drawItems(&painter, numItems, itemArray, styleOptionArray); + d->freeStyleOptionsArray(styleOptionArray); + } #ifdef QGRAPHICSVIEW_DEBUG int itemsTime = stopWatch.elapsed() - exposedTime - backgroundTime; @@ -3555,9 +3464,6 @@ void QGraphicsView::paintEvent(QPaintEvent *event) // Foreground drawForeground(&painter, exposedSceneRect); - delete [] itemArray; - d->freeStyleOptionsArray(styleOptionArray); - #ifdef QGRAPHICSVIEW_DEBUG int foregroundTime = stopWatch.elapsed() - exposedTime - backgroundTime - itemsTime; #endif diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index d573e8f..c18f85d 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -174,13 +174,6 @@ public: bool updateSceneSlotReimplementedChecked; QList findItems(const QRegion &exposedRegion, bool *allItems) const; - - void generateStyleOptions(const QList &itemList, - QGraphicsItem **itemArray, - QStyleOptionGraphicsItem *styleOptionArray, - const QTransform &worldTransform, - bool allItems, - const QRegion &exposedRegion) const; }; QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 8ced47a..a435758 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -76,6 +76,7 @@ void QGraphicsWidgetPrivate::init(QGraphicsItem *parentItem, Qt::WindowFlags wFl resolveLayoutDirection(); q->unsetWindowFrameMargins(); + q->setFlag(QGraphicsItem::ItemUsesExtendedStyleOption); } qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const { diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp index ce053ae..5b1bc61 100644 --- a/src/gui/styles/qstyleoption.cpp +++ b/src/gui/styles/qstyleoption.cpp @@ -48,6 +48,7 @@ #ifndef QT_NO_DEBUG #include #endif +#include QT_BEGIN_NAMESPACE @@ -4998,6 +4999,34 @@ QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int version) } /*! + \since 4.6 + + Returns the level of detail from the \a worldTransform. + + Its value represents the maximum value of the height and + width of a unity rectangle, mapped using the \a worldTransform + of the painter used to draw the item. By default, if no + transformations are applied, its value is 1. If zoomed out 1:2, the level + of detail will be 0.5, and if zoomed in 2:1, its value is 2. + + For more advanced level-of-detail metrics, use + QStyleOptionGraphicsItem::matrix directly. + + \sa QStyleOptionGraphicsItem::matrix +*/ +qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &worldTransform) +{ + if (worldTransform.type() <= QTransform::TxTranslate) + return 1; // Translation only? The LOD is 1. + + // Two unit vectors. + QLineF v1(0, 0, 1, 0); + QLineF v2(0, 0, 0, 1); + // LOD is the transformed area of a 1x1 rectangle. + return qSqrt(worldTransform.map(v1).length() * worldTransform.map(v2).length()); +} + +/*! \fn QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) Constructs a copy of \a other. @@ -5029,19 +5058,10 @@ QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int version) /*! \variable QStyleOptionGraphicsItem::levelOfDetail - \brief a simple metric for determining an item's level of detail - - This simple metric provides an easy way to determine the level of detail - for an item. Its value represents the maximum value of the height and - width of a unity rectangle, mapped using the complete transformation - matrix of the painter used to draw the item. By default, if no - transformations are applied, its value is 1. If zoomed out 1:2, the level - of detail will be 0.5, and if zoomed in 2:1, its value is 2. - - For more advanced level-of-detail metrics, use - QStyleOptionGraphicsItem::matrix directly. + \obsolete - \sa QStyleOptionGraphicsItem::matrix + Use QStyleOptionGraphicsItem::levelOfDetailFromTransform + together with QPainter::worldTransform() instead. */ /*! diff --git a/src/gui/styles/qstyleoption.h b/src/gui/styles/qstyleoption.h index 5759a05..eb05324 100644 --- a/src/gui/styles/qstyleoption.h +++ b/src/gui/styles/qstyleoption.h @@ -856,6 +856,7 @@ public: QStyleOptionGraphicsItem(); QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) : QStyleOption(Version, Type) { *this = other; } + static qreal levelOfDetailFromTransform(const QTransform &worldTransform); protected: QStyleOptionGraphicsItem(int version); }; diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 8602307..b3ae60a 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -247,50 +247,59 @@ void tst_QGraphicsItem::construction() QCOMPARE(int(item->type()), int(QGraphicsEllipseItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsEllipseItem *)item); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + QCOMPARE(item->flags(), 0); break; case 1: item = new QGraphicsLineItem; QCOMPARE(int(item->type()), int(QGraphicsLineItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsLineItem *)item); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + QCOMPARE(item->flags(), 0); break; case 2: item = new QGraphicsPathItem; QCOMPARE(int(item->type()), int(QGraphicsPathItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsPathItem *)item); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + QCOMPARE(item->flags(), 0); break; case 3: item = new QGraphicsPixmapItem; QCOMPARE(int(item->type()), int(QGraphicsPixmapItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsPixmapItem *)item); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + QCOMPARE(item->flags(), 0); break; case 4: item = new QGraphicsPolygonItem; QCOMPARE(int(item->type()), int(QGraphicsPolygonItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsPolygonItem *)item); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + QCOMPARE(item->flags(), 0); break; case 5: item = new QGraphicsRectItem; QCOMPARE(int(item->type()), int(QGraphicsRectItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)item); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsLineItem *)0); + QCOMPARE(item->flags(), 0); break; case 6: - default: item = new QGraphicsTextItem; QCOMPARE(int(item->type()), int(QGraphicsTextItem::Type)); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsTextItem *)item); QCOMPARE(qgraphicsitem_cast(item), (QGraphicsRectItem *)0); + // This is the only item that uses an extended style option. + QCOMPARE(item->flags(), QGraphicsItem::GraphicsItemFlags(QGraphicsItem::ItemUsesExtendedStyleOption)); + break; + default: + qFatal("You broke the logic, please fix!"); break; } QCOMPARE(item->scene(), (QGraphicsScene *)0); QCOMPARE(item->parentItem(), (QGraphicsItem *)0); QVERIFY(item->children().isEmpty()); - QCOMPARE(item->flags(), 0); QVERIFY(item->isVisible()); QVERIFY(item->isEnabled()); QVERIFY(!item->isSelected()); diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 920cba7..8e490ad 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -2371,7 +2371,7 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *viewport) { - lastLod = option->levelOfDetail; + lastLod = option->levelOfDetailFromTransform(painter->worldTransform()); QGraphicsRectItem::paint(painter, option, viewport); } -- cgit v0.12 From 247952ec74cede6a69c718ef039e00b21a877e56 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 18 May 2009 10:34:27 +1000 Subject: Don't traverse clipped canvas trees. --- src/declarative/canvas/qsimplecanvas_software.cpp | 106 ++++++++++++---------- src/declarative/canvas/qsimplecanvasitem.cpp | 2 +- src/declarative/canvas/qsimplecanvasitem_p.h | 2 + 3 files changed, 60 insertions(+), 50 deletions(-) diff --git a/src/declarative/canvas/qsimplecanvas_software.cpp b/src/declarative/canvas/qsimplecanvas_software.cpp index 194024d..f822677 100644 --- a/src/declarative/canvas/qsimplecanvas_software.cpp +++ b/src/declarative/canvas/qsimplecanvas_software.cpp @@ -51,52 +51,56 @@ QRect QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &bounding QRectF boundingRectActive = q->boundingRect(); QRect rv = data()->transformActive.mapRect(boundingRectActive).toAlignedRect() & bounding; + data()->doNotPaint = rv.isEmpty(); + data()->doNotPaintChildren = data()->doNotPaint && q->clip(); QRect myBounding = bounding; if (q->clip()) myBounding &= rv; - for (int ii = 0; ii < children.count(); ++ii) { - QSimpleCanvasItem *child = children.at(ii); - - qreal visible = child->visible(); - child->d_func()->data()->activeOpacity = data()->activeOpacity; - if (visible != 1) - child->d_func()->data()->activeOpacity *= visible; - - if (child->d_func()->data()->activeOpacity != 0) { - // Calculate child's transform - qreal x = child->x(); - qreal y = child->y(); - qreal scale = child->scale(); - QSimpleCanvasItem::Flip flip = child->flip(); - - QSimpleCanvas::Matrix &am = child->d_func()->data()->transformActive; - am = data()->transformActive; - if (x != 0 || y != 0) - am.translate(x, y); - if (scale != 1) { - QPointF to = child->d_func()->transformOrigin(); - if (to.x() != 0. || to.y() != 0.) - am.translate(to.x(), to.y()); - am.scale(scale, scale); - if (to.x() != 0. || to.y() != 0.) - am.translate(-to.x(), -to.y()); - } - - if (child->d_func()->data()->transformUser) - am = *child->d_func()->data()->transformUser * am; - - if (flip) { - QRectF br = child->boundingRect(); - am.translate(br.width() / 2., br.height() / 2); - am.scale((flip & QSimpleCanvasItem::HorizontalFlip)?-1:1, - (flip & QSimpleCanvasItem::VerticalFlip)?-1:1); - am.translate(-br.width() / 2., -br.height() / 2); - } - child->d_func()->data()->transformValid = true; - rv |= child->d_func()->setupPainting(version, myBounding); - } - } + if (!data()->doNotPaintChildren) { + for (int ii = 0; ii < children.count(); ++ii) { + QSimpleCanvasItem *child = children.at(ii); + + qreal visible = child->visible(); + child->d_func()->data()->activeOpacity = data()->activeOpacity; + if (visible != 1) + child->d_func()->data()->activeOpacity *= visible; + + if (child->d_func()->data()->activeOpacity != 0) { + // Calculate child's transform + qreal x = child->x(); + qreal y = child->y(); + qreal scale = child->scale(); + QSimpleCanvasItem::Flip flip = child->flip(); + + QSimpleCanvas::Matrix &am = child->d_func()->data()->transformActive; + am = data()->transformActive; + if (x != 0 || y != 0) + am.translate(x, y); + if (scale != 1) { + QPointF to = child->d_func()->transformOrigin(); + if (to.x() != 0. || to.y() != 0.) + am.translate(to.x(), to.y()); + am.scale(scale, scale); + if (to.x() != 0. || to.y() != 0.) + am.translate(-to.x(), -to.y()); + } + + if (child->d_func()->data()->transformUser) + am = *child->d_func()->data()->transformUser * am; + + if (flip) { + QRectF br = child->boundingRect(); + am.translate(br.width() / 2., br.height() / 2); + am.scale((flip & QSimpleCanvasItem::HorizontalFlip)?-1:1, + (flip & QSimpleCanvasItem::VerticalFlip)?-1:1); + am.translate(-br.width() / 2., -br.height() / 2); + } + child->d_func()->data()->transformValid = true; + rv |= child->d_func()->setupPainting(version, myBounding); + } + } + } data()->lastPaintRect = rv; return rv; @@ -162,13 +166,17 @@ void QSimpleCanvasItemPrivate::paint(QPainter &p) } } - p.setWorldTransform(data()->transformActive); - q->paintContents(p); - - for (; upto < children.count(); ++upto) { - QSimpleCanvasItem *c = children.at(upto); - paintChild(p, c); - } + if (!data()->doNotPaint) { + p.setWorldTransform(data()->transformActive); + q->paintContents(p); + } + + if (!data()->doNotPaintChildren) { + for (; upto < children.count(); ++upto) { + QSimpleCanvasItem *c = children.at(upto); + paintChild(p, c); + } + } if (clip) p.restore(); diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp index 12c725c..9c110d7 100644 --- a/src/declarative/canvas/qsimplecanvasitem.cpp +++ b/src/declarative/canvas/qsimplecanvasitem.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QSimpleCanvasItemData::QSimpleCanvasItemData() : buttons(Qt::NoButton), flip(QSimpleCanvasItem::NoFlip), - dirty(false), transformValid(true), x(0), y(0), z(0), visible(1), + dirty(false), transformValid(true), doNotPaint(false), doNotPaintChildren(false), x(0), y(0), z(0), visible(1), transformUser(0), activeOpacity(1) { } diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h index cfe0bba..a20b8f4 100644 --- a/src/declarative/canvas/qsimplecanvasitem_p.h +++ b/src/declarative/canvas/qsimplecanvasitem_p.h @@ -92,6 +92,8 @@ public: QSimpleCanvasItem::Flip flip:2; bool dirty:1; bool transformValid:1; + bool doNotPaint:1; + bool doNotPaintChildren:1; qreal x; qreal y; -- cgit v0.12 From 6566578d6301523e1e17d0aa5af2663822ffb567 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 18 May 2009 10:47:11 +1000 Subject: Remove moc line --- src/declarative/util/qmlsetproperties.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp index 9a1095c..34d3b00 100644 --- a/src/declarative/util/qmlsetproperties.cpp +++ b/src/declarative/util/qmlsetproperties.cpp @@ -344,4 +344,3 @@ QmlSetProperties::ActionList QmlSetProperties::actions() QML_DEFINE_CUSTOM_TYPE(QmlSetProperties,SetProperties,QmlSetPropertiesParser); QT_END_NAMESPACE -#include "qmlsetproperties.moc" -- cgit v0.12 From 3e5c94c368c261190992b9c0f8b4223c35ede407 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 18 May 2009 11:44:26 +1000 Subject: More aggressively skip calculations --- src/declarative/canvas/qsimplecanvas.cpp | 5 +- src/declarative/canvas/qsimplecanvas_p.h | 2 + src/declarative/canvas/qsimplecanvas_software.cpp | 119 ++++++++++++++-------- src/declarative/canvas/qsimplecanvasitem.cpp | 7 +- src/declarative/canvas/qsimplecanvasitem_p.h | 2 +- 5 files changed, 84 insertions(+), 51 deletions(-) diff --git a/src/declarative/canvas/qsimplecanvas.cpp b/src/declarative/canvas/qsimplecanvas.cpp index e1dd0e8..cd50945 100644 --- a/src/declarative/canvas/qsimplecanvas.cpp +++ b/src/declarative/canvas/qsimplecanvas.cpp @@ -621,8 +621,10 @@ QSimpleCanvas::~QSimpleCanvas() void QSimpleCanvasPrivate::paint(QPainter &p) { #if defined(QFX_RENDER_QPAINTER) - if (!isSetup) + if (!isSetup) { + ++paintVersion; root->d_func()->setupPainting(0, q->rect()); + } lrpTimer.start(); @@ -920,6 +922,7 @@ bool QSimpleCanvas::event(QEvent *e) unsigned int zero = 0; d->root->d_func()->setupPainting(0, rect(), &zero); #else + ++d->paintVersion; d->root->d_func()->setupPainting(0, rect()); #endif diff --git a/src/declarative/canvas/qsimplecanvas_p.h b/src/declarative/canvas/qsimplecanvas_p.h index 7bc7330..9c3408e 100644 --- a/src/declarative/canvas/qsimplecanvas_p.h +++ b/src/declarative/canvas/qsimplecanvas_p.h @@ -112,6 +112,7 @@ public: #if defined(QFX_RENDER_OPENGL) ,egl(q, this), basicShadersInstance(0) #endif + , paintVersion(1) { } @@ -190,6 +191,7 @@ public: void release(QGLFramebufferObject *); void paintGL(); #endif + int paintVersion; }; #endif diff --git a/src/declarative/canvas/qsimplecanvas_software.cpp b/src/declarative/canvas/qsimplecanvas_software.cpp index f822677..dd5e201 100644 --- a/src/declarative/canvas/qsimplecanvas_software.cpp +++ b/src/declarative/canvas/qsimplecanvas_software.cpp @@ -41,6 +41,7 @@ #include "qsimplecanvas.h" #include "qsimplecanvasitem_p.h" +#include "qsimplecanvas_p.h" QT_BEGIN_NAMESPACE @@ -48,9 +49,15 @@ QRect QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &bounding { Q_Q(QSimpleCanvasItem); - QRectF boundingRectActive = q->boundingRect(); - QRect rv = - data()->transformActive.mapRect(boundingRectActive).toAlignedRect() & bounding; + bool hasContents = options & QSimpleCanvasItem::HasContents; + + QRect rv; + + if (hasContents || q->clip()) { + QRectF boundingRectActive = q->boundingRect(); + rv = data()->transformActive.mapRect(boundingRectActive).toAlignedRect() & bounding; + } + data()->doNotPaint = rv.isEmpty(); data()->doNotPaintChildren = data()->doNotPaint && q->clip(); QRect myBounding = bounding; @@ -61,48 +68,68 @@ QRect QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &bounding for (int ii = 0; ii < children.count(); ++ii) { QSimpleCanvasItem *child = children.at(ii); - qreal visible = child->visible(); - child->d_func()->data()->activeOpacity = data()->activeOpacity; - if (visible != 1) - child->d_func()->data()->activeOpacity *= visible; - + int childVersion = version; + if (!child->d_func()->data()->transformValid) + childVersion = canvas->d->paintVersion; + + bool recalcNeeded = + (childVersion > child->d_func()->data()->transformVersion); + + if (recalcNeeded) { + qreal visible = child->visible(); + child->d_func()->data()->activeOpacity = data()->activeOpacity; + if (visible != 1) + child->d_func()->data()->activeOpacity *= visible; + } + if (child->d_func()->data()->activeOpacity != 0) { - // Calculate child's transform - qreal x = child->x(); - qreal y = child->y(); - qreal scale = child->scale(); - QSimpleCanvasItem::Flip flip = child->flip(); - - QSimpleCanvas::Matrix &am = child->d_func()->data()->transformActive; - am = data()->transformActive; - if (x != 0 || y != 0) - am.translate(x, y); - if (scale != 1) { - QPointF to = child->d_func()->transformOrigin(); - if (to.x() != 0. || to.y() != 0.) - am.translate(to.x(), to.y()); - am.scale(scale, scale); - if (to.x() != 0. || to.y() != 0.) - am.translate(-to.x(), -to.y()); - } - - if (child->d_func()->data()->transformUser) - am = *child->d_func()->data()->transformUser * am; - - if (flip) { - QRectF br = child->boundingRect(); - am.translate(br.width() / 2., br.height() / 2); - am.scale((flip & QSimpleCanvasItem::HorizontalFlip)?-1:1, - (flip & QSimpleCanvasItem::VerticalFlip)?-1:1); - am.translate(-br.width() / 2., -br.height() / 2); - } - child->d_func()->data()->transformValid = true; - rv |= child->d_func()->setupPainting(version, myBounding); + if (recalcNeeded) { + // Calculate child's transform + qreal x = child->x(); + qreal y = child->y(); + qreal scale = child->scale(); + QSimpleCanvasItem::Flip flip = child->flip(); + + QSimpleCanvas::Matrix &am = + child->d_func()->data()->transformActive; + am = data()->transformActive; + if (x != 0 || y != 0) + am.translate(x, y); + if (scale != 1) { + QPointF to = child->d_func()->transformOrigin(); + if (to.x() != 0. || to.y() != 0.) + am.translate(to.x(), to.y()); + am.scale(scale, scale); + if (to.x() != 0. || to.y() != 0.) + am.translate(-to.x(), -to.y()); + } + + if (child->d_func()->data()->transformUser) + am = *child->d_func()->data()->transformUser * am; + + if (flip) { + QRectF br = child->boundingRect(); + am.translate(br.width() / 2., br.height() / 2); + am.scale((flip & QSimpleCanvasItem::HorizontalFlip)?-1:1, + (flip & QSimpleCanvasItem::VerticalFlip)?-1:1); + am.translate(-br.width() / 2., -br.height() / 2); + } + child->d_func()->data()->transformValid = true; + child->d_func()->data()->transformVersion = childVersion; + } + rv |= child->d_func()->setupPainting(child->d_func()->data()->transformVersion, myBounding); } } } data()->lastPaintRect = rv; + if (!data()->doNotPaintChildren) { + if (!bounding.intersects(rv)) { + data()->doNotPaintChildren = true; + data()->doNotPaint = true; + } + } + return rv; } @@ -157,12 +184,14 @@ void QSimpleCanvasItemPrivate::paint(QPainter &p) zOrderChildren(); int upto = 0; - for (upto = 0; upto < children.count(); ++upto) { - QSimpleCanvasItem *c = children.at(upto); - if (c->z() < 0) { - paintChild(p, c); - } else { - break; + if (!data()->doNotPaintChildren) { + for (upto = 0; upto < children.count(); ++upto) { + QSimpleCanvasItem *c = children.at(upto); + if (c->z() < 0) { + paintChild(p, c); + } else { + break; + } } } diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp index 9c110d7..a62dbc9 100644 --- a/src/declarative/canvas/qsimplecanvasitem.cpp +++ b/src/declarative/canvas/qsimplecanvasitem.cpp @@ -50,8 +50,9 @@ QT_BEGIN_NAMESPACE QSimpleCanvasItemData::QSimpleCanvasItemData() : buttons(Qt::NoButton), flip(QSimpleCanvasItem::NoFlip), - dirty(false), transformValid(true), doNotPaint(false), doNotPaintChildren(false), x(0), y(0), z(0), visible(1), - transformUser(0), activeOpacity(1) + dirty(false), transformValid(true), doNotPaint(false), + doNotPaintChildren(false), x(0), y(0), z(0), visible(1), + transformUser(0), transformVersion(0), activeOpacity(1) { } @@ -934,8 +935,6 @@ QRectF QSimpleCanvasItem::mapToScene(const QRectF &r) const } } -int QSimpleCanvasItemPrivate::nextTransformVersion = 1; - void QSimpleCanvasItemPrivate::freshenTransforms() const { if (freshenNeeded()) diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h index a20b8f4..34880f0 100644 --- a/src/declarative/canvas/qsimplecanvasitem_p.h +++ b/src/declarative/canvas/qsimplecanvasitem_p.h @@ -102,6 +102,7 @@ public: QSimpleCanvas::Matrix *transformUser; QSimpleCanvas::Matrix transformActive; + int transformVersion; float activeOpacity; @@ -238,7 +239,6 @@ public: #endif void zOrderChildren(); - static int nextTransformVersion; bool freshenNeeded() const; void doFreshenTransforms() const; -- cgit v0.12 From dd9899ac1523d8ed38eb689d486c3cfb3ad5236a Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 18 May 2009 12:43:11 +1000 Subject: GraphicsView preserves stacking order --- src/declarative/canvas/qsimplecanvasitem.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp index a62dbc9..dfe02c0 100644 --- a/src/declarative/canvas/qsimplecanvasitem.cpp +++ b/src/declarative/canvas/qsimplecanvasitem.cpp @@ -1505,11 +1505,8 @@ void QSimpleCanvasItemPrivate::convertToGraphicsItem(QGraphicsItem *parent) q->setClipType(clip); - for (int ii = 0; ii < children.count(); ++ii) { + for (int ii = 0; ii < children.count(); ++ii) static_cast(children.at(ii)->d_ptr)->convertToGraphicsItem(graphicsItem); - if (children.at(ii)->z() == 0) - children.at(ii)->setZ(ii); - } } /*! -- cgit v0.12 From 00d012f3f2d8971d277a6177d6d707cf31e155f4 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 18 May 2009 13:15:56 +1000 Subject: Start work on translation support in Qml. Added basic support for qsTr in Qml, both in the engine and in lupdate. --- src/declarative/qml/qmlengine.cpp | 19 +++- src/declarative/qml/qmlengine_p.h | 2 + src/declarative/qml/qmlexpression.h | 2 + src/declarative/qml/qmlvme.cpp | 2 + tools/linguist/lupdate/lupdate.h | 1 + tools/linguist/lupdate/lupdate.pro | 4 + tools/linguist/lupdate/main.cpp | 2 + tools/linguist/lupdate/qml.cpp | 205 ++++++++++++++++++++++++++++++++++++ 8 files changed, 233 insertions(+), 4 deletions(-) create mode 100644 tools/linguist/lupdate/qml.cpp diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index b2d3a9c..0209c1d 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -193,6 +193,7 @@ void QmlEnginePrivate::clear(SimpleList &pss) void QmlEnginePrivate::init() { + scriptEngine.installTranslatorFunctions(); contextClass = new QmlContextScriptClass(q); objectClass = new QmlObjectScriptClass(q); rootContext = new QmlContext(q); @@ -781,17 +782,17 @@ QmlEngine *QmlEngine::activeEngine() QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b) -: q(b), ctxt(0), sseData(0), proxy(0), me(0), trackChange(false), id(0), log(0) +: q(b), ctxt(0), sseData(0), proxy(0), me(0), trackChange(false), line(-1), id(0), log(0) { } QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b, void *expr, QmlRefCount *rc) -: q(b), ctxt(0), sse((const char *)expr, rc), sseData(0), proxy(0), me(0), trackChange(true), id(0), log(0) +: q(b), ctxt(0), sse((const char *)expr, rc), sseData(0), proxy(0), me(0), trackChange(true), line(-1), id(0), log(0) { } QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b, const QString &expr, bool ssecompile) -: q(b), ctxt(0), expression(expr), sseData(0), proxy(0), me(0), trackChange(true), id(0), log(0) +: q(b), ctxt(0), expression(expr), sseData(0), proxy(0), me(0), trackChange(true), line(-1), id(0), log(0) { if (ssecompile) { #ifdef Q_ENABLE_PERFORMANCE_LOG @@ -996,7 +997,7 @@ QVariant QmlExpression::value() for (int i = context()->d_func()->scopeChain.size() - 1; i > -1; --i) { scriptEngine->currentContext()->pushScope(context()->d_func()->scopeChain.at(i)); } - QScriptValue svalue = scriptEngine->evaluate(expression()); + QScriptValue svalue = scriptEngine->evaluate(expression(), d->fileName, d->line); if (scriptEngine->hasUncaughtException()) { if (scriptEngine->uncaughtException().isError()){ QScriptValue exception = scriptEngine->uncaughtException(); @@ -1151,6 +1152,16 @@ void QmlExpression::setTrackChange(bool trackChange) } /*! + Set the location of this expression to \a line of \a fileName. This information + is used by the script engine. +*/ +void QmlExpression::setSourceLocation(const QString &fileName, int line) +{ + d->fileName = fileName; + d->line = line; +} + +/*! Returns the expression's scope object, if provided, otherwise 0. In addition to data provided by the expression's QmlContext, the scope diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 7578fdf..7cafb59 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -277,6 +277,8 @@ public: BindExpressionProxy *proxy; QObject *me; bool trackChange; + QString fileName; + int line; quint32 id; diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qmlexpression.h index 2c6b1ad..ea3b093 100644 --- a/src/declarative/qml/qmlexpression.h +++ b/src/declarative/qml/qmlexpression.h @@ -78,6 +78,8 @@ public: bool trackChange() const; void setTrackChange(bool); + void setSourceLocation(const QString &fileName, int line); + QObject *scopeObject() const; quint32 id() const; diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 53ed05a..f4ce891 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -526,6 +526,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in QFx_setParent_noEvent(bind, target); bind->setTarget(mp); + bind->setSourceLocation(comp->url.toString(), instr.line); } break; @@ -551,6 +552,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in QFx_setParent_noEvent(bind, target); bind->setTarget(mp); + bind->setSourceLocation(comp->url.toString(), instr.line); } break; diff --git a/tools/linguist/lupdate/lupdate.h b/tools/linguist/lupdate/lupdate.h index 2f98643..6db544f 100644 --- a/tools/linguist/lupdate/lupdate.h +++ b/tools/linguist/lupdate/lupdate.h @@ -79,6 +79,7 @@ void loadCPP(Translator &translator, const QStringList &filenames, ConversionDat bool loadJava(Translator &translator, const QString &filename, ConversionData &cd); bool loadQScript(Translator &translator, const QString &filename, ConversionData &cd); bool loadUI(Translator &translator, const QString &filename, ConversionData &cd); +bool loadQml(Translator &translator, const QString &filename, ConversionData &cd); QT_END_NAMESPACE diff --git a/tools/linguist/lupdate/lupdate.pro b/tools/linguist/lupdate/lupdate.pro index ccc2d47..283d69f 100644 --- a/tools/linguist/lupdate/lupdate.pro +++ b/tools/linguist/lupdate/lupdate.pro @@ -15,6 +15,9 @@ build_all:!build_pass { include(../shared/formats.pri) include(../shared/proparser.pri) +include($$QT_SOURCE_TREE/src/declarative/qml/parser/parser.pri) +INCLUDEPATH += $$QT_SOURCE_TREE/src/declarative/qml + SOURCES += \ main.cpp \ merge.cpp \ @@ -23,6 +26,7 @@ SOURCES += \ cpp.cpp \ java.cpp \ qscript.cpp \ + qml.cpp \ ui.cpp HEADERS += \ diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 8a70b55..8597672 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -518,6 +518,8 @@ int main(int argc, char **argv) else if (it->endsWith(QLatin1String(".js"), Qt::CaseInsensitive) || it->endsWith(QLatin1String(".qs"), Qt::CaseInsensitive)) loadQScript(fetchedTor, *it, cd); + else if (it->endsWith(QLatin1String(".qml"), Qt::CaseInsensitive)) + loadQml(fetchedTor, *it, cd); else sourceFilesCpp << *it; } diff --git a/tools/linguist/lupdate/qml.cpp b/tools/linguist/lupdate/qml.cpp new file mode 100644 index 0000000..8c3f1c5 --- /dev/null +++ b/tools/linguist/lupdate/qml.cpp @@ -0,0 +1,205 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "lupdate.h" + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#include "parser/javascriptengine_p.h" +#include "parser/javascriptparser_p.h" +#include "parser/javascriptlexer_p.h" +#include "parser/javascriptnodepool_p.h" +#include "parser/javascriptastvisitor_p.h" +#include "parser/javascriptast_p.h" + +#include +#include +#include +#include +#include + +#include +#include + +using namespace JavaScript; + +class FindTrCalls: protected AST::Visitor +{ +public: + void operator()(Translator *translator, const QString &fileName, AST::Node *node) + { + m_translator = translator; + m_fileName = fileName; + m_component = QFileInfo(fileName).baseName(); //matches qsTr usage in QScriptEngine + accept(node); + } + +protected: + using AST::Visitor::visit; + using AST::Visitor::endVisit; + + void accept(AST::Node *node) + { AST::Node::acceptChild(node, this); } + + virtual void endVisit(AST::CallExpression *node) + { + if (AST::IdentifierExpression *idExpr = AST::cast(node->base)) { + if (idExpr->name->asString() == QLatin1String("qsTr")) { + if (node->arguments && AST::cast(node->arguments->expression)) { + AST::StringLiteral *literal = AST::cast(node->arguments->expression); + const QString source = literal->value->asString(); + + QString comment; + AST::ArgumentList *commentNode = node->arguments->next; + if (commentNode) { + literal = AST::cast(commentNode->expression); + comment = literal->value->asString(); + } + + bool plural = false; + AST::ArgumentList *nNode = commentNode->next; + if (nNode) { + AST::NumericLiteral *literal3 = AST::cast(nNode->expression); + if (literal3) { + plural = true; + } + } + + TranslatorMessage msg(m_component, source, + comment, QString(), m_fileName, + node->firstSourceLocation().startLine, QStringList(), + TranslatorMessage::Unfinished, plural); + m_translator->extend(msg); + } + } + //### support qsTranslate, QT_TR_NOOP, and QT_TRANSLATE_NOOP + } + } + +private: + Translator *m_translator; + QString m_fileName; + QString m_component; +}; + +QString createErrorString(const QString &filename, const QString &code, Parser &parser) +{ + // print out error + QStringList lines = code.split(QLatin1Char('\n')); + lines.append(QLatin1String("\n")); // sentinel. + QString errorString; + + foreach (const DiagnosticMessage &m, parser.diagnosticMessages()) { + + if (m.isWarning()) + continue; + + QString error = filename + QLatin1Char(':') + QString::number(m.loc.startLine) + + QLatin1Char(':') + QString::number(m.loc.startColumn) + QLatin1String(": error: ") + + m.message + QLatin1Char('\n'); + + int line = 0; + if (m.loc.startLine > 0) + line = m.loc.startLine - 1; + + const QString textLine = lines.at(line); + + error += textLine + QLatin1Char('\n'); + + int column = m.loc.startColumn - 1; + if (column < 0) + column = 0; + + column = qMin(column, textLine.length()); + + for (int i = 0; i < column; ++i) { + const QChar ch = textLine.at(i); + if (ch.isSpace()) + error += ch.unicode(); + else + error += QLatin1Char(' '); + } + error += QLatin1String("^\n"); + errorString += error; + } + return errorString; +} + +bool loadQml(Translator &translator, const QString &filename, ConversionData &cd) +{ + cd.m_sourceFileName = filename; + QFile file(filename); + if (!file.open(QIODevice::ReadOnly)) { + cd.appendError(QString::fromLatin1("Cannot open %1: %2") + .arg(filename, file.errorString())); + return false; + } + + const QString code = QTextStream(&file).readAll(); + + Engine driver; + Parser parser(&driver); + + NodePool nodePool(filename, &driver); + driver.setNodePool(&nodePool); + + Lexer lexer(&driver); + lexer.setCode(code, /*line = */ 1); + driver.setLexer(&lexer); + + if (parser.parse()) { + FindTrCalls trCalls; + trCalls(&translator, filename, parser.ast()); + } else { + QString error = createErrorString(filename, code, parser); + cd.appendError(error); + return false; + } + return true; +} + +QT_END_NAMESPACE -- cgit v0.12 From 504c489d40e815397235ba26df7f06aae821c88a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 18 May 2009 14:00:16 +1000 Subject: Better looking scale grid painting at small sizes. This is tailored for the common case (where left == right and top == bottom) and splits the area evenly rather than proportionally between the two sides. --- src/declarative/fx/qfximage.cpp | 36 +++++++++++++++++----------- src/declarative/fx/qfxrect.cpp | 52 +++++++++++++++++++++++++---------------- 2 files changed, 54 insertions(+), 34 deletions(-) diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 9d7a36a..4197a80 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -361,49 +361,57 @@ void QFxImage::paintContents(QPainter &p) p.drawImage(0, 0, pix); } } else { - const int sgl = d->_scaleGrid->left(); - const int sgr = d->_scaleGrid->right(); - const int sgt = d->_scaleGrid->top(); - const int sgb = d->_scaleGrid->bottom(); - const int xSide = qMin(sgl + sgr, int(width())); - const int ySide = qMin(sgt + sgb, int(height())); + int sgl = d->_scaleGrid->left(); + int sgr = d->_scaleGrid->right(); + int sgt = d->_scaleGrid->top(); + int sgb = d->_scaleGrid->bottom(); + + int w = width(); + int h = height(); + if (sgt + sgb > h) + sgt = sgb = h/2; + if (sgl + sgr > w) + sgl = sgr = w/2; + + const int xSide = sgl + sgr; + const int ySide = sgt + sgb; // Upper left if (sgt && sgl) p.drawImage(QRect(0, 0, sgl, sgt), pix, QRect(0, 0, sgl, sgt)); // Upper middle if (pix.width() - xSide && sgt) - p.drawImage(QRect(sgl, 0, width() - xSide, sgt), pix, + p.drawImage(QRect(sgl, 0, w - xSide, sgt), pix, QRect(sgl, 0, pix.width() - xSide, sgt)); // Upper right if (sgt && pix.width() - sgr) - p.drawImage(QPoint(width()-sgr, 0), pix, + p.drawImage(QPoint(w-sgr, 0), pix, QRect(pix.width()-sgr, 0, sgr, sgt)); // Middle left if (sgl && pix.height() - ySide) - p.drawImage(QRect(0, sgt, sgl, height() - ySide), pix, + p.drawImage(QRect(0, sgt, sgl, h - ySide), pix, QRect(0, sgt, sgl, pix.height() - ySide)); // Middle if (pix.width() - xSide && pix.height() - ySide) - p.drawImage(QRect(sgl, sgt, width() - xSide, height() - ySide), + p.drawImage(QRect(sgl, sgt, w - xSide, h - ySide), pix, QRect(sgl, sgt, pix.width() - xSide, pix.height() - ySide)); // Middle right if (sgr && pix.height() - ySide) - p.drawImage(QRect(width()-sgr, sgt, sgr, height() - ySide), pix, + p.drawImage(QRect(w-sgr, sgt, sgr, h - ySide), pix, QRect(pix.width()-sgr, sgt, sgr, pix.height() - ySide)); // Lower left if (sgl && sgr) - p.drawImage(QPoint(0, height() - sgb), pix, + p.drawImage(QPoint(0, h - sgb), pix, QRect(0, pix.height() - sgb, sgl, sgb)); // Lower Middle if (pix.width() - xSide && sgb) - p.drawImage(QRect(sgl, height() - sgb, width() - xSide, sgb), pix, + p.drawImage(QRect(sgl, h - sgb, w - xSide, sgb), pix, QRect(sgl, pix.height() - sgb, pix.width() - xSide, sgb)); // Lower Right if (sgr && sgb) - p.drawImage(QPoint(width()-sgr, height() - sgb), pix, + p.drawImage(QPoint(w-sgr, h - sgb), pix, QRect(pix.width()-sgr, pix.height() - sgb, sgr, sgb)); } diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index dafd8a2..d75a45a 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -486,45 +486,57 @@ void QFxRect::drawRect(QPainter &p) } //basically same code as QFxImage uses to paint sci images - int xSide = qMin(offset * 2, int(width())); - int ySide = qMin(offset * 2, int(height()));; + int w = width(); + int h = height(); + int xOffset = offset; + int xSide = xOffset * 2; + if (xSide > w) { + xOffset = w/2; + xSide = xOffset * 2; + } + int yOffset = offset; + int ySide = yOffset * 2; + if (ySide > h) { + yOffset = h/2; + ySide = yOffset * 2; + } // Upper left - p.drawImage(QRect(0, 0, offset, offset), d->_rectImage, QRect(0, 0, offset, offset)); + p.drawImage(QRect(0, 0, xOffset, yOffset), d->_rectImage, QRect(0, 0, xOffset, yOffset)); // Upper middle if (d->_rectImage.width() - xSide) - p.drawImage(QRect(offset, 0, width() - xSide, offset), d->_rectImage, - QRect(offset, 0, d->_rectImage.width() - xSide, offset)); + p.drawImage(QRect(xOffset, 0, w - xSide, yOffset), d->_rectImage, + QRect(xOffset, 0, d->_rectImage.width() - xSide, yOffset)); // Upper right - if (d->_rectImage.width() - offset) { - p.drawImage(QPoint(width()-offset, 0), d->_rectImage, - QRect(d->_rectImage.width()-offset, 0, offset, offset)); + if (d->_rectImage.width() - xOffset) { + p.drawImage(QPoint(w-xOffset, 0), d->_rectImage, + QRect(d->_rectImage.width()-xOffset, 0, xOffset, yOffset)); } // Middle left if (d->_rectImage.height() - ySide) - p.drawImage(QRect(0, offset, offset, height() - ySide), d->_rectImage, - QRect(0, offset, offset, d->_rectImage.height() - ySide)); + p.drawImage(QRect(0, yOffset, xOffset, height() - ySide), d->_rectImage, + QRect(0, yOffset, xOffset, d->_rectImage.height() - ySide)); // Middle if (d->_rectImage.width() - xSide && d->_rectImage.height() - ySide) - p.drawImage(QRect(offset, offset, width() - xSide, height() - ySide), d->_rectImage, - QRect(offset, offset, d->_rectImage.width() - xSide, d->_rectImage.height() - ySide)); + p.drawImage(QRect(xOffset, yOffset, w - xSide, height() - ySide), d->_rectImage, + QRect(xOffset, yOffset, d->_rectImage.width() - xSide, d->_rectImage.height() - ySide)); // Midlle right if (d->_rectImage.height() - ySide) - p.drawImage(QRect(width()-offset, offset, offset, height() - ySide), d->_rectImage, - QRect(d->_rectImage.width()-offset, offset, offset, d->_rectImage.height() - ySide)); + p.drawImage(QRect(w-xOffset, yOffset, xOffset, height() - ySide), d->_rectImage, + QRect(d->_rectImage.width()-xOffset, yOffset, xOffset, d->_rectImage.height() - ySide)); // Lower left - p.drawImage(QPoint(0, height() - offset), d->_rectImage, QRect(0, d->_rectImage.height() - offset, offset, offset)); + p.drawImage(QPoint(0, height() - yOffset), d->_rectImage, QRect(0, d->_rectImage.height() - yOffset, xOffset, yOffset)); // Lower Middle if (d->_rectImage.width() - xSide) - p.drawImage(QRect(offset, height() - offset, width() - xSide, offset), d->_rectImage, - QRect(offset, d->_rectImage.height() - offset, d->_rectImage.width() - xSide, offset)); + p.drawImage(QRect(xOffset, height() - yOffset, w - xSide, yOffset), d->_rectImage, + QRect(xOffset, d->_rectImage.height() - yOffset, d->_rectImage.width() - xSide, yOffset)); // Lower Right - if (d->_rectImage.width() - offset) - p.drawImage(QPoint(width()-offset, height() - offset), d->_rectImage, - QRect(d->_rectImage.width()-offset, d->_rectImage.height() - offset, offset, offset)); + if (d->_rectImage.width() - xOffset) + p.drawImage(QPoint(w-xOffset, height() - yOffset), d->_rectImage, + QRect(d->_rectImage.width()-xOffset, d->_rectImage.height() - yOffset, xOffset, yOffset)); } } #endif -- cgit v0.12 From 2b025bf4a4d07469df984aeda03d5f163fc274ce Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 18 May 2009 14:34:37 +1000 Subject: Support loading a translation in qmlviewer. --- tools/qmlviewer/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp index da13c1a..f59918f 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qmlviewer/main.cpp @@ -17,6 +17,8 @@ #include #include "qfxtestengine.h" #include +#include +#include void usage() { @@ -38,6 +40,7 @@ void usage() qWarning(" -cache ................................... disk cache remote content"); qWarning(" -recordtest .................. record an autotest"); qWarning(" -runtest ..................... run a previously recorded test"); + qWarning(" -translation ........... set the language to run in"); qWarning(" "); qWarning(" Press F1 for interactive help"); exit(1); @@ -83,6 +86,7 @@ int main(int argc, char ** argv) bool cache = false; QFxTestEngine::TestMode testMode = QFxTestEngine::NoTest; QString testDir; + QString translationFile; for (int i = 1; i < newargc; ++i) { QString arg = newargv[i]; @@ -123,6 +127,11 @@ int main(int argc, char ** argv) } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) { fprintf(stderr, "Qt Declarative UI Viewer version %s\n", QT_VERSION_STR); return 0; + } else if (arg == "-translation") { + if(i + 1 >= newargc) + usage(); + translationFile = newargv[i + 1]; + ++i; } else if (arg[0] != '-') { fileName = arg; } else if (1 || arg == "-help") { @@ -130,6 +139,12 @@ int main(int argc, char ** argv) } } + QTranslator qmlTranslator; + if (!translationFile.isEmpty()) { + qmlTranslator.load(translationFile); + app.installTranslator(&qmlTranslator); + } + QmlViewer viewer(testMode, testDir, 0, frameless ? Qt::FramelessWindowHint : Qt::Widget); viewer.setCacheEnabled(cache); viewer.setRecordFile(recordfile); -- cgit v0.12 From c22504ae79b45268d603c2b2bc66bd2a59c331c7 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 18 May 2009 16:39:05 +1000 Subject: Simplify (hopefully) anchors, and make them less reliant on signals --- demos/declarative/flickr/content/ImageDetails.qml | 1 - src/declarative/fx/qfxanchors.cpp | 717 +++++++++------------- src/declarative/fx/qfxanchors.h | 12 +- src/declarative/fx/qfxanchors_p.h | 36 +- src/declarative/fx/qfxflipable.cpp | 1 + src/declarative/fx/qfxitem.cpp | 105 +--- src/declarative/fx/qfxitem.h | 5 - src/declarative/fx/qfxitem_p.h | 4 +- 8 files changed, 344 insertions(+), 537 deletions(-) diff --git a/demos/declarative/flickr/content/ImageDetails.qml b/demos/declarative/flickr/content/ImageDetails.qml index b8091f2..ccc91cb 100644 --- a/demos/declarative/flickr/content/ImageDetails.qml +++ b/demos/declarative/flickr/content/ImageDetails.qml @@ -89,7 +89,6 @@ Flipable { // Center image if it is smaller than the flickable area. x: ImageContainer.width > width*scale ? (ImageContainer.width - width*scale) / 2 : 0 y: ImageContainer.height > height*scale ? (ImageContainer.height - height*scale) / 2 : 0 - anchors.centeredIn: parent onStatusChanged : { // Default scale shows the entire image. if (status == 0 && width != 0) { diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index 53d0187..826d6c1 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -41,6 +41,7 @@ #include "qfxanchors_p.h" #include "qfxitem.h" +#include "qfxitem_p.h" #include #include #include @@ -132,22 +133,174 @@ static qreal adjustedPosition(QFxItem *item, QFxAnchorLine::AnchorLine anchorLin QFxAnchors::QFxAnchors(QObject *parent) : QObject(*new QFxAnchorsPrivate(), parent) { - } -void QFxAnchors::fillChanged() +QFxAnchors::~QFxAnchors() { Q_D(QFxAnchors); - if (!d->fill) + d->remDepend(d->fill); + d->remDepend(d->centeredIn); + d->remDepend(d->left.item); + d->remDepend(d->right.item); + d->remDepend(d->top.item); + d->remDepend(d->bottom.item); + d->remDepend(d->vCenter.item); + d->remDepend(d->hCenter.item); +} + +void QFxAnchorsPrivate::fillChanged() +{ + if (!fill || !isItemComplete()) + return; + + if (fill == item->itemParent()) { //child-parent + setItemPos(QPointF(leftMargin, topMargin)); + } else if (fill->itemParent() == item->itemParent()) { //siblings + setItemPos(QPointF(fill->x()+leftMargin, fill->y()+topMargin)); + } + setItemWidth(fill->width()-leftMargin-rightMargin); + setItemHeight(fill->height()-topMargin-bottomMargin); +} + +void QFxAnchorsPrivate::centeredInChanged() +{ + if (!centeredIn || fill || !isItemComplete()) return; - if (d->fill == d->item->itemParent()) { //child-parent - d->item->setPos(QPointF(leftMargin(), topMargin())); - } else if (d->fill->itemParent() == d->item->itemParent()) { //siblings - d->item->setPos(QPointF(d->fill->x()+leftMargin(), d->fill->y()+topMargin())); + if (centeredIn == item->itemParent()) { + QPointF p((item->itemParent()->width() - item->width()) / 2., + (item->itemParent()->height() - item->height()) / 2.); + setItemPos(p); + + } else if (centeredIn->itemParent() == item->itemParent()) { + + QPointF p(centeredIn->x() + (centeredIn->width() - item->width()) / 2., + centeredIn->y() + (centeredIn->height() - item->height()) / 2.); + setItemPos(p); + } +} + +void QFxAnchorsPrivate::clearItem(QFxItem *item) +{ + if (fill == item) + fill = 0; + if (centeredIn == item) + centeredIn = 0; + if (left.item == item) + left.item = 0; + if (right.item == item) { + right.item = 0; + usedAnchors &= ~QFxAnchors::HasRightAnchor; + } + if (top.item == item) { + top.item = 0; + usedAnchors &= ~QFxAnchors::HasTopAnchor; + } + if (bottom.item == item) { + bottom.item = 0; + usedAnchors &= ~QFxAnchors::HasBottomAnchor; + } + if (vCenter.item == item) { + vCenter.item = 0; + usedAnchors &= ~QFxAnchors::HasVCenterAnchor; + } + if (hCenter.item == item) { + hCenter.item = 0; + usedAnchors &= ~QFxAnchors::HasHCenterAnchor; + } +} + +void QFxAnchorsPrivate::addDepend(QFxItem *item) +{ + Q_Q(QFxAnchors); + if (!item) + return; + QFxItemPrivate *p = + static_cast(QObjectPrivate::get(item)); + p->dependantAnchors.append(q); +} + +void QFxAnchorsPrivate::remDepend(QFxItem *item) +{ + Q_Q(QFxAnchors); + if (!item) + return; + QFxItemPrivate *p = + static_cast(QObjectPrivate::get(item)); + p->dependantAnchors.removeAll(q); +} + +bool QFxAnchorsPrivate::isItemComplete() const +{ + return true; + return item->isComponentComplete(); +} + +void QFxAnchorsPrivate::setItemHeight(qreal v) +{ + updatingMe = true; + item->setHeight(v); + updatingMe = false; +} + +void QFxAnchorsPrivate::setItemWidth(qreal v) +{ + updatingMe = true; + item->setWidth(v); + updatingMe = false; +} + +void QFxAnchorsPrivate::setItemX(qreal v) +{ + updatingMe = true; + item->setX(v); + updatingMe = false; +} + +void QFxAnchorsPrivate::setItemY(qreal v) +{ + updatingMe = true; + item->setY(v); + updatingMe = false; +} + +void QFxAnchorsPrivate::setItemPos(const QPointF &v) +{ + updatingMe = true; + item->setPos(v); + updatingMe = false; +} + +void QFxAnchorsPrivate::updateMe() +{ + if (updatingMe) { + updatingMe = false; + return; } - d->item->setWidth(d->fill->width()-leftMargin()-rightMargin()); - d->item->setHeight(d->fill->height()-topMargin()-bottomMargin()); + + fillChanged(); + centeredInChanged(); + updateHorizontalAnchors(); + updateVerticalAnchors(); +} + +void QFxAnchorsPrivate::updateOnComplete() +{ + fillChanged(); + centeredInChanged(); + updateHorizontalAnchors(); + updateVerticalAnchors(); +} + +void QFxAnchorsPrivate::update(QFxItem *, const QRectF &newG, const QRectF &oldG) +{ + fillChanged(); + centeredInChanged(); + + if (newG.x() != oldG.x() || newG.width() != oldG.width()) + updateHorizontalAnchors(); + if (newG.y() != oldG.y() || newG.height() != oldG.height()) + updateVerticalAnchors(); } /*! @@ -166,37 +319,11 @@ QFxItem *QFxAnchors::fill() const void QFxAnchors::setFill(QFxItem *f) { Q_D(QFxAnchors); - if (d->fill) { - QObject::disconnect(d->fill, SIGNAL(leftChanged()), this, SLOT(fillChanged())); - QObject::disconnect(d->fill, SIGNAL(topChanged()), this, SLOT(fillChanged())); - QObject::disconnect(d->fill, SIGNAL(widthChanged()), this, SLOT(fillChanged())); - QObject::disconnect(d->fill, SIGNAL(heightChanged()), this, SLOT(fillChanged())); - QObject::disconnect(this, SIGNAL(leftMarginChanged()), this, SLOT(fillChanged())); - QObject::disconnect(this, SIGNAL(topMarginChanged()), this, SLOT(fillChanged())); - QObject::disconnect(this, SIGNAL(rightMarginChanged()), this, SLOT(fillChanged())); - QObject::disconnect(this, SIGNAL(bottomMarginChanged()), this, SLOT(fillChanged())); - } - + d->remDepend(d->fill); d->fill = f; + d->addDepend(d->fill); - if (d->fill) { - if (d->fill == d->item->itemParent()) { //child-parent - QObject::connect(d->fill, SIGNAL(widthChanged()), this, SLOT(fillChanged())); - QObject::connect(d->fill, SIGNAL(heightChanged()), this, SLOT(fillChanged())); - } else if (f->itemParent() == d->item->itemParent()) { //siblings - QObject::connect(d->fill, SIGNAL(leftChanged()), this, SLOT(fillChanged())); - QObject::connect(d->fill, SIGNAL(topChanged()), this, SLOT(fillChanged())); - QObject::connect(d->fill, SIGNAL(widthChanged()), this, SLOT(fillChanged())); - QObject::connect(d->fill, SIGNAL(heightChanged()), this, SLOT(fillChanged())); - } else { - qmlInfo(d->item) << "Can't anchor to an item that isn't a parent or sibling."; - } - } - QObject::connect(this, SIGNAL(leftMarginChanged()), this, SLOT(fillChanged())); - QObject::connect(this, SIGNAL(topMarginChanged()), this, SLOT(fillChanged())); - QObject::connect(this, SIGNAL(rightMarginChanged()), this, SLOT(fillChanged())); - QObject::connect(this, SIGNAL(bottomMarginChanged()), this, SLOT(fillChanged())); - fillChanged(); //### can/should we defer until component completion? + d->fillChanged(); } /*! @@ -223,163 +350,12 @@ void QFxAnchors::setCenteredIn(QFxItem* c) qmlInfo(d->item) << "Can't anchor to an item that isn't a parent or sibling."; return; } - d->centeredIn = c; - setHorizontalCenter(c->horizontalCenter()); - setVerticalCenter(c->verticalCenter()); -} - -void QFxAnchorsPrivate::connectVHelper(const QFxAnchorLine &edge) -{ - //### should we do disconnects first? (will it be called more than once?) - Q_Q(QFxAnchors); - if (edge.item == item->itemParent()) { //child-parent - switch(edge.anchorLine) { - case QFxAnchorLine::Bottom: - case QFxAnchorLine::VCenter: - QObject::connect(edge.item, SIGNAL(heightChanged()), q, SLOT(updateVerticalAnchors())); - break; - case QFxAnchorLine::Top: //no connection needed - default: - break; - } - } else if (edge.item->itemParent() == item->itemParent()) { //siblings - switch(edge.anchorLine) { - case QFxAnchorLine::Top: - QObject::connect(edge.item, SIGNAL(topChanged()), q, SLOT(updateVerticalAnchors())); - break; - case QFxAnchorLine::Bottom: - QObject::connect(edge.item, SIGNAL(bottomChanged()), q, SLOT(updateVerticalAnchors())); - break; - case QFxAnchorLine::VCenter: - QObject::connect(edge.item, SIGNAL(vcenterChanged()), q, SLOT(updateVerticalAnchors())); - break; - default: - break; - } - } else { - qmlInfo(item) << "Can't anchor to an item that isn't a parent or sibling."; - } -} - -void QFxAnchors::connectVAnchors() -{ - Q_D(QFxAnchors); - if (!d->checkVValid()) - return; - - if (d->usedAnchors & HasTopAnchor) { - //Handle stretching connections (if we have multiple horizontal anchors) - QFxAnchorLine *edge = 0; - if (d->usedAnchors & HasBottomAnchor) { - edge = &d->bottom; - connect(this, SIGNAL(bottomMarginChanged()), this, SLOT(updateVerticalAnchors())); - } else if (d->usedAnchors & HasVCenterAnchor) { - edge = &d->vCenter; - connect(this, SIGNAL(verticalCenterOffsetChanged()), this, SLOT(updateVerticalAnchors())); - } - if (edge) { - //we need to stretch - d->connectVHelper(*edge); - } - - //Handle top - d->connectVHelper(d->top); - connect(this, SIGNAL(topMarginChanged()), this, SLOT(updateVerticalAnchors())); - updateVerticalAnchors(); - } else if (d->usedAnchors & HasBottomAnchor) { - //Handle stretching connections (if we have multiple horizontal anchors) - if (d->usedAnchors & HasVCenterAnchor) { - d->connectVHelper(d->vCenter); - connect(this, SIGNAL(verticalCenterOffsetChanged()), this, SLOT(updateVerticalAnchors())); - } - - //Handle bottom - d->connectVHelper(d->bottom); - connect(this, SIGNAL(bottomMarginChanged()), this, SLOT(updateVerticalAnchors())); - updateVerticalAnchors(); - } else if (d->usedAnchors & HasVCenterAnchor) { - //Handle vCenter - d->connectVHelper(d->vCenter); - connect(this, SIGNAL(verticalCenterOffsetChanged()), this, SLOT(updateVerticalAnchors())); - updateVerticalAnchors(); - } -} - -void QFxAnchorsPrivate::connectHHelper(const QFxAnchorLine &edge) -{ - //### should we do disconnects first? (will it be called more than once?) - Q_Q(QFxAnchors); - if (edge.item == item->itemParent()) { //child-parent - switch(edge.anchorLine) { - case QFxAnchorLine::Right: - case QFxAnchorLine::HCenter: - QObject::connect(edge.item, SIGNAL(widthChanged()), q, SLOT(updateHorizontalAnchors())); - break; - case QFxAnchorLine::Left: //no connection needed - default: - break; - } - } else if (edge.item->itemParent() == item->itemParent()) { //siblings - switch(edge.anchorLine) { - case QFxAnchorLine::Left: - QObject::connect(edge.item, SIGNAL(leftChanged()), q, SLOT(updateHorizontalAnchors())); - break; - case QFxAnchorLine::Right: - QObject::connect(edge.item, SIGNAL(rightChanged()), q, SLOT(updateHorizontalAnchors())); - break; - case QFxAnchorLine::HCenter: - QObject::connect(edge.item, SIGNAL(hcenterChanged()), q, SLOT(updateHorizontalAnchors())); - break; - default: - break; - } - } else { - qmlInfo(item) << "Can't anchor to an item that isn't a parent or sibling."; - } -} - -void QFxAnchors::connectHAnchors() -{ - Q_D(QFxAnchors); - if (!d->checkHValid()) - return; - - if (d->usedAnchors & HasLeftAnchor) { - //Handle stretching connections (if we have multiple horizontal anchors) - QFxAnchorLine *edge = 0; - if (d->usedAnchors & HasRightAnchor) { - edge = &d->right; - connect(this, SIGNAL(rightMarginChanged()), this, SLOT(updateHorizontalAnchors())); - } else if (d->usedAnchors & HasHCenterAnchor) { - edge = &d->hCenter; - connect(this, SIGNAL(horizontalCenterOffsetChanged()), this, SLOT(updateHorizontalAnchors())); - } - if (edge) { - //we need to stretch - d->connectHHelper(*edge); - } - //Handle left - d->connectHHelper(d->left); - connect(this, SIGNAL(leftMarginChanged()), this, SLOT(updateHorizontalAnchors())); - updateHorizontalAnchors(); - } else if (d->usedAnchors & HasRightAnchor) { - //Handle stretching connections (if we have multiple horizontal anchors) - if (d->usedAnchors & HasHCenterAnchor) { - d->connectHHelper(d->hCenter); - connect(this, SIGNAL(horizontalCenterOffsetChanged()), this, SLOT(updateHorizontalAnchors())); - } + d->remDepend(d->centeredIn); + d->centeredIn = c; + d->addDepend(d->centeredIn); - //Handle right - d->connectHHelper(d->right); - connect(this, SIGNAL(rightMarginChanged()), this, SLOT(updateHorizontalAnchors())); - updateHorizontalAnchors(); - } else if (d->usedAnchors & HasHCenterAnchor) { - //Handle hCenter - d->connectHHelper(d->hCenter); - connect(this, SIGNAL(horizontalCenterOffsetChanged()), this, SLOT(updateHorizontalAnchors())); - updateHorizontalAnchors(); - } + d->centeredInChanged(); } bool QFxAnchorsPrivate::calcStretch(const QFxAnchorLine &edge1, @@ -411,168 +387,124 @@ bool QFxAnchorsPrivate::calcStretch(const QFxAnchorLine &edge1, return invalid; } -void QFxAnchors::updateVerticalAnchors() +void QFxAnchorsPrivate::updateVerticalAnchors() { - Q_D(QFxAnchors); - if (!d->updatingVerticalAnchor) { - d->updatingVerticalAnchor = true; - if (d->usedAnchors & HasTopAnchor) { + if (fill || centeredIn || !isItemComplete()) + return; + + if (!updatingVerticalAnchor) { + updatingVerticalAnchor = true; + if (usedAnchors & QFxAnchors::HasTopAnchor) { //Handle stretching bool invalid = true; int height = 0; - if (d->usedAnchors & HasBottomAnchor) { - invalid = d->calcStretch(d->top, d->bottom, d->topMargin, -d->bottomMargin, QFxAnchorLine::Top, height); - } else if (d->usedAnchors & HasVCenterAnchor) { - invalid = d->calcStretch(d->top, d->vCenter, d->topMargin, d->vCenterOffset, QFxAnchorLine::Top, height); + if (usedAnchors & QFxAnchors::HasBottomAnchor) { + invalid = calcStretch(top, bottom, topMargin, -bottomMargin, QFxAnchorLine::Top, height); + } else if (usedAnchors & QFxAnchors::HasVCenterAnchor) { + invalid = calcStretch(top, vCenter, topMargin, vCenterOffset, QFxAnchorLine::Top, height); height *= 2; } if (!invalid) - d->item->setHeight(height); + setItemHeight(height); //Handle top - if (d->top.item == d->item->itemParent()) { - d->item->setY(adjustedPosition(d->top.item, d->top.anchorLine) + d->topMargin); - } else if (d->top.item->itemParent() == d->item->itemParent()) { - d->item->setY(position(d->top.item, d->top.anchorLine) + d->topMargin); + if (top.item == item->itemParent()) { + setItemY(adjustedPosition(top.item, top.anchorLine) + topMargin); + } else if (top.item->itemParent() == item->itemParent()) { + setItemY(position(top.item, top.anchorLine) + topMargin); } - } else if (d->usedAnchors & HasBottomAnchor) { + } else if (usedAnchors & QFxAnchors::HasBottomAnchor) { //Handle stretching (top + bottom case is handled above) - if (d->usedAnchors & HasVCenterAnchor) { + if (usedAnchors & QFxAnchors::HasVCenterAnchor) { int height = 0; - bool invalid = d->calcStretch(d->vCenter, d->bottom, d->vCenterOffset, -d->bottomMargin, + bool invalid = calcStretch(vCenter, bottom, vCenterOffset, -bottomMargin, QFxAnchorLine::Top, height); if (!invalid) - d->item->setHeight(height*2); + setItemHeight(height*2); } //Handle bottom - if (d->bottom.item == d->item->itemParent()) { - d->item->setY(adjustedPosition(d->bottom.item, d->bottom.anchorLine) - d->item->height() - d->bottomMargin); - } else if (d->bottom.item->itemParent() == d->item->itemParent()) { - d->item->setY(position(d->bottom.item, d->bottom.anchorLine) - d->item->height() - d->bottomMargin); + if (bottom.item == item->itemParent()) { + setItemY(adjustedPosition(bottom.item, bottom.anchorLine) - item->height() - bottomMargin); + } else if (bottom.item->itemParent() == item->itemParent()) { + setItemY(position(bottom.item, bottom.anchorLine) - item->height() - bottomMargin); } - } else if (d->usedAnchors & HasVCenterAnchor) { + } else if (usedAnchors & QFxAnchors::HasVCenterAnchor) { //(stetching handled above) //Handle vCenter - if (d->vCenter.item == d->item->itemParent()) { - d->item->setY(adjustedPosition(d->vCenter.item, d->vCenter.anchorLine) - - d->item->height()/2 + d->vCenterOffset); - } else if (d->vCenter.item->itemParent() == d->item->itemParent()) { - d->item->setY(position(d->vCenter.item, d->vCenter.anchorLine) - d->item->height()/2 + d->vCenterOffset); + if (vCenter.item == item->itemParent()) { + setItemY(adjustedPosition(vCenter.item, vCenter.anchorLine) + - item->height()/2 + vCenterOffset); + } else if (vCenter.item->itemParent() == item->itemParent()) { + setItemY(position(vCenter.item, vCenter.anchorLine) - item->height()/2 + vCenterOffset); } } - d->updatingVerticalAnchor = false; + updatingVerticalAnchor = false; } else { - qmlInfo(d->item) << "Anchor loop detected on vertical anchor."; + // ### Make this certain :) + qmlInfo(item) << "Possible anchor loop detected on vertical anchor."; } } -void QFxAnchors::updateHorizontalAnchors() +void QFxAnchorsPrivate::updateHorizontalAnchors() { - Q_D(QFxAnchors); - if (!d->updatingHorizontalAnchor) { - d->updatingHorizontalAnchor = true; + if (fill || centeredIn || !isItemComplete()) + return; - //alternate implementation (needs performance testing) - /*switch(d->usedAnchors & QFxAnchors::Horizontal_Mask) { - case 0x03: //(HasLeftAnchor | HasRightAnchor) - { - int width = 0; - if (!d->calcStretch(d->left, d->right, d->leftMargin, -d->rightMargin, QFxAnchorLine::Left, width)) - d->item->setWidth(width); - //fall though - } - case 0x11: //(HasLeftAnchor | HasHCenterAnchor) - { - if (d->usedAnchors & HasHCenterAnchor) { - int width = 0; - if (!d->calcStretch(d->left, d->hCenter, d->leftMargin, d->hCenterOffset, QFxAnchorLine::Left, width)) - d->item->setWidth(width*2); - } - //fall though - } - case HasLeftAnchor: - if (d->left.item == d->item->itemParent()) { - d->item->setX(adjustedPosition(d->left.item, d->left.anchorLine) + d->leftMargin); - } else if (d->left.item->itemParent() == d->item->itemParent()) { - d->item->setX(position(d->left.item, d->left.anchorLine) + d->leftMargin); - } - break; - case 0x12: //(HasRightAnchor | HasHCenterAnchor) - { - int width = 0; - if (!d->calcStretch(d->hCenter, d->right, d->hCenterOffset, -d->rightMargin, QFxAnchorLine::Left, width)) - d->item->setWidth(width*2); - //fall though - } - case HasRightAnchor: - if (d->right.item == d->item->itemParent()) { - d->item->setX(adjustedPosition(d->right.item, d->right.anchorLine) - d->item->width() - d->rightMargin); - } else if (d->right.item->itemParent() == d->item->itemParent()) { - d->item->setX(position(d->right.item, d->right.anchorLine) - d->item->width() - d->rightMargin); - } - break; - case HasHCenterAnchor: - if (d->hCenter.item == d->item->itemParent()) { - d->item->setX(adjustedPosition(d->hCenter.item, d->hCenter.anchorLine) - d->item->width()/2 + d->hCenterOffset); - } else if (d->hCenter.item->itemParent() == d->item->itemParent()) { - d->item->setX(position(d->hCenter.item, d->hCenter.anchorLine) - d->item->width()/2 + d->hCenterOffset); - } - break; - default: - break; - }*/ + if (!updatingHorizontalAnchor) { + updatingHorizontalAnchor = true; - if (d->usedAnchors & HasLeftAnchor) { + if (usedAnchors & QFxAnchors::HasLeftAnchor) { //Handle stretching bool invalid = true; int width = 0; - if (d->usedAnchors & HasRightAnchor) { - invalid = d->calcStretch(d->left, d->right, d->leftMargin, -d->rightMargin, QFxAnchorLine::Left, width); - } else if (d->usedAnchors & HasHCenterAnchor) { - invalid = d->calcStretch(d->left, d->hCenter, d->leftMargin, d->hCenterOffset, QFxAnchorLine::Left, width); + if (usedAnchors & QFxAnchors::HasRightAnchor) { + invalid = calcStretch(left, right, leftMargin, -rightMargin, QFxAnchorLine::Left, width); + } else if (usedAnchors & QFxAnchors::HasHCenterAnchor) { + invalid = calcStretch(left, hCenter, leftMargin, hCenterOffset, QFxAnchorLine::Left, width); width *= 2; } if (!invalid) - d->item->setWidth(width); + setItemWidth(width); //Handle left - if (d->left.item == d->item->itemParent()) { - d->item->setX(adjustedPosition(d->left.item, d->left.anchorLine) + d->leftMargin); - } else if (d->left.item->itemParent() == d->item->itemParent()) { - d->item->setX(position(d->left.item, d->left.anchorLine) + d->leftMargin); + if (left.item == item->itemParent()) { + setItemX(adjustedPosition(left.item, left.anchorLine) + leftMargin); + } else if (left.item->itemParent() == item->itemParent()) { + setItemX(position(left.item, left.anchorLine) + leftMargin); } - } else if (d->usedAnchors & HasRightAnchor) { + } else if (usedAnchors & QFxAnchors::HasRightAnchor) { //Handle stretching (left + right case is handled in updateLeftAnchor) - if (d->usedAnchors & HasHCenterAnchor) { + if (usedAnchors & QFxAnchors::HasHCenterAnchor) { int width = 0; - bool invalid = d->calcStretch(d->hCenter, d->right, d->hCenterOffset, -d->rightMargin, + bool invalid = calcStretch(hCenter, right, hCenterOffset, -rightMargin, QFxAnchorLine::Left, width); if (!invalid) - d->item->setWidth(width*2); + setItemWidth(width*2); } //Handle right - if (d->right.item == d->item->itemParent()) { - d->item->setX(adjustedPosition(d->right.item, d->right.anchorLine) - d->item->width() - d->rightMargin); - } else if (d->right.item->itemParent() == d->item->itemParent()) { - d->item->setX(position(d->right.item, d->right.anchorLine) - d->item->width() - d->rightMargin); + if (right.item == item->itemParent()) { + setItemX(adjustedPosition(right.item, right.anchorLine) - item->width() - rightMargin); + } else if (right.item->itemParent() == item->itemParent()) { + setItemX(position(right.item, right.anchorLine) - item->width() - rightMargin); } - } else if (d->usedAnchors & HasHCenterAnchor) { + } else if (usedAnchors & QFxAnchors::HasHCenterAnchor) { //Handle hCenter - if (d->hCenter.item == d->item->itemParent()) { - d->item->setX(adjustedPosition(d->hCenter.item, d->hCenter.anchorLine) - d->item->width()/2 + d->hCenterOffset); - } else if (d->hCenter.item->itemParent() == d->item->itemParent()) { - d->item->setX(position(d->hCenter.item, d->hCenter.anchorLine) - d->item->width()/2 + d->hCenterOffset); + if (hCenter.item == item->itemParent()) { + setItemX(adjustedPosition(hCenter.item, hCenter.anchorLine) - item->width()/2 + hCenterOffset); + } else if (hCenter.item->itemParent() == item->itemParent()) { + setItemX(position(hCenter.item, hCenter.anchorLine) - item->width()/2 + hCenterOffset); } } - d->updatingHorizontalAnchor = false; + updatingHorizontalAnchor = false; } else { - qmlInfo(d->item) << "Anchor loop detected on horizontal anchor."; + // ### Make this certain :) + qmlInfo(item) << "Possible anchor loop detected on horizontal anchor."; } } @@ -588,29 +520,22 @@ void QFxAnchors::setTop(const QFxAnchorLine &edge) if (!d->checkVAnchorValid(edge)) return; - d->usedAnchors |= HasTopAnchor; + if (edge.item) + d->usedAnchors |= HasTopAnchor; + else + d->usedAnchors &= ~HasTopAnchor; d->checkVValid(); + d->remDepend(d->top.item); d->top = edge; + d->addDepend(d->top.item); + d->updateVerticalAnchors(); } void QFxAnchors::resetTop() { - Q_D(QFxAnchors); - - //update flags - d->usedAnchors &= ~HasTopAnchor; - - //clear binding - QmlMetaProperty prop(this, "top"); - prop.binding()->clearExpression(); - - //disconnect signal/slot connections as needed - disconnect(this, SIGNAL(topMarginChanged()), this, SLOT(updateVerticalAnchors())); - disconnect(d->top.item, 0, this, 0); - - updateVerticalAnchors(); + setTop(QFxAnchorLine()); } QFxAnchorLine QFxAnchors::bottom() const @@ -625,29 +550,22 @@ void QFxAnchors::setBottom(const QFxAnchorLine &edge) if (!d->checkVAnchorValid(edge)) return; - d->usedAnchors |= HasBottomAnchor; + if (edge.item) + d->usedAnchors |= HasBottomAnchor; + else + d->usedAnchors &= ~HasBottomAnchor; d->checkVValid(); + d->remDepend(d->bottom.item); d->bottom = edge; + d->addDepend(d->bottom.item); + d->updateVerticalAnchors(); } void QFxAnchors::resetBottom() { - Q_D(QFxAnchors); - - //update flags - d->usedAnchors &= ~HasBottomAnchor; - - //clear binding - QmlMetaProperty prop(this, "bottom"); - prop.binding()->clearExpression(); - - //disconnect signal/slot connections as needed - disconnect(this, SIGNAL(bottomMarginChanged()), this, SLOT(updateVerticalAnchors())); - disconnect(d->bottom.item, 0, this, 0); - - updateVerticalAnchors(); + setBottom(QFxAnchorLine()); } QFxAnchorLine QFxAnchors::verticalCenter() const @@ -662,29 +580,22 @@ void QFxAnchors::setVerticalCenter(const QFxAnchorLine &edge) if (!d->checkVAnchorValid(edge)) return; - d->usedAnchors |= HasVCenterAnchor; + if (edge.item) + d->usedAnchors |= HasVCenterAnchor; + else + d->usedAnchors &= ~HasVCenterAnchor; d->checkVValid(); + d->remDepend(d->vCenter.item); d->vCenter = edge; + d->addDepend(d->vCenter.item); + d->updateVerticalAnchors(); } void QFxAnchors::resetVerticalCenter() { - Q_D(QFxAnchors); - - //update flags - d->usedAnchors &= ~HasVCenterAnchor; - - //clear binding - QmlMetaProperty prop(this, "verticalCenter"); - prop.binding()->clearExpression(); - - //disconnect signal/slot connections as needed - disconnect(this, SIGNAL(verticalCenterOffsetChanged()), this, SLOT(updateVerticalAnchors())); - disconnect(d->vCenter.item, 0, this, 0); - - updateVerticalAnchors(); + setVerticalCenter(QFxAnchorLine()); } QFxAnchorLine QFxAnchors::left() const @@ -699,29 +610,22 @@ void QFxAnchors::setLeft(const QFxAnchorLine &edge) if (!d->checkHAnchorValid(edge)) return; - d->usedAnchors |= HasLeftAnchor; + if (edge.item) + d->usedAnchors |= HasLeftAnchor; + else + d->usedAnchors &= ~HasLeftAnchor; d->checkHValid(); + d->remDepend(d->left.item); d->left = edge; + d->addDepend(d->left.item); + d->updateHorizontalAnchors(); } void QFxAnchors::resetLeft() { - Q_D(QFxAnchors); - - //update flags - d->usedAnchors &= ~HasLeftAnchor; - - //clear binding - QmlMetaProperty prop(this, "left"); - prop.binding()->clearExpression(); - - //disconnect signal/slot connections as needed - disconnect(this, SIGNAL(leftMarginChanged()), this, SLOT(updateHorizontalAnchors())); - disconnect(d->left.item, 0, this, 0); - - updateHorizontalAnchors(); + setLeft(QFxAnchorLine()); } QFxAnchorLine QFxAnchors::right() const @@ -736,29 +640,23 @@ void QFxAnchors::setRight(const QFxAnchorLine &edge) if (!d->checkHAnchorValid(edge)) return; - d->usedAnchors |= HasRightAnchor; + if (edge.item) + d->usedAnchors |= HasRightAnchor; + else + d->usedAnchors &= ~HasRightAnchor; d->checkHValid(); + d->remDepend(d->right.item); d->right = edge; + d->addDepend(d->right.item); + + d->updateHorizontalAnchors(); } void QFxAnchors::resetRight() { - Q_D(QFxAnchors); - - //update flags - d->usedAnchors &= ~HasRightAnchor; - - //clear binding - QmlMetaProperty prop(this, "right"); - prop.binding()->clearExpression(); - - //disconnect signal/slot connections as needed - disconnect(this, SIGNAL(rightMarginChanged()), this, SLOT(updateHorizontalAnchors())); - disconnect(d->right.item, 0, this, 0); - - updateHorizontalAnchors(); + setRight(QFxAnchorLine()); } QFxAnchorLine QFxAnchors::horizontalCenter() const @@ -773,29 +671,22 @@ void QFxAnchors::setHorizontalCenter(const QFxAnchorLine &edge) if (!d->checkHAnchorValid(edge)) return; - d->usedAnchors |= HasHCenterAnchor; + if (edge.item) + d->usedAnchors |= HasHCenterAnchor; + else + d->usedAnchors &= ~HasHCenterAnchor; d->checkHValid(); + d->remDepend(d->hCenter.item); d->hCenter = edge; + d->addDepend(d->hCenter.item); + d->updateHorizontalAnchors(); } void QFxAnchors::resetHorizontalCenter() { - Q_D(QFxAnchors); - - //update flags - d->usedAnchors &= ~HasHCenterAnchor; - - //clear binding - QmlMetaProperty prop(this, "horizontalCenter"); - prop.binding()->clearExpression(); - - //disconnect signal/slot connections as needed - disconnect(this, SIGNAL(horizontalCenterOffsetChanged()), this, SLOT(updateHorizontalAnchors())); - disconnect(d->hCenter.item, 0, this, 0); - - updateHorizontalAnchors(); + setHorizontalCenter(QFxAnchorLine()); } int QFxAnchors::leftMargin() const @@ -888,50 +779,6 @@ void QFxAnchors::setVerticalCenterOffset(int offset) emit verticalCenterOffsetChanged(); } -#if 0 -/*! - \property QFxAnchors::baseline - \brief what the baseline of the item should be anchored to (aligned with). - - The baseline of a Text item is the imaginary line on which the text sits. Controls containing - text usually set their baseline to the baseline of their text. - - For non-text items, a default baseline offset of two-thirds of the item's height is used - to determine the baseline. -*/ -int QFxAnchors::baseline() const -{ - return d->item->baseline(); -} - -void QFxAnchors::setBaseline(int baseline) -{ - d->usedAnchors |= HasBaselineAnchor; - - if (d->usedAnchors & HasTopAnchor && d->usedAnchors & HasBottomAnchor) { - qmlInfo(d->item) << "Can't specify top, bottom, and baseline anchors"; - return; - } - - if (d->usedAnchors & HasTopAnchor) { - int hoffset = baseline - d->item->baseline(); - d->item->setHeight(d->item->height() + hoffset); - } else { - if (d->usedAnchors & HasBottomAnchor) { - int hoffset = d->item->baseline() - baseline; - d->item->setHeight(d->item->height() + hoffset); - } - - int boffset = d->item->baseline() - d->item->top(); - QFxItem *parentItem = d->item->itemParent(); - if (parentItem) - d->item->setY(baseline - boffset - parentItem->top()); - else - d->item->setY(baseline - boffset); - } -} -#endif - QFxAnchors::UsedAnchors QFxAnchors::usedAnchors() const { Q_D(const QFxAnchors); diff --git a/src/declarative/fx/qfxanchors.h b/src/declarative/fx/qfxanchors.h index 5a8cc1a..2c59266 100644 --- a/src/declarative/fx/qfxanchors.h +++ b/src/declarative/fx/qfxanchors.h @@ -80,6 +80,7 @@ public: Q_DECLARE_METATYPE(QFxAnchorLine); +class QFxAnchorsPrivate; class Q_DECLARATIVE_EXPORT QFxAnchors : public QObject { Q_OBJECT @@ -101,6 +102,7 @@ class Q_DECLARATIVE_EXPORT QFxAnchors : public QObject public: QFxAnchors(QObject *parent=0); + virtual ~QFxAnchors(); enum UsedAnchor { HasLeftAnchor = 0x01, @@ -167,9 +169,6 @@ public: void setItem(QFxItem *item); - void connectHAnchors(); - void connectVAnchors(); - Q_SIGNALS: void leftMarginChanged(); void rightMarginChanged(); @@ -178,13 +177,8 @@ Q_SIGNALS: void verticalCenterOffsetChanged(); void horizontalCenterOffsetChanged(); -private Q_SLOTS: - void fillChanged(); - void updateHorizontalAnchors(); - void updateVerticalAnchors(); - private: - //### should item be a friend? (and make some of the public methods private or protected) + friend class QFxItem; Q_DISABLE_COPY(QFxAnchors) Q_DECLARE_PRIVATE(QFxAnchors) }; diff --git a/src/declarative/fx/qfxanchors_p.h b/src/declarative/fx/qfxanchors_p.h index 82c2086..b90380a 100644 --- a/src/declarative/fx/qfxanchors_p.h +++ b/src/declarative/fx/qfxanchors_p.h @@ -63,9 +63,10 @@ class QFxAnchorsPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QFxAnchors) public: QFxAnchorsPrivate() - : item(0), usedAnchors(0), fill(0), centeredIn(0), leftMargin(0), rightMargin(0), - topMargin(0), bottomMargin(0), vCenterOffset(0), hCenterOffset(0), - updatingHorizontalAnchor(false), updatingVerticalAnchor(false) + : updatingMe(false), updatingHorizontalAnchor(false), + updatingVerticalAnchor(false), item(0), usedAnchors(0), fill(0), + centeredIn(0), leftMargin(0), rightMargin(0), topMargin(0), + bottomMargin(0), vCenterOffset(0), hCenterOffset(0) { } @@ -73,14 +74,37 @@ public: { } + void clearItem(QFxItem *); + + void addDepend(QFxItem *); + void remDepend(QFxItem *); + bool isItemComplete() const; + + bool updatingMe:1; + bool updatingHorizontalAnchor:1; + bool updatingVerticalAnchor:1; + + void setItemHeight(qreal); + void setItemWidth(qreal); + void setItemX(qreal); + void setItemY(qreal); + void setItemPos(const QPointF &); + + void updateOnComplete(); + void updateMe(); + void update(QFxItem *, const QRectF &, const QRectF &); + bool checkHValid() const; bool checkVValid() const; bool checkHAnchorValid(QFxAnchorLine anchor) const; bool checkVAnchorValid(QFxAnchorLine anchor) const; - void connectHHelper(const QFxAnchorLine &anchorLine); - void connectVHelper(const QFxAnchorLine &anchorLine); bool calcStretch(const QFxAnchorLine &edge1, const QFxAnchorLine &edge2, int offset1, int offset2, QFxAnchorLine::AnchorLine line, int &stretch); + void updateHorizontalAnchors(); + void updateVerticalAnchors(); + void fillChanged(); + void centeredInChanged(); + QFxItem *item; QFxAnchors::UsedAnchors usedAnchors; @@ -101,8 +125,6 @@ public: int vCenterOffset; int hCenterOffset; - bool updatingHorizontalAnchor; - bool updatingVerticalAnchor; }; QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp index 24ae428..9804004 100644 --- a/src/declarative/fx/qfxflipable.cpp +++ b/src/declarative/fx/qfxflipable.cpp @@ -296,6 +296,7 @@ QFxFlipable::Side QFxFlipable::side() const //(the logic here should be kept in sync with setBackTransform and setRotation) void QFxFlipable::transformChanged(const QSimpleCanvas::Matrix &trans) { + qWarning("Transform changed"); Q_D(QFxFlipable); QPointF p1(0, 0); QPointF p2(1, 0); diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index b737615..3cbcd6a 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -52,6 +52,7 @@ #include "qmlengine.h" #include "qmlstate.h" #include "qlistmodelinterface.h" +#include "qfxanchors_p.h" #include "qfxtransform.h" #include "qfxscalegrid.h" @@ -434,6 +435,14 @@ void QFxItem::doUpdate() QFxItem::~QFxItem() { Q_D(QFxItem); + for (int ii = 0; ii < d->dependantAnchors.count(); ++ii) { + QFxAnchors *anchor = d->dependantAnchors.at(ii); + anchor->d_func()->clearItem(this); + } + for (int ii = 0; ii < d->dependantAnchors.count(); ++ii) { + QFxAnchors *anchor = d->dependantAnchors.at(ii); + anchor->d_func()->updateOnComplete(); + } delete d->_anchorLines; d->_anchorLines = 0; } @@ -1062,85 +1071,30 @@ void QFxItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { Q_D(QFxItem); - if (newGeometry.width() != oldGeometry.width()) { - int xoffset = oldGeometry.width() - newGeometry.width(); - d->handleWidthChange(xoffset); - } - if (newGeometry.height() != oldGeometry.height()) { - int yoffset = oldGeometry.height() - newGeometry.height(); - d->handleHeightChange(yoffset); - } + if (d->_anchors) + d->_anchors->d_func()->updateMe(); - if (newGeometry.x() != oldGeometry.x()) { - emit leftChanged(); - emit hcenterChanged(); - emit rightChanged(); + if (newGeometry.size() != oldGeometry.size()) { + if (rotation() && transformOrigin() != QFxItem::TopLeft) + setRotation(rotation()); + if (scale() && transformOrigin() != QFxItem::TopLeft) + setScale(scale()); } - if (newGeometry.y() != oldGeometry.y()) { + if (newGeometry.x() != oldGeometry.x()) + emit leftChanged(); + if (newGeometry.width() != oldGeometry.width()) + emit widthChanged(); + if (newGeometry.y() != oldGeometry.y()) emit topChanged(); - emit vcenterChanged(); - emit bottomChanged(); - } -} - -void QFxItemPrivate::handleWidthChange(int xoffset) -{ - Q_Q(QFxItem); - if (!_anchors) { - emit q->hcenterChanged(); - emit q->rightChanged(); - } else { - QFxAnchors::UsedAnchors used = anchors()->usedAnchors(); - if (used & QFxAnchors::HasHCenterAnchor) { - q->setX(q->x() + xoffset/2); - emit q->rightChanged(); - } else if ((used & QFxAnchors::HasRightAnchor) && !(used & QFxAnchors::HasLeftAnchor)) { - q->setX(q->x() + xoffset); - emit q->hcenterChanged(); - } else { - emit q->hcenterChanged(); - emit q->rightChanged(); - } - } - if (q->rotation() && q->transformOrigin() != QFxItem::TopLeft) - q->setRotation(q->rotation()); - if (q->scale() && q->transformOrigin() != QFxItem::TopLeft) - q->setScale(q->scale()); - emit q->widthChanged(); -} + if (newGeometry.height() != oldGeometry.height()) + emit heightChanged(); -void QFxItemPrivate::handleHeightChange(int yoffset) -{ - Q_Q(QFxItem); - if (!_anchors) { - emit q->vcenterChanged(); - emit q->bottomChanged(); - emit q->baselineChanged(); - } else { - QFxAnchors::UsedAnchors used = anchors()->usedAnchors(); - if (used & QFxAnchors::HasBaselineAnchor) { - q->setY(q->y() + yoffset - q->baselineOffset()); - emit q->bottomChanged(); - emit q->vcenterChanged(); - } else if (used & QFxAnchors::HasVCenterAnchor) { - q->setY(q->y() + yoffset/2); - emit q->bottomChanged(); - } else if ((used & QFxAnchors::HasBottomAnchor) && !(used & QFxAnchors::HasTopAnchor)) { - q->setY(q->y() + yoffset); - emit q->vcenterChanged(); - } else { - emit q->vcenterChanged(); - emit q->bottomChanged(); - emit q->baselineChanged(); - } + for(int ii = 0; ii < d->dependantAnchors.count(); ++ii) { + QFxAnchors *anchor = d->dependantAnchors.at(ii); + anchor->d_func()->update(this, newGeometry, oldGeometry); } - if (q->rotation() && q->transformOrigin() != QFxItem::TopLeft) - q->setRotation(q->rotation()); - if (q->scale() && q->transformOrigin() != QFxItem::TopLeft) - q->setScale(q->scale()); - emit q->heightChanged(); } /*! @@ -1483,7 +1437,6 @@ void QFxItem::setBaselineOffset(int offset) d->_baselineOffset = offset; emit baselineOffsetChanged(); - emit baselineChanged(); } /*! @@ -2075,10 +2028,8 @@ void QFxItem::componentComplete() d->_componentComplete = true; if (d->_stateGroup) d->_stateGroup->componentComplete(); - if (d->_anchors) { - d->anchors()->connectHAnchors(); - d->anchors()->connectVAnchors(); - } + if (d->_anchors) + d->anchors()->d_func()->updateOnComplete(); if (!d->_transform.isEmpty()) updateTransform(); } diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 549c9c2..437709f 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -213,14 +213,9 @@ public Q_SLOTS: Q_SIGNALS: void leftChanged(); - void rightChanged(); void widthChanged(); void heightChanged(); void topChanged(); - void bottomChanged(); - void hcenterChanged(); - void vcenterChanged(); - void baselineChanged(); void baselineOffsetChanged(); void stateChanged(const QString &); void focusChanged(); diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index f2da3ba..8ca7fda 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -129,6 +129,7 @@ public: } return _anchors; } + QList dependantAnchors; QFxAnchors *_anchors; QFxContents *_contents; QFxItem *qmlItem; @@ -171,9 +172,6 @@ public: QmlStateGroup *states(); QmlStateGroup *_stateGroup; - - void handleWidthChange(int xoffset); - void handleHeightChange(int xoffset); }; QT_END_NAMESPACE -- cgit v0.12 From 6210f1508da2d62614e0e9d35e5036a3ab9ee247 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 18 May 2009 09:08:17 +0200 Subject: Allow mapping from QMetaObject * to corresponding QmlType This is needed in Bauhaus to get the QmlType of a parent QMetaObject. Also, mark QmlType class as to be exported. Reviewed-by: Aaron Kennedy --- src/declarative/qml/qmlmetatype.cpp | 12 ++++++++++-- src/declarative/qml/qmlmetatype.h | 6 ++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp index 7825e5c..df61a82 100644 --- a/src/declarative/qml/qmlmetatype.cpp +++ b/src/declarative/qml/qmlmetatype.cpp @@ -95,8 +95,8 @@ struct QmlMetaTypeData QBitArray qmllists; QBitArray lists; }; -Q_GLOBAL_STATIC(QmlMetaTypeData, metaTypeData); -Q_GLOBAL_STATIC(QReadWriteLock, metaTypeDataLock); +Q_GLOBAL_STATIC(QmlMetaTypeData, metaTypeData) +Q_GLOBAL_STATIC(QReadWriteLock, metaTypeDataLock) class QmlTypePrivate { @@ -864,6 +864,14 @@ QmlType *QmlMetaType::qmlType(const QByteArray &name) return data->nameToType.value(name); } +QmlType *QmlMetaType::qmlType(const QMetaObject *metaObject) +{ + QReadLocker lock(metaTypeDataLock()); + QmlMetaTypeData *data = metaTypeData(); + + return data->metaObjectToType.value(metaObject); +} + QList QmlMetaType::qmlTypeNames() { QReadLocker lock(metaTypeDataLock()); diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h index 7ab01a5..cc3887c 100644 --- a/src/declarative/qml/qmlmetatype.h +++ b/src/declarative/qml/qmlmetatype.h @@ -64,9 +64,11 @@ public: static bool copy(int type, void *data, const void *copy = 0); - static QmlType *qmlType(const QByteArray &); static QList qmlTypeNames(); + static QmlType *qmlType(const QByteArray &); + static QmlType *qmlType(const QMetaObject *); + static QMetaProperty defaultProperty(const QMetaObject *); static QMetaProperty defaultProperty(QObject *); static QMetaMethod defaultMethod(const QMetaObject *); @@ -108,7 +110,7 @@ public: }; class QmlTypePrivate; -class QmlType +class Q_DECLARATIVE_EXPORT QmlType { public: QByteArray typeName() const; -- cgit v0.12 From 97d0f8f43db98e1c5ae49bd32dfc027e6d3a1349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 18 May 2009 09:59:06 +0200 Subject: Fixed a bug which implicitly closed perspective transformed poly lines. When the end point of a line in a path is clipped, only closed paths should have the closing line. Task-number: 253663 Reviewed-by: Samuel --- src/gui/painting/qtransform.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 2383272..cec2d16 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1355,7 +1355,8 @@ static inline QHomogeneousCoordinate mapHomogeneous(const QTransform &transform, return c; } -static inline bool lineTo_clipped(QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b, bool needsMoveTo) +static inline bool lineTo_clipped(QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b, + bool needsMoveTo, bool needsLineTo = true) { QHomogeneousCoordinate ha = mapHomogeneous(transform, a); QHomogeneousCoordinate hb = mapHomogeneous(transform, b); @@ -1388,7 +1389,8 @@ static inline bool lineTo_clipped(QPainterPath &path, const QTransform &transfor if (needsMoveTo) path.moveTo(ha.toPoint()); - path.lineTo(hb.toPoint()); + if (needsLineTo) + path.lineTo(hb.toPoint()); return true; } @@ -1455,7 +1457,7 @@ static QPainterPath mapProjective(const QTransform &transform, const QPainterPat } if (path.elementCount() > 0 && lastMoveTo != last) - lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo); + lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo, false); return result; } -- cgit v0.12 From 8dfb09c26d228388fba5318b6f61b4edbf67cdc2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 May 2009 10:55:52 +0200 Subject: Updated German translations for 4.5.2 --- translations/assistant_de.qm | Bin 20332 -> 18688 bytes translations/assistant_de.ts | 110 +++++++------ translations/designer_de.qm | Bin 152455 -> 151189 bytes translations/designer_de.ts | 12 +- translations/linguist_de.qm | Bin 47074 -> 45915 bytes translations/linguist_de.ts | 365 ++++++++++++++++++++++--------------------- translations/qt_de.qm | Bin 181913 -> 181348 bytes translations/qt_de.ts | 110 ++++++------- translations/qt_help_de.qm | Bin 9381 -> 9583 bytes translations/qt_help_de.ts | 2 +- 10 files changed, 300 insertions(+), 299 deletions(-) diff --git a/translations/assistant_de.qm b/translations/assistant_de.qm index 54146f6..5b31aea 100644 Binary files a/translations/assistant_de.qm and b/translations/assistant_de.qm differ diff --git a/translations/assistant_de.ts b/translations/assistant_de.ts index 0411ef1..9b0d628 100644 --- a/translations/assistant_de.ts +++ b/translations/assistant_de.ts @@ -163,7 +163,7 @@ CentralWidget - + Add new page Neue Seite hinzufügen @@ -173,38 +173,38 @@ Aktuelle Seite schließen - + Print Document Drucken - + unknown unbekannt - + Add New Page Neue Seite hinzufügen - + Close This Page Aktuelle Seite schließen - + Close Other Pages Andere Seiten schließen - + Add Bookmark for this Page... Lesezeichen für diese Seite hinzufügen... - + Search Suchen @@ -242,17 +242,17 @@ FindWidget - + Previous Vorherige - + Next Nächste - + Case Sensitive Gross/ Kleinschreibung beachten @@ -298,7 +298,7 @@ HelpViewer - + Help Hilfe @@ -329,12 +329,12 @@ Link in neuem Tab öffnen - + Open Link in New Tab Link in neuem Tab öffnen - + Unable to launch external application. Fehler beim Starten der externen Anwendung. @@ -463,38 +463,37 @@ MainWindow - + Index Index - - + + Contents Inhalt - - + + Bookmarks Lesezeichen - - + Search Suchen - - - + + + Qt Assistant Qt Assistant - - + + Unfiltered Ohne Filter @@ -718,7 +717,7 @@ Navigationsleiste - + Toolbars Werkzeugleisten @@ -743,7 +742,7 @@ Adresse: - + Could not find the associated content item. Der zugehörige Inhaltseintrag konnte nicht gefunden werden. @@ -769,12 +768,12 @@ Über %1 - + Updating search index Suchindex wird aufgebaut - + Looking for Qt Documentation... Suche nach Qt Dokumentationen... @@ -862,46 +861,45 @@ Von Helpserver herunterladen... - - - + + Add Documentation Dokumentation hinzufügen - + Qt Compressed Help Files (*.qch) Komprimierte Hilfe Dateien (*.qch) - + The specified file is not a valid Qt Help File! Die angegebene Datei ist keine Qt Hilfe Datei! - + The namespace %1 is already registered! Der Namespace %1 ist bereits registriert! - + Remove Documentation - + Dokumentation entfernen 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. Cancel - Abbrechen + Abbrechen OK - OK + OK @@ -1000,22 +998,22 @@ Options - + Einstellungen Current Page - + Aktuelle Seite Restore to default - + Vorgabe wiederherstellen Homepage - + Startseite @@ -1025,7 +1023,7 @@ Neuer Ordner - + The specified collection file does not exist! Die angegeben Katalogdatei (collection file) konnte nicht gefunden werden! @@ -1073,10 +1071,10 @@ Missing filter argument! - + Das Filter-Argument fehlt! - + Unknown option: %1 Unbekannte Option: %1 @@ -1087,7 +1085,7 @@ Qt Assistant - + Could not register documentation file %1 @@ -1115,9 +1113,9 @@ Reason: Dokumentation erfolgreich entfernt. - + Cannot load sqlite database driver! - + Der Datenbanktreiber für SQLite kann nicht geladen werden! @@ -1147,7 +1145,7 @@ Reason: SearchWidget - + &Copy &Kopieren @@ -1157,20 +1155,18 @@ Reason: &Link Adresse kopieren - - + Open Link in New Tab Link in neuem Tab öffnen - + Select All Alles markieren - Open Link - Link öffnen + Link öffnen diff --git a/translations/designer_de.qm b/translations/designer_de.qm index d51c51d..f9b0a03 100644 Binary files a/translations/designer_de.qm and b/translations/designer_de.qm differ diff --git a/translations/designer_de.ts b/translations/designer_de.ts index 4cd9914..002fc8d 100644 --- a/translations/designer_de.ts +++ b/translations/designer_de.ts @@ -339,7 +339,7 @@ ate the goose who was loose. Change signal-slot connection - + Signale-Slotverbindung ändern @@ -1384,7 +1384,7 @@ ate the goose who was loose. Plugin Information - Plugins + Plugins @@ -4026,7 +4026,7 @@ Möchten Sie sie überschreiben? Go to slot... - Slot anzeigen... + Slot anzeigen... @@ -5963,14 +5963,14 @@ Please select another name. Detailansicht - + Object: %1 Class: %2 Objekt: %1 Klasse: %2 - + Sorting Sortiert @@ -5980,7 +5980,7 @@ Klasse: %2 Farbige Hervorhebung - + Configure Property Editor Anzeige der Eigenschaften konfigurieren diff --git a/translations/linguist_de.qm b/translations/linguist_de.qm index f411122..a39c3bf 100644 Binary files a/translations/linguist_de.qm and b/translations/linguist_de.qm differ diff --git a/translations/linguist_de.ts b/translations/linguist_de.ts index 712f75d..cb8e4d2 100644 --- a/translations/linguist_de.ts +++ b/translations/linguist_de.ts @@ -6,7 +6,7 @@ (New Entry) - + (Neuer Eintrag) @@ -29,7 +29,7 @@ Batch Translation of '%1' - Qt Linguist - + Automatische Übersetzung von '%1' - Qt Linguist @@ -57,62 +57,62 @@ Qt Linguist - Batch Translation - Qt Linguist - Automatische Übersetzung + Qt Linguist - Automatische Übersetzung Options - Optionen + Optionen Set translated entries to finished - Markiere Übersetzung als erledigt + Markiere Übersetzung als erledigt Retranslate entries with existing translation - + Einträge mit bereits existierender Übersetzung neu übersetzen 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. Translate also finished entries - + Erledigte Einträge übersetzen Phrase book preference - Wörterbücher + Wörterbücher Move up - Nach oben + Nach oben Move down - Nach unten + Nach unten The batch translator will search through the selected phrase books in the order given above. - + Der automatische Übersetzer wird in der angegebenen Reihenfolge durch die ausgewählten Wörterbücher gehen. &Run - &Ausführen + &Ausführen Cancel - Abbrechen + Abbrechen @@ -120,38 +120,39 @@ <qt>Duplicate messages found in '%1': - + <qt>Mehrfach vorhandene Meldungen in '%1': <p>[more duplicates omitted] - + <p>[weitere mehrfach vorhandene Nachrichten weggelassen] <p>* Context: %1<br>* Source: %2 - + <p>* Kontext: %1<br>* Quelle: %2 <br>* Comment: %3 - + <br>* Kommentar: %3 Linguist does not know the plural rules for '%1'. Will assume a single universal form. - + Die Regeln zur Pluralbildung der Sprache '%1' sind in Linguist nicht definiert. +Es wird mit einer einfachen Universalform gearbeitet. Cannot create '%2': %1 - + '%2' kann nicht erzeugt werden: %1 Universal Form - + Universalform @@ -239,7 +240,7 @@ Will assume a single universal form. Translation does not contain the necessary %n place marker. - + Der erforderliche Platzhalter (%n) fehlt in der Übersetzung. @@ -311,37 +312,37 @@ Will assume a single universal form. Find - + Suchen &Find what: - + &Suchmuster: &Source texts - + &Quelltexte &Translations - + &Übersetzungen &Match case - + &Groß-/Kleinschreibung beachten &Comments - + &Kommentare Ignore &accelerators - + Tastenkürzel &ignorieren @@ -612,102 +613,102 @@ p, li { white-space: pre-wrap; } Previous unfinished item. - + Vorherige Unerledigte Move to the previous unfinished item. - + Gehe zum vorangehenden unerledigten Eintrag. Next unfinished item. - + Nächste Unerledigte Move to the next unfinished item. - + Gehe zum nächsten unerledigten Eintrag. Move to previous item. - + Gehe zum vorigen Eintrag. Move to the previous item. - + Gehe zum vorigen Eintrag. Next item. - + Nächster EIntrag. Move to the next item. - + Gehe zum nächsten Eintrag. Mark item as done and move to the next unfinished item. - + Markiere Eintrag als erledigt und gehe zum nächsten unerledigten Eintrag. Mark this item as done and move to the next unfinished item. - + Markiert diesen Eintrag als erledigt und geht zum nächsten unerledigten Eintrag. Copy from source text - + Übernehme &Ursprungstext Toggle the validity check of accelerators. - + Schalte Prüfung der Tastenkürzel um. Toggle the validity check of accelerators, i.e. whether the number of ampersands in the source and translation text is the same. If the check fails, a message is shown in the warnings window. - + Schalte Prüfung der Tastenkürzel um; das heisst, die Übereinstimmung der kaufmännischen Und-Zeichen in Quelle und Übersetzung. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt. Toggle the validity check of ending punctuation. - + Schalte Prüfung der Satzendezeichen am Ende des Textes um. Toggle the validity check of ending punctuation. If the check fails, a message is shown in the warnings window. - + Schaltet die Prüfung der Satzendezeichen am Ende des Textes um. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt. Toggle checking that phrase suggestions are used. If the check fails, a message is shown in the warnings window. - + Schaltet die Prüfung der Verwendung der Wörterbuchvorschläge um. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt. Toggle the validity check of place markers. - + Schaltet die Prüfung der Platzhalter um. 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. - + Schaltet die Prüfung der Platzhalter um; das heisst, ob %1, %2,... in Quelltext und Übersetzung übereinstimmend verwendet werden. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt. Open Read-O&nly... - + Schr&eibgeschützt öffnen... &Save All - + &Alles Speichern @@ -767,22 +768,22 @@ p, li { white-space: pre-wrap; } Recently Opened &Files - + Zu&letzt bearbeitete Dateien Save - + Speichern Print a list of all the translation units in the current translation source file. - + Liste aller Übersetzungseinheiten in der aktuellen Übersetzungsdatei drucken. Undo the last editing operation performed on the current translation. - + Mache die letzte Änderung an der Übersetzung rückgängig. @@ -902,12 +903,12 @@ p, li { white-space: pre-wrap; } Close - Schließen + Schließen &Close All - + A&lle schließen @@ -1170,49 +1171,49 @@ p, li { white-space: pre-wrap; } Source text - Ursprungstext + Ursprungstext Index - Index + Index Context - Kontext + Kontext Items - Einträge + Einträge This panel lists the source contexts. - Dieser Bereich zeigt die Kontexte an. + Dieser Bereich zeigt die Kontexte an. Strings - Zeichenketten + Zeichenketten Phrases and guesses - Wörterbuch und Vorschläge + Wörterbuch und Vorschläge Sources and Forms - + Quelldateien und Formulare Warnings - Warnungen + Hinweise @@ -1223,120 +1224,124 @@ p, li { white-space: pre-wrap; } Loading... - Lade... + Lade... Loading File - Qt Linguist - + Laden - Qt Linguist The file '%1' does not seem to be related to the currently open file(s) '%2'. Close the open file(s) first? - + Die Datei '%1' scheint nicht zu den bereits geöffneten Dateien '%2' zu passen. + +Sollen die bereits geöffneten Dateien vorher geschlossen werden? The file '%1' does not seem to be related to the file '%2' which is being loaded as well. Skip loading the first named file? - + Die Datei '%1' scheint nicht zu der Datei '%2' zu passen, die ebenfalls geladen wird. + +Soll die erstgenannte Datei übersprungen werden? %n translation unit(s) loaded. - - - + + Eine Übersetzungseinheit geladen. + %n Übersetzungseinheiten geladen. Related files (%1);; - + Verwandte Dateien (%1);; Open Translation Files - + Übersetzungsdateien öffnen File saved. - Datei gespeichert. + Datei gespeichert. Release - Freigeben + Freigeben Qt message files for released applications (*.qm) All files (*) - Qt Nachrichtendateien (*.qm) + Qt Nachrichtendateien (*.qm) Alle Dateien (*) File created. - Datei erzeugt. + Datei erzeugt. Printing... - Drucke... + Drucke... Context: %1 - Kontext: %1 + Kontext: %1 finished - erledigt + erledigt unresolved - ungelöst + ungelöst obsolete - veraltet + veraltet Printing... (page %1) - Drucke... (Seite %1) + Drucke... (Seite %1) Printing completed - Drucken beendet + Drucken beendet Printing aborted - Drucken abgebrochen + Drucken abgebrochen Search wrapped. - Suche beginnt von oben. + Suche beginnt von oben. @@ -1356,7 +1361,7 @@ Alle Dateien (*) Cannot find the string '%1'. - Kann Zeichenkette '%1' nicht finden. + Kann Zeichenkette '%1' nicht finden. Translated %n entries to '%1' @@ -1368,59 +1373,59 @@ Alle Dateien (*) Search And Translate in '%1' - Qt Linguist - + Suchen und übersetzen '%1' - Qt Linguist Translate - Qt Linguist - + Übersetzung - Qt Linguist Translated %n entry(s) - - - + + Ein Eintrag übersetzt + %n Einträge übersetzt No more occurrences of '%1'. Start over? - + Keine weiteren Fundstellen von '%1'. Von vorn beginnen? Create New Phrase Book - Erzeugen eines neuen Wörterbuchs + Erzeugen eines neuen Wörterbuchs Qt phrase books (*.qph) All files (*) - Qt Wörterbücher (*.qph) + Qt Wörterbücher (*.qph) Alle Dateien (*) Phrase book created. - Wörterbuch erzeugt. + Wörterbuch erzeugt. Open Phrase Book - Öffne Wörterbuch + Öffne Wörterbuch Qt phrase books (*.qph);;All files (*) - Qt Wörterbücher (*.qph);;Alle Dateien (*) + Qt Wörterbücher (*.qph);;Alle Dateien (*) %n phrase(s) loaded. - + Ein Wörterbucheintrag geladen. %n Wörterbucheinträge geladen. @@ -1430,32 +1435,32 @@ Alle Dateien (*) Add to phrase book - Hinzufügen zum Wörterbuch + Hinzufügen zum Wörterbuch No appropriate phrasebook found. - + Es wurde kein geeignetes Wörterbuch gefunden. Adding entry to phrasebook %1 - + Eintrag zu Wörterbuch %1 hinzufügen Select phrase book to add to - Zu welchem Wörterbuch soll der Eintrag hinzugefügt werden? + Zu welchem Wörterbuch soll der Eintrag hinzugefügt werden? Unable to launch Qt Assistant (%1) - Kann Qt Assistant nicht starten (%1) + Kann Qt Assistant nicht starten (%1) Version %1 - Version %1 + Version %1 Open Source Edition @@ -1464,17 +1469,17 @@ Alle Dateien (*) <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 ist ein Werkzeug zum Übersetzen von Qt Anwendungen.</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 ist ein Werkzeug zum Übersetzen von Qt Anwendungen.</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> Do you want to save the modified files? - + Möchten Sie die geänderten Dateien speichern? Do you want to save '%1'? - Wollen Sie '%1' speichern? + Möchten Sie '%1' speichern? @@ -1490,99 +1495,99 @@ Alle Dateien (*) No untranslated translation units left. - + Es wurden alle Übersetzungseinheiten abgearbeitet. &Window - &Fenster + &Fenster Minimize - Minimieren + Minimieren Ctrl+M - Ctrl+M + Display the manual for %1. - Zeige Handbuch für %1 an. + Zeige Handbuch für %1 an. Display information about %1. - Zeige Informationen über %1 an. + Zeige Informationen über %1 an. &Save '%1' - + '%1' &Speichern Save '%1' &As... - + Speichere '%1' &unter... Release '%1' - + '%1' freigeben Release '%1' As... - + Gebe '%1'frei unter ... &Close '%1' - + '%1' &Schließen &Close - &Schließen + &Schließen Save All - + Alles speichern &Release All - + Alles f&reigeben Close All - Alle schließen + Alle schließen Translation File &Settings for '%1'... - + Einstellungen der Übersetzungs&datei für '%1'... &Batch Translation of '%1'... - + &Automatische Übersetzung von '%1'... Search And &Translate in '%1'... - + Suchen und &Übersetzen in '%1'... Search And &Translate... - + Suchen und &Übersetzen... @@ -1617,37 +1622,37 @@ Alle Dateien (*) Cannot read from phrase book '%1'. - Kann Wörterbuch '%1' nicht lesen. + Kann Wörterbuch '%1' nicht lesen. Close this phrase book. - Schließe dieses Wörterbuch. + Schließe dieses Wörterbuch. 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. Print the entries in this phrase book. - + Drucke die Einträge des Wörterbuchs. Cannot create phrase book '%1'. - Kann Wörterbuch '%1' nicht erzeugen. + Kann Wörterbuch '%1' nicht erzeugen. Do you want to save phrase book '%1'? - + Möchten Sie das Wörterbuch '%1' speichern? All - + Alle @@ -1704,27 +1709,27 @@ Alle Dateien (*) German - Deutsch + Deutsch Japanese - Japanisch + Japanisch French - Französisch + Französisch Polish - Polnisch + Polnisch Chinese - Chinesisch + Chinesisch @@ -1732,59 +1737,59 @@ Alle Dateien (*) Dieser Bereich erlaubt die Darstellung und Änderung der Übersetzung eines Textes. - + Source text - Ursprungstext + Ursprungstext This area shows the source text. - Dieser Bereich zeigt den Ursprungstext. + Dieser Bereich zeigt den Ursprungstext. Source text (Plural) - + Ursprungstext (Plural) This area shows the plural form of the source text. - + Dieser Bereich zeigt die Pluralform des Ursprungstexts. Developer comments - + Hinweise des Entwicklers This area shows a comment that may guide you, and the context in which the text occurs. - Dieser Bereich zeigt eventuelle Kommentare und den Kontext, in dem der Text auftritt. + Dieser Bereich zeigt eventuelle Kommentare und den Kontext, in dem der Text auftritt. Here you can enter comments for your own use. They have no effect on the translated applications. - + Hier können Sie Hinweise für den eigenen Gebrauch eintragen. Diese haben keinen Einflusse auf die Übersetzung. %1 translation (%2) - Übersetzung %1 (%2) + Übersetzung %1 (%2) This is where you can enter or modify the translation of the above source text. - + Hier können Sie die Übersetzung des Ursprungstextes eingeben bzw. ändern. %1 translation - Übersetzung %1 + Übersetzung %1 %1 translator comments - + %1 Hinweise des Übersetzers @@ -1839,22 +1844,22 @@ Zeile: %2 Completion status for %1 - + Bearbeitungsstand von %1 <file header> - + <Dateikopf> <context comment> - + <Kontexthinweis> <unnamed context> - + <unbenannter Kontext> @@ -1867,7 +1872,7 @@ Zeile: %2 MsgEdit - + This is the right panel of the main window. @@ -1912,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. @@ -1952,22 +1957,22 @@ Zeile: %2 &New Entry - + &Neuer Eintrag Click here to remove the entry from the phrase book. - + Entferne den Eintrag aus dem Wörterbuch. &Remove Entry - + &Entferne Eintrag Settin&gs... - + &Einstellungen... &New Phrase @@ -2053,12 +2058,12 @@ Zeile: %2 Translation files (%1);; - + Übersetzungsdateien (%1);; All files (*) - + Alle Dateien (*) @@ -2074,57 +2079,57 @@ Zeile: %2 C++ source files - + C++-Quelltextdateien' Java source files - + Java-Quelltextdateien GNU Gettext localization files - + GNU-Gettext Übersetzungsdateien Qt Script source files - + Qt-Skript-Quelltextdateien Qt translation sources (format 1.1) - + Qt-Übersetzungsdateien (Formatversion 1.1) Qt translation sources (format 2.0) - + Qt-Übersetzungsdateien (Formatversion 2.0) Qt translation sources (latest format) - + Qt Übersetzungsdateien (aktuelles Format) Qt Designer form files - + Qt Designer Formulardateien Qt Jambi form files - + Qt Jambi Formulardateien XLIFF localization files - + XLIFF Übersetzungsdateien Qt Linguist 'Phrase Book' - + Qt Linguist-Wörterbuch @@ -2223,7 +2228,7 @@ Zeile: %2 Close - Schließen + Schließen @@ -2727,27 +2732,27 @@ Alle Dateien (*) Settings for '%1' - Qt Linguist - + Einstellungen für '%1' - Qt Linguist Source language - + Ursprungssprache Language - Sprache + Sprache Country/Region - Land/Region + Land/Region Target language - Zielsprache + Zielsprache diff --git a/translations/qt_de.qm b/translations/qt_de.qm index 5d68bf7..9ea09a7 100644 Binary files a/translations/qt_de.qm and b/translations/qt_de.qm differ diff --git a/translations/qt_de.ts b/translations/qt_de.ts index 70cf6f3..33f9ea8 100644 --- a/translations/qt_de.ts +++ b/translations/qt_de.ts @@ -22,7 +22,7 @@ CloseButton - + Close Tab Schließen @@ -186,7 +186,7 @@ Bitte prüfen Sie die Gstreamer-Installation und stellen Sie sicher, dass das Pa Q3FileDialog - + Copy or Move a File Datei kopieren oder verschieben @@ -203,7 +203,7 @@ Bitte prüfen Sie die Gstreamer-Installation und stellen Sie sicher, dass das Pa - + Cancel Abbrechen @@ -886,7 +886,7 @@ nach 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. LTR @@ -1170,7 +1170,7 @@ nach QDialogButtonBox - + OK @@ -1392,7 +1392,7 @@ nach Cannot remove source file - + Die Quelldatei kann nicht entfernt werden @@ -1418,8 +1418,8 @@ nach QFileDialog - - + + All Files (*) Alle Dateien (*) @@ -1448,7 +1448,7 @@ nach Datei - + Open Öffnen @@ -1458,26 +1458,26 @@ nach Speichern unter - + - + &Open &Öffnen - + &Save S&peichern - + Recent Places Zuletzt besucht - + &Rename &Umbenennen @@ -1492,17 +1492,17 @@ nach &Versteckte Dateien anzeigen - + New Folder Neues Verzeichnis - + Find Directory Verzeichnis suchen - + Directories Verzeichnisse @@ -1512,13 +1512,13 @@ nach Alle Dateien (*.*) - - + + Directory: Verzeichnis: - + %1 already exists. Do you want to replace it? Die Datei %1 existiert bereits. @@ -1552,7 +1552,7 @@ Stellen Sie sicher, dass der Dateiname richtig ist. - + %1 Directory not found. Please verify the correct directory name was given. @@ -1588,7 +1588,7 @@ Möchten sie die Datei trotzdem löschen? Unbekannt - + Show Anzeigen @@ -1604,19 +1604,19 @@ Möchten sie die Datei trotzdem löschen? &Neues Verzeichnis - + &Choose &Auswählen - + Remove Löschen - - + + File &name: Datei&name: @@ -1698,7 +1698,7 @@ Möchten sie die Datei trotzdem löschen? Änderungsdatum - + My Computer Mein Computer @@ -2161,7 +2161,7 @@ Möchten sie die Datei trotzdem löschen? QHttp - + Connection refused Verbindung verweigert @@ -2253,7 +2253,7 @@ Möchten sie die Datei trotzdem löschen? Unknown authentication method - + Unbekannte Authentifizierungsmethode @@ -2365,7 +2365,7 @@ Möchten sie die Datei trotzdem löschen? QIBaseDriver - + Error opening database Die Datenbankverbindung konnte nicht geöffnet werden @@ -2643,7 +2643,7 @@ Möchten sie die Datei trotzdem löschen? QLocalServer - + %1: Name error %1: Fehlerhafter Name @@ -2738,7 +2738,7 @@ Möchten sie die Datei trotzdem löschen? QMYSQLDriver - + Unable to open database ' Die Datenbankverbindung konnte nicht geöffnet werden ' @@ -2766,12 +2766,12 @@ Möchten sie die Datei trotzdem löschen? QMYSQLResult - + Unable to fetch data Es konnten keine Daten abgeholt werden - + Unable to execute query Die Abfrage konnte nicht ausgeführt werden @@ -2781,13 +2781,13 @@ Möchten sie die Datei trotzdem löschen? Das Ergebnis konnte nicht gespeichert werden - + Unable to prepare statement Der Befehl konnte nicht initialisiert werden - + Unable to reset statement Der Befehl konnte nicht zurückgesetzt werden @@ -2813,7 +2813,7 @@ Möchten sie die Datei trotzdem löschen? Die Ergebnisse des Befehls konnten nicht gespeichert werden - + Unable to execute next query Die folgende Abfrage kann nicht ausgeführt werden @@ -2971,7 +2971,7 @@ Möchten sie die Datei trotzdem löschen? <p>Dieses Programm verwendet Qt-Version %1.</p> - + Show Details... Details einblenden... @@ -2981,7 +2981,7 @@ Möchten sie die Datei trotzdem löschen? Details ausblenden... - + <h3>About Qt</h3><p>This program uses Qt version %1.</p><p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://www.qtsoftware.com/products/licensing">www.qtsoftware.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://www.qtsoftware.com/qt/">www.qtsoftware.com/qt</a> for more information.</p> @@ -3310,7 +3310,7 @@ Möchten sie die Datei trotzdem löschen? QODBCDriver - + Unable to connect Es kann keine Verbindung aufgebaut werden @@ -3444,7 +3444,7 @@ Möchten sie die Datei trotzdem löschen? QPPDOptionsModel - + Name Name @@ -4009,7 +4009,7 @@ Bitte wählen Sie einen anderen Dateinamen. Benutzerdefiniert - + &Options >> &Einstellungen >> @@ -4030,7 +4030,7 @@ Bitte wählen Sie einen anderen Dateinamen. Druck in Postscript-Datei - + Local file Lokale Datei @@ -4040,7 +4040,7 @@ Bitte wählen Sie einen anderen Dateinamen. Schreiben der Datei %1 - + &Print &Drucken @@ -4373,7 +4373,7 @@ Bitte wählen Sie einen anderen Dateinamen. No program defined - + Es wurde kein Programm angegeben @@ -5985,7 +5985,7 @@ Bitte wählen Sie einen anderen Dateinamen. %1 (%2x%3 Pixel) - + Bad HTTP request Ungültige HTTP-Anforderung @@ -6077,15 +6077,15 @@ Bitte wählen Sie einen anderen Dateinamen. JavaScript Confirm - %1 - JavaScript-Bestätigung - %1 + JavaScript-Bestätigung - %1 JavaScript Prompt - %1 - JavaScript-Eingabeaufforderung - %1 + JavaScript-Eingabeaufforderung - %1 - + Move the cursor to the next character Positionsmarke auf folgendes Zeichen setzen @@ -6147,7 +6147,7 @@ Bitte wählen Sie einen anderen Dateinamen. Select all - + Alles auswählen @@ -6222,12 +6222,12 @@ Bitte wählen Sie einen anderen Dateinamen. Insert a new paragraph - + Neuen Abschnitt einfügen Insert a new line - + Neue Zeile einfügen @@ -6241,7 +6241,7 @@ Bitte wählen Sie einen anderen Dateinamen. QWidget - + * * @@ -6787,7 +6787,7 @@ Bitte wählen Sie einen anderen Dateinamen. %1 ist kein gültiger regulärer Ausdruck: %2 - + It will not be possible to retrieve %1. %1 kann nicht bestimmt werden. @@ -7508,7 +7508,7 @@ Bitte wählen Sie einen anderen Dateinamen. In a namespace constructor, the value for a namespace cannot be an empty string. - + Im Konstruktor eines Namensraums darf der Wert des Namensraumes keine leere Zeichenkette sein. diff --git a/translations/qt_help_de.qm b/translations/qt_help_de.qm index e28a97e..e3d8d87 100644 Binary files a/translations/qt_help_de.qm and b/translations/qt_help_de.qm differ diff --git a/translations/qt_help_de.ts b/translations/qt_help_de.ts index ed8a3c3..8f67ec3 100644 --- a/translations/qt_help_de.ts +++ b/translations/qt_help_de.ts @@ -39,7 +39,7 @@ Cannot load sqlite database driver! - + Der Datenbanktreiber für SQLite kann nicht geladen werden! -- cgit v0.12 From 44d0dbcc350ddd2ab3459aea78628409a1aef0d5 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 18 May 2009 10:48:11 +0200 Subject: Fix QSoundServer on Big-Endian machines. Task-number: 253619 Reviewed-by: Paul --- src/gui/embedded/qsoundqss_qws.cpp | 40 +++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp index c72ea91..283bbd3 100644 --- a/src/gui/embedded/qsoundqss_qws.cpp +++ b/src/gui/embedded/qsoundqss_qws.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -335,7 +336,13 @@ public: virtual int readySamples(int) = 0; int getSample(int off, int bps) { - return (bps == 1) ? (data[out+off] - 128) * 128 : ((short*)data)[(out/2)+off]; + + // + // 16-bit audio data is converted to native endian so that it can be scaled + // Yes, this is ugly on a BigEndian machine + // Perhaps it shouldn't be scaled at all + // + return (bps == 1) ? (data[out+off] - 128) * 128 : qToLittleEndian(((short*)data)[(out/2)+off]); } int add(int* mixl, int* mixr, int count) @@ -547,7 +554,7 @@ public: wavedata_remaining = 0; mFinishedRead = true; } else if ( qstrncmp(chunk.id,"data",4) == 0 ) { - wavedata_remaining = chunk.size; + wavedata_remaining = qToLittleEndian( chunk.size ); //out = max = sound_buffer_size; @@ -572,10 +579,23 @@ public: //qDebug("couldn't ready chunkdata"); mFinishedRead = true; } + #define WAVE_FORMAT_PCM 1 - else if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) { - //qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag); - mFinishedRead = true; + else + { + /* + ** Endian Fix the chuck data + */ + chunkdata.formatTag = qToLittleEndian( chunkdata.formatTag ); + chunkdata.channels = qToLittleEndian( chunkdata.channels ); + chunkdata.samplesPerSec = qToLittleEndian( chunkdata.samplesPerSec ); + chunkdata.avgBytesPerSec = qToLittleEndian( chunkdata.avgBytesPerSec ); + chunkdata.blockAlign = qToLittleEndian( chunkdata.blockAlign ); + chunkdata.wBitsPerSample = qToLittleEndian( chunkdata.wBitsPerSample ); + if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) { + qWarning("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag); + mFinishedRead = true; + } } } else { // ignored chunk @@ -1166,9 +1186,15 @@ bool QWSSoundServerPrivate::openDevice() if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &v)) qWarning("Could not set fragments to %08x",v); #ifdef QT_QWS_SOUND_16BIT - v=AFMT_S16_LE; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v)) + // + // Use native endian + // Since we have manipulated the data volume the data + // is now in native format, even though its stored + // as little endian in the WAV file + // + v=AFMT_S16_NE; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v)) qWarning("Could not set format %d",v); - if (AFMT_S16_LE != v) + if (AFMT_S16_NE != v) qDebug("Want format %d got %d", AFMT_S16_LE, v); #else v=AFMT_U8; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v)) -- cgit v0.12 From 7133b932ac2af6e5a09323f09ee8024d0042bce3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 May 2009 11:00:10 +0200 Subject: Made it possible to set string properties using QDesignerFormWindowCursor::setProperty. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ensure the text does not get clobbered by the subproperty handling. Reviewed-by: Kai Köhne Task-number: 253278 --- tools/designer/src/lib/shared/qdesigner_propertycommand.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp b/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp index ff3b50b..94e8044 100644 --- a/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp +++ b/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp @@ -316,6 +316,10 @@ Qt::Alignment variantToAlignment(const QVariant & q) // find changed subproperties of a variant unsigned compareSubProperties(const QVariant & q1, const QVariant & q2, qdesigner_internal::SpecialProperty specialProperty) { + // Do not clobber new value in the comparison function in + // case someone sets a QString on a PropertySheetStringValue. + if (q1.type() != q2.type()) + return SubPropertyAll; switch (q1.type()) { case QVariant::Rect: return compareSubProperties(q1.toRect(), q2.toRect()); -- cgit v0.12 From 76504e5e5ee51665ddd37d36e220c9266d84aa53 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 May 2009 11:06:06 +0200 Subject: Fixed a bug caused by forms with a sizepolicy of 'Fixed' on the main container. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restore 4.4 behaviour by using a QStackedLayout as the layout containing the actual form (as was in 4.4). The difference in behaviour was caused by insertion of an additional widget with a QVBoxLayout which is supposed to ease setting of inheritable properties (style, etc). Reviewed-by: Kai Köhne Task-number: 253236 --- tools/designer/src/components/formeditor/formwindow_widgetstack.cpp | 6 +++++- tools/designer/src/components/formeditor/formwindow_widgetstack.h | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/designer/src/components/formeditor/formwindow_widgetstack.cpp b/tools/designer/src/components/formeditor/formwindow_widgetstack.cpp index 7270628..58127b0 100644 --- a/tools/designer/src/components/formeditor/formwindow_widgetstack.cpp +++ b/tools/designer/src/components/formeditor/formwindow_widgetstack.cpp @@ -57,16 +57,20 @@ using namespace qdesigner_internal; FormWindowWidgetStack::FormWindowWidgetStack(QObject *parent) : QObject(parent), m_formContainer(new QWidget), - m_formContainerLayout(new QVBoxLayout), + m_formContainerLayout(new QStackedLayout), m_layout(new QStackedLayout) { m_layout->setMargin(0); m_layout->setSpacing(0); m_layout->setStackingMode(QStackedLayout::StackAll); + // We choose a QStackedLayout as immediate layout for + // the form windows as it ignores the sizePolicy of + // its child (for example, Fixed would cause undesired side effects). m_formContainerLayout->setMargin(0); m_formContainer->setObjectName(QLatin1String("formContainer")); m_formContainer->setLayout(m_formContainerLayout); + m_formContainerLayout->setStackingMode(QStackedLayout::StackAll); // System settings might have different background colors, autofill them // (affects for example mainwindow status bars) m_formContainer->setAutoFillBackground(true); diff --git a/tools/designer/src/components/formeditor/formwindow_widgetstack.h b/tools/designer/src/components/formeditor/formwindow_widgetstack.h index 92323c5..f21c4f0 100644 --- a/tools/designer/src/components/formeditor/formwindow_widgetstack.h +++ b/tools/designer/src/components/formeditor/formwindow_widgetstack.h @@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE class QDesignerFormWindowToolInterface; class QStackedLayout; -class QVBoxLayout; class QWidget; namespace qdesigner_internal { @@ -92,7 +91,7 @@ protected: private: QList m_tools; QWidget *m_formContainer; - QVBoxLayout *m_formContainerLayout; + QStackedLayout *m_formContainerLayout; QStackedLayout *m_layout; }; -- cgit v0.12 From 968c3e34b97769c0917325ce8b2b3b34b87a4e48 Mon Sep 17 00:00:00 2001 From: axasia Date: Sun, 17 May 2009 00:02:02 +0900 Subject: Update japanese translation of Qt Assistant. --- translations/assistant_ja.ts | 395 ++++++++++++++++++++++--------------------- 1 file changed, 203 insertions(+), 192 deletions(-) diff --git a/translations/assistant_ja.ts b/translations/assistant_ja.ts index 1853155..5e4d2c9 100644 --- a/translations/assistant_ja.ts +++ b/translations/assistant_ja.ts @@ -1,12 +1,12 @@ - + AboutDialog &Close - + é–‰ã˜ã‚‹(&C) @@ -14,18 +14,19 @@ Warning - + 警告 Unable to launch external application. - + 外部アプリケーションを起動ã§ãã¾ã›ã‚“。 + OK - + OK @@ -37,42 +38,42 @@ Bookmarks - + ブックマーク Add Bookmark - + ブックマークã®è¿½åŠ  Bookmark: - + ブックマーク: Add in Folder: - + 追加先フォルダ: + - + + New Folder - + æ–°ã—ã„フォルダ Delete Folder - + フォルダを削除 Rename Folder - + フォルダã®åå‰å¤‰æ›´ @@ -80,23 +81,23 @@ Bookmarks - + ブックマーク Remove - + 削除 You are going to delete a Folder, this will also<br>remove it's content. Are you sure to continue? - + フォルダを削除ã™ã‚‹ã¨ä¸­èº«ã‚‚削除ã•れã¾ã™ãŒã€ç¶šã‘ã¦ã‚ˆã‚ã—ã„ã§ã™ã‹? New Folder - + æ–°ã—ã„フォルダ @@ -104,47 +105,47 @@ Filter: - + フィルタ: Remove - + 削除 Delete Folder - + フォルダを削除 Rename Folder - + フォルダã®åå‰å¤‰æ›´ Show Bookmark - + ブックマークを開ã Show Bookmark in New Tab - + ブックマークを新ã—ã„タブã§é–‹ã Delete Bookmark - + ブックマークを削除 Rename Bookmark - + ブックマークã®åå‰å¤‰æ›´ Add - + 追加 @@ -152,48 +153,48 @@ Add new page - + æ–°ã—ã„ページã®è¿½åŠ  Close current page - + ç¾åœ¨ã®ãƒšãƒ¼ã‚¸ã‚’é–‰ã˜ã‚‹ Print Document - + ドキュメントをå°åˆ· unknown - + 䏿˜Ž Add New Page - + æ–°ã—ã„ページã®è¿½åŠ  Close This Page - + ã“ã®ãƒšãƒ¼ã‚¸ã‚’é–‰ã˜ã‚‹ Close Other Pages - + ä»–ã®ãƒšãƒ¼ã‚¸ã‚’é–‰ã˜ã‚‹ Add Bookmark for this Page... - + ã“ã®ãƒšãƒ¼ã‚¸ã‚’ブックマークã«è¿½åŠ ... Search - + 検索 @@ -201,12 +202,12 @@ Open Link - + リンクを開ã Open Link in New Tab - + リンクを新ã—ã„タブã§é–‹ã @@ -214,12 +215,12 @@ Add Filter Name - + フィルタåを追加 Filter Name: - + フィルタå: @@ -227,27 +228,27 @@ Previous - + 戻る Next - + 進む Case Sensitive - + 大文字/å°æ–‡å­—を区別ã™ã‚‹ Whole words - + å˜èªžå˜ä½ã§æ¤œç´¢ã™ã‚‹ <img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped - + <img src=":/trolltech/assistant/images/wrap.png">&nbsp;見ã¤ã‹ã‚‰ãªã‘れã°å…ˆé ­ã‹ã‚‰æ¤œç´¢ã™ã‚‹ @@ -255,27 +256,27 @@ Font - + フォント &Writing system - + 文字セット(&W) &Family - + フォントå(&F) &Style - + スタイル(&S) &Point size - + サイズ(&P) @@ -283,38 +284,39 @@ Help - + ヘルプ OK - + OK <title>Error 404...</title><div align="center"><br><br><h1>The page could not be found</h1><br><h3>'%1'</h3></div> - + <title>Error 404...</title><div align="center"><br><br><h1>ページãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸ</h1><br><h3>'%1'</h3></div> Copy &Link Location - + リンクã®URLをコピー(&L) Open Link in New Tab Ctrl+LMB - + リンクを新ã—ã„タブã§é–‹ã Ctrl+LMB Open Link in New Tab - + リンクを新ã—ã„タブã§é–‹ã Unable to launch external application. - + 外部アプリケーションを起動ã§ãã¾ã›ã‚“。 + @@ -322,17 +324,17 @@ &Look for: - + 検索文字列(&L): Open Link - + リンクを開ã Open Link in New Tab - + リンクを新ã—ã„タブã§é–‹ã @@ -341,97 +343,98 @@ Install Documentation - + ドキュメントã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ« Downloading documentation info... - + ドキュメント情報をダウンロード中... Download canceled. - + ダウンロードを中止ã—ã¾ã—ãŸã€‚ Done. - + 完了. The file %1 already exists. Do you want to overwrite it? - + %1 ã¯æ—¢ã«å­˜åœ¨ã—ã¾ã™ã€‚上書ãã—ã¾ã™ã‹? Unable to save the file %1: %2. - + ファイルをä¿å­˜ã§ãã¾ã›ã‚“。%1: %2. Downloading %1... - + %1 をダウンロード中... Download failed: %1. - + ダウンロード失敗: %1. Documentation info file is corrupt! - + ドキュメント情報ファイルãŒä¸æ­£ã§ã™! Download failed: Downloaded file is corrupted. - + ダウンロード失敗: ダウンロードã—ãŸãƒ•ァイルãŒä¸æ­£ã§ã™ã€‚ Installing documentation %1... - + %1 ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’インストール中... Error while installing documentation: %1 - + ドキュメントã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: +%1 Available Documentation: - + 使用å¯èƒ½ãªãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆ: Install - + インストール Cancel - + キャンセル Close - + é–‰ã˜ã‚‹ Installation Path: - + インストール先ã®ãƒ‘ス: ... - + ... @@ -440,298 +443,298 @@ Index - + インデックス Contents - + コンテンツ Bookmarks - + ブックマーク Search - + 検索 Qt Assistant - + Qt Assistant Unfiltered - + フィルタãªã— Page Set&up... - + ページ設定(&U)... Print Preview... - + å°åˆ·ãƒ—レビュー... &Print... - + å°åˆ·(&P)... New &Tab - + æ–°ã—ã„タブ(&T) &Close Tab - + タブを閉ã˜ã‚‹(&C) &Quit - + 終了(&Q) CTRL+Q - + CTRL+Q &Copy selected Text - + é¸æŠžä¸­ã®æ–‡å­—をコピー(&C) &Find in Text... - + 検索(&F)... Find &Next - + 次を検索(&N) Find &Previous - + å‰ã‚’検索(&P) Preferences... - + 設定... Zoom &in - + 拡大(&I) Zoom &out - + 縮å°(&O) Normal &Size - + 普通ã®å¤§ãã•(&S) Ctrl+0 - + Ctrl+0 ALT+C - + ALT+C ALT+I - + ALT+I ALT+S - + ALT+S &Home - + ホーム(&H) Ctrl+Home - + Ctrl+Home &Back - + 戻る(&B) &Forward - + 進む(&F) Sync with Table of Contents - + 内容ã¨ç›®æ¬¡ã‚’åŒæœŸã™ã‚‹ Next Page - + 次ã®ãƒšãƒ¼ã‚¸ Ctrl+Alt+Right - + Ctrl+Alt+Right Previous Page - + å‰ã®ãƒšãƒ¼ã‚¸ Ctrl+Alt+Left - + Ctrl+Alt+Left Add Bookmark... - + ブックマークã®è¿½åŠ ... About... - + Qt Assistant ã«ã¤ã„ã¦... Navigation Toolbar - + ナビゲーション ツールãƒãƒ¼ Toolbars - + ツールãƒãƒ¼ Filter Toolbar - + フィルター ツールãƒãƒ¼ Filtered by: - + フィルタæ¡ä»¶: Address Toolbar - + アドレス ツールãƒãƒ¼ Address: - + アドレス: Could not find the associated content item. - + 関連付ã„ãŸå†…容ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“。 About %1 - + %1 ã«ã¤ã„㦠Updating search index - + 検索インデックスを更新中 Looking for Qt Documentation... - + Qt ドキュメントを探ã—ã¦ã„ã¾ã™... &Window - + ウィンドウ(&W) Minimize - + 最å°åŒ– Ctrl+M - + Ctrl+M Zoom - + ズーム &File - + ファイル(&F) &Edit - + 編集(&E) &View - + 表示(&V) &Go - + ジャンプ(&G) &Bookmarks - + ブックマーク(&B) &Help - + ヘルプ(&H) ALT+O - + ALT+O CTRL+D - + CTRL+D @@ -741,47 +744,47 @@ Add Documentation - + ドキュメントã®è¿½åŠ  Qt Compressed Help Files (*.qch) - + 圧縮済㿠Qt ヘルプファイル (*.qch) The specified file is not a valid Qt Help File! - + 指定ã•れãŸãƒ•ã‚¡ã‚¤ãƒ«ã¯æœ‰åŠ¹ãª Qt ヘルプ ファイルã§ã¯ã‚りã¾ã›ã‚“! The namespace %1 is already registered! - + ãƒãƒ¼ãƒ ã‚¹ãƒšãƒ¼ã‚¹ %1 ã¯æ—¢ã«ç™»éŒ²æ¸ˆã¿ã§ã™! Remove Documentation - + ドキュメントã®é™¤åŽ» Some documents currently opened in Assistant reference the documentation you are attempting to remove. Removing the documentation will close those documents. - + 除去ã—よã†ã¨ã—ã¦ã„ã‚‹ã„ãã¤ã‹ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯ Assistant 上ã§å‚ç…§ã•れã¦ã„ã¾ã™ã€‚除去ã™ã‚‹ã¨ã€ã“れらã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã¯é–‰ã˜ã‚‰ã‚Œã¾ã™ã€‚ Cancel - + キャンセル OK - + OK Use custom settings - + 独自設定を使用ã™ã‚‹ @@ -789,92 +792,92 @@ Preferences - + 設定 Fonts - + フォント Font settings: - + フォント設定: Browser - + ブラウザー Application - + アプリケーション Filters - + フィルタ Filter: - + フィルタ: Attributes: - + 属性: 1 - + 1 Add - + 追加 Remove - + 削除 Documentation - + ドキュメント Registered Documentation: - + 登録済ã¿ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆ: Add... - + 追加... Options - + オプション Current Page - + ç¾åœ¨ã®ãƒšãƒ¼ã‚¸ Restore to default - + ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆè¨­å®šã«æˆ»ã™ Homepage - + ホームページ @@ -882,64 +885,64 @@ The specified collection file does not exist! - + 指定ã•れãŸã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ãƒ•ァイルã¯å­˜åœ¨ã—ã¾ã›ã‚“! Missing collection file! - + コレクションファイルãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“! Invalid URL! - + 䏿­£ãªURLã§ã™! Missing URL! - + URLãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“! Unknown widget: %1 - + 䏿˜Žãªã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆ: %1 Missing widget! - + ウィジェットãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“! The specified Qt help file does not exist! - + 指定ã•れ㟠Qt ヘルプ ファイルãŒå­˜åœ¨ã—ã¾ã›ã‚“! Missing help file! - + ヘルプファイルãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“! Missing filter argument! - + フィルタ引数ãŒä¸è¶³ã—ã¦ã„ã¾ã™! Unknown option: %1 - + 䏿˜Žãªã‚ªãƒ—ション: %1 Qt Assistant - + Qt Assistant @@ -948,12 +951,16 @@ Reason: %2 - + ドキュメントファイルを登録ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ +%1 + +原因: +%2 Documentation successfully registered. - + ドキュメントã®ç™»éŒ²ã«æˆåŠŸã—ã¾ã—ãŸã€‚ @@ -962,28 +969,32 @@ Reason: Reason: %2 - + ドキュメントファイルを解除ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ +%1 + +原因: +%2 Documentation successfully unregistered. - + ドキュメントã®è§£æ”¾ã«æˆåŠŸã—ã¾ã—ãŸã€‚ Cannot load sqlite database driver! - + SQLite データベース ドライãƒãƒ¼ã‚’ロードã§ãã¾ã›ã‚“! The specified collection file could not be read! - + 指定ã•れãŸã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ãƒ•ァイルã¯èª­ã¿è¾¼ã‚ã¾ã›ã‚“! Bookmark - + ブックマーク @@ -991,12 +1002,12 @@ Reason: Debugging Remote Control - + リモート コントロールをデãƒãƒƒã‚°ä¸­ Received Command: %1 %2 - + å—ä¿¡ã—ãŸã‚³ãƒžãƒ³ãƒ‰: %1 %2 @@ -1004,28 +1015,28 @@ Reason: &Copy - + コピー(&C) Copy &Link Location - + リンクã®URLをコピー(&L) Open Link in New Tab - + リンクを新ã—ã„タブã§é–‹ã Select All - + ã™ã¹ã¦ã‚’é¸æŠž Open Link - + リンクを開ã @@ -1033,27 +1044,27 @@ Reason: Choose a topic for <b>%1</b>: - + <b>%1</b> ã®æ¤œç´¢å…ˆãƒˆãƒ”ãƒƒã‚¯ã‚’é¸æŠžã—ã¦ãã ã•ã„: Choose Topic - + ãƒˆãƒ”ãƒƒã‚¯ã‚’é¸æŠž &Topics - + トピック(&T) &Display - + 表示(&D) &Close - + é–‰ã˜ã‚‹(&C) -- cgit v0.12 From 3cc966afd45ac727126ea89bafa7c1aa1295226b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 May 2009 11:07:36 +0200 Subject: less inefficient --- qmake/project.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 00bb2f0..8ae0fe2 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -2412,7 +2412,7 @@ QMakeProject::doProjectTest(QString func, QList args_list, QMap rhs_int; return lhs_int < rhs_int; } -- cgit v0.12 From dc2cc1e853a3dd98646a4619903ad2086d0fe62d Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 18 May 2009 11:11:48 +0200 Subject: Introduced qualified type names in the grammar. --- src/declarative/qml/parser/javascript.g | 91 +- src/declarative/qml/parser/javascriptast.cpp | 2 + src/declarative/qml/parser/javascriptast_p.h | 23 +- src/declarative/qml/parser/javascriptgrammar.cpp | 1235 +++++++++++----------- src/declarative/qml/parser/javascriptgrammar_p.h | 14 +- src/declarative/qml/parser/javascriptparser.cpp | 450 ++++---- src/declarative/qml/parser/javascriptparser_p.h | 6 +- src/declarative/qml/qmlscriptparser.cpp | 64 +- 8 files changed, 989 insertions(+), 896 deletions(-) diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g index af4fb74..7622421 100644 --- a/src/declarative/qml/parser/javascript.g +++ b/src/declarative/qml/parser/javascript.g @@ -305,6 +305,8 @@ protected: inline AST::SourceLocation &loc(int index) { return location_stack [tos + index - 1]; } + AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr); + protected: Engine *driver; int tos; @@ -344,6 +346,7 @@ protected: /. #include "javascriptparser_p.h" +#include // // This file is automatically generated from javascript.g. @@ -405,6 +408,34 @@ static inline AST::SourceLocation location(Lexer *lexer) return loc; } +AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) +{ + QVarLengthArray nameIds; + QVarLengthArray locations; + + AST::ExpressionNode *it = expr; + while (AST::FieldMemberExpression *m = AST::cast(it)) { + nameIds.append(m->name); + locations.append(m->identifierToken); + it = m->base; + } + + if (AST::IdentifierExpression *idExpr = AST::cast(it)) { + AST::UiQualifiedId *q = makeAstNode(driver->nodePool(), idExpr->name); + q->identifierToken = idExpr->identifierToken; + + AST::UiQualifiedId *currentId = q; + for (int i = nameIds.size() - 1; i != -1; --i) { + currentId = makeAstNode(driver->nodePool(), currentId, nameIds[i]); + currentId->identifierToken = locations[i]; + } + + return currentId->finish(); + } + + return 0; +} + bool Parser::parse() { Lexer *lexer = driver->lexer(); @@ -570,23 +601,11 @@ case $rule_number: { } break; ./ -UiObjectMember: UiQualifiedId T_COLON T_IDENTIFIER UiObjectInitializer ; +UiObjectDefinition: UiQualifiedId UiObjectInitializer ; /. case $rule_number: { - AST::UiObjectBinding *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId->finish(), - sym(3).sval, sym(4).UiObjectInitializer); - node->colonToken = loc(2); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; -./ - -UiObjectDefinition: T_IDENTIFIER UiObjectInitializer ; -/. -case $rule_number: { - AST::UiObjectDefinition *node = makeAstNode (driver->nodePool(), sym(1).sval, + AST::UiObjectDefinition *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId->finish(), sym(2).UiObjectInitializer); - node->identifierToken = loc(1); sym(1).Node = node; } break; ./ @@ -625,17 +644,45 @@ case $rule_number: { ./ -UiStatement: Block ; -UiStatement: EmptyStatement ; -UiStatement: ExpressionStatement ; -UiStatement: DebuggerStatement ; -UiStatement: UiMultilineStringStatement ; -UiStatement: IfStatement ; --- ### do we really want if statement in a binding? +UiObjectMember: UiQualifiedId T_COLON Expression UiObjectInitializer ; +/. +case $rule_number: { + if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(3).Expression)) { + AST::UiObjectBinding *node = makeAstNode (driver->nodePool(), + sym(1).UiQualifiedId->finish(), qualifiedId, sym(4).UiObjectInitializer); + node->colonToken = loc(2); + sym(1).Node = node; + } else { + sym(1).Node = 0; + diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(2), + "Expected a type name after token `:'")); + + return false; // ### recover + } +} break; +./ + +UiObjectMember: UiQualifiedId T_COLON Block ; +/.case $rule_number:./ + +UiObjectMember: UiQualifiedId T_COLON EmptyStatement ; +/.case $rule_number:./ + +UiObjectMember: UiQualifiedId T_COLON ExpressionStatement ; +/.case $rule_number:./ + +UiObjectMember: UiQualifiedId T_COLON DebuggerStatement ; +/.case $rule_number:./ + +UiObjectMember: UiQualifiedId T_COLON UiMultilineStringStatement ; +/.case $rule_number:./ + +UiObjectMember: UiQualifiedId T_COLON IfStatement ; --- ### do we really want if statement in a binding? +/.case $rule_number:./ -UiObjectMember: UiQualifiedId T_COLON UiStatement ; /. -case $rule_number: { +{ AST::UiScriptBinding *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId->finish(), sym(3).Statement); node->colonToken = loc(2); diff --git a/src/declarative/qml/parser/javascriptast.cpp b/src/declarative/qml/parser/javascriptast.cpp index 8a10650..de06503 100644 --- a/src/declarative/qml/parser/javascriptast.cpp +++ b/src/declarative/qml/parser/javascriptast.cpp @@ -813,6 +813,7 @@ void UiPublicMember::accept0(Visitor *visitor) void UiObjectDefinition::accept0(Visitor *visitor) { if (visitor->visit(this)) { + acceptChild(qualifiedObjectNameId, visitor); acceptChild(initializer, visitor); } @@ -833,6 +834,7 @@ void UiObjectBinding::accept0(Visitor *visitor) { if (visitor->visit(this)) { acceptChild(qualifiedId, visitor); + acceptChild(qualifiedObjectNameId, visitor); acceptChild(initializer, visitor); } diff --git a/src/declarative/qml/parser/javascriptast_p.h b/src/declarative/qml/parser/javascriptast_p.h index 571fdff..e446e89 100644 --- a/src/declarative/qml/parser/javascriptast_p.h +++ b/src/declarative/qml/parser/javascriptast_p.h @@ -2345,28 +2345,22 @@ class UiObjectDefinition: public UiObjectMember public: JAVASCRIPT_DECLARE_AST_NODE(UiObjectDefinition) - UiObjectDefinition(NameId *name, + UiObjectDefinition(UiQualifiedId *qualifiedObjectNameId, UiObjectInitializer *initializer) - : name(name), initializer(initializer) + : qualifiedObjectNameId(qualifiedObjectNameId), initializer(initializer) { kind = K; } virtual SourceLocation firstSourceLocation() const - { return identifierToken; } + { return qualifiedObjectNameId->identifierToken; } virtual SourceLocation lastSourceLocation() const - { - if (initializer) - return initializer->rbraceToken; - - return identifierToken; - } + { return initializer->rbraceToken; } virtual void accept0(Visitor *visitor); // attributes - NameId *name; + UiQualifiedId *qualifiedObjectNameId; UiObjectInitializer *initializer; - SourceLocation identifierToken; }; class UiSourceElement: public UiObjectMember @@ -2411,10 +2405,10 @@ public: JAVASCRIPT_DECLARE_AST_NODE(UiObjectBinding) UiObjectBinding(UiQualifiedId *qualifiedId, - NameId *name, + UiQualifiedId *qualifiedObjectNameId, UiObjectInitializer *initializer) : qualifiedId(qualifiedId), - name(name), + qualifiedObjectNameId(qualifiedObjectNameId), initializer(initializer) { kind = K; } @@ -2428,10 +2422,9 @@ public: // attributes UiQualifiedId *qualifiedId; - NameId *name; + UiQualifiedId *qualifiedObjectNameId; UiObjectInitializer *initializer; SourceLocation colonToken; - SourceLocation identifierToken; }; class UiScriptBinding: public UiObjectMember diff --git a/src/declarative/qml/parser/javascriptgrammar.cpp b/src/declarative/qml/parser/javascriptgrammar.cpp index 2d50da8..db34464 100644 --- a/src/declarative/qml/parser/javascriptgrammar.cpp +++ b/src/declarative/qml/parser/javascriptgrammar.cpp @@ -56,558 +56,566 @@ const char *const JavaScriptGrammar::spell [] = { const int JavaScriptGrammar::lhs [] = { 91, 92, 92, 95, 95, 96, 96, 94, 93, 98, - 98, 100, 100, 101, 101, 99, 97, 99, 99, 103, - 104, 104, 105, 105, 105, 105, 105, 105, 99, 111, - 111, 111, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 102, 102, 115, 115, 115, 102, 102, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 118, 118, 122, 122, 117, - 117, 120, 120, 123, 123, 123, 123, 123, 123, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 125, 125, 126, 126, 126, 126, 126, 129, 129, 130, - 130, 130, 130, 128, 128, 131, 131, 132, 132, 133, - 133, 133, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 135, 135, 135, 135, 136, 136, 136, 137, - 137, 137, 137, 138, 138, 138, 138, 138, 138, 138, - 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, - 140, 141, 141, 141, 141, 141, 142, 142, 143, 143, - 144, 144, 145, 145, 146, 146, 147, 147, 148, 148, - 149, 149, 150, 150, 151, 151, 152, 152, 153, 153, - 121, 121, 154, 154, 155, 155, 155, 155, 155, 155, - 155, 155, 155, 155, 155, 155, 112, 112, 156, 156, - 157, 157, 158, 158, 159, 159, 159, 159, 159, 159, - 159, 159, 159, 159, 159, 159, 159, 159, 159, 106, - 170, 170, 169, 169, 114, 114, 171, 171, 172, 172, - 174, 174, 173, 175, 178, 176, 176, 179, 177, 177, - 107, 108, 108, 110, 110, 160, 160, 160, 160, 160, - 160, 160, 161, 161, 161, 161, 162, 162, 162, 162, - 163, 163, 164, 166, 180, 180, 183, 183, 181, 181, - 184, 182, 165, 165, 165, 167, 167, 168, 168, 168, - 185, 186, 109, 109, 113, 127, 190, 190, 187, 187, - 188, 188, 191, 192, 192, 193, 193, 189, 189, 119, - 119, 194}; + 98, 100, 100, 101, 101, 97, 99, 99, 103, 104, + 104, 99, 99, 99, 99, 99, 99, 99, 111, 111, + 111, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 102, 102, 114, 114, 114, 102, 102, 115, + 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, + 115, 115, 115, 115, 117, 117, 121, 121, 116, 116, + 119, 119, 122, 122, 122, 122, 122, 122, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 123, 123, 124, + 124, 125, 125, 125, 125, 125, 128, 128, 129, 129, + 129, 129, 127, 127, 130, 130, 131, 131, 132, 132, + 132, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 134, 134, 134, 134, 135, 135, 135, 136, 136, + 136, 136, 137, 137, 137, 137, 137, 137, 137, 138, + 138, 138, 138, 138, 138, 139, 139, 139, 139, 139, + 140, 140, 140, 140, 140, 141, 141, 142, 142, 143, + 143, 144, 144, 145, 145, 146, 146, 147, 147, 148, + 148, 149, 149, 150, 150, 151, 151, 152, 152, 120, + 120, 153, 153, 154, 154, 154, 154, 154, 154, 154, + 154, 154, 154, 154, 154, 105, 105, 155, 155, 156, + 156, 157, 157, 158, 158, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 158, 106, 169, + 169, 168, 168, 113, 113, 170, 170, 171, 171, 173, + 173, 172, 174, 177, 175, 175, 178, 176, 176, 107, + 108, 108, 110, 110, 159, 159, 159, 159, 159, 159, + 159, 160, 160, 160, 160, 161, 161, 161, 161, 162, + 162, 163, 165, 179, 179, 182, 182, 180, 180, 183, + 181, 164, 164, 164, 166, 166, 167, 167, 167, 184, + 185, 109, 109, 112, 126, 189, 189, 186, 186, 187, + 187, 190, 191, 191, 192, 192, 188, 188, 118, 118, + 193}; const int JavaScriptGrammar:: rhs[] = { 2, 1, 1, 1, 2, 3, 3, 0, 1, 1, - 2, 1, 3, 2, 3, 4, 2, 1, 5, 1, - 2, 2, 1, 1, 1, 1, 1, 1, 3, 1, - 1, 1, 2, 4, 4, 5, 5, 6, 6, 7, - 7, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 3, 5, 3, 4, 3, 2, 4, 1, 2, 0, - 1, 3, 5, 1, 1, 1, 1, 1, 1, 1, + 2, 1, 3, 2, 3, 2, 1, 5, 1, 2, + 2, 4, 3, 3, 3, 3, 3, 3, 1, 1, + 1, 2, 4, 4, 5, 5, 6, 6, 7, 7, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, + 5, 3, 4, 3, 2, 4, 1, 2, 0, 1, + 3, 5, 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, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 4, 3, 5, 1, 2, 4, - 4, 4, 3, 0, 1, 1, 3, 1, 1, 1, - 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 1, 3, 3, 3, 1, 3, 3, 1, - 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, - 1, 3, 3, 3, 3, 3, 1, 3, 3, 3, - 3, 1, 3, 3, 3, 3, 1, 3, 1, 3, - 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, - 1, 3, 1, 3, 1, 3, 1, 5, 1, 5, - 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 0, 1, - 1, 3, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 1, 2, 0, 1, 3, 3, 1, 1, 1, 3, - 1, 3, 2, 2, 2, 0, 1, 2, 0, 1, - 1, 2, 2, 7, 5, 7, 7, 5, 9, 10, - 7, 8, 2, 2, 3, 3, 2, 2, 3, 3, - 3, 3, 5, 5, 3, 5, 1, 2, 0, 1, - 4, 3, 3, 3, 3, 3, 3, 3, 3, 4, - 5, 2, 2, 2, 8, 8, 1, 3, 0, 1, - 0, 1, 1, 1, 2, 1, 1, 0, 1, 0, - 1, 2}; + 1, 1, 1, 4, 3, 5, 1, 2, 4, 4, + 4, 3, 0, 1, 1, 3, 1, 1, 1, 2, + 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 3, 3, 3, 1, 3, 3, 1, 3, + 3, 3, 1, 3, 3, 3, 3, 3, 3, 1, + 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, + 1, 3, 3, 3, 3, 1, 3, 1, 3, 1, + 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, + 3, 1, 3, 1, 3, 1, 5, 1, 5, 1, + 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 3, 0, 1, 1, + 3, 0, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 2, 0, 1, 3, 3, 1, 1, 1, 3, 1, + 3, 2, 2, 2, 0, 1, 2, 0, 1, 1, + 2, 2, 7, 5, 7, 7, 5, 9, 10, 7, + 8, 2, 2, 3, 3, 2, 2, 3, 3, 3, + 3, 5, 5, 3, 5, 1, 2, 0, 1, 4, + 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, + 2, 2, 2, 8, 8, 1, 3, 0, 1, 0, + 1, 1, 1, 2, 1, 1, 0, 1, 0, 1, + 2}; const int JavaScriptGrammar::action_default [] = { 8, 2, 0, 4, 3, 0, 0, 0, 6, 7, - 5, 0, 9, 1, 0, 17, 42, 49, 247, 0, - 0, 46, 47, 14, 44, 45, 48, 248, 18, 10, - 0, 0, 0, 43, 0, 32, 31, 30, 0, 0, - 36, 0, 37, 150, 217, 181, 189, 185, 129, 201, - 177, 0, 114, 52, 130, 193, 197, 118, 147, 128, - 133, 113, 167, 154, 0, 58, 59, 55, 318, 46, - 320, 70, 0, 0, 0, 0, 0, 53, 56, 0, - 0, 47, 48, 57, 51, 0, 54, 0, 0, 143, - 0, 0, 130, 149, 132, 131, 0, 0, 0, 145, - 146, 144, 148, 0, 178, 0, 0, 0, 0, 168, - 0, 0, 0, 0, 0, 0, 158, 0, 0, 0, - 152, 153, 151, 156, 160, 159, 157, 155, 170, 169, - 171, 0, 186, 0, 182, 0, 0, 124, 111, 123, - 112, 80, 81, 82, 107, 83, 108, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 109, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 110, 0, 0, 122, 218, 125, 0, 126, 0, - 127, 121, 40, 41, 0, 214, 207, 205, 212, 213, - 211, 210, 216, 209, 208, 206, 215, 202, 0, 190, - 0, 0, 194, 0, 0, 198, 0, 0, 124, 116, - 0, 115, 0, 120, 134, 0, 319, 309, 310, 0, - 307, 0, 308, 0, 311, 225, 232, 231, 239, 227, - 0, 228, 312, 0, 317, 229, 230, 235, 233, 314, - 313, 316, 236, 0, 0, 0, 0, 0, 318, 46, - 0, 320, 47, 219, 261, 48, 0, 0, 0, 0, - 0, 237, 238, 226, 234, 262, 263, 306, 315, 0, - 277, 278, 279, 280, 0, 273, 274, 275, 276, 303, - 304, 0, 0, 0, 0, 0, 266, 267, 223, 221, - 183, 191, 187, 203, 179, 224, 0, 130, 195, 199, - 172, 161, 0, 0, 180, 0, 0, 0, 0, 173, - 0, 0, 0, 0, 0, 165, 163, 166, 164, 162, - 175, 174, 176, 0, 188, 0, 184, 0, 222, 130, - 0, 204, 219, 220, 0, 219, 0, 0, 269, 0, - 0, 0, 271, 0, 192, 0, 0, 196, 0, 0, - 200, 259, 0, 251, 260, 254, 0, 258, 0, 219, - 252, 0, 219, 0, 0, 270, 0, 0, 0, 272, - 319, 309, 0, 0, 311, 0, 305, 0, 295, 0, - 0, 0, 265, 0, 264, 0, 321, 0, 79, 241, - 244, 0, 80, 247, 83, 108, 85, 86, 55, 90, - 91, 46, 92, 95, 53, 56, 47, 219, 48, 57, - 98, 51, 100, 54, 102, 103, 248, 105, 106, 110, - 0, 72, 0, 0, 74, 78, 76, 64, 75, 77, - 0, 73, 63, 242, 240, 118, 119, 124, 0, 117, - 0, 294, 0, 281, 282, 0, 293, 0, 0, 0, - 284, 289, 287, 290, 0, 0, 288, 289, 0, 285, - 0, 286, 243, 292, 0, 243, 291, 0, 296, 297, - 0, 243, 298, 299, 0, 0, 300, 0, 0, 0, - 301, 302, 136, 135, 0, 0, 0, 268, 0, 0, - 0, 283, 0, 71, 0, 68, 70, 61, 0, 67, - 62, 69, 66, 60, 0, 65, 140, 138, 142, 139, - 137, 141, 0, 0, 0, 34, 0, 35, 0, 38, - 39, 33, 15, 11, 0, 0, 23, 26, 24, 25, - 28, 46, 70, 20, 0, 27, 29, 16, 0, 12, - 0, 19, 13, 21, 22, 50, 256, 249, 0, 257, - 253, 0, 255, 245, 0, 246, 250, 322}; + 5, 48, 45, 46, 43, 44, 47, 9, 0, 1, + 0, 0, 16, 49, 41, 246, 0, 0, 46, 14, + 47, 247, 17, 10, 0, 0, 0, 42, 0, 31, + 30, 29, 0, 0, 35, 0, 36, 149, 216, 180, + 188, 184, 128, 200, 176, 0, 113, 51, 129, 192, + 196, 117, 146, 127, 132, 112, 166, 153, 0, 57, + 58, 54, 317, 319, 69, 0, 0, 0, 0, 0, + 52, 55, 0, 0, 56, 50, 0, 53, 0, 0, + 142, 0, 0, 129, 148, 131, 130, 0, 0, 0, + 144, 145, 143, 147, 0, 177, 0, 0, 0, 0, + 167, 0, 0, 0, 0, 0, 0, 157, 0, 0, + 0, 151, 152, 150, 155, 159, 158, 156, 154, 169, + 168, 170, 0, 185, 0, 181, 0, 0, 123, 110, + 122, 111, 79, 80, 81, 106, 82, 107, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 108, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 109, 0, 0, 121, 217, 124, 0, 125, + 0, 126, 120, 39, 40, 0, 213, 206, 204, 211, + 212, 210, 209, 215, 208, 207, 205, 214, 201, 0, + 189, 0, 0, 193, 0, 0, 197, 0, 0, 123, + 115, 0, 114, 0, 119, 133, 0, 318, 308, 309, + 0, 306, 0, 307, 0, 310, 224, 231, 230, 238, + 226, 0, 227, 311, 0, 316, 228, 229, 234, 232, + 313, 312, 315, 235, 0, 0, 0, 0, 0, 317, + 45, 0, 319, 46, 218, 260, 47, 0, 0, 0, + 0, 0, 236, 237, 225, 233, 261, 262, 305, 314, + 0, 276, 277, 278, 279, 0, 272, 273, 274, 275, + 302, 303, 0, 0, 0, 0, 0, 265, 266, 222, + 220, 182, 190, 186, 202, 178, 223, 0, 129, 194, + 198, 171, 160, 0, 0, 179, 0, 0, 0, 0, + 172, 0, 0, 0, 0, 0, 164, 162, 165, 163, + 161, 174, 173, 175, 0, 187, 0, 183, 0, 221, + 129, 0, 203, 218, 219, 0, 218, 0, 0, 268, + 0, 0, 0, 270, 0, 191, 0, 0, 195, 0, + 0, 199, 258, 0, 250, 259, 253, 0, 257, 0, + 218, 251, 0, 218, 0, 0, 269, 0, 0, 0, + 271, 318, 308, 0, 0, 310, 0, 304, 0, 294, + 0, 0, 0, 264, 0, 263, 0, 320, 0, 78, + 240, 243, 0, 79, 246, 82, 107, 84, 85, 54, + 89, 90, 45, 91, 94, 52, 55, 46, 218, 47, + 56, 97, 50, 99, 53, 101, 102, 247, 104, 105, + 109, 0, 71, 0, 0, 73, 77, 75, 63, 74, + 76, 0, 72, 62, 241, 239, 117, 118, 123, 0, + 116, 0, 293, 0, 280, 281, 0, 292, 0, 0, + 0, 283, 288, 286, 289, 0, 0, 287, 288, 0, + 284, 0, 285, 242, 291, 0, 242, 290, 0, 295, + 296, 0, 242, 297, 298, 0, 0, 299, 0, 0, + 0, 300, 301, 135, 134, 0, 0, 0, 267, 0, + 0, 0, 282, 0, 70, 0, 67, 69, 60, 0, + 66, 61, 68, 65, 59, 0, 64, 139, 137, 141, + 138, 136, 140, 0, 0, 0, 33, 0, 34, 0, + 37, 38, 32, 15, 11, 0, 23, 26, 24, 0, + 25, 28, 242, 69, 19, 0, 27, 22, 79, 246, + 82, 107, 84, 85, 54, 89, 90, 45, 91, 94, + 52, 55, 46, 218, 47, 56, 97, 50, 99, 53, + 101, 102, 247, 104, 105, 109, 0, 12, 0, 18, + 13, 20, 21, 255, 248, 0, 256, 252, 0, 254, + 244, 0, 245, 249, 321}; const int JavaScriptGrammar::goto_default [] = { - 6, 5, 13, 1, 4, 3, 28, 30, 29, 538, - 15, 31, 534, 535, 536, 225, 229, 231, 228, 235, - 513, 230, 234, 263, 53, 61, 494, 492, 387, 386, - 44, 493, 385, 388, 139, 57, 52, 177, 59, 48, - 176, 54, 60, 89, 58, 43, 63, 62, 300, 50, - 294, 45, 290, 47, 292, 46, 291, 55, 298, 56, - 299, 49, 293, 289, 330, 442, 295, 296, 389, 236, - 227, 226, 238, 264, 237, 242, 261, 262, 391, 390, - 32, 548, 547, 352, 353, 550, 355, 549, 354, 450, - 454, 457, 453, 452, 472, 473, 219, 233, 215, 218, - 232, 240, 239, 0}; + 6, 5, 19, 1, 4, 3, 32, 34, 33, 566, + 22, 18, 535, 536, 231, 226, 230, 232, 229, 236, + 514, 235, 264, 57, 65, 495, 493, 388, 387, 48, + 494, 386, 389, 140, 61, 56, 178, 63, 52, 177, + 58, 64, 90, 62, 47, 67, 66, 301, 54, 295, + 49, 291, 51, 293, 50, 292, 59, 299, 60, 300, + 53, 294, 290, 331, 443, 296, 297, 390, 237, 228, + 227, 239, 265, 238, 243, 262, 263, 392, 391, 36, + 575, 574, 353, 354, 577, 356, 576, 355, 451, 455, + 458, 454, 453, 473, 474, 220, 234, 216, 219, 233, + 241, 240, 0}; const int JavaScriptGrammar::action_index [] = { - 60, -91, -21, -91, -47, 22, 43, 76, -91, -91, - -91, 20, -91, -91, 394, -91, -91, -91, -91, -31, - 199, 6, 185, -91, -91, -91, 11, -91, -91, -91, - 381, 157, 180, -91, 182, -91, -91, -91, 19, 183, - -91, 697, -91, 66, -91, 54, 32, -19, 174, -91, - 257, 211, -91, -91, 538, 63, 69, 248, 170, -91, - -91, -91, 345, 154, 697, -91, -91, -91, 158, -91, - 1275, 55, 697, 697, 697, 617, 697, -91, -91, 697, - 697, -91, -91, -91, -91, 697, -91, 697, 697, -91, - 697, 697, 100, 217, -91, -91, 697, 697, 697, -91, - -91, -91, 131, 697, 267, 697, 697, 697, 697, 355, - 697, 697, 697, 697, 697, 697, 188, 697, 697, 697, - 101, 118, 105, 314, 224, 210, 205, 153, 450, 365, - 450, 697, -8, 697, 172, 1188, 697, 697, -91, -91, + 7, -91, 35, -91, 7, 304, 96, 111, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, 120, -91, + 136, 417, -91, -91, -91, -91, 64, 161, 160, -91, + 73, -91, -91, -91, 385, 262, 259, -91, 229, -91, + -91, -91, 65, 237, -91, 721, -91, 115, -91, 79, + 41, 3, 338, -91, 303, 228, -91, -91, 562, 68, + 77, 260, 243, -91, -91, -91, 400, 158, 721, -91, + -91, -91, 159, 1299, 93, 721, 721, 721, 515, 721, + -91, -91, 721, 721, -91, -91, 721, -91, 721, 721, + -91, 721, 721, 110, 150, -91, -91, 721, 721, 721, + -91, -91, -91, 175, 721, 310, 721, 721, 721, 721, + 474, 721, 721, 721, 721, 721, 721, 179, 721, 721, + 721, 70, 74, 78, 246, 253, 249, 241, 227, 474, + 474, 474, 721, 61, 721, 178, 1212, 721, 721, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, 103, 697, -91, -91, 42, -22, -91, 697, - -91, -91, -91, -91, 697, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, 697, 25, - 697, 697, -2, 82, 697, -91, 1188, 697, 697, -91, - 119, -91, 44, -91, -91, -9, -91, 132, 73, 50, - -91, 134, -91, 62, 1449, -91, -91, -91, -91, -91, - 122, -91, -91, 37, -91, -91, -91, -91, -91, -91, - 1449, -91, -91, 298, 300, 109, 1536, 41, 194, 75, - 47, 1623, 68, 697, -91, 65, 49, 697, 45, 40, - 38, -91, -91, -91, -91, -91, -91, -91, -91, 72, - -91, -91, -91, -91, 115, -91, -91, -91, -91, -91, - -91, 56, 58, 697, 95, 67, -91, -91, 1021, -91, - 86, 59, -12, -91, 259, 61, 39, 467, 77, 70, - 382, 314, 223, 697, 276, 697, 697, 697, 697, 274, - 697, 697, 697, 697, 697, 314, 314, 314, 168, 314, - 382, 291, 301, 697, -20, 697, 17, 697, -91, 538, - 697, -91, 697, 12, -37, 697, -39, 1536, -91, 697, - 106, 1536, -91, 697, -25, 697, 697, 15, 8, 697, - -91, 2, 113, -15, -91, -91, 697, -91, 225, 697, - -91, -36, 697, -38, 1536, -91, 697, 80, 1536, -91, - -7, 202, -23, 3, 1449, -42, -91, 1536, -91, 697, - 97, 1536, 14, 1536, -91, 21, 18, 36, -91, -91, - 1536, -24, 288, 7, 281, 74, 697, 1536, -5, -32, - 264, -4, -26, 617, 0, -1, -91, 781, -91, 5, - -27, 1, 697, 4, -28, 697, -6, 697, -3, 9, - 697, -91, 1362, 53, -91, -91, -91, -91, -91, -91, - 697, -91, -91, -91, -91, 171, -91, 697, 24, -91, - 1536, -91, 64, -91, -91, 1536, -91, 697, 91, 28, - -91, 51, -91, 52, 99, 697, -91, 27, 57, -91, - 31, -91, 1536, -91, 94, 1536, -91, 226, -91, -91, - 102, 1536, 48, -91, 35, 34, -91, 175, 33, 29, - -91, -91, -91, -91, 697, 90, 1536, -91, 697, 89, - 1536, -91, 88, 46, 941, -91, 26, -91, 861, -91, - -91, -91, -91, -91, 107, -91, -91, -91, -91, -91, - -91, -91, 10, 13, 155, -91, 697, -91, 177, -91, - -91, -91, -91, -91, 1101, 191, -91, -91, -91, -91, - -91, 16, 110, -91, 85, -91, -91, -91, 104, -91, - 23, -91, -91, -91, -91, -91, 30, -91, 160, -91, - -91, 697, -91, -91, 136, -91, -91, -91, + -91, -91, -91, 104, 721, -91, -91, 84, 56, -91, + 721, -91, -91, -91, -91, 721, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, 721, + 69, 721, 721, 95, 92, 721, -91, 1212, 721, 721, + -91, 112, -91, 14, -91, -91, 36, -91, 155, 67, + 53, -91, 176, -91, 43, 1560, -91, -91, -91, -91, + -91, 254, -91, -91, 33, -91, -91, -91, -91, -91, + -91, 1560, -91, -91, 339, 332, 85, 1473, 62, 252, + 66, 32, 1734, 71, 721, -91, 72, 55, 721, 60, + 50, 46, -91, -91, -91, -91, -91, -91, -91, -91, + 75, -91, -91, -91, -91, 80, -91, -91, -91, -91, + -91, -91, 1, 49, 721, 118, 119, -91, -91, 961, + -91, 86, 21, 6, -91, 305, 63, 22, 482, 88, + 121, 406, 282, 157, 721, 312, 721, 721, 721, 721, + 406, 721, 721, 721, 721, 721, 212, 208, 222, 226, + 234, 406, 406, 406, 721, -39, 721, -1, 721, -91, + 562, 721, -91, 721, -3, -57, 721, -54, 1473, -91, + 721, 116, 1473, -91, 721, -45, 721, 721, 88, -6, + 721, -91, -10, 130, -21, -91, -91, 721, -91, 238, + 721, -91, -44, 721, -46, 1473, -91, 721, 132, 1473, + -91, -23, 219, -49, -24, 1560, -47, -91, 1473, -91, + 721, 99, 1473, -4, 1473, -91, 40, 42, 2, -91, + -91, 1473, -2, 325, 39, 314, 108, 721, 1473, 34, + 12, 272, 38, 13, 641, 45, 48, -91, 1045, -91, + 57, 26, 47, 721, 8, 11, 721, 16, 721, -11, + -7, 721, -91, 1386, 17, -91, -91, -91, -91, -91, + -91, 721, -91, -91, -91, -91, 182, -91, 721, -41, + -91, 1473, -91, 89, -91, -91, 1473, -91, 721, 114, + -5, -91, 28, -91, 37, 109, 721, -91, 29, 25, + -91, -25, -91, 1473, -91, 125, 1473, -91, 221, -91, + -91, 103, 1473, 18, -91, 0, 4, -91, 164, -20, + 10, -91, -91, -91, -91, 721, 97, 1473, -91, 721, + 98, 1473, -91, 100, 27, 801, -91, 23, -91, 881, + -91, -91, -91, -91, -91, 107, -91, -91, -91, -91, + -91, -91, -91, -16, -8, 147, -91, 721, -91, 153, + -91, -91, -91, -91, -91, 1125, -91, -91, -91, 284, + -91, -91, 1647, 388, -91, 82, -91, -91, 359, 9, + 349, 87, 721, 1473, 15, -9, 298, 19, 24, 641, + 52, 51, -91, 1045, -91, 54, 31, 58, 721, 59, + 30, 721, 44, 721, 20, -18, 126, -91, 318, -91, + -91, -91, -91, -15, -91, 137, -91, -91, 721, -91, + -91, 190, -91, -91, -91, - -104, -104, -104, -104, 98, 6, -104, -104, -104, -104, - -104, -104, -104, -104, 212, -104, -104, -104, -104, -104, - 0, -104, -104, -104, -104, -104, -104, -104, -104, -104, - 320, -104, 3, -104, -3, -104, -104, -104, -104, -104, - -104, 11, -104, -104, -104, -104, -104, -104, -104, -104, - -104, -104, -104, -104, -43, -104, -104, -104, -104, -104, - -104, -104, -104, -104, 108, -104, -104, -104, -16, -104, - -104, -104, -11, 116, 103, 79, 92, -104, -104, 48, - 143, -104, -104, -104, -104, 112, -104, 99, 93, -104, - 161, 106, -104, -104, -104, -104, 81, 87, 96, -104, - -104, -104, -104, 77, -104, 147, 134, 148, 121, -104, - 124, 132, 136, 130, 75, 44, -104, 43, 35, 53, - -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, - -104, 55, -104, 64, -104, 73, 21, 23, -104, -104, - -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, - -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, - -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, - -104, -104, -104, 24, -104, -104, -104, -104, -104, 22, - -104, -104, -104, -104, -26, -104, -104, -104, -104, -104, - -104, -104, -104, -104, -104, -104, -104, -104, 119, -104, - 123, 19, -104, -104, 17, -104, 214, 9, 56, -104, - -104, -104, -104, -104, -104, -104, -104, 1, -104, -104, - -104, -4, -104, -104, -37, -104, -104, -104, -104, -104, - -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, - 52, -104, -104, 12, 10, -104, -35, -104, -2, -104, - -104, -104, -104, 5, -104, -104, -104, 7, 14, -104, - -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, - -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, - -104, -104, -104, -20, -104, -104, -104, -104, 97, -104, - -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, - -104, -104, 41, 191, -104, 203, 162, 185, 182, -104, - 117, 146, 120, 61, 63, -104, -104, -104, -104, -104, - -104, -104, -104, 170, -104, 168, -104, 176, -104, -104, - 166, -104, 58, -104, -104, 66, -104, 32, -104, 45, - -104, 33, -104, 224, -104, 160, 152, -104, -104, 158, - -104, -104, -104, -104, -104, -104, 150, -104, 88, 54, - -104, -104, 60, -104, 42, -104, 47, -104, 31, -104, - -104, 49, -104, -104, 59, -104, -104, -22, -104, 34, - -104, -27, -104, -28, -104, -104, -104, -104, -104, -104, - -30, -104, 38, -104, 40, -104, 70, -24, -104, -104, - 39, -104, -104, 57, -104, -104, -104, 36, -104, -104, - -104, -104, 37, -104, 28, 126, -104, 142, -104, -104, - 30, -104, 27, -104, -104, -104, -104, -104, -104, -104, - 26, -104, -104, -104, -104, -104, -104, 111, -104, -104, - 4, -104, -104, -104, -104, -7, -104, 46, -104, -104, - -104, -104, -104, -48, -104, -5, -104, -90, -104, -104, - -104, -104, -73, -104, -104, -75, -104, -104, -104, -104, - -104, -104, -84, -104, -104, -6, -104, -18, -104, -1, - -104, -104, -104, -104, -19, -104, -53, -104, 16, -104, - -55, -104, -104, -104, 18, -104, 25, -104, 20, -104, - -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, - -104, -104, -104, -104, -104, -104, 2, -104, -104, -104, - -104, -104, -104, -104, 237, 15, -104, -104, -104, -104, - -104, 8, 13, -104, -104, -104, -104, -104, -104, -104, - 29, -104, -104, -104, -104, -104, -104, -104, -104, -104, - -104, -23, -104, -104, 50, -104, -104, -104}; + -103, -103, -103, -103, 7, 70, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + 20, 240, -103, -103, -103, -103, -103, 45, -103, -103, + -103, -103, -103, -103, 256, -103, -15, -103, -13, -103, + -103, -103, -103, -103, -103, -14, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -42, -103, + -103, -103, -103, -103, -103, -103, -103, -103, 142, -103, + -103, -103, 9, -103, -103, 0, 143, 132, 136, 114, + -103, -103, 146, 62, -103, -103, 129, -103, 125, 119, + -103, 151, 164, -103, -103, -103, -103, 157, 160, 122, + -103, -103, -103, -103, 65, -103, 77, 78, 89, 109, + -103, 82, 86, 80, 69, 47, 66, -103, 75, 72, + 137, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, 101, -103, 107, -103, 120, 34, 17, -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, -103, -103, + -103, -103, -103, -103, 13, -103, -103, -103, -103, -103, + 28, -103, -103, -103, -103, 46, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, 135, + -103, 110, -5, -103, -103, -10, -103, 209, 6, 50, + -103, -103, -103, -103, -103, -103, -103, -103, -19, -103, + -103, -103, 39, -103, -103, 33, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, 79, -103, -103, -6, 4, -103, -38, -103, 29, + -103, -103, -103, -103, 36, -103, -103, -103, 40, 25, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, 8, -103, -103, -103, -103, 200, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, 11, 169, -103, 212, 203, 263, 179, + -103, 165, 147, 150, 156, 163, -103, -103, -103, -103, + -103, -103, -103, -103, 182, -103, 204, -103, 185, -103, + -103, 194, -103, 134, -103, -103, 96, -103, 30, -103, + 59, -103, 2, -103, 191, -103, 172, 175, -103, -103, + 176, -103, -103, -103, -103, -103, -103, 166, -103, 85, + 76, -103, -103, 81, -103, -51, -103, 16, -103, -41, + -103, -103, 84, -103, -103, 67, -103, -103, -61, -103, + 53, -103, 3, -103, -3, -103, -103, -103, -103, -103, + -103, -31, -103, 21, -103, 15, -103, 102, -9, -103, + -103, 26, -103, -103, 99, -103, -103, -103, 37, -103, + -103, -103, -103, 31, -103, 38, 97, -103, 90, -103, + -103, 27, -103, 10, -103, -103, -103, -103, -103, -103, + -103, 18, -103, -103, -103, -103, -103, -103, 92, -103, + -103, 5, -103, -103, -103, -103, 32, -103, 52, -103, + -103, -103, -103, -103, -33, -103, 49, -103, -28, -103, + -103, -103, -103, -76, -103, -103, -72, -103, -103, -103, + -103, -103, -103, -84, -103, -103, -12, -103, -21, -103, + 74, -103, -103, -103, -103, 14, -103, -54, -103, 19, + -103, -36, -103, -103, -103, -4, -103, -2, -103, -11, + -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, + -103, -103, -103, -103, -103, -103, -103, 1, -103, -103, + -103, -103, -103, -103, -103, 254, -103, -103, -103, -1, + -103, -103, -103, 68, -103, -103, -103, -103, 12, -103, + 42, -103, 61, -7, -103, -103, 48, -103, -103, 44, + -103, -103, -103, 41, -103, -103, -103, -103, 23, -103, + 24, 56, -103, 43, -103, -103, -103, -103, 71, -103, + -103, -103, -103, -103, -103, -103, -103, -103, -18, -103, + -103, 57, -103, -103, -103}; const int JavaScriptGrammar::action_info [] = { - 198, -104, -88, -74, 288, 471, -78, -96, -99, 447, - 379, -101, -77, 376, -107, 349, 366, 343, 303, 356, - 173, 337, 364, 323, 335, 362, 422, 217, 420, 371, - 383, 434, 455, 484, 495, 34, 374, 373, 181, 14, - 521, 2, 514, 557, 7, 488, 371, 551, 39, 14, - 179, 11, 11, 14, 501, 103, 455, 455, 325, 133, - 430, 451, 471, 495, 462, 198, 325, 471, 475, 327, - 133, 477, 445, 131, 488, 440, 484, 288, 471, 343, - 131, 221, 377, 379, 439, 447, 461, 303, 173, 204, - 0, 432, 267, 479, 283, 224, 496, 173, 173, 173, - 332, 465, 173, 173, 213, 173, 90, 323, 474, 458, - 223, 173, 540, 0, 173, 173, 0, 91, 495, 200, - 345, 358, 475, 201, 346, 444, 443, 173, 287, 286, - 173, 0, 282, 273, 272, 280, 279, 9, 8, 11, - 368, 90, 94, 96, 497, 90, 544, 543, 2, 490, - 486, 449, 91, 95, 459, 285, 91, 381, 90, 174, - 541, 69, 516, 69, 524, 69, 341, 505, 554, 91, - 280, 279, 525, 103, 359, 211, 278, 277, 117, 117, - 118, 118, 96, 266, 265, 173, 206, 69, 97, 135, - 41, 119, 119, 117, 98, 118, 0, 0, 81, 82, - 81, 82, 81, 82, 69, 207, 119, 437, 136, 69, - 137, 35, 0, 117, 35, 118, 517, 515, 0, 173, - 69, 555, 553, 69, 81, 82, 119, 97, 69, 96, - 117, 69, 118, 98, 173, 117, 0, 118, 520, 519, - 0, 81, 82, 119, 42, 40, 81, 82, 119, 117, - 0, 118, 69, 0, 69, 0, 37, 81, 82, 37, - 81, 82, 119, 206, 0, 81, 82, 36, 81, 82, - 36, 0, 183, 182, 97, 105, 106, 305, 306, 0, - 98, 0, 207, 0, 208, 105, 106, 469, 468, 81, - 82, 81, 82, 69, 305, 306, 0, 310, 311, 0, - -318, 0, 107, 108, 307, 308, 312, 0, 0, 313, - 69, 314, 107, 108, 310, 311, 0, 69, 0, 0, - 0, 307, 308, 312, 310, 311, 313, 69, 314, 69, - 81, 82, 0, 312, 0, 0, 313, 0, 314, 117, - 0, 118, 276, 275, 0, 0, 0, 81, 82, 271, - 270, 0, 119, 0, 81, 82, 0, 0, 0, 271, - 270, 276, 275, 0, 81, 82, 81, 82, 110, 111, - 0, 0, 0, 0, 0, 0, 112, 113, 110, 111, - 114, 0, 115, 0, 0, 0, 112, 113, 110, 111, - 114, 19, 115, 0, 0, 0, 112, 113, 0, 0, - 114, 0, 115, 20, 19, 310, 311, 0, 0, 0, - 21, 0, 0, 0, 312, 0, 20, 313, 0, 314, - 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 522, 0, 0, 0, - 25, 0, 0, 0, 0, 0, 0, 22, 26, 23, - 0, 0, 0, 25, 0, 27, 0, 0, 0, 0, - 22, 26, 0, 0, 18, 0, 24, 0, 27, 0, - 185, 0, 0, 110, 111, 0, 0, 18, 0, 24, - 186, 112, 113, 0, 187, 114, 0, 115, 0, 0, - 0, 0, 0, 188, 0, 189, 0, 0, 339, 0, - 0, 0, 0, 0, 0, 0, 190, 0, 191, 94, - 0, 0, 0, 0, 0, 0, 192, 0, 0, 193, - 95, 0, 0, 0, 0, 194, 0, 0, 0, 0, - 0, 195, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 185, 0, 0, 0, 0, 196, 0, 0, 0, - 0, 186, 0, 0, 0, 187, 0, 0, 0, 0, - 0, 0, 0, 0, 188, 0, 189, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 190, 0, 191, - 94, 0, 0, 0, 0, 0, 0, 192, 0, 0, - 193, 95, 0, 0, 0, 0, 194, 0, 0, 0, - 0, 0, 195, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 196, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, - 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, - 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, - 70, 71, 0, 72, 0, 0, 0, 0, 0, 0, - 75, 0, 0, 0, 78, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 83, 81, 82, 0, 84, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 77, 86, 67, - 0, 0, 0, 0, 0, 0, 0, 0, 64, 65, - 66, 0, 0, 0, 0, 0, 0, 0, 0, 68, - 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, - 70, 71, 0, 72, 0, 0, 0, 73, 0, 74, - 75, 76, 0, 0, 78, 0, 0, 0, 79, 0, - 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 83, 81, 82, 0, 84, 0, 85, 0, - 87, 0, 88, 0, 0, 0, 0, 77, 86, 67, - 0, 0, 0, 0, 0, 0, 0, 0, -97, 0, - 0, 0, 64, 65, 66, 0, 0, 0, 0, 0, - 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, - 69, 0, 0, 0, 70, 71, 0, 72, 0, 0, - 0, 73, 0, 74, 75, 76, 0, 0, 78, 0, - 0, 0, 79, 0, 80, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 83, 81, 82, 0, - 84, 0, 85, 0, 87, 0, 88, 0, 0, 0, - 0, 77, 86, 67, 0, 0, 0, 0, 0, 0, - 0, 0, 64, 65, 66, 0, 0, 0, 0, 0, - 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, - 69, 0, 0, 0, 70, 71, 0, 72, 0, 0, - 0, 73, 0, 74, 75, 76, 0, 0, 78, 0, - 0, 0, 79, 0, 80, 0, 0, 500, 0, 0, - 0, 0, 0, 0, 0, 0, 83, 81, 82, 0, - 84, 0, 85, 0, 87, 0, 88, 0, 0, 0, - 0, 77, 86, 67, 0, 0, 0, 0, 0, 0, - 0, 0, 64, 65, 66, 0, 0, 0, 0, 0, - 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, - 69, 0, 0, 0, 70, 71, 0, 72, 0, 0, - 0, 73, 0, 74, 75, 76, 0, 0, 78, 0, - 0, 0, 79, 0, 80, 0, 0, 503, 0, 0, - 0, 0, 0, 0, 0, 0, 83, 81, 82, 0, - 84, 0, 85, 0, 87, 0, 88, 0, 0, 0, - 0, 77, 86, 67, 0, 0, 0, 0, 0, 0, - 0, 0, 64, 65, 66, 0, 0, 0, 0, 0, - 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, - 69, 0, 0, 0, 70, 71, 0, 72, 0, 0, - 0, 73, 0, 74, 75, 76, 0, 0, 78, 0, - 0, 0, 79, 0, 80, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 83, 81, 82, 0, - 84, 0, 85, 0, 87, 302, 88, 0, 0, 0, - 0, 77, 86, 67, 0, 0, 0, 0, 0, 0, - 0, 0, 64, 65, 66, 0, 0, 0, 0, 0, - 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, - 531, 250, 0, 0, 251, 532, 0, 72, 0, 0, - 0, 73, 0, 74, 75, 76, 0, 0, 78, 0, - 0, 0, 79, 0, 80, 0, 0, 0, 0, 0, - 0, 0, 254, 0, 0, 0, 83, 81, 82, 0, - 84, 0, 85, 0, 87, 0, 88, 0, 0, 0, - 0, 77, 86, 67, 0, 245, 0, 533, 0, 0, - 0, 0, 141, 142, 143, 0, 0, 145, 147, 148, - 0, 0, 149, 0, 150, 0, 0, 0, 152, 153, - 154, 0, 0, 0, 0, 0, 0, 69, 155, 156, - 157, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 158, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 161, 0, 0, - 0, 0, 0, 0, 81, 82, 162, 163, 164, 0, - 166, 167, 168, 169, 170, 171, 0, 0, 159, 165, - 151, 144, 146, 160, 0, 0, 0, 0, 0, 141, - 142, 143, 0, 0, 145, 147, 148, 0, 0, 149, - 0, 150, 0, 0, 0, 152, 153, 154, 0, 0, - 0, 0, 0, 0, 424, 155, 156, 157, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 158, 0, - 0, 0, 425, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 161, 0, 0, 0, 0, 0, - 429, 426, 428, 162, 163, 164, 0, 166, 167, 168, - 169, 170, 171, 0, 0, 159, 165, 151, 144, 146, - 160, 0, 0, 0, 0, 0, 141, 142, 143, 0, - 0, 145, 147, 148, 0, 0, 149, 0, 150, 0, - 0, 0, 152, 153, 154, 0, 0, 0, 0, 0, - 0, 424, 155, 156, 157, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 158, 0, 0, 0, 425, - 0, 0, 0, 0, 0, 0, 0, 427, 0, 0, - 0, 161, 0, 0, 0, 0, 0, 429, 426, 428, - 162, 163, 164, 0, 166, 167, 168, 169, 170, 171, - 0, 0, 159, 165, 151, 144, 146, 160, 0, 0, - 0, 0, 0, 243, 0, 0, 0, 0, 244, 0, - 64, 65, 66, 246, 0, 0, 0, 0, 0, 0, - 247, 248, 0, 0, 0, 0, 0, 0, 249, 250, - 0, 0, 251, 71, 0, 72, 0, 0, 0, 73, - 0, 74, 75, 76, 0, 0, 78, 0, 0, 0, - 79, 0, 80, 0, 0, 0, 0, 0, 253, 0, - 254, 0, 0, 0, 83, 252, 255, 256, 84, 257, - 85, 258, 87, 27, 88, 259, 260, 0, 0, 77, - 86, 67, 18, 245, 0, 0, 0, 0, 0, 0, - 243, 0, 0, 0, 0, 244, 0, 64, 65, 66, - 246, 0, 0, 0, 0, 0, 0, 247, 68, 0, - 0, 0, 0, 0, 0, 249, 250, 0, 0, 251, - 71, 0, 72, 0, 0, 0, 73, 0, 74, 75, - 76, 0, 0, 78, 0, 0, 0, 79, 0, 80, - 0, 0, 0, 0, 0, 253, 0, 254, 0, 0, - 0, 83, 252, 255, 256, 84, 257, 85, 258, 87, - 27, 88, 259, 260, 0, 0, 77, 86, 67, 18, - 245, 0, 0, 0, 0, 0, 0, 392, 142, 143, - 0, 0, 394, 147, 396, 65, 66, 397, 0, 150, - 0, 0, 0, 152, 399, 400, 0, 0, 0, 0, - 0, 0, 401, 402, 156, 157, 251, 71, 0, 72, - 0, 0, 0, 73, 0, 74, 403, 76, 0, 0, - 405, 0, 0, 0, 79, 0, 80, 0, -243, 0, - 0, 0, 407, 0, 254, 0, 0, 0, 409, 406, - 408, 410, 411, 412, 85, 414, 415, 416, 417, 418, - 419, 0, 0, 404, 413, 398, 393, 395, 160, 0, - 0, 0, 0, 0, - - 460, 284, 485, 466, 197, 463, 478, 552, 216, 481, - 504, 476, 12, 491, 480, 487, 464, 38, 537, 539, - 222, 184, 370, 518, 512, 220, 333, 546, 467, 470, - 210, 241, 51, 281, 274, 542, 269, 489, 433, 545, - 384, 382, 172, 470, 281, 456, 378, 205, 502, 203, - 499, 498, 180, 178, 175, 380, 431, 333, 467, 423, - 421, 446, 269, 216, 274, 351, 340, 448, 367, 0, - 0, 0, 441, 220, 546, 333, 92, 0, 0, 333, - 121, 333, 0, 0, 92, 92, 178, 333, 120, 92, - 127, 509, 435, 212, 92, 436, 92, 138, 122, 369, - 338, 342, 92, 10, 92, 92, 140, 318, 132, 319, - 365, 92, 351, 214, 435, 134, 92, 436, 92, 361, - 241, 126, 92, 334, 99, 363, 104, 241, 92, 0, - 100, 336, 556, 92, 92, 508, 483, 92, 297, 101, - 92, 178, 482, 301, 92, 372, 507, 92, 438, 92, - 102, 214, 0, 92, 268, 511, 375, 92, 92, 506, - 92, 92, 92, 315, 92, 92, 317, 92, 130, 482, - 116, 92, 360, 92, 199, 92, 125, 92, 123, 0, - 202, 128, 124, 92, 92, 483, 510, 92, 92, 92, - 0, 329, 316, 329, 109, 129, 301, 0, 301, 329, - 0, 92, 92, 92, 301, 93, 301, 329, 301, 92, - 320, 92, 301, 357, 301, 348, 301, 329, 347, 0, - 326, 350, 301, 92, 324, 0, 92, 0, 301, 331, - 322, 301, 92, 321, 16, 33, 17, 301, 138, 328, - 0, 304, 0, 0, 92, 0, 0, 140, 209, 301, - 0, 309, 526, 528, 529, 527, 530, 0, 0, 0, - 0, 0, 0, 0, 0, 92, 0, 0, 0, 0, - 301, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 304, 350, 578, 324, 336, 174, 338, 357, 377, 375, + 367, 374, 384, 372, 365, -100, -106, 363, 489, 440, + 372, 515, -87, -103, 431, 485, -73, 289, 452, 489, + 462, 496, 463, 456, 456, 502, 478, 472, 476, 326, + 480, -87, 456, 472, 472, -73, -106, 421, 289, 380, + 423, -103, -95, 435, -98, -77, 485, 433, -77, -95, + 380, -76, 448, 472, -76, -98, -100, 448, 380, 324, + 199, 328, 218, 378, 214, 222, 225, 283, 441, 446, + 104, 134, 489, 333, 326, 284, 485, 304, 268, 132, + 344, 448, 180, 472, 43, 2, 584, 199, 289, 205, + 7, 496, 522, 0, 0, 174, 174, 174, 497, 475, + 91, 0, 174, 224, 91, 174, 182, 132, 91, 459, + 174, 92, 174, 476, 174, 92, 174, 201, 0, 92, + 38, 202, 466, 174, 568, 20, 274, 273, 359, 134, + 174, 279, 278, 572, 571, 581, 281, 280, 281, 280, + 445, 444, 95, 21, 517, 91, 498, 487, 491, 382, + 175, 174, 97, 96, 460, 12, 92, 506, 212, 281, + 280, 346, 9, 8, 450, 347, 342, 0, 286, 104, + 288, 287, 569, 118, 12, 119, 12, 97, 12, 39, + 12, 360, 369, 12, 0, 0, 120, 207, 582, 580, + 0, 0, 13, 16, 118, 12, 119, 98, 518, 516, + 0, 0, 0, 99, 521, 520, 208, 120, 438, 12, + 0, 13, 16, 13, 16, 13, 16, 13, 16, 174, + 13, 16, 98, 118, 41, 119, 174, 118, 99, 119, + 0, 0, 13, 16, 45, 40, 120, 118, 12, 119, + 120, 118, 118, 119, 119, 97, 13, 16, 39, 118, + 120, 119, 174, 0, 120, 120, 118, 12, 119, 525, + 0, 118, 120, 119, 118, 207, 119, 20, 118, 120, + 119, 12, 470, 469, 120, 13, 16, 120, 12, 184, + 183, 120, 174, 0, 208, 21, 209, 0, 46, 44, + 98, 12, 0, 41, 13, 16, 99, 118, -317, 119, + 0, 0, 0, 0, 40, 267, 266, 21, 13, 16, + 120, 106, 107, 306, 307, 13, 16, 12, 106, 107, + 306, 307, 0, 12, -317, 0, 0, 0, 13, 16, + 0, 0, 0, 12, 0, 267, 266, 12, 108, 109, + 308, 309, 0, 136, 12, 108, 109, 308, 309, 0, + 0, 12, 0, 15, 13, 16, 0, 0, 12, 0, + 13, 16, 137, 0, 138, 277, 276, 15, 12, 0, + 13, 16, 0, 0, 13, 16, 272, 271, 12, 14, + 0, 13, 16, 277, 276, 26, 496, 0, 13, 16, + 272, 271, 0, 14, 0, 13, 16, 27, 0, 0, + 277, 276, 0, 0, 12, 13, 16, 12, 0, 0, + 272, 271, 0, 111, 112, 13, 16, 26, 0, 311, + 312, 113, 114, 0, 0, 115, 0, 116, 313, 27, + 523, 314, 0, 315, 15, 0, 12, 15, 0, 0, + 0, 28, 30, 0, 13, 16, 0, 0, 0, 31, + 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, + 14, 0, 29, 14, 0, 0, 15, 0, 0, 0, + 0, 0, 0, 28, 30, 186, 0, 0, 0, 0, + 0, 31, 0, 0, 0, 187, 0, 111, 112, 188, + 25, 0, 14, 0, 0, 113, 114, 0, 189, 115, + 190, 116, 0, 340, 0, 0, 0, 0, 0, 0, + 0, 191, 0, 192, 95, 0, 0, 69, 70, 0, + 0, 193, 0, 0, 194, 96, 0, 72, 0, 0, + 195, 0, 0, 0, 12, 0, 196, 0, 73, 74, + 0, 75, 0, 0, 0, 0, 0, 0, 78, 0, + 0, 197, 81, 0, 0, 186, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 187, 0, 0, 0, 188, + 84, 13, 16, 0, 85, 0, 0, 0, 189, 0, + 190, 0, 0, 0, 0, 80, 87, 71, 0, 0, + 0, 191, 0, 192, 95, 0, 0, 0, 0, 0, + 0, 193, 0, 0, 194, 96, 0, 0, 0, 0, + 195, 0, 0, 0, 0, 0, 196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 197, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 69, 70, 0, 0, 0, 0, 0, + 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 73, 74, 0, 75, 0, 0, + 0, 0, 0, 0, 78, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 84, 13, 16, 0, + 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 80, 87, 71, 0, 0, 0, 0, 0, 0, + 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, + 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 73, 74, 0, 75, 0, 0, + 0, 76, 0, 77, 78, 79, 0, 0, 81, 0, + 0, 0, 82, 0, 83, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 84, 13, 16, 0, + 85, 0, 86, 0, 88, 0, 89, 0, 0, 0, + 0, 80, 87, 71, 0, 0, 0, 0, 0, 0, + 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, + 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 73, 74, 0, 75, 0, 0, + 0, 76, 0, 77, 78, 79, 0, 0, 81, 0, + 0, 0, 82, 0, 83, 0, 0, 504, 0, 0, + 0, 0, 0, 0, 0, 0, 84, 13, 16, 0, + 85, 0, 86, 0, 88, 0, 89, 0, 0, 0, + 0, 80, 87, 71, 0, 0, 0, 0, 0, 0, + 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, + 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 73, 74, 0, 75, 0, 0, + 0, 76, 0, 77, 78, 79, 0, 0, 81, 0, + 0, 0, 82, 0, 83, 0, 0, 501, 0, 0, + 0, 0, 0, 0, 0, 0, 84, 13, 16, 0, + 85, 0, 86, 0, 88, 0, 89, 0, 0, 0, + 0, 80, 87, 71, 0, 0, 0, 0, 0, 0, + 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, + 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 73, 74, 0, 75, 0, 0, + 0, 76, 0, 77, 78, 79, 0, 0, 81, 0, + 0, 0, 82, 0, 83, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 84, 13, 16, 0, + 85, 0, 86, 0, 88, 303, 89, 0, 0, 0, + 0, 80, 87, 71, 0, 0, 0, 0, 0, 0, + 0, 0, -96, 0, 0, 0, 68, 69, 70, 0, + 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, + 0, 0, 0, 0, 12, 0, 0, 0, 73, 74, + 0, 75, 0, 0, 0, 76, 0, 77, 78, 79, + 0, 0, 81, 0, 0, 0, 82, 0, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 523, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 16, 33, 17, 0, 0, 0, 0, 0, + 84, 13, 16, 0, 85, 0, 86, 0, 88, 0, + 89, 0, 0, 0, 0, 80, 87, 71, 0, 0, + 0, 0, 0, 0, 0, 0, 68, 69, 70, 0, + 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, + 0, 0, 0, 0, 12, 251, 0, 0, 532, 533, + 0, 75, 0, 0, 0, 76, 0, 77, 78, 79, + 0, 0, 81, 0, 0, 0, 82, 0, 83, 0, + 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, + 84, 13, 16, 0, 85, 0, 86, 0, 88, 0, + 89, 0, 0, 0, 0, 80, 87, 71, 0, 246, + 0, 534, 0, 0, 0, 0, 142, 143, 144, 0, + 0, 146, 148, 149, 0, 0, 150, 0, 151, 0, + 0, 0, 153, 154, 155, 0, 0, 0, 0, 0, + 0, 12, 156, 157, 158, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 162, 0, 0, 0, 0, 0, 0, 13, 16, + 163, 164, 165, 0, 167, 168, 169, 170, 171, 172, + 0, 0, 160, 166, 152, 145, 147, 161, 0, 0, + 0, 0, 0, 142, 143, 144, 0, 0, 146, 148, + 149, 0, 0, 150, 0, 151, 0, 0, 0, 153, + 154, 155, 0, 0, 0, 0, 0, 0, 425, 156, + 157, 158, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 159, 0, 0, 0, 426, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 162, 0, + 0, 0, 0, 0, 430, 427, 429, 163, 164, 165, + 0, 167, 168, 169, 170, 171, 172, 0, 0, 160, + 166, 152, 145, 147, 161, 0, 0, 0, 0, 0, + 142, 143, 144, 0, 0, 146, 148, 149, 0, 0, + 150, 0, 151, 0, 0, 0, 153, 154, 155, 0, + 0, 0, 0, 0, 0, 425, 156, 157, 158, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 159, + 0, 0, 0, 426, 0, 0, 0, 0, 0, 0, + 0, 428, 0, 0, 0, 162, 0, 0, 0, 0, + 0, 430, 427, 429, 163, 164, 165, 0, 167, 168, + 169, 170, 171, 172, 0, 0, 160, 166, 152, 145, + 147, 161, 0, 0, 0, 0, 0, 244, 0, 0, + 0, 0, 245, 0, 68, 69, 70, 247, 0, 0, + 0, 0, 0, 0, 248, 72, 0, 0, 0, 0, + 0, 0, 250, 251, 0, 0, 252, 74, 0, 75, + 0, 0, 0, 76, 0, 77, 78, 79, 0, 0, + 81, 0, 0, 0, 82, 0, 83, 0, 0, 0, + 0, 0, 254, 0, 255, 0, 0, 0, 84, 253, + 256, 257, 85, 258, 86, 259, 88, 31, 89, 260, + 261, 0, 0, 80, 87, 71, 25, 246, 0, 0, + 0, 0, 0, 0, 244, 0, 0, 0, 0, 245, + 0, 68, 69, 70, 247, 0, 0, 0, 0, 0, + 0, 248, 249, 0, 0, 0, 0, 0, 0, 250, + 251, 0, 0, 252, 74, 0, 75, 0, 0, 0, + 76, 0, 77, 78, 79, 0, 0, 81, 0, 0, + 0, 82, 0, 83, 0, 0, 0, 0, 0, 254, + 0, 255, 0, 0, 0, 84, 253, 256, 257, 85, + 258, 86, 259, 88, 31, 89, 260, 261, 0, 0, + 80, 87, 71, 25, 246, 0, 0, 0, 0, 0, + 0, 538, 143, 144, 0, 0, 540, 148, 542, 69, + 70, 543, 0, 151, 0, 0, 0, 153, 545, 546, + 0, 0, 0, 0, 0, 0, 547, 548, 157, 158, + 252, 74, 0, 75, 0, 0, 0, 76, 0, 77, + 549, 79, 0, 0, 551, 0, 0, 0, 82, 0, + 83, 0, 0, 0, 0, 0, 553, 0, 255, 0, + 0, 0, 555, 552, 554, 556, 557, 558, 86, 560, + 561, 562, 563, 564, 565, 0, 0, 550, 559, 544, + 539, 541, 161, 0, 0, 0, 0, 0, 393, 143, + 144, 0, 0, 395, 148, 397, 69, 70, 398, 0, + 151, 0, 0, 0, 153, 400, 401, 0, 0, 0, + 0, 0, 0, 402, 403, 157, 158, 252, 74, 0, + 75, 0, 0, 0, 76, 0, 77, 404, 79, 0, + 0, 406, 0, 0, 0, 82, 0, 83, 0, -242, + 0, 0, 0, 408, 0, 255, 0, 0, 0, 410, + 407, 409, 411, 412, 413, 86, 415, 416, 417, 418, + 419, 420, 0, 0, 405, 414, 399, 394, 396, 161, + 0, 0, 0, 0, 0, + + 55, 464, 479, 482, 221, 467, 379, 42, 573, 537, + 477, 579, 10, 488, 505, 519, 366, 270, 500, 206, + 211, 185, 285, 499, 204, 503, 370, 275, 486, 282, + 368, 492, 217, 490, 352, 270, 434, 468, 275, 471, + 471, 424, 176, 23, 270, 468, 179, 432, 173, 217, + 334, 334, 371, 471, 468, 334, 422, 181, 282, 457, + 282, 461, 223, 465, 385, 275, 449, 381, 513, 343, + 383, 217, 442, 341, 567, 198, 17, 570, 436, 179, + 573, 437, 0, 93, 0, 484, 213, 93, 0, 481, + 334, 11, 127, 11, 11, 334, 93, 339, 483, 447, + 242, 93, 93, 215, 511, 93, 93, 221, 352, 93, + 334, 128, 93, 105, 126, 93, 122, 93, 93, 121, + 93, 179, 93, 110, 129, 125, 93, 117, 439, 93, + 93, 124, 484, 436, 242, 130, 437, 93, 583, 483, + 362, 93, 93, 139, 215, 364, 242, 93, 334, 93, + 93, 0, 141, 133, 93, 131, 509, 135, 0, 93, + 337, 484, 93, 376, 102, 93, 203, 483, 361, 93, + 436, 512, 93, 437, 508, 93, 0, 93, 0, 373, + 269, 123, 93, 93, 215, 507, 93, 93, 510, 200, + 93, 93, 317, 0, 94, 318, 93, 93, 335, 100, + 93, 319, 101, 93, 93, 93, 330, 103, 320, 93, + 316, 302, 93, 0, 302, 330, 330, 302, 305, 93, + 302, 302, 93, 0, 302, 330, 323, 302, 358, 348, + 302, 93, 139, 0, 330, 325, 302, 349, 351, 302, + 298, 141, 210, 93, 93, 302, 345, 329, 302, 302, + 321, 35, 93, 0, 0, 327, 332, 302, 0, 310, + 0, 24, 37, 11, 524, 0, 0, 35, 529, 526, + 528, 530, 527, 531, 0, 0, 0, 24, 37, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 93, 0, 0, 0, 0, 302, 0, + 322, 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, 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, 0}; + 0, 0, 0, 0, 0, 0}; const int JavaScriptGrammar::action_check [] = { - 2, 7, 7, 7, 36, 33, 7, 7, 7, 36, - 36, 7, 7, 55, 7, 7, 31, 2, 1, 17, - 8, 60, 60, 48, 61, 61, 8, 36, 7, 36, - 16, 55, 5, 36, 8, 66, 33, 60, 60, 33, - 29, 88, 29, 0, 65, 36, 36, 17, 29, 33, - 8, 29, 29, 33, 8, 1, 5, 5, 78, 78, - 7, 33, 33, 8, 7, 2, 78, 33, 20, 8, - 78, 36, 7, 48, 36, 7, 36, 36, 33, 2, - 48, 8, 7, 36, 60, 36, 55, 1, 8, 7, - -1, 55, 55, 60, 36, 33, 8, 8, 8, 8, - 61, 7, 8, 8, 60, 8, 40, 48, 6, 10, - 60, 8, 8, -1, 8, 8, -1, 51, 8, 50, - 50, 8, 20, 54, 54, 61, 62, 8, 61, 62, - 8, -1, 76, 61, 62, 61, 62, 61, 62, 29, - 60, 40, 42, 12, 56, 40, 61, 62, 88, 60, - 60, 60, 51, 53, 55, 60, 51, 60, 40, 56, - 56, 29, 7, 29, 7, 29, 60, 60, 8, 51, - 61, 62, 15, 1, 61, 56, 61, 62, 25, 25, - 27, 27, 12, 61, 62, 8, 15, 29, 57, 15, - 7, 38, 38, 25, 63, 27, -1, -1, 66, 67, - 66, 67, 66, 67, 29, 34, 38, 36, 34, 29, - 36, 29, -1, 25, 29, 27, 61, 62, -1, 8, - 29, 61, 62, 29, 66, 67, 38, 57, 29, 12, - 25, 29, 27, 63, 8, 25, -1, 27, 61, 62, - -1, 66, 67, 38, 61, 62, 66, 67, 38, 25, - -1, 27, 29, -1, 29, -1, 74, 66, 67, 74, - 66, 67, 38, 15, -1, 66, 67, 85, 66, 67, - 85, -1, 61, 62, 57, 18, 19, 18, 19, -1, - 63, -1, 34, -1, 36, 18, 19, 61, 62, 66, - 67, 66, 67, 29, 18, 19, -1, 23, 24, -1, - 36, -1, 45, 46, 45, 46, 32, -1, -1, 35, - 29, 37, 45, 46, 23, 24, -1, 29, -1, -1, - -1, 45, 46, 32, 23, 24, 35, 29, 37, 29, - 66, 67, -1, 32, -1, -1, 35, -1, 37, 25, - -1, 27, 61, 62, -1, -1, -1, 66, 67, 61, - 62, -1, 38, -1, 66, 67, -1, -1, -1, 61, - 62, 61, 62, -1, 66, 67, 66, 67, 23, 24, - -1, -1, -1, -1, -1, -1, 31, 32, 23, 24, - 35, -1, 37, -1, -1, -1, 31, 32, 23, 24, - 35, 10, 37, -1, -1, -1, 31, 32, -1, -1, - 35, -1, 37, 22, 10, 23, 24, -1, -1, -1, - 29, -1, -1, -1, 32, -1, 22, 35, -1, 37, - -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, - 59, -1, -1, -1, -1, -1, -1, 66, 67, 55, - -1, -1, -1, 59, -1, 74, -1, -1, -1, -1, - 66, 67, -1, -1, 83, -1, 85, -1, 74, -1, - 3, -1, -1, 23, 24, -1, -1, 83, -1, 85, - 13, 31, 32, -1, 17, 35, -1, 37, -1, -1, - -1, -1, -1, 26, -1, 28, -1, -1, 31, -1, - -1, -1, -1, -1, -1, -1, 39, -1, 41, 42, - -1, -1, -1, -1, -1, -1, 49, -1, -1, 52, - 53, -1, -1, -1, -1, 58, -1, -1, -1, -1, - -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 3, -1, -1, -1, -1, 79, -1, -1, -1, - -1, 13, -1, -1, -1, 17, -1, -1, -1, -1, - -1, -1, -1, -1, 26, -1, 28, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 39, -1, 41, - 42, -1, -1, -1, -1, -1, -1, 49, -1, -1, - 52, 53, -1, -1, -1, -1, 58, -1, -1, -1, - -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, - 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, + 1, 7, 17, 48, 61, 8, 60, 17, 55, 33, + 31, 60, 16, 36, 60, 7, 7, 61, 36, 60, + 36, 29, 7, 7, 7, 36, 7, 36, 33, 36, + 55, 8, 7, 5, 5, 8, 36, 33, 20, 78, + 60, 7, 5, 33, 33, 7, 7, 7, 36, 36, + 8, 7, 7, 55, 7, 7, 36, 55, 7, 7, + 36, 7, 36, 33, 7, 7, 7, 36, 36, 48, + 2, 8, 36, 7, 60, 8, 33, 76, 7, 7, + 1, 78, 36, 61, 78, 36, 36, 1, 55, 48, + 2, 36, 8, 33, 29, 88, 0, 2, 36, 7, + 65, 8, 29, -1, -1, 8, 8, 8, 8, 6, + 40, -1, 8, 60, 40, 8, 60, 48, 40, 10, + 8, 51, 8, 20, 8, 51, 8, 50, -1, 51, + 66, 54, 7, 8, 8, 15, 61, 62, 8, 78, + 8, 61, 62, 61, 62, 8, 61, 62, 61, 62, + 61, 62, 42, 33, 7, 40, 56, 60, 60, 60, + 56, 8, 12, 53, 55, 29, 51, 60, 56, 61, + 62, 50, 61, 62, 60, 54, 60, -1, 60, 1, + 61, 62, 56, 25, 29, 27, 29, 12, 29, 29, + 29, 61, 60, 29, -1, -1, 38, 15, 61, 62, + -1, -1, 66, 67, 25, 29, 27, 57, 61, 62, + -1, -1, -1, 63, 61, 62, 34, 38, 36, 29, + -1, 66, 67, 66, 67, 66, 67, 66, 67, 8, + 66, 67, 57, 25, 74, 27, 8, 25, 63, 27, + -1, -1, 66, 67, 7, 85, 38, 25, 29, 27, + 38, 25, 25, 27, 27, 12, 66, 67, 29, 25, + 38, 27, 8, -1, 38, 38, 25, 29, 27, 7, + -1, 25, 38, 27, 25, 15, 27, 15, 25, 38, + 27, 29, 61, 62, 38, 66, 67, 38, 29, 61, + 62, 38, 8, -1, 34, 33, 36, -1, 61, 62, + 57, 29, -1, 74, 66, 67, 63, 25, 36, 27, + -1, -1, -1, -1, 85, 61, 62, 33, 66, 67, + 38, 18, 19, 18, 19, 66, 67, 29, 18, 19, + 18, 19, -1, 29, 36, -1, -1, -1, 66, 67, + -1, -1, -1, 29, -1, 61, 62, 29, 45, 46, + 45, 46, -1, 15, 29, 45, 46, 45, 46, -1, + -1, 29, -1, 59, 66, 67, -1, -1, 29, -1, + 66, 67, 34, -1, 36, 61, 62, 59, 29, -1, + 66, 67, -1, -1, 66, 67, 61, 62, 29, 85, + -1, 66, 67, 61, 62, 10, 8, -1, 66, 67, + 61, 62, -1, 85, -1, 66, 67, 22, -1, -1, + 61, 62, -1, -1, 29, 66, 67, 29, -1, -1, + 61, 62, -1, 23, 24, 66, 67, 10, -1, 23, + 24, 31, 32, -1, -1, 35, -1, 37, 32, 22, + 55, 35, -1, 37, 59, -1, 29, 59, -1, -1, + -1, 66, 67, -1, 66, 67, -1, -1, -1, 74, + -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, + 85, -1, 55, 85, -1, -1, 59, -1, -1, -1, + -1, -1, -1, 66, 67, 3, -1, -1, -1, -1, + -1, 74, -1, -1, -1, 13, -1, 23, 24, 17, + 83, -1, 85, -1, -1, 31, 32, -1, 26, 35, + 28, 37, -1, 31, -1, -1, -1, -1, -1, -1, + -1, 39, -1, 41, 42, -1, -1, 12, 13, -1, + -1, 49, -1, -1, 52, 53, -1, 22, -1, -1, + 58, -1, -1, -1, 29, -1, 64, -1, 33, 34, + -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, + -1, 79, 47, -1, -1, 3, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 13, -1, -1, -1, 17, + 65, 66, 67, -1, 69, -1, -1, -1, 26, -1, + 28, -1, -1, -1, -1, 80, 81, 82, -1, -1, + -1, 39, -1, 41, 42, -1, -1, -1, -1, -1, + -1, 49, -1, -1, 52, 53, -1, -1, -1, -1, + 58, -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, -1, 69, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 80, 81, 82, - -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, - 73, -1, 75, -1, -1, -1, -1, 80, 81, 82, - -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, + -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 12, 13, -1, -1, -1, -1, -1, + -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, + 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, + -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, + 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, @@ -640,109 +648,120 @@ const int JavaScriptGrammar::action_check [] = { -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, 73, 74, 75, -1, -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, - -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, - -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, - 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, - -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, - -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, - -1, -1, 61, -1, -1, -1, 65, 66, 67, -1, - 69, -1, 71, -1, 73, -1, 75, -1, -1, -1, - -1, 80, 81, 82, -1, 84, -1, 86, -1, -1, - -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, - -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, - 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, - 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, - -1, -1, -1, -1, 66, 67, 68, 69, 70, -1, - 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, - 82, 83, 84, 85, -1, -1, -1, -1, -1, 4, - 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, - -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, - -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, - -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, - 65, 66, 67, 68, 69, 70, -1, 72, 73, 74, - 75, 76, 77, -1, -1, 80, 81, 82, 83, 84, - 85, -1, -1, -1, -1, -1, 4, 5, 6, -1, + -1, -1, 7, -1, -1, -1, 11, 12, 13, -1, + -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, + -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, + -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, + -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 65, 66, 67, -1, 69, -1, 71, -1, 73, -1, + 75, -1, -1, -1, -1, 80, 81, 82, -1, -1, + -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, + -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, + -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, + -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, + -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, + -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, + 65, 66, 67, -1, 69, -1, 71, -1, 73, -1, + 75, -1, -1, -1, -1, 80, 81, 82, -1, 84, + -1, 86, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, - -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, - -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, + -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 59, -1, -1, -1, -1, -1, -1, 66, 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, 84, 85, -1, -1, - -1, -1, -1, 4, -1, -1, -1, -1, 9, -1, - 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, + 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, - -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, - -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, - 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, - 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, - 81, 82, 83, 84, -1, -1, -1, -1, -1, -1, - 4, -1, -1, -1, -1, 9, -1, 11, 12, 13, - 14, -1, -1, -1, -1, -1, -1, 21, 22, -1, - -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, - 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, - 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, - -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, - -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, + -1, -1, -1, -1, 65, 66, 67, 68, 69, 70, + -1, 72, 73, 74, 75, 76, 77, -1, -1, 80, + 81, 82, 83, 84, 85, -1, -1, -1, -1, -1, + 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, + 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, + -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, + -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, + -1, 55, -1, -1, -1, 59, -1, -1, -1, -1, + -1, 65, 66, 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, - 84, -1, -1, -1, -1, -1, -1, 4, 5, 6, - -1, -1, 9, 10, 11, 12, 13, 14, -1, 16, - -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, - -1, -1, 29, 30, 31, 32, 33, 34, -1, 36, + 84, 85, -1, -1, -1, -1, -1, 4, -1, -1, + -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, + -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, + -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, - 47, -1, -1, -1, 51, -1, 53, -1, 55, -1, + 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, -1, -1, 80, 81, 82, 83, 84, 85, -1, - -1, -1, -1, -1, + 77, -1, -1, 80, 81, 82, 83, 84, -1, -1, + -1, -1, -1, -1, 4, -1, -1, -1, -1, 9, + -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, + -1, 21, 22, -1, -1, -1, -1, -1, -1, 29, + 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, + 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, + -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, + -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, -1, -1, + 80, 81, 82, 83, 84, -1, -1, -1, -1, -1, + -1, 4, 5, 6, -1, -1, 9, 10, 11, 12, + 13, 14, -1, 16, -1, -1, -1, 20, 21, 22, + -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, + 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, + 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, + 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, + -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, + 83, 84, 85, -1, -1, -1, -1, -1, 4, 5, + 6, -1, -1, 9, 10, 11, 12, 13, 14, -1, + 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, + -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, + 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, + -1, 47, -1, -1, -1, 51, -1, 53, -1, 55, + -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, -1, -1, 80, 81, 82, 83, 84, 85, + -1, -1, -1, -1, -1, - 90, 21, 21, 78, 30, 78, 24, 30, 24, 15, - 21, 95, 6, 68, 15, 68, 21, 20, 10, 6, - 24, 64, 24, 21, 24, 24, 21, 24, 21, 15, - 21, 68, 21, 68, 24, 6, 24, 21, 68, 24, - 68, 68, 21, 15, 68, 93, 68, 30, 30, 30, - 30, 26, 30, 30, 30, 21, 30, 21, 21, 32, - 30, 68, 24, 24, 24, 24, 21, 21, 21, -1, - -1, -1, 68, 24, 24, 21, 41, -1, -1, 21, - 45, 21, -1, -1, 41, 41, 30, 21, 45, 41, - 46, 43, 35, 37, 41, 38, 41, 24, 45, 68, - 68, 68, 41, 5, 41, 41, 33, 46, 53, 46, - 68, 41, 24, 43, 35, 51, 41, 38, 41, 65, - 68, 46, 41, 65, 43, 65, 49, 68, 41, -1, - 43, 65, 82, 41, 41, 43, 43, 41, 41, 43, - 41, 30, 43, 46, 41, 96, 43, 41, 37, 41, - 44, 43, -1, 41, 102, 43, 97, 41, 41, 43, - 41, 41, 41, 46, 41, 41, 46, 41, 47, 43, - 46, 41, 84, 41, 55, 41, 46, 41, 46, -1, - 57, 47, 46, 41, 41, 43, 43, 41, 41, 41, - -1, 41, 46, 41, 47, 47, 46, -1, 46, 41, - -1, 41, 41, 41, 46, 44, 46, 41, 46, 41, - 48, 41, 46, 63, 46, 63, 46, 41, 58, -1, - 52, 63, 46, 41, 54, -1, 41, -1, 46, 63, - 48, 46, 41, 48, 22, 23, 24, 46, 24, 63, - -1, 50, -1, -1, 41, -1, -1, 33, 34, 46, - -1, 48, 15, 16, 17, 18, 19, -1, -1, -1, - -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, - 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 56, -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, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 22, 23, 24, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 14, 77, 23, 15, 23, 77, 67, 20, 23, 10, + 94, 29, 5, 67, 14, 14, 67, 23, 29, 29, + 14, 63, 14, 25, 29, 29, 67, 23, 14, 67, + 14, 67, 23, 14, 23, 23, 67, 14, 23, 15, + 15, 31, 29, 23, 23, 14, 29, 29, 14, 23, + 14, 14, 23, 15, 14, 14, 29, 29, 67, 92, + 67, 89, 23, 14, 67, 23, 14, 14, 23, 67, + 67, 23, 67, 14, 6, 29, 6, 6, 34, 29, + 23, 37, -1, 40, -1, 42, 36, 40, -1, 15, + 14, 23, 45, 23, 23, 14, 40, 67, 42, 67, + 67, 40, 40, 42, 42, 40, 40, 23, 23, 40, + 14, 45, 40, 48, 45, 40, 44, 40, 40, 44, + 40, 29, 40, 46, 46, 45, 40, 45, 36, 40, + 40, 45, 42, 34, 67, 46, 37, 40, 81, 42, + 64, 40, 40, 23, 42, 64, 67, 40, 14, 40, + 40, -1, 32, 52, 40, 46, 42, 50, -1, 40, + 64, 42, 40, 96, 42, 40, 56, 42, 83, 40, + 34, 42, 40, 37, 42, 40, -1, 40, -1, 95, + 101, 44, 40, 40, 42, 42, 40, 40, 42, 54, + 40, 40, 45, -1, 43, 45, 40, 40, 64, 42, + 40, 45, 42, 40, 40, 40, 40, 43, 45, 40, + 45, 45, 40, -1, 45, 40, 40, 45, 49, 40, + 45, 45, 40, -1, 45, 40, 47, 45, 62, 57, + 45, 40, 23, -1, 40, 53, 45, 62, 62, 45, + 40, 32, 33, 40, 40, 45, 55, 62, 45, 45, + 47, 11, 40, -1, -1, 51, 62, 45, -1, 47, + -1, 21, 22, 23, 8, -1, -1, 11, 14, 15, + 16, 17, 18, 19, -1, -1, -1, 21, 22, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 40, -1, -1, -1, -1, 45, -1, + 47, -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, -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}; diff --git a/src/declarative/qml/parser/javascriptgrammar_p.h b/src/declarative/qml/parser/javascriptgrammar_p.h index 2e78a77..de83cd0 100644 --- a/src/declarative/qml/parser/javascriptgrammar_p.h +++ b/src/declarative/qml/parser/javascriptgrammar_p.h @@ -150,15 +150,15 @@ public: T_XOR = 78, T_XOR_EQ = 79, - ACCEPT_STATE = 557, - RULE_COUNT = 322, - STATE_COUNT = 558, + ACCEPT_STATE = 584, + RULE_COUNT = 321, + STATE_COUNT = 585, TERMINAL_COUNT = 91, - NON_TERMINAL_COUNT = 104, + NON_TERMINAL_COUNT = 103, - GOTO_INDEX_OFFSET = 558, - GOTO_INFO_OFFSET = 1714, - GOTO_CHECK_OFFSET = 1714 + GOTO_INDEX_OFFSET = 585, + GOTO_INFO_OFFSET = 1825, + GOTO_CHECK_OFFSET = 1825 }; static const char *const spell []; diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp index 4369771..cf17c02 100644 --- a/src/declarative/qml/parser/javascriptparser.cpp +++ b/src/declarative/qml/parser/javascriptparser.cpp @@ -53,6 +53,7 @@ #include "javascriptparser_p.h" +#include // // This file is automatically generated from javascript.g. @@ -114,6 +115,34 @@ static inline AST::SourceLocation location(Lexer *lexer) return loc; } +AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) +{ + QVarLengthArray nameIds; + QVarLengthArray locations; + + AST::ExpressionNode *it = expr; + while (AST::FieldMemberExpression *m = AST::cast(it)) { + nameIds.append(m->name); + locations.append(m->identifierToken); + it = m->base; + } + + if (AST::IdentifierExpression *idExpr = AST::cast(it)) { + AST::UiQualifiedId *q = makeAstNode(driver->nodePool(), idExpr->name); + q->identifierToken = idExpr->identifierToken; + + AST::UiQualifiedId *currentId = q; + for (int i = nameIds.size() - 1; i != -1; --i) { + currentId = makeAstNode(driver->nodePool(), currentId, nameIds[i]); + currentId->identifierToken = locations[i]; + } + + return currentId->finish(); + } + + return 0; +} + bool Parser::parse() { Lexer *lexer = driver->lexer(); @@ -234,21 +263,12 @@ case 14: { } break; case 15: { - AST::UiObjectBinding *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId->finish(), - sym(3).sval, sym(4).UiObjectInitializer); - node->colonToken = loc(2); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; - -case 16: { - AST::UiObjectDefinition *node = makeAstNode (driver->nodePool(), sym(1).sval, + AST::UiObjectDefinition *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId->finish(), sym(2).UiObjectInitializer); - node->identifierToken = loc(1); sym(1).Node = node; } break; -case 18: { +case 17: { AST::UiArrayBinding *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId->finish(), sym(4).UiObjectMemberList->finish()); node->colonToken = loc(2); @@ -257,33 +277,49 @@ case 18: { sym(1).Node = node; } break; -case 19: { +case 18: { AST::StringLiteral *node = makeAstNode (driver->nodePool(), sym(1).sval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 21: { +case 20: { AST::ExpressionStatement *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 28: { +case 21: { + if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(3).Expression)) { + AST::UiObjectBinding *node = makeAstNode (driver->nodePool(), + sym(1).UiQualifiedId->finish(), qualifiedId, sym(4).UiObjectInitializer); + node->colonToken = loc(2); + sym(1).Node = node; + } else { + sym(1).Node = 0; + + diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(2), + "Expected a type name after token `:'")); + + return false; // ### recover + } +} break; +case 22:case 23:case 24:case 25:case 26:case 27: +{ AST::UiScriptBinding *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId->finish(), sym(3).Statement); node->colonToken = loc(2); sym(1).Node = node; } break; -case 29: +case 28: -case 30: { +case 29: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); break; } -case 32: { +case 31: { AST::UiPublicMember *node = makeAstNode (driver->nodePool(), (NameId *)0, sym(2).sval); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); @@ -292,7 +328,7 @@ case 32: { sym(1).Node = node; } break; -case 34: { +case 33: { AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(3).sval); node->propertyToken = loc(1); node->typeToken = loc(2); @@ -301,7 +337,7 @@ case 34: { sym(1).Node = node; } break; -case 36: { +case 35: { AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(4).sval); node->isDefaultMember = true; node->defaultToken = loc(1); @@ -312,7 +348,7 @@ case 36: { sym(1).Node = node; } break; -case 38: { +case 37: { AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(3).sval, sym(5).Expression); node->propertyToken = loc(1); @@ -323,7 +359,7 @@ case 38: { sym(1).Node = node; } break; -case 40: { +case 39: { AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(4).sval, sym(6).Expression); node->isDefaultMember = true; @@ -336,88 +372,88 @@ case 40: { sym(1).Node = node; } break; -case 41: { +case 40: { sym(1).Node = makeAstNode(driver->nodePool(), sym(1).Node); } break; -case 42: { +case 41: { sym(1).Node = makeAstNode(driver->nodePool(), sym(1).Node); } break; -case 43: -case 44: +case 42: +case 43: { AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 46: { +case 45: { QString s = QLatin1String(JavaScriptGrammar::spell[T_PROPERTY]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 47: { +case 46: { QString s = QLatin1String(JavaScriptGrammar::spell[T_SIGNAL]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 48: { +case 47: { AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 49: { +case 48: { AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 50: { +case 49: { AST::ThisExpression *node = makeAstNode (driver->nodePool()); node->thisToken = loc(1); sym(1).Node = node; } break; -case 51: { +case 50: { AST::IdentifierExpression *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 52: { +case 51: { AST::NullExpression *node = makeAstNode (driver->nodePool()); node->nullToken = loc(1); sym(1).Node = node; } break; -case 53: { +case 52: { AST::TrueLiteral *node = makeAstNode (driver->nodePool()); node->trueToken = loc(1); sym(1).Node = node; } break; -case 54: { +case 53: { AST::FalseLiteral *node = makeAstNode (driver->nodePool()); node->falseToken = loc(1); sym(1).Node = node; } break; -case 55: { +case 54: { AST::NumericLiteral *node = makeAstNode (driver->nodePool(), sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 56: { +case 55: { AST::StringLiteral *node = makeAstNode (driver->nodePool(), sym(1).sval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 57: { +case 56: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -428,7 +464,7 @@ case 57: { sym(1).Node = node; } break; -case 58: { +case 57: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -439,21 +475,21 @@ case 58: { sym(1).Node = node; } break; -case 59: { +case 58: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).Elision); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 60: { +case 59: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 61: { +case 60: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision); node->lbracketToken = loc(1); node->commaToken = loc(3); @@ -461,7 +497,7 @@ case 61: { sym(1).Node = node; } break; -case 62: { +case 61: { AST::ObjectLiteral *node = 0; if (sym(2).Node) node = makeAstNode (driver->nodePool(), @@ -473,7 +509,7 @@ case 62: { sym(1).Node = node; } break; -case 63: { +case 62: { AST::ObjectLiteral *node = makeAstNode (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); @@ -481,51 +517,51 @@ case 63: { sym(1).Node = node; } break; -case 64: { +case 63: { AST::NestedExpression *node = makeAstNode(driver->nodePool(), sym(2).Expression); node->lparenToken = loc(1); node->rparenToken = loc(3); sym(1).Node = node; } break; -case 65: { +case 64: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Elision, sym(2).Expression); } break; -case 66: { +case 65: { AST::ElementList *node = makeAstNode (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 67: { +case 66: { AST::Elision *node = makeAstNode (driver->nodePool()); node->commaToken = loc(1); sym(1).Node = node; } break; -case 68: { +case 67: { AST::Elision *node = makeAstNode (driver->nodePool(), sym(1).Elision); node->commaToken = loc(2); sym(1).Node = node; } break; -case 69: { +case 68: { sym(1).Node = 0; } break; -case 70: { +case 69: { sym(1).Elision = sym(1).Elision->finish (); } break; -case 71: { +case 70: { AST::PropertyNameAndValueList *node = makeAstNode (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; -case 72: { +case 71: { AST::PropertyNameAndValueList *node = makeAstNode (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); @@ -533,36 +569,38 @@ case 72: { sym(1).Node = node; } break; -case 73: { +case 72: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 74: -case 75: { +case 73: +case 74: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 76: { +case 75: { AST::StringLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 77: { +case 76: { AST::NumericLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 78: { +case 77: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; +case 78: + case 79: case 80: @@ -622,27 +660,25 @@ case 106: case 107: case 108: - -case 109: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); } break; -case 114: { +case 113: { AST::ArrayMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 115: { +case 114: { AST::FieldMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 116: { +case 115: { AST::NewMemberExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); @@ -650,384 +686,384 @@ case 116: { sym(1).Node = node; } break; -case 118: { +case 117: { AST::NewExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; -case 119: { +case 118: { AST::CallExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 120: { +case 119: { AST::CallExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 121: { +case 120: { AST::ArrayMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 122: { +case 121: { AST::FieldMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 123: { +case 122: { sym(1).Node = 0; } break; -case 124: { +case 123: { sym(1).Node = sym(1).ArgumentList->finish(); } break; -case 125: { +case 124: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Expression); } break; -case 126: { +case 125: { AST::ArgumentList *node = makeAstNode (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 130: { +case 129: { AST::PostIncrementExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; -case 131: { +case 130: { AST::PostDecrementExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; -case 133: { +case 132: { AST::DeleteExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; -case 134: { +case 133: { AST::VoidExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; -case 135: { +case 134: { AST::TypeOfExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; -case 136: { +case 135: { AST::PreIncrementExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; -case 137: { +case 136: { AST::PreDecrementExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; -case 138: { +case 137: { AST::UnaryPlusExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; -case 139: { +case 138: { AST::UnaryMinusExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; -case 140: { +case 139: { AST::TildeExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; -case 141: { +case 140: { AST::NotExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; -case 143: { +case 142: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 144: { +case 143: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 145: { +case 144: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 147: { +case 146: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 148: { +case 147: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 150: { +case 149: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 151: { +case 150: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 152: { +case 151: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 154: { +case 153: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 155: { +case 154: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 156: { +case 155: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 157: { +case 156: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 158: { +case 157: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 159: { +case 158: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 161: { +case 160: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 162: { +case 161: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 163: { +case 162: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 164: { +case 163: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 165: { +case 164: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 167: { +case 166: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 168: { +case 167: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 169: { +case 168: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 170: { +case 169: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 172: { +case 171: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 173: { +case 172: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 174: { +case 173: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 175: { +case 174: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 177: { +case 176: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 179: { +case 178: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 181: { +case 180: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 183: { +case 182: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 185: { +case 184: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 187: { +case 186: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 189: { +case 188: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 191: { +case 190: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 193: { +case 192: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 195: { +case 194: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 197: { +case 196: { AST::ConditionalExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1035,7 +1071,7 @@ case 197: { sym(1).Node = node; } break; -case 199: { +case 198: { AST::ConditionalExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1043,112 +1079,112 @@ case 199: { sym(1).Node = node; } break; -case 201: { +case 200: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 203: { +case 202: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 204: { +case 203: { sym(1).ival = QSOperator::Assign; } break; -case 205: { +case 204: { sym(1).ival = QSOperator::InplaceMul; } break; -case 206: { +case 205: { sym(1).ival = QSOperator::InplaceDiv; } break; -case 207: { +case 206: { sym(1).ival = QSOperator::InplaceMod; } break; -case 208: { +case 207: { sym(1).ival = QSOperator::InplaceAdd; } break; -case 209: { +case 208: { sym(1).ival = QSOperator::InplaceSub; } break; -case 210: { +case 209: { sym(1).ival = QSOperator::InplaceLeftShift; } break; -case 211: { +case 210: { sym(1).ival = QSOperator::InplaceRightShift; } break; -case 212: { +case 211: { sym(1).ival = QSOperator::InplaceURightShift; } break; -case 213: { +case 212: { sym(1).ival = QSOperator::InplaceAnd; } break; -case 214: { +case 213: { sym(1).ival = QSOperator::InplaceXor; } break; -case 215: { +case 214: { sym(1).ival = QSOperator::InplaceOr; } break; -case 217: { +case 216: { AST::Expression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 218: { +case 217: { sym(1).Node = 0; } break; -case 221: { +case 220: { AST::Expression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 222: { +case 221: { sym(1).Node = 0; } break; -case 239: { +case 238: { AST::Block *node = makeAstNode (driver->nodePool(), sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 240: { +case 239: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Statement); } break; -case 241: { +case 240: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).StatementList, sym(2).Statement); } break; -case 242: { +case 241: { sym(1).Node = 0; } break; -case 243: { +case 242: { sym(1).Node = sym(1).StatementList->finish (); } break; -case 245: { +case 244: { AST::VariableStatement *node = makeAstNode (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); @@ -1156,76 +1192,76 @@ case 245: { sym(1).Node = node; } break; -case 246: { +case 245: { sym(1).ival = T_CONST; } break; -case 247: { +case 246: { sym(1).ival = T_VAR; } break; -case 248: { +case 247: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 249: { +case 248: { AST::VariableDeclarationList *node = makeAstNode (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; -case 250: { +case 249: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 251: { +case 250: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; -case 252: { +case 251: { AST::VariableDeclaration *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 253: { +case 252: { AST::VariableDeclaration *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 254: { +case 253: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 255: { +case 254: { sym(1).Node = 0; } break; -case 257: { +case 256: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 258: { +case 257: { sym(1).Node = 0; } break; -case 260: { +case 259: { AST::EmptyStatement *node = makeAstNode (driver->nodePool()); node->semicolonToken = loc(1); sym(1).Node = node; } break; -case 262: { +case 261: { AST::ExpressionStatement *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 263: { +case 262: { AST::IfStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1234,7 +1270,7 @@ case 263: { sym(1).Node = node; } break; -case 264: { +case 263: { AST::IfStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1242,7 +1278,7 @@ case 264: { sym(1).Node = node; } break; -case 266: { +case 265: { AST::DoWhileStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); @@ -1252,7 +1288,7 @@ case 266: { sym(1).Node = node; } break; -case 267: { +case 266: { AST::WhileStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); @@ -1260,7 +1296,7 @@ case 267: { sym(1).Node = node; } break; -case 268: { +case 267: { AST::ForStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); @@ -1271,7 +1307,7 @@ case 268: { sym(1).Node = node; } break; -case 269: { +case 268: { AST::LocalForStatement *node = makeAstNode (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); @@ -1284,7 +1320,7 @@ case 269: { sym(1).Node = node; } break; -case 270: { +case 269: { AST:: ForEachStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); @@ -1294,7 +1330,7 @@ case 270: { sym(1).Node = node; } break; -case 271: { +case 270: { AST::LocalForEachStatement *node = makeAstNode (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); @@ -1305,14 +1341,14 @@ case 271: { sym(1).Node = node; } break; -case 273: { +case 272: { AST::ContinueStatement *node = makeAstNode (driver->nodePool()); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 275: { +case 274: { AST::ContinueStatement *node = makeAstNode (driver->nodePool(), sym(2).sval); node->continueToken = loc(1); node->identifierToken = loc(2); @@ -1320,14 +1356,14 @@ case 275: { sym(1).Node = node; } break; -case 277: { +case 276: { AST::BreakStatement *node = makeAstNode (driver->nodePool()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 279: { +case 278: { AST::BreakStatement *node = makeAstNode (driver->nodePool(), sym(2).sval); node->breakToken = loc(1); node->identifierToken = loc(2); @@ -1335,14 +1371,14 @@ case 279: { sym(1).Node = node; } break; -case 281: { +case 280: { AST::ReturnStatement *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 282: { +case 281: { AST::WithStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); @@ -1350,7 +1386,7 @@ case 282: { sym(1).Node = node; } break; -case 283: { +case 282: { AST::SwitchStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); @@ -1358,90 +1394,90 @@ case 283: { sym(1).Node = node; } break; -case 284: { +case 283: { AST::CaseBlock *node = makeAstNode (driver->nodePool(), sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 285: { +case 284: { AST::CaseBlock *node = makeAstNode (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(5); sym(1).Node = node; } break; -case 286: { +case 285: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).CaseClause); } break; -case 287: { +case 286: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); } break; -case 288: { +case 287: { sym(1).Node = 0; } break; -case 289: { +case 288: { sym(1).Node = sym(1).CaseClauses->finish (); } break; -case 290: { +case 289: { AST::CaseClause *node = makeAstNode (driver->nodePool(), sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; -case 291: { +case 290: { AST::DefaultClause *node = makeAstNode (driver->nodePool(), sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 292: -case 293: { +case 291: +case 292: { AST::LabelledStatement *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 294: { +case 293: { AST::LabelledStatement *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 296: { +case 295: { AST::ThrowStatement *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 297: { +case 296: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; -case 298: { +case 297: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 299: { +case 298: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 300: { +case 299: { AST::Catch *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); @@ -1450,20 +1486,20 @@ case 300: { sym(1).Node = node; } break; -case 301: { +case 300: { AST::Finally *node = makeAstNode (driver->nodePool(), sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; -case 303: { +case 302: { AST::DebuggerStatement *node = makeAstNode (driver->nodePool()); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 304: { +case 303: { AST::FunctionDeclaration *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); @@ -1474,7 +1510,7 @@ case 304: { sym(1).Node = node; } break; -case 305: { +case 304: { AST::FunctionExpression *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (sym(2).sval) @@ -1486,56 +1522,56 @@ case 305: { sym(1).Node = node; } break; -case 306: { +case 305: { AST::FormalParameterList *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 307: { +case 306: { AST::FormalParameterList *node = makeAstNode (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 308: { +case 307: { sym(1).Node = 0; } break; -case 309: { +case 308: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; -case 310: { +case 309: { sym(1).Node = 0; } break; -case 312: { +case 311: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElements->finish ()); } break; -case 313: { +case 312: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElement); } break; -case 314: { +case 313: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); } break; -case 315: { +case 314: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Statement); } break; -case 316: { +case 315: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).FunctionDeclaration); } break; -case 317: { +case 316: { sym(1).sval = 0; } break; -case 319: { +case 318: { sym(1).Node = 0; } break; diff --git a/src/declarative/qml/parser/javascriptparser_p.h b/src/declarative/qml/parser/javascriptparser_p.h index aa29ff3..4c5fef1 100644 --- a/src/declarative/qml/parser/javascriptparser_p.h +++ b/src/declarative/qml/parser/javascriptparser_p.h @@ -160,6 +160,8 @@ protected: inline AST::SourceLocation &loc(int index) { return location_stack [tos + index - 1]; } + AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr); + protected: Engine *driver; int tos; @@ -194,9 +196,9 @@ protected: -#define J_SCRIPT_REGEXPLITERAL_RULE1 57 +#define J_SCRIPT_REGEXPLITERAL_RULE1 56 -#define J_SCRIPT_REGEXPLITERAL_RULE2 58 +#define J_SCRIPT_REGEXPLITERAL_RULE2 57 QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index 9d6b018..e0265c7 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -62,18 +62,16 @@ public: void operator()(const QString &code, AST::Node *node); protected: - Object *defineObjectBinding(int line, - AST::UiQualifiedId *propertyName, - const QString &objectType, - AST::SourceLocation typeLocation, - LocationSpan location, - AST::UiObjectInitializer *initializer = 0); - Object *defineObjectBinding_helper(int line, - AST::UiQualifiedId *propertyName, - const QString &objectType, - AST::SourceLocation typeLocation, - LocationSpan location, - AST::UiObjectInitializer *initializer = 0); + Object *defineObjectBinding(AST::UiQualifiedId *propertyName, + AST::UiQualifiedId *objectTypeName, + LocationSpan location, + AST::UiObjectInitializer *initializer = 0); + + Object *defineObjectBinding_helper(AST::UiQualifiedId *propertyName, + const QString &objectType, + AST::SourceLocation typeLocation, + LocationSpan location, + AST::UiObjectInitializer *initializer = 0); QmlParser::Variant getVariant(AST::ExpressionNode *expr); @@ -199,8 +197,7 @@ QString ProcessAST::asString(AST::UiQualifiedId *node) const } Object * -ProcessAST::defineObjectBinding_helper(int line, - AST::UiQualifiedId *propertyName, +ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, const QString &objectType, AST::SourceLocation typeLocation, LocationSpan location, @@ -283,16 +280,17 @@ ProcessAST::defineObjectBinding_helper(int line, } } -Object *ProcessAST::defineObjectBinding(int line, - AST::UiQualifiedId *qualifiedId, - const QString &objectType, - AST::SourceLocation typeLocation, - LocationSpan location, - AST::UiObjectInitializer *initializer) +Object *ProcessAST::defineObjectBinding(AST::UiQualifiedId *qualifiedId, + AST::UiQualifiedId *objectTypeName, + LocationSpan location, + AST::UiObjectInitializer *initializer) { + const QString objectType = asString(objectTypeName); + const AST::SourceLocation typeLocation = objectTypeName->identifierToken; + if (objectType == QLatin1String("Connection")) { - Object *obj = defineObjectBinding_helper(line, 0, objectType, typeLocation, location); + Object *obj = defineObjectBinding_helper(/*propertyName = */0, objectType, typeLocation, location); _stateStack.pushObject(obj); @@ -331,7 +329,7 @@ Object *ProcessAST::defineObjectBinding(int line, return obj; } - return defineObjectBinding_helper(line, qualifiedId, objectType, typeLocation, location, initializer); + return defineObjectBinding_helper(qualifiedId, objectType, typeLocation, location, initializer); } LocationSpan ProcessAST::location(AST::UiQualifiedId *id) @@ -446,16 +444,14 @@ bool ProcessAST::visit(AST::UiPublicMember *node) } -// UiObjectMember: T_IDENTIFIER UiObjectInitializer ; +// UiObjectMember: UiQualifiedId UiObjectInitializer ; bool ProcessAST::visit(AST::UiObjectDefinition *node) { LocationSpan l = location(node->firstSourceLocation(), - node->lastSourceLocation());; + node->lastSourceLocation()); - defineObjectBinding(node->identifierToken.startLine, - 0, - node->name->asString(), - node->identifierToken, + defineObjectBinding(/*propertyName = */ 0, + node->qualifiedObjectNameId, l, node->initializer); @@ -463,16 +459,14 @@ bool ProcessAST::visit(AST::UiObjectDefinition *node) } -// UiObjectMember: UiQualifiedId T_COLON T_IDENTIFIER UiObjectInitializer ; +// UiObjectMember: UiQualifiedId T_COLON UiQualifiedId UiObjectInitializer ; bool ProcessAST::visit(AST::UiObjectBinding *node) { - LocationSpan l; - l = location(node->identifierToken, node->initializer->rbraceToken); + LocationSpan l = location(node->qualifiedObjectNameId->identifierToken, + node->initializer->rbraceToken); - defineObjectBinding(node->identifierToken.startLine, - node->qualifiedId, - node->name->asString(), - node->identifierToken, + defineObjectBinding(node->qualifiedId, + node->qualifiedObjectNameId, l, node->initializer); -- cgit v0.12 From 60a17320d39eed9cd82f38d07495161b2b2d5e42 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Mon, 18 May 2009 11:23:05 +0200 Subject: Add an extension to QPixmapCache to get rid of strings. This commit add a new API to add/find/remove pixmaps into QPixmapCache. This new extension is based on a key that the cache give you during the insertion. This key is internally a int which makes all operations in the cache much more faster that the string approach. Auto-tests has been extended as well and a benchmark has been added to compare both approach. I also depecrate the find method for the string API to have a method pointer based and not reference based like the Qt policy says. Reviewed-by: bnilsen Reviewed-by: andreas Followed-deeply-by: trond --- .../snippets/code/src_gui_image_qpixmapcache.cpp | 2 +- src/gui/graphicsview/qgraphicsitem.cpp | 11 +- src/gui/graphicsview/qgraphicsitem_p.h | 6 +- src/gui/graphicsview/qgraphicsscene.cpp | 31 +- src/gui/image/image.pri | 1 + src/gui/image/qpixmapcache.cpp | 365 ++++++++++++++++++--- src/gui/image/qpixmapcache.h | 27 +- src/gui/image/qpixmapcache_p.h | 92 ++++++ tests/auto/qpixmapcache/tst_qpixmapcache.cpp | 258 ++++++++++++++- .../benchmarks/qgraphicsview/tst_qgraphicsview.cpp | 1 - tests/benchmarks/qpixmapcache/qpixmapcache.pro | 6 + tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp | 226 +++++++++++++ 12 files changed, 935 insertions(+), 91 deletions(-) create mode 100644 src/gui/image/qpixmapcache_p.h create mode 100644 tests/benchmarks/qpixmapcache/qpixmapcache.pro create mode 100644 tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp diff --git a/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp b/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp index c4b6353..2a04f64 100644 --- a/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp +++ b/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp @@ -13,7 +13,7 @@ painter->drawPixmap(0, 0, p); //! [1] QPixmap pm; -if (!QPixmapCache::find("my_big_image", pm)) { +if (!QPixmapCache::find("my_big_image", &pm)) { pm.load("bigimage.png"); QPixmapCache::insert("my_big_image", pm); } diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index ec08aaf..72b832a 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -978,6 +978,7 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con void QGraphicsItemCache::purge() { QPixmapCache::remove(key); + key = QPixmapCache::Key(); QMutableMapIterator it(deviceData); while (it.hasNext()) { DeviceData &data = it.next().value(); @@ -1426,12 +1427,6 @@ void QGraphicsItem::setCacheMode(CacheMode mode, const QSize &logicalCacheSize) cache->purge(); if (mode == ItemCoordinateCache) { - if (cache->key.isEmpty()) { - // Generate new simple pixmap cache key. - QString tmp; - tmp.sprintf("qgv-%p", this); - cache->key = tmp; - } if (lastMode == mode && cache->fixedSize == logicalCacheSize) noVisualChange = true; cache->fixedSize = logicalCacheSize; @@ -4205,7 +4200,7 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect) && (d->cacheMode == ItemCoordinateCache && !c->fixedSize.isValid()); if (scrollCache) { QPixmap pix; - if (QPixmapCache::find(c->key, pix)) { + if (QPixmapCache::find(c->key, &pix)) { // Adjust with 2 pixel margin. Notice the loss of precision // when converting to QRect. int adjust = 2; @@ -4214,7 +4209,7 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect) _q_scrollPixmap(&pix, irect, dx, dy); - QPixmapCache::insert(c->key, pix); + QPixmapCache::replace(c->key, pix); // Translate the existing expose. foreach (QRectF exposedRect, c->exposed) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 82a48fb..820ef04 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -54,6 +54,7 @@ // #include "qgraphicsitem.h" +#include "qpixmapcache.h" #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW @@ -69,13 +70,14 @@ public: // ItemCoordinateCache only QRect boundingRect; QSize fixedSize; - QString key; + QPixmapCache::Key key; // DeviceCoordinateCache only struct DeviceData { + DeviceData() {} QTransform lastTransform; QPoint cacheIndent; - QString key; + QPixmapCache::Key key; }; QMap deviceData; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 7318fa5..1fbda85 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4743,8 +4743,9 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte return; // Fetch the off-screen transparent buffer and exposed area info. - QString pixmapKey; + QPixmapCache::Key pixmapKey; QPixmap pix; + bool pixmapFound; QGraphicsItemCache *itemCache = itemd->extraItemCache(); if (cacheMode == QGraphicsItem::ItemCoordinateCache) { if (itemCache->boundingRect != brect.toRect()) { @@ -4754,17 +4755,14 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte } pixmapKey = itemCache->key; } else { - if ((pixmapKey = itemCache->deviceData.value(widget).key).isEmpty()) { - pixmapKey.sprintf("qgv-%p-%p", item, widget); - QGraphicsItemCache::DeviceData data; - data.key = pixmapKey; - itemCache->deviceData.insert(widget, data); - } + pixmapKey = itemCache->deviceData.value(widget).key; } // Find pixmap in cache. if (!itemCache->allExposed) - QPixmapCache::find(pixmapKey, pix); + pixmapFound = QPixmapCache::find(pixmapKey, &pix); + else + pixmapFound = false; // Render using item coordinate cache mode. if (cacheMode == QGraphicsItem::ItemCoordinateCache) { @@ -4817,8 +4815,12 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(), &cacheOption, painterStateProtection); - // Reinsert this pixmap into the cache. - QPixmapCache::insert(pixmapKey, pix); + if (!pixmapFound) { + // insert this pixmap into the cache. + itemCache->key = QPixmapCache::insert(pix); + } else { + QPixmapCache::replace(pixmapKey, pix); + } // Reset expose data. itemCache->allExposed = false; @@ -4985,8 +4987,13 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte } if (pixModified) { - // Reinsert this pixmap into the cache - QPixmapCache::insert(pixmapKey, pix); + if (!pixmapFound) { + // Insert this pixmap into the cache. + deviceData->key = QPixmapCache::insert(pix); + } else { + //otherwise we replace the pixmap in the cache + QPixmapCache::replace(pixmapKey, pix); + } } // Redraw the exposed area using an untransformed painter. This diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index ca52974..bf348af 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -22,6 +22,7 @@ HEADERS += \ image/qpixmap.h \ image/qpixmap_raster_p.h \ image/qpixmapcache.h \ + image/qpixmapcache_p.h \ image/qpixmapdata_p.h \ image/qpixmapdatafactory_p.h \ image/qpixmapfilter_p.h diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 4916489..810ce65 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -40,13 +40,9 @@ ****************************************************************************/ #include "qpixmapcache.h" -#include "qcache.h" #include "qobject.h" #include "qdebug.h" - -#include "qpaintengine.h" -#include -#include +#include "qpixmapcache_p.h" QT_BEGIN_NAMESPACE @@ -68,15 +64,17 @@ QT_BEGIN_NAMESPACE access the global pixmap cache. It creates an internal QCache object for caching the pixmaps. - The cache associates a pixmap with a string (key). If two pixmaps - are inserted into the cache using equal keys, then the last pixmap - will hide the first pixmap. The QHash and QCache classes do + The cache associates a pixmap with a string as a key or with a QPixmapCache::Key. + The QPixmapCache::Key is faster than using strings as key. + If two pixmaps are inserted into the cache using equal keys, then the + last pixmap will hide the first pixmap. The QHash and QCache classes do exactly the same. The cache becomes full when the total size of all pixmaps in the - cache exceeds cacheLimit(). The initial cache limit is 1024 KB (1 - MB); it is changed with setCacheLimit(). A pixmap takes roughly - (\e{width} * \e{height} * \e{depth})/8 bytes of memory. + cache exceeds cacheLimit(). The initial cache limit is + 2048 KB(2 MB) for Embedded, 10240 KB (10 + MB) for Desktops; it is changed with setCacheLimit(). + A pixmap takes roughly (\e{width} * \e{height} * \e{depth})/8 bytes of memory. The \e{Qt Quarterly} article \l{http://doc.trolltech.com/qq/qq12-qpixmapcache.html}{Optimizing @@ -92,52 +90,117 @@ static int cache_limit = 2048; // 2048 KB cache limit for embedded static int cache_limit = 10240; // 10 MB cache limit for desktop #endif -// XXX: hw: is this a general concept we need to abstract? -class QDetachedPixmap : public QPixmap +/*! + Constructs an empty Key object. +*/ +QPixmapCache::Key::Key() : d(0) { -public: - QDetachedPixmap(const QPixmap &pix) : QPixmap(pix) - { - if (data && data->classId() == QPixmapData::RasterClass) { - QRasterPixmapData *d = static_cast(data); - if (!d->image.isNull() && d->image.d->paintEngine - && !d->image.d->paintEngine->isActive()) - { - delete d->image.d->paintEngine; - d->image.d->paintEngine = 0; - } - } +} + +/*! + \internal + Constructs a copy of \a other. +*/ +QPixmapCache::Key::Key(const Key &other) +{ + if (other.d) + ++(other.d->ref); + d = other.d; +} + +/*! + Destructor; called immediately before the object is deleted. +*/ +QPixmapCache::Key::~Key() +{ + if (d && --(d->ref) == 0) + delete d; +} + +/*! + \internal + + Returns true if this key is the same as the given \a key. +*/ +bool QPixmapCache::Key::operator ==(const Key &key) const +{ + return (d == key.d); +} + +/*! + \internal +*/ +QPixmapCache::Key &QPixmapCache::Key::operator =(const Key &other) +{ + if (d != other.d) { + if (other.d) + ++(other.d->ref); + if (d && --(d->ref) == 0) + delete d; + d = other.d; } -}; + return *this; +} -class QPMCache : public QObject, public QCache +class QPMCache : public QObject, public QCache { Q_OBJECT public: - QPMCache() - : QObject(0), - QCache(cache_limit * 1024), - theid(0), ps(0), t(false) { } - ~QPMCache() { } + QPMCache(); + ~QPMCache(); void timerEvent(QTimerEvent *); bool insert(const QString& key, const QPixmap &pixmap, int cost); + QPixmapCache::Key insert(const QPixmap &pixmap, int cost); + bool replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int cost); bool remove(const QString &key); + bool remove(const QPixmapCache::Key &key); + + void resizeKeyArray(int size); + QPixmapCache::Key createKey(); + void releaseKey(const QPixmapCache::Key &key); + void clear(); QPixmap *object(const QString &key) const; + QPixmap *object(const QPixmapCache::Key &key) const; + + static inline QPixmapCache::KeyData *get(const QPixmapCache::Key &key) + {return key.d;} + + static QPixmapCache::KeyData* getKeyData(QPixmapCache::Key *key); private: - QHash cacheKeys; + int *keyArray; int theid; int ps; + int keyArraySize; + int freeKey; + QHash cacheKeys; bool t; }; + QT_BEGIN_INCLUDE_NAMESPACE #include "qpixmapcache.moc" QT_END_INCLUDE_NAMESPACE +static uint qHash(const QPixmapCache::Key &k) +{ + return qHash(QPMCache::get(k)->key); +} + +QPMCache::QPMCache() + : QObject(0), + QCache(cache_limit * 1024), + keyArray(0), theid(0), ps(0), keyArraySize(0), freeKey(0), t(false) +{ +} +QPMCache::~QPMCache() +{ + free(keyArray); +} + /* - This is supposed to cut the cache size down by about 80-90% in a + This is supposed to cut the cache size down by about 25% in a minute once the application becomes idle, to let any inserted pixmap remain in the cache for some time before it becomes a candidate for cleaning-up, and to not cut down the size of the cache while the @@ -146,23 +209,28 @@ QT_END_INCLUDE_NAMESPACE When the last pixmap has been deleted from the cache, kill the timer so Qt won't keep the CPU from going into sleep mode. */ - void QPMCache::timerEvent(QTimerEvent *) { int mc = maxCost(); bool nt = totalCost() == ps; + QList keys = QCache::keys(); setMaxCost(nt ? totalCost() * 3 / 4 : totalCost() -1); setMaxCost(mc); ps = totalCost(); - QHash::iterator it = cacheKeys.begin(); + QHash::iterator it = cacheKeys.begin(); while (it != cacheKeys.end()) { if (!contains(it.value())) { + releaseKey(it.value()); it = cacheKeys.erase(it); } else { ++it; } } + for (int i = 0; i < keys.size(); ++i) { + if (!contains(keys.at(i))) + releaseKey(keys.at(i)); + } if (!size()) { killTimer(theid); @@ -176,38 +244,154 @@ void QPMCache::timerEvent(QTimerEvent *) QPixmap *QPMCache::object(const QString &key) const { - return QCache::object(cacheKeys.value(key, -1)); + QPixmapCache::Key cacheKey = cacheKeys.value(key); + if (!cacheKey.d || !cacheKey.d->isValid) { + const_cast(this)->cacheKeys.remove(key); + return 0; + } + QPixmap *ptr = QCache::object(cacheKey); + //We didn't find the pixmap in the cache, the key is not valid anymore + if (!ptr) { + const_cast(this)->cacheKeys.remove(key); + const_cast(this)->releaseKey(cacheKey); + } + return ptr; } +QPixmap *QPMCache::object(const QPixmapCache::Key &key) const +{ + Q_ASSERT(key.d->isValid); + QPixmap *ptr = QCache::object(key); + //We didn't find the pixmap in the cache, the key is not valid anymore + if (!ptr) + const_cast(this)->releaseKey(key); + return ptr; +} bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost) { - qint64 cacheKey = pixmap.cacheKey(); - if (QCache::object(cacheKey)) { + QPixmapCache::Key cacheKey; + QPixmapCache::Key oldCacheKey = cacheKeys.value(key); + //If for the same key we add already a pixmap we should delete it + if (oldCacheKey.d) { + QCache::remove(oldCacheKey); + cacheKey = oldCacheKey; + } else { + cacheKey = createKey(); + } + + bool success = QCache::insert(cacheKey, new QDetachedPixmap(pixmap), cost); + if (success) { cacheKeys.insert(key, cacheKey); - return true; + if (!theid) { + theid = startTimer(30000); + t = false; + } + } else { + //Insertion failed we released the new allocated key + releaseKey(cacheKey); } - qint64 oldCacheKey = cacheKeys.value(key, -1); - //If for the same key we add already a pixmap we should delete it - if (oldCacheKey != -1) - QCache::remove(oldCacheKey); + return success; +} - bool success = QCache::insert(cacheKey, new QDetachedPixmap(pixmap), cost); +QPixmapCache::Key QPMCache::insert(const QPixmap &pixmap, int cost) +{ + QPixmapCache::Key cacheKey = createKey(); + bool success = QCache::insert(cacheKey, new QDetachedPixmap(pixmap), cost); if (success) { - cacheKeys.insert(key, cacheKey); if (!theid) { theid = startTimer(30000); t = false; } + } else { + //Insertion failed we released the key and return an invalid one + releaseKey(cacheKey); + } + return cacheKey; +} + +bool QPMCache::replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int cost) +{ + Q_ASSERT(key.d->isValid); + //If for the same key we add already a pixmap we should delete it + QCache::remove(key); + + bool success = QCache::insert(key, new QDetachedPixmap(pixmap), cost); + if (success && !theid) { + theid = startTimer(30000); + t = false; } return success; } bool QPMCache::remove(const QString &key) { - qint64 cacheKey = cacheKeys.value(key, -1); + QPixmapCache::Key cacheKey = cacheKeys.value(key); + //The key was not in the cache + if (!cacheKey.d) + return false; cacheKeys.remove(key); - return QCache::remove(cacheKey); + releaseKey(cacheKey); + return QCache::remove(cacheKey); +} + +bool QPMCache::remove(const QPixmapCache::Key &key) +{ + releaseKey(key); + return QCache::remove(key); +} + +void QPMCache::resizeKeyArray(int size) +{ + if (size <= keyArraySize || size == 0) + return; + keyArray = reinterpret_cast(realloc(keyArray, size * sizeof(int))); + for (int i = keyArraySize; i != size; ++i) + keyArray[i] = i + 1; + keyArraySize = size; +} + +QPixmapCache::Key QPMCache::createKey() +{ + if (freeKey == keyArraySize) + resizeKeyArray(keyArraySize ? keyArraySize << 1 : 2); + int id = freeKey; + freeKey = keyArray[id]; + QPixmapCache::Key key; + QPixmapCache::KeyData *d = QPMCache::getKeyData(&key); + d->key = ++id; + return key; +} + +void QPMCache::releaseKey(const QPixmapCache::Key &key) +{ + if (key.d->key > keyArraySize || key.d->key <= 0) + return; + key.d->key--; + keyArray[key.d->key] = freeKey; + freeKey = key.d->key; + key.d->isValid = false; + key.d->key = 0; +} + +void QPMCache::clear() +{ + free(keyArray); + keyArray = 0; + freeKey = 0; + keyArraySize = 0; + //Mark all keys as invalid + QList keys = QCache::keys(); + for (int i = 0; i < keys.size(); ++i) + keys.at(i).d->isValid = false; + QCache::clear(); +} + +QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key) +{ + if (!key->d) + key->d = new QPixmapCache::KeyData; + return key->d; } Q_GLOBAL_STATIC(QPMCache, pm_cache) @@ -222,7 +406,7 @@ Q_GLOBAL_STATIC(QPMCache, pm_cache) \warning If valid, you should copy the pixmap immediately (this is fast). Subsequent insertions into the cache could cause the pointer to become invalid. For this reason, we recommend you use - find(const QString&, QPixmap&) instead. + bool find(const QString&, QPixmap*) instead. Example: \snippet doc/src/snippets/code/src_gui_image_qpixmapcache.cpp 0 @@ -235,6 +419,17 @@ QPixmap *QPixmapCache::find(const QString &key) /*! + \obsolete + + Use bool find(const QString&, QPixmap*) instead. +*/ + +bool QPixmapCache::find(const QString &key, QPixmap& pixmap) +{ + return find(key, &pixmap); +} + +/*! Looks for a cached pixmap associated with the \a key in the cache. If the pixmap is found, the function sets \a pm to that pixmap and returns true; otherwise it leaves \a pm alone and returns false. @@ -243,14 +438,31 @@ QPixmap *QPixmapCache::find(const QString &key) \snippet doc/src/snippets/code/src_gui_image_qpixmapcache.cpp 1 */ -bool QPixmapCache::find(const QString &key, QPixmap& pm) +bool QPixmapCache::find(const QString &key, QPixmap* pixmap) { QPixmap *ptr = pm_cache()->object(key); - if (ptr) - pm = *ptr; + if (ptr && pixmap) + *pixmap = *ptr; return ptr != 0; } +/*! + Looks for a cached pixmap associated with the \a key in the cache. + If the pixmap is found, the function sets \a pm to that pixmap and + returns true; otherwise it leaves \a pm alone and returns false. If + the pixmap is not found, it means that the \a key is not valid anymore, + so it will be released for the next insertion. +*/ +bool QPixmapCache::find(const Key &key, QPixmap* pixmap) +{ + //The key is not valid anymore, a flush happened before probably + if (!key.d || !key.d->isValid) + return false; + QPixmap *ptr = pm_cache()->object(key); + if (ptr && pixmap) + *pixmap = *ptr; + return ptr != 0; +} /*! Inserts a copy of the pixmap \a pm associated with the \a key into @@ -272,9 +484,43 @@ bool QPixmapCache::find(const QString &key, QPixmap& pm) \sa setCacheLimit() */ -bool QPixmapCache::insert(const QString &key, const QPixmap &pm) +bool QPixmapCache::insert(const QString &key, const QPixmap &pixmap) +{ + return pm_cache()->insert(key, pixmap, pixmap.width() * pixmap.height() * pixmap.depth() / 8); +} + +/*! + Inserts a copy of the pixmap \a pm into + the cache and return you the key. The key is always greater than 0. + If the key is equals 0 then the insertion failed. + + When a pixmap is inserted and the cache is about to exceed its + limit, it removes pixmaps until there is enough room for the + pixmap to be inserted. + + The oldest pixmaps (least recently accessed in the cache) are + deleted when more space is needed. + + \sa setCacheLimit(), replace() +*/ +QPixmapCache::Key QPixmapCache::insert(const QPixmap &pixmap) +{ + return pm_cache()->insert(pixmap, pixmap.width() * pixmap.height() * pixmap.depth() / 8); +} + +/*! + Replace the pixmap associated to the \a key into + the cache. It return true if the pixmap \a pm has been correctly + inserted into the cache false otherwise. + + \sa setCacheLimit(), insert() +*/ +bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap) { - return pm_cache()->insert(key, pm, pm.width() * pm.height() * pm.depth() / 8); + //The key is not valid anymore, a flush happened before probably + if (!key.d || !key.d->isValid) + return false; + return pm_cache()->replace(key, pixmap, pixmap.width() * pixmap.height() * pixmap.depth() / 8); } /*! @@ -314,6 +560,17 @@ void QPixmapCache::remove(const QString &key) pm_cache()->remove(key); } +/*! + Removes the pixmap associated with \a key from the cache and release + the key for a future insertion. +*/ +void QPixmapCache::remove(const Key &key) +{ + //The key is not valid anymore, a flush happened before probably + if (!key.d || !key.d->isValid) + return; + pm_cache()->remove(key); +} /*! Removes all pixmaps from the cache. diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h index 2750a88..ae64310 100644 --- a/src/gui/image/qpixmapcache.h +++ b/src/gui/image/qpixmapcache.h @@ -53,12 +53,35 @@ QT_MODULE(Gui) class Q_GUI_EXPORT QPixmapCache { public: + class KeyData; + class Key + { + public: + Key(); + Key(const Key &other); + ~Key(); + bool operator ==(const Key &key) const; + inline bool operator !=(const Key &key) const + { return !operator==(key); } + Key &operator =(const Key &other); + + private: + KeyData *d; + friend class QPMCache; + friend class QPixmapCache; + }; + static int cacheLimit(); static void setCacheLimit(int); static QPixmap *find(const QString &key); - static bool find(const QString &key, QPixmap&); - static bool insert(const QString &key, const QPixmap&); + static bool find(const QString &key, QPixmap &pixmap); + static bool find(const QString &key, QPixmap *pixmap); + static bool find(const Key &key, QPixmap *pixmap); + static bool insert(const QString &key, const QPixmap &pixmap); + static Key insert(const QPixmap &pixmap); + static bool replace(const Key &key, const QPixmap &pixmap); static void remove(const QString &key); + static void remove(const Key &key); static void clear(); }; diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h new file mode 100644 index 0000000..66b30d2 --- /dev/null +++ b/src/gui/image/qpixmapcache_p.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** 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 QPIXMAPCACHE_P_H +#define QPIXMAPCACHE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#include "qpixmapcache.h" +#include "qpaintengine.h" +#include +#include +#include "qcache.h" + +class QPixmapCache::KeyData +{ +public: + KeyData() : isValid(true), key(0), ref(1) {} + KeyData(const KeyData &other) + : isValid(other.isValid), key(other.key), ref(1) {} + ~KeyData() {} + + bool isValid; + int key; + int ref; +}; + +// XXX: hw: is this a general concept we need to abstract? +class QDetachedPixmap : public QPixmap +{ +public: + QDetachedPixmap(const QPixmap &pix) : QPixmap(pix) + { + if (data && data->classId() == QPixmapData::RasterClass) { + QRasterPixmapData *d = static_cast(data); + if (!d->image.isNull() && d->image.d->paintEngine + && !d->image.d->paintEngine->isActive()) + { + delete d->image.d->paintEngine; + d->image.d->paintEngine = 0; + } + } + } +}; + +#endif // QPIXMAPCACHE_P_H diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp index 1f515ff..405ac34 100644 --- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp @@ -44,9 +44,7 @@ #include - - - +#include "../../../src/gui/image/qpixmapcache_p.h" //TESTED_CLASS= @@ -68,10 +66,21 @@ private slots: void setCacheLimit(); void find(); void insert(); + void replace(); void remove(); void clear(); + void pixmapKey(); }; +static QPixmapCache::KeyData* getPrivate(QPixmapCache::Key &key) +{ + return (*reinterpret_cast(&key)); +} + +static QPixmapCache::KeyData** getPrivateRef(QPixmapCache::Key &key) +{ + return (reinterpret_cast(&key)); +} static int originalCacheLimit; @@ -119,6 +128,72 @@ void tst_QPixmapCache::setCacheLimit() QVERIFY(QPixmapCache::find("P1") != 0); delete p1; + + //The int part of the API + p1 = new QPixmap(2, 3); + QPixmapCache::Key key = QPixmapCache::insert(*p1); + QVERIFY(QPixmapCache::find(key, p1) != 0); + delete p1; + + QPixmapCache::setCacheLimit(0); + QVERIFY(QPixmapCache::find(key, p1) == 0); + + p1 = new QPixmap(2, 3); + QPixmapCache::setCacheLimit(1000); + QPixmapCache::replace(key, *p1); + QVERIFY(QPixmapCache::find(key, p1) == 0); + + delete p1; + + //Let check if keys are released when the pixmap cache is + //full or has been flushed. + QPixmapCache::clear(); + p1 = new QPixmap(2, 3); + key = QPixmapCache::insert(*p1); + QVERIFY(QPixmapCache::find(key, p1) != 0); + QPixmapCache::setCacheLimit(0); + QVERIFY(QPixmapCache::find(key, p1) == 0); + QPixmapCache::setCacheLimit(1000); + key = QPixmapCache::insert(*p1); + QCOMPARE(getPrivate(key)->isValid, true); + QCOMPARE(getPrivate(key)->key, 1); + + delete p1; + + //Let check if removing old entries doesn't let you get + // wrong pixmaps + QPixmapCache::clear(); + QPixmap p2; + p1 = new QPixmap(2, 3); + key = QPixmapCache::insert(*p1); + QVERIFY(QPixmapCache::find(key, &p2) != 0); + //we flush the cache + QPixmapCache::setCacheLimit(0); + QPixmapCache::setCacheLimit(1000); + QPixmapCache::Key key2 = QPixmapCache::insert(*p1); + QCOMPARE(getPrivate(key2)->key, 2); + QVERIFY(QPixmapCache::find(key, &p2) == 0); + QVERIFY(QPixmapCache::find(key2, &p2) != 0); + QCOMPARE(p2, *p1); + + delete p1; + + //Here we simulate the flushing when the app is idle + /*QPixmapCache::clear(); + QPixmapCache::setCacheLimit(originalCacheLimit); + p1 = new QPixmap(300, 300); + key = QPixmapCache::insert(*p1); + QCOMPARE(getPrivate(key)->key, 1); + key2 = QPixmapCache::insert(*p1); + key2 = QPixmapCache::insert(*p1); + QPixmapCache::Key key3 = QPixmapCache::insert(*p1); + QTest::qWait(32000); + key2 = QPixmapCache::insert(*p1); + QCOMPARE(getPrivate(key2)->key, 1); + //This old key is not valid anymore after the flush + QCOMPARE(getPrivate(key)->isValid, false); + QVERIFY(QPixmapCache::find(key, &p2) == 0); + delete p1;*/ } void tst_QPixmapCache::find() @@ -137,6 +212,28 @@ void tst_QPixmapCache::find() QPixmap *p3 = QPixmapCache::find("P1"); QVERIFY(p3); QCOMPARE(p1, *p3); + + //The int part of the API + QPixmapCache::Key key = QPixmapCache::insert(p1); + + QVERIFY(QPixmapCache::find(key, &p2)); + QCOMPARE(p2.width(), 10); + QCOMPARE(p2.height(), 10); + QCOMPARE(p1, p2); + + QPixmapCache::clear(); + + key = QPixmapCache::insert(p1); + + //The int part of the API + // make sure it doesn't explode + QList keys; + for (int i = 0; i < 40000; ++i) + QPixmapCache::insert(p1); + + //at that time the first key has been erase because no more place in the cache + QVERIFY(QPixmapCache::find(key, &p1) == 0); + QCOMPARE(getPrivate(key)->isValid, false); } void tst_QPixmapCache::insert() @@ -152,18 +249,22 @@ void tst_QPixmapCache::insert() QPixmapCache::insert("0", p1); // ditto - for (int j = 0; j < 20000; ++j) + for (int j = 0; j < 40000; ++j) QPixmapCache::insert(QString::number(j), p1); int num = 0; - for (int k = 0; k < 20000; ++k) { + for (int k = 0; k < 40000; ++k) { if (QPixmapCache::find(QString::number(k))) ++num; } + if (QPixmapCache::find("0")) + ++num; + int estimatedNum = (1024 * QPixmapCache::cacheLimit()) / ((p1.width() * p1.height() * p1.depth()) / 8); - QVERIFY(estimatedNum - 1 <= num <= estimatedNum + 1); + + QVERIFY(num <= estimatedNum); QPixmap p3; QPixmapCache::insert("null", p3); @@ -176,6 +277,50 @@ void tst_QPixmapCache::insert() QPixmapCache::insert("custom", c2); //We have deleted the old pixmap in the cache for the same key QVERIFY(c1.isDetached()); + + //The int part of the API + // make sure it doesn't explode + QList keys; + for (int i = 0; i < 40000; ++i) + keys.append(QPixmapCache::insert(p1)); + + num = 0; + for (int k = 0; k < 40000; ++k) { + if (QPixmapCache::find(keys.at(k), &p2)) + ++num; + } + + estimatedNum = (1024 * QPixmapCache::cacheLimit()) + / ((p1.width() * p1.height() * p1.depth()) / 8); + QVERIFY(num <= estimatedNum); + QPixmapCache::insert(p3); + +} + +void tst_QPixmapCache::replace() +{ + //The int part of the API + QPixmap p1(10, 10); + p1.fill(Qt::red); + + QPixmap p2(10, 10); + p2.fill(Qt::yellow); + + QPixmapCache::Key key = QPixmapCache::insert(p1); + + QPixmap p3; + QVERIFY(QPixmapCache::find(key, &p3) == 1); + + QPixmapCache::replace(key,p2); + + QVERIFY(QPixmapCache::find(key, &p3) == 1); + + QCOMPARE(p3.width(), 10); + QCOMPARE(p3.height(), 10); + QCOMPARE(p3, p2); + + //Broken keys + QCOMPARE(QPixmapCache::replace(QPixmapCache::Key(), p2), false); } void tst_QPixmapCache::remove() @@ -198,6 +343,40 @@ void tst_QPixmapCache::remove() QPixmapCache::remove("green"); QVERIFY(QPixmapCache::find("green") == 0); + + //The int part of the API + QPixmapCache::clear(); + p1.fill(Qt::red); + QPixmapCache::Key key = QPixmapCache::insert(p1); + p1.fill(Qt::yellow); + + QVERIFY(QPixmapCache::find(key, &p2)); + QVERIFY(p1.toImage() != p2.toImage()); + QVERIFY(p1.toImage() == p1.toImage()); // sanity check + + QPixmapCache::remove(key); + QVERIFY(QPixmapCache::find(key, &p1) == 0); + + //Broken key + QPixmapCache::remove(QPixmapCache::Key()); + QVERIFY(QPixmapCache::find(QPixmapCache::Key(), &p1) == 0); + + //Test if keys are release + QPixmapCache::clear(); + key = QPixmapCache::insert(p1); + QCOMPARE(getPrivate(key)->key, 1); + QPixmapCache::remove(key); + key = QPixmapCache::insert(p1); + QCOMPARE(getPrivate(key)->key, 1); + + //We mix both part of the API + QPixmapCache::clear(); + p1.fill(Qt::red); + QPixmapCache::insert("red", p1); + key = QPixmapCache::insert(p1); + QPixmapCache::remove(key); + QVERIFY(QPixmapCache::find(key, &p1) == 0); + QVERIFY(QPixmapCache::find("red") != 0); } void tst_QPixmapCache::clear() @@ -205,12 +384,11 @@ void tst_QPixmapCache::clear() QPixmap p1(10, 10); p1.fill(Qt::red); - for (int i = 0; i < 20000; ++i) { + for (int i = 0; i < 20000; ++i) QVERIFY(QPixmapCache::find("x" + QString::number(i)) == 0); - } - for (int j = 0; j < 20000; ++j) { + + for (int j = 0; j < 20000; ++j) QPixmapCache::insert(QString::number(j), p1); - } int num = 0; for (int k = 0; k < 20000; ++k) { @@ -221,10 +399,68 @@ void tst_QPixmapCache::clear() QPixmapCache::clear(); - for (int k = 0; k < 20000; ++k) { + for (int k = 0; k < 20000; ++k) QVERIFY(QPixmapCache::find(QString::number(k)) == 0); + + //The int part of the API + QPixmap p2(10, 10); + p2.fill(Qt::red); + + QList keys; + for (int k = 0; k < 20000; ++k) + keys.append(QPixmapCache::insert(p2)); + + QPixmapCache::clear(); + + for (int k = 0; k < 20000; ++k) { + QVERIFY(QPixmapCache::find(keys.at(k), &p1) == 0); + QCOMPARE(getPrivate(keys[k])->isValid, false); } } +void tst_QPixmapCache::pixmapKey() +{ + QPixmapCache::Key key; + //Default constructed keys have no d pointer unless + //we use them + QVERIFY(!getPrivate(key)); + //Let's put a d pointer + QPixmapCache::KeyData** keyd = getPrivateRef(key); + *keyd = new QPixmapCache::KeyData; + QCOMPARE(getPrivate(key)->ref, 1); + QPixmapCache::Key key2; + //Let's put a d pointer + QPixmapCache::KeyData** key2d = getPrivateRef(key2); + *key2d = new QPixmapCache::KeyData; + QCOMPARE(getPrivate(key2)->ref, 1); + key = key2; + QCOMPARE(getPrivate(key2)->ref, 2); + QCOMPARE(getPrivate(key)->ref, 2); + QPixmapCache::Key key3; + //Let's put a d pointer + QPixmapCache::KeyData** key3d = getPrivateRef(key3); + *key3d = new QPixmapCache::KeyData; + QPixmapCache::Key key4 = key3; + QCOMPARE(getPrivate(key3)->ref, 2); + QCOMPARE(getPrivate(key4)->ref, 2); + key4 = key; + QCOMPARE(getPrivate(key4)->ref, 3); + QCOMPARE(getPrivate(key3)->ref, 1); + QPixmapCache::Key key5(key3); + QCOMPARE(getPrivate(key3)->ref, 2); + QCOMPARE(getPrivate(key5)->ref, 2); + + //let test default constructed keys + QPixmapCache::Key key6; + QVERIFY(!getPrivate(key6)); + QPixmapCache::Key key7; + QVERIFY(!getPrivate(key7)); + key6 = key7; + QVERIFY(!getPrivate(key6)); + QVERIFY(!getPrivate(key7)); + QPixmapCache::Key key8(key7); + QVERIFY(!getPrivate(key8)); +} + QTEST_MAIN(tst_QPixmapCache) #include "tst_qpixmapcache.moc" diff --git a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp index a293de4..a06e033 100644 --- a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp @@ -705,7 +705,6 @@ public: QGraphicsPixmapItem::paint(painter,option,widget); //We just want to wait, and we don't want to process the event loop with qWait QTest::qSleep(3); - } protected: void advance(int i) diff --git a/tests/benchmarks/qpixmapcache/qpixmapcache.pro b/tests/benchmarks/qpixmapcache/qpixmapcache.pro new file mode 100644 index 0000000..e0d7543 --- /dev/null +++ b/tests/benchmarks/qpixmapcache/qpixmapcache.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qpixmapcache +TEMPLATE = app +# Input +SOURCES += tst_qpixmapcache.cpp diff --git a/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp b/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp new file mode 100644 index 0000000..f3c1134 --- /dev/null +++ b/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** 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 +//TESTED_FILES= + +class tst_QPixmapCache : public QObject +{ + Q_OBJECT + +public: + tst_QPixmapCache(); + virtual ~tst_QPixmapCache(); + +public slots: + void init(); + void cleanup(); + +private slots: + void insert_data(); + void insert(); + void find_data(); + void find(); + void styleUseCaseComplexKey(); + void styleUseCaseComplexKey_data(); +}; + +tst_QPixmapCache::tst_QPixmapCache() +{ +} + +tst_QPixmapCache::~tst_QPixmapCache() +{ +} + +void tst_QPixmapCache::init() +{ +} + +void tst_QPixmapCache::cleanup() +{ +} + +void tst_QPixmapCache::insert_data() +{ + QTest::addColumn("cacheType"); + QTest::newRow("QPixmapCache") << true; + QTest::newRow("QPixmapCache (int API)") << false; +} + +QList keys; + +void tst_QPixmapCache::insert() +{ + QFETCH(bool, cacheType); + QPixmap p; + if (cacheType) { + QBENCHMARK { + for (int i = 0 ; i <= 10000 ; i++) + { + QString tmp; + tmp.sprintf("my-key-%d", i); + QPixmapCache::insert(tmp, p); + } + } + } else { + QBENCHMARK { + for (int i = 0 ; i <= 10000 ; i++) + keys.append(QPixmapCache::insert(p)); + } + } +} + +void tst_QPixmapCache::find_data() +{ + QTest::addColumn("cacheType"); + QTest::newRow("QPixmapCache") << true; + QTest::newRow("QPixmapCache (int API)") << false; +} + +void tst_QPixmapCache::find() +{ + QFETCH(bool, cacheType); + QPixmap p; + if (cacheType) { + QBENCHMARK { + QString tmp; + for (int i = 0 ; i <= 10000 ; i++) + { + tmp.sprintf("my-key-%d", i); + QPixmapCache::find(tmp, p); + } + } + } else { + QBENCHMARK { + for (int i = 0 ; i <= 10000 ; i++) + QPixmapCache::find(keys.at(i), &p); + } + } + +} + +void tst_QPixmapCache::styleUseCaseComplexKey_data() +{ + QTest::addColumn("cacheType"); + QTest::newRow("QPixmapCache") << true; + QTest::newRow("QPixmapCache (int API)") << false; +} + +struct styleStruct { + QString key; + uint state; + uint direction; + uint complex; + uint palette; + int width; + int height; + bool operator==(const styleStruct &str) const + { + return str.key == key && str.state == state && str.direction == direction + && str.complex == complex && str.palette == palette && str.width == width + && str.height == height; + } +}; + +uint qHash(const styleStruct &myStruct) +{ + return qHash(myStruct.state); +} + +void tst_QPixmapCache::styleUseCaseComplexKey() +{ + QFETCH(bool, cacheType); + QPixmap p; + if (cacheType) { + QBENCHMARK { + for (int i = 0 ; i <= 10000 ; i++) + { + QString tmp; + tmp.sprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200); + QPixmapCache::insert(tmp, p); + } + + for (int i = 0 ; i <= 10000 ; i++) + { + QString tmp; + tmp.sprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200); + QPixmapCache::find(tmp, p); + } + } + } else { + QHash hash; + QBENCHMARK { + for (int i = 0 ; i <= 10000 ; i++) + { + styleStruct myStruct; + myStruct.key = QString("my-progressbar-%1").arg(i); + myStruct.key = 5; + myStruct.key = 4; + myStruct.key = 3; + myStruct.palette = 358; + myStruct.width = 100; + myStruct.key = 200; + QPixmapCache::Key key = QPixmapCache::insert(p); + hash.insert(myStruct, key); + } + for (int i = 0 ; i <= 10000 ; i++) + { + styleStruct myStruct; + myStruct.key = QString("my-progressbar-%1").arg(i); + myStruct.key = 5; + myStruct.key = 4; + myStruct.key = 3; + myStruct.palette = 358; + myStruct.width = 100; + myStruct.key = 200; + QPixmapCache::Key key = hash.value(myStruct); + QPixmapCache::find(key, &p); + } + } + } + +} + + +QTEST_MAIN(tst_QPixmapCache) +#include "tst_qpixmapcache.moc" -- cgit v0.12 From 30a604d0d04785aa9f38fad912e72347facc2bd1 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 18 May 2009 11:26:13 +0200 Subject: Compile. --- src/declarative/qml/parser/javascript.g | 4 ++-- src/declarative/qml/parser/javascriptparser.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g index 7622421..33847f2 100644 --- a/src/declarative/qml/parser/javascript.g +++ b/src/declarative/qml/parser/javascript.g @@ -46,7 +46,7 @@ %decl javascriptparser_p.h %impl javascriptparser.cpp %expect 2 -%expect-rr 1 +%expect-rr 2 %token T_AND "&" T_AND_AND "&&" T_AND_EQ "&=" %token T_BREAK "break" T_CASE "case" T_CATCH "catch" @@ -656,7 +656,7 @@ case $rule_number: { sym(1).Node = 0; diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(2), - "Expected a type name after token `:'")); + QLatin1String("Expected a type name after token `:'"))); return false; // ### recover } diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp index cf17c02..5d456c7 100644 --- a/src/declarative/qml/parser/javascriptparser.cpp +++ b/src/declarative/qml/parser/javascriptparser.cpp @@ -299,7 +299,7 @@ case 21: { sym(1).Node = 0; diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(2), - "Expected a type name after token `:'")); + QLatin1String("Expected a type name after token `:'"))); return false; // ### recover } -- cgit v0.12 From cfcf72970cd58282aff9aac76f421915d287dc09 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 May 2009 11:27:13 +0200 Subject: Wrote Designer/uic changelog for 4.5.2. --- dist/changes-4.5.2 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.5.2 b/dist/changes-4.5.2 index a772bf7..3180b7c 100644 --- a/dist/changes-4.5.2 +++ b/dist/changes-4.5.2 @@ -78,7 +78,17 @@ Qt for Windows CE - Designer - + * [248769] Fixed a bug affecting the display of keyboard shortcuts in + the detailed view of the action editor. + * [251092] Fixed a bug preventing entering local file names for QUrl-type + properties on Windows. + * [251691] Fixed dynamic re-translation of table headers. + * [252251] Improved readability of the property editor when using the + KDE Obsidian Coast theme. + * [253236] Fixed a regression bug triggered by forms with a size policy + of 'Fixed' on the main cointainer. + * [253278] Made it possible to set QString-type properties using + QDesignerFormWindowCursor::setProperty(). - Linguist - Linguist GUI @@ -95,7 +105,8 @@ Qt for Windows CE - uic - + * [252333] Fixed a regression crash triggered by using icons with + different pixmaps for QIcon states. - uic3 -- cgit v0.12 From 6e5d9637b981e532ef9c92d88aa88a4388d69384 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 18 May 2009 11:35:26 +0200 Subject: Renamed qualifiedObjectNameId. --- src/declarative/qml/parser/javascriptast.cpp | 4 ++-- src/declarative/qml/parser/javascriptast_p.h | 14 +++++++------- src/declarative/qml/qmlscriptparser.cpp | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/declarative/qml/parser/javascriptast.cpp b/src/declarative/qml/parser/javascriptast.cpp index de06503..083dd28 100644 --- a/src/declarative/qml/parser/javascriptast.cpp +++ b/src/declarative/qml/parser/javascriptast.cpp @@ -813,7 +813,7 @@ void UiPublicMember::accept0(Visitor *visitor) void UiObjectDefinition::accept0(Visitor *visitor) { if (visitor->visit(this)) { - acceptChild(qualifiedObjectNameId, visitor); + acceptChild(qualifiedTypeNameId, visitor); acceptChild(initializer, visitor); } @@ -834,7 +834,7 @@ void UiObjectBinding::accept0(Visitor *visitor) { if (visitor->visit(this)) { acceptChild(qualifiedId, visitor); - acceptChild(qualifiedObjectNameId, visitor); + acceptChild(qualifiedTypeNameId, visitor); acceptChild(initializer, visitor); } diff --git a/src/declarative/qml/parser/javascriptast_p.h b/src/declarative/qml/parser/javascriptast_p.h index e446e89..134f3cc 100644 --- a/src/declarative/qml/parser/javascriptast_p.h +++ b/src/declarative/qml/parser/javascriptast_p.h @@ -2345,13 +2345,13 @@ class UiObjectDefinition: public UiObjectMember public: JAVASCRIPT_DECLARE_AST_NODE(UiObjectDefinition) - UiObjectDefinition(UiQualifiedId *qualifiedObjectNameId, + UiObjectDefinition(UiQualifiedId *qualifiedTypeNameId, UiObjectInitializer *initializer) - : qualifiedObjectNameId(qualifiedObjectNameId), initializer(initializer) + : qualifiedTypeNameId(qualifiedTypeNameId), initializer(initializer) { kind = K; } virtual SourceLocation firstSourceLocation() const - { return qualifiedObjectNameId->identifierToken; } + { return qualifiedTypeNameId->identifierToken; } virtual SourceLocation lastSourceLocation() const { return initializer->rbraceToken; } @@ -2359,7 +2359,7 @@ public: virtual void accept0(Visitor *visitor); // attributes - UiQualifiedId *qualifiedObjectNameId; + UiQualifiedId *qualifiedTypeNameId; UiObjectInitializer *initializer; }; @@ -2405,10 +2405,10 @@ public: JAVASCRIPT_DECLARE_AST_NODE(UiObjectBinding) UiObjectBinding(UiQualifiedId *qualifiedId, - UiQualifiedId *qualifiedObjectNameId, + UiQualifiedId *qualifiedTypeNameId, UiObjectInitializer *initializer) : qualifiedId(qualifiedId), - qualifiedObjectNameId(qualifiedObjectNameId), + qualifiedTypeNameId(qualifiedTypeNameId), initializer(initializer) { kind = K; } @@ -2422,7 +2422,7 @@ public: // attributes UiQualifiedId *qualifiedId; - UiQualifiedId *qualifiedObjectNameId; + UiQualifiedId *qualifiedTypeNameId; UiObjectInitializer *initializer; SourceLocation colonToken; }; diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index e0265c7..ead7ee5 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -451,7 +451,7 @@ bool ProcessAST::visit(AST::UiObjectDefinition *node) node->lastSourceLocation()); defineObjectBinding(/*propertyName = */ 0, - node->qualifiedObjectNameId, + node->qualifiedTypeNameId, l, node->initializer); @@ -462,11 +462,11 @@ bool ProcessAST::visit(AST::UiObjectDefinition *node) // UiObjectMember: UiQualifiedId T_COLON UiQualifiedId UiObjectInitializer ; bool ProcessAST::visit(AST::UiObjectBinding *node) { - LocationSpan l = location(node->qualifiedObjectNameId->identifierToken, + LocationSpan l = location(node->qualifiedTypeNameId->identifierToken, node->initializer->rbraceToken); defineObjectBinding(node->qualifiedId, - node->qualifiedObjectNameId, + node->qualifiedTypeNameId, l, node->initializer); -- cgit v0.12 From 72516886fffdc0d66592655d47f1a869f89472f7 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 18 May 2009 12:35:36 +0200 Subject: Do not store empty type names in QmlMetaType --- src/declarative/qml/qmlmetatype.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp index df61a82..2e490a4 100644 --- a/src/declarative/qml/qmlmetatype.cpp +++ b/src/declarative/qml/qmlmetatype.cpp @@ -388,7 +388,8 @@ int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id, data->idToType.insert(type->typeId(), type); data->idToType.insert(type->qListTypeId(), type); data->idToType.insert(type->qmlListTypeId(), type); - data->nameToType.insert(type->qmlTypeName(), type); + if (!type->qmlTypeName().isEmpty()) + data->nameToType.insert(type->qmlTypeName(), type); if (data->interfaces.size() < id.typeId) data->interfaces.resize(id.typeId + 16); -- cgit v0.12 From dcf8e8a44867377f6f46b85aca862b48d3da5612 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 18 May 2009 13:16:47 +0200 Subject: qdoc: Added back the list count that was lost in translation. --- tools/qdoc3/htmlgenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 295cdab..d7770bb 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -2248,7 +2248,8 @@ void HtmlGenerator::generateSectionInheritedList(const Section& section, if (nameAlignment) out() << "
  • "; else - out() << (*p).second << " "; + out() << "
  • "; + out() << (*p).second << " "; if ((*p).second == 1) { out() << section.singularMember; } -- cgit v0.12 From 7008bfe80e0466ed2978b39e7e698bbd52fb690f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 18 May 2009 13:05:14 +0200 Subject: Fixed the SVG parser to handle CSS properties with multiple values. CSS properties with more than 1 value was ignored. E.g. the 'stroke-dasharray' attribute is specified by a comma separates list of numbers. This was previously ignored because the CSS parser split it into a value array. Task-number: 253614 Reviewed-by: Kim --- src/svg/qsvghandler.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 433a3ad..6a897e8 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -1673,10 +1673,19 @@ static void parseCSStoXMLAttrs(const QVector &declarations, const QCss::Declaration &decl = declarations.at(i); if (decl.d->property.isEmpty()) continue; - if (decl.d->values.count() != 1) - continue; QCss::Value val = decl.d->values.first(); - QString valueStr = val.toString(); + QString valueStr; + if (decl.d->values.count() != 1) { + for (int i=0; ivalues.count(); ++i) { + const QString &value = decl.d->values[i].toString(); + if (value.isEmpty()) + valueStr += QLatin1Char(','); + else + valueStr += value; + } + } else { + valueStr = val.toString(); + } if (val.type == QCss::Value::Uri) { valueStr.prepend(QLatin1String("url(")); valueStr.append(QLatin1Char(')')); -- cgit v0.12 From 04a38501780b30cbec4bada8e984453e02ce3402 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 18 May 2009 13:39:08 +0200 Subject: Added "id" to the list of QmlDomObject properties, so we can get to the location information. --- src/declarative/qml/qmldom.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index 673520e..aeb8e7c 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -477,12 +477,8 @@ QmlDomObjectPrivate::properties(QmlParser::Property *property) const iter->second.prepend(name); } else { - - // We don't display "id" sets as a property in the dom - if (property->values.count() != 1 || - property->values.at(0)->type != QmlParser::Value::Id) + if (property->values.count() != 1) rv << qMakePair(property, property->name); - } return rv; -- cgit v0.12 From 99548c8bb2e3523dfbf21be8591a29867503e136 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 18 May 2009 14:18:29 +0200 Subject: Fixed the addition of "id" to the list of QmlDomObject properties. --- src/declarative/qml/qmldom.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index aeb8e7c..9871fcb 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -477,8 +477,7 @@ QmlDomObjectPrivate::properties(QmlParser::Property *property) const iter->second.prepend(name); } else { - if (property->values.count() != 1) - rv << qMakePair(property, property->name); + rv << qMakePair(property, property->name); } return rv; -- cgit v0.12 From e7653f2d2cef626b1dc9ad07753b99c38b015eac Mon Sep 17 00:00:00 2001 From: jasplin Date: Mon, 18 May 2009 14:20:48 +0200 Subject: Fixed regression introduced by fix for Task 177022. The fix for Task 177022 broke the fix for Task 163334. This commit fixes the regression. Reviewed-by: janarve --- src/gui/dialogs/qwizard.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp index 6f2ab0a..2c29ebf 100644 --- a/src/gui/dialogs/qwizard.cpp +++ b/src/gui/dialogs/qwizard.cpp @@ -1241,8 +1241,10 @@ void QWizardPrivate::updateMinMaxSizes(const QWizardLayoutInfo &info) #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 + if (QSysInfo::WindowsVersion <= QSysInfo::WV_Me) // ### See Tasks 164078 and 161660 + skipMaxSize = true; #endif maximumSize = mainLayout->totalMaximumSize(); if (info.header && headerWidget->maximumWidth() != QWIDGETSIZE_MAX) { @@ -1263,11 +1265,13 @@ void QWizardPrivate::updateMinMaxSizes(const QWizardLayoutInfo &info) } if (q->maximumWidth() == maximumWidth) { maximumWidth = maximumSize.width(); - q->setMaximumWidth(maximumWidth); + if (!skipMaxSize) + q->setMaximumWidth(maximumWidth); } if (q->maximumHeight() == maximumHeight) { maximumHeight = maximumSize.height(); - q->setMaximumHeight(maximumHeight); + if (!skipMaxSize) + q->setMaximumHeight(maximumHeight); } } -- cgit v0.12 From 6f81986c3e5022fb6a873c6d60bede460bf6a4dd Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 18 May 2009 14:33:03 +0200 Subject: Fix incorrect signal referred to in the docs Fix the documentation to state sortIndicatorChanged() should be used and not sectionClicked() for connecting to the sortByColumn() slot as the sortByColumn() takes two parameters, not one. Reviewed-by: Kavindra Palaraja --- doc/src/model-view-programming.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/model-view-programming.qdoc b/doc/src/model-view-programming.qdoc index bf0c1c8..8874cfa 100644 --- a/doc/src/model-view-programming.qdoc +++ b/doc/src/model-view-programming.qdoc @@ -249,7 +249,7 @@ provide an API that allows you to sort your model data programmatically. In addition, you can enable interactive sorting (i.e. allowing the users to sort the data by clicking the view's - headers), by connecting the QHeaderView::sectionClicked() signal + headers), by connecting the QHeaderView::sortIndicatorChanged() signal to the QTableView::sortByColumn() slot or the QTreeView::sortByColumn() slot, respectively. -- cgit v0.12 From 0ff3bb25df3626a8112def75fc3ff048c70ebdb2 Mon Sep 17 00:00:00 2001 From: jasplin Date: Mon, 18 May 2009 14:30:09 +0200 Subject: Fixed crash in QWizard running on old Windows systems. When compiling the QWizard on a Windows system where QT_NO_STYLE_WINDOWSVISTA is not set and running the app on an old system that has no Vista support, the app would crash in the paint event of the Vista Back button. In this scenario, the Vista Back button is not needed (i.e. the regular Back button next to the Next button is used), so the fix is simply to avoid instanciating it altogether. Reviewed-by: janarve Task-number: 252662 --- src/gui/dialogs/qwizard.cpp | 4 ++-- src/gui/dialogs/qwizard_win.cpp | 5 ++++- src/gui/dialogs/qwizard_win_p.h | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp index 32395c4..298f23f 100644 --- a/src/gui/dialogs/qwizard.cpp +++ b/src/gui/dialogs/qwizard.cpp @@ -1465,7 +1465,7 @@ void QWizardPrivate::handleAeroStyleChange() return; // prevent recursion inHandleAeroStyleChange = true; - vistaHelper->backButton()->disconnect(); + vistaHelper->disconnectBackButton(); q->removeEventFilter(vistaHelper); if (isVistaThemeEnabled()) { @@ -1491,7 +1491,7 @@ void QWizardPrivate::handleAeroStyleChange() q->setMouseTracking(true); // ### original value possibly different q->unsetCursor(); // ### ditto antiFlickerWidget->move(0, 0); - vistaHelper->backButton()->hide(); + vistaHelper->hideBackButton(); vistaHelper->setTitleBarIconAndCaptionVisible(true); } diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp index 64696de..8aad4af 100644 --- a/src/gui/dialogs/qwizard_win.cpp +++ b/src/gui/dialogs/qwizard_win.cpp @@ -239,9 +239,11 @@ void QVistaBackButton::paintEvent(QPaintEvent *) QVistaHelper::QVistaHelper(QWizard *wizard) : pressed(false) , wizard(wizard) + , backButton_(0) { is_vista = resolveSymbols(); - backButton_ = new QVistaBackButton(wizard); + if (is_vista) + backButton_ = new QVistaBackButton(wizard); } QVistaHelper::~QVistaHelper() @@ -310,6 +312,7 @@ void QVistaHelper::drawTitleBar(QPainter *painter) QRect(0, 0, wizard->width(), titleBarSize() + topOffset()), painter->paintEngine()->getDC()); + Q_ASSERT(backButton_); const int btnTop = backButton_->mapToParent(QPoint()).y(); const int btnHeight = backButton_->size().height(); const int verticalCenter = (btnTop + btnHeight / 2); diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/gui/dialogs/qwizard_win_p.h index cbb3b17..148be26 100644 --- a/src/gui/dialogs/qwizard_win_p.h +++ b/src/gui/dialogs/qwizard_win_p.h @@ -94,6 +94,8 @@ public: void resizeEvent(QResizeEvent *event); void paintEvent(QPaintEvent *event); QVistaBackButton *backButton() const { return backButton_; } + void disconnectBackButton() { if (backButton_) backButton_->disconnect(); } + void hideBackButton() { if (backButton_) backButton_->hide(); } void setWindowPosHack(); QColor basicWindowFrameColor(); enum VistaState { VistaAero, VistaBasic, Classic, Dirty }; -- cgit v0.12 From 6c16cb557205c8cf33bcf0493b3d9436c6f43236 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 18 May 2009 14:39:14 +0200 Subject: QCalendarWidget::setDateTextFormat() reset the format is the date is invalid According to the documentation, QCalendarWidget::setDateTextFormat() should reset the format if the date is not valid. New tests included for the formating of this widget. Task-number: 252943 Reviewed-by: Olivier --- src/gui/widgets/qcalendarwidget.cpp | 2 +- tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp | 53 ++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/gui/widgets/qcalendarwidget.cpp index 92c12a5..4436c04 100644 --- a/src/gui/widgets/qcalendarwidget.cpp +++ b/src/gui/widgets/qcalendarwidget.cpp @@ -2791,7 +2791,7 @@ QTextCharFormat QCalendarWidget::dateTextFormat(const QDate &date) const void QCalendarWidget::setDateTextFormat(const QDate &date, const QTextCharFormat &format) { Q_D(QCalendarWidget); - if ( date.isNull() && !format.isValid() ) + if (date.isNull()) d->m_model->m_dateFormats.clear(); else d->m_model->m_dateFormats[date] = format; diff --git a/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp index 67a822f..617832b 100644 --- a/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp +++ b/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp @@ -47,6 +47,8 @@ #include #include #include +#include +#include //TESTED_CLASS= @@ -68,6 +70,11 @@ public slots: private slots: void getSetCheck(); void buttonClickCheck(); + + void setTextFormat(); + void resetTextFormat(); + + void setWeekdayFormat(); }; // Testing get/set functions @@ -215,6 +222,52 @@ void tst_QCalendarWidget::buttonClickCheck() } +void tst_QCalendarWidget::setTextFormat() +{ + QCalendarWidget calendar; + QTextCharFormat format; + format.setFontItalic(true); + format.setForeground(Qt::green); + + const QDate date(1984, 10, 20); + calendar.setDateTextFormat(date, format); + QCOMPARE(calendar.dateTextFormat(date), format); +} + +void tst_QCalendarWidget::resetTextFormat() +{ + QCalendarWidget calendar; + QTextCharFormat format; + format.setFontItalic(true); + format.setForeground(Qt::green); + + const QDate date(1984, 10, 20); + calendar.setDateTextFormat(date, format); + + calendar.setDateTextFormat(QDate(), QTextCharFormat()); + QCOMPARE(calendar.dateTextFormat(date), QTextCharFormat()); +} + +void tst_QCalendarWidget::setWeekdayFormat() +{ + QCalendarWidget calendar; + + QTextCharFormat format; + format.setFontItalic(true); + format.setForeground(Qt::green); + + calendar.setWeekdayTextFormat(Qt::Wednesday, format); + + // check the format of the a given month + for (int i = 1; i <= 31; ++i) { + const QDate date(1984, 10, i); + const Qt::DayOfWeek dayOfWeek = static_cast(date.dayOfWeek()); + if (dayOfWeek == Qt::Wednesday) + QCOMPARE(calendar.weekdayTextFormat(dayOfWeek), format); + else + QVERIFY(calendar.weekdayTextFormat(dayOfWeek) != format); + } +} tst_QCalendarWidget::tst_QCalendarWidget() { -- cgit v0.12 From 3c40b1af35319f1fd1b10c97b954adff3abbe9b0 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 15 May 2009 13:54:44 +0200 Subject: Fix race condition in ~QObject while using QOrderedMutexLocker::relock we might unlock our mutex protecting the 'senders' list for a short moment. Another thread may then modify or remove element on the list. Therefore, we need to recheck the consistency of the list once we did that. Also, we cannot call removeSender because that will remove every connections, making impossible for another object destroyed in the same time to clean up the senders list, so call derefSender instead. Reviewed-by: Brad --- src/corelib/kernel/qobject.cpp | 30 ++++------ src/corelib/kernel/qobject_p.h | 1 - tests/auto/qobjectrace/tst_qobjectrace.cpp | 89 ++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 20 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 05015c0..f1a1eb5 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -345,18 +345,6 @@ void QObjectPrivate::derefSender(QObject *sender, int signal) // Q_ASSERT_X(false, "QObjectPrivate::derefSender", "sender not found"); } -void QObjectPrivate::removeSender(QObject *sender, int signal) -{ - for (int i = 0; i < senders.count(); ++i) { - Sender &s = senders[i]; - if (s.sender == sender && s.signal == signal) { - senders.removeAt(i); - return; - } - } - // Q_ASSERT_X(false, "QObjectPrivate::removeSender", "sender not found"); -} - QObjectPrivate::Sender *QObjectPrivate::setCurrentSender(QObject *receiver, Sender *sender) { @@ -790,7 +778,7 @@ QObject::~QObject() bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m); c = &connectionList[i]; if (c->receiver) - c->receiver->d_func()->removeSender(this, signal); + c->receiver->d_func()->derefSender(this, signal); if (needToUnlock) m->unlock(); @@ -811,18 +799,22 @@ QObject::~QObject() } // disconnect all senders - for (int i = 0; i < d->senders.count(); ++i) { + for (int i = 0; i < d->senders.count(); ) { QObjectPrivate::Sender *s = &d->senders[i]; - if (!s->sender) - continue; QMutex *m = &s->sender->d_func()->threadData->mutex; bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m); - s = &d->senders[i]; - if (s->sender) - s->sender->d_func()->removeReceiver(s->signal, this); + if (m < locker.mutex()) { + if (i >= d->senders.count() || s != &d->senders[i]) { + if (needToUnlock) + m->unlock(); + continue; + } + } + s->sender->d_func()->removeReceiver(s->signal, this); if (needToUnlock) m->unlock(); + ++i; } d->senders.clear(); diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index b324334..0eed938 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -163,7 +163,6 @@ public: QList senders; void refSender(QObject *sender, int signal); void derefSender(QObject *sender, int signal); - void removeSender(QObject *sender, int signal); static Sender *setCurrentSender(QObject *receiver, Sender *sender); diff --git a/tests/auto/qobjectrace/tst_qobjectrace.cpp b/tests/auto/qobjectrace/tst_qobjectrace.cpp index 0c88f29..fcfd528 100644 --- a/tests/auto/qobjectrace/tst_qobjectrace.cpp +++ b/tests/auto/qobjectrace/tst_qobjectrace.cpp @@ -50,6 +50,7 @@ class tst_QObjectRace: public QObject Q_OBJECT private slots: void moveToThreadRace(); + void destroyRace(); }; class RaceObject : public QObject @@ -147,5 +148,93 @@ void tst_QObjectRace::moveToThreadRace() delete object; } + +class MyObject : public QObject +{ Q_OBJECT + public slots: + void slot1() { emit signal1(); } + void slot2() { emit signal2(); } + void slot3() { emit signal3(); } + void slot4() { emit signal4(); } + void slot5() { emit signal5(); } + void slot6() { emit signal6(); } + void slot7() { emit signal7(); } + signals: + void signal1(); + void signal2(); + void signal3(); + void signal4(); + void signal5(); + void signal6(); + void signal7(); +}; + + + +class DestroyThread : public QThread +{ + Q_OBJECT + QObject **objects; + int number; + +public: + void setObjects(QObject **o, int n) + { + objects = o; + number = n; + for(int i = 0; i < number; i++) + objects[i]->moveToThread(this); + } + + void run() { + for(int i = 0; i < number; i++) + delete objects[i]; + } +}; + +void tst_QObjectRace::destroyRace() +{ + enum { ThreadCount = 10, ObjectCountPerThread = 733, + ObjectCount = ThreadCount * ObjectCountPerThread }; + + const char *_slots[] = { SLOT(slot1()) , SLOT(slot2()) , SLOT(slot3()), + SLOT(slot4()) , SLOT(slot5()) , SLOT(slot6()), + SLOT(slot7()) }; + + const char *_signals[] = { SIGNAL(signal1()), SIGNAL(signal2()), SIGNAL(signal3()), + SIGNAL(signal4()), SIGNAL(signal5()), SIGNAL(signal6()), + SIGNAL(signal7()) }; + + QObject *objects[ObjectCount]; + for (int i = 0; i < ObjectCount; ++i) + objects[i] = new MyObject; + + + for (int i = 0; i < ObjectCount * 11; ++i) { + connect(objects[(i*13) % ObjectCount], _signals[(2*i)%7], + objects[((i+2)*17) % ObjectCount], _slots[(3*i+2)%7] ); + connect(objects[((i+6)*23) % ObjectCount], _signals[(5*i+4)%7], + objects[((i+8)*41) % ObjectCount], _slots[(i+6)%7] ); + } + + DestroyThread *threads[ThreadCount]; + for (int i = 0; i < ThreadCount; ++i) { + threads[i] = new DestroyThread; + threads[i]->setObjects(objects + i*ObjectCountPerThread, ObjectCountPerThread); + } + + for (int i = 0; i < ThreadCount; ++i) + threads[i]->start(); + + QVERIFY(threads[0]->wait(TwoMinutes)); + // the other threads should finish pretty quickly now + for (int i = 1; i < ThreadCount; ++i) + QVERIFY(threads[i]->wait(3000)); + + for (int i = 0; i < ThreadCount; ++i) + delete threads[i]; +} + + QTEST_MAIN(tst_QObjectRace) #include "tst_qobjectrace.moc" -- cgit v0.12 From e8ac2b958d92319da7c725f0c30f8ba5fe06497b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 18 May 2009 14:59:14 +0200 Subject: QCss: font-family handle fallback font specs if one specify more than one parameter in font-family, e.g., font-family: Verdana, Arial Qt should fallback on the second font if the first cannot be found. QFont::setFamily handle the case when the family name contains a comas, so we do not need to handle that specially in the css parser code. Task-number: 252311 Reviewed-by: Thomas Zander --- doc/src/stylesheet.qdoc | 4 ---- src/gui/text/qcssparser.cpp | 19 ++++++++++++------- tests/auto/qcssparser/tst_cssparser.cpp | 13 +++++++++---- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/doc/src/stylesheet.qdoc b/doc/src/stylesheet.qdoc index c0d13da..f895918 100644 --- a/doc/src/stylesheet.qdoc +++ b/doc/src/stylesheet.qdoc @@ -1872,10 +1872,6 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 54 - \note If you specify more than one parameter in \c font-family, - e.g., \c{font-family: Verdana, Arial}, Qt will only use the first - font. If it cannot be found, Qt uses the system fallbacks instead. - \row \o \c font-size \o \l{#Font Size}{Font Size} diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 8214e54..38621c1 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -1161,13 +1161,20 @@ static bool setFontWeightFromValue(const Value &value, QFont *font) return true; } -static bool setFontFamilyFromValues(const QVector &values, QFont *font) +/** \internal + * parse the font family from the values (starting from index \a start) + * and set it the \a font + * \returns true if a family was extracted. + */ +static bool setFontFamilyFromValues(const QVector &values, QFont *font, int start = 0) { QString family; - for (int i = 0; i < values.count(); ++i) { + for (int i = start; i < values.count(); ++i) { const Value &v = values.at(i); - if (v.type == Value::TermOperatorComma) - break; + if (v.type == Value::TermOperatorComma) { + family += QLatin1Char(','); + continue; + } const QString str = v.variant.toString(); if (str.isEmpty()) break; @@ -1221,9 +1228,7 @@ static void parseShorthandFontProperty(const QVector &values, QFont *font } if (i < values.count()) { - QString fam = values.at(i).variant.toString(); - if (!fam.isEmpty()) - font->setFamily(fam); + setFontFamilyFromValues(values, font, i); } } diff --git a/tests/auto/qcssparser/tst_cssparser.cpp b/tests/auto/qcssparser/tst_cssparser.cpp index ab6bad6..7c4fac1 100644 --- a/tests/auto/qcssparser/tst_cssparser.cpp +++ b/tests/auto/qcssparser/tst_cssparser.cpp @@ -123,7 +123,7 @@ static void debug(const QVector &symbols, int index = -1) qDebug() << "failure at index" << index; } -static void debug(const QCss::Parser &p) { debug(p.symbols); } +//static void debug(const QCss::Parser &p) { debug(p.symbols); } void tst_CssParser::scanner() { @@ -1473,7 +1473,12 @@ void tst_CssParser::extractFontFamily_data() QTest::newRow("quoted-family-name") << "font-family: 'Times New Roman'" << QString("Times New Roman"); QTest::newRow("unquoted-family-name") << "font-family: Times New Roman" << QString("Times New Roman"); QTest::newRow("unquoted-family-name2") << "font-family: Times New Roman" << QString("Times New Roman"); - QTest::newRow("multiple") << "font-family: Times New Roman , foobar, 'baz'" << QString("Times New Roman"); + QTest::newRow("multiple") << "font-family: Times New Roman , foobar, 'baz'" << QString("Times New Roman"); + QTest::newRow("multiple2") << "font-family: invalid, Times New Roman " << QString("Times New Roman"); + QTest::newRow("invalid") << "font-family: invalid" << QFont().family(); + QTest::newRow("shorthand") << "font: 12pt Times New Roman" << QString("Times New Roman"); + QTest::newRow("shorthand multiple quote") << "font: 12pt invalid, \"Times New Roman\" " << QString("Times New Roman"); + QTest::newRow("shorthand multiple") << "font: 12pt invalid, Times New Roman " << QString("Times New Roman"); } void tst_CssParser::extractFontFamily() @@ -1497,8 +1502,8 @@ void tst_CssParser::extractFontFamily() int adjustment = 0; QFont fnt; extractor.extractFont(&fnt, &adjustment); - - QTEST(fnt.family(), "expectedFamily"); + QFontInfo info(fnt); + QTEST(info.family(), "expectedFamily"); } void tst_CssParser::extractBorder_data() -- cgit v0.12 From 5c25207628fbcc94e92b129ac7660af14613ad85 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Mon, 18 May 2009 15:00:59 +0200 Subject: Adding change details in to Qt 3 to Qt 4 porting guide Adding details about QCloseEvents being acceptet by default in Qt 4 opposed to Qt 3 Task-number: 192607 Rev-by: msorvig --- doc/src/porting4-overview.qdoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/src/porting4-overview.qdoc b/doc/src/porting4-overview.qdoc index b0146a6..462f849 100644 --- a/doc/src/porting4-overview.qdoc +++ b/doc/src/porting4-overview.qdoc @@ -364,4 +364,10 @@ In Qt 4.2 and later, \l{Qt Style Sheets} can be used to implement many common modifications to existing styles, and this may be sufficient for Qt 3 applications. + + \section2 Events + In Qt 3, QCloseEvents were not accepted by default. In Qt 4, + the event handler QWidget::closeEvent() receives QCloseEvents, + and accepts them by default closing the application. To avoid + this, please reimplement QWidget::closeEvent(). */ -- cgit v0.12 From 020b02a16aa69fad173a3b32ec98f05e9a33034d Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 14 May 2009 16:34:52 +0200 Subject: Fixed: No margin between the text and the shortcut in menu with stylesheet If padding, margin border are set on an menu item with stylesheet, no space appeared between the text and the shortcut. Fix that by adding the 12px space, same as in QCommonStyle equivalent function Note that this patch also remove unused code, since the variable with and height were not used. example to reproduce the bug: the following stylesheet on a mainwindow that contains a menu with one action with a shortcut QMenu::item { border: 1px solid red; } Task-number: 252610 Reveiwed-by: jbache --- src/gui/styles/qstylesheetstyle.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index cd44bfd..fdd51c3 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -4806,13 +4806,10 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op if ((pe == PseudoElement_MenuSeparator) && subRule.hasContentsSize()) { return QSize(sz.width(), subRule.size().height()); } else if ((pe == PseudoElement_Item) && (subRule.hasBox() || subRule.hasBorder())) { - int width = csz.width(), height = qMax(csz.height(), mi->fontMetrics.height()); - if (!mi->icon.isNull()) { - int iconExtent = pixelMetric(PM_SmallIconSize); - height = qMax(height, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height()); - } - width += mi->tabWidth; - return subRule.boxSize(csz.expandedTo(subRule.minimumContentsSize())); + int width = csz.width(); + if (mi->text.contains(QLatin1Char('\t'))) + width += 12; //as in QCommonStyle + return subRule.boxSize(subRule.adjustSize(QSize(width, csz.height()))); } } break; -- cgit v0.12 From a07385de15636e41de51d5d9df1faeb0c76a5537 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 11 May 2009 16:59:29 +0200 Subject: Fix warning on QVector with gcc4.4 Use QVectorData whenever possible instead of QVectorTypedData. It is not safe to convert the shared_null to QVectorTypedData as different instance of qvector with different type may cast it in the same function (because everything is inline) and that would break strict aliasing. Reviewed-by: Thiago Reviewed-by: Brad --- src/corelib/tools/qvector.h | 154 ++++++++++++++++++++++---------------------- 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 1f047b8..8aa61ff 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -104,14 +104,14 @@ template class QVector { typedef QVectorTypedData Data; - union { QVectorData *p; QVectorTypedData *d; }; + union { QVectorData *d; Data *p; }; public: - inline QVector() : p(&QVectorData::shared_null) { d->ref.ref(); } + inline QVector() : d(&QVectorData::shared_null) { d->ref.ref(); } explicit QVector(int size); QVector(int size, const T &t); inline QVector(const QVector &v) : d(v.d) { d->ref.ref(); if (!d->sharable) detach_helper(); } - inline ~QVector() { if (!d) return; if (!d->ref.deref()) free(d); } + inline ~QVector() { if (!d) return; if (!d->ref.deref()) free(p); } QVector &operator=(const QVector &v); bool operator==(const QVector &v) const; inline bool operator!=(const QVector &v) const { return !(*this == v); } @@ -130,9 +130,9 @@ public: inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } - inline T *data() { detach(); return d->array; } - inline const T *data() const { return d->array; } - inline const T *constData() const { return d->array; } + inline T *data() { detach(); return p->array; } + inline const T *data() const { return p->array; } + inline const T *constData() const { return p->array; } void clear(); const T &at(int i) const; @@ -225,12 +225,12 @@ public: typedef T* iterator; typedef const T* const_iterator; #endif - inline iterator begin() { detach(); return d->array; } - inline const_iterator begin() const { return d->array; } - inline const_iterator constBegin() const { return d->array; } - inline iterator end() { detach(); return d->array + d->size; } - inline const_iterator end() const { return d->array + d->size; } - inline const_iterator constEnd() const { return d->array + d->size; } + inline iterator begin() { detach(); return p->array; } + inline const_iterator begin() const { return p->array; } + inline const_iterator constBegin() const { return p->array; } + inline iterator end() { detach(); return p->array + d->size; } + inline const_iterator end() const { return p->array + d->size; } + inline const_iterator constEnd() const { return p->array + d->size; } iterator insert(iterator before, int n, const T &x); inline iterator insert(iterator before, const T &x) { return insert(before, 1, x); } iterator erase(iterator begin, iterator end); @@ -327,11 +327,11 @@ inline void QVector::clear() template inline const T &QVector::at(int i) const { Q_ASSERT_X(i >= 0 && i < d->size, "QVector::at", "index out of range"); - return d->array[i]; } + return p->array[i]; } template inline const T &QVector::operator[](int i) const { Q_ASSERT_X(i >= 0 && i < d->size, "QVector::operator[]", "index out of range"); - return d->array[i]; } + return p->array[i]; } template inline T &QVector::operator[](int i) { Q_ASSERT_X(i >= 0 && i < d->size, "QVector::operator[]", "index out of range"); @@ -369,7 +369,7 @@ QVector &QVector::operator=(const QVector &v) { v.d->ref.ref(); if (!d->ref.deref()) - free(d); + free(p); d = v.d; if (!d->sharable) detach_helper(); @@ -385,31 +385,31 @@ inline QVectorData *QVector::malloc(int aalloc) template QVector::QVector(int asize) { - p = malloc(asize); + d = malloc(asize); d->ref = 1; d->alloc = d->size = asize; d->sharable = true; d->capacity = false; if (QTypeInfo::isComplex) { - T* b = d->array; - T* i = d->array + d->size; + T* b = p->array; + T* i = p->array + d->size; while (i != b) new (--i) T; } else { - qMemSet(d->array, 0, asize * sizeof(T)); + qMemSet(p->array, 0, asize * sizeof(T)); } } template QVector::QVector(int asize, const T &t) { - p = malloc(asize); + d = malloc(asize); d->ref = 1; d->alloc = d->size = asize; d->sharable = true; d->capacity = false; - T* i = d->array + d->size; - while (i != d->array) + T* i = p->array + d->size; + while (i != p->array) new (--i) T(t); } @@ -418,7 +418,7 @@ void QVector::free(Data *x) { if (QTypeInfo::isComplex) { T* b = x->array; - T* i = b + x->size; + T* i = b + reinterpret_cast(x)->size; while (i-- != b) i->~T(); } @@ -429,13 +429,13 @@ template void QVector::realloc(int asize, int aalloc) { T *j, *i, *b; - union { QVectorData *p; Data *d; } x; + union { QVectorData *d; Data *p; } x; x.d = d; if (QTypeInfo::isComplex && aalloc == d->alloc && d->ref == 1) { // pure resize - i = d->array + d->size; - j = d->array + asize; + i = p->array + d->size; + j = p->array + asize; if (i > j) { while (i-- != j) i->~T(); @@ -450,22 +450,22 @@ void QVector::realloc(int asize, int aalloc) if (aalloc != d->alloc || d->ref != 1) { // (re)allocate memory if (QTypeInfo::isStatic) { - x.p = malloc(aalloc); + x.d = malloc(aalloc); } else if (d->ref != 1) { - x.p = QVectorData::malloc(sizeOfTypedData(), aalloc, sizeof(T), p); + x.d = QVectorData::malloc(sizeOfTypedData(), aalloc, sizeof(T), d); } else { if (QTypeInfo::isComplex) { // call the destructor on all objects that need to be // destroyed when shrinking if (asize < d->size) { - j = d->array + asize; - i = d->array + d->size; + j = p->array + asize; + i = p->array + d->size; while (i-- != j) i->~T(); - i = d->array + asize; + i = p->array + asize; } } - x.p = p = static_cast(qRealloc(p, sizeOfTypedData() + (aalloc - 1) * sizeof(T))); + x.d = d = static_cast(qRealloc(d, sizeOfTypedData() + (aalloc - 1) * sizeof(T))); } x.d->ref = 1; x.d->sharable = true; @@ -474,31 +474,31 @@ void QVector::realloc(int asize, int aalloc) } if (QTypeInfo::isComplex) { if (asize < d->size) { - j = d->array + asize; - i = x.d->array + asize; + j = p->array + asize; + i = x.p->array + asize; } else { // construct all new objects when growing - i = x.d->array + asize; - j = x.d->array + d->size; + i = x.p->array + asize; + j = x.p->array + d->size; while (i != j) new (--i) T; - j = d->array + d->size; + j = p->array + d->size; } if (i != j) { // copy objects from the old array into the new array - b = x.d->array; + b = x.p->array; while (i != b) new (--i) T(*--j); } } else if (asize > d->size) { // initialize newly allocated memory to 0 - qMemSet(x.d->array + d->size, 0, (asize - d->size) * sizeof(T)); + qMemSet(x.p->array + d->size, 0, (asize - d->size) * sizeof(T)); } x.d->size = asize; x.d->alloc = aalloc; if (d != x.d) { if (!d->ref.deref()) - free(d); + free(p); d = x.d; } } @@ -506,15 +506,15 @@ void QVector::realloc(int asize, int aalloc) template Q_OUTOFLINE_TEMPLATE T QVector::value(int i) const { - if (i < 0 || i >= p->size) { + if (i < 0 || i >= d->size) { return T(); } - return d->array[i]; + return p->array[i]; } template Q_OUTOFLINE_TEMPLATE T QVector::value(int i, const T &defaultValue) const { - return ((i < 0 || i >= p->size) ? defaultValue : d->array[i]); + return ((i < 0 || i >= d->size) ? defaultValue : p->array[i]); } template @@ -525,14 +525,14 @@ void QVector::append(const T &t) realloc(d->size, QVectorData::grow(sizeOfTypedData(), d->size + 1, sizeof(T), QTypeInfo::isStatic)); if (QTypeInfo::isComplex) - new (d->array + d->size) T(copy); + new (p->array + d->size) T(copy); else - d->array[d->size] = copy; + p->array[d->size] = copy; } else { if (QTypeInfo::isComplex) - new (d->array + d->size) T(t); + new (p->array + d->size) T(t); else - d->array[d->size] = t; + p->array[d->size] = t; } ++d->size; } @@ -540,27 +540,27 @@ void QVector::append(const T &t) template Q_TYPENAME QVector::iterator QVector::insert(iterator before, size_type n, const T &t) { - int offset = before - d->array; + int offset = before - p->array; if (n != 0) { const T copy(t); if (d->ref != 1 || d->size + n > d->alloc) realloc(d->size, QVectorData::grow(sizeOfTypedData(), d->size + n, sizeof(T), QTypeInfo::isStatic)); if (QTypeInfo::isStatic) { - T *b = d->array + d->size; - T *i = d->array + d->size + n; + T *b = p->array + d->size; + T *i = p->array + d->size + n; while (i != b) new (--i) T; - i = d->array + d->size; + i = p->array + d->size; T *j = i + n; - b = d->array + offset; + b = p->array + offset; while (i != b) *--j = *--i; i = b+n; while (i != b) *--i = copy; } else { - T *b = d->array + offset; + T *b = p->array + offset; T *i = b + n; memmove(i, b, (d->size - offset) * sizeof(T)); while (i != b) @@ -568,29 +568,29 @@ Q_TYPENAME QVector::iterator QVector::insert(iterator before, size_type n, } d->size += n; } - return d->array + offset; + return p->array + offset; } template Q_TYPENAME QVector::iterator QVector::erase(iterator abegin, iterator aend) { - int f = abegin - d->array; - int l = aend - d->array; + int f = abegin - p->array; + int l = aend - p->array; int n = l - f; detach(); if (QTypeInfo::isComplex) { - qCopy(d->array+l, d->array+d->size, d->array+f); - T *i = d->array+d->size; - T* b = d->array+d->size-n; + qCopy(p->array+l, p->array+d->size, p->array+f); + T *i = p->array+d->size; + T* b = p->array+d->size-n; while (i != b) { --i; i->~T(); } } else { - memmove(d->array + f, d->array + l, (d->size-l)*sizeof(T)); + memmove(p->array + f, p->array + l, (d->size-l)*sizeof(T)); } d->size -= n; - return d->array + f; + return p->array + f; } template @@ -600,9 +600,9 @@ bool QVector::operator==(const QVector &v) const return false; if (d == v.d) return true; - T* b = d->array; + T* b = p->array; T* i = b + d->size; - T* j = v.d->array + d->size; + T* j = v.p->array + d->size; while (i != b) if (!(*--i == *--j)) return false; @@ -615,8 +615,8 @@ QVector &QVector::fill(const T &from, int asize) const T copy(from); resize(asize < 0 ? d->size : asize); if (d->size) { - T *i = d->array + d->size; - T *b = d->array; + T *i = p->array + d->size; + T *b = p->array; while (i != b) *--i = copy; } @@ -629,9 +629,9 @@ QVector &QVector::operator+=(const QVector &l) int newSize = d->size + l.d->size; realloc(d->size, newSize); - T *w = d->array + newSize; - T *i = l.d->array + l.d->size; - T *b = l.d->array; + T *w = p->array + newSize; + T *i = l.p->array + l.d->size; + T *b = l.p->array; while (i != b) { if (QTypeInfo::isComplex) new (--w) T(*--i); @@ -648,11 +648,11 @@ int QVector::indexOf(const T &t, int from) const if (from < 0) from = qMax(from + d->size, 0); if (from < d->size) { - T* n = d->array + from - 1; - T* e = d->array + d->size; + T* n = p->array + from - 1; + T* e = p->array + d->size; while (++n != e) if (*n == t) - return n - d->array; + return n - p->array; } return -1; } @@ -665,8 +665,8 @@ int QVector::lastIndexOf(const T &t, int from) const else if (from >= d->size) from = d->size-1; if (from >= 0) { - T* b = d->array; - T* n = d->array + from + 1; + T* b = p->array; + T* n = p->array + from + 1; while (n != b) { if (*--n == t) return n - b; @@ -678,8 +678,8 @@ int QVector::lastIndexOf(const T &t, int from) const template bool QVector::contains(const T &t) const { - T* b = d->array; - T* i = d->array + d->size; + T* b = p->array; + T* i = p->array + d->size; while (i != b) if (*--i == t) return true; @@ -690,8 +690,8 @@ template int QVector::count(const T &t) const { int c = 0; - T* b = d->array; - T* i = d->array + d->size; + T* b = p->array; + T* i = p->array + d->size; while (i != b) if (*--i == t) ++c; -- cgit v0.12 From 343e848abc19f15a30e73f53117a0c001b081e7f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 14 May 2009 16:50:17 +0200 Subject: Make QVectorTypedData inheriting from QVectorData This way the content of QVectorData is not duplicated in the code. Reviewed-by: Thiago Reviewed-by: Brad --- src/corelib/tools/qvector.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 8aa61ff..7bdcba0 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -82,19 +82,9 @@ struct Q_CORE_EXPORT QVectorData }; template -struct QVectorTypedData -{ - QBasicAtomicInt ref; - int alloc; - int size; -#if defined(QT_ARCH_SPARC) && defined(Q_CC_GNU) && defined(__LP64__) && defined(QT_BOOTSTRAPPED) - // workaround for bug in gcc 3.4.2 - uint sharable; - uint capacity; -#else - uint sharable : 1; - uint capacity : 1; -#endif +struct QVectorTypedData : private QVectorData +{ // private inheritance as we must not access QVectorData member thought QVectorTypedData + // as this would break strict aliasing rules. (in the case of shared_null) T array[1]; }; -- cgit v0.12 From 7e4d4474d10cb17047d95e3a4820388468c74507 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 18 May 2009 11:22:05 +0200 Subject: Fix compilation of the cssparser test the Q_GUI_EXPORT macro have been removed, but we still need to export the classes for the test --- src/gui/text/qcssparser_p.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index fbd6c16..72bd637 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -403,7 +403,7 @@ struct BorderData { // 4. QVector - { prop1: value1; prop2: value2; } // 5. Declaration - prop1: value1; -struct Declaration +struct Q_AUTOTEST_EXPORT Declaration { struct DeclarationData : public QSharedData { @@ -539,7 +539,7 @@ struct BasicSelector Relation relationToNext; }; -struct Selector +struct Q_AUTOTEST_EXPORT Selector { QVector basicSelectors; int specificity() const; @@ -552,7 +552,7 @@ struct MediaRule; struct PageRule; struct ImportRule; -struct ValueExtractor +struct Q_AUTOTEST_EXPORT ValueExtractor { ValueExtractor(const QVector &declarations, const QPalette & = QPalette()); -- cgit v0.12 From ef310a8cf2067a2fe21d6812cf34fb8aaad74f48 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Mon, 18 May 2009 15:40:51 +0200 Subject: Prevent a crash with brushed metal windows and a qApp style sheet My great metal hack simply needs to hack more and not do the "extra" assign since I'm doing this through a back door in set attribute. We probably should have had the brushed metal go via an actual QStyle subclass instead of through the attribute. Task-number: 253448 Reviewed-by: ogoffart --- src/gui/kernel/qwidget.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index d911b48..4cb9380 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2343,13 +2343,26 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool ) { Q_Q(QWidget); - createExtra(); - QStyle *oldStyle = q->style(); #ifndef QT_NO_STYLE_STYLESHEET - QStyle *origStyle = extra->style; + QStyle *origStyle = 0; +#endif + +#ifdef Q_WS_MAC + // the metalhack boolean allows Qt/Mac to do a proper re-polish depending + // on how the Qt::WA_MacBrushedMetal attribute is set. It is only ever + // set when changing that attribute and passes the widget's CURRENT style. + // therefore no need to do a reassignment. + if (!metalHack) #endif - extra->style = newStyle; + { + createExtra(); + +#ifndef QT_NO_STYLE_STYLESHEET + origStyle = extra->style; +#endif + extra->style = newStyle; + } // repolish if (q->windowType() != Qt::Desktop) { -- cgit v0.12 From e5755e131952ab5c3c8dd0fd6a88dbaa7148898a Mon Sep 17 00:00:00 2001 From: Benjamin C Meyer Date: Wed, 29 Apr 2009 11:15:25 -0400 Subject: Fix QNetworkDiskCache to expire the oldest files first. When expiring cache files use a QMultiMap, when using a QMap not all files are put into the map because often many files (downloaded or updated at the same time) will have the same creation QDateTime and so only one will go into the QMap who's key is QDateTime. Reviewed-By: Thiago Macieira Reviewed-By: Peter Hartmann --- src/network/access/qnetworkdiskcache.cpp | 6 +++--- tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 892929e..44a8298 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -494,21 +494,21 @@ qint64 QNetworkDiskCache::expire() QDir::Filters filters = QDir::AllDirs | QDir:: Files | QDir::NoDotAndDotDot; QDirIterator it(cacheDirectory(), filters, QDirIterator::Subdirectories); - QMap cacheItems; + QMultiMap cacheItems; qint64 totalSize = 0; while (it.hasNext()) { QString path = it.next(); QFileInfo info = it.fileInfo(); QString fileName = info.fileName(); if (fileName.endsWith(CACHE_POSTFIX) && fileName.startsWith(CACHE_PREFIX)) { - cacheItems[info.created()] = path; + cacheItems.insert(info.created(), path); totalSize += info.size(); } } int removedFiles = 0; qint64 goal = (maximumCacheSize() * 9) / 10; - QMap::const_iterator i = cacheItems.constBegin(); + QMultiMap::const_iterator i = cacheItems.constBegin(); while (i != cacheItems.constEnd()) { if (totalSize < goal) break; diff --git a/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index fc15437..2383767 100644 --- a/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp @@ -389,7 +389,8 @@ void tst_QNetworkDiskCache::expire() qint64 max = cache.maximumCacheSize(); QCOMPARE(max, limit); for (int i = 0; i < 10; ++i) { - QTest::qWait(2000); + if (i % 3 == 0) + QTest::qWait(2000); QNetworkCacheMetaData m; m.setUrl(QUrl("http://www.foo.com/" + QString::number(i))); QIODevice *d = cache.prepare(m); -- cgit v0.12 From d13162dd4695274dc4bdb286ce85bf198391d94b Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Mon, 11 May 2009 15:55:59 +0200 Subject: Fix some typos in the documentation. Usually, "the the" is not proper English Reviewed-By: Thiago Macieira --- doc/src/accessible.qdoc | 2 +- doc/src/deployment.qdoc | 2 +- doc/src/examples/codeeditor.qdoc | 2 +- doc/src/examples/containerextension.qdoc | 2 +- doc/src/examples/fortuneserver.qdoc | 2 +- doc/src/examples/ftp.qdoc | 4 ++-- doc/src/examples/icons.qdoc | 2 +- doc/src/examples/musicplayerexample.qdoc | 2 +- doc/src/examples/qobjectxmlmodel.qdoc | 2 +- doc/src/examples/tabdialog.qdoc | 2 +- doc/src/examples/tooltips.qdoc | 2 +- doc/src/examples/transformations.qdoc | 2 +- doc/src/examples/trollprint.qdoc | 2 +- doc/src/licenses.qdoc | 2 +- doc/src/mac-differences.qdoc | 2 +- doc/src/phonon-api.qdoc | 2 +- doc/src/q3valuelist.qdoc | 2 +- doc/src/qalgorithms.qdoc | 2 +- doc/src/qtdesigner.qdoc | 2 +- doc/src/qtscriptdebugger-manual.qdoc | 2 +- doc/src/stylesheet.qdoc | 8 ++++---- doc/src/tech-preview/known-issues.html | 2 +- doc/src/timers.qdoc | 4 ++-- doc/src/xquery-introduction.qdoc | 2 +- src/corelib/io/qsettings.cpp | 2 +- src/corelib/kernel/qtimer.cpp | 2 +- src/corelib/tools/qrect.cpp | 2 +- src/corelib/tools/qsize.cpp | 2 +- src/corelib/tools/qstringlist.cpp | 2 +- src/gui/embedded/qscreen_qws.cpp | 2 +- src/gui/graphicsview/qgraphicslayoutitem.cpp | 2 +- src/gui/graphicsview/qgraphicssceneevent.cpp | 14 +++++++------- src/gui/image/qicon.cpp | 2 +- src/gui/image/qimage.cpp | 2 +- src/gui/image/qpixmap.cpp | 2 +- src/gui/itemviews/qabstractitemview.cpp | 2 +- src/gui/itemviews/qlistwidget.cpp | 2 +- src/gui/kernel/qclipboard.cpp | 2 +- src/gui/kernel/qwidget.cpp | 2 +- src/gui/painting/qpainterpath.cpp | 2 +- src/gui/text/qfontdatabase_x11.cpp | 2 +- src/gui/text/qtextformat.cpp | 2 +- src/gui/util/qundostack.cpp | 2 +- src/gui/widgets/qlcdnumber.cpp | 2 +- src/gui/widgets/qlineedit.cpp | 2 +- src/gui/widgets/qmdiarea.cpp | 2 +- src/gui/widgets/qmenubar.cpp | 2 +- src/gui/widgets/qscrollarea.cpp | 2 +- src/gui/widgets/qsplitter.cpp | 2 +- src/gui/widgets/qtabwidget.cpp | 2 +- src/gui/widgets/qtoolbox.cpp | 2 +- src/network/access/qhttp.cpp | 2 +- src/network/kernel/qnetworkinterface.cpp | 2 +- src/network/socket/qabstractsocket.cpp | 2 +- src/opengl/qgl.cpp | 2 +- src/qt3support/network/q3http.cpp | 2 +- src/qt3support/network/q3urloperator.cpp | 2 +- src/qt3support/widgets/q3action.cpp | 2 +- src/qt3support/widgets/q3groupbox.cpp | 4 ++-- src/qt3support/widgets/q3popupmenu.cpp | 2 +- src/qt3support/widgets/q3progressbar.cpp | 2 +- src/qt3support/widgets/q3scrollview.cpp | 2 +- src/sql/kernel/qsqlquery.cpp | 2 +- src/xml/sax/qxml.cpp | 2 +- 64 files changed, 76 insertions(+), 76 deletions(-) diff --git a/doc/src/accessible.qdoc b/doc/src/accessible.qdoc index 090da86..ad9f4f1 100644 --- a/doc/src/accessible.qdoc +++ b/doc/src/accessible.qdoc @@ -527,7 +527,7 @@ on plugins, consult the plugins \l{How to Create Qt Plugins}{overview document}. - You can omit the the first macro unless you want the plugin + You can omit the first macro unless you want the plugin to be statically linked with the application. \section2 Implementing Interface Factories diff --git a/doc/src/deployment.qdoc b/doc/src/deployment.qdoc index bcfa93d..446c91b 100644 --- a/doc/src/deployment.qdoc +++ b/doc/src/deployment.qdoc @@ -1247,7 +1247,7 @@ \snippet doc/src/snippets/code/doc_src_deployment.qdoc 48 Then we update the source code in \c tools/plugandpaint/main.cpp - to look for the the new plugins. After constructing the + to look for the new plugins. After constructing the QApplication, we add the following code: \snippet doc/src/snippets/code/doc_src_deployment.qdoc 49 diff --git a/doc/src/examples/codeeditor.qdoc b/doc/src/examples/codeeditor.qdoc index 669ab45..d218d0d 100644 --- a/doc/src/examples/codeeditor.qdoc +++ b/doc/src/examples/codeeditor.qdoc @@ -67,7 +67,7 @@ QTextEdit because it is optimized for handling plain text. See the QPlainTextEdit class description for details. - QPlainTextEdit lets us add selections in addition to the the + QPlainTextEdit lets us add selections in addition to the selection the user can make with the mouse or keyboard. We use this functionality to highlight the current line. More on this later. diff --git a/doc/src/examples/containerextension.qdoc b/doc/src/examples/containerextension.qdoc index a4fbcea..6d29cf6 100644 --- a/doc/src/examples/containerextension.qdoc +++ b/doc/src/examples/containerextension.qdoc @@ -305,7 +305,7 @@ MultiPageWidget class \l {designer/containerextension/multipagewidget.cpp}{implementation}). Finally, we implicitly force an update of the page's property - sheet by calling the the + sheet by calling the QDesignerPropertySheetExtension::setChanged() function. \snippet examples/designer/containerextension/multipagewidgetplugin.cpp 4 diff --git a/doc/src/examples/fortuneserver.qdoc b/doc/src/examples/fortuneserver.qdoc index e6a7f85..848a3a3 100644 --- a/doc/src/examples/fortuneserver.qdoc +++ b/doc/src/examples/fortuneserver.qdoc @@ -45,7 +45,7 @@ The Fortune Server example shows how to create a server for a simple network service. It is intended to be run alongside the - \l{network/fortuneclient}{Fortune Client} example or the the + \l{network/fortuneclient}{Fortune Client} example or the \l{network/blockingfortuneclient}{Blocking Fortune Client} example. \image fortuneserver-example.png Screenshot of the Fortune Server example diff --git a/doc/src/examples/ftp.qdoc b/doc/src/examples/ftp.qdoc index 9cc9cd1..7a74a37 100644 --- a/doc/src/examples/ftp.qdoc +++ b/doc/src/examples/ftp.qdoc @@ -172,7 +172,7 @@ no entries were found (in which case our \c addToList() function would not have been called). - Let's continue with the the \c addToList() slot: + Let's continue with the \c addToList() slot: \snippet examples/network/ftp/ftpwindow.cpp 10 @@ -190,7 +190,7 @@ \snippet examples/network/ftp/ftpwindow.cpp 12 - \c cdToParent() is invoked when the the user requests to go to the + \c cdToParent() is invoked when the user requests to go to the parent directory of the one displayed in the file list. After changing the directory, we QFtp::List its contents. diff --git a/doc/src/examples/icons.qdoc b/doc/src/examples/icons.qdoc index 750ef2e..a81ddb9 100644 --- a/doc/src/examples/icons.qdoc +++ b/doc/src/examples/icons.qdoc @@ -479,7 +479,7 @@ QTableWidget::openPersistentEditor() function to create comboboxes for the mode and state columns of the items. - Due to the the connection between the table widget's \l + Due to the connection between the table widget's \l {QTableWidget::itemChanged()}{itemChanged()} signal and the \c changeIcon() slot, the new image is automatically converted into a pixmap and made part of the set of pixmaps available to the icon diff --git a/doc/src/examples/musicplayerexample.qdoc b/doc/src/examples/musicplayerexample.qdoc index d23c1f1..9f04bf6 100644 --- a/doc/src/examples/musicplayerexample.qdoc +++ b/doc/src/examples/musicplayerexample.qdoc @@ -154,7 +154,7 @@ \snippet examples/phonon/musicplayer/mainwindow.cpp 5 - We move on to the the slots of \c MainWindow, starting with \c + We move on to the slots of \c MainWindow, starting with \c addFiles(): \snippet examples/phonon/musicplayer/mainwindow.cpp 6 diff --git a/doc/src/examples/qobjectxmlmodel.qdoc b/doc/src/examples/qobjectxmlmodel.qdoc index ce1dab6..37c66bc 100644 --- a/doc/src/examples/qobjectxmlmodel.qdoc +++ b/doc/src/examples/qobjectxmlmodel.qdoc @@ -71,7 +71,7 @@ The query engine can only traverse two dimensional trees, because an XML document is always a two dimensional tree. If we want to add the QMetaObject tree to the node model, we have to somehow flatten it - into the the same plane as the QObject tree. This requires that the + into the same plane as the QObject tree. This requires that the node model class must build an auxiliary data structure and make it part of the two dimensional QObject node model. How to do this is explained in \l{Including The QMetaObject Tree}. diff --git a/doc/src/examples/tabdialog.qdoc b/doc/src/examples/tabdialog.qdoc index c9500af..5394b82 100644 --- a/doc/src/examples/tabdialog.qdoc +++ b/doc/src/examples/tabdialog.qdoc @@ -91,7 +91,7 @@ \snippet examples/dialogs/tabdialog/tabdialog.cpp 1 \snippet examples/dialogs/tabdialog/tabdialog.cpp 3 - We arrange the the tab widget above the buttons in the dialog: + We arrange the tab widget above the buttons in the dialog: \snippet examples/dialogs/tabdialog/tabdialog.cpp 4 diff --git a/doc/src/examples/tooltips.qdoc b/doc/src/examples/tooltips.qdoc index 5daa2b2..78b350b 100644 --- a/doc/src/examples/tooltips.qdoc +++ b/doc/src/examples/tooltips.qdoc @@ -353,7 +353,7 @@ Whenever the user creates a new shape item, we want the new item to appear at a random position, and we use the \c randomItemPosition() function to calculate such a position. We - make sure that the item appears within the the visible area of the + make sure that the item appears within the visible area of the \c SortingBox widget, using the widget's current width and heigth when calculating the random coordinates. diff --git a/doc/src/examples/transformations.qdoc b/doc/src/examples/transformations.qdoc index eabb803..58c8b80 100644 --- a/doc/src/examples/transformations.qdoc +++ b/doc/src/examples/transformations.qdoc @@ -208,7 +208,7 @@ After transforming the coordinate system, we draw the \c RenderArea's shape, and then we restore the painter state using - the the QPainter::restore() function (i.e. popping the saved state off + the QPainter::restore() function (i.e. popping the saved state off the stack). \snippet examples/painting/transformations/renderarea.cpp 7 diff --git a/doc/src/examples/trollprint.qdoc b/doc/src/examples/trollprint.qdoc index 38251ee..489012e 100644 --- a/doc/src/examples/trollprint.qdoc +++ b/doc/src/examples/trollprint.qdoc @@ -142,7 +142,7 @@ We can easily determine which file must be changed because the translator's "context" is in fact the class name for the class where the texts that must be changed appears. In this case the file is \c - printpanel.cpp, where the there are four lines to change. Add the + printpanel.cpp, where there are four lines to change. Add the second argument "two-sided" in the appropriate \c tr() calls to the first pair of radio buttons: diff --git a/doc/src/licenses.qdoc b/doc/src/licenses.qdoc index 1c3f6d2..a11c071 100644 --- a/doc/src/licenses.qdoc +++ b/doc/src/licenses.qdoc @@ -45,7 +45,7 @@ \ingroup licensing \brief Information about other licenses used for Qt components and third-party code. - Qt contains some code that is not provided under the the + Qt contains some code that is not provided under the \l{GNU General Public License (GPL)}, \l{GNU Lesser General Public License (LGPL)} or the \l{Qt Commercial Editions}{Qt Commercial License Agreement}, but rather under diff --git a/doc/src/mac-differences.qdoc b/doc/src/mac-differences.qdoc index 573e62d..5849850 100644 --- a/doc/src/mac-differences.qdoc +++ b/doc/src/mac-differences.qdoc @@ -128,7 +128,7 @@ If you want to build a new dynamic library combining the Qt 4 dynamic libraries, you need to introduce the \c{ld -r} flag. Then - relocation information is stored in the the output file, so that + relocation information is stored in the output file, so that this file could be the subject of another \c ld run. This is done by setting the \c -r flag in the \c .pro file, and the \c LFLAGS settings. diff --git a/doc/src/phonon-api.qdoc b/doc/src/phonon-api.qdoc index 501b5a5..dd37fe2 100644 --- a/doc/src/phonon-api.qdoc +++ b/doc/src/phonon-api.qdoc @@ -2973,7 +2973,7 @@ \value ToggledHint If this hint is set it means that - the the control has only two states: zero and non-zero + the control has only two states: zero and non-zero (see isToggleControl()). \value LogarithmicHint diff --git a/doc/src/q3valuelist.qdoc b/doc/src/q3valuelist.qdoc index be315c2..e3681af 100644 --- a/doc/src/q3valuelist.qdoc +++ b/doc/src/q3valuelist.qdoc @@ -108,7 +108,7 @@ pointing to the removed member become invalid. Inserting into the list does not invalidate any iterator. For convenience, the function last() returns a reference to the last item in the list, - and first() returns a reference to the the first item. If the + and first() returns a reference to the first item. If the list is empty(), both last() and first() have undefined behavior (your application will crash or do unpredictable things). Use last() and first() with caution, for example: diff --git a/doc/src/qalgorithms.qdoc b/doc/src/qalgorithms.qdoc index b33c250..90289f9 100644 --- a/doc/src/qalgorithms.qdoc +++ b/doc/src/qalgorithms.qdoc @@ -59,7 +59,7 @@ If STL is available on all your target platforms, you can use the STL algorithms instead of their Qt counterparts. One reason why - you might want to use the the STL algorithms is that STL provides + you might want to use the STL algorithms is that STL provides dozens and dozens of algorithms, whereas Qt only provides the most important ones, making no attempt to duplicate functionality that is already provided by the C++ standard. diff --git a/doc/src/qtdesigner.qdoc b/doc/src/qtdesigner.qdoc index 7e3b619..9699c5b 100644 --- a/doc/src/qtdesigner.qdoc +++ b/doc/src/qtdesigner.qdoc @@ -632,7 +632,7 @@ /*! \fn void QDesignerContainerExtension::setCurrentIndex(int index) - Sets the the currently selected page in the container to be the + Sets the currently selected page in the container to be the page at the given \a index in the extension's list of pages. \sa currentIndex() diff --git a/doc/src/qtscriptdebugger-manual.qdoc b/doc/src/qtscriptdebugger-manual.qdoc index 3dfe879..75d87f8 100644 --- a/doc/src/qtscriptdebugger-manual.qdoc +++ b/doc/src/qtscriptdebugger-manual.qdoc @@ -367,7 +367,7 @@ \section3 continue Continues execution normally, i.e, gives the execution control over - the script back the the QScriptEngine. + the script back to the QScriptEngine. \section3 eval diff --git a/doc/src/stylesheet.qdoc b/doc/src/stylesheet.qdoc index f895918..46ec041 100644 --- a/doc/src/stylesheet.qdoc +++ b/doc/src/stylesheet.qdoc @@ -332,7 +332,7 @@ respect to the reference element. Once positioned, they are treated the same as widgets and can be styled - using the the \l{box model}. + using the \l{box model}. See the \l{List of Sub-Controls} below for a list of supported sub-controls, and \l{Customizing the QPushButton's Menu Indicator @@ -671,7 +671,7 @@ \l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin} properties. - Once positioned, sub-controls can be styled using the the \l{box model}. + Once positioned, sub-controls can be styled using the \l{box model}. \note With complex widgets such as QComboBox and QScrollBar, if one property or sub-control is customized, \bold{all} the other properties or @@ -1154,7 +1154,7 @@ \l{#pane-sub}{::pane} subcontrol. The left and right corners are styled using the \l{#left-corner-sub}{::left-corner} and \l{#right-corner-sub}{::right-corner} respectively. - The position of the the tab bar is controlled using the + The position of the tab bar is controlled using the \l{#tab-bar-sub}{::tab-bar} subcontrol. By default, the subcontrols have positions of a QTabWidget in @@ -1254,7 +1254,7 @@ the \l{#menu-button-sub}{::menu-button} subcontrol is used to draw the menu button. \l{#menu-arrow-sub}{::menu-arrow} subcontrol is used to draw the menu arrow inside the menu-button. By default, it is - positioned in the center of the Contents rectangle of the the + positioned in the center of the Contents rectangle of the menu-button subcontrol. When the QToolButton displays arrows, the \l{#up-arrow-sub}{::up-arrow}, diff --git a/doc/src/tech-preview/known-issues.html b/doc/src/tech-preview/known-issues.html index 05df69e..885104e 100644 --- a/doc/src/tech-preview/known-issues.html +++ b/doc/src/tech-preview/known-issues.html @@ -16,7 +16,7 @@

    Known Issues: Qt 4.0.0 Technology Preview 1

    - This is the list of known and reported issues for the the Qt 4.0.0 + This is the list of known and reported issues for the Qt 4.0.0 Technology Preview 1. This list is updated daily.



    diff --git a/doc/src/timers.qdoc b/doc/src/timers.qdoc index 4f54343..1b48d7d 100644 --- a/doc/src/timers.qdoc +++ b/doc/src/timers.qdoc @@ -62,7 +62,7 @@ In multithreaded applications, you can use the timer mechanism in any thread that has an event loop. To start an event loop from a - non-GUI thread, use QThread::exec(). Qt uses the the object's + non-GUI thread, use QThread::exec(). Qt uses the object's \l{QObject::thread()}{thread affinity} to determine which thread will deliver the QTimerEvent. Because of this, you must start and stop all timers in the object's thread; it is not possible to @@ -105,7 +105,7 @@ In multithreaded applications, you can use QTimer in any thread that has an event loop. To start an event loop from a non-GUI - thread, use QThread::exec(). Qt uses the the timer's + thread, use QThread::exec(). Qt uses the timer's \l{QObject::thread()}{thread affinity} to determine which thread will emit the \l{QTimer::}{timeout()} signal. Because of this, you must start and stop the timer in its thread; it is not possible to diff --git a/doc/src/xquery-introduction.qdoc b/doc/src/xquery-introduction.qdoc index 37a45ac..fe541e2 100644 --- a/doc/src/xquery-introduction.qdoc +++ b/doc/src/xquery-introduction.qdoc @@ -347,7 +347,7 @@ has a more detailed section on the shorthand form, which it calls the \l{http://www.w3.org/TR/xquery/#abbrev} {abbreviated syntax}. More examples of path expressions written in the shorthand form are found there. There is also a section listing examples of path expressions -written in the the \l{http://www.w3.org/TR/xquery/#unabbrev} {longhand +written in the \l{http://www.w3.org/TR/xquery/#unabbrev} {longhand form}. \target Name Tests diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 484e79a..14fc2d4 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2295,7 +2295,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, As mentioned in the \l{Fallback Mechanism} section, QSettings stores settings for an application in up to four locations, depending on whether the settings are user-specific or - system-wide and whether the the settings are application-specific + system-wide and whether the settings are application-specific or organization-wide. For simplicity, we're assuming the organization is called MySoft and the application is called Star Runner. diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 01e81ab..4b3feb0 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -77,7 +77,7 @@ QT_BEGIN_NAMESPACE In multithreaded applications, you can use QTimer in any thread that has an event loop. To start an event loop from a non-GUI - thread, use QThread::exec(). Qt uses the the timer's + thread, use QThread::exec(). Qt uses the timer's \l{QObject::thread()}{thread affinity} to determine which thread will emit the \l{QTimer::}{timeout()} signal. Because of this, you must start and stop the timer in its thread; it is not possible to diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp index 3930a0d..5602170 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -901,7 +901,7 @@ void QRect::moveCenter(const QPoint &p) /*! \fn bool QRect::contains(const QPoint &point, bool proper) const - Returns true if the the given \a point is inside or on the edge of + Returns true if the given \a point is inside or on the edge of the rectangle, otherwise returns false. If \a proper is true, this function only returns true if the given \a point is \e inside the rectangle (i.e., not on the edge). diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp index 76a5484..bbf6c2a 100644 --- a/src/corelib/tools/qsize.cpp +++ b/src/corelib/tools/qsize.cpp @@ -781,7 +781,7 @@ void QSizeF::scale(const QSizeF &s, Qt::AspectRatioMode mode) \fn QDataStream &operator<<(QDataStream &stream, const QSizeF &size) \relates QSizeF - Writes the the given \a size to the given \a stream and returns a + Writes the given \a size to the given \a stream and returns a reference to the stream. \sa {Format of the QDataStream Operators} diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index 386321f1..e22f122 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -397,7 +397,7 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegExp &r \fn QString QStringList::join(const QString &separator) const Joins all the string list's strings into a single string with each - element separated by the the given \a separator (which can be an + element separated by the given \a separator (which can be an empty string). \sa QString::split() diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp index 6741f2c..39a74d5 100644 --- a/src/gui/embedded/qscreen_qws.cpp +++ b/src/gui/embedded/qscreen_qws.cpp @@ -1394,7 +1394,7 @@ QImage::Format QScreenPrivate::preferredImageFormat() const altered. Note that the default implementations of these functions do nothing. - Reimplement the the mapFromDevice() and mapToDevice() functions to + Reimplement the mapFromDevice() and mapToDevice() functions to map objects from the framebuffer coordinate system to the coordinate space used by the application, and vice versa. Be aware that the default implementations simply return the given objects diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index eaa97ff..b46e05e 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -255,7 +255,7 @@ QGraphicsItem *QGraphicsLayoutItemPrivate::parentItem() const passing a QGraphicsLayoutItem pointer to QGraphicsLayoutItem's protected constructor, or by calling setParentLayoutItem(). The parentLayoutItem() function returns a pointer to the item's layoutItem - parent. If the item's parent is 0 or if the the parent does not inherit + parent. If the item's parent is 0 or if the parent does not inherit from QGraphicsItem, the parentLayoutItem() function then returns 0. isLayout() returns true if the QGraphicsLayoutItem subclass is itself a layout, or false otherwise. diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp index b819c2c..0ffd2b1 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.cpp +++ b/src/gui/graphicsview/qgraphicssceneevent.cpp @@ -844,7 +844,7 @@ QGraphicsSceneContextMenuEvent::~QGraphicsSceneContextMenuEvent() /*! Returns the position of the mouse cursor in item coordinates at the moment - the the context menu was requested. + the context menu was requested. \sa scenePos(), screenPos() */ @@ -992,7 +992,7 @@ QGraphicsSceneHoverEvent::~QGraphicsSceneHoverEvent() /*! Returns the position of the mouse cursor in item coordinates at the moment - the the hover event was sent. + the hover event was sent. \sa scenePos(), screenPos() */ @@ -1017,7 +1017,7 @@ void QGraphicsSceneHoverEvent::setPos(const QPointF &pos) /*! Returns the position of the mouse cursor in scene coordinates at the - moment the the hover event was sent. + moment the hover event was sent. \sa pos(), screenPos() */ @@ -1042,7 +1042,7 @@ void QGraphicsSceneHoverEvent::setScenePos(const QPointF &pos) /*! Returns the position of the mouse cursor in screen coordinates at the - moment the the hover event was sent. + moment the hover event was sent. \sa pos(), scenePos() */ @@ -1138,7 +1138,7 @@ void QGraphicsSceneHoverEvent::setLastScreenPos(const QPoint &pos) /*! \since 4.4 - Returns the keyboard modifiers at the moment the the hover event was sent. + Returns the keyboard modifiers at the moment the hover event was sent. */ Qt::KeyboardModifiers QGraphicsSceneHoverEvent::modifiers() const { @@ -1184,7 +1184,7 @@ QGraphicsSceneHelpEvent::~QGraphicsSceneHelpEvent() /*! Returns the position of the mouse cursor in scene coordinates at the - moment the the help event was sent. + moment the help event was sent. \sa screenPos() */ @@ -1209,7 +1209,7 @@ void QGraphicsSceneHelpEvent::setScenePos(const QPointF &pos) /*! Returns the position of the mouse cursor in screen coordinates at the - moment the the help event was sent. + moment the help event was sent. \sa scenePos() */ diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 53430ab..a880a13 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -922,7 +922,7 @@ QList QIcon::availableSizes(Mode mode, State state) const \relates QIcon \since 4.2 - Writes the given \a icon to the the given \a stream as a PNG + Writes the given \a icon to the given \a stream as a PNG image. If the icon contains more than one image, all images will be written to the stream. Note that writing the stream to a file will not produce a valid image file. diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index c7a20db..70d4e2c 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4996,7 +4996,7 @@ QPoint QImage::offset() const /*! \fn void QImage::setOffset(const QPoint& offset) - Sets the the number of pixels by which the image is intended to be + Sets the number of pixels by which the image is intended to be offset by when positioning relative to other images, to \a offset. \sa offset(), {QImage#Image Information}{Image Information} diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index efb8260..0f6b649 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1232,7 +1232,7 @@ bool QPixmap::convertFromImage(const QImage &image, ColorMode mode) /*! \relates QPixmap - Writes the given \a pixmap to the the given \a stream as a PNG + Writes the given \a pixmap to the given \a stream as a PNG image. Note that writing the stream to a file will not produce a valid image file. diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 83e05b4..7a3d674 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1338,7 +1338,7 @@ QSize QAbstractItemView::iconSize() const /*! \property QAbstractItemView::textElideMode - \brief the the position of the "..." in elided text. + \brief the position of the "..." in elided text. The default value for all item views is Qt::ElideRight. */ diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp index 7a366d1..bf3b43c 100644 --- a/src/gui/itemviews/qlistwidget.cpp +++ b/src/gui/itemviews/qlistwidget.cpp @@ -1158,7 +1158,7 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, /*! \fn void QListWidget::addItem(QListWidgetItem *item) - Inserts the \a item at the the end of the list widget. + Inserts the \a item at the end of the list widget. \warning A QListWidgetItem can only be added to a QListWidget once. Adding the same QListWidgetItem multiple diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index 917b5d5..bab3449 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -466,7 +466,7 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode) The \a mode argument is used to control which part of the system clipboard is used. If \a mode is QClipboard::Clipboard, this - function clears the the global clipboard contents. If \a mode is + function clears the global clipboard contents. If \a mode is QClipboard::Selection, this function clears the global mouse selection contents. If \a mode is QClipboard::FindBuffer, this function clears the search string buffer. diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 4cb9380..bbf6758 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -6282,7 +6282,7 @@ QByteArray QWidget::saveGeometry() const returns false. If the restored geometry is off-screen, it will be modified to be - inside the the available screen geometry. + inside the available screen geometry. To restore geometry saved using QSettings, you can use code like this: diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index e1f5eea..9ce16d3 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1006,7 +1006,7 @@ void QPainterPath::addPolygon(const QPolygonF &polygon) /*! \fn void QPainterPath::addEllipse(const QRectF &boundingRectangle) - Creates an ellipse within the the specified \a boundingRectangle + Creates an ellipse within the specified \a boundingRectangle and adds it to the painter path as a closed subpath. The ellipse is composed of a clockwise curve, starting and diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index 15e626e..70e1599 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -494,7 +494,7 @@ static inline bool isFixedPitch(char **tokens) Fills in a font definition (QFontDef) from an XLFD (X Logical Font Description). - Returns true if the the given xlfd is valid. + Returns true if the given xlfd is valid. */ bool qt_fillFontDef(const QByteArray &xlfd, QFontDef *fd, int dpi, QtFontDesc *desc) { diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 21bfc4d..38ac4ca 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -1449,7 +1449,7 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style) /*! \since 4.5 \fn bool QTextCharFormat::fontKerning() const - Returns true if the the font kerning is enabled. + Returns true if the font kerning is enabled. \sa setFontKerning() \sa font() diff --git a/src/gui/util/qundostack.cpp b/src/gui/util/qundostack.cpp index 11f65e3..a6b9c23 100644 --- a/src/gui/util/qundostack.cpp +++ b/src/gui/util/qundostack.cpp @@ -715,7 +715,7 @@ int QUndoStack::index() const } /*! - Repeatedly calls undo() or redo() until the the current command index reaches + Repeatedly calls undo() or redo() until the current command index reaches \a idx. This function can be used to roll the state of the document forwards of backwards. indexChanged() is emitted only once. diff --git a/src/gui/widgets/qlcdnumber.cpp b/src/gui/widgets/qlcdnumber.cpp index 0136f1a..af80963 100644 --- a/src/gui/widgets/qlcdnumber.cpp +++ b/src/gui/widgets/qlcdnumber.cpp @@ -1271,7 +1271,7 @@ bool QLCDNumber::event(QEvent *e) /*! \fn int QLCDNumber::margin() const - Returns the with of the the margin around the contents of the widget. + Returns the width of the margin around the contents of the widget. Use QWidget::getContentsMargins() instead. \sa setMargin(), QWidget::getContentsMargins() diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index b03df9e..b76d019 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -3673,7 +3673,7 @@ void QLineEditPrivate::redo() { /*! \fn int QLineEdit::margin() const - Returns the with of the the margin around the contents of the widget. + Returns the width of the margin around the contents of the widget. Use QWidget::getContentsMargins() instead. \sa setMargin(), QWidget::getContentsMargins() diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp index 598d3b5..6acd977 100644 --- a/src/gui/widgets/qmdiarea.cpp +++ b/src/gui/widgets/qmdiarea.cpp @@ -81,7 +81,7 @@ subwindows. This information could be used in a popup menu containing a list of windows, for example. - The subwindows are sorted by the the current + The subwindows are sorted by the current \l{QMdiArea::}{WindowOrder}. This is used for the subWindowList() and for activateNextSubWindow() and acivatePreviousSubWindow(). Also, it is used when cascading or tiling the windows with diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index ccf37db..c63da64 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -2379,7 +2379,7 @@ int QMenuBar::findIdForAction(QAction *act) const /*! \fn int QMenuBar::margin() const - Returns the with of the the margin around the contents of the widget. + Returns the width of the margin around the contents of the widget. Use QWidget::getContentsMargins() instead. \sa setMargin(), QWidget::getContentsMargins() diff --git a/src/gui/widgets/qscrollarea.cpp b/src/gui/widgets/qscrollarea.cpp index 6aca7d3..8b01453 100644 --- a/src/gui/widgets/qscrollarea.cpp +++ b/src/gui/widgets/qscrollarea.cpp @@ -127,7 +127,7 @@ QT_BEGIN_NAMESPACE setting the layout's \l{QLayout::sizeConstraint}{size constraint} property to one which provides constraints on the minimum and/or maximum size of the layout (e.g., QLayout::SetMinAndMaxSize) will - cause the size of the the scroll area to be updated whenever the + cause the size of the scroll area to be updated whenever the contents of the layout changes. For a complete example using the QScrollArea class, see the \l diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp index bf8af35..45e838f 100644 --- a/src/gui/widgets/qsplitter.cpp +++ b/src/gui/widgets/qsplitter.cpp @@ -1517,7 +1517,7 @@ void QSplitter::setOpaqueResize(bool on) /*! \fn int QSplitter::margin() const - Returns the with of the the margin around the contents of the widget. + Returns the width of the margin around the contents of the widget. Use QWidget::getContentsMargins() instead. \sa setMargin(), QWidget::getContentsMargins() diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp index c16e000..43b2f54 100644 --- a/src/gui/widgets/qtabwidget.cpp +++ b/src/gui/widgets/qtabwidget.cpp @@ -504,7 +504,7 @@ QIcon QTabWidget::tabIcon(int index) const } /*! - Returns true if the the page at position \a index is enabled; otherwise returns false. + Returns true if the page at position \a index is enabled; otherwise returns false. \sa setTabEnabled(), QWidget::isEnabled() */ diff --git a/src/gui/widgets/qtoolbox.cpp b/src/gui/widgets/qtoolbox.cpp index 81935a5..271130a 100644 --- a/src/gui/widgets/qtoolbox.cpp +++ b/src/gui/widgets/qtoolbox.cpp @@ -802,7 +802,7 @@ void QToolBox::itemRemoved(int index) /*! \fn int QToolBox::margin() const - Returns the with of the the margin around the contents of the widget. + Returns the width of the margin around the contents of the widget. Use QWidget::getContentsMargins() instead. \sa setMargin(), QWidget::getContentsMargins() diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp index 96ccc91..7d14ab6 100644 --- a/src/network/access/qhttp.cpp +++ b/src/network/access/qhttp.cpp @@ -950,7 +950,7 @@ void QHttpHeader::setContentLength(int len) } /*! - Returns true if the header has an entry for the the special HTTP + Returns true if the header has an entry for the special HTTP header field \c content-type; otherwise returns false. \sa contentType() setContentType() diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index 670745b..960999e 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -397,7 +397,7 @@ QNetworkInterface::~QNetworkInterface() } /*! - Creates a copy of the the QNetworkInterface object contained in \a + Creates a copy of the QNetworkInterface object contained in \a other. */ QNetworkInterface::QNetworkInterface(const QNetworkInterface &other) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index f9750f2..336a7e7 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1127,7 +1127,7 @@ bool QAbstractSocketPrivate::readFromSocket() /*! \internal - Sets up the the internal state after the connection has succeeded. + Sets up the internal state after the connection has succeeded. */ void QAbstractSocketPrivate::fetchConnectionParameters() { diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 04bc611..8f963f8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2588,7 +2588,7 @@ const QGLContext* QGLContext::currentContext() \i paintGL() - Renders the OpenGL scene. Gets called whenever the widget needs to be updated. \i resizeGL() - Sets up the OpenGL viewport, projection, etc. Gets - called whenever the the widget has been resized (and also when it + called whenever the widget has been resized (and also when it is shown for the first time because all newly created widgets get a resize event automatically). \i initializeGL() - Sets up the OpenGL rendering context, defines display diff --git a/src/qt3support/network/q3http.cpp b/src/qt3support/network/q3http.cpp index f1590a6..591b381 100644 --- a/src/qt3support/network/q3http.cpp +++ b/src/qt3support/network/q3http.cpp @@ -626,7 +626,7 @@ void Q3HttpHeader::setContentLength( int len ) } /*! - Returns true if the header has an entry for the the special HTTP + Returns true if the header has an entry for the special HTTP header field \c content-type; otherwise returns false. \sa contentType() setContentType() diff --git a/src/qt3support/network/q3urloperator.cpp b/src/qt3support/network/q3urloperator.cpp index 3f334a8..b415e12 100644 --- a/src/qt3support/network/q3urloperator.cpp +++ b/src/qt3support/network/q3urloperator.cpp @@ -543,7 +543,7 @@ const Q3NetworkOperation *Q3UrlOperator::rename( const QString &oldname, const Q in mind that the get() and put() operations emit this signal through the Q3UrlOperator. The number of transferred bytes and the total bytes that you receive as arguments in this signal do not - relate to the the whole copy operation; they relate first to the + relate to the whole copy operation; they relate first to the get() and then to the put() operation. Always check what type of operation the signal comes from; this is given in the signal's last argument. diff --git a/src/qt3support/widgets/q3action.cpp b/src/qt3support/widgets/q3action.cpp index 4e1a1bf..311212a 100644 --- a/src/qt3support/widgets/q3action.cpp +++ b/src/qt3support/widgets/q3action.cpp @@ -497,7 +497,7 @@ Q3Action::Q3Action(const QIcon& icon, const QString& menuText, QKeySequence acce } /*! - This constructor results in an icon-less action with the the menu + This constructor results in an icon-less action with the menu text \a menuText and keyboard accelerator \a accel. It is a child of \a parent and called \a name. diff --git a/src/qt3support/widgets/q3groupbox.cpp b/src/qt3support/widgets/q3groupbox.cpp index 1fa7e7c..e0b609a 100644 --- a/src/qt3support/widgets/q3groupbox.cpp +++ b/src/qt3support/widgets/q3groupbox.cpp @@ -382,7 +382,7 @@ int Q3GroupBox::insideSpacing() const } /*! - Sets the the width of the inside margin to \a m pixels. + Sets the width of the inside margin to \a m pixels. \sa insideMargin() */ @@ -954,7 +954,7 @@ int Q3GroupBox::frameWidth() const \fn int Q3GroupBox::margin() const \since 4.2 - Returns the width of the the margin around the contents of the widget. + Returns the width of the margin around the contents of the widget. This function uses QWidget::getContentsMargins() to get the margin. diff --git a/src/qt3support/widgets/q3popupmenu.cpp b/src/qt3support/widgets/q3popupmenu.cpp index 7f890b5..0b3a524 100644 --- a/src/qt3support/widgets/q3popupmenu.cpp +++ b/src/qt3support/widgets/q3popupmenu.cpp @@ -134,7 +134,7 @@ QT_BEGIN_NAMESPACE \fn int Q3PopupMenu::margin() const \since 4.2 - Returns the with of the the margin around the contents of the widget. + Returns the width of the margin around the contents of the widget. This function uses QWidget::getContentsMargins() to get the margin. \sa setMargin(), QWidget::getContentsMargins() diff --git a/src/qt3support/widgets/q3progressbar.cpp b/src/qt3support/widgets/q3progressbar.cpp index caae460..81f0dbf 100644 --- a/src/qt3support/widgets/q3progressbar.cpp +++ b/src/qt3support/widgets/q3progressbar.cpp @@ -455,7 +455,7 @@ void Q3ProgressBar::paintEvent(QPaintEvent *) \fn int Q3ProgressBar::margin() const \since 4.2 - Returns the with of the the margin around the contents of the widget. + Returns the width of the margin around the contents of the widget. This function uses QWidget::getContentsMargins() to get the margin. \sa setMargin(), QWidget::getContentsMargins() diff --git a/src/qt3support/widgets/q3scrollview.cpp b/src/qt3support/widgets/q3scrollview.cpp index 91a9203..5a91027 100644 --- a/src/qt3support/widgets/q3scrollview.cpp +++ b/src/qt3support/widgets/q3scrollview.cpp @@ -2038,7 +2038,7 @@ void Q3ScrollView::center(int x, int y) \list \i Margin 0.0 allows (x, y) to be on the edge of the visible area. \i Margin 0.5 ensures that (x, y) is in middle 50% of the visible area. - \i Margin 1.0 ensures that (x, y) is in the center of the the visible area. + \i Margin 1.0 ensures that (x, y) is in the center of the visible area. \endlist */ void Q3ScrollView::center(int x, int y, float xmargin, float ymargin) diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index e6729a5..2a07e28 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -1195,7 +1195,7 @@ void QSqlQuery::finish() The query will be repositioned on an \e invalid record in the new result set and must be navigated to a valid record before data values can be retrieved. If a new result set isn't available the - function returns false and the the query is set to inactive. In any + function returns false and the query is set to inactive. In any case the old result set will be discarded. When one of the statements is a non-select statement a count of diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index c78d4ba..ade0339 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -2107,7 +2107,7 @@ events are reported. You can set the lexical handler with QXmlReader::setLexicalHandler(). - This interface's design is based on the the SAX2 extension + This interface's design is based on the SAX2 extension LexicalHandler. The interface provides the startDTD(), endDTD(), startEntity(), -- cgit v0.12 From d76c5fb7feda66621b435263353f49e9b4b34308 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 14 May 2009 18:30:57 +0200 Subject: Fix handling of dynamic casts in QSharedPointer. It's wrong to assume that static_cast<> is allowed everywhere where dynamic_cast<> is allowed. For example, if class C derives from both A and B, then you can dynamic_cast(ptr_to_A), but you can't static_cast. So introduce a helper for dynamic casts that doesn't do static_cast. Reviewed-by: Olivier Goffart --- src/corelib/tools/qsharedpointer_impl.h | 21 ++-- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 137 +++++++++++++++++++++-- 2 files changed, 140 insertions(+), 18 deletions(-) diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index f1b35ee..ad2d9f2 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -238,6 +238,7 @@ namespace QtSharedPointer { template friend class ExternalRefCount; template friend class QWeakPointer; template friend QSharedPointer qSharedPointerCastHelper(const QSharedPointer &src, X *); + template friend QSharedPointer qSharedPointerDynamicCastHelper(const QSharedPointer &src, X *); template friend QSharedPointer qSharedPointerConstCastHelper(const QSharedPointer &src, X *); template friend QSharedPointer QtSharedPointer::qStrongRefFromWeakHelper(const QWeakPointer &src, X *); #endif @@ -509,6 +510,14 @@ namespace QtSharedPointer { return result; } template + Q_INLINE_TEMPLATE QSharedPointer qSharedPointerDynamicCastHelper(const QSharedPointer &src, X *) + { + QSharedPointer result; + register T *ptr = src.data(); + result.internalSet(src.d, dynamic_cast(ptr)); + return result; + } + template Q_INLINE_TEMPLATE QSharedPointer qSharedPointerConstCastHelper(const QSharedPointer &src, X *) { QSharedPointer result; @@ -544,9 +553,7 @@ template Q_INLINE_TEMPLATE QSharedPointer qSharedPointerDynamicCast(const QSharedPointer &src) { X *x = 0; - if (QtSharedPointer::qVerifyDynamicCast(src.data(), x)) - return QtSharedPointer::qSharedPointerCastHelper(src, x); - return QSharedPointer(); + return QtSharedPointer::qSharedPointerDynamicCastHelper(src, x); } template Q_INLINE_TEMPLATE QSharedPointer qSharedPointerDynamicCast(const QWeakPointer &src) @@ -558,17 +565,13 @@ template Q_INLINE_TEMPLATE QSharedPointer qSharedPointerConstCast(const QSharedPointer &src) { X *x = 0; - if (QtSharedPointer::qVerifyConstCast(src.data(), x)) - return QtSharedPointer::qSharedPointerConstCastHelper(src, x); - return QSharedPointer(); + return QtSharedPointer::qSharedPointerConstCastHelper(src, x); } template Q_INLINE_TEMPLATE QSharedPointer qSharedPointerConstCast(const QWeakPointer &src) { X *x = 0; - if (QtSharedPointer::qVerifyConstCast(src.data(), x)) - return QtSharedPointer::qSharedPointerCastHelper(src, x); - return QSharedPointer(); + return QtSharedPointer::qSharedPointerConstCastHelper(src, x); } template diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 64439fb..a52bb3e 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -57,8 +57,11 @@ private slots: void downCast(); void upCast(); void differentPointers(); + void virtualBaseDifferentPointers(); #ifndef QTEST_NO_RTTI void dynamicCast(); + void dynamicCastDifferentPointers(); + void dynamicCastVirtualBase(); void dynamicCastFailure(); #endif void customDeleter(); @@ -321,6 +324,10 @@ class DiffPtrDerivedData: public Stuffing, public Data { }; +class VirtualDerived: virtual public Data +{ +}; + void tst_QSharedPointer::downCast() { { @@ -439,7 +446,7 @@ void tst_QSharedPointer::differentPointers() DiffPtrDerivedData *aData = new DiffPtrDerivedData; Data *aBase = aData; Q_ASSERT(aData == aBase); - Q_ASSERT(quintptr(&aData) != quintptr(&aBase)); + Q_ASSERT(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); QSharedPointer baseptr = QSharedPointer(aData); QSharedPointer ptr = qSharedPointerCast(baseptr); @@ -453,7 +460,7 @@ void tst_QSharedPointer::differentPointers() DiffPtrDerivedData *aData = new DiffPtrDerivedData; Data *aBase = aData; Q_ASSERT(aData == aBase); - Q_ASSERT(quintptr(&aData) != quintptr(&aBase)); + Q_ASSERT(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); QSharedPointer ptr = QSharedPointer(aData); QSharedPointer baseptr = ptr; @@ -464,23 +471,53 @@ void tst_QSharedPointer::differentPointers() QVERIFY(baseptr == aData); QVERIFY(baseptr == aBase); } +} + +void tst_QSharedPointer::virtualBaseDifferentPointers() +{ + { + VirtualDerived *aData = new VirtualDerived; + Data *aBase = aData; + Q_ASSERT(aData == aBase); + Q_ASSERT(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); + + QSharedPointer ptr = QSharedPointer(aData); + QSharedPointer baseptr = qSharedPointerCast(ptr); + QVERIFY(ptr == baseptr); + QVERIFY(ptr.data() == baseptr.data()); + QVERIFY(ptr == aBase); + QVERIFY(ptr == aData); + QVERIFY(baseptr == aData); + QVERIFY(baseptr == aBase); + } + + { + VirtualDerived *aData = new VirtualDerived; + Data *aBase = aData; + Q_ASSERT(aData == aBase); + Q_ASSERT(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); - // there is no possibility for different pointers in - // internal reference counting right now - // - // to do that, it's necessary to first implement the ability to - // call (virtual) functions, so that the two differing bases have - // the same reference counter + QSharedPointer ptr = QSharedPointer(aData); + QSharedPointer baseptr = ptr; + QVERIFY(ptr == baseptr); + QVERIFY(ptr.data() == baseptr.data()); + QVERIFY(ptr == aBase); + QVERIFY(ptr == aData); + QVERIFY(baseptr == aData); + QVERIFY(baseptr == aBase); + } } #ifndef QTEST_NO_RTTI void tst_QSharedPointer::dynamicCast() { - QSharedPointer baseptr = QSharedPointer(new DerivedData); + DerivedData *aData = new DerivedData; + QSharedPointer baseptr = QSharedPointer(aData); { QSharedPointer derivedptr = qSharedPointerDynamicCast(baseptr); QVERIFY(baseptr == derivedptr); + QCOMPARE(derivedptr.data(), aData); QCOMPARE(static_cast(derivedptr.data()), baseptr.data()); } QCOMPARE(int(baseptr.d->weakref), 1); @@ -490,6 +527,7 @@ void tst_QSharedPointer::dynamicCast() QWeakPointer weakptr = baseptr; QSharedPointer derivedptr = qSharedPointerDynamicCast(weakptr); QVERIFY(baseptr == derivedptr); + QCOMPARE(derivedptr.data(), aData); QCOMPARE(static_cast(derivedptr.data()), baseptr.data()); } QCOMPARE(int(baseptr.d->weakref), 1); @@ -498,6 +536,87 @@ void tst_QSharedPointer::dynamicCast() { QSharedPointer derivedptr = baseptr.dynamicCast(); QVERIFY(baseptr == derivedptr); + QCOMPARE(derivedptr.data(), aData); + QCOMPARE(static_cast(derivedptr.data()), baseptr.data()); + } + QCOMPARE(int(baseptr.d->weakref), 1); + QCOMPARE(int(baseptr.d->strongref), 1); +} + +void tst_QSharedPointer::dynamicCastDifferentPointers() +{ + // DiffPtrDerivedData derives from both Data and Stuffing + DiffPtrDerivedData *aData = new DiffPtrDerivedData; + QSharedPointer baseptr = QSharedPointer(aData); + + { + QSharedPointer derivedptr = qSharedPointerDynamicCast(baseptr); + QVERIFY(baseptr == derivedptr); + QCOMPARE(derivedptr.data(), aData); + QCOMPARE(static_cast(derivedptr.data()), baseptr.data()); + } + QCOMPARE(int(baseptr.d->weakref), 1); + QCOMPARE(int(baseptr.d->strongref), 1); + + { + QWeakPointer weakptr = baseptr; + QSharedPointer derivedptr = qSharedPointerDynamicCast(weakptr); + QVERIFY(baseptr == derivedptr); + QCOMPARE(derivedptr.data(), aData); + QCOMPARE(static_cast(derivedptr.data()), baseptr.data()); + } + QCOMPARE(int(baseptr.d->weakref), 1); + QCOMPARE(int(baseptr.d->strongref), 1); + + { + QSharedPointer derivedptr = baseptr.dynamicCast(); + QVERIFY(baseptr == derivedptr); + QCOMPARE(derivedptr.data(), aData); + QCOMPARE(static_cast(derivedptr.data()), baseptr.data()); + } + QCOMPARE(int(baseptr.d->weakref), 1); + QCOMPARE(int(baseptr.d->strongref), 1); + + { + Stuffing *nakedptr = dynamic_cast(baseptr.data()); + QVERIFY(nakedptr); + + QSharedPointer otherbaseptr = qSharedPointerDynamicCast(baseptr); + QVERIFY(!otherbaseptr.isNull()); + QVERIFY(otherbaseptr == nakedptr); + QCOMPARE(otherbaseptr.data(), nakedptr); + QCOMPARE(static_cast(otherbaseptr.data()), aData); + } +} + +void tst_QSharedPointer::dynamicCastVirtualBase() +{ + VirtualDerived *aData = new VirtualDerived; + QSharedPointer baseptr = QSharedPointer(aData); + + { + QSharedPointer derivedptr = qSharedPointerDynamicCast(baseptr); + QVERIFY(baseptr == derivedptr); + QCOMPARE(derivedptr.data(), aData); + QCOMPARE(static_cast(derivedptr.data()), baseptr.data()); + } + QCOMPARE(int(baseptr.d->weakref), 1); + QCOMPARE(int(baseptr.d->strongref), 1); + + { + QWeakPointer weakptr = baseptr; + QSharedPointer derivedptr = qSharedPointerDynamicCast(weakptr); + QVERIFY(baseptr == derivedptr); + QCOMPARE(derivedptr.data(), aData); + QCOMPARE(static_cast(derivedptr.data()), baseptr.data()); + } + QCOMPARE(int(baseptr.d->weakref), 1); + QCOMPARE(int(baseptr.d->strongref), 1); + + { + QSharedPointer derivedptr = baseptr.dynamicCast(); + QVERIFY(baseptr == derivedptr); + QCOMPARE(derivedptr.data(), aData); QCOMPARE(static_cast(derivedptr.data()), baseptr.data()); } QCOMPARE(int(baseptr.d->weakref), 1); -- cgit v0.12 From 03069de9c398fe7a787388e61badb09ae1b1e6b7 Mon Sep 17 00:00:00 2001 From: Andre Haupt Date: Thu, 14 May 2009 04:44:19 +0200 Subject: Replace all occurences of "heirarchy" with "hierarchy" Signed-off-by: Andre Haupt Reviewed-By: Thiago Macieira --- doc/src/stylesheet.qdoc | 4 ++-- src/corelib/io/qresource.cpp | 2 +- src/gui/widgets/qmenu_p.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/src/stylesheet.qdoc b/doc/src/stylesheet.qdoc index 46ec041..4060f33 100644 --- a/doc/src/stylesheet.qdoc +++ b/doc/src/stylesheet.qdoc @@ -398,7 +398,7 @@ (usually) refers to a single object, not to all instances of a class. - Similarly, selectors with pseudo-states are more specific that + Similarly, selectors with pseudo-states are more specific than ones that do not specify pseudo-states. Thus, the following style sheet specifies that a \l{QPushButton} should have white text when the mouse is hovering over it, otherwise red text: @@ -653,7 +653,7 @@ \target sub controls \section1 Sub-controls - A widget is considered as a heirarchy (tree) of subcontrols drawn on top + A widget is considered as a hierarchy (tree) of subcontrols drawn on top of each other. For example, the QComboBox draws the drop-down sub-control followed by the down-arrow sub-control. A QComboBox is thus rendered as follows: diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index a1f921e..1f77caa 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -406,7 +406,7 @@ QString QResource::absoluteFilePath() const } /*! - Returns true if the resource really exists in the resource heirarchy, + Returns true if the resource really exists in the resource hierarchy, false otherwise. */ diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index e3c4890..74367c4 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -208,7 +208,7 @@ public: QString searchBuffer; QBasicTimer searchBufferTimer; - //passing of mouse events up the parent heirarchy + //passing of mouse events up the parent hierarchy QPointer activeMenu; bool mouseEventTaken(QMouseEvent *); -- cgit v0.12 From 4bdee921aaaeb0ed150f0a9041a92566499a7936 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 18 May 2009 16:45:41 +0200 Subject: Fix compilation after merge --- src/network/access/qhttpnetworkconnection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 161e6e9..43fbb16 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -723,6 +723,7 @@ void QHttpNetworkConnectionPrivate::handleStatus(QAbstractSocket *socket, QHttpN // proxy or server connections.. channels[i].resendCurrent = true; QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); + } } else { int i = indexOf(socket); emit channels[i].reply->headerChanged(); -- cgit v0.12 From f5322311fa5f93e995d4c9dc35c778b11413abf5 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 18 May 2009 16:49:08 +0200 Subject: Fix compilation with strict iterators --- src/corelib/tools/qmap.h | 2 +- tests/auto/qmap/tst_qmap.cpp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 5f13e5a..32c8d17 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -990,7 +990,7 @@ Q_INLINE_TEMPLATE int QMultiMap::remove(const Key &key, const T &value) { int n = 0; typename QMap::iterator i(find(key)); - typename QMap::const_iterator end(QMap::constEnd()); + typename QMap::iterator end(QMap::end()); while (i != end && !qMapLessThanKey(key, i.key())) { if (i.value() == value) { i = erase(i); diff --git a/tests/auto/qmap/tst_qmap.cpp b/tests/auto/qmap/tst_qmap.cpp index 99efc80..68ac8d6 100644 --- a/tests/auto/qmap/tst_qmap.cpp +++ b/tests/auto/qmap/tst_qmap.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#define QT_STRICT_ITERATORS #include #include @@ -400,7 +401,7 @@ void tst_QMap::operator_eq() QVERIFY(a == b); QVERIFY(!(a != b)); - + a.insert(1,1); b.insert(1,1); QVERIFY(a == b); @@ -422,7 +423,7 @@ void tst_QMap::operator_eq() b.insert(-1, -1); QVERIFY(a != b); - QVERIFY(!(a == b)); + QVERIFY(!(a == b)); } { @@ -468,7 +469,7 @@ void tst_QMap::operator_eq() b.insert("willy", 1); QVERIFY(a != b); QVERIFY(!(a == b)); - } + } } void tst_QMap::empty() @@ -523,9 +524,9 @@ void tst_QMap::find() map1.insertMulti(4, compareString); } - QMap::const_iterator it=map1.find(4); + QMap::const_iterator it=map1.constFind(4); - for(i = 9; i > 2 && it != map1.end() && it.key() == 4; --i) { + for(i = 9; i > 2 && it != map1.constEnd() && it.key() == 4; --i) { compareString = testString.arg(i); QVERIFY(it.value() == compareString); ++it; @@ -546,9 +547,9 @@ void tst_QMap::constFind() map1.insert(1,"Mensch"); map1.insert(1,"Mayer"); map1.insert(2,"Hej"); - + QVERIFY(map1.constFind(4) == map1.constEnd()); - + QVERIFY(map1.constFind(1).value() == "Mayer"); QVERIFY(map1.constFind(2).value() == "Hej"); @@ -677,7 +678,7 @@ void tst_QMap::iterators() cstlIt--; QVERIFY(cstlIt.value() == "Teststring 3"); - for(cstlIt = map.begin(), i = 1; cstlIt != map.constEnd(), i < 100; ++cstlIt, ++i) + for(cstlIt = map.constBegin(), i = 1; cstlIt != map.constEnd(), i < 100; ++cstlIt, ++i) QVERIFY(cstlIt.value() == testString.arg(i)); //Java-Style iterators -- cgit v0.12 From a860dfbd20ac99492bb30c646b672e72283bb810 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 18 May 2009 16:54:01 +0200 Subject: Add src/corelib/kernel/qpointer.cpp to src/corelib/kernel/kernel.pri Makes it possible to find it when using QtCreator :) --- src/corelib/kernel/kernel.pri | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index d90ecae..68649a6 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -53,7 +53,8 @@ SOURCES += \ kernel/qvariant.cpp \ kernel/qcoreglobaldata.cpp \ kernel/qsharedmemory.cpp \ - kernel/qsystemsemaphore.cpp + kernel/qsystemsemaphore.cpp \ + kernel/qpointer.cpp win32 { SOURCES += \ -- cgit v0.12 From 0266129d26695987e93c3c3f856e8353a5d7cd89 Mon Sep 17 00:00:00 2001 From: kh Date: Mon, 18 May 2009 17:23:34 +0200 Subject: Make sure we add the progress bar only once. --- tools/assistant/tools/assistant/mainwindow.cpp | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index b0c2c6b..582eef3 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -926,25 +926,27 @@ void MainWindow::expandTOC(int depth) void MainWindow::indexingStarted() { - m_progressWidget = new QWidget(); - QLayout* hlayout = new QHBoxLayout(m_progressWidget); + if (!m_progressWidget) { + m_progressWidget = new QWidget(); + QLayout* hlayout = new QHBoxLayout(m_progressWidget); - QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); - QLabel *label = new QLabel(tr("Updating search index")); - label->setSizePolicy(sizePolicy); - hlayout->addWidget(label); + QLabel *label = new QLabel(tr("Updating search index")); + label->setSizePolicy(sizePolicy); + hlayout->addWidget(label); - QProgressBar *progressBar = new QProgressBar(); - progressBar->setRange(0, 0); - progressBar->setTextVisible(false); - progressBar->setSizePolicy(sizePolicy); + QProgressBar *progressBar = new QProgressBar(); + progressBar->setRange(0, 0); + progressBar->setTextVisible(false); + progressBar->setSizePolicy(sizePolicy); - hlayout->setSpacing(6); - hlayout->setMargin(0); - hlayout->addWidget(progressBar); + hlayout->setSpacing(6); + hlayout->setMargin(0); + hlayout->addWidget(progressBar); - statusBar()->addPermanentWidget(m_progressWidget); + statusBar()->addPermanentWidget(m_progressWidget); + } } void MainWindow::indexingFinished() -- cgit v0.12 From a13ef81dbd66472e7fb0c18ea528502295aa24ab Mon Sep 17 00:00:00 2001 From: kh Date: Mon, 18 May 2009 17:26:34 +0200 Subject: Make ctrl+lmb and mmb work in a same way everywhere (like in browsers). --- .../assistant/tools/assistant/bookmarkmanager.cpp | 77 +++++++++++----------- tools/assistant/tools/assistant/contentwindow.cpp | 9 ++- tools/assistant/tools/assistant/indexwindow.cpp | 9 ++- 3 files changed, 51 insertions(+), 44 deletions(-) diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp index 6f5732f..66475a4 100644 --- a/tools/assistant/tools/assistant/bookmarkmanager.cpp +++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp @@ -536,58 +536,57 @@ void BookmarkWidget::focusInEvent(QFocusEvent *e) bool BookmarkWidget::eventFilter(QObject *object, QEvent *e) { - if (object == this && e->type() == QEvent::KeyPress) { - QKeyEvent *ke = static_cast(e); + if ((object == this) || (object == treeView->viewport())) { QModelIndex index = treeView->currentIndex(); - switch (ke->key()) { + if (e->type() == QEvent::KeyPress) { + QKeyEvent *ke = static_cast(e); if (index.isValid() && searchField->text().isEmpty()) { - case Qt::Key_F2: { - const QModelIndex& source = filterBookmarkModel->mapToSource(index); - QStandardItem *item = - bookmarkManager->treeBookmarkModel()->itemFromIndex(source); + if (ke->key() == Qt::Key_F2) { + QStandardItem *item = bookmarkManager->treeBookmarkModel() + ->itemFromIndex(filterBookmarkModel->mapToSource(index)); if (item) { item->setEditable(true); treeView->edit(index); item->setEditable(false); } - } break; - - case Qt::Key_Delete: { + } else if (ke->key() == Qt::Key_Delete) { bookmarkManager->removeBookmarkItem(treeView, filterBookmarkModel->mapToSource(index)); - } break; + } } - case Qt::Key_Up: - case Qt::Key_Down: - treeView->subclassKeyPressEvent(ke); - break; - - case Qt::Key_Enter: { - case Qt::Key_Return: - index = treeView->selectionModel()->currentIndex(); - if (index.isValid()) { - QString data = index.data(Qt::UserRole + 10).toString(); - if (!data.isEmpty() && data != QLatin1String("Folder")) - emit requestShowLink(data); - } - } break; + switch (ke->key()) { + default: break; + case Qt::Key_Up: { + case Qt::Key_Down: + treeView->subclassKeyPressEvent(ke); + } break; - case Qt::Key_Escape: - emit escapePressed(); - break; + case Qt::Key_Enter: { + case Qt::Key_Return: + index = treeView->selectionModel()->currentIndex(); + if (index.isValid()) { + QString data = index.data(Qt::UserRole + 10).toString(); + if (!data.isEmpty() && data != QLatin1String("Folder")) + emit requestShowLink(data); + } + } break; - default: - break; - } - } - else if (object == treeView->viewport() && e->type() == QEvent::MouseButtonRelease) { - const QModelIndex& index = treeView->currentIndex(); - QMouseEvent *me = static_cast(e); - if (index.isValid() && (me->button() == Qt::MidButton)) { - QString data = index.data(Qt::UserRole + 10).toString(); - if (!data.isEmpty() && data != QLatin1String("Folder")) - CentralWidget::instance()->setSourceInNewTab(data); + case Qt::Key_Escape: { + emit escapePressed(); + } break; + } + } else if (e->type() == QEvent::MouseButtonRelease) { + if (index.isValid()) { + QMouseEvent *me = static_cast(e); + bool controlPressed = me->modifiers() & Qt::ControlModifier; + if(((me->button() == Qt::LeftButton) && controlPressed) + || (me->button() == Qt::MidButton)) { + QString data = index.data(Qt::UserRole + 10).toString(); + if (!data.isEmpty() && data != QLatin1String("Folder")) + CentralWidget::instance()->setSourceInNewTab(data); + } + } } } return QWidget::eventFilter(object, e); diff --git a/tools/assistant/tools/assistant/contentwindow.cpp b/tools/assistant/tools/assistant/contentwindow.cpp index 89060bd..9f39de5 100644 --- a/tools/assistant/tools/assistant/contentwindow.cpp +++ b/tools/assistant/tools/assistant/contentwindow.cpp @@ -124,10 +124,10 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e) QModelIndex index = m_contentWidget->indexAt(me->pos()); QItemSelectionModel *sm = m_contentWidget->selectionModel(); + Qt::MouseButtons button = me->button(); if (index.isValid() && (sm && sm->isSelected(index))) { - if (me->button() == Qt::LeftButton) { - itemClicked(index); - } else if (me->button() == Qt::MidButton) { + if ((button == Qt::LeftButton && (me->modifiers() & Qt::ControlModifier)) + || (button == Qt::MidButton)) { QHelpContentModel *contentModel = qobject_cast(m_contentWidget->model()); if (contentModel) { @@ -135,12 +135,15 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e) if (itm && !isPdfFile(itm)) CentralWidget::instance()->setSourceInNewTab(itm->url()); } + } else if (button == Qt::LeftButton) { + itemClicked(index); } } } return QWidget::eventFilter(o, e); } + void ContentWindow::showContextMenu(const QPoint &pos) { if (!m_contentWidget->indexAt(pos).isValid()) diff --git a/tools/assistant/tools/assistant/indexwindow.cpp b/tools/assistant/tools/assistant/indexwindow.cpp index a2c0950..1117ae0 100644 --- a/tools/assistant/tools/assistant/indexwindow.cpp +++ b/tools/assistant/tools/assistant/indexwindow.cpp @@ -146,8 +146,13 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e) && e->type() == QEvent::MouseButtonRelease) { QMouseEvent *mouseEvent = static_cast(e); QModelIndex idx = m_indexWidget->indexAt(mouseEvent->pos()); - if (idx.isValid() && mouseEvent->button()==Qt::MidButton) - open(m_indexWidget, idx); + if (idx.isValid()) { + Qt::MouseButtons button = mouseEvent->button(); + if (((button == Qt::LeftButton) && (mouseEvent->modifiers() & Qt::ControlModifier)) + || (button == Qt::MidButton)) { + open(m_indexWidget, idx); + } + } } #ifdef Q_OS_MAC else if (obj == m_indexWidget && e->type() == QEvent::KeyPress) { -- cgit v0.12 From 9824e4a9afed9591175b07d22cd130c64b5457cf Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 18 May 2009 17:50:17 +0200 Subject: Added doc about QSharedMemory and other applications Task-number: 253835 Reviewed-by: David Boddie --- src/corelib/kernel/qsharedmemory.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp index 9853079..87e154f 100644 --- a/src/corelib/kernel/qsharedmemory.cpp +++ b/src/corelib/kernel/qsharedmemory.cpp @@ -129,6 +129,10 @@ QSharedMemoryPrivate::makePlatformSafeKey(const QString &key, detached from the segment, and no references to the segment remain. Do not mix using QtSharedMemory and QSharedMemory. Port everything to QSharedMemory. + + \warning QSharedMemory changes the key in a Qt-specific way. + It is therefore currently not possible to use the shared memory of + non-Qt applications with QSharedMemory. */ /*! -- cgit v0.12 From 6e8f112492dec917cdcd9bc50b992eca5d41b998 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 18 May 2009 17:52:39 +0200 Subject: Fixed #includes --- src/declarative/3rdparty/qlistmodelinterface.h | 6 +++--- src/declarative/canvas/qsimplecanvas.h | 2 +- src/declarative/canvas/qsimplecanvasfilter.h | 6 +++--- src/declarative/canvas/qsimplecanvasitem.h | 2 +- src/declarative/extra/qfxintegermodel.h | 6 +++--- src/declarative/extra/qmlnumberformatter.h | 4 ++-- src/declarative/extra/qmlsqlconnection.h | 4 ++-- src/declarative/extra/qmlsqlquery.h | 4 ++-- src/declarative/extra/qmlxmllistmodel.h | 4 ++-- src/declarative/extra/qnumberformat.h | 6 +++--- src/declarative/fx/qfxanchors.h | 6 +++--- src/declarative/fx/qfxanimatedimageitem.h | 2 +- src/declarative/fx/qfxblendedimage.h | 2 +- src/declarative/fx/qfxblurfilter.h | 4 ++-- src/declarative/fx/qfxcomponentinstance.h | 2 +- src/declarative/fx/qfxcontentwrapper.h | 2 +- src/declarative/fx/qfxevents_p.h | 4 ++-- src/declarative/fx/qfxflickable.h | 2 +- src/declarative/fx/qfxflipable.h | 6 +++--- src/declarative/fx/qfxfocuspanel.h | 2 +- src/declarative/fx/qfxfocusrealm.h | 2 +- src/declarative/fx/qfxgridview.h | 2 +- src/declarative/fx/qfxhighlightfilter.h | 4 ++-- src/declarative/fx/qfximage.h | 2 +- src/declarative/fx/qfxitem.h | 4 ++-- src/declarative/fx/qfxitem_p.h | 6 +++--- src/declarative/fx/qfxkeyactions.h | 8 ++++---- src/declarative/fx/qfxkeyproxy.h | 2 +- src/declarative/fx/qfxlayouts.h | 8 ++++---- src/declarative/fx/qfxlayouts_p.h | 10 +++++----- src/declarative/fx/qfxlistview.h | 2 +- src/declarative/fx/qfxmouseregion.h | 2 +- src/declarative/fx/qfxpainteditem.h | 4 ++-- src/declarative/fx/qfxpainteditem_p.h | 4 ++-- src/declarative/fx/qfxparticles.h | 2 +- src/declarative/fx/qfxpath.h | 8 ++++---- src/declarative/fx/qfxpathview.h | 4 ++-- src/declarative/fx/qfxpixmap.h | 8 ++++---- src/declarative/fx/qfxrect.h | 2 +- src/declarative/fx/qfxreflectionfilter.h | 4 ++-- src/declarative/fx/qfxrepeater.h | 2 +- src/declarative/fx/qfxscalegrid.h | 14 +++++++------- src/declarative/fx/qfxshadowfilter.h | 4 ++-- src/declarative/fx/qfxtext.h | 4 ++-- src/declarative/fx/qfxtextedit.h | 4 ++-- src/declarative/fx/qfxtransform.h | 6 +++--- src/declarative/fx/qfxvisualitemmodel.h | 2 +- src/declarative/fx/qfxwebview.h | 10 +++++----- src/declarative/fx/qfxwidgetcontainer.h | 2 ++ src/declarative/opengl/glheaders.h | 2 +- src/declarative/opengl/glsave.h | 6 +++--- src/declarative/opengl/gltexture.h | 6 +++--- src/declarative/qml/qmlbindablevalue.h | 8 ++++---- src/declarative/qml/qmlbindablevalue_p.h | 4 ++-- src/declarative/qml/qmlboundsignal_p.h | 2 +- src/declarative/qml/qmlcompiledcomponent_p.h | 2 +- src/declarative/qml/qmlcompiler_p.h | 4 ++-- src/declarative/qml/qmlcomponent_p.h | 24 ++++++++++++------------ src/declarative/qml/qmlcompositetypemanager_p.h | 4 ++-- src/declarative/qml/qmlcontext_p.h | 6 +++--- src/declarative/qml/qmlengine_p.h | 16 ++++++++-------- src/declarative/qml/qmlinstruction_p.h | 2 +- src/declarative/qml/qmlmetaproperty.h | 2 +- src/declarative/qml/qmlparser_p.h | 6 +++--- src/declarative/qml/qmlpropertyvaluesource.h | 6 +++--- src/declarative/qml/qmlproxymetaobject_p.h | 6 +++--- src/declarative/qml/qmlrefcount_p.h | 2 +- src/declarative/qml/qmlvme_p.h | 8 ++++---- src/declarative/qml/qmlvmemetaobject_p.h | 6 +++--- src/declarative/qml/script/lexer.h | 2 +- src/declarative/qml/script/qmlbasicscript.h | 6 +++--- src/declarative/test/qfxtestengine.h | 4 ++-- src/declarative/test/qfxtestobjects.h | 8 ++++---- src/declarative/test/qfxtestview.h | 2 +- src/declarative/timeline/qmltimeline.h | 6 +++--- src/declarative/timeline/qmltimelinevalueproxy.h | 2 +- src/declarative/util/qbindablemap.h | 10 +++++----- src/declarative/util/qfxglobal.h | 4 ++-- src/declarative/util/qfxview.h | 4 ++-- src/declarative/util/qmlanimation.h | 10 +++++----- src/declarative/util/qmlanimation_p.h | 16 ++++++++-------- src/declarative/util/qmlbehaviour.h | 6 +++--- src/declarative/util/qmlbind.h | 4 ++-- src/declarative/util/qmlfollow.h | 4 ++-- src/declarative/util/qmlfont.h | 2 +- src/declarative/util/qmllistaccessor.h | 2 +- src/declarative/util/qmllistmodel.h | 16 ++++++++-------- src/declarative/util/qmlopenmetaobject.h | 4 ++-- src/declarative/util/qmlpackage.h | 2 +- src/declarative/util/qmlscript.h | 4 ++-- src/declarative/util/qmlsetproperties.h | 2 +- src/declarative/util/qmlstate.h | 6 +++--- src/declarative/util/qmlstate_p.h | 6 +++--- src/declarative/util/qmlstategroup.h | 2 +- src/declarative/util/qmlstateoperations.h | 2 +- src/declarative/util/qmltransition.h | 6 +++--- src/declarative/widgets/graphicslayouts.h | 6 +++--- src/declarative/widgets/graphicswidgets.h | 10 +++++----- 98 files changed, 247 insertions(+), 245 deletions(-) diff --git a/src/declarative/3rdparty/qlistmodelinterface.h b/src/declarative/3rdparty/qlistmodelinterface.h index 19284ca..44c4a24 100644 --- a/src/declarative/3rdparty/qlistmodelinterface.h +++ b/src/declarative/3rdparty/qlistmodelinterface.h @@ -42,9 +42,9 @@ #ifndef QLISTMODELINTERFACE_H #define QLISTMODELINTERFACE_H -#include -#include -#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/canvas/qsimplecanvas.h b/src/declarative/canvas/qsimplecanvas.h index d57ada4..880fae0 100644 --- a/src/declarative/canvas/qsimplecanvas.h +++ b/src/declarative/canvas/qsimplecanvas.h @@ -42,7 +42,7 @@ #ifndef QSIMPLECANVAS_H #define QSIMPLECANVAS_H -#include +#include #ifdef QFX_RENDER_OPENGL #include diff --git a/src/declarative/canvas/qsimplecanvasfilter.h b/src/declarative/canvas/qsimplecanvasfilter.h index cb75ddf..d05dc7e 100644 --- a/src/declarative/canvas/qsimplecanvasfilter.h +++ b/src/declarative/canvas/qsimplecanvasfilter.h @@ -43,9 +43,9 @@ #define QSIMPLECANVASFILTER_H #include -#include -#include -#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/canvas/qsimplecanvasitem.h b/src/declarative/canvas/qsimplecanvasitem.h index cab8492..63be27b 100644 --- a/src/declarative/canvas/qsimplecanvasitem.h +++ b/src/declarative/canvas/qsimplecanvasitem.h @@ -47,13 +47,13 @@ #include #include #include -class QPainter; QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) +class QPainter; class QRect; class QSimpleCanvas; class QMouseEvent; diff --git a/src/declarative/extra/qfxintegermodel.h b/src/declarative/extra/qfxintegermodel.h index 3a48a56..2f5c756 100644 --- a/src/declarative/extra/qfxintegermodel.h +++ b/src/declarative/extra/qfxintegermodel.h @@ -42,9 +42,9 @@ #ifndef QFXINTMODEL_H #define QFXINTMODEL_H -#include -#include "qml.h" -#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/extra/qmlnumberformatter.h b/src/declarative/extra/qmlnumberformatter.h index e053be5..cdd6b58 100644 --- a/src/declarative/extra/qmlnumberformatter.h +++ b/src/declarative/extra/qmlnumberformatter.h @@ -42,8 +42,8 @@ #ifndef QMLNUMBERFORMATTER_H #define QMLNUMBERFORMATTER_H -#include -#include "qnumberformat.h" +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/extra/qmlsqlconnection.h b/src/declarative/extra/qmlsqlconnection.h index 2cc5774..0fff1b0 100644 --- a/src/declarative/extra/qmlsqlconnection.h +++ b/src/declarative/extra/qmlsqlconnection.h @@ -42,8 +42,8 @@ #ifndef QMLSQLCONNECTION_H #define QMLSQLCONNECTION_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/extra/qmlsqlquery.h b/src/declarative/extra/qmlsqlquery.h index 984483c..3fff127 100644 --- a/src/declarative/extra/qmlsqlquery.h +++ b/src/declarative/extra/qmlsqlquery.h @@ -42,8 +42,8 @@ #ifndef QMLSQLQUERYMODEL_H #define QMLSQLQUERYMODEL_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/extra/qmlxmllistmodel.h b/src/declarative/extra/qmlxmllistmodel.h index 2e932cb..9371448 100644 --- a/src/declarative/extra/qmlxmllistmodel.h +++ b/src/declarative/extra/qmlxmllistmodel.h @@ -42,8 +42,8 @@ #ifndef QMLXMLLISTMODEL_H #define QMLXMLLISTMODEL_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/extra/qnumberformat.h b/src/declarative/extra/qnumberformat.h index 6ee333c..75224ec 100644 --- a/src/declarative/extra/qnumberformat.h +++ b/src/declarative/extra/qnumberformat.h @@ -42,9 +42,9 @@ #ifndef NUMBERFORMAT_H #define NUMBERFORMAT_H -#include "qml.h" -#include - +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxanchors.h b/src/declarative/fx/qfxanchors.h index 2c59266..9d776ab 100644 --- a/src/declarative/fx/qfxanchors.h +++ b/src/declarative/fx/qfxanchors.h @@ -42,9 +42,9 @@ #ifndef QFXANCHORS_H #define QFXANCHORS_H -#include -#include -#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxanimatedimageitem.h b/src/declarative/fx/qfxanimatedimageitem.h index 121fe62..a332c8b 100644 --- a/src/declarative/fx/qfxanimatedimageitem.h +++ b/src/declarative/fx/qfxanimatedimageitem.h @@ -42,7 +42,7 @@ #ifndef QFXANIMATEDIMAGEITEM_H #define QFXANIMATEDIMAGEITEM_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxblendedimage.h b/src/declarative/fx/qfxblendedimage.h index 1cf4dc8..2fdf15b 100644 --- a/src/declarative/fx/qfxblendedimage.h +++ b/src/declarative/fx/qfxblendedimage.h @@ -42,7 +42,7 @@ #ifndef QFXBLENDEDIMAGE_H #define QFXBLENDEDIMAGE_H -#include +#include #if defined(QFX_RENDER_OPENGL2) #include #endif diff --git a/src/declarative/fx/qfxblurfilter.h b/src/declarative/fx/qfxblurfilter.h index 7a2b5b9..576debf 100644 --- a/src/declarative/fx/qfxblurfilter.h +++ b/src/declarative/fx/qfxblurfilter.h @@ -42,8 +42,8 @@ #ifndef QFXBLURFILTER_H #define QFXBLURFILTER_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxcomponentinstance.h b/src/declarative/fx/qfxcomponentinstance.h index 64af355..9f84043 100644 --- a/src/declarative/fx/qfxcomponentinstance.h +++ b/src/declarative/fx/qfxcomponentinstance.h @@ -42,7 +42,7 @@ #ifndef QFXCOMPONENTINSTANCE_H #define QFXCOMPONENTINSTANCE_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxcontentwrapper.h b/src/declarative/fx/qfxcontentwrapper.h index 5d5a7e1..0b7253e 100644 --- a/src/declarative/fx/qfxcontentwrapper.h +++ b/src/declarative/fx/qfxcontentwrapper.h @@ -42,7 +42,7 @@ #ifndef QFXCONTENTWRAPPER_H #define QFXCONTENTWRAPPER_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxevents_p.h b/src/declarative/fx/qfxevents_p.h index 30717ef..bcd9f2d 100644 --- a/src/declarative/fx/qfxevents_p.h +++ b/src/declarative/fx/qfxevents_p.h @@ -42,8 +42,8 @@ #ifndef QFXEVENTS_P_H #define QFXEVENTS_P_H -#include -#include +#include +#include #include #include diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h index c5a0593..3857017 100644 --- a/src/declarative/fx/qfxflickable.h +++ b/src/declarative/fx/qfxflickable.h @@ -42,7 +42,7 @@ #ifndef QFXFLICKABLE_H #define QFXFLICKABLE_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxflipable.h b/src/declarative/fx/qfxflipable.h index ef1832e..62b62a5 100644 --- a/src/declarative/fx/qfxflipable.h +++ b/src/declarative/fx/qfxflipable.h @@ -42,12 +42,12 @@ #ifndef QFXFLIPABLE_H #define QFXFLIPABLE_H -#include -#include +#include +#include #if defined(QFX_RENDER_OPENGL) #include #endif -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxfocuspanel.h b/src/declarative/fx/qfxfocuspanel.h index 38f7a15..cec12a1 100644 --- a/src/declarative/fx/qfxfocuspanel.h +++ b/src/declarative/fx/qfxfocuspanel.h @@ -42,7 +42,7 @@ #ifndef QFXFOCUSPANEL_H #define QFXFOCUSPANEL_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxfocusrealm.h b/src/declarative/fx/qfxfocusrealm.h index 6c35405..fdf1525 100644 --- a/src/declarative/fx/qfxfocusrealm.h +++ b/src/declarative/fx/qfxfocusrealm.h @@ -42,7 +42,7 @@ #ifndef QFXFOCUSREALM_H #define QFXFOCUSREALM_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h index 2bbfc40..ff08831 100644 --- a/src/declarative/fx/qfxgridview.h +++ b/src/declarative/fx/qfxgridview.h @@ -42,7 +42,7 @@ #ifndef QFXGRIDVIEW_H #define QFXGRIDVIEW_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxhighlightfilter.h b/src/declarative/fx/qfxhighlightfilter.h index 218f4e1..92a3dc7 100644 --- a/src/declarative/fx/qfxhighlightfilter.h +++ b/src/declarative/fx/qfxhighlightfilter.h @@ -42,8 +42,8 @@ #ifndef QFXHIGHLIGHTFILTER_H #define QFXHIGHLIGHTFILTER_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h index dc13a97..1436551 100644 --- a/src/declarative/fx/qfximage.h +++ b/src/declarative/fx/qfximage.h @@ -42,7 +42,7 @@ #ifndef QFXIMAGE_H #define QFXIMAGE_H -#include +#include #include diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 437709f..d34a9fb 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -42,9 +42,9 @@ #ifndef QFXITEM_H #define QFXITEM_H -#include +#include #include -#include +#include #include #include #include diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index 8ca7fda..85ce171 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -53,11 +53,11 @@ // We mean it. // -#include "qfxitem.h" +#include #include #include -#include -#include +#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/declarative/fx/qfxkeyactions.h b/src/declarative/fx/qfxkeyactions.h index 7ad323a..a5aec2e 100644 --- a/src/declarative/fx/qfxkeyactions.h +++ b/src/declarative/fx/qfxkeyactions.h @@ -42,10 +42,10 @@ #ifndef QFXKEYACTIONS_H #define QFXKEYACTIONS_H -#include -#include -#include -#include +#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxkeyproxy.h b/src/declarative/fx/qfxkeyproxy.h index ae5fce4..6cf0c0d 100644 --- a/src/declarative/fx/qfxkeyproxy.h +++ b/src/declarative/fx/qfxkeyproxy.h @@ -42,7 +42,7 @@ #ifndef QFXKEYPROXY_H #define QFXKEYPROXY_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxlayouts.h b/src/declarative/fx/qfxlayouts.h index acfc0c4..35e41d8 100644 --- a/src/declarative/fx/qfxlayouts.h +++ b/src/declarative/fx/qfxlayouts.h @@ -42,10 +42,10 @@ #ifndef QFXLAYOUTS_H #define QFXLAYOUTS_H -#include -#include -#include -#include +#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxlayouts_p.h b/src/declarative/fx/qfxlayouts_p.h index 859482f..77b0ea1 100644 --- a/src/declarative/fx/qfxlayouts_p.h +++ b/src/declarative/fx/qfxlayouts_p.h @@ -53,11 +53,11 @@ // We mean it. // -#include "qfxlayouts.h" -#include "qfxitem_p.h" -#include -#include -#include +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index 40c2496..6bf2b54 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -42,7 +42,7 @@ #ifndef QFXLISTVIEW_H #define QFXLISTVIEW_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxmouseregion.h b/src/declarative/fx/qfxmouseregion.h index 2ba4a50..1d1ec93 100644 --- a/src/declarative/fx/qfxmouseregion.h +++ b/src/declarative/fx/qfxmouseregion.h @@ -42,7 +42,7 @@ #ifndef QFXMOUSEREGION_H #define QFXMOUSEREGION_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxpainteditem.h b/src/declarative/fx/qfxpainteditem.h index 015a035..6cd21e6 100644 --- a/src/declarative/fx/qfxpainteditem.h +++ b/src/declarative/fx/qfxpainteditem.h @@ -42,8 +42,8 @@ #ifndef QFXIMAGEITEM_H #define QFXIMAGEITEM_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxpainteditem_p.h b/src/declarative/fx/qfxpainteditem_p.h index b0432ac..5d5da6b 100644 --- a/src/declarative/fx/qfxpainteditem_p.h +++ b/src/declarative/fx/qfxpainteditem_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "qfxitem_p.h" -#include +#include +#include #if defined(QFX_RENDER_OPENGL) #include "gltexture.h" diff --git a/src/declarative/fx/qfxparticles.h b/src/declarative/fx/qfxparticles.h index a879b2d..31a00fb 100644 --- a/src/declarative/fx/qfxparticles.h +++ b/src/declarative/fx/qfxparticles.h @@ -42,7 +42,7 @@ #ifndef QFXPARTICLES_H #define QFXPARTICLES_H -#include +#include #if defined(QFX_RENDER_OPENGL) #include "gltexture.h" diff --git a/src/declarative/fx/qfxpath.h b/src/declarative/fx/qfxpath.h index c594793..10cf252 100644 --- a/src/declarative/fx/qfxpath.h +++ b/src/declarative/fx/qfxpath.h @@ -42,10 +42,10 @@ #ifndef QFXPATH_H #define QFXPATH_H -#include -#include -#include -#include +#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxpathview.h b/src/declarative/fx/qfxpathview.h index 2ecd04e..32e03b8 100644 --- a/src/declarative/fx/qfxpathview.h +++ b/src/declarative/fx/qfxpathview.h @@ -42,8 +42,8 @@ #ifndef QFXPATHVIEW_H #define QFXPATHVIEW_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxpixmap.h b/src/declarative/fx/qfxpixmap.h index 297dba7..fd56ee4 100644 --- a/src/declarative/fx/qfxpixmap.h +++ b/src/declarative/fx/qfxpixmap.h @@ -42,10 +42,10 @@ #ifndef QFXPIXMAP_H #define QFXPIXMAP_H -#include -#include -#include -#include +#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h index 42e7b2f..f8bff78 100644 --- a/src/declarative/fx/qfxrect.h +++ b/src/declarative/fx/qfxrect.h @@ -42,7 +42,7 @@ #ifndef QFXRECT_H #define QFXRECT_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxreflectionfilter.h b/src/declarative/fx/qfxreflectionfilter.h index b0cc7b2..383e12f 100644 --- a/src/declarative/fx/qfxreflectionfilter.h +++ b/src/declarative/fx/qfxreflectionfilter.h @@ -42,8 +42,8 @@ #ifndef QFXREFLECTIONFILTER_H #define QFXREFLECTIONFILTER_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxrepeater.h b/src/declarative/fx/qfxrepeater.h index 8efd281..362242b 100644 --- a/src/declarative/fx/qfxrepeater.h +++ b/src/declarative/fx/qfxrepeater.h @@ -42,7 +42,7 @@ #ifndef QFXREPEATER_H #define QFXREPEATER_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxscalegrid.h b/src/declarative/fx/qfxscalegrid.h index 9010ce7..d0f735f 100644 --- a/src/declarative/fx/qfxscalegrid.h +++ b/src/declarative/fx/qfxscalegrid.h @@ -42,13 +42,13 @@ #ifndef QFXSCALEGRID_H #define QFXSCALEGRID_H -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxshadowfilter.h b/src/declarative/fx/qfxshadowfilter.h index 9ba3b7b..fc54e01 100644 --- a/src/declarative/fx/qfxshadowfilter.h +++ b/src/declarative/fx/qfxshadowfilter.h @@ -42,8 +42,8 @@ #ifndef QFXSHADOWFILTER_H #define QFXSHADOWFILTER_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h index 0de884b..ee9082b 100644 --- a/src/declarative/fx/qfxtext.h +++ b/src/declarative/fx/qfxtext.h @@ -42,8 +42,8 @@ #ifndef QFXTEXT_H #define QFXTEXT_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index 0aaa17b..f702101 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -42,8 +42,8 @@ #ifndef QFXTEXTEDIT_H #define QFXTEXTEDIT_H -#include -#include +#include +#include #include #include diff --git a/src/declarative/fx/qfxtransform.h b/src/declarative/fx/qfxtransform.h index a3a1a83..6d55cff 100644 --- a/src/declarative/fx/qfxtransform.h +++ b/src/declarative/fx/qfxtransform.h @@ -42,12 +42,12 @@ #ifndef QFXTRANSFORM_H #define QFXTRANSFORM_H -#include -#include +#include +#include #if defined(QFX_RENDER_OPENGL) #include #endif -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxvisualitemmodel.h b/src/declarative/fx/qfxvisualitemmodel.h index 5db5209..586d837 100644 --- a/src/declarative/fx/qfxvisualitemmodel.h +++ b/src/declarative/fx/qfxvisualitemmodel.h @@ -44,7 +44,7 @@ #include #include -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h index afd5b0f..6a3dad5 100644 --- a/src/declarative/fx/qfxwebview.h +++ b/src/declarative/fx/qfxwebview.h @@ -42,12 +42,12 @@ #ifndef QFXWEBVIEW_H #define QFXWEBVIEW_H -#include -#include -#include -#include +#include +#include +#include +#include #include -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/fx/qfxwidgetcontainer.h b/src/declarative/fx/qfxwidgetcontainer.h index 65e4352..3b1f016 100644 --- a/src/declarative/fx/qfxwidgetcontainer.h +++ b/src/declarative/fx/qfxwidgetcontainer.h @@ -48,6 +48,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Declarative) + class QGraphicsWidget; class Q_DECLARATIVE_EXPORT QFxWidgetContainer : public QFxItem diff --git a/src/declarative/opengl/glheaders.h b/src/declarative/opengl/glheaders.h index f0f6a55..fd1da18 100644 --- a/src/declarative/opengl/glheaders.h +++ b/src/declarative/opengl/glheaders.h @@ -42,7 +42,7 @@ #ifndef _GLHEADERS_H_ #define _GLHEADERS_H_ -#include +#include #define GL_GLEXT_PROTOTYPES 1 #include diff --git a/src/declarative/opengl/glsave.h b/src/declarative/opengl/glsave.h index cca3d3c..8256162 100644 --- a/src/declarative/opengl/glsave.h +++ b/src/declarative/opengl/glsave.h @@ -42,9 +42,9 @@ #ifndef _GLSAVE_H_ #define _GLSAVE_H_ -#include -#include -#include +#include +#include +#include #include "glheaders.h" diff --git a/src/declarative/opengl/gltexture.h b/src/declarative/opengl/gltexture.h index f920b60..8704498 100644 --- a/src/declarative/opengl/gltexture.h +++ b/src/declarative/opengl/gltexture.h @@ -42,10 +42,10 @@ #ifndef _GLTEXTURE_H_ #define _GLTEXTURE_H_ -#include +#include -#include -#include +#include +#include #include "glheaders.h" diff --git a/src/declarative/qml/qmlbindablevalue.h b/src/declarative/qml/qmlbindablevalue.h index c4ef64a..7831177 100644 --- a/src/declarative/qml/qmlbindablevalue.h +++ b/src/declarative/qml/qmlbindablevalue.h @@ -42,10 +42,10 @@ #ifndef QMLBINDABLEVALUE_H #define QMLBINDABLEVALUE_H -#include -#include -#include -#include +#include +#include +#include +#include #include diff --git a/src/declarative/qml/qmlbindablevalue_p.h b/src/declarative/qml/qmlbindablevalue_p.h index d9af0ef..9973bdc 100644 --- a/src/declarative/qml/qmlbindablevalue_p.h +++ b/src/declarative/qml/qmlbindablevalue_p.h @@ -43,8 +43,8 @@ #define QMLBINDABLEVALUE_P_H #include -#include -#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmlboundsignal_p.h b/src/declarative/qml/qmlboundsignal_p.h index e84f0c1..2c05770 100644 --- a/src/declarative/qml/qmlboundsignal_p.h +++ b/src/declarative/qml/qmlboundsignal_p.h @@ -42,7 +42,7 @@ #ifndef QMLBOUNDSIGNAL_P_H #define QMLBOUNDSIGNAL_P_H -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmlcompiledcomponent_p.h b/src/declarative/qml/qmlcompiledcomponent_p.h index c5e1226..2201423 100644 --- a/src/declarative/qml/qmlcompiledcomponent_p.h +++ b/src/declarative/qml/qmlcompiledcomponent_p.h @@ -42,7 +42,7 @@ #ifndef QMLCOMPILEDCOMPONENT_P_H #define QMLCOMPILEDCOMPONENT_P_H -#include +#include #include #include #include diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index 87c1b82..bc04cfa 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -44,8 +44,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/declarative/qml/qmlcomponent_p.h b/src/declarative/qml/qmlcomponent_p.h index 4de47c6..254d9ba 100644 --- a/src/declarative/qml/qmlcomponent_p.h +++ b/src/declarative/qml/qmlcomponent_p.h @@ -42,21 +42,21 @@ #ifndef QMLCOMPONENT_P_H #define QMLCOMPONENT_P_H -#include -#include -#include -#include "private/qobject_p.h" -#include "private/qmlengine_p.h" -#include "private/qmlcompositetypemanager_p.h" -#include -#include "qmlcomponent.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + class QmlComponent; class QmlEngine; class QmlCompiledComponent; -#include "qml.h" - - -QT_BEGIN_NAMESPACE class QmlComponentPrivate : public QObjectPrivate { diff --git a/src/declarative/qml/qmlcompositetypemanager_p.h b/src/declarative/qml/qmlcompositetypemanager_p.h index f03b2cb..9312819 100644 --- a/src/declarative/qml/qmlcompositetypemanager_p.h +++ b/src/declarative/qml/qmlcompositetypemanager_p.h @@ -42,10 +42,10 @@ #ifndef QMLCOMPOSITETYPEMANAGER_P_H #define QMLCOMPOSITETYPEMANAGER_P_H -#include +#include #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h index 6f1e486..4d88fc2 100644 --- a/src/declarative/qml/qmlcontext_p.h +++ b/src/declarative/qml/qmlcontext_p.h @@ -42,11 +42,11 @@ #ifndef QMLCONTEXT_P_H #define QMLCONTEXT_P_H -#include +#include #include #include -#include -#include +#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 7cafb59..0dc4736 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -42,9 +42,9 @@ #ifndef QMLENGINE_P_H #define QMLENGINE_P_H -#include -#include -#include +#include +#include +#include #include #include #include @@ -52,11 +52,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index 323735b..a21ccee 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -42,7 +42,7 @@ #ifndef QMLINSTRUCTION_P_H #define QMLINSTRUCTION_P_H -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qmlmetaproperty.h index 4e59cf7..9daef59 100644 --- a/src/declarative/qml/qmlmetaproperty.h +++ b/src/declarative/qml/qmlmetaproperty.h @@ -43,7 +43,7 @@ #define QMLMETAPROPERTY_H #include -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h index 95b21e6..add5773 100644 --- a/src/declarative/qml/qmlparser_p.h +++ b/src/declarative/qml/qmlparser_p.h @@ -42,10 +42,10 @@ #ifndef QMLPARSER_P_H #define QMLPARSER_P_H -#include -#include +#include +#include #include -#include +#include #include #include diff --git a/src/declarative/qml/qmlpropertyvaluesource.h b/src/declarative/qml/qmlpropertyvaluesource.h index 6ef2e38..736b25f 100644 --- a/src/declarative/qml/qmlpropertyvaluesource.h +++ b/src/declarative/qml/qmlpropertyvaluesource.h @@ -42,9 +42,9 @@ #ifndef QMLPROPERTYVALUESOURCE_H #define QMLPROPERTYVALUESOURCE_H -#include -#include -#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/qml/qmlproxymetaobject_p.h b/src/declarative/qml/qmlproxymetaobject_p.h index 594e7a3..0ffa365 100644 --- a/src/declarative/qml/qmlproxymetaobject_p.h +++ b/src/declarative/qml/qmlproxymetaobject_p.h @@ -42,11 +42,11 @@ #ifndef QMLPROXYMETAOBJECT_P_H #define QMLPROXYMETAOBJECT_P_H -#include +#include +#include #include #include -#include -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/qml/qmlrefcount_p.h b/src/declarative/qml/qmlrefcount_p.h index 90b50a8..1355c86 100644 --- a/src/declarative/qml/qmlrefcount_p.h +++ b/src/declarative/qml/qmlrefcount_p.h @@ -42,7 +42,7 @@ #ifndef QMLREFCOUNT_P_H #define QMLREFCOUNT_P_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/qml/qmlvme_p.h b/src/declarative/qml/qmlvme_p.h index f7e13d6..4e5c6c1 100644 --- a/src/declarative/qml/qmlvme_p.h +++ b/src/declarative/qml/qmlvme_p.h @@ -42,12 +42,12 @@ #ifndef QMLVME_P_H #define QMLVME_P_H -#include -#include -#include -class QObject; +#include +#include +#include QT_BEGIN_NAMESPACE +class QObject; class QmlInstruction; class QmlCompiledComponent; class QmlCompiledData; diff --git a/src/declarative/qml/qmlvmemetaobject_p.h b/src/declarative/qml/qmlvmemetaobject_p.h index d8ed242..6f1e31b 100644 --- a/src/declarative/qml/qmlvmemetaobject_p.h +++ b/src/declarative/qml/qmlvmemetaobject_p.h @@ -42,9 +42,9 @@ #ifndef QMLVMEMETAOBJECT_P_H #define QMLVMEMETAOBJECT_P_H -#include -#include -#include +#include +#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/script/lexer.h b/src/declarative/qml/script/lexer.h index 7781ee8..9de4afd 100644 --- a/src/declarative/qml/script/lexer.h +++ b/src/declarative/qml/script/lexer.h @@ -11,7 +11,7 @@ #ifndef LEXER_H #define LEXER_H -#include +#include #include "tokens.h" diff --git a/src/declarative/qml/script/qmlbasicscript.h b/src/declarative/qml/script/qmlbasicscript.h index d465f04..5ef2148 100644 --- a/src/declarative/qml/script/qmlbasicscript.h +++ b/src/declarative/qml/script/qmlbasicscript.h @@ -13,10 +13,10 @@ #define QMLBASICSCRIPT_H #include "instructions.h" -#include -#include +#include +#include #include "lexer.h" -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/test/qfxtestengine.h b/src/declarative/test/qfxtestengine.h index 6698645..44a140f 100644 --- a/src/declarative/test/qfxtestengine.h +++ b/src/declarative/test/qfxtestengine.h @@ -42,8 +42,7 @@ #ifndef _QFXTESTENGINE_H_ #define _QFXTESTENGINE_H_ -#include -class QSimpleCanvas; +#include QT_BEGIN_HEADER @@ -51,6 +50,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) +class QSimpleCanvas; class QFxTestEnginePrivate; class Q_DECLARATIVE_EXPORT QFxTestEngine : public QObject { diff --git a/src/declarative/test/qfxtestobjects.h b/src/declarative/test/qfxtestobjects.h index 4273d4e..653656e 100644 --- a/src/declarative/test/qfxtestobjects.h +++ b/src/declarative/test/qfxtestobjects.h @@ -42,10 +42,10 @@ #ifndef _QFXTESTOBJECTS_H_ #define _QFXTESTOBJECTS_H_ -#include -#include -#include -#include +#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/test/qfxtestview.h b/src/declarative/test/qfxtestview.h index 33275b9..a8f78bf 100644 --- a/src/declarative/test/qfxtestview.h +++ b/src/declarative/test/qfxtestview.h @@ -42,7 +42,7 @@ #ifndef _QFXTESTVIEW_H_ #define _QFXTESTVIEW_H_ -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/timeline/qmltimeline.h b/src/declarative/timeline/qmltimeline.h index ce9d1f2..23bdd64 100644 --- a/src/declarative/timeline/qmltimeline.h +++ b/src/declarative/timeline/qmltimeline.h @@ -42,9 +42,9 @@ #ifndef QMLTIMELINE_H #define QMLTIMELINE_H -#include -#include -#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/timeline/qmltimelinevalueproxy.h b/src/declarative/timeline/qmltimelinevalueproxy.h index 853db4e..9ecdba1 100644 --- a/src/declarative/timeline/qmltimelinevalueproxy.h +++ b/src/declarative/timeline/qmltimelinevalueproxy.h @@ -42,7 +42,7 @@ #ifndef QMLTIMELINEVALUEPROXY_H #define QMLTIMELINEVALUEPROXY_H -#include "qmltimeline.h" +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qbindablemap.h b/src/declarative/util/qbindablemap.h index d617867..c76928d 100644 --- a/src/declarative/util/qbindablemap.h +++ b/src/declarative/util/qbindablemap.h @@ -42,11 +42,11 @@ #ifndef QBINDABLEMAP_H #define QBINDABLEMAP_H -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qfxglobal.h b/src/declarative/util/qfxglobal.h index 887351d..6ba9409 100644 --- a/src/declarative/util/qfxglobal.h +++ b/src/declarative/util/qfxglobal.h @@ -42,8 +42,8 @@ #ifndef QFXGLOBAL_H #define QFXGLOBAL_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qfxview.h b/src/declarative/util/qfxview.h index 8dd9e2c..05bf005 100644 --- a/src/declarative/util/qfxview.h +++ b/src/declarative/util/qfxview.h @@ -42,11 +42,11 @@ #ifndef QFXVIEW_H #define QFXVIEW_H -#include #include #include #include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlanimation.h b/src/declarative/util/qmlanimation.h index 578631c..8bd53e2 100644 --- a/src/declarative/util/qmlanimation.h +++ b/src/declarative/util/qmlanimation.h @@ -43,12 +43,12 @@ #define QMLANIMATION_H #include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index 00937a6..36b826f 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -44,15 +44,15 @@ #include #include -#include -#include -#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlbehaviour.h b/src/declarative/util/qmlbehaviour.h index 3d25cd8..7a54d63 100644 --- a/src/declarative/util/qmlbehaviour.h +++ b/src/declarative/util/qmlbehaviour.h @@ -42,9 +42,9 @@ #ifndef QMLBEHAVIOUR_H #define QMLBEHAVIOUR_H -#include -#include -#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlbind.h b/src/declarative/util/qmlbind.h index 355edfd..5576957 100644 --- a/src/declarative/util/qmlbind.h +++ b/src/declarative/util/qmlbind.h @@ -42,9 +42,9 @@ #ifndef QMLBIND_H #define QMLBIND_H -#include +#include #include -#include "qml.h" +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlfollow.h b/src/declarative/util/qmlfollow.h index bd9363a..fa0bff8 100644 --- a/src/declarative/util/qmlfollow.h +++ b/src/declarative/util/qmlfollow.h @@ -42,8 +42,8 @@ #ifndef QMLFOLLOW_H #define QMLFOLLOW_H -#include -#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlfont.h b/src/declarative/util/qmlfont.h index b6bce7c..3a21c34 100644 --- a/src/declarative/util/qmlfont.h +++ b/src/declarative/util/qmlfont.h @@ -43,7 +43,7 @@ #define QMLFONT_H #include -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmllistaccessor.h b/src/declarative/util/qmllistaccessor.h index 29f910d..dd766b2 100644 --- a/src/declarative/util/qmllistaccessor.h +++ b/src/declarative/util/qmllistaccessor.h @@ -42,7 +42,7 @@ #ifndef QMLLISTACCESSOR_H #define QMLLISTACCESSOR_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmllistmodel.h b/src/declarative/util/qmllistmodel.h index 36aa009..ddf1e13 100644 --- a/src/declarative/util/qmllistmodel.h +++ b/src/declarative/util/qmllistmodel.h @@ -42,14 +42,14 @@ #ifndef QMLLISTMODEL_H #define QMLLISTMODEL_H -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlopenmetaobject.h b/src/declarative/util/qmlopenmetaobject.h index f842f96..239276d 100644 --- a/src/declarative/util/qmlopenmetaobject.h +++ b/src/declarative/util/qmlopenmetaobject.h @@ -42,9 +42,9 @@ #ifndef QMLOPENMETAOBJECT_H #define QMLOPENMETAOBJECT_H -#include +#include #include -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlpackage.h b/src/declarative/util/qmlpackage.h index 6652b98..3861890 100644 --- a/src/declarative/util/qmlpackage.h +++ b/src/declarative/util/qmlpackage.h @@ -42,7 +42,7 @@ #ifndef QMLPACKAGE_H #define QMLPACKAGE_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlscript.h b/src/declarative/util/qmlscript.h index 8047a88..b739fd7 100644 --- a/src/declarative/util/qmlscript.h +++ b/src/declarative/util/qmlscript.h @@ -42,9 +42,9 @@ #ifndef QMLSCRIPT_H #define QMLSCRIPT_H -#include +#include #include -#include "qml.h" +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlsetproperties.h b/src/declarative/util/qmlsetproperties.h index bd036c1..41c189f 100644 --- a/src/declarative/util/qmlsetproperties.h +++ b/src/declarative/util/qmlsetproperties.h @@ -42,7 +42,7 @@ #ifndef QMLSETPROPERTIES_H #define QMLSETPROPERTIES_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h index 68c43fa..03a27b2 100644 --- a/src/declarative/util/qmlstate.h +++ b/src/declarative/util/qmlstate.h @@ -43,9 +43,9 @@ #define QMLSTATE_H #include -#include -#include -#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlstate_p.h b/src/declarative/util/qmlstate_p.h index 28e1781..a2f18eb 100644 --- a/src/declarative/util/qmlstate_p.h +++ b/src/declarative/util/qmlstate_p.h @@ -42,9 +42,9 @@ #ifndef QMLSTATE_P_H #define QMLSTATE_P_H -#include -#include "private/qobject_p.h" -#include "private/qmlanimation_p.h" +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlstategroup.h b/src/declarative/util/qmlstategroup.h index 55b84eb..cca1015 100644 --- a/src/declarative/util/qmlstategroup.h +++ b/src/declarative/util/qmlstategroup.h @@ -42,7 +42,7 @@ #ifndef QMLSTATEGROUP_H #define QMLSTATEGROUP_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlstateoperations.h b/src/declarative/util/qmlstateoperations.h index 8ecdcd2..720c639 100644 --- a/src/declarative/util/qmlstateoperations.h +++ b/src/declarative/util/qmlstateoperations.h @@ -42,7 +42,7 @@ #ifndef QMLSTATEOPERATIONS_H #define QMLSTATEOPERATIONS_H -#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/util/qmltransition.h b/src/declarative/util/qmltransition.h index 0b7ea14..646746e 100644 --- a/src/declarative/util/qmltransition.h +++ b/src/declarative/util/qmltransition.h @@ -43,9 +43,9 @@ #define QMLTRANSITION_H #include -#include -#include -#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/widgets/graphicslayouts.h b/src/declarative/widgets/graphicslayouts.h index beb4b65..e9930f1 100644 --- a/src/declarative/widgets/graphicslayouts.h +++ b/src/declarative/widgets/graphicslayouts.h @@ -42,9 +42,9 @@ #ifndef GRAPHICSLAYOUTS_H #define GRAPHICSLAYOUTS_H -#include "graphicswidgets.h" -#include -#include +#include +#include +#include QT_BEGIN_HEADER diff --git a/src/declarative/widgets/graphicswidgets.h b/src/declarative/widgets/graphicswidgets.h index 47a753a..cec15b6 100644 --- a/src/declarative/widgets/graphicswidgets.h +++ b/src/declarative/widgets/graphicswidgets.h @@ -42,11 +42,11 @@ #ifndef GRAPHICSWIDGETS_H #define GRAPHICSWIDGETS_H -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE -- cgit v0.12 From 64e46dd18c2dcfe26107a41ee1cc48ed2f9c6f97 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Mon, 18 May 2009 20:22:12 +0200 Subject: Updated WebKit from /home/ariya/dev/webkit/qtwebkit-4.5 to origin/qtwebkit-4.5 ( 1f83e4058bffd5a3fe7e44cf45add01953a772d4 ) 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-05-12 Ariya Hidayat Reviewed by Dimitri Glazkov. Added Qt-specific expected result for toDataURL test, since Qt does not support saving pixmaps to GIF. * platform/qt/fast/canvas/toDataURL-supportedTypes-expected.txt: Added. 2009-05-12 Ariya Hidayat Rubber-stamped by Simon Hausmann. Added Qt-specific expected result for Canvas getImageData's test. https://bugs.webkit.org/show_bug.cgi?id=22150 Since Qt is internally using premultiplied ARGB32 for doing alpha-blending painting, reading the color back will not necessarily give the same exact color. * platform/qt/Skipped: Excluded canvas-getImageData. * platform/qt/fast/canvas/canvas-getImageData-expected.txt: Added. 2009-04-29 Ariya Hidayat Reviewed by Simon Fraser. Updated expected results after Qt's GraphicsContext fixes. * platform/qt/fast/canvas/set-colors-expected.txt: 2009-04-24 Ariya Hidayat Reviewed by Simon Hausmann. Added Qt-specific expected result for color conversion. This is to compensate the lack of color profile in Qt to do color conversion, hence CMYK 0,0,0,1 always give pure black (#000) instead of very dark black. * platform/qt/fast/canvas/set-colors-expected.txt: Added. ++ b/WebCore/ChangeLog 2009-05-18 Ariya Hidayat Reviewed by Simon Hausmann. Done together with Balazs Kelemen . https://bugs.webkit.org/show_bug.cgi?id=24551 [Qt] Reuse FontPlatformData for the same FontDescription. This effectively prevents growing heap usage for loading every web page. * platform/graphics/qt/FontCacheQt.cpp: (WebCore::qHash): Necessary for FontPlatformDataCache. (WebCore::FontCache::getCachedFontPlatformData): Reuse the instance if it exists, otherwise create a new one and insert it in the cache. 2009-05-18 Balazs Kelemen Reviewed by Ariya Hidayat. https://bugs.webkit.org/show_bug.cgi?id=24551 [Qt] Fix the leak in FontFallbackList::fontDataAt() function. When creating a new instance of SimpleFontData, put it in the font list so that it can deleted later on. * platform/graphics/qt/FontFallbackListQt.cpp: (WebCore::FontFallbackList::invalidate): (WebCore::FontFallbackList::releaseFontData): (WebCore::FontFallbackList::fontDataAt): 2009-05-15 Ariya Hidayat Reviewed by Holger Freyther. [Qt] In the image decoder, remove the raw image data represented as QImage once the image is converted to QPixmap and inserted in the pixmap cache. This effectively reduces the heap usage when running on graphics system other than raster (i.e the case where QImage != QPixmap). * platform/graphics/qt/ImageDecoderQt.cpp: (WebCore::ImageDecoderQt::imageAtIndex): Nullified the image on purpose. * platform/graphics/qt/ImageDecoderQt.h: Made m_imageList mutable. 2009-05-15 Ariya Hidayat Reviewed by Holger Freyther. [Qt] Refactor alpha channel detection the image decoder. Sets the boolean flag as soon as the image is being read. * platform/graphics/qt/ImageDecoderQt.cpp: (WebCore::ImageDecoderQt::ImageDecoderQt): Initialized m_hasAlphaChannel. (WebCore::ImageDecoderQt::setData): Set the flag when appropriate. (WebCore::ImageDecoderQt::supportsAlpha): Simplified. (WebCore::ImageDecoderQt::reset): Resetted the flag. * platform/graphics/qt/ImageDecoderQt.h: Added m_hasAlphaChannel. 2009-05-13 Ariya Hidayat Reviewed by Sam Weinig. [Qt] Fix "lighther" composition mode. QPainter::CompositionMode_Plus is the right match. * platform/graphics/qt/GraphicsContextQt.cpp: (WebCore::toQtCompositionMode): 2009-04-29 Ariya Hidayat Reviewed by Simon Fraser. [Qt] Initialize GraphicsContext's and ImageBuffer's QPainter to match the default values of canvas attributes. * platform/graphics/qt/ImageBufferQt.cpp: (WebCore::ImageBufferData::ImageBufferData): 2009-04-27 Ariya Hidayat Reviewed by Tor Arne Vestbø. https://bugs.webkit.org/show_bug.cgi?id=18475 [Qt] Widget painting should follow the layout direction (LTR, RTL) of the element style, not the application layout direction. * platform/qt/RenderThemeQt.cpp: (WebCore::RenderThemeQt::applyTheme): --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 90 ++++++++++++++++++++++ .../WebCore/platform/graphics/qt/FontCacheQt.cpp | 27 ++++++- .../platform/graphics/qt/FontFallbackListQt.cpp | 12 ++- .../platform/graphics/qt/GraphicsContextQt.cpp | 2 +- .../WebCore/platform/graphics/qt/ImageBufferQt.cpp | 19 ++++- .../platform/graphics/qt/ImageDecoderQt.cpp | 13 +++- .../WebCore/platform/graphics/qt/ImageDecoderQt.h | 3 +- .../webkit/WebCore/platform/qt/RenderThemeQt.cpp | 4 + 9 files changed, 162 insertions(+), 10 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 26ce489..f5402ce 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 - a6ebe3865025e2bb4d767a79435af4daf5a9b4db + 1f83e4058bffd5a3fe7e44cf45add01953a772d4 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 00bd427..23f3ca6 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,93 @@ +2009-05-18 Ariya Hidayat + + Reviewed by Simon Hausmann. + + Done together with Balazs Kelemen . + + https://bugs.webkit.org/show_bug.cgi?id=24551 + + [Qt] Reuse FontPlatformData for the same FontDescription. + This effectively prevents growing heap usage for loading every web page. + + * platform/graphics/qt/FontCacheQt.cpp: + (WebCore::qHash): Necessary for FontPlatformDataCache. + (WebCore::FontCache::getCachedFontPlatformData): Reuse the instance if + it exists, otherwise create a new one and insert it in the cache. + +2009-05-18 Balazs Kelemen + + Reviewed by Ariya Hidayat. + + https://bugs.webkit.org/show_bug.cgi?id=24551 + + [Qt] Fix the leak in FontFallbackList::fontDataAt() function. + When creating a new instance of SimpleFontData, put it in the font list + so that it can deleted later on. + + * platform/graphics/qt/FontFallbackListQt.cpp: + (WebCore::FontFallbackList::invalidate): + (WebCore::FontFallbackList::releaseFontData): + (WebCore::FontFallbackList::fontDataAt): + +2009-05-15 Ariya Hidayat + + Reviewed by Holger Freyther. + + [Qt] In the image decoder, remove the raw image data represented as QImage + once the image is converted to QPixmap and inserted in the pixmap cache. + This effectively reduces the heap usage when running on graphics system + other than raster (i.e the case where QImage != QPixmap). + + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::imageAtIndex): Nullified the image on purpose. + * platform/graphics/qt/ImageDecoderQt.h: Made m_imageList mutable. + +2009-05-15 Ariya Hidayat + + Reviewed by Holger Freyther. + + [Qt] Refactor alpha channel detection the image decoder. + Sets the boolean flag as soon as the image is being read. + + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::ImageDecoderQt): Initialized m_hasAlphaChannel. + (WebCore::ImageDecoderQt::setData): Set the flag when appropriate. + (WebCore::ImageDecoderQt::supportsAlpha): Simplified. + (WebCore::ImageDecoderQt::reset): Resetted the flag. + * platform/graphics/qt/ImageDecoderQt.h: Added m_hasAlphaChannel. + +2009-05-13 Ariya Hidayat + + Reviewed by Sam Weinig. + + [Qt] Fix "lighther" composition mode. + QPainter::CompositionMode_Plus is the right match. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::toQtCompositionMode): + +2009-04-29 Ariya Hidayat + + Reviewed by Simon Fraser. + + [Qt] Initialize GraphicsContext's and ImageBuffer's QPainter to match + the default values of canvas attributes. + + * platform/graphics/qt/ImageBufferQt.cpp: + (WebCore::ImageBufferData::ImageBufferData): + +2009-04-27 Ariya Hidayat + + Reviewed by Tor Arne Vestbø. + + https://bugs.webkit.org/show_bug.cgi?id=18475 + + [Qt] Widget painting should follow the layout direction (LTR, RTL) + of the element style, not the application layout direction. + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::applyTheme): + 2009-03-13 Adam Bergkvist Reviewed by Alexey Proskuryakov. diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp index 8a31861..5d1f147 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCacheQt.cpp @@ -26,6 +26,9 @@ #include "FontDescription.h" #include "FontPlatformData.h" #include "Font.h" +#include "StringHash.h" + +#include namespace WebCore { @@ -33,9 +36,31 @@ void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector FontPlatformDataCache; + +// using Q_GLOBAL_STATIC leads to crash. TODO investigate the way to fix this. +static FontPlatformDataCache* gFontPlatformDataCache; + +uint qHash(const FontDescription& key) +{ + uint value = CaseFoldingHash::hash(key.family().family()); + value ^= key.computedPixelSize(); + value ^= static_cast(key.weight()); + return value; +} + FontPlatformData* FontCache::getCachedFontPlatformData(const FontDescription& description, const AtomicString& family, bool checkingAlternateName) { - return new FontPlatformData(description); + if (!gFontPlatformDataCache) + gFontPlatformDataCache = new FontPlatformDataCache; + + FontPlatformData* fontData = gFontPlatformDataCache->value(description, 0); + if (!fontData) { + fontData = new FontPlatformData(description); + gFontPlatformDataCache->insert(description, fontData); + } + + return fontData; } SimpleFontData* FontCache::getCachedFontData(const FontPlatformData*) diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp index 22ae205..50627b7 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp @@ -42,8 +42,6 @@ FontFallbackList::FontFallbackList() void FontFallbackList::invalidate(WTF::PassRefPtr fontSelector) { - releaseFontData(); - m_fontList.clear(); m_familyIndex = 0; m_pitch = UnknownPitch; m_loadingCustomFonts = false; @@ -53,6 +51,9 @@ void FontFallbackList::invalidate(WTF::PassRefPtr fontSel void FontFallbackList::releaseFontData() { + if (m_fontList.size()) + delete m_fontList[0].first; + m_fontList.clear(); } void FontFallbackList::determinePitch(const WebCore::Font* font) const @@ -90,7 +91,12 @@ const FontData* FontFallbackList::fontDataAt(const WebCore::Font* _font, unsigne family = family->next(); } - return new SimpleFontData(FontPlatformData(description), _font->wordSpacing(), _font->letterSpacing()); + if (m_fontList.size()) + return m_fontList[0].first; + + const FontData* result = new SimpleFontData(FontPlatformData(description), _font->wordSpacing(), _font->letterSpacing()); + m_fontList.append(pair(result, result->isCustomFont())); + return result; } const FontData* FontFallbackList::fontDataForCharacters(const WebCore::Font* font, const UChar*, int) const diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 6c90ea3..490b54b 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -98,7 +98,7 @@ static inline QPainter::CompositionMode toQtCompositionMode(CompositeOperator op case CompositeHighlight: return QPainter::CompositionMode_SourceOver; case CompositePlusLighter: - return QPainter::CompositionMode_SourceOver; + return QPainter::CompositionMode_Plus; } return QPainter::CompositionMode_SourceOver; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp index 29a02d4..333269e 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp @@ -47,7 +47,24 @@ ImageBufferData::ImageBufferData(const IntSize& size) : m_pixmap(size) { m_pixmap.fill(QColor(Qt::transparent)); - m_painter.set(new QPainter(&m_pixmap)); + + QPainter* painter = new QPainter(&m_pixmap); + m_painter.set(painter); + + // Since ImageBuffer is used mainly for Canvas, explicitly initialize + // its painter's pen and brush with the corresponding canvas defaults + // NOTE: keep in sync with CanvasRenderingContext2D::State + QPen pen = painter->pen(); + pen.setColor(Qt::black); + pen.setWidth(1); + pen.setCapStyle(Qt::FlatCap); + pen.setJoinStyle(Qt::MiterJoin); + pen.setMiterLimit(10); + painter->setPen(pen); + QBrush brush = painter->brush(); + brush.setColor(Qt::black); + painter->setBrush(brush); + painter->setCompositionMode(QPainter::CompositionMode_SourceOver); } ImageBuffer::ImageBuffer(const IntSize& size, bool grayScale, bool& success) diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index 394c7a7..cd32428 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -197,7 +197,8 @@ ImageDecoderQt* ImageDecoderQt::create(const SharedBuffer& data) } ImageDecoderQt::ImageDecoderQt(const QString &imageFormat) - : m_imageFormat(imageFormat) + : m_hasAlphaChannel(false) + , m_imageFormat(imageFormat) { } @@ -212,6 +213,7 @@ bool ImageDecoderQt::hasFirstImageHeader() const void ImageDecoderQt::reset() { + m_hasAlphaChannel = false; m_failed = false; m_imageList.clear(); m_pixmapCache.clear(); @@ -230,6 +232,9 @@ void ImageDecoderQt::setData(const IncomingData &data, bool allDataReceived) const ReadContext::ReadResult readResult = readContext.read(allDataReceived); + if (hasFirstImageHeader()) + m_hasAlphaChannel = m_imageList[0].m_image.hasAlphaChannel(); + if (debugImageDecoderQt) qDebug() << " read returns " << readResult; @@ -280,7 +285,7 @@ int ImageDecoderQt::repetitionCount() const bool ImageDecoderQt::supportsAlpha() const { - return hasFirstImageHeader() && m_imageList[0].m_image.hasAlphaChannel(); + return m_hasAlphaChannel; } int ImageDecoderQt::duration(size_t index) const @@ -314,6 +319,10 @@ QPixmap* ImageDecoderQt::imageAtIndex(size_t index) const if (!m_pixmapCache.contains(index)) { m_pixmapCache.insert(index, QPixmap::fromImage(m_imageList[index].m_image)); + + // store null image since the converted pixmap is already in pixmap cache + Q_ASSERT(m_imageList[index].m_imageState == ImageComplete); + m_imageList[index].m_image = QImage(); } return &m_pixmapCache[index]; } diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.h b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.h index a2eb6aa..b8c3edd 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.h @@ -81,8 +81,9 @@ private: int m_duration; }; + bool m_hasAlphaChannel; typedef QList ImageList; - ImageList m_imageList; + mutable ImageList m_imageList; mutable QHash m_pixmapCache; int m_loopCount; QString m_imageFormat; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp index a9da76b..02d17ed 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp @@ -737,6 +737,10 @@ ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con if (isHovered(o)) option.state |= QStyle::State_MouseOver; + option.direction = Qt::LeftToRight; + if (o->style() && o->style()->direction() == WebCore::RTL) + option.direction = Qt::RightToLeft; + ControlPart result = o->style()->appearance(); switch (result) { -- cgit v0.12 From 56ffcd446d7b4a411fbada3a63d06c6a3e262a36 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Mon, 18 May 2009 20:43:28 +0200 Subject: Update QtWebKit changes for the next patch release. Reviewed-by: TrustMe --- dist/changes-4.5.2 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dist/changes-4.5.2 b/dist/changes-4.5.2 index 3180b7c..a132028 100644 --- a/dist/changes-4.5.2 +++ b/dist/changes-4.5.2 @@ -33,6 +33,16 @@ Third party components * Library * **************************************************************************** +- QtWebKit + * Backported fixes for critical bugs, memory leaks, and crashes from + WebKit trunk (with revision numbers) related to: + Canvas (r40546, r41221 r41355, r42996, r43645) + Memory (r41527, r43764, r43828, r43830) + JavaScript (r39882, r40086, r40131, r40133) + Rendering (r41285, r41296, r41659, r42887) + Network (r41664, r42516) + Plugins (r41346) + Clipboard (r41360) **************************************************************************** * Database Drivers * -- cgit v0.12 From 954f1288e40f5fe2997c3caa66cb2f4ba9d710b3 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 19 May 2009 09:48:09 +1000 Subject: Various fixes for Qml support in lupdate. --- tools/linguist/lupdate/main.cpp | 3 ++- tools/linguist/lupdate/qml.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 8597672..f47844f 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -428,7 +428,8 @@ int main(int argc, char **argv) if (!fn.endsWith(QLatin1String(".java")) && !fn.endsWith(QLatin1String(".ui")) && !fn.endsWith(QLatin1String(".js")) - && !fn.endsWith(QLatin1String(".qs"))) { + && !fn.endsWith(QLatin1String(".qs")) + && !fn.endsWith(QLatin1String(".qml"))) { int offset = 0; int depth = 0; do { diff --git a/tools/linguist/lupdate/qml.cpp b/tools/linguist/lupdate/qml.cpp index 8c3f1c5..6eec72e 100644 --- a/tools/linguist/lupdate/qml.cpp +++ b/tools/linguist/lupdate/qml.cpp @@ -94,18 +94,18 @@ protected: const QString source = literal->value->asString(); QString comment; + bool plural = false; AST::ArgumentList *commentNode = node->arguments->next; if (commentNode) { literal = AST::cast(commentNode->expression); comment = literal->value->asString(); - } - bool plural = false; - AST::ArgumentList *nNode = commentNode->next; - if (nNode) { - AST::NumericLiteral *literal3 = AST::cast(nNode->expression); - if (literal3) { - plural = true; + AST::ArgumentList *nNode = commentNode->next; + if (nNode) { + AST::NumericLiteral *literal3 = AST::cast(nNode->expression); + if (literal3) { + plural = true; + } } } -- cgit v0.12 From 8d2e8481d6190ce15db66e9bebc22f9068174bea Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 19 May 2009 09:52:13 +1000 Subject: Remove debug. --- src/declarative/fx/qfxflipable.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp index 9804004..24ae428 100644 --- a/src/declarative/fx/qfxflipable.cpp +++ b/src/declarative/fx/qfxflipable.cpp @@ -296,7 +296,6 @@ QFxFlipable::Side QFxFlipable::side() const //(the logic here should be kept in sync with setBackTransform and setRotation) void QFxFlipable::transformChanged(const QSimpleCanvas::Matrix &trans) { - qWarning("Transform changed"); Q_D(QFxFlipable); QPointF p1(0, 0); QPointF p2(1, 0); -- cgit v0.12 From 692782c4d11cf7352a7923633cb015c3580e2704 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 18 May 2009 16:46:12 +1000 Subject: Fix pens. Now corresponds to standard Qt painting; in particular, penwidth extends outside rectangle. Task-number: 249318 --- src/declarative/canvas/qsimplecanvasitem.cpp | 10 +- src/declarative/canvas/qsimplecanvasitem.h | 1 + src/declarative/canvas/qsimplecanvasitem_p.h | 3 +- src/declarative/fx/qfxrect.cpp | 157 ++++++++++++++++----------- src/declarative/fx/qfxrect.h | 2 +- 5 files changed, 108 insertions(+), 65 deletions(-) diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp index 12c725c..4449e2b 100644 --- a/src/declarative/canvas/qsimplecanvasitem.cpp +++ b/src/declarative/canvas/qsimplecanvasitem.cpp @@ -180,10 +180,18 @@ void QSimpleCanvasItem::childrenChanged() { } +int QSimpleCanvasItem::setPaintMargin(qreal margin) +{ + Q_D(QSimpleCanvasItem); + if (margin < d->paintmargin) + update(); // schedule repaint of old boundingRect + d->paintmargin = margin; +} + QRectF QSimpleCanvasItem::boundingRect() const { Q_D(const QSimpleCanvasItem); - return QRectF(0., 0., d->width, d->height); + return QRectF(-d->paintmargin, -d->paintmargin, d->width+d->paintmargin*2, d->height+d->paintmargin*2); } void QSimpleCanvasItem::paintContents(QPainter &) diff --git a/src/declarative/canvas/qsimplecanvasitem.h b/src/declarative/canvas/qsimplecanvasitem.h index cab8492..1c729b1 100644 --- a/src/declarative/canvas/qsimplecanvasitem.h +++ b/src/declarative/canvas/qsimplecanvasitem.h @@ -183,6 +183,7 @@ public: }; + int setPaintMargin(qreal margin); QRectF boundingRect() const; virtual void paintContents(QPainter &); virtual void paintGLContents(GLPainter &); diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h index cfe0bba..7fe16a3 100644 --- a/src/declarative/canvas/qsimplecanvasitem_p.h +++ b/src/declarative/canvas/qsimplecanvasitem_p.h @@ -139,7 +139,7 @@ public: focusable(false), wantsActiveFocusPanelPendingCanvas(false), hasBeenActiveFocusPanel(false), hasFocus(false), hasActiveFocus(false), needsZOrder(false), - widthValid(false), heightValid(false), width(0), height(0), scale(1), + widthValid(false), heightValid(false), width(0), height(0), paintmargin(0), scale(1), graphicsItem(0), data_ptr(0) { } @@ -173,6 +173,7 @@ public: qreal width; qreal height; + qreal paintmargin; qreal scale; QSimpleGraphicsItem *graphicsItem; diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index dafd8a2..cd5a4c3 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -86,8 +86,26 @@ QML_DEFINE_TYPE(QFxPen,Pen); void QFxPen::setColor(const QColor &c) { _color = c; - emit updated(); _valid = _color.alpha() ? true : false; + emit updated(); +} + +/*! + \property QFxPen::width + \brief the width of the pen. + + \qml + // rect with green border using hexidecimal notation + Rect { pen.width: 4 } + \endqml + + Odd pen widths generally lead to half-pixel painting. +*/ +void QFxPen::setWidth(int w) +{ + _width = w; + _valid = (_width < 1) ? false : true; + emit updated(); } @@ -167,6 +185,8 @@ void QFxRect::doUpdate() Q_D(QFxRect); d->_rectTexture.clear(); #endif + const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0; + setPaintMargin((pw+1)/2); update(); } @@ -372,14 +392,19 @@ void QFxRect::generateRoundedRect() { Q_D(QFxRect); if (d->_rectImage.isNull()) { - d->_rectImage = QImage(d->_radius*2 + 1, d->_radius*2 + 1, QImage::Format_ARGB32_Premultiplied); + const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0; + d->_rectImage = QImage(d->_radius*2 + 1 + pw*2, d->_radius*2 + 1 + pw*2, QImage::Format_ARGB32_Premultiplied); d->_rectImage.fill(0); QPainter p(&(d->_rectImage)); - QPen pn(QColor(pen()->color()), pen()->width()); p.setRenderHint(QPainter::Antialiasing); - p.setPen(pn); + if (d->_pen && d->_pen->isValid()) { + QPen pn(QColor(pen()->color()), pen()->width()); + p.setPen(pn); + } else { + p.setPen(Qt::NoPen); + } p.setBrush(d->_color); - p.drawRoundedRect(0, 0, d->_rectImage.width(), d->_rectImage.height(), d->_radius, d->_radius); + p.drawRoundedRect((pw+1)/2, (pw+1)/2, d->_rectImage.width()-(pw+1)/2*2, d->_rectImage.height()-(pw+1)/2*2, d->_radius, d->_radius); } } @@ -387,14 +412,19 @@ void QFxRect::generateBorderedRect() { Q_D(QFxRect); if (d->_rectImage.isNull()) { - d->_rectImage = QImage(d->pen()->width()*2 + 1, d->pen()->width()*2 + 1, QImage::Format_ARGB32_Premultiplied); + const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0; + d->_rectImage = QImage(d->pen()->width()*2 + 1 + pw*2, d->pen()->width()*2 + 1 + pw*2, QImage::Format_ARGB32_Premultiplied); d->_rectImage.fill(0); QPainter p(&(d->_rectImage)); - QPen pn(QColor(pen()->color()), pen()->width()); p.setRenderHint(QPainter::Antialiasing); - p.setPen(pn); + if (d->_pen && d->_pen->isValid()) { + QPen pn(QColor(pen()->color()), pen()->width()); + p.setPen(pn); + } else { + p.setPen(Qt::NoPen); + } p.setBrush(d->_color); - p.drawRect(0, 0, d->_rectImage.width(), d->_rectImage.height()); + p.drawRect(qreal(pw+1)/2, qreal(pw+1)/2, d->_rectImage.width()-(pw+1)/2*2, d->_rectImage.height()-(pw+1)/2*2); } } #elif defined(QFX_RENDER_OPENGL) @@ -402,14 +432,15 @@ void QFxRect::generateRoundedRect() { Q_D(QFxRect); if (d->_rectTexture.isNull()) { - QImage roundRect(int(d->_radius*2 + 1), int(d->_radius*2 + 1), QImage::Format_ARGB32); + const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0; + QImage roundRect(d->_radius*2 + 4 + pw*2, d->_radius*2 + 4 + pw*2, QImage::Format_ARGB32_Premultiplied); roundRect.fill(0); QPainter p(&roundRect); QPen pn(QColor(pen()->color()), pen()->width()); p.setRenderHint(QPainter::Antialiasing); p.setPen(pn); p.setBrush(d->_color); - p.drawRoundedRect(0, 0, roundRect.width(), roundRect.height(), d->_radius, d->_radius); + p.drawRoundedRect((pw+1)/2, (pw+1)/2, roundRect.width()-(pw+1)/2*2, roundRect.height()-(pw+1)/2*2, d->_radius, d->_radius); d->_rectTexture.setImage(roundRect); } } @@ -418,14 +449,15 @@ void QFxRect::generateBorderedRect() { Q_D(QFxRect); if (d->_rectTexture.isNull()) { - QImage borderedRect(d->pen()->width()*2 + 1, d->pen()->width()*2 + 1, QImage::Format_ARGB32_Premultiplied); + const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0; + QImage borderedRect(pw*2 + 4, pw*2 + 4, QImage::Format_ARGB32_Premultiplied); borderedRect.fill(0); QPainter p(&(borderedRect)); QPen pn(QColor(pen()->color()), pen()->width()); p.setRenderHint(QPainter::Antialiasing); p.setPen(pn); p.setBrush(d->_color); - p.drawRect(0, 0, borderedRect.width(), borderedRect.height()); + p.drawRect(qreal(pw+1)/2, qreal(pw+1)/2, borderedRect.width()-(pw+1)/2*2, borderedRect.height()-(pw+1)/2*2); d->_rectTexture.setImage(borderedRect); } } @@ -458,9 +490,13 @@ void QFxRect::drawRect(QPainter &p) // XXX This path is still slower than the image path // Image path won't work for gradients though p.save(); - QPen pn(QColor(pen()->color()), pen()->width()); p.setRenderHint(QPainter::Antialiasing); - p.setPen(pn); + if (d->_pen && d->_pen->isValid()) { + QPen pn(QColor(pen()->color()), pen()->width()); + p.setPen(pn); + } else { + p.setPen(Qt::NoPen); + } if (d->_gradcolor.isValid()){ QLinearGradient grad(0, 0, 0, height()); grad.setColorAt(0, d->_color); @@ -476,13 +512,15 @@ void QFxRect::drawRect(QPainter &p) p.restore(); } else { int offset = 0; + const int pw = d->_pen && d->_pen->isValid() ? (d->_pen->width()+1)/2*2 : 0; + if (d->_radius > 0) { generateRoundedRect(); //### implicit conversion to int - offset = d->_radius; + offset = int(d->_radius+0.5+pw); } else { generateBorderedRect(); - offset = d->pen()->width(); + offset = pw; } //basically same code as QFxImage uses to paint sci images @@ -490,40 +528,42 @@ void QFxRect::drawRect(QPainter &p) int ySide = qMin(offset * 2, int(height()));; // Upper left - p.drawImage(QRect(0, 0, offset, offset), d->_rectImage, QRect(0, 0, offset, offset)); + p.drawImage(QRect(-pw/2, -pw/2, offset, offset), d->_rectImage, QRect(0, 0, offset, offset)); // Upper middle if (d->_rectImage.width() - xSide) - p.drawImage(QRect(offset, 0, width() - xSide, offset), d->_rectImage, - QRect(offset, 0, d->_rectImage.width() - xSide, offset)); + p.drawImage(QRect(offset-pw/2, -pw/2, width() - xSide + pw, offset), d->_rectImage, + QRect(d->_rectImage.width()/2, 0, 1, offset)); // Upper right if (d->_rectImage.width() - offset) { - p.drawImage(QPoint(width()-offset, 0), d->_rectImage, + p.drawImage(QPoint(width()-offset+pw/2, -pw/2), d->_rectImage, QRect(d->_rectImage.width()-offset, 0, offset, offset)); } // Middle left if (d->_rectImage.height() - ySide) - p.drawImage(QRect(0, offset, offset, height() - ySide), d->_rectImage, - QRect(0, offset, offset, d->_rectImage.height() - ySide)); + p.drawImage(QRect(-pw/2, offset-pw/2, offset, height() - ySide + pw), d->_rectImage, + QRect(0, d->_rectImage.height()/2, offset, 1)); // Middle if (d->_rectImage.width() - xSide && d->_rectImage.height() - ySide) - p.drawImage(QRect(offset, offset, width() - xSide, height() - ySide), d->_rectImage, - QRect(offset, offset, d->_rectImage.width() - xSide, d->_rectImage.height() - ySide)); - // Midlle right + // XXX paint errors in animation example + //p.fillRect(offset-pw/2, offset-pw/2, width() - xSide + pw, height() - ySide + pw, d->getColor()); + p.drawImage(QRect(offset-pw/2, offset-pw/2, width() - xSide + pw, height() - ySide + pw), d->_rectImage, + QRect(d->_rectImage.width()/2, d->_rectImage.height()/2, 1, 1)); + // Middle right if (d->_rectImage.height() - ySide) - p.drawImage(QRect(width()-offset, offset, offset, height() - ySide), d->_rectImage, - QRect(d->_rectImage.width()-offset, offset, offset, d->_rectImage.height() - ySide)); + p.drawImage(QRect(width()-offset+pw/2, offset-pw/2, offset, height() - ySide + pw), d->_rectImage, + QRect(d->_rectImage.width()-offset, d->_rectImage.height()/2, offset, 1)); // Lower left - p.drawImage(QPoint(0, height() - offset), d->_rectImage, QRect(0, d->_rectImage.height() - offset, offset, offset)); + p.drawImage(QPoint(-pw/2, height() - offset + pw/2), d->_rectImage, QRect(0, d->_rectImage.height() - offset, offset, offset)); // Lower Middle if (d->_rectImage.width() - xSide) - p.drawImage(QRect(offset, height() - offset, width() - xSide, offset), d->_rectImage, - QRect(offset, d->_rectImage.height() - offset, d->_rectImage.width() - xSide, offset)); + p.drawImage(QRect(offset-pw/2, height() - offset +pw/2, width() - xSide + pw, offset), d->_rectImage, + QRect(d->_rectImage.width()/2, d->_rectImage.height() - offset, 1, offset)); // Lower Right if (d->_rectImage.width() - offset) - p.drawImage(QPoint(width()-offset, height() - offset), d->_rectImage, + p.drawImage(QPoint(width()-offset+pw/2, height() - offset+pw/2), d->_rectImage, QRect(d->_rectImage.width()-offset, d->_rectImage.height() - offset, offset, offset)); } } @@ -586,12 +626,14 @@ void QFxRect::paintGLContents(GLPainter &p) } } else { qreal offset = 0; + qreal pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0.0; + if (d->_radius > 0) { generateRoundedRect(); - offset = d->_radius; + offset = d->_radius + pw+1.5; } else { generateBorderedRect(); - offset = d->pen()->width(); + offset = pw+1.5; } QGLShaderProgram *shader = p.useTextureShader(); @@ -601,38 +643,29 @@ void QFxRect::paintGLContents(GLPainter &p) if (!imgWidth || !imgHeight) return; - float widthV = width(); - float heightV = height(); + float widthV = qreal(width())+pw/2; + float heightV = qreal(height())+pw/2; - float texleft = 0; - float texright = 1; - float textop = 1; - float texbottom = 0; - float imgleft = 0; - float imgright = widthV; - float imgtop = 0; - float imgbottom = heightV; - - texleft = float(offset) / imgWidth; - imgleft = offset; - texright = 1. - float(offset) / imgWidth; - imgright = widthV - offset; - textop = 1. - float(offset) / imgHeight; - imgtop = offset; - texbottom = float(offset) / imgHeight; - imgbottom = heightV - offset; + float texleft = float(offset) / imgWidth; + float imgleft = offset-pw/2; + float texright = float(imgWidth-offset) / imgWidth; + float imgright = widthV - offset; + float textop = float(imgHeight-offset) / imgHeight; + float imgtop = offset-pw/2; + float texbottom = float(offset) / imgHeight; + float imgbottom = heightV - offset; //Bug 231768: Inappropriate interpolation was occuring on 3x3 textures if (offset==1) texleft=texright=textop=texbottom=0.5; - float vert1[] = { 0, 0, - 0, imgtop, - imgleft, 0, + float vert1[] = { -pw/2, -pw/2, + -pw/2, imgtop, + imgleft, -pw/2, imgleft, imgtop, - imgright, 0, + imgright, -pw/2, imgright, imgtop, - widthV, 0, + widthV, -pw/2, widthV, imgtop }; float tex1[] = { 0, 0, 0, textop, @@ -642,8 +675,8 @@ void QFxRect::paintGLContents(GLPainter &p) texright, textop, 1, 0, 1, textop }; - float vert2[] = { 0, imgtop, - 0, imgbottom, + float vert2[] = { -pw/2, imgtop, + -pw/2, imgbottom, imgleft, imgtop, imgleft, imgbottom, imgright, imgtop, @@ -658,8 +691,8 @@ void QFxRect::paintGLContents(GLPainter &p) texright, texbottom, 1, textop, 1, texbottom }; - float vert3[] = { 0, imgbottom, - 0, heightV, + float vert3[] = { -pw/2, imgbottom, + -pw/2, heightV, imgleft, imgbottom, imgleft, heightV, imgright, imgbottom, diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h index 42e7b2f..339a7d8 100644 --- a/src/declarative/fx/qfxrect.h +++ b/src/declarative/fx/qfxrect.h @@ -62,7 +62,7 @@ public: {} int width() const { return _width; } - void setWidth(int w) { _width = w; emit updated(); _valid = (_width < 1) ? false : true; } + void setWidth(int w); QColor color() const { return _color; } void setColor(const QColor &c); -- cgit v0.12 From b176adc2665ef4b94f30ba5fd8d85a5913b0bbbb Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 19 May 2009 11:36:49 +1000 Subject: Add missing clearItem() flag --- src/declarative/fx/qfxanchors.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index 826d6c1..3eaf47a 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -186,8 +186,10 @@ void QFxAnchorsPrivate::clearItem(QFxItem *item) fill = 0; if (centeredIn == item) centeredIn = 0; - if (left.item == item) + if (left.item == item) { left.item = 0; + usedAnchors &= ~QFxAnchors::HasLeftAnchor; + } if (right.item == item) { right.item = 0; usedAnchors &= ~QFxAnchors::HasRightAnchor; -- cgit v0.12 From ba7e2d913deb4adeef071002e3518f43949e6a08 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 19 May 2009 13:33:21 +1000 Subject: Fixed incorrect pass/fail semantics for xpass/xfail when using xunitxml testlib logger. In the testlib plain logger, xfail is considered a pass and xpass considered a fail. xunitxml had the opposite behavior; change it to be the same. Autotest: included --- src/testlib/qtestlogger.cpp | 21 +++++++++++++++------ tests/auto/selftests/expected_xunit.txt | 13 ++++++++++++- tests/auto/selftests/xunit/tst_xunit.cpp | 29 +++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 7 deletions(-) diff --git a/src/testlib/qtestlogger.cpp b/src/testlib/qtestlogger.cpp index 2249e8a..46af232 100644 --- a/src/testlib/qtestlogger.cpp +++ b/src/testlib/qtestlogger.cpp @@ -180,7 +180,7 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description, switch (type) { case QAbstractTestLogger::XPass: - ++passCounter; + ++failureCounter; typeBuf = "xpass"; break; case QAbstractTestLogger::Pass: @@ -188,7 +188,7 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description, typeBuf = "pass"; break; case QAbstractTestLogger::XFail: - ++failureCounter; + ++passCounter; typeBuf = "xfail"; break; case QAbstractTestLogger::Fail: @@ -200,7 +200,8 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description, break; } - if (type == QAbstractTestLogger::Fail || type == QAbstractTestLogger::XFail) { + if (type == QAbstractTestLogger::Fail || type == QAbstractTestLogger::XPass + || ((format != TLF_XunitXml) && (type == QAbstractTestLogger::XFail))) { QTestElement *failureElement = new QTestElement(QTest::LET_Failure); failureElement->addAttribute(QTest::AI_Result, typeBuf); if(file) @@ -230,10 +231,10 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description, if (!strcmp(oldResult, "pass")) { overwrite = true; } - else if (!strcmp(oldResult, "xpass")) { - overwrite = (type == QAbstractTestLogger::XFail || type == QAbstractTestLogger::Fail); - } else if (!strcmp(oldResult, "xfail")) { + overwrite = (type == QAbstractTestLogger::XPass || type == QAbstractTestLogger::Fail); + } + else if (!strcmp(oldResult, "xpass")) { overwrite = (type == QAbstractTestLogger::Fail); } if (overwrite) { @@ -251,6 +252,14 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description, QTest::qt_snprintf(buf, sizeof(buf), "%i", line); currentLogElement->addAttribute(QTest::AI_Line, buf); + + /* + Since XFAIL does not add a failure to the testlog in xunitxml, add a message, so we still + have some information about the expected failure. + */ + if (format == TLF_XunitXml && type == QAbstractTestLogger::XFail) { + QTestLogger::addMessage(QAbstractTestLogger::Info, description, file, line); + } } void QTestLogger::addBenchmarkResult(const QBenchmarkResult &result) diff --git a/tests/auto/selftests/expected_xunit.txt b/tests/auto/selftests/expected_xunit.txt index 875dda6..cb74491 100644 --- a/tests/auto/selftests/expected_xunit.txt +++ b/tests/auto/selftests/expected_xunit.txt @@ -1,5 +1,5 @@ - + @@ -20,10 +20,21 @@ + + + + + + + + + ]]> + + diff --git a/tests/auto/selftests/xunit/tst_xunit.cpp b/tests/auto/selftests/xunit/tst_xunit.cpp index dbe9fec..c3c90ab 100644 --- a/tests/auto/selftests/xunit/tst_xunit.cpp +++ b/tests/auto/selftests/xunit/tst_xunit.cpp @@ -53,6 +53,9 @@ private slots: void testFunc2(); void testFunc3(); void testFunc4(); + void testFunc5(); + void testFunc6(); + void testFunc7(); }; tst_Xunit::tst_Xunit() @@ -81,6 +84,32 @@ void tst_Xunit::testFunc4() QFAIL("a forced failure!"); } +/* + Note there are two testfunctions which give expected failures. + This is so we can test that expected failures don't add to failure + counts and unexpected passes do. If we had one xfail and one xpass + testfunction, we couldn't test which one of them adds to the failure + count. +*/ + +void tst_Xunit::testFunc5() +{ + QEXPECT_FAIL("", "this failure is expected", Abort); + QVERIFY(false); +} + +void tst_Xunit::testFunc6() +{ + QEXPECT_FAIL("", "this failure is also expected", Abort); + QVERIFY(false); +} + +void tst_Xunit::testFunc7() +{ + QEXPECT_FAIL("", "this pass is unexpected", Abort); + QVERIFY(true); +} + QTEST_APPLESS_MAIN(tst_Xunit) #include "tst_xunit.moc" -- cgit v0.12 From f9aa68b172ddcaa63e5a1bc4d91649d0734d3b15 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 19 May 2009 14:45:49 +1000 Subject: Add a basic anchoring autotest. --- tests/auto/declarative/anchors/data/anchors.qml | 115 ++++++++++++++++++++++++ tests/auto/declarative/anchors/tst_anchors.cpp | 75 +++++++++++++++- 2 files changed, 188 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/anchors/data/anchors.qml diff --git a/tests/auto/declarative/anchors/data/anchors.qml b/tests/auto/declarative/anchors/data/anchors.qml new file mode 100644 index 0000000..6a87390 --- /dev/null +++ b/tests/auto/declarative/anchors/data/anchors.qml @@ -0,0 +1,115 @@ +Rect { + color: "white" + width: 240 + height: 320 + Rect { id: MasterRect; x: 26; width: 96; height: 20; color: "red" } + Rect { + id: Rect1 + y: 20; width: 10; height: 10 + anchors.left: MasterRect.left + } + Rect { + id: Rect2 + y: 20; width: 10; height: 10 + anchors.left: MasterRect.right + } + Rect { + id: Rect3 + y: 20; width: 10; height: 10 + anchors.left: MasterRect.horizontalCenter + } + Rect { + id: Rect4 + y: 30; width: 10; height: 10 + anchors.right: MasterRect.left + } + Rect { + id: Rect5 + y: 30; width: 10; height: 10 + anchors.right: MasterRect.right + } + Rect { + id: Rect6 + y: 30; width: 10; height: 10 + anchors.right: MasterRect.horizontalCenter + } + Rect { + id: Rect7 + y: 50; width: 10; height: 10 + anchors.left: parent.left + } + Rect { + id: Rect8 + y: 50; width: 10; height: 10 + anchors.left: parent.right + } + Rect { + id: Rect9 + y: 50; width: 10; height: 10 + anchors.left: parent.horizontalCenter + } + Rect { + id: Rect10 + y: 60; width: 10; height: 10 + anchors.right: parent.left + } + Rect { + id: Rect11 + y: 60; width: 10; height: 10 + anchors.right: parent.right + } + Rect { + id: Rect12 + y: 60; width: 10; height: 10 + anchors.right: parent.horizontalCenter + } + Rect { + id: Rect13 + x: 200; width: 10; height: 10 + anchors.top: MasterRect.bottom + } + Rect { + id: Rect14 + width: 10; height: 10; color: "steelblue" + anchors.verticalCenter: parent.verticalCenter + } + Rect { + id: Rect15 + y: 200; height: 10 + anchors.left: MasterRect.left + anchors.right: MasterRect.right + } + Rect { + id: Rect16 + y: 220; height: 10 + anchors.left: MasterRect.left + anchors.horizontalCenter: MasterRect.right + } + Rect { + id: Rect17 + y: 240; height: 10 + anchors.right: MasterRect.right + anchors.horizontalCenter: MasterRect.left + } + Rect { + id: Rect18 + x: 180; width: 10 + anchors.top: MasterRect.bottom + anchors.bottom: Rect12.top + } + Rect { + id: Rect19 + y: 70; width: 10; height: 10 + anchors.horizontalCenter: parent.horizontalCenter + } + Rect { + id: Rect20 + y: 70; width: 10; height: 10 + anchors.horizontalCenter: parent.right + } + Rect { + id: Rect21 + y: 70; width: 10; height: 10 + anchors.horizontalCenter: parent.left + } +} diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp index 683a7b9..8087d6e 100644 --- a/tests/auto/declarative/anchors/tst_anchors.cpp +++ b/tests/auto/declarative/anchors/tst_anchors.cpp @@ -2,8 +2,7 @@ #include #include #include -#include -#include +#include class tst_anchors : public QObject { @@ -11,10 +10,82 @@ class tst_anchors : public QObject public: tst_anchors() {} + template + T *findItem(QFxItem *parent, const QString &id); + private slots: + void basicAnchors(); void loops(); }; +/* + Find an item with the specified id. +*/ +template +T *tst_anchors::findItem(QFxItem *parent, const QString &id) +{ + const QMetaObject &mo = T::staticMetaObject; + for (int i = 0; i < parent->QSimpleCanvasItem::children().count(); ++i) { + QFxItem *item = qobject_cast(parent->QSimpleCanvasItem::children().at(i)); + if (mo.cast(item) && (id.isEmpty() || item->id() == id)) { + return static_cast(item); + } + item = findItem(item, id); + if (item) + return static_cast(item); + } + + return 0; +} + +void tst_anchors::basicAnchors() +{ + QFxView *view = new QFxView; + view->setUrl(QUrl("file://" SRCDIR "/data/anchors.qml")); + + view->execute(); + qApp->processEvents(); + + //sibling horizontal + QCOMPARE(findItem(view->root(), QLatin1String("Rect1"))->x(), 26.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect2"))->x(), 122.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect3"))->x(), 74.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect4"))->x(), 16.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect5"))->x(), 112.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect6"))->x(), 64.0); + + //parent horizontal + QCOMPARE(findItem(view->root(), QLatin1String("Rect7"))->x(), 0.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect8"))->x(), 240.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect9"))->x(), 120.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect10"))->x(), -10.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect11"))->x(), 230.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect12"))->x(), 110.0); + + //vertical + QCOMPARE(findItem(view->root(), QLatin1String("Rect13"))->y(), 20.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect14"))->y(), 155.0); + + //stretch + QCOMPARE(findItem(view->root(), QLatin1String("Rect15"))->x(), 26.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect15"))->width(), 96.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect16"))->x(), 26.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect16"))->width(), 192.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect17"))->x(), -70.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect17"))->width(), 192.0); + + //vertical stretch + QCOMPARE(findItem(view->root(), QLatin1String("Rect18"))->y(), 20.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect18"))->height(), 40.0); + + //more parent horizontal + QCOMPARE(findItem(view->root(), QLatin1String("Rect19"))->x(), 115.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect20"))->x(), 235.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect21"))->x(), -5.0); + + delete view; +} + // mostly testing that we don't crash void tst_anchors::loops() { -- cgit v0.12 From da5cb2883e2b0e4a52a0aecba2c82808e64668f8 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 19 May 2009 15:27:44 +1000 Subject: Docs and minor fixes for the Rotation element. --- doc/src/declarative/elements.qdoc | 1 + examples/declarative/dial/DialLibrary/Dial.qml | 34 +++++++++++++------------- src/declarative/fx/qfxtransform.cpp | 28 +++++++++++++++++++++ src/declarative/fx/qfxtransform.h | 5 +++- 4 files changed, 50 insertions(+), 18 deletions(-) diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 976e2f1..3298699 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -140,6 +140,7 @@ The following table lists the Qml elements provided by the Qt Declarative module \o \list +\o \l Rotation \o \l Squish \o \l Rotation3D \endlist diff --git a/examples/declarative/dial/DialLibrary/Dial.qml b/examples/declarative/dial/DialLibrary/Dial.qml index 2e214a8..e3fd382 100644 --- a/examples/declarative/dial/DialLibrary/Dial.qml +++ b/examples/declarative/dial/DialLibrary/Dial.qml @@ -4,26 +4,26 @@ Item { width: 210; height: 210 Image { id: Background; source: "background.svg" } - Item { - x: 104; y: 102 - rotation: Needle.rotation - Image { - source: "needle_shadow.svg" - x: -104; y: -102 + + Image { + source: "needle_shadow.svg" + transform: Rotation { + originX: 104; originY: 102 + angle: NeedleRotation.angle } } - Item { + Image { id: Needle - x: 102; y: 98 - rotation: -130 - rotation: Follow { - spring: 1.4 - damping: .15 - source: Math.min(Math.max(-130, value*2.2 - 130), 133) - } - Image { - source: "needle.svg" - x: -102; y: -98 + source: "needle.svg" + transform: Rotation { + id: NeedleRotation + originX: 102; originY: 98 + angle: -130 + angle: Follow { + spring: 1.4 + damping: .15 + source: Math.min(Math.max(-130, value*2.2 - 130), 133) + } } } Image { source: "overlay.svg" } diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp index 7b76367..bc59e0a 100644 --- a/src/declarative/fx/qfxtransform.cpp +++ b/src/declarative/fx/qfxtransform.cpp @@ -179,6 +179,20 @@ void QFxAxis::setEndZ(qreal z) emit updated(); } +/*! + \qmlclass Rotation + \brief A Rotation object provides a way to rotate an Item around a point. + + The following example rotates a Rect around its interior point 25, 25: + \qml + Rect { + width: 100; height: 100 + color: "blue" + transform: Rotation { originX: 25; originY: 25; angle: 45} + } + \endqml +*/ + QFxRotation::QFxRotation(QObject *parent) : QFxTransform(parent), _originX(0), _originY(0), _angle(0), _dirty(true) { @@ -188,6 +202,12 @@ QFxRotation::~QFxRotation() { } +/*! + \qmlproperty real Rotation::originX + \qmlproperty real Rotation::originY + + The point to rotate around. +*/ qreal QFxRotation::originX() const { return _originX; @@ -210,6 +230,11 @@ void QFxRotation::setOriginY(qreal oy) update(); } +/*! + \qmlproperty real Rotation::angle + + The angle, in degrees, to rotate. +*/ qreal QFxRotation::angle() const { return _angle; @@ -217,8 +242,11 @@ qreal QFxRotation::angle() const void QFxRotation::setAngle(qreal angle) { + if (_angle == angle) + return; _angle = angle; update(); + emit angleChanged(); } bool QFxRotation::isIdentity() const diff --git a/src/declarative/fx/qfxtransform.h b/src/declarative/fx/qfxtransform.h index a3a1a83..2e17ed5 100644 --- a/src/declarative/fx/qfxtransform.h +++ b/src/declarative/fx/qfxtransform.h @@ -115,7 +115,7 @@ class Q_DECLARATIVE_EXPORT QFxRotation : public QFxTransform Q_PROPERTY(qreal originX READ originX WRITE setOriginX) Q_PROPERTY(qreal originY READ originY WRITE setOriginY) - Q_PROPERTY(qreal angle READ angle WRITE setAngle) + Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged()) public: QFxRotation(QObject *parent=0); ~QFxRotation(); @@ -132,6 +132,9 @@ public: virtual bool isIdentity() const; virtual QSimpleCanvas::Matrix transform() const; +Q_SIGNALS: + void angleChanged(); + private Q_SLOTS: void update(); private: -- cgit v0.12 From 3b97e2d22ac184590b5049cff720a259f9aa6b42 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 19 May 2009 12:41:06 +1000 Subject: Fix pens, at small sizes See 504c489d40e815397235ba26df7f06aae821c88a Also fixes 0 width (hairline) pens. --- src/declarative/fx/qfxrect.cpp | 147 +++++++++++++++++++++++++---------------- src/declarative/fx/qfxrect.h | 2 +- 2 files changed, 90 insertions(+), 59 deletions(-) diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index 6f13d7c..b61baec 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -52,6 +52,11 @@ QML_DEFINE_TYPE(QFxPen,Pen); \ingroup group_utility \brief The QFxPen class provides a pen used for drawing rect borders on a QFxView. + By default, the pen is invalid and nothing is drawn. You must either set a color (then the default + width is 0) or a width (then the default color is black). + + A width of 0 is a single-pixel line on the border of the item being painted. + Example: \qml Rect { pen.width: 2; pen.color: "red" ... } @@ -61,8 +66,9 @@ QML_DEFINE_TYPE(QFxPen,Pen); /*! \property QFxPen::width \brief the width of the pen. - The default width is 1. If the width is less than 1 the pen is considered invalid - and won't be used. + A width of 0 is a single-pixel line on the border of the item being painted. + + If the width is less than 0 the pen is considered invalid and won't be used. */ /*! @@ -99,12 +105,14 @@ void QFxPen::setColor(const QColor &c) Rect { pen.width: 4 } \endqml + A width of 0 creates a thin line. For no line, use a negative width or a transparent color. + Odd pen widths generally lead to half-pixel painting. */ void QFxPen::setWidth(int w) { _width = w; - _valid = (_width < 1) ? false : true; + _valid = (_width < 0) ? false : true; emit updated(); } @@ -436,9 +444,13 @@ void QFxRect::generateRoundedRect() QImage roundRect(d->_radius*2 + 4 + pw*2, d->_radius*2 + 4 + pw*2, QImage::Format_ARGB32_Premultiplied); roundRect.fill(0); QPainter p(&roundRect); - QPen pn(QColor(pen()->color()), pen()->width()); p.setRenderHint(QPainter::Antialiasing); - p.setPen(pn); + if (d->_pen && d->_pen->isValid()) { + QPen pn(QColor(pen()->color()), pen()->width()); + p.setPen(pn); + } else { + p.setPen(Qt::NoPen); + } p.setBrush(d->_color); p.drawRoundedRect((pw+1)/2, (pw+1)/2, roundRect.width()-(pw+1)/2*2, roundRect.height()-(pw+1)/2*2, d->_radius, d->_radius); d->_rectTexture.setImage(roundRect); @@ -453,9 +465,13 @@ void QFxRect::generateBorderedRect() QImage borderedRect(pw*2 + 4, pw*2 + 4, QImage::Format_ARGB32_Premultiplied); borderedRect.fill(0); QPainter p(&(borderedRect)); - QPen pn(QColor(pen()->color()), pen()->width()); p.setRenderHint(QPainter::Antialiasing); - p.setPen(pn); + if (d->_pen && d->_pen->isValid()) { + QPen pn(QColor(pen()->color()), pen()->width()); + p.setPen(pn); + } else { + p.setPen(Qt::NoPen); + } p.setBrush(d->_color); p.drawRect(qreal(pw+1)/2, qreal(pw+1)/2, borderedRect.width()-(pw+1)/2*2, borderedRect.height()-(pw+1)/2*2); d->_rectTexture.setImage(borderedRect); @@ -524,18 +540,22 @@ void QFxRect::drawRect(QPainter &p) } //basically same code as QFxImage uses to paint sci images - int w = width(); - int h = height(); + int w = width()+pw; + int h = height()+pw; int xOffset = offset; int xSide = xOffset * 2; + bool xMiddles=true; if (xSide > w) { - xOffset = w/2; + xMiddles=false; + xOffset = w/2 + 1; xSide = xOffset * 2; } int yOffset = offset; int ySide = yOffset * 2; + bool yMiddles=true; if (ySide > h) { - yOffset = h/2; + yMiddles = false; + yOffset = h/2 + 1; ySide = yOffset * 2; } @@ -543,40 +563,37 @@ void QFxRect::drawRect(QPainter &p) p.drawImage(QRect(-pw/2, -pw/2, xOffset, yOffset), d->_rectImage, QRect(0, 0, xOffset, yOffset)); // Upper middle - if (d->_rectImage.width() - xSide) + if (xMiddles) p.drawImage(QRect(xOffset-pw/2, -pw/2, width() - xSide + pw, yOffset), d->_rectImage, QRect(d->_rectImage.width()/2, 0, 1, yOffset)); // Upper right - if (d->_rectImage.width() - xOffset) { - p.drawImage(QPoint(width()-xOffset+pw/2, -pw/2), d->_rectImage, - QRect(d->_rectImage.width()-xOffset, 0, xOffset, yOffset)); - } + p.drawImage(QPoint(width()-xOffset+pw/2, -pw/2), d->_rectImage, + QRect(d->_rectImage.width()-xOffset, 0, xOffset, yOffset)); // Middle left - if (d->_rectImage.height() - ySide) + if (yMiddles) p.drawImage(QRect(-pw/2, yOffset-pw/2, xOffset, height() - ySide + pw), d->_rectImage, QRect(0, d->_rectImage.height()/2, xOffset, 1)); // Middle - if (d->_rectImage.width() - xSide && d->_rectImage.height() - ySide) + if (xMiddles && yMiddles) // XXX paint errors in animation example //p.fillRect(xOffset-pw/2, yOffset-pw/2, width() - xSide + pw, height() - ySide + pw, d->getColor()); p.drawImage(QRect(xOffset-pw/2, yOffset-pw/2, width() - xSide + pw, height() - ySide + pw), d->_rectImage, QRect(d->_rectImage.width()/2, d->_rectImage.height()/2, 1, 1)); // Middle right - if (d->_rectImage.height() - ySide) + if (yMiddles) p.drawImage(QRect(width()-xOffset+pw/2, yOffset-pw/2, xOffset, height() - ySide + pw), d->_rectImage, QRect(d->_rectImage.width()-xOffset, d->_rectImage.height()/2, xOffset, 1)); // Lower left p.drawImage(QPoint(-pw/2, height() - yOffset + pw/2), d->_rectImage, QRect(0, d->_rectImage.height() - yOffset, xOffset, yOffset)); // Lower Middle - if (d->_rectImage.width() - xSide) + if (xMiddles) p.drawImage(QRect(xOffset-pw/2, height() - yOffset +pw/2, width() - xSide + pw, yOffset), d->_rectImage, QRect(d->_rectImage.width()/2, d->_rectImage.height() - yOffset, 1, yOffset)); // Lower Right - if (d->_rectImage.width() - xOffset) - p.drawImage(QPoint(width()-xOffset+pw/2, height() - yOffset+pw/2), d->_rectImage, - QRect(d->_rectImage.width()-xOffset, d->_rectImage.height() - yOffset, xOffset, yOffset)); + p.drawImage(QPoint(width()-xOffset+pw/2, height() - yOffset+pw/2), d->_rectImage, + QRect(d->_rectImage.width()-xOffset, d->_rectImage.height() - yOffset, xOffset, yOffset)); } } #endif @@ -650,22 +667,36 @@ void QFxRect::paintGLContents(GLPainter &p) QGLShaderProgram *shader = p.useTextureShader(); - float imgWidth = d->_rectTexture.width(); - float imgHeight = d->_rectTexture.height(); - if (!imgWidth || !imgHeight) + float texWidth = d->_rectTexture.width(); + float texHeight = d->_rectTexture.height(); + if (!texWidth || !texHeight) return; float widthV = qreal(width())+pw/2; float heightV = qreal(height())+pw/2; - float texleft = float(offset) / imgWidth; - float imgleft = offset-pw/2; - float texright = float(imgWidth-offset) / imgWidth; - float imgright = widthV - offset; - float textop = float(imgHeight-offset) / imgHeight; - float imgtop = offset-pw/2; - float texbottom = float(offset) / imgHeight; - float imgbottom = heightV - offset; + float xOffset = offset; + bool xMiddles = true; + if (xOffset*2 > width()+pw) { + xMiddles = false; + xOffset = (width()+pw)/2; + } + float yOffset = offset; + bool yMiddles = true; + if (yOffset*2 > height()+pw) { + yMiddles = false; + yOffset = (height()+pw)/2; + } + + float texleft = xOffset / texWidth; + float imgleft = xOffset-pw/2; + float texright = (texWidth-xOffset) / texWidth; + float imgright = widthV - xOffset; + + float textop = yOffset / texHeight; + float imgtop = yOffset-pw/2; + float texbottom = (texHeight-yOffset) / texHeight; + float imgbottom = heightV - yOffset; //Bug 231768: Inappropriate interpolation was occuring on 3x3 textures if (offset==1) @@ -703,31 +734,31 @@ void QFxRect::paintGLContents(GLPainter &p) texright, texbottom, 1, textop, 1, texbottom }; - float vert3[] = { -pw/2, imgbottom, - -pw/2, heightV, - imgleft, imgbottom, + float vert3[] = { -pw/2, heightV, + -pw/2, imgbottom, imgleft, heightV, - imgright, imgbottom, + imgleft, imgbottom, imgright, heightV, - widthV, imgbottom, - widthV, heightV }; - float tex3[] = { 0, texbottom, - 0, 0, + imgright, imgbottom, + widthV, heightV, + widthV, imgbottom }; + float tex3[] = { 0, 1, + 0, texbottom, + texleft, 1, texleft, texbottom, - texleft, 0, + texright, 1, texright, texbottom, - texright, 0, - 1, texbottom, - 1, 0 }; - - glBindTexture(GL_TEXTURE_2D, d->_rectTexture.texture()); + 1, 1, + 1, texbottom }; shader->setAttributeArray(SingleTextureShader::Vertices, vert1, 2); shader->setAttributeArray(SingleTextureShader::TextureCoords, tex1, 2); glDrawArrays(GL_TRIANGLE_STRIP, 0, 8); - shader->setAttributeArray(SingleTextureShader::Vertices, vert2, 2); - shader->setAttributeArray(SingleTextureShader::TextureCoords, tex2, 2); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 8); + if (yMiddles) { + shader->setAttributeArray(SingleTextureShader::Vertices, vert2, 2); + shader->setAttributeArray(SingleTextureShader::TextureCoords, tex2, 2); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 8); + } shader->setAttributeArray(SingleTextureShader::Vertices, vert3, 2); shader->setAttributeArray(SingleTextureShader::TextureCoords, tex3, 2); glDrawArrays(GL_TRIANGLE_STRIP, 0, 8); @@ -806,9 +837,9 @@ void QFxRect::paintGLContents(GLPainter &p) glColor4f(1, 1, 1, p.activeOpacity); } - float imgWidth = d->_rectTexture.width(); - float imgHeight = d->_rectTexture.height(); - if (!imgWidth || !imgHeight) + float texWidth = d->_rectTexture.width(); + float texHeight = d->_rectTexture.height(); + if (!texWidth || !texHeight) return; float widthV = width(); @@ -823,13 +854,13 @@ void QFxRect::paintGLContents(GLPainter &p) float imgtop = 0; float imgbottom = heightV; - texleft = float(offset) / imgWidth; + texleft = float(offset) / texWidth; imgleft = offset; - texright = 1. - float(offset) / imgWidth; + texright = 1. - float(offset) / texWidth; imgright = widthV - offset; - textop = 1. - float(offset) / imgHeight; + textop = 1. - float(offset) / texHeight; imgtop = offset; - texbottom = float(offset) / imgHeight; + texbottom = float(offset) / texHeight; imgbottom = heightV - offset; float vert1[] = { 0, 0, diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h index 339a7d8..84a9c57 100644 --- a/src/declarative/fx/qfxrect.h +++ b/src/declarative/fx/qfxrect.h @@ -58,7 +58,7 @@ class Q_DECLARATIVE_EXPORT QFxPen : public QObject Q_PROPERTY(QColor color READ color WRITE setColor) public: QFxPen(QObject *parent=0) - : QObject(parent), _width(1), _color("#000000"), _valid(false) + : QObject(parent), _width(0), _color("#000000"), _valid(false) {} int width() const { return _width; } -- cgit v0.12 From 2057092a86b049075e50eb3bc934982cec991f9b Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 19 May 2009 16:09:58 +1000 Subject: Fixes particle clipping bug Particles painting moved to an item with an accurate bounding box. --- src/declarative/fx/qfxparticles.cpp | 96 +++++++++++++++++++++++++++++++++---- 1 file changed, 88 insertions(+), 8 deletions(-) diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp index 1aaf256..930d7a3 100644 --- a/src/declarative/fx/qfxparticles.cpp +++ b/src/declarative/fx/qfxparticles.cpp @@ -340,6 +340,32 @@ void QFxParticleMotionWander::destroy(QFxParticle &p) } //--------------------------------------------------------------------------- +class QFxParticlesPainter : public QFxItem +{ +public: + QFxParticlesPainter(QFxParticlesPrivate *p, QFxItem* parent) + : QFxItem(parent), d(p) + { + setOptions(HasContents); + maxX = minX = maxY = minY = 0; + } + +#if defined(QFX_RENDER_QPAINTER) + void paintContents(QPainter &p); +#elif defined(QFX_RENDER_OPENGL2) + void paintGLContents(GLPainter &); +#endif + + void updateSize(); + + qreal maxX; + qreal minX; + qreal maxY; + qreal minY; + QFxParticlesPrivate* d; +}; + +//--------------------------------------------------------------------------- class QFxParticlesPrivate : public QFxItemPrivate { Q_DECLARE_PUBLIC(QFxParticles) @@ -359,7 +385,12 @@ public: { } - void init() {} + void init() + { + Q_Q(QFxParticles); + paintItem = new QFxParticlesPainter(this, q); + } + void tick(int time); void createParticle(int time); void updateOpacity(QFxParticle &p, int age); @@ -383,6 +414,7 @@ public: int streamDelay; bool emitting; QFxParticleMotion *motion; + QFxParticlesPainter *paintItem; QList particles; QTickAnimationProxy clock; @@ -1040,28 +1072,76 @@ QString QFxParticles::propertyInfo() const return d->url.toString(); } +void QFxParticlesPainter::updateSize(){ + setX(-500); + setY(-500); + setWidth(1000); + setHeight(1000); + return ; + const int parentX = parent()->x(); + const int parentY = parent()->y(); + //Have to use statistical approach to needed size as arbitrary particle + //motions make it impossible to calculate. + //max/min vars stored to give a never shrinking rect + for (int i = 0; i < d->particles.count(); ++i) { + const QFxParticle &particle = d->particles.at(i); + if(particle.x > maxX) + maxX = particle.x; + if(particle.x < minX) + minX = particle.x; + if(particle.y > maxY) + maxY = particle.y; + if(particle.y < minY) + minY = particle.y; + } + + int myWidth = (int)(maxX-minX+0.5)+d->image.width(); + int myX = (int)(minX - parentX); + int myHeight = (int)(maxY-minY+0.5)+d->image.height(); + int myY = (int)(minY - parentY); + setWidth(myWidth); + setHeight(myHeight); + setX(myX); + setY(myY); +} + #if defined(QFX_RENDER_QPAINTER) void QFxParticles::paintContents(QPainter &p) { - Q_D(QFxParticles); + Q_UNUSED(p); + //painting is done by the ParticlesPainter, so it can have the right size +} + +void QFxParticlesPainter::paintContents(QPainter &p) +{ if (d->image.isNull()) return; - const int myX = x(); - const int myY = y(); + updateSize(); + const int myX = x() + parent()->x(); + const int myY = y() + parent()->y(); + for (int i = 0; i < d->particles.count(); ++i) { const QFxParticle &particle = d->particles.at(i); p.setOpacity(particle.opacity); - p.drawImage(particle.x-myX, particle.y-myY, d->image); + p.drawImage(particle.x - myX, particle.y - myY, d->image); } + update();//Should I need this? (GV does) } #elif defined(QFX_RENDER_OPENGL2) void QFxParticles::paintGLContents(GLPainter &p) { - Q_D(QFxParticles); + //painting is done by the ParticlesPainter, so it can have the right size +} + +void QFxParticlesPainter::paintGLContents(GLPainter &p) +{ + if (d->image.isNull()) return; + updateSize(); + if (d->texDirty && !d->image.isNull()) { d->tex.setImage(d->image); d->tex.setHorizontalWrap(GLTexture::Repeat); @@ -1075,8 +1155,8 @@ void QFxParticles::paintGLContents(GLPainter &p) glBindTexture(GL_TEXTURE_2D, d->tex.texture()); - const int myX = (int)x(); - const int myY = (int)y(); + const int myX = (int)(x() + parent->x()); + const int myY = (int)(y() + parent->y()); float widthV = d->image.width(); float heightV = d->image.height(); for (int i = 0; i < d->particles.count(); ++i) { -- cgit v0.12 From d6127efabb74e2004608f53d0be3b7c4a6df768d Mon Sep 17 00:00:00 2001 From: jasplin Date: Tue, 19 May 2009 08:11:19 +0200 Subject: Fixed typo. Reviewed-by: TrustMe --- src/network/access/qhttp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp index 96ccc91..2002641 100644 --- a/src/network/access/qhttp.cpp +++ b/src/network/access/qhttp.cpp @@ -1446,7 +1446,7 @@ QString QHttpRequestHeader::toString() const that indicates if the request finished with an error. To make an HTTP request you must set up suitable HTTP headers. The - following example demonstrates, how to request the main HTML page + following example demonstrates how to request the main HTML page from the Trolltech home page (i.e., the URL \c http://qtsoftware.com/index.html): -- cgit v0.12 From 6fee456cff928c504a48df74bb3986fb453fc97a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 19 May 2009 16:33:34 +1000 Subject: Use pngs instead of svgs for dial example. --- examples/declarative/dial/DialLibrary/Dial.qml | 8 +- .../declarative/dial/DialLibrary/background.png | Bin 0 -> 35876 bytes .../declarative/dial/DialLibrary/background.svg | 385 --------------------- examples/declarative/dial/DialLibrary/needle.png | Bin 0 -> 1078 bytes examples/declarative/dial/DialLibrary/needle.svg | 26 -- .../declarative/dial/DialLibrary/needle_shadow.png | Bin 0 -> 1401 bytes .../declarative/dial/DialLibrary/needle_shadow.svg | 30 -- examples/declarative/dial/DialLibrary/overlay.png | Bin 0 -> 4389 bytes examples/declarative/dial/DialLibrary/overlay.svg | 47 --- 9 files changed, 4 insertions(+), 492 deletions(-) create mode 100644 examples/declarative/dial/DialLibrary/background.png delete mode 100644 examples/declarative/dial/DialLibrary/background.svg create mode 100644 examples/declarative/dial/DialLibrary/needle.png delete mode 100644 examples/declarative/dial/DialLibrary/needle.svg create mode 100644 examples/declarative/dial/DialLibrary/needle_shadow.png delete mode 100644 examples/declarative/dial/DialLibrary/needle_shadow.svg create mode 100644 examples/declarative/dial/DialLibrary/overlay.png delete mode 100644 examples/declarative/dial/DialLibrary/overlay.svg diff --git a/examples/declarative/dial/DialLibrary/Dial.qml b/examples/declarative/dial/DialLibrary/Dial.qml index e3fd382..32c58cd 100644 --- a/examples/declarative/dial/DialLibrary/Dial.qml +++ b/examples/declarative/dial/DialLibrary/Dial.qml @@ -3,10 +3,10 @@ Item { width: 210; height: 210 - Image { id: Background; source: "background.svg" } + Image { id: Background; source: "background.png" } Image { - source: "needle_shadow.svg" + source: "needle_shadow.png" transform: Rotation { originX: 104; originY: 102 angle: NeedleRotation.angle @@ -14,7 +14,7 @@ Item { } Image { id: Needle - source: "needle.svg" + source: "needle.png" transform: Rotation { id: NeedleRotation originX: 102; originY: 98 @@ -26,5 +26,5 @@ Item { } } } - Image { source: "overlay.svg" } + Image { source: "overlay.png" } } diff --git a/examples/declarative/dial/DialLibrary/background.png b/examples/declarative/dial/DialLibrary/background.png new file mode 100644 index 0000000..75d555d Binary files /dev/null and b/examples/declarative/dial/DialLibrary/background.png differ diff --git a/examples/declarative/dial/DialLibrary/background.svg b/examples/declarative/dial/DialLibrary/background.svg deleted file mode 100644 index 415320d..0000000 --- a/examples/declarative/dial/DialLibrary/background.svg +++ /dev/null @@ -1,385 +0,0 @@ - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0 - -1 -0 - -2 -0 - -3 -0 - -4 -0 - -5 -0 - -6 -0 - -7 -0 - -8 -0 - -9 -0 - -1 -0 -0 - -1 -1 -0 - -1 -2 -0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/declarative/dial/DialLibrary/needle.png b/examples/declarative/dial/DialLibrary/needle.png new file mode 100644 index 0000000..c171b43 Binary files /dev/null and b/examples/declarative/dial/DialLibrary/needle.png differ diff --git a/examples/declarative/dial/DialLibrary/needle.svg b/examples/declarative/dial/DialLibrary/needle.svg deleted file mode 100644 index dce7d7e..0000000 --- a/examples/declarative/dial/DialLibrary/needle.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - -]> - - - - - - - - - - - - - - - - - diff --git a/examples/declarative/dial/DialLibrary/needle_shadow.png b/examples/declarative/dial/DialLibrary/needle_shadow.png new file mode 100644 index 0000000..4e1ac0c Binary files /dev/null and b/examples/declarative/dial/DialLibrary/needle_shadow.png differ diff --git a/examples/declarative/dial/DialLibrary/needle_shadow.svg b/examples/declarative/dial/DialLibrary/needle_shadow.svg deleted file mode 100644 index 6aab197..0000000 --- a/examples/declarative/dial/DialLibrary/needle_shadow.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - -]> - - - - - - diff --git a/examples/declarative/dial/DialLibrary/overlay.png b/examples/declarative/dial/DialLibrary/overlay.png new file mode 100644 index 0000000..3341a16 Binary files /dev/null and b/examples/declarative/dial/DialLibrary/overlay.png differ diff --git a/examples/declarative/dial/DialLibrary/overlay.svg b/examples/declarative/dial/DialLibrary/overlay.svg deleted file mode 100644 index 8530dd5..0000000 --- a/examples/declarative/dial/DialLibrary/overlay.svg +++ /dev/null @@ -1,47 +0,0 @@ - - - -]> - - - - - - - - - - - - - - - - - -- cgit v0.12 From 8c2f6d4b70bc6e3579c99b49a1dd842678bd7ebe Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 19 May 2009 16:44:16 +1000 Subject: Make sure Flippable updates its back transform correctly. Previously we didn't update the back transform on geometry changes to the back element. Now we make sure it is up-to-date whenever we show it. Also updated anchors (they no longer need to work around this). --- src/declarative/fx/qfxanchors.cpp | 1 - src/declarative/fx/qfxflipable.cpp | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index 3eaf47a..235511f 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -234,7 +234,6 @@ void QFxAnchorsPrivate::remDepend(QFxItem *item) bool QFxAnchorsPrivate::isItemComplete() const { - return true; return item->isComponentComplete(); } diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp index 24ae428..edcc7cb 100644 --- a/src/declarative/fx/qfxflipable.cpp +++ b/src/declarative/fx/qfxflipable.cpp @@ -169,7 +169,6 @@ void QFxFlipable::setBack(QFxItem *back) children()->append(d->back); if (Front == d->current) d->back->setOpacity(0.); - d->setBackTransform(); } /*! @@ -203,8 +202,6 @@ void QFxFlipablePrivate::_q_updateAxis() axisRotation.axis()->setEndX(axis->endX()); axisRotation.axis()->setEndY(axis->endY()); axisRotation.axis()->setEndZ(axis->endZ()); - - setBackTransform(); } void QFxFlipablePrivate::setBackTransform() @@ -273,8 +270,10 @@ void QFxFlipable::setRotation(qreal angle) d->current = newSide; if (d->front) d->front->setOpacity((d->current==Front)?1.:0.); - if (d->back) + if (d->back) { + d->setBackTransform(); d->back->setOpacity((d->current==Back)?1.:0.); + } emit sideChanged(); } } -- cgit v0.12 From e6fa564cb2f562eaca675872c08af14614a76283 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 19 May 2009 17:02:29 +1000 Subject: Reduce the size of the images to the minimum possible --- examples/declarative/dial/DialLibrary/Dial.qml | 10 +++++++--- examples/declarative/dial/DialLibrary/needle.png | Bin 1078 -> 342 bytes .../declarative/dial/DialLibrary/needle_shadow.png | Bin 1401 -> 632 bytes examples/declarative/dial/DialLibrary/overlay.png | Bin 4389 -> 3564 bytes 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/declarative/dial/DialLibrary/Dial.qml b/examples/declarative/dial/DialLibrary/Dial.qml index 32c58cd..6cd42df 100644 --- a/examples/declarative/dial/DialLibrary/Dial.qml +++ b/examples/declarative/dial/DialLibrary/Dial.qml @@ -6,18 +6,22 @@ Item { Image { id: Background; source: "background.png" } Image { + x: 93 + y: 35 source: "needle_shadow.png" transform: Rotation { - originX: 104; originY: 102 + originX: 11; originY: 67 angle: NeedleRotation.angle } } Image { id: Needle + x: 95 + y: 33 source: "needle.png" transform: Rotation { id: NeedleRotation - originX: 102; originY: 98 + originX: 7; originY: 65 angle: -130 angle: Follow { spring: 1.4 @@ -26,5 +30,5 @@ Item { } } } - Image { source: "overlay.png" } + Image { x: 21; y: 18; source: "overlay.png" } } diff --git a/examples/declarative/dial/DialLibrary/needle.png b/examples/declarative/dial/DialLibrary/needle.png index c171b43..2d19f75 100644 Binary files a/examples/declarative/dial/DialLibrary/needle.png and b/examples/declarative/dial/DialLibrary/needle.png differ diff --git a/examples/declarative/dial/DialLibrary/needle_shadow.png b/examples/declarative/dial/DialLibrary/needle_shadow.png index 4e1ac0c..8d8a928 100644 Binary files a/examples/declarative/dial/DialLibrary/needle_shadow.png and b/examples/declarative/dial/DialLibrary/needle_shadow.png differ diff --git a/examples/declarative/dial/DialLibrary/overlay.png b/examples/declarative/dial/DialLibrary/overlay.png index 3341a16..3860a7b 100644 Binary files a/examples/declarative/dial/DialLibrary/overlay.png and b/examples/declarative/dial/DialLibrary/overlay.png differ -- cgit v0.12 From 3eb9a9404544a7b954d18f19d373883d0623da93 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 19 May 2009 17:31:46 +1000 Subject: More precise positioning to leave 1-pixel inner margin --- demos/declarative/flickr/content/Progress.qml | 2 +- demos/declarative/flickr/content/Slider.qml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/demos/declarative/flickr/content/Progress.qml b/demos/declarative/flickr/content/Progress.qml index 92a232e..aa2a2e6 100644 --- a/demos/declarative/flickr/content/Progress.qml +++ b/demos/declarative/flickr/content/Progress.qml @@ -5,7 +5,7 @@ Item { Rect { id: Container; anchors.fill: parent; gradientColor: "#66000000"; - pen.color: "white"; pen.width: 1; color: "#66343434"; radius: height/2 - 2 + pen.color: "white"; pen.width: 0; color: "#66343434"; radius: height/2 - 2 } Rect { diff --git a/demos/declarative/flickr/content/Slider.qml b/demos/declarative/flickr/content/Slider.qml index 92f4993..aae4631 100644 --- a/demos/declarative/flickr/content/Slider.qml +++ b/demos/declarative/flickr/content/Slider.qml @@ -3,25 +3,25 @@ Item { // value is read/write. property real value - onValueChanged: { Handle.x = (value - minimum) * Slider.xMax / (maximum - minimum); } + onValueChanged: { Handle.x = 2 + (value - minimum) * Slider.xMax / (maximum - minimum); } property real maximum: 1 property real minimum: 1 - property int xMax: Slider.width - Handle.width - 2 + property int xMax: Slider.width - Handle.width - 4 Rect { id: Container; anchors.fill: parent; gradientColor: "#66000000"; - pen.color: "white"; pen.width: 1; color: "#66343434"; radius: 8 + pen.color: "white"; pen.width: 0; color: "#66343434"; radius: 8 } Rect { id: Handle - x: Slider.width / 2 - Handle.width / 2; y: 2; width: 30; height: 12 + x: Slider.width / 2 - Handle.width / 2; y: 2; width: 30; height: Slider.height-4 color: "lightgray"; gradientColor: "gray"; radius: 6 MouseRegion { anchors.fill: parent; drag.target: parent - drag.axis: "x"; drag.xmin: 2; drag.xmax: Slider.xMax - onPositionChanged: { value = (maximum - minimum) * Handle.x / Slider.xMax + minimum; } + drag.axis: "x"; drag.xmin: 2; drag.xmax: Slider.xMax+2 + onPositionChanged: { value = (maximum - minimum) * (Handle.x-2) / Slider.xMax + minimum; } } } } -- cgit v0.12 From 2d8a925309d2b5bfbff19df8bf607ccf3a343930 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 19 May 2009 09:39:44 +0200 Subject: Added QmlEngine::componentSearchPath() componentSearchPath() returns the list of urls (folders) inspected by qml to locate sub components. This is used in Bauhaus. Autotests have been stored in new "declarative/qmlengine" directory. --- src/declarative/qml/qmlengine.cpp | 29 +++++++++++++++ src/declarative/qml/qmlengine.h | 2 + tests/auto/declarative/declarative.pro | 3 +- tests/auto/declarative/qmlengine/qmlengine.pro | 5 +++ tests/auto/declarative/qmlengine/tst_qmlengine.cpp | 43 ++++++++++++++++++++++ 5 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qmlengine/qmlengine.pro create mode 100644 tests/auto/declarative/qmlengine/tst_qmlengine.cpp diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 0209c1d..425cba4 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -615,6 +615,35 @@ QUrl QmlEngine::componentUrl(const QUrl& src, const QUrl& baseUrl) const } /*! + Returns the list of base urls the engine browses to find sub-components. + + The search path consists of the base of the \a url, and, in the case of local files, + the directories imported using the "import" statement in \a qml. + */ +QList QmlEngine::componentSearchPath(const QByteArray &qml, const QUrl &url) const +{ + QList searchPath; + + searchPath << url.resolved(QUrl(QLatin1String("."))); + + if (QFileInfo(url.toLocalFile()).exists()) { + QmlScriptParser parser; + if (parser.parse(qml, url)) { + for (int i = 0; i < parser.imports().size(); ++i) { + QUrl importUrl = QUrl(parser.imports().at(i).uri); + if (importUrl.isRelative()) { + searchPath << url.resolved(importUrl); + } else { + searchPath << importUrl; + } + } + } + } + + return searchPath; +} + +/*! Sets the common QNetworkAccessManager, \a network, used by all QML elements instantiated by this engine. diff --git a/src/declarative/qml/qmlengine.h b/src/declarative/qml/qmlengine.h index fde84d4..9382389 100644 --- a/src/declarative/qml/qmlengine.h +++ b/src/declarative/qml/qmlengine.h @@ -78,6 +78,8 @@ public: QMap nameSpacePaths() const; QUrl componentUrl(const QUrl& src, const QUrl& baseUrl) const; + QList componentSearchPath(const QByteArray &qml, const QUrl &url) const; + void setNetworkAccessManager(QNetworkAccessManager *); QNetworkAccessManager *networkAccessManager() const; diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index b6e3584..14d8c24 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -14,7 +14,8 @@ SUBDIRS += datetimeformatter \ qmlmetaproperty \ qmllist \ qmllistaccessor \ - visual + visual\ + qmlengine # Tests which should run in Pulse PULSE_TESTS = $$SUBDIRS diff --git a/tests/auto/declarative/qmlengine/qmlengine.pro b/tests/auto/declarative/qmlengine/qmlengine.pro new file mode 100644 index 0000000..4ac81e9 --- /dev/null +++ b/tests/auto/declarative/qmlengine/qmlengine.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qmlengine.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlengine/tst_qmlengine.cpp b/tests/auto/declarative/qmlengine/tst_qmlengine.cpp new file mode 100644 index 0000000..9a04c61 --- /dev/null +++ b/tests/auto/declarative/qmlengine/tst_qmlengine.cpp @@ -0,0 +1,43 @@ +#include +#include + +#include +#include +#include + +class tst_qmlengine : public QObject +{ + Q_OBJECT +public: + tst_qmlengine() {} + +private slots: + void componentSearchPath(); +}; + + +void tst_qmlengine::componentSearchPath() +{ + QFile file(SRCDIR "/imports.qml"); + QVERIFY(file.open(QIODevice::ReadOnly)); + + QmlEngine engine; + + QList searchPath = engine.componentSearchPath(file.readAll(), + QUrl::fromLocalFile(file.fileName())); + + QList expected; + expected << QUrl::fromLocalFile(SRCDIR); + expected << QUrl::fromLocalFile(file.fileName()).resolved(QUrl("import1")); + expected << QUrl::fromLocalFile(file.fileName()).resolved(QUrl("import2")); + + QCOMPARE(searchPath.size(), expected.size()); + for (int i = 0; i < expected.size(); ++i) { + QCOMPARE(searchPath.at(i).toString(QUrl::StripTrailingSlash), + expected.at(i).toString(QUrl::StripTrailingSlash)); + } +} + +QTEST_MAIN(tst_qmlengine) + +#include "tst_qmlengine.moc" -- cgit v0.12 From 6a94214e691966874faaab0bacd5d787850e0546 Mon Sep 17 00:00:00 2001 From: KOBAYASHI Tomoyuki Date: Tue, 19 May 2009 16:48:10 +0900 Subject: Update japanese translation file "translations/qt_ja_JP.ts". QtXmlPatterns is not completed. --- translations/qt_ja_JP.ts | 5920 +++++++++++++++++++++++----------------------- 1 file changed, 2993 insertions(+), 2927 deletions(-) diff --git a/translations/qt_ja_JP.ts b/translations/qt_ja_JP.ts index 7c8b874..55b21d0 100644 --- a/translations/qt_ja_JP.ts +++ b/translations/qt_ja_JP.ts @@ -2,29 +2,12 @@ - AudioOutput - - - <html>The audio playback device <b>%1</b> does not work.<br/>Falling back to <b>%2</b>.</html> - - - - - <html>Switching to the audio playback device <b>%1</b><br/>which just became available and has higher preference.</html> - - - - - Revert back to device '%1' - - - - CloseButton - + Close Tab - + ToolTip + タブを閉ã˜ã‚‹ @@ -43,32 +26,50 @@ Notifications - + 通知 Music - + 音楽 Video - + å‹•ç”» Communication - + コミュニケーション Games - + ゲーム Accessibility - + アクセシビリティ + + + + Phonon::AudioOutput + + + <html>The audio playback device <b>%1</b> does not work.<br/>Falling back to <b>%2</b>.</html> + <html>オーディオå†ç”Ÿãƒ‡ãƒã‚¤ã‚¹<b>%1</b>ãŒå‹•作ã—ã¾ã›ã‚“。<br/><b>%2</b>を使用ã—ã¾ã™ã€‚</html> + + + + <html>Switching to the audio playback device <b>%1</b><br/>which just became available and has higher preference.</html> + <html>より高ã„パフォーマンスを得られるオーディオデãƒã‚¤ã‚¹ <b>%1</b> ãŒä½¿ç”¨å¯èƒ½ã¨ãªã£ãŸã®ã§ã€ä½¿ç”¨ã—ã¾ã™ã€‚</html> + + + + Revert back to device '%1' + デãƒã‚¤ã‚¹ '%1' ã«æˆ»ã™ @@ -77,13 +78,13 @@ Warning: You do not seem to have the package gstreamer0.10-plugins-good installed. Some video features have been disabled. - + 警告: gstreamer0.10-plugins-good ãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¦ã„ã¾ã›ã‚“。幾ã¤ã‹ã®å‹•画機能ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。 Warning: You do not seem to have the base GStreamer plugins installed. All audio and video support has been disabled - + 警告: GStreamer plugin ãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¦ã„ã¾ã›ã‚“。ã™ã¹ã¦ã®éŸ³å£°ã€å‹•画機能ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“ @@ -94,12 +95,14 @@ Check your Gstreamer installation and make sure you have libgstreamer-plugins-base installed. - + å†ç”Ÿã§ãã¾ã›ã‚“。 + +Gstreamer 㨠libgstreamer-plugins-base ãŒæ­£ã—ãインストールã•れã¦ã„ã‚‹ã‹ç¢ºèªã—ã¦ãã ã•ã„。 A required codec is missing. You need to install the following codec(s) to play this content: %0 - + å¿…è¦ãªã‚³ãƒ¼ãƒ‡ãƒƒã‚¯ãŒã¿ã¤ã‹ã‚Šã¾ã›ã‚“。ã“ã®ã‚³ãƒ³ãƒ†ãƒ³ãƒ„ã‚’å†ç”Ÿã™ã‚‹ãŸã‚ã«ã¯ã€ä»¥ä¸‹ã®ã‚³ãƒ¼ãƒ‡ãƒƒã‚¯ã‚’インストールã™ã‚‹å¿…è¦ãŒã‚りã¾ã™: %0 @@ -111,27 +114,27 @@ have libgstreamer-plugins-base installed. Could not open media source. - + メディアソースを開ãã“ã¨ãŒã§ãã¾ã›ã‚“。 Invalid source type. - + 無効ãªã‚½ãƒ¼ã‚¹ã®å½¢å¼ã§ã™ã€‚ Could not locate media source. - + メディアソースãŒã¿ã¤ã‹ã‚Šã¾ã›ã‚“。 Could not open audio device. The device is already in use. - + オーディオデãƒã‚¤ã‚¹ã‚’é–‹ãã“ã¨ãŒã§ãã¾ã›ã‚“。デãƒã‚¤ã‚¹ã¯æ—¢ã«ä»–ã®ãƒ—ロセスã«ã‚ˆã‚Šä½¿ç”¨ã•れã¦ã„ã¾ã™ã€‚ Could not decode media source. - + メディアソースを開ãã“ã¨ãŒã§ãã¾ã›ã‚“。見ã¤ã‹ã‚‰ãªã„ã‹ã€æœªçŸ¥ã®å½¢å¼ã§ã™ã€‚ @@ -139,15 +142,22 @@ have libgstreamer-plugins-base installed. + + Volume: %1% - + 音é‡: %1% - + Use this slider to adjust the volume. The leftmost position is 0%, the rightmost is %1% - + スライダを用ã„ã¦éŸ³é‡ã‚’指定ã—ã¦ãã ã•ã„。左端ãŒ0%ã€å³ç«¯ãŒ%1%ã«ãªã‚Šã¾ã™ + + + + Muted + ミュート @@ -168,12 +178,12 @@ have libgstreamer-plugins-base installed. True - True + 真 False - False + å½ @@ -209,7 +219,7 @@ have libgstreamer-plugins-base installed. ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’é¸æŠž - + Copy or Move a File ファイルをコピーã¾ãŸã¯ç§»å‹• @@ -226,7 +236,7 @@ have libgstreamer-plugins-base installed. - + Cancel キャンセル @@ -344,17 +354,17 @@ have libgstreamer-plugins-base installed. Symlink to File - ファイルã¸ã®Symlink + ファイルã¸ã®ã‚·ãƒ³ãƒœãƒªãƒƒã‚¯ãƒªãƒ³ã‚¯ Symlink to Directory - ディレクトリã¸ã®Symlink + ディレクトリã¸ã®ã‚·ãƒ³ãƒœãƒªãƒƒã‚¯ãƒªãƒ³ã‚¯ Symlink to Special - スペシャルã¸ã®Symlink + スペシャルファイルã¸ã®ã‚·ãƒ³ãƒœãƒªãƒƒã‚¯ãƒªãƒ³ã‚¯ @@ -455,7 +465,7 @@ have libgstreamer-plugins-base installed. the symlink - Symlink + シンボリックリンク @@ -465,7 +475,7 @@ have libgstreamer-plugins-base installed. <qt>Are you sure you wish to delete %1 "%2"?</qt> - <qt>%1「%2ã€ã‚’削除ã—ã¾ã™ã‹?</qt> + <qt>%1 "%2" を削除ã—ã¾ã™ã‹?</qt> @@ -556,8 +566,9 @@ to %2 åå‰ã‚’変更ã§ãã¾ã›ã‚“ã§ã—㟠%1 -㸠-%2 +ã‚’ +%2 +㸠@@ -607,13 +618,13 @@ to Q3TabDialog - - + + OK OK - + Apply é©ç”¨ @@ -737,7 +748,7 @@ to Displays the name of the window and contains controls to manipulate it - ウィンドウã®åå‰ã‚’表示ã—ã€ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’æ“作ã™ã‚‹ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«ã‚’å«ã¿ã¾ã™ + ウィンドウã®åå‰ã¨ã€ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’æ“作ã™ã‚‹ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«ã‚’表示ã—ã¾ã™ @@ -755,43 +766,43 @@ to The protocol `%1' is not supported - プロトコル「%1ã€ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ + プロトコル '%1' ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ The protocol `%1' does not support listing directories - プロトコル「%1ã€ã§ã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®ãƒªã‚¹ãƒˆã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ + プロトコル '%1' ã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®ãƒªã‚¹ãƒ†ã‚£ãƒ³ã‚°ã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ The protocol `%1' does not support creating new directories - プロトコル「%1ã€ã§ã¯æ–°ã—ã„ディレクトリã®ä½œæˆã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ + プロトコル '%1' ã¯æ–°ã—ã„ディレクトリã®ä½œæˆã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ The protocol `%1' does not support removing files or directories - プロトコル「%1ã€ã§ã¯ãƒ•ァイルã¾ãŸã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®å‰Šé™¤ã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ + プロトコル '%1' ã¯ãƒ•ァイルã¾ãŸã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®å‰Šé™¤ã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ The protocol `%1' does not support renaming files or directories - プロトコル「%1ã€ã§ã¯ãƒ•ァイルã¾ãŸã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®åå‰ã®å¤‰æ›´ã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ + プロトコル '%1' ã¯ãƒ•ァイルã¾ãŸã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®åå‰ã®å¤‰æ›´ã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ The protocol `%1' does not support getting files - プロトコル「%1ã€ã§ã¯ãƒ•ァイルã®å–得をサãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ + プロトコル '%1' ã¯ãƒ•ァイルã®å–得をサãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ The protocol `%1' does not support putting files - プロトコル「%1ã€ã§ã¯ãƒ•ァイルã®é€ä¿¡ã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ + プロトコル '%1' ã¯ãƒ•ァイルã®é€ä¿¡ã‚’サãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ The protocol `%1' does not support copying or moving files or directories - プロトコル「%1ã€ã§ã¯ãƒ•ァイルã¾ãŸã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®ã‚³ãƒ”ーã¾ãŸã¯ç§»å‹•をサãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ + プロトコル '%1' ã¯ãƒ•ァイルã¾ãŸã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®ã‚³ãƒ”ーã¾ãŸã¯ç§»å‹•をサãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ @@ -848,14 +859,15 @@ to Connection timed out - 接続ãŒã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã—ã¾ã—㟠+ 接続ãŒã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã—ã¾ã—㟠Operation on socket is not supported - + 抽象ソケットクラスã§ã®ã‚½ã‚±ãƒƒãƒˆã®ã‚¨ãƒ©ãƒ¼ + ã“ã®ã‚½ã‚±ãƒƒãƒˆã¸ã®ã“ã®æ“作ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ @@ -870,13 +882,13 @@ to Network unreachable - ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯ã¸åˆ°é”ã§ãã¾ã›ã‚“ + ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯ã¸åˆ°é”ã§ãã¾ã›ã‚“ QAbstractSpinBox - + &Step up 上(&S) @@ -888,7 +900,7 @@ to &Select All - + ã™ã¹ã¦ã‚’é¸æŠž(&S) @@ -914,7 +926,7 @@ to äº’æ›æ€§ã®ãªã„Qtライブラリエラー - + 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. LTR @@ -940,7 +952,7 @@ to COM &Object: - COM オブジェクト(&O) + COM オブジェクト(&O): @@ -1001,7 +1013,7 @@ to Select Color - + 色 @@ -1046,17 +1058,17 @@ to False - False + å½ True - True + 真 Close - é–‰ã˜ã‚‹ + é–‰ã˜ã‚‹ @@ -1065,19 +1077,19 @@ to %1: key is empty QSystemSemaphore - + %1: キーãŒç©ºã§ã™ %1: unable to make key QSystemSemaphore - + %1: キーを作æˆã§ãã¾ã›ã‚“ %1: ftok failed QSystemSemaphore - + %1: fork ã«å¤±æ•—ã—ã¾ã—㟠@@ -1165,17 +1177,17 @@ to QDial - + ダイヤル SpeedoMeter - + スピードメータ SliderHandle - + スライダãƒãƒ³ãƒ‰ãƒ« @@ -1183,12 +1195,12 @@ to What's This? - ヒント + ヒント? Done - + 終了 @@ -1203,7 +1215,7 @@ to Cancel - キャンセル + キャンセル @@ -1233,12 +1245,12 @@ to Save - ä¿å­˜ + ä¿å­˜ &Save - ä¿å­˜(&S) + ä¿å­˜(&S) @@ -1248,17 +1260,17 @@ to &Cancel - キャンセル(&C) + キャンセル(&C) Close - é–‰ã˜ã‚‹ + é–‰ã˜ã‚‹ &Close - é–‰ã˜ã‚‹(&C) + é–‰ã˜ã‚‹(&C) @@ -1313,13 +1325,13 @@ to &OK - OK(&O) + OK(&O) QDirModel - + Name åå‰ @@ -1351,17 +1363,17 @@ to Close - é–‰ã˜ã‚‹ + é–‰ã˜ã‚‹ Dock - + ドック Float - + フロート @@ -1369,12 +1381,12 @@ to More - 増や㙠+ 増や㙠Less - 減ら㙠+ 減ら㙠@@ -1392,7 +1404,7 @@ to Fatal Error: - 致命的エラー: + 致命的ãªã‚¨ãƒ©ãƒ¼: @@ -1409,41 +1421,41 @@ to QFile - + Destination file exists - + æ–°ã—ã„åå‰ã®ãƒ•ã‚¡ã‚¤ãƒ«ã¯æ—¢ã«å­˜åœ¨ã—ã¾ã™ Cannot remove source file - + å…ƒã®ãƒ•ァイルを削除ã§ãã¾ã›ã‚“ - + Cannot open %1 for input - + コピー元ファイル %1 を読ã‚ã¾ã›ã‚“ Cannot open for output - + コピー先ã®ãƒ•ァイルをオープンã§ãã¾ã›ã‚“ Failure to write block - + 書ãè¾¼ã¿ã«å¤±æ•—ã—ã¾ã—㟠Cannot create %1 for output - + コピー先ã¨ã—㦠%1 を作æˆã§ãã¾ã›ã‚“ QFileDialog - - + + All Files (*) ã™ã¹ã¦ã®ãƒ•ァイル(*) @@ -1453,33 +1465,33 @@ to ディレクトリ - - + + Directory: ディレクトリ: - - + + File &name: - ファイルå: + ファイルå(&N): - + &Open オープン(&O) - + &Save ä¿å­˜(&S) - + Open オープン @@ -1499,7 +1511,7 @@ Please verify the correct file name was given %1 already exists. Do you want to replace it? - %1ã¯ã™ã§ã«å­˜åœ¨ã—ã¾ã™ã€‚ + %1 ã¯ã™ã§ã«å­˜åœ¨ã—ã¾ã™ã€‚ ç½®ãæ›ãˆã¾ã™ã‹? @@ -1518,7 +1530,7 @@ Please verify the correct file name was given. - + %1 Directory not found. Please verify the correct directory name was given. @@ -1531,7 +1543,7 @@ Please verify the correct directory name was given. ソート - + &Rename åå‰ã®å¤‰æ›´(&R) @@ -1619,14 +1631,38 @@ Please verify the correct directory name was given. ファイル - + + File Folder + Match Windows Explorer + ファイルフォルダ + + + + Folder + All other platforms + フォルダ + + + + Alias + Mac OS X Finder + エイリアス + + + + Shortcut + All other platforms + ショートカット + + + Unknown 䏿˜Ž All Files (*.*) - ã™ã¹ã¦ã®ãƒ•ァイル(*.*) + ã™ã¹ã¦ã®ãƒ•ァイル(*.*) @@ -1642,16 +1678,16 @@ Please verify the correct directory name was given. ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’é¸æŠž - + '%1' is write protected. Do you want to delete it anyway? '%1' ã¯æ›¸ãè¾¼ã¿ãŒç¦æ­¢ã•れã¦ã„ã¾ã™ã€‚ -本当ã«å‰Šé™¤ã—ã¾ã™ã‹ï¼Ÿ +本当ã«å‰Šé™¤ã—ã¾ã™ã‹? Are sure you want to delete '%1'? - '%1' を本当ã«å‰Šé™¤ã—ã¾ã™ã‹ï¼Ÿ + '%1' を本当ã«å‰Šé™¤ã—ã¾ã™ã‹? @@ -1659,46 +1695,46 @@ Do you want to delete it anyway? ディレクトリを削除ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ - + Find Directory - ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®æ¤œç´¢ + ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã®æ¤œç´¢ Show - + 表示 &New Folder - + æ–°ã—ã„フォルダ(&N) - + &Choose - + é¸æŠž(&C) - + New Folder - æ–°ã—ã„フォルダ + æ–°ã—ã„フォルダ Recent Places - + 履歴 Forward - 進む + 進む - + Remove - + 削除 @@ -1732,48 +1768,53 @@ Do you want to delete it anyway? + %1 TB - + %1 TB + %1 GB - + %1 GB + %1 MB - + %1 MB + %1 KB - + %1 KB + %1 bytes - + %1 ãƒã‚¤ãƒˆ Invalid filename - + 無効ãªãƒ•ァイルå <b>The name "%1" can not be used.</b><p>Try using another name, with fewer characters or no punctuations marks. - + <b>ファイルå "%1" ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。</b><p>åå‰ã‚’短ãã—ãŸã‚Šã€ã‚¢ã‚¯ã‚»ãƒ³ãƒˆè¨˜å·ãªã©ã‚’削除ã—ã¦å†åº¦è©¦ã—ã¦ãã ã•ã„。 - + My Computer - マイ コンピュータ + マイ コンピュータ Computer - + コンピュータ @@ -1782,215 +1823,216 @@ Do you want to delete it anyway? Normal - + ã“ã“ã¯ã©ã†è¨³ã™ã¹ãã‹... + æ˜Žæœ Bold - + ゴシック Demi Bold - + Demi Bold Black - + 太字 Demi - + Demi Light - + ç´°å­— Italic - + イタリック Oblique - + 斜体 Any - + ã™ã¹ã¦ Latin - + ラテン Greek - + ギリシャ Cyrillic - + キリル Armenian - + アルメニア Hebrew - + ヘブライ Arabic - + アラビア Syriac - + シリア Thaana - + ターナ Devanagari - + デーヴァナーガリー Bengali - + ベンガル Gurmukhi - + グルムキー Gujarati - + グジャラート Oriya - + オリヤー Tamil - + タミル Telugu - + テルグ Kannada - + カンナダ Malayalam - + マラヤーラム Sinhala - + シンãƒãƒ© Thai - + タイ Lao - + ラーオ Tibetan - + ãƒãƒ™ãƒƒãƒˆ Myanmar - + ビルマ Georgian - + グルジア Khmer - + クメール Simplified Chinese - + 簡体中国 Traditional Chinese - + ç¹ä½“中国 Japanese - + 日本 Korean - + ãƒãƒ³ã‚°ãƒ« Vietnamese - + ベトナム Symbol - + è¨˜å· Ogham - + オガム Runic - + ルーン @@ -2065,7 +2107,7 @@ Do you want to delete it anyway? Connection timed out to host %1 - + ホスト %1 ã¸ã®æŽ¥ç¶šãŒã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã—ã¾ã—㟠@@ -2231,7 +2273,7 @@ Do you want to delete it anyway? HTTPS connection requested but SSL support not compiled in - + HTTPSã«ã‚ˆã‚‹æŽ¥ç¶šãŒè¦æ±‚ã•れã¾ã—ãŸãŒã€SSLã®ã‚µãƒãƒ¼ãƒˆãŒã‚³ãƒ³ãƒ‘イル時ã«çµ„ã¿è¾¼ã¾ã‚Œã¦ã„ãªã„ãŸã‚ã€æŽ¥ç¶šã§ãã¾ã›ã‚“ @@ -2268,15 +2310,15 @@ Do you want to delete it anyway? Unknown authentication method - + éžå¯¾å¿œã®èªè¨¼æ–¹æ³•ãŒè¦æ±‚ã•れã¾ã—㟠Error writing response to device - + デãƒã‚¤ã‚¹ã¸ã®æ›¸ãè¾¼ã¿æ™‚ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠- + Connection refused æŽ¥ç¶šãŒæ‹’å¦ã•れã¾ã—㟠@@ -2344,42 +2386,42 @@ Do you want to delete it anyway? Proxy authentication required - + プロキシーã®èªè¨¼ãŒå¿…è¦ã§ã™ Authentication required - + èªè¨¼ãŒå¿…è¦ã§ã™ Connection refused (or timed out) - + æŽ¥ç¶šãŒæ‹’å¦ã•れãŸã‹ã€ã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã—ã¾ã—㟠Proxy requires authentication - + プロキシーã®èªè¨¼ãŒå¿…è¦ã§ã™ Host requires authentication - + ホストã®èªè¨¼ãŒå¿…è¦ã§ã™ Data corrupted - + データãŒç ´æã—ã¦ã„ã¾ã™ Unknown protocol specified - + 未対応ã®ãƒ—ロトコルã§ã™ SSL handshake failed - + SSLã®ãƒãƒ³ãƒ‰ã‚·ã‚§ãƒ¼ã‚¯ã«å¤±æ•—ã—ã¾ã—㟠@@ -2387,53 +2429,53 @@ Do you want to delete it anyway? Did not receive HTTP response from proxy - + プロキシーã‹ã‚‰HTTPレスãƒãƒ³ã‚¹ã‚’å—ä¿¡ã§ãã¾ã›ã‚“ã§ã—㟠Error parsing authentication request from proxy - + プロキシーã‹ã‚‰ã®èªè¨¼è¦æ±‚ã®ãƒ‘ースã«å¤±æ•—ã—ã¾ã—㟠Authentication required - + èªè¨¼ãŒå¿…è¦ã§ã™ Proxy denied connection - + ãƒ—ãƒ­ã‚­ã‚·ãƒ¼ãŒæŽ¥ç¶šã‚’æ‹’å¦ã—ã¾ã—㟠Error communicating with HTTP proxy - + HTTP プロキシーã¨ã®é€šä¿¡ã«ã¦ã€ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠Proxy server not found - + プロキシーサーãƒãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ Proxy connection refused - + ãƒ—ãƒ­ã‚­ã‚·ãƒ¼ãŒæŽ¥ç¶šã‚’æ‹’å¦ã—ã¾ã—㟠Proxy server connection timed out - + プロキシーã¨ã®æŽ¥ç¶šãŒã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã—ã¾ã—㟠Proxy connection closed prematurely - + ãƒ—ãƒ­ã‚­ã‚·ãƒ¼ã®æŽ¥ç¶šãŒé€šä¿¡ã®çµ‚了å‰ã«åˆ‡æ–­ã•れã¾ã—㟠QIBaseDriver - + Error opening database データベースã®ã‚ªãƒ¼ãƒ—ンã§ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠@@ -2566,7 +2608,7 @@ Do you want to delete it anyway? デãƒã‚¤ã‚¹ã®æ®‹ã‚Šå®¹é‡ãŒã‚りã¾ã›ã‚“ - + Unknown error 䏿˜Žãªã‚¨ãƒ©ãƒ¼ @@ -2599,7 +2641,7 @@ Do you want to delete it anyway? Enter a value: - + 数値を入力: @@ -2650,35 +2692,35 @@ Do you want to delete it anyway? The shared library was not found. - + 共有ライブラリãŒã¿ã¤ã‹ã‚Šã¾ã›ã‚“。 The file '%1' is not a valid Qt plugin. - + ファイル '%1' 㯠Qt プラグインã§ã¯ã‚りã¾ã›ã‚“。 The plugin '%1' uses incompatible Qt library. (Cannot mix debug and release libraries.) - + プラグイン '%1' ã¯ã“ã® Qt ã¨äº’æ›æ€§ã®ãªã„ライブラリを使用ã—ã¦ã„ã¾ã™ã€‚ (デãƒãƒƒã‚¯ç‰ˆã¨ãƒªãƒªãƒ¼ã‚¹ç‰ˆã®ãƒ©ã‚¤ãƒ–ãƒ©ãƒªã‚’åŒæ™‚ã«ä½¿ç”¨ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“) Cannot load library %1: %2 - + ライブラリ '%1' を読ã¿è¾¼ã‚€ã“ã¨ãŒã§ãã¾ã›ã‚“: %2 Cannot unload library %1: %2 - + ライブラリ %1 を解放ã™ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“: %2 Cannot resolve symbol "%1" in %2: %3 - + '%2'ã«å«ã¾ã‚Œã‚‹è­˜åˆ¥å­ "%1" を解決ã§ãã¾ã›ã‚“: %3 @@ -2723,25 +2765,24 @@ Do you want to delete it anyway? QLocalServer - + %1: Name error - + %1: åå‰ã®è§£æ±ºã«å¤±æ•— %1: Permission denied - + %1: 許å¯ã•れã¦ã„ã¾ã›ã‚“ %1: Address in use - + %1: ã‚¢ãƒ‰ãƒ¬ã‚¹ã¯æ—¢ã«ä½¿ç”¨ã•れã¦ã„ã¾ã™ - %1: Unknown error %2 - + %1: 未知ã®ã‚¨ãƒ©ãƒ¼ %2 @@ -2750,13 +2791,13 @@ Do you want to delete it anyway? %1: Connection refused - + %1: æŽ¥ç¶šãŒæ‹’å¦ã•れã¾ã—㟠%1: Remote closed - + %1: リモートã«ã‚ˆã‚ŠæŽ¥ç¶šãŒé–‰ã˜ã‚‰ã‚Œã¾ã—㟠@@ -2764,61 +2805,61 @@ Do you want to delete it anyway? %1: Invalid name - + %1: 無効ãªåå‰ã§ã™ %1: Socket access error - + %1: ソケットアクセスã®ã‚¨ãƒ©ãƒ¼ã§ã™ %1: Socket resource error - + %1: ソケットリソースã®ã‚¨ãƒ©ãƒ¼ã§ã™ %1: Socket operation timed out - + %1: ソケットæ“作ãŒã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã—ã¾ã—㟠%1: Datagram too large - + %1: データグラムãŒå¤§ãã™ãŽã¾ã™ %1: Connection error - + %1: 接続ã®ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠%1: The socket operation is not supported - + %1: ãã®ã‚½ã‚±ãƒƒãƒˆæ“作ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ %1: Unknown error - + %1: 未知ã®ã‚¨ãƒ©ãƒ¼ã§ã™ %1: Unknown error %2 - + %1: 未知ã®ã‚¨ãƒ©ãƒ¼ %2 QMYSQLDriver - + Unable to open database ' データベースをオープンã§ãã¾ã›ã‚“ ' @@ -2846,12 +2887,12 @@ Do you want to delete it anyway? QMYSQLResult - + Unable to fetch data データをフェッãƒã§ãã¾ã›ã‚“ - + Unable to execute query クエリーを実行ã§ãã¾ã›ã‚“ @@ -2861,13 +2902,13 @@ Do you want to delete it anyway? å®Ÿè¡Œçµæžœã‚’記録ã§ãã¾ã›ã‚“ - + Unable to prepare statement プリペアステートメントを使ãˆã¾ã›ã‚“ - + Unable to reset statement ステートメントをリセットã§ãã¾ã›ã‚“ @@ -2893,14 +2934,14 @@ Do you want to delete it anyway? ステートメントã®å®Ÿè¡Œçµæžœã‚’記録ã§ãã¾ã›ã‚“ - + Unable to execute next query - + 次ã®ã‚¯ã‚¨ãƒªãƒ¼ã‚’実行ã§ãã¾ã›ã‚“ Unable to store next result - + 次ã®çµæžœã‚’記録ã§ãã¾ã›ã‚“ @@ -2908,7 +2949,7 @@ Do you want to delete it anyway? (Untitled) - + (タイトルãªã—) @@ -2916,92 +2957,93 @@ Do you want to delete it anyway? %1 - [%2] - %1 - [%2] + %1 - [%2] Close - é–‰ã˜ã‚‹ + é–‰ã˜ã‚‹ Minimize - 最å°åŒ– + 最å°åŒ– Restore Down - å…ƒã«æˆ»ã™ + å…ƒã«æˆ»ã™ &Restore - å…ƒã«æˆ»ã™(&R) + å…ƒã«æˆ»ã™(&R) &Move - 移動(&M) + 移動(&M) &Size - + サイズ(&S) Mi&nimize - 最å°åŒ–(&N) + 最å°åŒ–(&N) Ma&ximize - 最大化(&X) + 最大化(&X) Stay on &Top - å¸¸ã«æ‰‹å‰ã«è¡¨ç¤º(&T) + å¸¸ã«æ‰‹å‰ã«è¡¨ç¤º(&T) &Close - é–‰ã˜ã‚‹(&C) + é–‰ã˜ã‚‹(&C) - [%1] - + - [%1] Maximize - 最大化 + 最大化 Unshade - + ãŸã¶ã‚“é¸æŠžãƒ»éžé¸æŠžçŠ¶æ…‹ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®ã“ã¨ã ã¨æ€ã†ã‘ã©ã€‚fvwmãªã©ã®x11ã§ä½¿ã‚れã¦ã„る用語 + éžé¸æŠž Shade - + é¸æŠž Restore - + å…ƒã«æˆ»ã™ Help - ヘルプ + ヘルプ Menu - メニュー + メニュー @@ -3082,7 +3124,32 @@ Do you want to delete it anyway? <h3>About Qt</h3><p>This program uses Qt version %1.</p><p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://www.qtsoftware.com/products/licensing">www.qtsoftware.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://www.qtsoftware.com/qt/">www.qtsoftware.com/qt</a> for more information.</p> - + <h3>Qtã«ã¤ã„ã¦</h3> +<p>ã“ã®ãƒ—ログラム㯠Qt ãƒãƒ¼ã‚¸ãƒ§ãƒ³ %1 を使用ã—ã¦ã„ã¾ã™ã€‚</p> +<p>Qt ã¯ã€ã‚¯ãƒ­ã‚¹ãƒ—ラットホームã®ã‚¢ãƒ—リケーション開発ã«ä½¿ç”¨ã•れる C++ ã®ãƒ„ールキットã§ã™ã€‚</p> +<p>Qt ã¯ã€ MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, ãã—ã¦å¤šæ•°ã® Unix ç³»OS環境ã«å¯¾ã—ã¦ã€å˜ä¸€ã®ã‚½ãƒ¼ã‚¹ã‹ã‚‰ãƒã‚¤ãƒŠãƒªã‚’生æˆã—ã¾ã™ã€‚ +ã¾ãŸã€ Linux ãŠã‚ˆã³ Windows CE ã‚’å…ƒã¨ã—ãŸçµ„ã¿è¾¼ã¿ç’°å¢ƒã«ã‚‚対応ã—ã¦ã„ã¾ã™ã€‚</p> +<p>Qt ã¯æ§˜ã€…ãªãƒ¦ãƒ¼ã‚¶ã®è¦æœ›ã«å¿œã˜ã‚‹ãŸã‚ã«ã€3ã¤ã®ç•°ãªã‚‹ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã§æä¾›ã•れã¦ã„ã¾ã™ã€‚</p> +<p> +Qt 商用ライセンスã¯ã€ãƒ—ロプライエタリã¾ãŸã¯å•†ç”¨ã‚½ãƒ•トウェアã«é©ç”¨ã§ãã¾ã™ã€‚ +ã“ã®å ´åˆã¯ã€ä»–者ã¨ã®ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã®å…±æœ‰ã‚’æ‹’å¦ã—〠GNU LGP ãƒãƒ¼ã‚¸ãƒ§ãƒ³ 2.1 ã¾ãŸã¯ GNU GPL ãƒãƒ¼ã‚¸ãƒ§ãƒ³ 3.0 を許容ã§ããªã„ソフトウェアã«ãŠã„㦠Qt を使用ã§ãã¾ã™ã€‚ +</p> +<p> +Qt GNU LGPL ãƒãƒ¼ã‚¸ãƒ§ãƒ³ 2.1 ライセンスã¯ã€ãƒ—ロプライエタリã¾ãŸã¯ã‚ªãƒ¼ãƒ—ンソースソフトウェアã«é©ç”¨ã§ãã¾ã™ã€‚ +ã“ã®å ´åˆã¯ã€ GNU LGPL ãƒãƒ¼ã‚¸ãƒ§ãƒ³ 2.1 ã«å¾“ã†å¿…è¦ãŒã‚りã¾ã™ã€‚ +</p> +<p> +Qt GNU General Public License ãƒãƒ¼ã‚¸ãƒ§ãƒ³ 3.0 ライセンスã¯ã€GNU GPL ãƒãƒ¼ã‚¸ãƒ§ãƒ³ 3.0 ã¾ãŸã¯ GPL 3.0 ã¨äº’æ›æ€§ã®ã‚るライセンスを採用ã—ã¦ã„るソフトウェアã«é©ç”¨ã•れã¾ã™ã€‚ +ã“ã®å ´åˆã¯ã€GNU GPL ãƒãƒ¼ã‚¸ãƒ§ãƒ³ 3.0 ã«å¾“ã†å¿…è¦ãŒã‚りã¾ã™ã€‚ +</p> +<p> +ライセンスã®è©³ç´°ã«ã¤ã„ã¦ã¯ã€<a href="http://www.qtsoftware.com/products/licensing">www.qtsoftware.com/products/licensing</a> +ã‚’å‚ç…§ã—ã¦ãã ã•ã„。</p> +<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p> +<p>Qt 㯠Nokia ã®è£½å“ã§ã™ã€‚詳細ã«ã¤ã„ã¦ã¯<a href="http://www.qtsoftware.com/qt/">www.qtsoftware.com/qt</a> ã‚’å‚ç…§ã—ã¦ãã ã•ã„。</p> +<p> +訳注: ライセンスã¯ã“ã“ã«ã‚る翻訳ã¯å‚考ã®ãŸã‚ã®ã‚‚ã®ã§ã‚りã€ã‚ªãƒªã‚¸ãƒŠãƒ«ã®(英語ã®)ã‚‚ã®ãŒæ­£å¼ãªã‚‚ã®ã¨ãªã‚Šã¾ã™ã€‚ +</p> @@ -3090,7 +3157,7 @@ Do you want to delete it anyway? Select IM - å…¥åŠ›ãƒ¡ã‚½ãƒƒãƒ‰ã‚’é¸æŠž + ã‚¤ãƒ³ãƒ—ãƒƒãƒˆãƒ¡ã‚½ãƒƒãƒ‰ã‚’é¸æŠž @@ -3098,12 +3165,12 @@ Do you want to delete it anyway? Multiple input method switcher - 複数ã®å…¥åŠ›ãƒ¡ã‚½ãƒƒãƒ‰ã‚’åˆ‡ã‚Šæ›¿ãˆ + 複数ã®ã‚¤ãƒ³ãƒ—ットメソッドを切り替㈠Multiple input method switcher that uses the context menu of the text widgets - テキストウィジェットã®ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‚’使ã£ãŸè¤‡æ•°ã®å…¥åŠ›ãƒ¡ã‚½ãƒƒãƒ‰ã®åˆ‡ã‚Šæ›¿ãˆã§ã™ + テキストウィジェットã®ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆãƒ¡ãƒ‹ãƒ¥ãƒ¼ã‚’使ã£ãŸè¤‡æ•°ã®ã‚¤ãƒ³ãƒ—ットメソッドã®åˆ‡ã‚Šæ›¿ãˆã§ã™ @@ -3111,7 +3178,7 @@ Do you want to delete it anyway? Unable to initialize non-blocking socket - ãƒŽãƒ³ãƒ–ãƒ­ãƒƒã‚­ãƒ³ã‚°ã‚½ã‚±ãƒƒãƒˆã‚’åˆæœŸåŒ–ã§ãã¾ã›ã‚“ + éžãƒ–ãƒ­ãƒƒã‚¯åž‹ã‚½ã‚±ãƒƒãƒˆã‚’åˆæœŸåŒ–ã§ãã¾ã›ã‚“ @@ -3236,7 +3303,7 @@ Do you want to delete it anyway? The proxy type is invalid for this operation - + ã“ã®ãƒ—ロキシーã¯ã€ã“ã®æ“作ã«å¯¾å¿œã—ã¦ã„ã¾ã›ã‚“ @@ -3244,93 +3311,101 @@ Do you want to delete it anyway? Error opening %1 - + オープンã®ã‚¨ãƒ©ãƒ¼ %1 + + + + QNetworkAccessDebugPipeBackend + + + Write error writing to %1: %2 + %1 ã¸ã®æ›¸ãè¾¼ã¿æ™‚ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: %2 QNetworkAccessFileBackend - + Request for opening non-local file %1 - + éžãƒ­ãƒ¼ã‚«ãƒ«ãƒ•ァイル %1 をオープンã™ã‚‹ã‚ˆã†è¦æ±‚ã•れã¾ã—ãŸãŒã€ãƒ­ãƒ¼ã‚«ãƒ«ãƒ•ァイルã®ã¿ã‚ªãƒ¼ãƒ—ンã§ãã¾ã™ - + Error opening %1: %2 - + %1 をオープンã™ã‚‹æ™‚ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: %2 - + Write error writing to %1: %2 - + %1 ã¸ã®æ›¸ãè¾¼ã¿æ™‚ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: %2 - + Cannot open %1: Path is a directory - + %1 をオープンã§ãã¾ã›ã‚“。指定ã•れãŸãƒ‘スã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã§ã™ Read error reading from %1: %2 - + %1 を読ã¿è¾¼ã¿æ™‚ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: %2 QNetworkAccessFtpBackend - + No suitable proxy found - + é©åˆ‡ãªãƒ—ロキシーãŒã¿ã¤ã‹ã‚Šã¾ã›ã‚“ Cannot open %1: is a directory - + %1 をオープンã§ãã¾ã›ã‚“。指定ã•れãŸãƒ‘スã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã§ã™ - + Logging in to %1 failed: authentication required - + %1 ã¸ã®ãƒ­ã‚°ã‚¤ãƒ³ã«å¤±æ•—ã—ã¾ã—ãŸã€‚èªè¨¼ãŒå¿…è¦ã§ã™ Error while downloading %1: %2 - + %1 をダウンロード中ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: %2 Error while uploading %1: %2 - + %1 をアップロード中ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: %2 QNetworkAccessHttpBackend - + No suitable proxy found - + é©åˆ‡ãªãƒ—ロキシーãŒã¿ã¤ã‹ã‚Šã¾ã›ã‚“ QNetworkReply - + Error downloading %1 - server replied: %2 - + %1 をダウンロード中ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸã€‚サーãƒã®è¿”ç­”: %2 - + Protocol "%1" is unknown - + プロトコル "%1" ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ QNetworkReplyImpl - + Operation canceled - + æ“作ã¯ã‚­ãƒ£ãƒ³ã‚»ãƒ«ã•れã¾ã—㟠@@ -3349,17 +3424,17 @@ Do you want to delete it anyway? Unable to begin transaction - トランザクションを開始ã§ãã¾ã›ã‚“ + トランザクションを開始ã§ãã¾ã›ã‚“ Unable to commit transaction - トランザクションをコミットã§ãã¾ã›ã‚“ + トランザクションをコミットã§ãã¾ã›ã‚“ Unable to rollback transaction - トランザクションをロールãƒãƒƒã‚¯ã§ãã¾ã›ã‚“ + トランザクションをロールãƒãƒƒã‚¯ã§ãã¾ã›ã‚“ @@ -3409,7 +3484,7 @@ Do you want to delete it anyway? QODBCDriver - + Unable to connect 接続ã§ãã¾ã›ã‚“ @@ -3466,29 +3541,29 @@ Do you want to delete it anyway? QODBCResult::reset: Unable to set 'SQL_CURSOR_STATIC' as statement attribute. Please check your ODBC driver configuration - QODBCResult::reset: ステートメントã®å±žæ€§ã¨ã—㦠'SQL_CURSOR_STATUS' を設定ã§ãã¾ã›ã‚“。ODBC ドライãƒã®æ§‹æˆã‚’ãƒã‚§ãƒƒã‚¯ã—ã¦ãã ã•ã„。 + QODBCResult::reset: ステートメントã®å±žæ€§ã¨ã—㦠'SQL_CURSOR_STATUS' を設定ã§ãã¾ã›ã‚“。ODBC ドライãƒã®æ§‹æˆã‚’ãƒã‚§ãƒƒã‚¯ã—ã¦ãã ã•ã„ Unable to fetch last - + リストをå–å¾—ã§ãã¾ã›ã‚“ Unable to fetch - + フェッãƒã§ãã¾ã›ã‚“ Unable to fetch first - 最åˆã®ãƒ¬ã‚³ãƒ¼ãƒ‰ã‚’フェッãƒã§ãã¾ã›ã‚“ + 最åˆã®ãƒ¬ã‚³ãƒ¼ãƒ‰ã‚’フェッãƒã§ãã¾ã›ã‚“ Unable to fetch previous - + å‰ã®ãƒ¬ã‚³ãƒ¼ãƒ‰ã‚’フェッãƒã§ãã¾ã›ã‚“ @@ -3509,56 +3584,41 @@ Do you want to delete it anyway? Operation not supported on %1 - + %1 ã§ã¯ã“ã®æ“作ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ Invalid URI: %1 - - - - - Write error writing to %1: %2 - - - - - Read error reading from %1: %2 - + 無効ãªURIã§ã™: %1 - + Socket error on %1: %2 - + %1 ã®ã‚½ã‚±ãƒƒãƒˆã«ãŠã„ã¦ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: %2 Remote host closed the connection prematurely on %1 - - - - - Protocol error: packet of size 0 received - + リモートホスト %1 ã¨ã®æŽ¥ç¶šãŒé€šä¿¡ã®çµ‚了å‰ã«åˆ‡æ–­ã•れã¾ã—㟠No host name given - + ホストãƒãƒ¼ãƒ ãŒä¸Žãˆã‚‰ã‚Œã¦ã„ã¾ã›ã‚“ QPPDOptionsModel - + Name - åå‰ + åå‰ Value - 値 + 値 @@ -3586,12 +3646,12 @@ Do you want to delete it anyway? Unable to subscribe - + subscribe ã§ãã¾ã›ã‚“ Unable to unsubscribe - + unsubscribe ã§ãã¾ã›ã‚“ @@ -3604,7 +3664,7 @@ Do you want to delete it anyway? Unable to prepare statement - プリペアステートメントを使ãˆã¾ã›ã‚“ + プリペアステートメントを使ãˆã¾ã›ã‚“ @@ -3612,4355 +3672,4361 @@ Do you want to delete it anyway? Centimeters (cm) - + センãƒãƒ¡ãƒ¼ãƒˆãƒ« (cm) Millimeters (mm) - + ミリメートル (mm) Inches (in) - + インム(in) Points (pt) - + ãƒã‚¤ãƒ³ãƒˆ (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 - + 下端余白 - QPluginLoader + QPatternist::QtXmlPatterns - - Unknown error - 䏿˜Žãªã‚¨ãƒ©ãƒ¼ + + An %1-attribute with value %2 has already been declared. + 属性 %1 ã®å€¤ %2 ã¯æ—¢ã«å®£è¨€ã•れã¦ã„ã¾ã™ã€‚ - - The plugin was not loaded. - + + An %1-attribute must have a valid %2 as value, which %3 isn't. + 属性 %1 ã®å€¤ã¯ %2 ã®åž‹ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“ãŒã€ %3 ãŒæŒ‡å®šã•れã¾ã—ãŸã€‚ - - - QPrintDialog - Page size: - ページサイズ: + + %1 is an unsupported encoding. + %1 ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ãªã„エンコーディングã§ã™ã€‚ - Orientation: - æ–¹å‘: + + %1 contains octets which are disallowed in the requested encoding %2. + エンコーディング %2 ã§ã¯è¨±å¯ã•れã¦ã„ãªã„オクテット㌠%1 ã«å«ã¾ã‚Œã¦ã„ã¾ã™ã€‚ - Paper source: - 給紙装置: + + The codepoint %1, occurring in %2 using encoding %3, is an invalid XML character. + %2 ã§ä½¿ç”¨ã•れã¦ã„るエンコード %3 ã§ã¯ã€ã‚³ãƒ¼ãƒ‰ãƒã‚¤ãƒ³ãƒˆ %1 ã¯æœ‰åŠ¹ãª XML 表ç¾ã§ã¯ã‚りã¾ã›ã‚“。 - - OK - OK + + Network timeout. + ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯æŽ¥ç¶šãŒã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã—ã¾ã—ãŸã€‚ - Cancel - キャンセル + + Element %1 can't be serialized because it appears outside the document element. + エレメント %1 ã¯ã‚·ãƒªã‚¢ãƒ©ã‚¤ã‚ºã§ãã¾ã›ã‚“。ã“ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã®ç¯„囲を越ãˆã‚‹ã‚¨ãƒ¬ãƒ¡ãƒ³ãƒˆã‚’å«ã‚“ã§ã„ã¾ã™ã€‚ - Portrait - 縦 + + Attribute %1 can't be serialized because it appears at the top level. + 属性 %1 ã¯ã‚·ãƒªã‚¢ãƒ©ã‚¤ã‚ºã§ãã¾ã›ã‚“。トップレベルã«ç¾ã‚Œã¦ã„ã‚‹ãŸã‚ã§ã™ã€‚ - Landscape - 横 + + Year %1 is invalid because it begins with %2. + %1 å¹´ã¯ã‚€ã“ã†ã§ã™ã€‚%2 ã§å§‹ã¾ã£ã¦ã„ã¾ã™ã€‚ - - locally connected - ãƒ­ãƒ¼ã‚«ãƒ«ã«æŽ¥ç¶šã—ã¦ã„ã¾ã™ + + Day %1 is outside the range %2..%3. + %1 æ—¥ã¯ã€æœ‰åйãªç¯„囲 %2..%3 を逸脱ã—ã¦ã„ã¾ã™ã€‚ - - - Aliases: %1 - エイリアス: %1 + + Month %1 is outside the range %2..%3. + %1 月ã¯ã€æœ‰åйãªç¯„囲 %2..%3 を逸脱ã—ã¦ã„ã¾ã™ã€‚ - - - unknown - 䏿˜Ž + + Overflow: Can't represent date %1. + オーãƒãƒ¼ãƒ•ロー: 日付 %1 ã‚’å†ç¾ã§ãã¾ã›ã‚“。 - Print in color if available - å¯èƒ½ã§ã‚れã°ã‚«ãƒ©ãƒ¼ã§å°åˆ· + + Day %1 is invalid for month %2. + %2 月ã«ã¯ã€%1 æ—¥ã¯å­˜åœ¨ã—ã¾ã›ã‚“。 - Print to file - ファイルã«å‡ºåŠ›: + + Time 24:%1:%2.%3 is invalid. Hour is 24, but minutes, seconds, and milliseconds are not all 0; + 24:%1:%2.%3 ã¯ç„¡åйã§ã™ã€‚24時0分0ç§’ã®ã¿ä½¿ç”¨ã§ãã¾ã™ - Browse - å‚ç…§... + + Time %1:%2:%3.%4 is invalid. + 時刻 %1時%2分%3.%4ç§’ã¯ç„¡åйã§ã™ã€‚ - - Print all - ã™ã¹ã¦å°åˆ· + + Overflow: Date can't be represented. + オーãƒãƒ¼ãƒ•ロー: 日付をå†ç¾ã§ãã¾ã›ã‚“。 - Selection - é¸æŠžã—ãŸéƒ¨åˆ†ã‚’å°åˆ· + + + At least one component must be present. + å¹´ã€æœˆã€æ—¥ã®ã†ã¡ã„ãšã‚Œã‹ã‚’指定ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - Print range - å°åˆ·ç¯„囲 + + At least one time component must appear after the %1-delimiter. + %1 ã®å¾Œã«ã¯ã€æ™‚刻を指定ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - Pages from - 先頭ã®ãƒšãƒ¼ã‚¸: + + No operand in an integer division, %1, can be %2. + ゼロ除算? NaN? + æ•´æ•°ã®é™¤ç®—ã®ãŸã‚ã®ã‚ªãƒšãƒ©ãƒ³ãƒ‰ãŒä¸è¶³ã—ã¦ã„ã¾ã™ã€‚%1 㯠%2 ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - to - 末尾ã®ãƒšãƒ¼ã‚¸: + + The first operand in an integer division, %1, cannot be infinity (%2). + æ•´æ•°ã®é™¤ç®—ã«ãŠã‘る最åˆã®ã‚ªãƒšãƒ©ãƒ³ãƒ‰ %1 ã‚’èªè­˜ã§ãã¾ã›ã‚“ (%2)。 - Print last page first - 末尾ã®ãƒšãƒ¼ã‚¸ã‹ã‚‰å°åˆ· + + The second operand in a division, %1, cannot be zero (%2). + æ•´æ•°ã®é™¤ç®—ã«ãŠã‘る二ã¤ç›®ã®ã‚ªãƒšãƒ©ãƒ³ãƒ‰ %1 ã¯ã‚¼ãƒ­ã§ã‚ã£ã¦ã¯ã„ã‘ã¾ã‚“(%2)。 - Number of copies: - 部数: + + %1 is not a valid value of type %2. + %1 ã¯ã€%2 ã®åž‹ã«å¯¾ã—ã¦æœ‰åйãªå€¤ã§ã¯ã‚りã¾ã›ã‚“。 - Paper format - 用紙ã®å½¢å¼ + + When casting to %1 from %2, the source value cannot be %3. + %2 ã‹ã‚‰ %1 ã¸ã®åž‹å¤‰æ›ã«éš›ã—ã¦ã¯ã€å€¤ %3 ã¯æœ‰åйãªå€¤ã§ã¯ã‚りã¾ã›ã‚“。 - - A0 (841 x 1189 mm) - A0 (841 x 1189mm) + + Integer division (%1) by zero (%2) is undefined. + æ•´æ•°ã®é™¤ç®—ã«ãŠã„㦠%1 をゼロ (%2) ã§å‰²ã£ãŸçµæžœã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。 - - A1 (594 x 841 mm) - A1 (594 x 841mm) + + Division (%1) by zero (%2) is undefined. + 除算ã«ãŠã„㦠%1 をゼロ (%2) ã§å‰²ã£ãŸçµæžœã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。 - - A2 (420 x 594 mm) - A2 (420 x 594mm) + + Modulus division (%1) by zero (%2) is undefined. + 剰余を求ã‚ã‚‹ã«éš›ã—ã€%1 をゼロ (%2) ã§é™¤ã—ãŸçµæžœã¯å®šç¾©ã•れã¦ã„ã¾ã›ã‚“。 - - A3 (297 x 420 mm) - A3 (297 x 420mm) + + + Dividing a value of type %1 by %2 (not-a-number) is not allowed. + åž‹ %1 ã‚’éžæ•° %2 (NaN) ã§é™¤ã™ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - A4 (210 x 297 mm, 8.26 x 11.7 inches) - A4 (210 x 297mmã€8.26 x 11.7インãƒ) + + Dividing a value of type %1 by %2 or %3 (plus or minus zero) is not allowed. + åž‹ %1 ã‚’%2 ã¾ãŸã¯ %3 (æ­£ã¾ãŸã¯è² ã®ã‚¼ãƒ­) ã§é™¤ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - A5 (148 x 210 mm) - A5 (148 x 210mm) - - - - A6 (105 x 148 mm) - A6 (105 x 148mm) + + Multiplication of a value of type %1 by %2 or %3 (plus or minus infinity) is not allowed. + åž‹ %1 ã‚’ %2 ã¾ãŸã¯ %3 (æ­£ã¾ãŸã¯è² ã®ã‚¼ãƒ­)ã§ä¹—ãšã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - A7 (74 x 105 mm) - A7 (74 x 105mm) + + A value of type %1 cannot have an Effective Boolean Value. + åž‹ %1 ã¯æœ‰åйãªè«–ç†åž‹(bool)ã§ã¯ã‚りã¾ã›ã‚“。 - - A8 (52 x 74 mm) - A8 (52 x 74mm) + + Effective Boolean Value cannot be calculated for a sequence containing two or more atomic values. + ?? + è«–ç†åž‹ã¯ã€è«–ç†åž‹ä»¥å¤–ã®è¤‡æ•°ã®å€¤ã‹ã‚‰ãªã‚‹è¨ˆç®—ã«ã‚ˆã£ã¦æ±‚ã‚ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - A9 (37 x 52 mm) - A9 (37 x 52mm) + + Value %1 of type %2 exceeds maximum (%3). + åž‹ %2 ã®å€¤ %1 ã¯ã€ä¸Šé™ (%3) ã‚’è¶Šãˆã¦ã„ã¾ã™ã€‚ - - B0 (1000 x 1414 mm) - B0 (1000 x 1414mm) + + Value %1 of type %2 is below minimum (%3). + åž‹ %2 ã®å€¤ %1 ã¯ã€ä¸‹é™ (%3) ã‚’è¶Šãˆã¦ã„ã¾ã™ã€‚ - - B1 (707 x 1000 mm) - B1 (707 x 1000mm) + + A value of type %1 must contain an even number of digits. The value %2 does not. + åž‹ %1 ã®å€¤ã¯å¶æ•°å€‹ã®å進数文字を必è¦ã¨ã—ã¾ã™ã€‚ã—ã‹ã—ã€%2 ã¯ãã†ã§ã¯ã‚りã¾ã›ã‚“。 - - B2 (500 x 707 mm) - B2 (500 x 707mm) + + %1 is not valid as a value of type %2. + åž‹ %2 ã«å¯¾ã—ã¦ã€å€¤ %1 ã¯æœ‰åйã§ã¯ã‚りã¾ã›ã‚“。 - - B3 (353 x 500 mm) - B3 (353 x 500mm) + + Ambiguous rule match. + 曖昧ãªãƒ«ãƒ¼ãƒ«ã«ãƒžãƒƒãƒã—ã¾ã—ãŸã€‚ - - B4 (250 x 353 mm) - B4 (250 x 353mm) + + Operator %1 cannot be used on type %2. + åž‹ %2 ã«å¯¾ã—ã¦ã€ã‚ªãƒšãƒ¬ãƒ¼ã‚¿ %1 ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。 - - B5 (176 x 250 mm, 6.93 x 9.84 inches) - B5 (176 x 250mmã€6.93 x 9.84インãƒ) + + Operator %1 cannot be used on atomic values of type %2 and %3. + アトミックãªåž‹ %2 㨠%3 ã«å¯¾ã—ã¦ã€ã‚ªãƒšãƒ¬ãƒ¼ã‚¿ %1 ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。 - - B6 (125 x 176 mm) - B6 (125 x 176mm) + + The namespace URI in the name for a computed attribute cannot be %1. + computed attrib. ã£ã¦ãªã‚“ã¦ã‚„ãã™ã®ãŒé©å½“ã‹ãªã€‚ + çµåˆã•れãŸå±žæ€§ã«å¯¾ã™ã‚‹åå‰ç©ºé–“ã®URIã¨ã—ã¦ã€%1 を使用ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - B7 (88 x 125 mm) - B7 (88 x 125mm) + + The name for a computed attribute cannot have the namespace URI %1 with the local name %2. + çµåˆã•れãŸå±žæ€§ã®åå‰ç©ºé–“URI %1 ã¯ã€ãƒ­ãƒ¼ã‚«ãƒ«ãªåå‰ã§ã‚ã‚‹ %2 ã¨ä½µç”¨ã§ãã¾ã›ã‚“。 - - B8 (62 x 88 mm) - B8 (62 x 88mm) + + Type error in cast, expected %1, received %2. + åž‹å¤‰æ›æ™‚ã®ã‚¨ãƒ©ãƒ¼ã§ã™ã€‚望んã§ã„㟠%1 ã§ã¯ãªãã€%2 ã«ãªã‚Šã¾ã—ãŸã€‚ - - B9 (44 x 62 mm) - B9 (44 x 62mm) + + When casting to %1 or types derived from it, the source value must be of the same type, or it must be a string literal. Type %2 is not allowed. + %1 ã¾ãŸã¯ãれを継承ã—ã¦ã„ã‚‹åž‹ã¸ã®åž‹å¤‰æ›ã«ãŠã„ã¦ã¯ã€å…ƒã®å€¤ã®åž‹ã¯åŒã˜åž‹ã‹ã€ãƒªãƒ†ãƒ©ãƒ«ãªæ–‡å­—列ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚åž‹ %2 ã¯è¨±å¯ã•れã¦ã„ã¾ã›ã‚“。 - - B10 (31 x 44 mm) - B10 (31 x 44mm) + + No casting is possible with %1 as the target type. + 目標ã¨ã™ã‚‹åž‹ã« %1 を型変æ›ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - C5E (163 x 229 mm) - C5E (163 x 229mm) + + It is not possible to cast from %1 to %2. + åž‹ %1 ã‚’åž‹ %2 ã«åž‹å¤‰æ›ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - DLE (110 x 220 mm) - DLE (110 x 220mm) + + Casting to %1 is not possible because it is an abstract type, and can therefore never be instantiated. + åž‹ %1 ã¸ã®åž‹å¤‰æ›ã¯ã§ãã¾ã›ã‚“。抽象型ã§ã‚りã€ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹åŒ–ã™ã‚‹ã“ã¨ãŒã§ããªã„ã‹ã‚‰ã§ã™ã€‚ - - Executive (7.5 x 10 inches, 191 x 254 mm) - Executive (7.5 x 10インãƒã€191 x 254mm) + + It's not possible to cast the value %1 of type %2 to %3 + åž‹ %2 ã®å€¤ %1 ã‚’ã€åž‹ %3 ã«åž‹å¤‰æ›ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - Folio (210 x 330 mm) - Folio (210 x 330mm) + + Failure when casting from %1 to %2: %3 + %1 ã‚’ %2 ã«åž‹å¤‰æ›ã™ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“: %3 - - Ledger (432 x 279 mm) - Ledger (432 x 279mm) + + A comment cannot contain %1 + コメント㌠%1 ã‚’å«ã‚€ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - Legal (8.5 x 14 inches, 216 x 356 mm) - Legal (8.5 x 14インãƒã€216 x 356mm) + + A comment cannot end with a %1. + コメント㯠%1 ã§çµ‚了ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - Letter (8.5 x 11 inches, 216 x 279 mm) - Letter (8.5 x 11インãƒã€216 x 279mm) + + No comparisons can be done involving the type %1. + åž‹ %1 ã«å¯¾ã—ã¦æ¯”較を行ã†ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - Tabloid (279 x 432 mm) - Tabloid (279 x 432mm) + + Operator %1 is not available between atomic values of type %2 and %3. + オペレータ %1 ã¯ã€ã‚¢ãƒˆãƒŸãƒƒã‚¯ãªåž‹ã§ã‚ã‚‹ %2 㨠%3 ã«ã¯é©ç”¨ã§ãã¾ã›ã‚“。 - - US Common #10 Envelope (105 x 241 mm) - US Common #10 Envelope (105 x 241mm) + + In a namespace constructor, the value for a namespace cannot be an empty string. + åå‰ç©ºé–“ã®ã‚¹ãƒ³ãƒˆãƒ©ã‚¯ãƒˆã«ãŠã„ã¦ã€ç©ºç™½ã®æ–‡å­—列をåå‰ç©ºé–“ã®å€¤ã¨ã—ã¦ä½¿ç”¨ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - Print dialog - プリントダイアログ + + The prefix must be a valid %1, which %2 is not. + プレフィックス㯠%1 ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。%2 ã¯ç„¡åйã§ã™ã€‚ - Size: - サイズ: + + The prefix %1 cannot be bound. + プレフィックス %1 ã¯ãƒã‚¦ãƒ³ãƒ‰ã§ãã¾ã›ã‚“。 - Printer - プリンタ + + Only the prefix %1 can be bound to %2 and vice versa. + プレフィックス %1 ã¯ã€%2 ã«ã®ã¿ãƒã‚¦ãƒ³ãƒ‰ã§ãã¾ã™ã€‚逆もåŒã˜ã§ã™ã€‚ - Properties - プロパティ + + An attribute node cannot be a child of a document node. Therefore, the attribute %1 is out of place. + ドキュメントノードã®å­ã¨ã—ã¦å±žæ€§ãƒŽãƒ¼ãƒ‰ã‚’指定ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。属性 %1 ã¯èª¤ã£ãŸå ´æ‰€ã«ã‚りã¾ã™ã€‚ - Printer info: - プリンタ情報: + + Circularity detected + 循環を検出ã—ã¾ã—㟠- Copies - å°åˆ·éƒ¨æ•° + + A library module cannot be evaluated directly. It must be imported from a main module. + ライブラリモジュールを直接評価ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。メインモジュールã‹ã‚‰ã‚¤ãƒ³ãƒãƒ¼ãƒˆã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ - Collate - ä¸åˆã„ + + No template by name %1 exists. + テンプレートå %1 ã¯å­˜åœ¨ã—ã¾ã›ã‚“。 - Other - ãã®ä»– + + A value of type %1 cannot be a predicate. A predicate must have either a numeric type or an Effective Boolean Value type. + åž‹ %1 ã¯è¿°éƒ¨ã¨ã—ã¦ä½¿ç”¨ã§ãã¾ã›ã‚“。数値型ã‹ã€è«–ç†åž‹ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ - Double side printing - 両é¢å°åˆ· + + A positional predicate must evaluate to a single numeric value. + positional? + 述部ã¯è©•価ã•れãŸã¨ãã€å˜ä¸€ã®æ•°å€¤ã«ãªã‚‹ã‚ˆã†ã«ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - - - Print - å°åˆ· + + The target name in a processing instruction cannot be %1 in any combination of upper and lower case. Therefore, is %2 invalid. + ターゲットã¨ã—ã¦ã„ã‚‹åå‰ã¯ã€%1 ã§ã‚ã£ã¦ã¯ãªã‚Šã¾ã›ã‚“。%2 ã¯ç„¡åйã§ã™ã€‚ - File - ファイル + + %1 is not a valid target name in a processing instruction. It must be a %2 value, e.g. %3. + %1 ã¯ã‚¿ãƒ¼ã‚²ãƒƒãƒˆã¨ã—ã¦ç„¡åйã§ã™ã€‚%2 ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚例ãˆã° "%3" ã®ã‚ˆã†ã«ã§ã™ã€‚ - - Print To File ... - ファイルã¸å‡ºåŠ›... + + The last step in a path must contain either nodes or atomic values. It cannot be a mixture between the two. + ãƒã‚¹ã®æœ«ç«¯ã§ã‚るリーフã¯ã€å˜ä¸€ã®ãƒŽãƒ¼ãƒ‰ã‹ã‚¢ãƒˆãƒŸãƒƒã‚¯ãªå€¤ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚複数ã®åž‹ã®çµ„ã¿åˆã‚ã›ã§ã‚ã£ã¦ã¯ã„ã‘ã¾ã›ã‚“。 - - File %1 is not writable. -Please choose a different file name. - ファイル %1 ã¯æ›¸ãè¾¼ã¿å¯èƒ½ã§ã¯ã‚りã¾ã›ã‚“。 -別ã®ãƒ•ァイルåã‚’é¸ã‚“ã§ãã ã•ã„。 + + The data of a processing instruction cannot contain the string %1 + 処ç†ä¸­ã®ãƒ‡ãƒ¼ã‚¿ã¯ã€ä»¥ä¸‹ã®æ–‡å­—列をå«ã‚“ã§ã„ã¦ã¯ãªã‚Šã¾ã›ã‚“: %1 - - %1 already exists. -Do you want to overwrite it? - %1 ã¯ã™ã§ã«å­˜åœ¨ã—ã¾ã™ã€‚ -上書ãã—ã¾ã™ã‹? + + No namespace binding exists for the prefix %1 + プレフィックス %1 ã«ãƒã‚¤ãƒ³ãƒ‰ã•れãŸãƒãƒ¼ãƒ ã‚¹ãƒšãƒ¼ã‚¹ãŒã‚りã¾ã›ã‚“ - - File exists - + + No namespace binding exists for the prefix %1 in %2 + %2 ã«ãŠã‘るプレフィックス %1 ã«ãƒã‚¤ãƒ³ãƒ‡ã‚£ãƒ³ã‚°ã•れãŸãƒãƒ¼ãƒ ã‚¹ãƒšãƒ¼ã‚¹ãŒå­˜åœ¨ã—ã¾ã›ã‚“ - - <qt>Do you want to overwrite it?</qt> - + + + %1 is an invalid %2 + åž‹ %2 ã«å¯¾ã—ã€å€¤ %1 ã¯ç„¡åйã§ã™ - - Print selection - + + The parameter %1 is passed, but no corresponding %2 exists. + パラメータ %1 を処ç†ã—ã¾ã—ãŸã€‚ã—ã‹ã—ã€å¯¾å¿œã™ã‚‹ %2 ãŒå­˜åœ¨ã—ã¾ã›ã‚“。 - - %1 is a directory. -Please choose a different file name. - + + The parameter %1 is required, but no corresponding %2 is supplied. + パメータ %1 ãŒå¿…è¦ã§ã™ã€‚ã—ã‹ã—ã€å¯¾å¿œã™ã‚‹ %2 ãŒã‚りã¾ã›ã‚“。 - - - A0 - + + + %1 takes at most %n argument(s). %2 is therefore invalid. + + %1 ã¯ã€æœ€å¤§ã§ %n 個ã®å¼•æ•°ã‚’ã¨ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚%2 ã¯ç„¡åйã§ã™ã€‚ + - - - A1 - + + + %1 requires at least %n argument(s). %2 is therefore invalid. + + %1 ã¯ã€å°‘ãã¨ã‚‚ %n 個ã®å¼•æ•°ã‚’å¿…è¦ã¨ã—ã¾ã™ã€‚%2 ã¯ç„¡åйã§ã™ã€‚ + - - A2 - + + The first argument to %1 cannot be of type %2. It must be a numeric type, xs:yearMonthDuration or xs:dayTimeDuration. + %1 ã¸ã®æœ€åˆã®å¼•æ•°ã¯ã€åž‹ %2 ã§ã‚ã£ã¦ã¯ãªã‚Šã¾ã›ã‚“。数値型ã€xs:yerMonthDurationã€xs:dayTimeDurationã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ - - A3 - + + The first argument to %1 cannot be of type %2. It must be of type %3, %4, or %5. + %1 ã¸ã®æœ€åˆã®å¼•æ•°ã¯ã€åž‹ %2 ã§ã‚ã£ã¦ã¯ãªã‚Šã¾ã›ã‚“。%3, %4, %5 ã®ã„ãšã‚Œã‹ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ - - A4 - + + The second argument to %1 cannot be of type %2. It must be of type %3, %4, or %5. + %1 ã¸ã®äºŒã¤ç›®ã®å¼•æ•°ã¯ã€åž‹ %2 ã§ã‚ã£ã¦ã¯ãªã‚Šã¾ã›ã‚“。%3, %4, %5 ã®ã„ãšã‚Œã‹ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ - - A5 - + + %1 is not a valid XML 1.0 character. + %1 㯠XML 1.0 ã«ãŠã„ã¦æœ‰åŠ¹ãªæ–‡å­—ã§ã¯ã‚りã¾ã›ã‚“。 - - A6 - + + The first argument to %1 cannot be of type %2. + %1 ã¸ã®æœ€åˆã®å¼•æ•°ã¯ã€åž‹ %2 ã§ã‚ã£ã¦ã¯ãªã‚Šã¾ã›ã‚“。 - - A7 - + + The root node of the second argument to function %1 must be a document node. %2 is not a document node. + %1 ã¸ã®äºŒã¤ç›®ã®å¼•æ•°ã®ãƒ«ãƒ¼ãƒˆãƒŽãƒ¼ãƒ‰ã¯ã€ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆãƒŽãƒ¼ãƒ‰ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。ã—ã‹ã—ã€%2 ã¯ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆãƒŽãƒ¼ãƒ‰ã§ã¯ã‚りã¾ã›ã‚“。 - - A8 - + + If both values have zone offsets, they must have the same zone offset. %1 and %2 are not the same. + ゾーンオフセットã£ã¦ãªã«? xmlã«ãã‚“ãªã®ã‚ã£ãŸã£ã‘? + ã‚‚ã—二ã¤ã®å€¤ãŒã‚¾ãƒ¼ãƒ³ã‚ªãƒ•セットをもã¤å ´åˆã€ä¸¡è€…ã¯åŒã˜ã‚¾ãƒ¼ãƒ³ã‚ªãƒ•セットã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。%1 㨠%2 ã¯åŒä¸€ã§ã¯ã‚りã¾ã›ã‚“。 - - A9 - + + %1 was called. + %1 ãŒå‘¼ã°ã‚Œã¾ã—ãŸã€‚ - - B0 - + + %1 must be followed by %2 or %3, not at the end of the replacement string. + %1 ã®å¾Œã«ã¯ã€%2 ã‹ %3 ãŒç¶šã‹ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - B1 - + + In the replacement string, %1 must be followed by at least one digit when not escaped. + ç½®æ›æ“作ã«ãŠã„ã¦ã€%1 ã«ã¯å°‘ãã¨ã‚‚ä¸€æ–‡å­—ä»¥ä¸Šã®æ•°å€¤ãŒç¶šãå¿…è¦ãŒã‚りã¾ã™(エスケープã•れã¦ã„ã‚‹å ´åˆã‚’除ã)。 - - B2 - + + In the replacement string, %1 can only be used to escape itself or %2, not %3 + ç½®æ›æ“作ã«ãŠã„ã¦ã€%1 ã¯ãれ自身ã¾ãŸã¯ %2 をエスケープã™ã‚‹ç‚ºã«ã®ã¿ä½¿ç”¨ã§ãã¾ã™ã€‚%3 ã«å¯¾ã—ã¦ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“ - - B3 - + + %1 matches newline characters + %1 ã¯æ”¹è¡Œæ–‡å­—(列)ã«ãƒžãƒƒãƒã—ã¾ã—㟠- - B4 - + + %1 and %2 match the start and end of a line. + %1 㨠%2 ã¯ã€è¡Œã®å…ˆé ­ã¨æœ«å°¾ã«ãƒžãƒƒãƒã—ã¾ã—ãŸã€‚ - - B5 - + + Matches are case insensitive + マッãƒã¯å¤§æ–‡å­—å°æ–‡å­—を区別ã—ã¾ã›ã‚“ - - B6 - + + Whitespace characters are removed, except when they appear in character classes + CDATA? + 空白文字ã¯å‰Šé™¤ã•れã¾ã—ãŸã€‚ãŸã ã—ã€ã‚­ãƒ£ãƒ©ã‚¯ã‚¿ãƒ¼ã‚¯ãƒ©ã‚¹ã«å±žã™ã‚‹ã‚‚ã®ã¯é™¤ãã¾ã™ - - B7 - + + %1 is an invalid regular expression pattern: %2 + %1 ã¯æœ‰åŠ¹ãªæ­£è¦è¡¨ç¾ã§ã¯ã‚りã¾ã›ã‚“。: %2 - - B8 - + + %1 is an invalid flag for regular expressions. Valid flags are: + %1 ã¯æ­£è¦è¡¨ç¾ã«ãŠã„ã¦ç„¡åйãªãƒ•ラグã§ã™ã€‚使用å¯èƒ½ãªãƒ•ãƒ©ã‚°ã¯æ¬¡ã®é€šã‚Šã§ã™: - - B9 - + + If the first argument is the empty sequence or a zero-length string (no namespace), a prefix cannot be specified. Prefix %1 was specified. + ã‚‚ã—ã€æœ€åˆã®å¼•æ•°ãŒç©ºç™½ã‹ã‚‰ãªã‚‹æ–‡å­—列ã‹ã€é•·ã•ãŒ0 (åå‰ç©ºé–“ã‚’ã¨ã‚‚ãªã‚ãªã„)ã§ã‚ã‚‹å ´åˆã€ãƒ—レフィックスを指定ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。ã—ã‹ã—ã€ãƒ—レフィックスã¨ã—㦠%1 ãŒæŒ‡å®šã•れã¦ã„ã¾ã™ã€‚ - - B10 - + + It will not be possible to retrieve %1. + %1 ã‚’å–å¾—ã™ã‚‹ã“ã¨ã¯ã§ããªã„ã‹ã‚‚ã—れã¾ã›ã‚“。 - - C5E - + + The default collection is undefined + デフォルトã®ã‚³ãƒ¬ã‚¯ã‚·ãƒ§ãƒ³ãŒå®šç¾©ã•れã¦ã„ã¾ã›ã‚“ - - DLE - + + %1 cannot be retrieved + %1 ã‚’å–å¾—ã§ãã¾ã›ã‚“ - - Executive - + + The normalization form %1 is unsupported. The supported forms are %2, %3, %4, and %5, and none, i.e. the empty string (no normalization). + ã¤ã¾ã‚Šã€ç©ºç™½ã®æ–‡å­—ã§ã™ã€ã¯ã©ã†ã§ã‚‚ã„ã„よã­ã€‚ + æ­£è¦åŒ–ã•れãŸè¡¨ç¾ %1 ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“。サãƒãƒ¼ãƒˆã•れã¦ã„る表ç¾ã¯ã€%2, %3, %4, %5 ã®ã¿ã§ã™ã€‚ - - Folio - + + A zone offset must be in the range %1..%2 inclusive. %3 is out of range. + ゾーンオフセットã¯ã€%1 ã‹ã‚‰ %2 ã®ç¯„囲ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™(境界をå«ã‚€)。%3 ã¯ç¯„囲外ã§ã™ã€‚ - - Ledger - + + %1 is not a whole number of minutes. + %1 ã¯ã€åˆ†ã‚’ç¾ã™å€¤ã§ã¯ã‚りã¾ã›ã‚“。 - - Legal - + + The URI cannot have a fragment + ã“ã® URI ã¯ãƒ•ラグメントをもã¤ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - Letter - + + Required cardinality is %1; got cardinality %2. + カーディナリティ %1 ãŒå¿…è¦ã§ã™ã€‚%2 ã§ã¯ã‚りã¾ã›ã‚“。 - - Tabloid - + + The item %1 did not match the required type %2. + アイテム %1 ã¯ã€è¦æ±‚ã•れãŸåž‹ %2 ã«ãƒžãƒƒãƒã—ã¾ã›ã‚“。 - - US Common #10 Envelope - + + Attribute %1 cannot appear on the element %2. Only the standard attributes can appear. + エレメント %2 ã«å±žæ€§ %1 を指定ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。標準ã®å±žæ€§ã®ã¿ãŒè¨±å¯ã•れã¦ã„ã¾ã™ã€‚ - - Custom - + + Attribute %1 cannot appear on the element %2. Only %3 is allowed, and the standard attributes. + エレメント %2 ã«å±žæ€§ %1 を指定ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。%3 ã¨æ¨™æº–ã®å±žæ€§ã®ã¿ãŒè¨±å¯ã•れã¦ã„ã¾ã™ã€‚ - - - &Options >> - + + Attribute %1 cannot appear on the element %2. Allowed is %3, %4, and the standard attributes. + エレメント %2 ã«å±žæ€§ %1 を指定ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。%3, %4 ã¨æ¨™æº–ã®å±žæ€§ã®ã¿ãŒè¨±å¯ã•れã¦ã„ã¾ã™ã€‚ - - &Print - + + Attribute %1 cannot appear on the element %2. Allowed is %3, and the standard attributes. + エレメント %2 ã« %1 ã¯æŒ‡å®šã§ãã¾ã›ã‚“。%3 ã¨æ¨™æº–ã®å±žæ€§ã®ã¿ãŒæŒ‡å®šã§ãã¾ã™ã€‚ - - &Options << - + + XSL-T attributes on XSL-T elements must be in the null namespace, not in the XSL-T namespace which %1 is. + XSLT エレメントã«å¯¾ã™ã‚‹XSLT属性ã¯ã€åå‰ç©ºé–“ãŒnullã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。%1 ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。 - - Print to File (PDF) - + + The attribute %1 must appear on element %2. + 属性 %1 ã¯ã€ã‚¨ãƒ¬ãƒ¡ãƒ³ãƒˆ %2 ã«ã®ã¿è¨˜è¿°ã§ãã¾ã™ã€‚ - - Print to File (Postscript) - + + The element with local name %1 does not exist in XSL-T. + ローカルå %1 ã®ã‚¨ãƒ¬ãƒ¡ãƒ³ãƒˆã¯ã€XSLTã«å­˜åœ¨ã—ã¾ã›ã‚“。 - - Local file - + + The variable %1 is unused + 値 %1 ã¯ä½¿ç”¨ã•れã¾ã›ã‚“ã§ã—㟠- - Write %1 file - + + A construct was encountered which only is allowed in XQuery. + XQuery ã§ã®ã¿è¨±å¯ã•れã¦ã„ã‚‹ construct ã«é­é‡ã—ã¾ã—ãŸã€‚ - - The 'From' value cannot be greater than the 'To' value. - + + + %1 is an unknown schema type. + %1 ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ãªã„スキーマã®ã‚¿ã‚¤ãƒ—ã§ã™ã€‚ - - - QPrintPreviewDialog - - - Page Setup - + + A template by name %1 has already been declared. + テンプレートå '%1' ã¯ã€æ—¢ã«å®£è¨€ã•れã¦ã„ã¾ã™ã€‚ - - %1% - + + %1 is not a valid numeric literal. + %1 ã¯æ•°å€¤ãƒªãƒ†ãƒ©ãƒ«ã¨ã—ã¦ç„¡åйã§ã™ã€‚ - - Print Preview - + + Only one %1 declaration can occur in the query prolog. + クェリーã®ãƒ—ロローグã§ã¯ã€%1 ã¯ä¸€å›žã®ã¿å®£è¨€ã§ãã¾ã™ã€‚ - - Next page - + + The initialization of variable %1 depends on itself + å†å¸°? + 値 %1 ã®åˆæœŸåŒ–ã¯ã€ãれ自身ã«ä¾å­˜ã—ã¦ã„ã¾ã™ - - Previous page - + + No variable by name %1 exists + 変数 %1 ã¯å­˜åœ¨ã—ã¾ã›ã‚“ - - First page - + + Version %1 is not supported. The supported XQuery version is 1.0. + ãƒãƒ¼ã‚¸ãƒ§ãƒ³ %1 ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“。XQuery ãƒãƒ¼ã‚¸ãƒ§ãƒ³ 1.0 ã®ã¿ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã™ã€‚ - - Last page - + + The encoding %1 is invalid. It must contain Latin characters only, must not contain whitespace, and must match the regular expression %2. + エンコーディング '%1' ã¯ç„¡åйã§ã™ã€‚ラテン文字 (空白を除ã) ã‹ã‚‰ãªã‚‹ã‚‚ã®ã§ã€æ­£è¦è¡¨ç¾ '%2' ã«ãƒžãƒƒãƒã™ã‚‹ã‚‚ã®ã®ã¿ä½¿ç”¨ã§ãã¾ã™ã€‚ - - Fit width - + + No function with signature %1 is available + ã‚·ã‚°ãƒãƒãƒ£ %1 ã‚’ã‚‚ã¤é–¢æ•°ãŒã¿ã¤ã‹ã‚Šã¾ã›ã‚“ - - Fit page - + + + A default namespace declaration must occur before function, variable, and option declarations. + 標準ã®åå‰ç©ºé–“ã®å®£è¨€ã¯ã€é–¢æ•°ã€å¤‰æ•°ã€ã‚ªãƒ—ションã®å®£è¨€ã®å‰ã«ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 + + + + Namespace declarations must occur before function, variable, and option declarations. + åå‰ç©ºé–“ã®å®£è¨€ã¯ã€é–¢æ•°ã€å¤‰æ•°ã€ã‚ªãƒ—ションã®å®£è¨€ã®å‰ã«ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - Zoom in - + Module imports must occur before function, variable, and option declarations. + モジュールã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã¯ã€é–¢æ•°ã€å¤‰æ•°ã€ã‚ªãƒ—ションã®å®£è¨€ã®å‰ã«ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - Zoom out - + + The keyword %1 cannot occur with any other mode name. + キーワード %1 ã¯ã€ä»–ã®åã‚’ã¨ã‚‚ãªã£ã¦ä½¿ç”¨ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - Portrait - 縦 + + The value of attribute %1 must of type %2, which %3 isn't. + 属性 '%1' ã®å€¤ã¨ã—㦠'%3' ãŒæŒ‡å®šã•れã¾ã—ãŸãŒã€åž‹ '%2' ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - Landscape - 横 + + It is not possible to redeclare prefix %1. + プレフィックス '%1' ã‚’å†å®šç¾©ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - Show single page - + + The prefix %1 can not be bound. By default, it is already bound to the namespace %2. + プレフィックス '%1' ã¯ãƒã‚¦ãƒ³ãƒ‰ã§ãã¾ã›ã‚“。デフォルトã§ã¯ã€ãã‚Œã¯æ—¢ã«åå‰ç©ºé–“ '%2' ã«ãƒã‚¦ãƒ³ãƒ‰ã•れã¦ã„ã¾ã™ã€‚ - - Show facing pages - + + Prefix %1 is already declared in the prolog. + プロローグ部ã«ãŠã„ã¦ã€ãƒ—レフィックス '%1' ã¯ã™ã§ã«å®£è¨€ã•れã¦ã„ã¾ã™ã€‚ - - Show overview of all pages - + + The name of an option must have a prefix. There is no default namespace for options. + オプションã®åå‰ã¯ãƒ—レフィックスをもãŸãªã‘れã°ãªã‚Šã¾ã›ã‚“。ã“ã®ã‚ªãƒ—ションã«å¯¾ã™ã‚‹ãƒ‡ãƒ•ォルトã®åå‰ç©ºé–“ã¯å­˜åœ¨ã—ã¾ã›ã‚“。 - - Print - + + The Schema Import feature is not supported, and therefore %1 declarations cannot occur. + ã“ã®ã‚¹ã‚­ãƒ¼ãƒžã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆæ©Ÿèƒ½ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。ã¾ãŸã€'%1' 宣言も使用ã§ãã¾ã›ã‚“。 - - Page setup - + + The target namespace of a %1 cannot be empty. + åå‰ç©ºé–“ '%1' ã¯ã€ç©ºã§ã‚ã£ã¦ã¯ãªã‚Šã¾ã›ã‚“。 - - Close - é–‰ã˜ã‚‹ + + The module import feature is not supported + モジュールインãƒãƒ¼ãƒˆã®æ©Ÿèƒ½ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ - - Export to PDF - + + A variable by name %1 has already been declared. + åå‰ '%1' ã®å¤‰æ•°ã¯ã€ã™ã§ã«å®£è¨€ã•れã¦ã„ã¾ã™ã€‚ - - Export to PostScript - + + No value is available for the external variable by name %1. + 外部変数 '%1' ã®å€¤ãŒã¿ã¤ã‹ã‚Šã¾ã›ã‚“。 - - - QPrintPropertiesDialog - PPD Properties - å°åˆ·ãƒ—ロパティã®ãƒ€ã‚¤ã‚¢ãƒ­ã‚°ã®ãƒ—ロパティ + + A stylesheet function must have a prefixed name. + スタイルシート関数ã¯ã€ãƒ—レフィックスåã‚’æŒãŸãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - Save - ä¿å­˜ + + The namespace for a user defined function cannot be empty (try the predefined prefix %1 which exists for cases like this) + ユーザ定義ã®é–¢æ•°ã®åå‰ç©ºé–“ã¯ã€ç©ºã§ã‚ã£ã¦ã¯ãªã‚Šã¾ã›ã‚“。(ã™ã§ã«å®šç¾©ã•れã¦ã„るプレフィックス '%1' ãŒä½¿ç”¨ã§ãã¾ã™) - OK - OK + + The namespace %1 is reserved; therefore user defined functions may not use it. Try the predefined prefix %2, which exists for these cases. + åå‰ç©ºé–“ '%1' ã¯äºˆç´„済ã§ã™ã€‚ユーザ定義ã®é–¢æ•°ã§ã¯ä½¿ç”¨ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。プレフィックス '%2' ãŒä½¿ç”¨ã§ãã¾ã™ã€‚ - - - QPrintPropertiesWidget - - Form - + + The namespace of a user defined function in a library module must be equivalent to the module namespace. In other words, it should be %1 instead of %2 + ライブラリモジュールã§ä½¿ç”¨ã•れã¦ã„ã‚‹åå‰ç©ºé–“ã¯ã€ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã®åå‰ç©ºé–“ã¨åŒä¸€ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。ã¤ã¾ã‚Šã€'%2' ã§ã¯ãªãã€'%1' ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“ - - Page - + + A function already exists with the signature %1. + ã‚·ã‚°ãƒãƒãƒ£ãƒ¼ '%1' ã®é–¢æ•°ã¯ã™ã§ã«å­˜åœ¨ã—ã¦ã„ã¾ã™ã€‚ - - Advanced - + + No external functions are supported. All supported functions can be used directly, without first declaring them as external + 外部関数ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“。ã™ã¹ã¦ã®ã‚µãƒãƒ¼ãƒˆã•れã¦ã„る関数ã¯ã€å¤–部宣言をã™ã‚‹ã“ã¨ãªãã€ç›´æŽ¥ä½¿ç”¨ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ - - - QPrintSettingsOutput - - Form - + + An argument by name %1 has already been declared. Every argument name must be unique. + 引数å '%1' ã¯æ—¢ã«å®£è¨€ã•れã¦ã„ã¾ã™ã€‚ã™ã¹ã¦ã®å¼•æ•°åã¯ãƒ¦ãƒ‹ãƒ¼ã‚¯ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ - - Copies - å°åˆ·éƒ¨æ•° + + When function %1 is used for matching inside a pattern, the argument must be a variable reference or a string literal. + パターン一致ã®å†…å´ã§é–¢æ•° '%1' を使用ã™ã‚‹å ´åˆã€å¼•æ•°ã¯ãƒªãƒ†ãƒ©ãƒ«ãªæ–‡å­—列をå‚ç…§ã™ã‚‹å€¤ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - Print range - å°åˆ·ç¯„囲 + + In an XSL-T pattern, the first argument to function %1 must be a string literal, when used for matching. + XSL-T パターンマッãƒãƒ³ã‚°ã«ãŠã„ã¦ã€é–¢æ•° '%1' ã®æœ€åˆã®å¼•æ•°ã¯ã€ãƒªãƒ†ãƒ©ãƒ«ãªæ–‡å­—列ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - Print all - ã™ã¹ã¦å°åˆ· + + In an XSL-T pattern, the first argument to function %1 must be a literal or a variable reference, when used for matching. + variable ref? + XSL-T パターンマッãƒãƒ³ã‚°ã«ãŠã„ã¦ã€é–¢æ•° '%1' ã¸ã®æœ€åˆã®å¼•æ•°ã¯ã€ãƒªãƒ†ãƒ©ãƒ«ã‹å¤‰æ•°ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - Pages from - 先頭ã®ãƒšãƒ¼ã‚¸: + + In an XSL-T pattern, function %1 cannot have a third argument. + XSL-T パターンã«ãŠã„ã¦ã€é–¢æ•° '%1' ã¯ä¸‰ã¤ã®å¼•æ•°ã‚’ã‚‚ã¤ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - to - 末尾ã®ãƒšãƒ¼ã‚¸: + + In an XSL-T pattern, only function %1 and %2, not %3, can be used for matching. + XSL-T パターンマッãƒãƒ³ã‚°ã«ãŠã„ã¦ã€é–¢æ•° '%1' 㨠'%2' ã®ã¿ä½¿ç”¨ã§ãã¾ã™ã€‚'%3' ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。 - - Selection - é¸æŠžã—ãŸéƒ¨åˆ†ã‚’å°åˆ· + + In an XSL-T pattern, axis %1 cannot be used, only axis %2 or %3 can. + XSL-T パターンã«ãŠã„ã¦ã€axis %1 ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。%2 ã¾ãŸã¯ %3 ã®ã¿ä½¿ç”¨ã§ãã¾ã™ã€‚ - - Output Settings - + + %1 is an invalid template mode name. + %1 ã¯ãƒ†ãƒ³ãƒ—レートモジュールåã¨ã—ã¦ç„¡åйã§ã™ã€‚ - - Copies: - + + The name of a variable bound in a for-expression must be different from the positional variable. Hence, the two variables named %1 collide. + for æ§‹æ–‡ã«ãŠã„ã¦ä½¿ç”¨ã™ã‚‹å¤‰æ•°ã¯ã€å ´æ‰€ã«é–¢ã™ã‚‹å¤‰æ•°ã¨ã¯ç•°ãªã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ã¤ã¾ã‚Šã€'%1' ãŒé‡è¤‡ã—ã¦ä½¿ç”¨ã•れã¦ã„ã¾ã™ã€‚ - - Collate - ä¸åˆã„ + + The Schema Validation Feature is not supported. Hence, %1-expressions may not be used. + ã‚¹ã‚­ãƒ¼ãƒžã®æ¤œè¨¼æ©Ÿèƒ½ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“。よã£ã¦ã€'%1' æ§‹æ–‡ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。 - - Reverse - + + None of the pragma expressions are supported. Therefore, a fallback expression must be present + pragma æ§‹æ–‡ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“。fallback æ§‹æ–‡ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“ - - Options - + + Each name of a template parameter must be unique; %1 is duplicated. + テンプレートパラメータåã¯ãƒ¦ãƒ‹ãƒ¼ã‚¯ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚'%1' ã¯é‡è¤‡ã—ã¦ã„ã¾ã™ã€‚ - - Color Mode - + + The %1-axis is unsupported in XQuery + XQuery ã«ãŠã„ã¦ã€%1 axis ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ - - Color - + + No function by name %1 is available. + 関数å '%1' ã¯ã¿ã¤ã‹ã‚Šã¾ã›ã‚“。 - - Grayscale - + + The namespace URI cannot be the empty string when binding to a prefix, %1. + プレフィックス '%1' ã«ãƒã‚¤ãƒ³ãƒ‡ã‚£ãƒ³ã‚°ã™ã‚‹åå‰ç©ºé–“ã® URI ã¯ã€ç©ºã§ã‚ã£ã¦ã¯ãªã‚Šã¾ã›ã‚“。 - - Duplex Printing - + + %1 is an invalid namespace URI. + %1 ã¯åå‰ç©ºé–“ URI ã¨ã—ã¦ç„¡åйã§ã™ã€‚ - - None - + + It is not possible to bind to the prefix %1 + プレフィックス %1 ã«ãƒã‚¤ãƒ³ãƒ‰ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - Long side - + + Namespace %1 can only be bound to %2 (and it is, in either case, pre-declared). + ? + åå‰ç©ºé–“ %1 㯠%2 ã«ã®ã¿ãƒã‚¦ãƒ³ãƒ‰ã§ãã¾ã™ã€‚ - - Short side - + + Prefix %1 can only be bound to %2 (and it is, in either case, pre-declared). + プリフィックス %1 㯠%2 ã«ã®ã¿ãƒã‚¦ãƒ³ãƒ‰ã§ãã¾ã™ã€‚ - - - QPrintWidget - - Form - + + Two namespace declaration attributes have the same name: %1. + 二ã¤ã®åå‰ç©ºé–“宣言ã®å±žæ€§ãŒã€åŒã˜åå‰ '%1' ã‚’ã‚‚ã£ã¦ã„ã¾ã™ã€‚ - - Printer - プリンタ + + The namespace URI must be a constant and cannot use enclosed expressions. + åå‰ç©ºé–“ URI ã¯ã€constantã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。å¼ã‚’å«ã‚€ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - &Name: - + + An attribute by name %1 has already appeared on this element. + 属性å '%1' ã¯ã€ã™ã§ã«ã“ã®ã‚¨ãƒ¬ãƒ¡ãƒ³ãƒˆã§ä½¿ç”¨ã•れã¦ã„ã¾ã™ã€‚ - - P&roperties - + + A direct element constructor is not well-formed. %1 is ended with %2. + ç›´ç©çš„ãªæŒ‡å®šã®ã‚¨ãƒ¬ãƒ¡ãƒ³ãƒˆãŒwell formedã§ã¯ã‚りã¾ã›ã‚“。'%1' ãŒã€'%2' ã§çµ‚ã‚ã£ã¦ã„ã¾ã™ã€‚ - - Location: - + + The name %1 does not refer to any schema type. + åå‰ '%1' ã¯ã€ãªã‚“ã®ã‚¹ã‚­ãƒ¼ãƒžã‚¿ã‚¤ãƒ—ã‚‚å‚ç…§ã—ã¦ã„ã¾ã›ã‚“。 - - Preview - + + %1 is an complex type. Casting to complex types is not possible. However, casting to atomic types such as %2 works. + '%1' 㯠complex åž‹ã§ã™ã€‚complex åž‹ã¸ã®åž‹å¤‰æ›ã¯ã§ãã¾ã›ã‚“。ã—ã‹ã—ã€ã‚¢ãƒˆãƒŸãƒƒã‚¯ãªåž‹ã§ã‚ã‚‹ '%2' ã¸ã®å¤‰æ›ã¯ã§ãã¾ã™ã€‚ - - Type: - + + %1 is not an atomic type. Casting is only possible to atomic types. + '%1' ã¯ã‚¢ãƒˆãƒŸãƒƒã‚¯ãªåž‹ã§ã¯ã‚りã¾ã›ã‚“。型変æ›ã¯ã‚¢ãƒˆãƒŸãƒƒã‚¯ãªåž‹ã«å¯¾ã—ã¦ã®ã¿å¯èƒ½ã§ã™ã€‚ - - Output &file: - + + %1 is not a valid name for a processing-instruction. + å‡¦ç†æŒ‡å®šã«ãŠã„ã¦ã€'%1' ã¯ç„¡åйã§ã™ã€‚ - - ... - + + + %1 is not in the in-scope attribute declarations. Note that the schema import feature is not supported. + '%1' ã¯ã€ã‚¹ã‚³ãƒ¼ãƒ—属性宣言ã§ã¯ã‚りã¾ã›ã‚“。スキーマインãƒãƒ¼ãƒˆæ©Ÿèƒ½ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“。 - - - QProcess - - - Could not open input redirection for reading - + + The name of an extension expression must be in a namespace. + æ‹¡å¼µå¼ (extension expression) ã®åå‰ã¯ã€åå‰ç©ºé–“ã®ä¸­ã«ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - - Could not open output redirection for writing - + + Element %1 is not allowed at this location. + ã“ã®å ´æ‰€ã«ã‚¨ãƒ¬ãƒ¡ãƒ³ãƒˆ '%1' ã‚’ãŠãã“ã¨ã¯è¨±ã•れã¦ã„ã¾ã›ã‚“。 - - Resource error (fork failure): %1 - + + Text nodes are not allowed at this location. + ã“ã®å ´æ‰€ã«ãƒ†ã‚­ã‚¹ãƒˆãƒŽãƒ¼ãƒ‰ã‚’ãŠãã“ã¨ã¯è¨±ã•れã¦ã„ã¾ã›ã‚“。 - - - - - - - - - - Process operation timed out - + + Parse error: %1 + パースエラー: %1 - - - - - Error reading from process - + + The value of the XSL-T version attribute must be a value of type %1, which %2 isn't. + XSL-T ãƒãƒ¼ã‚¸ãƒ§ãƒ³å±žæ€§ã®å€¤ã¯ã€'%1' åž‹ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。'%2' ã¯ãã†ã§ã¯ã‚りã¾ã›ã‚“。 - - - - Error writing to process - + + Running an XSL-T 1.0 stylesheet with a 2.0 processor. + XSL-T 1.0 ã®ã‚¹ã‚¿ã‚¤ãƒ«ã‚·ãƒ¼ãƒˆã‚’ 2.0 ã®ãƒ—ロセッサã§ä½¿ç”¨ã—ã¾ã™ã€‚ - - Process crashed - + + Unknown XSL-T attribute %1. + 未知㮠XSL-T 属性 %1 ãŒã‚りã¾ã™ã€‚ - - No program defined - + + Attribute %1 and %2 are mutually exclusive. + 属性 '%1' 㨠'%2' ã¯æŽ’ä»–çš„ã«ã®ã¿ä½¿ç”¨ã§ãã¾ã™ã€‚ - - Process failed to start - + + In a simplified stylesheet module, attribute %1 must be present. + simplified stylesheet モジュールã«ãŠã„ã¦ã¯ã€å±žæ€§ '%1' を指定ã•れãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - - QProgressDialog - - Cancel - キャンセル + + If element %1 has no attribute %2, it cannot have attribute %3 or %4. + エレメント '%1' ãŒå±žæ€§ '%2' ã‚’æŒãŸãªã„å ´åˆã¯ã€å±žæ€§ '%3' ã‚„ '%4' を使用ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - - QPushButton - - Open - オープン + + Element %1 must have at least one of the attributes %2 or %3. + エレメント '%1' ã¯ã€å±žæ€§ '%2' ã‹ '%3' ã®ã„ãšã‚Œã‹ã‚’æŒãŸãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - - QRadioButton - - Check - é¸æŠž + + At least one mode must be specified in the %1-attribute on element %2. + エレメント '%2' ã«ãŠã„ã¦ã€'%1' 属性ã¯å°‘ãã¨ã‚‚一ã¤ã®ãƒ¢ãƒ¼ãƒ‰ã‚’指定ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - - QRegExp - - no error occurred - エラーã¯ç™ºç”Ÿã—ã¾ã›ã‚“ã§ã—㟠+ + Element %1 must come last. + エレメント %1 ã¯æœ€å¾Œã«ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - disabled feature used - ç„¡åŠ¹ãªæ©Ÿèƒ½ãŒä½¿ç”¨ã•れã¾ã—㟠+ + At least one %1-element must occur before %2. + %2 ã®å‰ã«ã€å°‘ãã¨ã‚‚一ã¤ã¯ %1 エレメントãŒå­˜åœ¨ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - bad char class syntax - 䏿­£ãªcharクラス構文 + + Only one %1-element can appear. + %1 エレメントã¯ä¸€ã¤ã®ã¿å­˜åœ¨ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - bad lookahead syntax - 䏿­£ãªlookaheadæ§‹æ–‡ + + At least one %1-element must occur inside %2. + %2 ã®å†…å´ã«ã¯ã€å°‘ãã¨ã‚‚一ã¤ã® '%1' エレメントãŒå­˜åœ¨ã—ãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - bad repetition syntax - 䏿­£ãªrepetitionæ§‹æ–‡ + + When attribute %1 is present on %2, a sequence constructor cannot be used. + %2 ã«å±žæ€§ %1 ãŒã‚ã‚‹å ´åˆã€sequence constructor ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。 - - invalid octal value - 無効ãª8進値 + + Element %1 must have either a %2-attribute or a sequence constructor. + エレメント %1 ã«ã¯ã€%2 属性ã¾ãŸã¯sequence constructorãŒãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - missing left delim - å·¦ã®åŒºåˆ‡ã‚Šæ–‡å­—ãŒã‚りã¾ã›ã‚“ + + When a parameter is required, a default value cannot be supplied through a %1-attribute or a sequence constructor. + パラメータãŒè¦æ±‚ã•れã¦ã„ã‚‹ã¨ãã«ã¯ã€ãƒ‡ãƒ•ォルトã®å€¤ã¯ã€%1 属性ã¾ãŸã¯ sequence constructor ã«ã‚ˆã£ã¦æŒ‡å®šã•れã¦ã„ã¦ã¯ãªã‚Šã¾ã›ã‚“。 - - unexpected end - 予期ã—ãªã„末尾ã§ã™ + + Element %1 cannot have children. + エレメント %1 ã¯ã€å­è¦ç´ ã‚’æŒã¤ã“ã¨ãŒã§ãã¾ã›ã‚“。 - - met internal limit - 内部制é™ã‚’満ãŸã—ã¾ã—㟠+ + Element %1 cannot have a sequence constructor. + エレメント %1 ã¯ã€sequence constructor ã‚’å«ã‚€ã“ã¨ãŒã§ãã¾ã›ã‚“。 - - - QSQLite2Driver - - Error to open database - データベースã®ã‚ªãƒ¼ãƒ—ンã§ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠+ + + The attribute %1 cannot appear on %2, when it is a child of %3. + %2 ㌠%3 ã®å­è¦ç´ ã§ã‚ã‚‹ã¨ãã¯ã€å±žæ€§ %1 を使用ã—ã¦ã¯ãªã‚Šã¾ã›ã‚“。 - - Unable to begin transaction - トランザクションを開始ã§ãã¾ã›ã‚“ + + A parameter in a function cannot be declared to be a tunnel. + 関数ã¸ã®ãƒ‘ラメータã¯ã€ãƒˆãƒ³ãƒãƒ«ã§ã‚ã£ã¦ã¯ãªã‚Šã¾ã›ã‚“。 - - Unable to commit transaction - トランザクションをコミットã§ãã¾ã›ã‚“ + + This processor is not Schema-aware and therefore %1 cannot be used. + ã“ã®å‡¦ç†ç³»ã¯ã€Schema-aware ã§ã¯ã‚りã¾ã›ã‚“。よã£ã¦ã€%1 ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。 - - Unable to rollback Transaction - トランザクションをロールãƒãƒƒã‚¯ã§ãã¾ã›ã‚“ + + Top level stylesheet elements must be in a non-null namespace, which %1 isn't. + トップレベルã®ã‚¹ã‚¿ã‚¤ãƒ«ã‚·ãƒ¼ãƒˆã®ã‚¨ãƒ¬ãƒ¡ãƒ³ãƒˆã¯ã€non-nullãªåå‰ç©ºé–“ã‚’æŒã£ã¦ã„ãªã‘れã°ãªã‚Šã¾ã›ã‚“。ã—ã‹ã—ã€%1 ã¯ãã†ã§ã¯ã‚りã¾ã›ã‚“。 - - - QSQLite2Result - - Unable to fetch results - å®Ÿè¡Œçµæžœã‚’フェッãƒã§ãã¾ã›ã‚“ + + The value for attribute %1 on element %2 must either be %3 or %4, not %5. + エレメント %2 ã®å±žæ€§ %1 ã®å€¤ã¯ã€%3 ã¾ãŸã¯ %4 ã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“。%5 ã¯ç•°ãªã‚Šã¾ã™ã€‚ - - Unable to execute statement - ステートメントを実行ã§ãã¾ã›ã‚“ + + Attribute %1 cannot have the value %2. + 属性 %1 ã«ã€å€¤ %2 を指定ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - - QSQLiteDriver - - Error opening database - データベースã®ã‚ªãƒ¼ãƒ—ンã§ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠+ + The attribute %1 can only appear on the first %2 element. + 属性 %1 ã¯ã€æœ€åˆã® %2 エレメントã«ã®ã¿æŒ‡å®šã§ãã¾ã™ã€‚ - - Error closing database - データベースã®ã‚¯ãƒ­ãƒ¼ã‚ºã§ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠+ + At least one %1 element must appear as child of %2. + %2 ã®å­è¦ç´ ã¨ã—ã¦ã¯ã€å°‘ãã¨ã‚‚一ã¤ã¯ %1 エレメントãŒãªã‘れã°ãªã‚Šã¾ã›ã‚“。 - - Unable to begin transaction - トランザクションを開始ã§ãã¾ã›ã‚“ + + empty + 空 - - Unable to commit transaction - トランザクションをコミットã§ãã¾ã›ã‚“ + + zero or one + ゼロã¾ãŸã¯ä¸€ã¤ - Unable to roll back transaction - トランザクションをロールãƒãƒƒã‚¯ã§ãã¾ã›ã‚“ + + exactly one + 厳密ã«ä¸€ã¤ - - Unable to rollback transaction - トランザクションをロールãƒãƒƒã‚¯ã§ãã¾ã›ã‚“ + + one or more + 一ã¤ã¾ãŸã¯è¤‡æ•° - - - QSQLiteResult - - - - Unable to fetch row - レコードをフェッãƒã§ãã¾ã›ã‚“ + + zero or more + ゼロã¾ãŸã¯ãれ以上 - - Unable to execute statement - ステートメントを実行ã§ãã¾ã›ã‚“ + + Required type is %1, but %2 was found. + è¦æ±‚ã•れã¦ã„る型㯠%1 ã§ã™ãŒã€ %2 ãŒã‚りã¾ã™ã€‚ - - Unable to reset statement - ステートメントをリセットã§ãã¾ã›ã‚“ + + Promoting %1 to %2 may cause loss of precision. + %1 ã‚’ %2 ã«å¤‰æ›ã™ã‚‹éš›ã«ã€ç²¾åº¦ã®ãƒ­ã‚¹ãŒç”Ÿã˜ã¾ã™ã€‚ - - Unable to bind parameters - パラメータをãƒã‚¤ãƒ³ãƒ‰ã§ãã¾ã›ã‚“ + + The focus is undefined. + フォーカスãŒå®šç¾©ã•れã¦ã„ã¾ã›ã‚“。 + + + + It's not possible to add attributes after any other kind of node. + ä»–ã®ç¨®é¡žã®ãƒŽãƒ¼ãƒ‰ã®ä¸­ã§ã¯ã€å±žæ€§ã‚’追加ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - Parameter count mismatch - ãƒ‘ãƒ©ãƒ¡ãƒ¼ã‚¿ã®æ•°ãŒåˆã£ã¦ã„ã¾ã›ã‚“ + An attribute by name %1 has already been created. + åå‰ '%1' ã®å±žæ€§ã¯ã€ã™ã§ã«ç”Ÿæˆã•れã¦ã„ã¾ã™ã€‚ - - No query - + + Only the Unicode Codepoint Collation is supported(%1). %2 is unsupported. + UNICODE Codepoint Collection ã®ã¿ä½¿ç”¨ã§ãã¾ã™(%1)。 %2 ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“。 - QScrollBar + QPluginLoader - - Scroll here - ã“ã“ã«ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + Unknown error + 䏿˜Žãªã‚¨ãƒ©ãƒ¼ - - Left edge - 左端 + + The plugin was not loaded. + ãã®ãƒ—ラグインã¯ãƒ­ãƒ¼ãƒ‰ã•れã¦ã„ã¾ã›ã‚“。 + + + QPrintDialog - - Top - 上端 + Page size: + ページサイズ: - - Right edge - å³ç«¯ + Orientation: + æ–¹å‘: - - Bottom - 下端 + Paper source: + 給紙装置: - - Page left - 1ページ左ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + OK + OK - - - Page up - 1ページ戻る + Cancel + キャンセル - - Page right - 1ページå³ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + Portrait + 縦 - - - Page down - 1ページ進む + Landscape + 横 - - Scroll left - å·¦ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + locally connected + ãƒ­ãƒ¼ã‚«ãƒ«ã«æŽ¥ç¶šã—ã¦ã„ã¾ã™ - - Scroll up - 上ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + + Aliases: %1 + エイリアス: %1 - - Scroll right - å³ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + + unknown + 䏿˜Ž - - Scroll down - 下ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + Print in color if available + å¯èƒ½ã§ã‚れã°ã‚«ãƒ©ãƒ¼ã§å°åˆ· - - Line up - 1行上㸠+ Print to file + ファイルã«å‡ºåŠ›: - - Position - ä½ç½® + Browse + å‚ç…§... - - Line down - 1行下㸠+ + Print all + ã™ã¹ã¦å°åˆ· - - - QSharedMemory - - %1: unable to set key on lock - + Selection + é¸æŠžã—ãŸéƒ¨åˆ†ã‚’å°åˆ· - - %1: create size is less then 0 - + + Print range + å°åˆ·ç¯„囲 - - - %1: unable to lock - + Pages from + 先頭ã®ãƒšãƒ¼ã‚¸: - - %1: unable to unlock - + to + 末尾ã®ãƒšãƒ¼ã‚¸: - - - %1: permission denied - + Print last page first + 末尾ã®ãƒšãƒ¼ã‚¸ã‹ã‚‰å°åˆ· - - - %1: already exists - + Number of copies: + 部数: - - - %1: doesn't exists - + Paper format + 用紙ã®å½¢å¼ - - - %1: out of resources - + + A0 (841 x 1189 mm) + A0 (841 x 1189mm) - - - %1: unknown error %2 - + + A1 (594 x 841 mm) + A1 (594 x 841mm) - - %1: key is empty - + + A2 (420 x 594 mm) + A2 (420 x 594mm) - - %1: unix key file doesn't exists - + + A3 (297 x 420 mm) + A3 (297 x 420mm) - - %1: ftok failed - + + A4 (210 x 297 mm, 8.26 x 11.7 inches) + A4 (210 x 297mmã€8.26 x 11.7インãƒ) - - - %1: unable to make key - + + A5 (148 x 210 mm) + A5 (148 x 210mm) - - %1: system-imposed size restrictions - + + A6 (105 x 148 mm) + A6 (105 x 148mm) - - %1: not attached - + + A7 (74 x 105 mm) + A7 (74 x 105mm) - - %1: invalid size - + + A8 (52 x 74 mm) + A8 (52 x 74mm) - - %1: key error - + + A9 (37 x 52 mm) + A9 (37 x 52mm) - - %1: size query failed - + + B0 (1000 x 1414 mm) + B0 (1000 x 1414mm) - - - QShortcut - - Space - Space + + B1 (707 x 1000 mm) + B1 (707 x 1000mm) - Esc - Esc + B2 (500 x 707 mm) + B2 (500 x 707mm) - Tab - Tab + B3 (353 x 500 mm) + B3 (353 x 500mm) - Backtab - Backtab + B4 (250 x 353 mm) + B4 (250 x 353mm) - Backspace - Backspace + B5 (176 x 250 mm, 6.93 x 9.84 inches) + B5 (176 x 250mmã€6.93 x 9.84インãƒ) - Return - Return + B6 (125 x 176 mm) + B6 (125 x 176mm) - Enter - Enter + B7 (88 x 125 mm) + B7 (88 x 125mm) - Ins - Ins + B8 (62 x 88 mm) + B8 (62 x 88mm) - Del - Del + B9 (44 x 62 mm) + B9 (44 x 62mm) - Pause - Pause + B10 (31 x 44 mm) + B10 (31 x 44mm) - Print - Print + C5E (163 x 229 mm) + C5E (163 x 229mm) - SysReq - SysReq + DLE (110 x 220 mm) + DLE (110 x 220mm) - Home - Home + Executive (7.5 x 10 inches, 191 x 254 mm) + Executive (7.5 x 10インãƒã€191 x 254mm) - End - End + Folio (210 x 330 mm) + Folio (210 x 330mm) - Left - → + Ledger (432 x 279 mm) + Ledger (432 x 279mm) - Up - ↑ + Legal (8.5 x 14 inches, 216 x 356 mm) + Legal (8.5 x 14インãƒã€216 x 356mm) - Right - ↠+ Letter (8.5 x 11 inches, 216 x 279 mm) + Letter (8.5 x 11インãƒã€216 x 279mm) - Down - ↓ + Tabloid (279 x 432 mm) + Tabloid (279 x 432mm) - PgUp - PgUp + US Common #10 Envelope (105 x 241 mm) + US Common #10 Envelope (105 x 241mm) - - PgDown - PgDown + Print dialog + プリントダイアログ - - CapsLock - CapsLock + Size: + サイズ: - - NumLock - NumLock + Printer + プリンタ - - ScrollLock - ScrollLock + Properties + プロパティ - - Menu - メニュー + Printer info: + プリンタ情報: - - Help - ヘルプ + Copies + å°åˆ·éƒ¨æ•° - - Back - 戻る + Collate + ä¸åˆã„ - - Forward - 進む + Other + ãã®ä»– - - Stop - åœæ­¢ + Double side printing + 両é¢å°åˆ· - - Refresh - æ›´æ–°é–“éš” + + + + Print + å°åˆ· - - Volume Down - 音é‡ã‚’下ã’ã‚‹ + File + ファイル - - Volume Mute - 消音 + + Print To File ... + ファイルã¸å‡ºåŠ›... - - Volume Up - 音é‡ã‚’上ã’ã‚‹ + + File %1 is not writable. +Please choose a different file name. + ファイル %1 ã¯æ›¸ãè¾¼ã¿å¯èƒ½ã§ã¯ã‚りã¾ã›ã‚“。 +別ã®ãƒ•ァイルåã‚’é¸ã‚“ã§ãã ã•ã„。 - - Bass Boost - 低音ブースト + + %1 already exists. +Do you want to overwrite it? + %1 ã¯ã™ã§ã«å­˜åœ¨ã—ã¾ã™ã€‚ +上書ãã—ã¾ã™ã‹? - - Bass Up - 低音を上ã’ã‚‹ + + File exists + ãƒ•ã‚¡ã‚¤ãƒ«ã¯æ—¢ã«å­˜åœ¨ã—ã¦ã„ã¾ã™ - Bass Down - 低音を下ã’ã‚‹ + <qt>Do you want to overwrite it?</qt> + <qt>ファイルを上書ãã—ã¦ã‚‚よã‚ã—ã„ã§ã™ã‹?</qt> - - Treble Up - 高音を上ã’ã‚‹ + + Print selection + é¸æŠžã•れãŸç¯„囲をå°åˆ· - - Treble Down - 高音を下ã’ã‚‹ + + %1 is a directory. +Please choose a different file name. + %1 ã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã§ã™ã€‚ +ファイルåを指定ã—ã¦ãã ã•ã„。 + + + + A0 + A0 - Media Play - メディアã®å†ç”Ÿ + A1 + A1 - Media Stop - メディアã®åœæ­¢ + A2 + A2 - Media Previous - å‰ã®ãƒ¡ãƒ‡ã‚£ã‚¢ + A3 + A3 - Media Next - 次ã®ãƒ¡ãƒ‡ã‚£ã‚¢ + A4 + A4 - Media Record - メディアã®éŒ²éŸ³ + A5 + A5 - Home Page - ホームページ + A6 + A6 - Favorites - ãŠæ°—ã«å…¥ã‚Š + A7 + A7 - Search - 検索 + A8 + A8 - Standby - スタンãƒã‚¤ + A9 + A9 - Open URL - URLã‚’é–‹ã + B0 + B0 - Launch Mail - メールã®èµ·å‹• + B1 + B1 - Launch Media - メディアã®èµ·å‹• + B2 + B2 - Launch (0) - (0)ã®èµ·å‹• + B3 + B3 - Launch (1) - (1)ã®èµ·å‹• + B4 + B4 - Launch (2) - (2)ã®èµ·å‹• + B5 + B5 - Launch (3) - (3)ã®èµ·å‹• + B6 + B6 - Launch (4) - (4)ã®èµ·å‹• + B7 + B7 - Launch (5) - (5)ã®èµ·å‹• + B8 + B8 - Launch (6) - (6)ã®èµ·å‹• + B9 + B9 - Launch (7) - (7)ã®èµ·å‹• + B10 + B10 - Launch (8) - (8)ã®èµ·å‹• + C5E + C5E - Launch (9) - (9)ã®èµ·å‹• + DLE + DLE - Launch (A) - (A)ã®èµ·å‹• + Executive + Exclusive - Launch (B) - (B)ã®èµ·å‹• + Folio + Folio - Launch (C) - (C)ã®èµ·å‹• + Ledger + Ledger - Launch (D) - (D)ã®èµ·å‹• + Legal + リーガルサイズ - Launch (E) - (E)ã®èµ·å‹• + Letter + レターサイズ - Launch (F) - (F)ã®èµ·å‹• + Tabloid + タブロイドサイズ - - Print Screen - Print Screen + + US Common #10 Envelope + US標準#10å°ç­’ - Page Up - Page Up + Custom + カスタム - - Page Down - Page Down + + + &Options >> + オプション(&O) >> - - Caps Lock - Caps Lock + + &Print + å°åˆ·(&P) - - Num Lock - Num Lock + + &Options << + オプション(&O) << - - Number Lock - Number Lock + + Print to File (PDF) + PDFファイルã«å‡ºåŠ› - Scroll Lock - Scroll Lock + Print to File (Postscript) + Postscriptファイルã«å‡ºåŠ› + + + + Local file + ローカルファイル - Insert - Insert + Write %1 file + ファイル %1 ã«æ›¸ãè¾¼ã¿ã¾ã—㟠+ + + + The 'From' value cannot be greater than the 'To' value. + QPrintPropertiesWidgetã«Fromã¨ToãŒã‚ã£ã¦ãれを指ã—ã¦ã„ã‚‹ + å°åˆ·é–‹å§‹ãƒšãƒ¼ã‚¸ç•ªå·ã¯ã€å°åˆ·çµ‚了ページ番å·ã‚ˆã‚Šå°ã•ããªã‘れã°ãªã‚Šã¾ã›ã‚“。 + + + + QPrintPreviewDialog + + + + Page Setup + ページã®è¨­å®š + + + + %1% + %1% + + + + Print Preview + å°åˆ·ã®ãƒ—レビュー + + + + Next page + 次ã®ãƒšãƒ¼ã‚¸ - Delete - Delete + Previous page + å‰ã®ãƒšãƒ¼ã‚¸ - Escape - Escape + First page + 最åˆã®ãƒšãƒ¼ã‚¸ - System Request - System Request + Last page + 最後ã®ãƒšãƒ¼ã‚¸ - - Select - Select + + Fit width + å¹…ã‚’ã‚ã‚ã›ã‚‹ - Yes - ã¯ã„ + Fit page + 高ã•ã‚’ã‚ã‚ã›ã‚‹ + + + + Zoom in + 拡大 - No - ã„ã„㈠+ Zoom out + ç¸®å° - - Context1 - Context1 + + Portrait + 縦 - Context2 - Context2 + Landscape + 横 - - Context3 - Context3 + + Show single page + 一枚ã®ãƒšãƒ¼ã‚¸ã‚’表示ã™ã‚‹ - Context4 - Context4 + Show facing pages + 見開ãã®ãƒšãƒ¼ã‚¸ã‚’表示ã™ã‚‹ - Call - Call + Show overview of all pages + ã™ã¹ã¦ã®ãƒšãƒ¼ã‚¸ã‚’表示ã™ã‚‹ - - Hangup - Hangup + + Print + å°åˆ· - Flip - Flip + Page setup + ページã®è¨­å®š - - - Ctrl - Ctrl + Close + é–‰ã˜ã‚‹ - - - Shift - Shift + + Export to PDF + PDFã«å‡ºåŠ› - - - Alt - Alt + + Export to PostScript + Postscriptã«å‡ºåŠ› + + + QPrintPropertiesDialog - - - Meta - Meta + PPD Properties + å°åˆ·ãƒ—ロパティã®ãƒ€ã‚¤ã‚¢ãƒ­ã‚°ã®ãƒ—ロパティ - - + - + + Save + ä¿å­˜ - - F%1 - F%1 + OK + OK - QSlider + QPrintPropertiesWidget - - Page left - 1ページ左ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + Form + æ›¸å¼ - - Page up - 1ページ戻る + + Page + ページ - - Position - ä½ç½® + + Advanced + 高度ãªè¨­å®š + + + QPrintSettingsOutput - - Page right - 1ページå³ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - + + Form + æ›¸å¼ - - Page down - 1ページ進む + + Copies + å°åˆ·éƒ¨æ•° - - - QSocks5SocketEngine - - Connection to proxy refused - + + Print range + å°åˆ·ç¯„囲 - - Connection to proxy closed prematurely - + + Print all + ã™ã¹ã¦å°åˆ· - - Proxy host not found - + + Pages from + 先頭ã®ãƒšãƒ¼ã‚¸ - - Connection to proxy timed out - + + to + 末尾ã®ãƒšãƒ¼ã‚¸ - - Proxy authentication failed - + + Selection + é¸æŠžã—ãŸéƒ¨åˆ†ã‚’å°åˆ· - - Proxy authentication failed: %1 - + + Output Settings + 出力設定 - - SOCKS version 5 protocol error - + + Copies: + å°åˆ·éƒ¨æ•°: - - General SOCKSv5 server failure - + + Collate + ä¸åˆã„ - - Connection not allowed by SOCKSv5 server - + + Reverse + 逆順 - - TTL expired - + + Options + オプション - - SOCKSv5 command not supported - + + Color Mode + 色 - - Address type not supported - + + Color + カラー - - Unknown SOCKSv5 proxy error code 0x%1 - + + Grayscale + グレースケール - Socks5 timeout error connecting to socks server - Socks5 ã¯ã‚½ãƒƒã‚¯ã‚¹ã‚µãƒ¼ãƒæŽ¥ç¶šã—よã†ã¨ã—ã¦ã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã«ãªã‚Šã¾ã—㟠+ + Duplex Printing + 両é¢å°åˆ· - - Network operation timed out - ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯æ“作ãŒã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã—ã¾ã—㟠+ + None + ãªã— - - - QSpinBox - - More - 増や㙠+ + Long side + 長辺綴㘠- - Less - 減ら㙠+ + Short side + 短辺綴㘠- QSql + QPrintWidget - - Delete - 削除 + + Form + æ›¸å¼ - - Delete this record? - ã“ã®ãƒ¬ã‚³ãƒ¼ãƒ‰ã‚’削除ã—ã¾ã™ã‹? + + Printer + プリンタ - - - - Yes - ã¯ã„ - - - - - - No - ã„ã„㈠+ + &Name: + åå‰(&N): - - Insert - 挿入 + + P&roperties + プロパティ(&r) - - Update - アップデート + + Location: + 設置場所: - - Save edits? - 編集内容をä¿å­˜ã—ã¾ã™ã‹? + + Preview + プレビュー - - Cancel - キャンセル + + Type: + タイプ: - - Confirm - ç¢ºèª + + Output &file: + 出力ファイルå(&f): - - Cancel your edits? - 編集をキャンセルã—ã¾ã™ã‹? + + ... + ... - QSslSocket - - - Error creating SSL context (%1) - - - - - Invalid or empty cipher list (%1) - - - - - Cannot provide a certificate with no key, %1 - - + QProcess - - Error loading local certificate, %1 - + + + Could not open input redirection for reading + 標準入力リダイレクトを読ã¿è¾¼ã¿ã®ãŸã‚ã«ã‚ªãƒ¼ãƒ—ンã™ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“ - Error loading private key, %1 - - - - - Private key does not certificate public key, %1 - - - - - Error creating SSL session, %1 - - - - - Error creating SSL session: %1 - - - - - Unable to write data: %1 - + + Could not open output redirection for writing + 標準出力リダイレクトを書ãè¾¼ã¿ã®ãŸã‚ã«ã‚ªãƒ¼ãƒ—ンã™ã‚‹ã“ã¨ãŒã§ãã¾ã›ã‚“ - - Error while reading: %1 - + + Resource error (fork failure): %1 + リソースエラー (fork ã«å¤±æ•—ã—ã¾ã—ãŸ): %1 - - Error during SSL handshake: %1 - + + + + + + + + + + Process operation timed out + プロセス処ç†ãŒã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã—ã¾ã—㟠- - - QSystemSemaphore - - - %1: out of resources - + + + + + Error reading from process + プロセスã‹ã‚‰ã®èª­ã¿è¾¼ã¿ã«ãŠã„ã¦ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠- - - %1: permission denied - + + + + Error writing to process + プロセスã¸ã®æ›¸ãè¾¼ã¿ã«ãŠã„ã¦ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠- - %1: already exists - + + Process crashed + プロセスãŒã‚¯ãƒ©ãƒƒã‚·ãƒ¥ã—ã¾ã—㟠- - %1: does not exist - + + No program defined + プログラムåãŒæŒ‡å®šã•れã¦ã„ã¾ã›ã‚“ - - - %1: unknown error %2 - + + Process failed to start + プロセスã®ã‚¹ã‚¿ãƒ¼ãƒˆã«å¤±æ•—ã—ã¾ã—㟠- QTDSDriver - - - Unable to open connection - 接続をオープンã§ãã¾ã›ã‚“ - + QProgressDialog - - Unable to use database - データベースを使用ã§ãã¾ã›ã‚“ + + Cancel + キャンセル - QTabBar - - - Scroll Left - å·¦ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - + QPushButton - - Scroll Right - å³ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + Open + オープン - QTcpServer - - Socket operation unsupported - ソケットæ“作ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ - + QRadioButton - - Operation on socket is not supported - + + Check + é¸æŠž - QTextControl - - - &Undo - å…ƒã«æˆ»ã™(&U) - + QRegExp - - &Redo - やり直ã™(&R) + + no error occurred + エラーã¯ç™ºç”Ÿã—ã¾ã›ã‚“ã§ã—㟠- - Cu&t - 切りå–り(&T) + + disabled feature used + ç„¡åŠ¹ãªæ©Ÿèƒ½ãŒä½¿ç”¨ã•れã¾ã—㟠- - &Copy - コピー(&C) + + bad char class syntax + 䏿­£ãªcharクラス構文 - - Copy &Link Location - リンクã®å ´æ‰€ã‚’コピー(&L) + + bad lookahead syntax + 䏿­£ãªlookaheadæ§‹æ–‡ - - &Paste - 貼り付ã‘(&P) + + bad repetition syntax + 䏿­£ãªrepetitionæ§‹æ–‡ - - Delete - 削除 + + invalid octal value + 無効ãª8進値 - - Select All - ã™ã¹ã¦ã‚’é¸æŠž + + missing left delim + å·¦ã®åŒºåˆ‡ã‚Šæ–‡å­—ãŒã‚りã¾ã›ã‚“ - - - QToolButton - - - Press - 押㙠+ + unexpected end + 予期ã—ãªã„末尾ã§ã™ - - - Open - オープン + + met internal limit + 内部制é™ã‚’満ãŸã—ã¾ã—㟠- QUdpSocket + QSQLite2Driver - - This platform does not support IPv6 - ã“ã®ãƒ—ラットフォーム㯠IPv6 をサãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ + + Error to open database + データベースã®ã‚ªãƒ¼ãƒ—ンã§ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠- - - QUndoGroup - - Undo - å…ƒã«æˆ»ã™ + + Unable to begin transaction + トランザクションを開始ã§ãã¾ã›ã‚“ - - Redo - やり直㙠+ + Unable to commit transaction + トランザクションをコミットã§ãã¾ã›ã‚“ - - - QUndoModel - - <empty> - <空> + + Unable to rollback Transaction + トランザクションをロールãƒãƒƒã‚¯ã§ãã¾ã›ã‚“ - QUndoStack + QSQLite2Result - - Undo - å…ƒã«æˆ»ã™ + + Unable to fetch results + å®Ÿè¡Œçµæžœã‚’フェッãƒã§ãã¾ã›ã‚“ - - Redo - やり直㙠+ + Unable to execute statement + ステートメントを実行ã§ãã¾ã›ã‚“ - QUnicodeControlCharacterMenu - - - LRM Left-to-right mark - - - - - RLM Right-to-left mark - - - - - ZWJ Zero width joiner - - + QSQLiteDriver - - ZWNJ Zero width non-joiner - + + Error opening database + データベースã®ã‚ªãƒ¼ãƒ—ンã§ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠- - ZWSP Zero width space - + + Error closing database + データベースã®ã‚¯ãƒ­ãƒ¼ã‚ºã§ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠- - LRE Start of left-to-right embedding - + + Unable to begin transaction + トランザクションを開始ã§ãã¾ã›ã‚“ - - RLE Start of right-to-left embedding - + + Unable to commit transaction + トランザクションをコミットã§ãã¾ã›ã‚“ - - LRO Start of left-to-right override - + Unable to roll back transaction + トランザクションをロールãƒãƒƒã‚¯ã§ãã¾ã›ã‚“ - - RLO Start of right-to-left override - + + Unable to rollback transaction + トランザクションをロールãƒãƒƒã‚¯ã§ãã¾ã›ã‚“ + + + QSQLiteResult - - PDF Pop directional formatting - + + + + Unable to fetch row + レコードをフェッãƒã§ãã¾ã›ã‚“ - - Insert Unicode control character - Unicode制御文字を挿入 + + Unable to execute statement + ステートメントを実行ã§ãã¾ã›ã‚“ - - - QWebFrame - - Request cancelled - + + Unable to reset statement + ステートメントをリセットã§ãã¾ã›ã‚“ - - Request blocked - + + Unable to bind parameters + パラメータをãƒã‚¤ãƒ³ãƒ‰ã§ãã¾ã›ã‚“ - Cannot show URL - + Parameter count mismatch + ãƒ‘ãƒ©ãƒ¡ãƒ¼ã‚¿ã®æ•°ãŒåˆã£ã¦ã„ã¾ã›ã‚“ - - Frame load interruped by policy change - + + No query + クェリーãŒã‚りã¾ã›ã‚“ + + + QScrollBar - - Cannot show mimetype - + + Scroll here + ã“ã“ã«ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - File does not exist - + + Left edge + 左端 - - - QWebPage - - Bad HTTP request - + + Top + 上端 - - Submit - default label for Submit buttons in forms on web pages - + + Right edge + å³ç«¯ - - Submit - Submit (input element) alt text for <input> elements with no alt, title, or value - + + Bottom + 下端 - - Reset - default label for Reset buttons in forms on web pages - リセット + + Page left + 1ページ左ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - This is a searchable index. Enter search keywords: - text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index' - + + + Page up + 1ページ戻る - - Choose File - title for file button used in HTML forms - + + Page right + 1ページå³ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - No file selected - text to display in file button used in HTML forms when no file is selected - + + + Page down + 1ページ進む - - Open in New Window - Open in New Window context menu item - + + Scroll left + å·¦ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - Save Link... - Download Linked File context menu item - + + Scroll up + 上ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - Copy Link - Copy Link context menu item - + + Scroll right + å³ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - Open Image - Open Image in New Window context menu item - + + Scroll down + 下ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - Save Image - Download Image context menu item - + + Line up + 1行上㸠- - Copy Image - Copy Link context menu item - + + Position + ä½ç½® - - Open Frame - Open Frame in New Window context menu item - + + Line down + 1行下㸠+ + + QSharedMemory - - Copy - Copy context menu item - + + %1: unable to set key on lock + 共有メモリ関連 + %1: ロックã™ã‚‹ãŸã‚ã®ã‚­ãƒ¼ã‚’設定ã§ãã¾ã›ã‚“ - - Go Back - Back context menu item - + + %1: create size is less then 0 + %1: 0よりå°ã•ã„サイズã®å…±æœ‰ãƒ¡ãƒ¢ãƒªã¯ä½œæˆã§ãã¾ã›ã‚“ - - Go Forward - Forward context menu item - + + + %1: unable to lock + %1: ロックã§ãã¾ã›ã‚“ - - Stop - Stop context menu item - åœæ­¢ + + %1: unable to unlock + %1: アンロックã§ãã¾ã›ã‚“ - - Reload - Reload context menu item - + + + %1: permission denied + %1: 許å¯ã•れã¦ã„ã¾ã›ã‚“ - - Cut - Cut context menu item - + + + %1: already exists + %1: æ—¢ã«å­˜åœ¨ã—ã¾ã™ - - Paste - Paste context menu item - + + + %1: doesn't exists + %1: 存在ã—ã¾ã›ã‚“ - - No Guesses Found - No Guesses Found context menu item - + + + %1: out of resources + %1: リソースä¸è¶³ã§ã™ - - Ignore - Ignore Spelling context menu item - 無視 + + + %1: unknown error %2 + %1: 未知ã®ã‚¨ãƒ©ãƒ¼ %2 - - Add To Dictionary - Learn Spelling context menu item - + + %1: key is empty + %1: キーãŒç©ºã§ã™ - - Search The Web - Search The Web context menu item - + + %1: unix key file doesn't exists + ? + %1: UNIX key file ãŒå­˜åœ¨ã—ã¾ã›ã‚“ - - Look Up In Dictionary - Look Up in Dictionary context menu item - + + %1: ftok failed + %1: fork ã«å¤±æ•—ã—ã¾ã—㟠- - Open Link - Open Link context menu item - + + + %1: unable to make key + %1: キーを作æˆã§ãã¾ã›ã‚“ - - Ignore - Ignore Grammar context menu item - 無視 + + %1: system-imposed size restrictions + EINVAL + %1: 指定ã•れãŸã‚µã‚¤ã‚ºã¯ã‚·ã‚¹ãƒ†ãƒ ã«ã‚ˆã‚Šæ‹’å¦ã•れã¾ã—㟠- - Spelling - Spelling and Grammar context sub-menu item - + + %1: not attached + %1: アタッãƒã—ã¦ã„ã¾ã›ã‚“ - - Show Spelling and Grammar - menu item title - + + %1: invalid size + %1: 無効ãªã‚µã‚¤ã‚ºã§ã™ - - Hide Spelling and Grammar - menu item title - + + %1: key error + safekey.isEmpty()==true + %1: キーã‹ã‚りã¾ã›ã‚“ - - Check Spelling - Check spelling context menu item - + + %1: size query failed + %1: サイズã®ã‚¯ã‚§ãƒªãƒ¼ã«å¤±æ•—ã—ã¾ã—㟠+ + + QShortcut - - Check Spelling While Typing - Check spelling while typing context menu item - + + Space + Space - - Check Grammar With Spelling - Check grammar with spelling context menu item - + + Esc + Esc - - Fonts - Font context sub-menu item - + + Tab + Tab - - Bold - Bold context menu item - + + Backtab + Backtab - - Italic - Italic context menu item - + + Backspace + Backspace - - Underline - Underline context menu item - + + Return + Return - - Outline - Outline context menu item - + + Enter + Enter - - Direction - Writing direction context sub-menu item - + + Ins + Ins - - Text Direction - Text direction context sub-menu item - + + Del + Del - - Default - Default writing direction context menu item - + + Pause + Pause - - LTR - Left to Right context menu item - + + Print + Print - - RTL - Right to Left context menu item - + + SysReq + SysReq - - Inspect - Inspect Element context menu item - + + Home + Home - - No recent searches - Label for only item in menu that appears when clicking on the search field image, when no searches have been performed - + + End + End - - Recent searches - label for first item in the menu that appears when clicking on the search field image, used as embedded menu title - + + Left + → - - Clear recent searches - menu item in Recent Searches menu that empties menu's contents - + + Up + ↑ - - Unknown - Unknown filesize FTP directory listing item - 䏿˜Ž + + Right + ↠- - %1 (%2x%3 pixels) - Title string for images - + + Down + ↓ - - Web Inspector - %2 - + + PgUp + PgUp - - Scroll here - ã“ã“ã«ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + PgDown + PgDown - - Left edge - 左端 + + CapsLock + CapsLock - - Top - 上端 + + NumLock + NumLock - Right edge - å³ç«¯ + ScrollLock + ScrollLock - - Bottom - 下端 + + Menu + メニュー + + + + Help + ヘルプ - Page left - 1ページ左ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + Back + 戻る - - Page up - 1ページ戻る + + Forward + 進む - Page right - + Stop + åœæ­¢ - - Page down - 1ページ進む + + Refresh + æ›´æ–°é–“éš” - - Scroll left - å·¦ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + Volume Down + 音é‡ã‚’下ã’ã‚‹ - - Scroll up - 上ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + Volume Mute + 消音 - Scroll right - å³ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + Volume Up + 音é‡ã‚’上ã’ã‚‹ - - Scroll down - 下ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + Bass Boost + 低音ブースト - - - %n file(s) - number of chosen file - - - + + + Bass Up + 低音を上ã’ã‚‹ - - JavaScript Alert - %1 - + + Bass Down + 低音を下ã’ã‚‹ - - JavaScript Confirm - %1 - + + Treble Up + 高音を上ã’ã‚‹ - - JavaScript Prompt - %1 - + + Treble Down + 高音を下ã’ã‚‹ - - Move the cursor to the next character - + + Media Play + メディアã®å†ç”Ÿ - - Move the cursor to the previous character - + + Media Stop + メディアã®åœæ­¢ - - Move the cursor to the next word - + + Media Previous + å‰ã®ãƒ¡ãƒ‡ã‚£ã‚¢ - - Move the cursor to the previous word - + + Media Next + 次ã®ãƒ¡ãƒ‡ã‚£ã‚¢ - - Move the cursor to the next line - + + Media Record + メディアã®éŒ²éŸ³ - - Move the cursor to the previous line - + + Home Page + ホームページ - - Move the cursor to the start of the line - + + Favorites + ãŠæ°—ã«å…¥ã‚Š - - Move the cursor to the end of the line - + + Search + 検索 - - Move the cursor to the start of the block - + + Standby + スタンãƒã‚¤ - - Move the cursor to the end of the block - + + Open URL + URLã‚’é–‹ã - - Move the cursor to the start of the document - + + Launch Mail + メールã®èµ·å‹• - - Move the cursor to the end of the document - + + Launch Media + メディアã®èµ·å‹• - - Select all - + + Launch (0) + (0)ã®èµ·å‹• - - Select to the next character - + + Launch (1) + (1)ã®èµ·å‹• - - Select to the previous character - + + Launch (2) + (2)ã®èµ·å‹• - - Select to the next word - + + Launch (3) + (3)ã®èµ·å‹• - - Select to the previous word - + + Launch (4) + (4)ã®èµ·å‹• - - Select to the next line - + + Launch (5) + (5)ã®èµ·å‹• - - Select to the previous line - + + Launch (6) + (6)ã®èµ·å‹• - - Select to the start of the line - + + Launch (7) + (7)ã®èµ·å‹• - - Select to the end of the line - + + Launch (8) + (8)ã®èµ·å‹• - - Select to the start of the block - + + Launch (9) + (9)ã®èµ·å‹• - - Select to the end of the block - + + Launch (A) + (A)ã®èµ·å‹• - - Select to the start of the document - + + Launch (B) + (B)ã®èµ·å‹• - - Select to the end of the document - + + Launch (C) + (C)ã®èµ·å‹• - - Delete to the start of the word - + + Launch (D) + (D)ã®èµ·å‹• - - Delete to the end of the word - + + Launch (E) + (E)ã®èµ·å‹• - - Insert a new paragraph - + + Launch (F) + (F)ã®èµ·å‹• - - Insert a new line - + + Print Screen + Print Screen - - - QWhatsThisAction - - What's This? - ヒント + + Page Up + Page Up - - - QWidget - - * - * + + Page Down + Page Down - - - QWizard - - Go Back - + + Caps Lock + Caps Lock - - Continue - + + Num Lock + Num Lock - - Commit - + + Number Lock + Number Lock - - Done - + + Scroll Lock + Scroll Lock - - Help - ヘルプ + + Insert + Insert - - < &Back - < 戻る(&B) + + Delete + Delete - - &Finish - 完了(&F) + + Escape + Escape - - Cancel - キャンセル + + System Request + System Request - - &Help - ヘルプ(&H) + + Select + Select - - &Next - + + Yes + ã¯ã„ - - &Next > - 次ã¸(&N) > + + No + ã„ã„㈠- - - QWorkspace - - &Restore - å…ƒã«æˆ»ã™(&R) + + Context1 + Context1 - &Move - 移動(&M) + Context2 + Context2 - &Size - サイズを変更(&S) + Context3 + Context3 - - Mi&nimize - 最å°åŒ–(&N) + + Context4 + Context4 - - Ma&ximize - 最大化(&X) + + Call + Call - - &Close - é–‰ã˜ã‚‹(&C) + + Hangup + Hangup - - Stay on &Top - å¸¸ã«æ‰‹å‰ã«è¡¨ç¤º(&T) + + Flip + Flip - - - Sh&ade - シェード(&A) + + + Ctrl + Ctrl - - - %1 - [%2] - %1 - [%2] + + + Shift + Shift - - Minimize - 最å°åŒ– + + + Alt + Alt - - Restore Down - å…ƒã«æˆ»ã™ + + + Meta + Meta - - Close - é–‰ã˜ã‚‹ + + + + + - - &Unshade - シェードを解除(&U) + + F%1 + F%1 - QXml - - - no error occurred - エラーã¯ç™ºç”Ÿã—ã¾ã›ã‚“ã§ã—㟠- + QSlider - - error triggered by consumer - 消費者ã«ã‚ˆã£ã¦ã‚¨ãƒ©ãƒ¼ãŒèª˜ç™ºã•れã¾ã—㟠+ + Page left + 1ページ左ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - unexpected end of file - 予期ã›ã¬ãƒ•ァイルã®çµ‚りã§ã™ + + Page up + 1ページ戻る - - more than one document type definition - ドキュメントタイプã®å®šç¾©ãŒè¤‡æ•°ã‚りã¾ã™ + + Position + ä½ç½® - - error occurred while parsing element - è¦ç´ ã®è§£æžä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠+ + Page right + 1ページå³ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - tag mismatch - ã‚¿ã‚°ãŒä¸€è‡´ã—ã¾ã›ã‚“ + + Page down + 1ページ進む + + + QSocks5SocketEngine - - error occurred while parsing content - コンテンツã®è§£æžä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠+ + Connection to proxy refused + プロキシーã¸ã®æŽ¥ç¶šãŒæ‹’å¦ã•れã¾ã—㟠- - unexpected character - 予期ã—ãªã„文字ã§ã™ + + Connection to proxy closed prematurely + ãƒ—ãƒ­ã‚­ã‚·ãƒ¼ã®æŽ¥ç¶šãŒé€šä¿¡ã®çµ‚了å‰ã«åˆ‡æ–­ã•れã¾ã—㟠- - invalid name for processing instruction - 処ç†ã®æŒ‡ç¤ºã«ç„¡åйãªåå‰ã§ã™ + + Proxy host not found + プロキシーホストãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ - - version expected while reading the XML declaration - XML宣言を読ã¿è¾¼ã‚€ã«ã¯ãƒãƒ¼ã‚¸ãƒ§ãƒ³ãŒå¿…è¦ã§ã™ + + Connection to proxy timed out + プロキシーã¨ã®æŽ¥ç¶šãŒã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã—ã¾ã—㟠- - wrong value for standalone declaration - スタンドアロン宣言ã¨ã—ã¦æ­£ã—ããªã„値ã§ã™ + + Proxy authentication failed + プロキシーã®èªè¨¼ã«å¤±æ•—ã—ã¾ã—㟠- encoding declaration or standalone declaration expected while reading the XML declaration - XML宣言を読ã¿è¾¼ã‚€ã«ã¯ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°å®£è¨€ã‹ã‚¹ã‚¿ãƒ³ãƒ‰ã‚¢ãƒ­ãƒ¼ãƒ³å®£è¨€ãŒå¿…è¦ã§ã™ + Proxy authentication failed: %1 + プロキシーã®èªè¨¼ã«å¤±æ•—ã—ã¾ã—ãŸ: %1 - - standalone declaration expected while reading the XML declaration - XML宣言を読ã¿è¾¼ã‚€ã«ã¯ã‚¹ã‚¿ãƒ³ãƒ‰ã‚¢ãƒ­ãƒ¼ãƒ³å®£è¨€ãŒå¿…è¦ã§ã™ + + SOCKS version 5 protocol error + SOCKS ãƒãƒ¼ã‚¸ãƒ§ãƒ³ 5 プロトコルã®ã‚¨ãƒ©ãƒ¼ã§ã™ - - error occurred while parsing document type definition - ドキュメントタイプã®å®šç¾©ã‚’è§£æžä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠+ + General SOCKSv5 server failure + SOCKS ãƒãƒ¼ã‚¸ãƒ§ãƒ³ 5 サーãƒã®ã‚¨ãƒ©ãƒ¼ã§ã™ - - letter is expected - 文字ãŒå¿…è¦ã§ã™ + + Connection not allowed by SOCKSv5 server + SOCKSv5 サーãƒã‚ˆã‚ŠæŽ¥ç¶šã‚’æ‹’å¦ã•れã¾ã—㟠- - error occurred while parsing comment - コメントã®è§£æžä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠+ + TTL expired + 実際ã¯ãƒ›ãƒƒãƒ—æ•°ã§ã™ + 有効期é™(TTL)ãŒãれã¾ã—㟠- - error occurred while parsing reference - å‚ç…§ã®è§£æžä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠+ + SOCKSv5 command not supported + ã“ã® SOCKSv5 コマンドã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ - - internal general entity reference not allowed in DTD - 内部一般エンティティå‚ç…§ã¯DTDã§è¨±ã•れã¦ã„ã¾ã›ã‚“ + + Address type not supported + 指定ã•れãŸã‚¢ãƒ‰ãƒ¬ã‚¹ã‚¿ã‚¤ãƒ—ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ - - external parsed general entity reference not allowed in attribute value - è§£æžã•れãŸå¤–部一般エンティティå‚ç…§ã¯å±žæ€§å€¤ã§è¨±ã•れã¦ã„ã¾ã›ã‚“ + + Unknown SOCKSv5 proxy error code 0x%1 + 未知㮠SOCKSv5 プロキシーエラーã§ã™: 0x%1 - - external parsed general entity reference not allowed in DTD - è§£æžã•れãŸå¤–部一般エンティティå‚ç…§ã¯DTDã§è¨±ã•れã¦ã„ã¾ã›ã‚“ + Socks5 timeout error connecting to socks server + Socks5 ã¯ã‚½ãƒƒã‚¯ã‚¹ã‚µãƒ¼ãƒæŽ¥ç¶šã—よã†ã¨ã—ã¦ã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã«ãªã‚Šã¾ã—㟠- - unparsed entity reference in wrong context - 䏿­£ãªæ–‡è„ˆã§è§£æžã•れãªã„エンティティå‚ç…§ã§ã™ + + Network operation timed out + ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯æ“作ãŒã‚¿ã‚¤ãƒ ã‚¢ã‚¦ãƒˆã—ã¾ã—㟠+ + + QSpinBox - - recursive entities - å†å¸°çš„エンティティ + + More + 増や㙠- - error in the text declaration of an external entity - 外部エンティティã®ãƒ†ã‚­ã‚¹ãƒˆå®£è¨€ã«ã‚¨ãƒ©ãƒ¼ãŒã‚りã¾ã™ + + Less + 減ら㙠- QXmlStream + QSql - - - Extra content at end of document. - + + Delete + 削除 - - Invalid entity value. - + + Delete this record? + ã“ã®ãƒ¬ã‚³ãƒ¼ãƒ‰ã‚’削除ã—ã¾ã™ã‹? - - Invalid XML character. - + + + + Yes + ã¯ã„ - - Sequence ']]>' not allowed in content. - + + + + No + ã„ã„㈠- - - Encountered incorrectly encoded content. - + + Insert + 挿入 - - Namespace prefix '%1' not declared - + + Update + アップデート - - Attribute redefined. - + + Save edits? + 編集内容をä¿å­˜ã—ã¾ã™ã‹? - - Unexpected character '%1' in public id literal. - + + Cancel + キャンセル - - Invalid XML version string. - + + Confirm + ç¢ºèª - - Unsupported XML version. - + + Cancel your edits? + 編集をキャンセルã—ã¾ã™ã‹? + + + + QSslSocket + + + Error creating SSL context (%1) + SSL content ã®ä½œæˆã«å¤±æ•—ã—ã¾ã—㟠(%1) - - The standalone pseudo attribute must appear after the encoding. - + + Invalid or empty cipher list (%1) + æš—å·æ–¹å¼ãƒªã‚¹ãƒˆãŒç„¡åйã¾ãŸã¯ç©ºã§ã™ (%1) - - %1 is an invalid encoding name. - + + Cannot provide a certificate with no key, %1 + éµãŒæŒ‡å®šã•れã¦ã„ãªã„ãŸã‚ã€è¨¼æ˜Žæ›¸ã‚’扱ãˆã¾ã›ã‚“。 %1 - Encoding %1 is unsupported - + Error loading local certificate, %1 + ローカルã®è¨¼æ˜Žæ›¸ã‚’ロードã§ãã¾ã›ã‚“。 %1 - - Standalone accepts only yes or no. - + + Error loading private key, %1 + プライベートキーをロードã§ãã¾ã›ã‚“。 %1 - - Invalid attribute in XML declaration. - + + Private key does not certificate public key, %1 + プライベートキーãŒã€ãƒ‘ブリックキーã®è¨¼æ˜Žæ›¸ã¨ãªã£ã¦ã„ã¾ã›ã‚“ %1 - - Premature end of document. - + + Error creating SSL session, %1 + SSL セッションを作æˆã§ãã¾ã›ã‚“。 %1 - - Invalid document. - + + Error creating SSL session: %1 + SSL セッションを作æˆã§ãã¾ã›ã‚“: %1 - - Expected - + + Unable to write data: %1 + 書ãè¾¼ã¿ã§ãã¾ã›ã‚“: %1 - - , but got ' - + + Error while reading: %1 + 読ã¿è¾¼ã¿æ™‚ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: %1 - - Unexpected ' - + + Error during SSL handshake: %1 + SSL ãƒãƒ³ãƒ‰ã‚·ã‚§ãƒ¼ã‚¯æ™‚ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: %1 + + + QSystemSemaphore - - Expected character data. - + + + %1: out of resources + %1: リソースä¸è¶³ã§ã™ - - Recursive entity detected. - + + + %1: permission denied + %1: 許å¯ã•れã¦ã„ã¾ã›ã‚“ - - Start tag expected. - + + %1: already exists + %1: æ—¢ã«å­˜åœ¨ã—ã¾ã™ - - NDATA in parameter entity declaration. - + + %1: does not exist + %1: 存在ã—ã¾ã›ã‚“ - - XML declaration not at start of document. - + + + %1: unknown error %2 + %1: 未知ã®ã‚¨ãƒ©ãƒ¼ã§ã™ %2 + + + QTDSDriver - - %1 is an invalid processing instruction name. - + + Unable to open connection + 接続をオープンã§ãã¾ã›ã‚“ - - Invalid processing instruction name. - + + Unable to use database + データベースを使用ã§ãã¾ã›ã‚“ + + + QTabBar - - %1 is an invalid PUBLIC identifier. - + + Scroll Left + å·¦ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - - - - Illegal namespace declaration. - + + Scroll Right + å³ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + + QTcpServer - - Invalid XML name. - + Socket operation unsupported + ソケットæ“作ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ - - Opening and ending tag mismatch. - + + Operation on socket is not supported + ã“ã®ã‚½ã‚±ãƒƒãƒˆã¸ã®æ“作ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ + + + + QTextControl + + + &Undo + å…ƒã«æˆ»ã™(&U) - - Reference to unparsed entity '%1'. - + + &Redo + やり直ã™(&R) - - - - Entity '%1' not declared. - + + Cu&t + 切りå–り(&T) - - Reference to external entity '%1' in attribute value. - + + &Copy + コピー(&C) - - Invalid character reference. - + + Copy &Link Location + リンクã®å ´æ‰€ã‚’コピー(&L) - - - QtXmlPatterns - - An %1-attribute with value %2 has already been declared. - + + &Paste + 貼り付ã‘(&P) - - An %1-attribute must have a valid %2 as value, which %3 isn't. - + + Delete + 削除 - - Network timeout. - + + Select All + ã™ã¹ã¦ã‚’é¸æŠž + + + QToolButton - - Element %1 can't be serialized because it appears outside the document element. - + + + Press + 押㙠- - Attribute %1 can't be serialized because it appears at the top level. - + + + Open + オープン + + + QUdpSocket - - Year %1 is invalid because it begins with %2. - + + This platform does not support IPv6 + ã“ã®ãƒ—ラットフォーム㯠IPv6 をサãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“ + + + QUndoGroup - - Day %1 is outside the range %2..%3. - + + Undo + å…ƒã«æˆ»ã™ - - Month %1 is outside the range %2..%3. - + + Redo + やり直㙠+ + + QUndoModel - - Overflow: Can't represent date %1. - + + <empty> + <空> + + + QUndoStack - - Day %1 is invalid for month %2. - + + Undo + å…ƒã«æˆ»ã™ - - Time 24:%1:%2.%3 is invalid. Hour is 24, but minutes, seconds, and milliseconds are not all 0; - + + Redo + やり直㙠+ + + QUnicodeControlCharacterMenu - - Time %1:%2:%3.%4 is invalid. - + + LRM Left-to-right mark + LRM (å·¦æ¨ªæ›¸ãæŒ‡å®š) - - Overflow: Date can't be represented. - + + RLM Right-to-left mark + RLM (峿¨ªæ›¸ã指定) - - - At least one component must be present. - + + ZWJ Zero width joiner + ZWJ (å¹…ã®ãªã„接続文字) - - At least one time component must appear after the %1-delimiter. - + + ZWNJ Zero width non-joiner + ZWNJ (å¹…ã®ãªã„éžæŽ¥ç¶šæ–‡å­—) - - No operand in an integer division, %1, can be %2. - + + ZWSP Zero width space + ZWSP (å¹…ã®ç„¡ã„空白) - - The first operand in an integer division, %1, cannot be infinity (%2). - + + LRE Start of left-to-right embedding + LRE (左横書ã開始指定) - - The second operand in a division, %1, cannot be zero (%2). - + + RLE Start of right-to-left embedding + RLE (峿¨ªæ›¸ã開始指定) - - %1 is not a valid value of type %2. - + + LRO Start of left-to-right override + LRO (左横書ã上書ã開始指定) - - When casting to %1 from %2, the source value cannot be %3. - + + RLO Start of right-to-left override + RLO (峿¨ªæ›¸ã上書ã開始指定) - - Integer division (%1) by zero (%2) is undefined. - + + PDF Pop directional formatting + PDF (æ–¹å‘上書ãã®çµ‚了指定) - - Division (%1) by zero (%2) is undefined. - + + Insert Unicode control character + Unicode制御文字を挿入 + + + QWebFrame - - Modulus division (%1) by zero (%2) is undefined. - + + Request cancelled + リクエストã¯ã‚­ãƒ£ãƒ³ã‚»ãƒ«ã•れã¾ã—㟠- - - Dividing a value of type %1 by %2 (not-a-number) is not allowed. - + + Request blocked + リクエストã¯ãƒ–ロックã•れã¾ã—㟠- - Dividing a value of type %1 by %2 or %3 (plus or minus zero) is not allowed. - + + Cannot show URL + URL を表示ã§ãã¾ã›ã‚“ - - Multiplication of a value of type %1 by %2 or %3 (plus or minus infinity) is not allowed. - + + Frame load interruped by policy change + ãƒãƒªã‚·ãƒ¼ã®å¤‰æ›´ã«ã‚ˆã‚Šã€ãƒ•レームã®ãƒ­ãƒ¼ãƒ‰ãŒä¸­æ–­ã—ã¾ã—㟠- - A value of type %1 cannot have an Effective Boolean Value. - + + Cannot show mimetype + MIME Type を表示ã§ãã¾ã›ã‚“ - - Effective Boolean Value cannot be calculated for a sequence containing two or more atomic values. - + + File does not exist + ファイルãŒå­˜åœ¨ã—ã¾ã›ã‚“ + + + QWebPage - - Value %1 of type %2 exceeds maximum (%3). - + + Bad HTTP request + 誤ã£ãŸ HTTP ã®ãƒªã‚¯ã‚¨ã‚¹ãƒˆã§ã™ - - Value %1 of type %2 is below minimum (%3). - + + Submit + default label for Submit buttons in forms on web pages + é€ä¿¡ - - A value of type %1 must contain an even number of digits. The value %2 does not. - + + Submit + Submit (input element) alt text for <input> elements with no alt, title, or value + é€ä¿¡ - - %1 is not valid as a value of type %2. - + + Reset + default label for Reset buttons in forms on web pages + リセット - - Operator %1 cannot be used on type %2. - + + This is a searchable index. Enter search keywords: + text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index' + 検索ãŒå¯èƒ½ã§ã™ã€‚検索ã®ãŸã‚ã®ã‚­ãƒ¼ãƒ¯ãƒ¼ãƒ‰ã‚’入力ã—ã¦ãã ã•ã„: - - Operator %1 cannot be used on atomic values of type %2 and %3. - + + Choose File + title for file button used in HTML forms + ファイルをé¸ã¶ - - The namespace URI in the name for a computed attribute cannot be %1. - + + No file selected + text to display in file button used in HTML forms when no file is selected + ファイルãŒé¸æŠžã•れã¦ã„ã¾ã›ã‚“ - - The name for a computed attribute cannot have the namespace URI %1 with the local name %2. - + + Open in New Window + Open in New Window context menu item + æ–°ã—ã„ウィンドウã§é–‹ã - - Type error in cast, expected %1, received %2. - + + Save Link... + Download Linked File context menu item + リンク先をä¿å­˜... - - When casting to %1 or types derived from it, the source value must be of the same type, or it must be a string literal. Type %2 is not allowed. - + + Copy Link + Copy Link context menu item + リンク先をコピー - - No casting is possible with %1 as the target type. - + + Open Image + Open Image in New Window context menu item + イメージを開ã - - It is not possible to cast from %1 to %2. - + + Save Image + Download Image context menu item + ç”»åƒã‚’ä¿å­˜ - - Casting to %1 is not possible because it is an abstract type, and can therefore never be instantiated. - + + Copy Image + Copy Link context menu item + ç”»åƒã‚’コピー - - It's not possible to cast the value %1 of type %2 to %3 - + + Open Frame + Open Frame in New Window context menu item + フレームを新ã—ã„ウィンドウã§é–‹ã - - Failure when casting from %1 to %2: %3 - + + Copy + Copy context menu item + コピー - - A comment cannot contain %1 - + + Go Back + Back context menu item + 戻る - - A comment cannot end with a %1. - + + Go Forward + Forward context menu item + 進む - - No comparisons can be done involving the type %1. - + + Stop + Stop context menu item + åœæ­¢ - - Operator %1 is not available between atomic values of type %2 and %3. - + + Reload + Reload context menu item + リロード - - An attribute node cannot be a child of a document node. Therefore, the attribute %1 is out of place. - + + Cut + Cut context menu item + 切りå–り - - A library module cannot be evaluated directly. It must be imported from a main module. - + + Paste + Paste context menu item + 貼り付㑠- - No template by name %1 exists. - + + No Guesses Found + No Guesses Found context menu item + 推測候補ã¯ã‚りã¾ã›ã‚“ - - A value of type %1 cannot be a predicate. A predicate must have either a numeric type or an Effective Boolean Value type. - + + Ignore + Ignore Spelling context menu item + 無視 - - A positional predicate must evaluate to a single numeric value. - + + Add To Dictionary + Learn Spelling context menu item + 辞書ã«è¿½åŠ  - - The target name in a processing instruction cannot be %1 in any combination of upper and lower case. Therefore, is %2 invalid. - + + Search The Web + Search The Web context menu item + Web を検索 - - %1 is not a valid target name in a processing instruction. It must be a %2 value, e.g. %3. - + + Look Up In Dictionary + Look Up in Dictionary context menu item + 辞書ã‹ã‚‰æŽ¢ã™ - - The last step in a path must contain either nodes or atomic values. It cannot be a mixture between the two. - + + Open Link + Open Link context menu item + リンクを開ã - - The data of a processing instruction cannot contain the string %1 - + + Ignore + Ignore Grammar context menu item + 無視 - - No namespace binding exists for the prefix %1 - + + Spelling + Spelling and Grammar context sub-menu item + スペル - - No namespace binding exists for the prefix %1 in %2 - + + Show Spelling and Grammar + menu item title + ã‚¹ãƒšãƒ«ã¨æ–‡æ³•を表示 - - - %1 is an invalid %2 - - - - - %1 takes at most %n argument(s). %2 is therefore invalid. - - - + + Hide Spelling and Grammar + menu item title + ã‚¹ãƒšãƒ«ã¨æ–‡æ³•ã‚’éš ã™ - - - %1 requires at least %n argument(s). %2 is therefore invalid. - - - + + + Check Spelling + Check spelling context menu item + スペルをãƒã‚§ãƒƒã‚¯ã™ã‚‹ - - The first argument to %1 cannot be of type %2. It must be a numeric type, xs:yearMonthDuration or xs:dayTimeDuration. - + + Check Spelling While Typing + Check spelling while typing context menu item + 入力中ã«ã‚¹ãƒšãƒ«ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ - - The first argument to %1 cannot be of type %2. It must be of type %3, %4, or %5. - + + Check Grammar With Spelling + Check grammar with spelling context menu item + スペルãŠã‚ˆã³æ–‡æ³•ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ - - The second argument to %1 cannot be of type %2. It must be of type %3, %4, or %5. - + + Fonts + Font context sub-menu item + フォント - - %1 is not a valid XML 1.0 character. - + + Bold + Bold context menu item + 太字 - - The first argument to %1 cannot be of type %2. - + + Italic + Italic context menu item + イタリック - - If both values have zone offsets, they must have the same zone offset. %1 and %2 are not the same. - + + Underline + Underline context menu item + 下線 - - %1 was called. - + + Outline + Outline context menu item + アウトライン - - %1 must be followed by %2 or %3, not at the end of the replacement string. - + + Direction + Writing direction context sub-menu item + æ–¹å‘ - - In the replacement string, %1 must be followed by at least one digit when not escaped. - + + Text Direction + Text direction context sub-menu item + ãƒ†ã‚­ã‚¹ãƒˆã®æ–¹å‘ - - In the replacement string, %1 can only be used to escape itself or %2, not %3 - + + Default + Default writing direction context menu item + デフォルト - - %1 matches newline characters - + + LTR + Left to Right context menu item + 左横書ã - - %1 and %2 match the start and end of a line. - + + RTL + Right to Left context menu item + 峿¨ªæ›¸ã - - Matches are case insensitive - + + Inspect + Inspect Element context menu item + ? + 検査 - - Whitespace characters are removed, except when they appear in character classes - + + No recent searches + Label for only item in menu that appears when clicking on the search field image, when no searches have been performed + 検索ã®å±¥æ­´ã¯ã‚りã¾ã›ã‚“ - - %1 is an invalid regular expression pattern: %2 - + + Recent searches + label for first item in the menu that appears when clicking on the search field image, used as embedded menu title + 検索ã®å±¥æ­´ - - %1 is an invalid flag for regular expressions. Valid flags are: - + + Clear recent searches + menu item in Recent Searches menu that empties menu's contents + 検索ã®å±¥æ­´ã‚’クリア - - If the first argument is the empty sequence or a zero-length string (no namespace), a prefix cannot be specified. Prefix %1 was specified. - + + Unknown + Unknown filesize FTP directory listing item + 䏿˜Ž - - It will not be possible to retrieve %1. - + + %1 (%2x%3 pixels) + Title string for images + %1 (%2x%3 ピクセル) - - The root node of the second argument to function %1 must be a document node. %2 is not a document node. - + + Web Inspector - %2 + Web ã®æ¤œæŸ» - %2 - - The default collection is undefined - + + Scroll here + ã“ã“ã«ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - %1 cannot be retrieved - + + Left edge + 左端 - - The normalization form %1 is unsupported. The supported forms are %2, %3, %4, and %5, and none, i.e. the empty string (no normalization). - + + Top + 上端 - - A zone offset must be in the range %1..%2 inclusive. %3 is out of range. - + + Right edge + å³ç«¯ - - %1 is not a whole number of minutes. - + + Bottom + 下端 - - Required cardinality is %1; got cardinality %2. - + + Page left + 1ページ左ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - The item %1 did not match the required type %2. - + + Page up + 1ページ戻る - - - %1 is an unknown schema type. - + + Page right + 1ページå³ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - Only one %1 declaration can occur in the query prolog. - + + Page down + 1ページ進む - - The initialization of variable %1 depends on itself - + + Scroll left + å·¦ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - No variable by name %1 exists - + + Scroll up + 上ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - The variable %1 is unused - + + Scroll right + å³ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« - - Version %1 is not supported. The supported XQuery version is 1.0. - + + Scroll down + 下ã¸ã‚¹ã‚¯ãƒ­ãƒ¼ãƒ« + + + + %n file(s) + number of chosen file + + %n 個ã®ãƒ•ァイル + - - The encoding %1 is invalid. It must contain Latin characters only, must not contain whitespace, and must match the regular expression %2. - + + JavaScript Alert - %1 + JavaScript アラート - %1 - - No function with signature %1 is available - + + JavaScript Confirm - %1 + JavaScript ç¢ºèª - %1 - - - A default namespace declaration must occur before function, variable, and option declarations. - + + JavaScript Prompt - %1 + JavaScript è³ªå• - %1 - - Namespace declarations must occur before function, variable, and option declarations. - + + Move the cursor to the next character + æ¬¡ã®æ–‡å­—ã¸ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - Module imports must occur before function, variable, and option declarations. - + + Move the cursor to the previous character + å‰ã®æ–‡å­—ã«ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - It is not possible to redeclare prefix %1. - + + Move the cursor to the next word + 次ã®å˜èªžã«ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - Prefix %1 is already declared in the prolog. - + + Move the cursor to the previous word + å‰ã®å˜èªžã«ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - The name of an option must have a prefix. There is no default namespace for options. - + + Move the cursor to the next line + 次ã®è¡Œã«ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - The Schema Import feature is not supported, and therefore %1 declarations cannot occur. - + + Move the cursor to the previous line + å‰ã®è¡Œã«ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - The target namespace of a %1 cannot be empty. - + + Move the cursor to the start of the line + æ–‡ãªã®ã‹è¡Œãªã®ã‹ + 文頭ã«ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - The module import feature is not supported - + + Move the cursor to the end of the line + 文末ã«ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - No value is available for the external variable by name %1. - + + Move the cursor to the start of the block + ブロックã®å…ˆé ­ã«ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - A construct was encountered which only is allowed in XQuery. - + + Move the cursor to the end of the block + ãƒ–ãƒ­ãƒƒã‚¯ã®æœ«å°¾ã«ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - A template by name %1 has already been declared. - + + Move the cursor to the start of the document + 文章ã®å…ˆé ­ã«ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - The keyword %1 cannot occur with any other mode name. - + + Move the cursor to the end of the document + æ–‡ç« ã®æœ«å°¾ã«ã‚«ãƒ¼ã‚½ãƒ«ã‚’移動 - - The value of attribute %1 must of type %2, which %3 isn't. - + + Select all + ã™ã¹ã¦ã‚’é¸æŠž - - The prefix %1 can not be bound. By default, it is already bound to the namespace %2. - + + Select to the next character + æ¬¡ã®æ–‡å­—ã‚’é¸æŠž - - A variable by name %1 has already been declared. - + + Select to the previous character + å‰ã®æ–‡å­—ã‚’é¸æŠž - - A stylesheet function must have a prefixed name. - + + Select to the next word + 次ã®å˜èªžã‚’é¸æŠž - - The namespace for a user defined function cannot be empty (try the predefined prefix %1 which exists for cases like this) - + + Select to the previous word + å‰ã®å˜èªžã‚’é¸æŠž - - The namespace %1 is reserved; therefore user defined functions may not use it. Try the predefined prefix %2, which exists for these cases. - + + Select to the next line + 次ã®è¡Œã‚’é¸æŠž - - The namespace of a user defined function in a library module must be equivalent to the module namespace. In other words, it should be %1 instead of %2 - + + Select to the previous line + å‰ã®è¡Œã‚’é¸æŠž - - A function already exists with the signature %1. - + + Select to the start of the line + 文頭ã‹ã‚‰é¸æŠž - - No external functions are supported. All supported functions can be used directly, without first declaring them as external - + + Select to the end of the line + 文末ã¾ã§é¸æŠž - - An argument by name %1 has already been declared. Every argument name must be unique. - + + Select to the start of the block + ブロックã®å…ˆé ­ã‹ã‚‰é¸æŠž - - When function %1 is used for matching inside a pattern, the argument must be a variable reference or a string literal. - + + Select to the end of the block + ãƒ–ãƒ­ãƒƒã‚¯ã®æœ«å°¾ã¾ã§é¸æŠž - - In an XSL-T pattern, the first argument to function %1 must be a string literal, when used for matching. - + + Select to the start of the document + ドキュメントã®å…ˆé ­ã‹ã‚‰é¸æŠž - - In an XSL-T pattern, the first argument to function %1 must be a literal or a variable reference, when used for matching. - + + Select to the end of the document + ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã®æœ«å°¾ã¾ã§é¸æŠž - - In an XSL-T pattern, function %1 cannot have a third argument. - + + Delete to the start of the word + å˜èªžã®å…ˆé ­ã¾ã§å‰Šé™¤ - - In an XSL-T pattern, only function %1 and %2, not %3, can be used for matching. - + + Delete to the end of the word + å˜èªžã®æœ«å°¾ã¾ã§å‰Šé™¤ - - In an XSL-T pattern, axis %1 cannot be used, only axis %2 or %3 can. - + + Insert a new paragraph + æ–°ã—ã„æ®µè½ã‚’挿入 - - %1 is an invalid template mode name. - + + Insert a new line + æ–°ã—ã„行を挿入 + + + QWhatsThisAction - - The name of a variable bound in a for-expression must be different from the positional variable. Hence, the two variables named %1 collide. - + + What's This? + ヒント? + + + QWidget - - The Schema Validation Feature is not supported. Hence, %1-expressions may not be used. - + + * + * + + + QWizard - - None of the pragma expressions are supported. Therefore, a fallback expression must be present - + + Go Back + 戻る - - Each name of a template parameter must be unique; %1 is duplicated. - + + Continue + ç¶šã - - The %1-axis is unsupported in XQuery - + + Commit + é©ç”¨ - - %1 is not a valid name for a processing-instruction. - + + Done + 終了 - - %1 is not a valid numeric literal. - + + Help + ヘルプ - - No function by name %1 is available. - + + < &Back + < 戻る(&B) - - The namespace URI cannot be the empty string when binding to a prefix, %1. - + + &Finish + 完了(&F) - - %1 is an invalid namespace URI. - + + Cancel + キャンセル - - It is not possible to bind to the prefix %1 - + + &Help + ヘルプ(&H) - - Namespace %1 can only be bound to %2 (and it is, in either case, pre-declared). - + + &Next + 次ã¸(&N) - - Prefix %1 can only be bound to %2 (and it is, in either case, pre-declared). - + + &Next > + 次ã¸(&N) > + + + QWorkspace - - Two namespace declaration attributes have the same name: %1. - + + &Restore + å…ƒã«æˆ»ã™(&R) - - The namespace URI must be a constant and cannot use enclosed expressions. - + + &Move + 移動(&M) - - An attribute by name %1 has already appeared on this element. - + + &Size + サイズを変更(&S) - - A direct element constructor is not well-formed. %1 is ended with %2. - + + Mi&nimize + 最å°åŒ–(&N) - - The name %1 does not refer to any schema type. - + + Ma&ximize + 最大化(&X) - - %1 is an complex type. Casting to complex types is not possible. However, casting to atomic types such as %2 works. - + + &Close + é–‰ã˜ã‚‹(&C) - - %1 is not an atomic type. Casting is only possible to atomic types. - + + Stay on &Top + å¸¸ã«æ‰‹å‰ã«è¡¨ç¤º(&T) - - - %1 is not in the in-scope attribute declarations. Note that the schema import feature is not supported. - + + + Sh&ade + シェード(&A) - - The name of an extension expression must be in a namespace. - + + + %1 - [%2] + %1 - [%2] - - empty - + + Minimize + 最å°åŒ– - zero or one - + Restore Down + å…ƒã«æˆ»ã™ - - exactly one - + + Close + é–‰ã˜ã‚‹ - - one or more - + + &Unshade + シェードを解除(&U) + + + + QXml + + + no error occurred + エラーã¯ç™ºç”Ÿã—ã¾ã›ã‚“ã§ã—㟠+ + + + error triggered by consumer + 消費者ã«ã‚ˆã£ã¦ã‚¨ãƒ©ãƒ¼ãŒèª˜ç™ºã•れã¾ã—㟠- - zero or more - + + unexpected end of file + 予期ã›ã¬ãƒ•ァイルã®çµ‚りã§ã™ - - Required type is %1, but %2 was found. - + + more than one document type definition + ドキュメントタイプã®å®šç¾©ãŒè¤‡æ•°ã‚りã¾ã™ - - Promoting %1 to %2 may cause loss of precision. - + + error occurred while parsing element + è¦ç´ ã®è§£æžä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠- - The focus is undefined. - + + tag mismatch + ã‚¿ã‚°ãŒä¸€è‡´ã—ã¾ã›ã‚“ - - It's not possible to add attributes after any other kind of node. - + + error occurred while parsing content + コンテンツã®è§£æžä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠- - An attribute by name %1 has already been created. - + + unexpected character + 予期ã—ãªã„文字ã§ã™ - - Only the Unicode Codepoint Collation is supported(%1). %2 is unsupported. - + + invalid name for processing instruction + 処ç†ã®æŒ‡ç¤ºã«ç„¡åйãªåå‰ã§ã™ - - %1 is an unsupported encoding. - + + version expected while reading the XML declaration + XML宣言を読ã¿è¾¼ã‚€ã«ã¯ãƒãƒ¼ã‚¸ãƒ§ãƒ³ãŒå¿…è¦ã§ã™ - - %1 contains octets which are disallowed in the requested encoding %2. - + + wrong value for standalone declaration + スタンドアロン宣言ã¨ã—ã¦æ­£ã—ããªã„値ã§ã™ - - The codepoint %1, occurring in %2 using encoding %3, is an invalid XML character. - + + encoding declaration or standalone declaration expected while reading the XML declaration + XML宣言を読ã¿è¾¼ã‚€ã«ã¯ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°å®£è¨€ã‹ã‚¹ã‚¿ãƒ³ãƒ‰ã‚¢ãƒ­ãƒ¼ãƒ³å®£è¨€ãŒå¿…è¦ã§ã™ - - Ambiguous rule match. - + + standalone declaration expected while reading the XML declaration + XML宣言を読ã¿è¾¼ã‚€ã«ã¯ã‚¹ã‚¿ãƒ³ãƒ‰ã‚¢ãƒ­ãƒ¼ãƒ³å®£è¨€ãŒå¿…è¦ã§ã™ - - In a namespace constructor, the value for a namespace cannot be an empty string. - + + error occurred while parsing document type definition + ドキュメントタイプã®å®šç¾©ã‚’è§£æžä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠- - The prefix must be a valid %1, which %2 is not. - + + letter is expected + 文字ãŒå¿…è¦ã§ã™ - - The prefix %1 cannot be bound. - + + error occurred while parsing comment + コメントã®è§£æžä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠- - Only the prefix %1 can be bound to %2 and vice versa. - + + error occurred while parsing reference + å‚ç…§ã®è§£æžä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—㟠- - Circularity detected - + + internal general entity reference not allowed in DTD + 内部一般エンティティå‚ç…§ã¯DTDã§è¨±ã•れã¦ã„ã¾ã›ã‚“ - - The parameter %1 is required, but no corresponding %2 is supplied. - + + external parsed general entity reference not allowed in attribute value + è§£æžã•れãŸå¤–部一般エンティティå‚ç…§ã¯å±žæ€§å€¤ã§è¨±ã•れã¦ã„ã¾ã›ã‚“ - - The parameter %1 is passed, but no corresponding %2 exists. - + + external parsed general entity reference not allowed in DTD + è§£æžã•れãŸå¤–部一般エンティティå‚ç…§ã¯DTDã§è¨±ã•れã¦ã„ã¾ã›ã‚“ - - The URI cannot have a fragment - + + unparsed entity reference in wrong context + 䏿­£ãªæ–‡è„ˆã§è§£æžã•れãªã„エンティティå‚ç…§ã§ã™ - - Element %1 is not allowed at this location. - + + recursive entities + å†å¸°çš„エンティティ - - Text nodes are not allowed at this location. - + + error in the text declaration of an external entity + 外部エンティティã®ãƒ†ã‚­ã‚¹ãƒˆå®£è¨€ã«ã‚¨ãƒ©ãƒ¼ãŒã‚りã¾ã™ + + + QXmlStream - - Parse error: %1 - + + + Extra content at end of document. + ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã®æœ«å°¾ã«ä½™è¨ˆãªã‚‚ã®ãŒã¤ã„ã¦ã„ã¾ã™ã€‚ - - The value of the XSL-T version attribute must be a value of type %1, which %2 isn't. - + + Invalid entity value. + エンティティã®å€¤ãŒç„¡åйã§ã™ã€‚ - - Running an XSL-T 1.0 stylesheet with a 2.0 processor. - + + Invalid XML character. + 無効㪠XML 文字ã§ã™ã€‚ - - Unknown XSL-T attribute %1. - + + Sequence ']]>' not allowed in content. + ã“ã®ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã§ã¯ã€']]>' ã¯è¨±å¯ã•れã¦ã„ã¾ã›ã‚“。 - - Attribute %1 and %2 are mutually exclusive. - + + + Encountered incorrectly encoded content. + æ­£ã—ããªã„ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‰ã®æ–‡è„ˆã«é­é‡ã—ã¾ã—ãŸã€‚ - - In a simplified stylesheet module, attribute %1 must be present. - + + Namespace prefix '%1' not declared + åå‰ç©ºé–“ã®ãƒ–リフィックス '%1' ã¯å®£è¨€ã•れã¦ã„ã¾ã›ã‚“ - - If element %1 has no attribute %2, it cannot have attribute %3 or %4. - + + Attribute redefined. + 属性ãŒå†åº¦æŒ‡å®šã•れã¦ã„ã¾ã™ã€‚ - - Element %1 must have at least one of the attributes %2 or %3. - + + Unexpected character '%1' in public id literal. + DTD宣言ã®éƒ¨åˆ† + 公開 ID 指定ã«ä½¿ç”¨ã§ããªã„文字 '%1' ãŒä½¿ç”¨ã•れã¦ã„ã¾ã™ã€‚ - At least one mode must be specified in the %1-attribute on element %2. - + Invalid XML version string. + 無効㪠XML ãƒãƒ¼ã‚¸ãƒ§ãƒ³æŒ‡å®šã§ã™ã€‚ - - Attribute %1 cannot appear on the element %2. Only the standard attributes can appear. - + + Unsupported XML version. + ã“ã® XML ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“。 - - Attribute %1 cannot appear on the element %2. Only %3 is allowed, and the standard attributes. - + + The standalone pseudo attribute must appear after the encoding. + &ddd; ã¯ã€ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚’指定ã—ã¦ã„ãªã„ã¨ä½¿ãˆãªã„ã¨ã„ã†ã“ã¨ã‹ãªã€‚utf8ã ã¨ãŠã‚‚ã†ã‘ã©ã€‚ + 仮想属性指定ã¯ã€ã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°æŒ‡å®šã®å¾Œã«ã®ã¿ä½¿ç”¨ã§ãã¾ã™ã€‚ - - Attribute %1 cannot appear on the element %2. Allowed is %3, %4, and the standard attributes. - + + %1 is an invalid encoding name. + %1 ã¯ç„¡åйãªã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã®åå‰ã§ã™ã€‚ - - Attribute %1 cannot appear on the element %2. Allowed is %3, and the standard attributes. - + + Encoding %1 is unsupported + エンコーディング '%1' ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ - - XSL-T attributes on XSL-T elements must be in the null namespace, not in the XSL-T namespace which %1 is. - + + Standalone accepts only yes or no. + standalone ã®æŒ‡å®šã¯ yes ã¾ãŸã¯ no ã®ã¿æŒ‡å®šã§ãã¾ã™ã€‚ - - The attribute %1 must appear on element %2. - + + Invalid attribute in XML declaration. + XML 宣言ã«ç„¡åйãªå±žæ€§ãŒã¤ã„ã¦ã„ã¾ã™ã€‚ - - The element with local name %1 does not exist in XSL-T. - + + Premature end of document. + ドキュメントãŒé€”中ã§çµ‚ã‚ã£ã¦ã„ã¾ã™ã€‚ - - Element %1 must come last. - + + Invalid document. + 無効ãªãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã§ã™ã€‚ - - At least one %1-element must occur before %2. - + + Expected + 予期ã—ã¦ã„ãŸè¡¨ç¾ã¯ã€ - - Only one %1-element can appear. - + + , but got ' + ã§ã™ãŒã€å–å¾—ã—ãŸè¡¨ç¾ã¯ä»¥ä¸‹ã®ã‚‚ã®ã§ã—㟠' - - At least one %1-element must occur inside %2. - + + Unexpected ' + 予期ã—ã¦ã„ãªã‹ã£ãŸè¡¨ç¾ ' - - When attribute %1 is present on %2, a sequence constructor cannot be used. - + + Expected character data. + 予期ã—ã¦ã„ãŸæ–‡å­—列。 - - Element %1 must have either a %2-attribute or a sequence constructor. - + + Recursive entity detected. + å†å¸°ã—ã¦ã„るエンティティを発見ã—ã¾ã—ãŸã€‚ - - When a parameter is required, a default value cannot be supplied through a %1-attribute or a sequence constructor. - + + Start tag expected. + 開始タグをよãã—ã¦ã„ã¾ã—ãŸãŒã€ã¿ã¤ã‹ã‚Šã¾ã›ã‚“。 - - Element %1 cannot have children. - + + NDATA in parameter entity declaration. + パラメータエンティティã®å®£è¨€ã«ãŠã„㦠NDATA ãŒã‚りã¾ã™ã€‚ - - Element %1 cannot have a sequence constructor. - + + XML declaration not at start of document. + XML 宣言ãŒãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã®å…ˆé ­ã«ã‚りã¾ã›ã‚“。 - - - The attribute %1 cannot appear on %2, when it is a child of %3. - + + %1 is an invalid processing instruction name. + XMLã«ãã‚“ãªã®ã‚ã£ãŸã£ã‘? + %1 ã¯ç„¡åйãªå‡¦ç†æŒ‡å®šã®åå‰ã§ã™ã€‚ - - A parameter in a function cannot be declared to be a tunnel. - + + Invalid processing instruction name. + 無効ãªå‡¦ç†å‘½ä»¤ã§ã™ã€‚ - - This processor is not Schema-aware and therefore %1 cannot be used. - + + %1 is an invalid PUBLIC identifier. + %1 ã¯ã€å…¬é–‹ (PUBLIC) 識別å­ã¨ã—ã¦ç„¡åйã§ã™ã€‚ - - Top level stylesheet elements must be in a non-null namespace, which %1 isn't. - + + + + + Illegal namespace declaration. + 無効ãªåå‰ç©ºé–“ã®æŒ‡å®šã§ã™ã€‚ - - The value for attribute %1 on element %2 must either be %3 or %4, not %5. - + + Invalid XML name. + 無効㪠XML åã§ã™ã€‚ - - Attribute %1 cannot have the value %2. - + + Opening and ending tag mismatch. + é–‹å§‹ã‚¿ã‚°ã¨ã€çµ‚了タグãŒãƒžãƒƒãƒã—ã¾ã›ã‚“。 - - The attribute %1 can only appear on the first %2 element. - + + Reference to unparsed entity '%1'. + ã¾ã ãƒ‘ースã—ã¦ã„ãªã„エンティティ '%1' ã‚’å‚ç…§ã—ã¦ã„ã¾ã™ã€‚ - - At least one %1 element must appear as child of %2. - + + + + Entity '%1' not declared. + エンティティ '%1' ã¯å®£è¨€ã•れã¦ã„ã¾ã›ã‚“。 - - - VolumeSlider - - Muted - + + Reference to external entity '%1' in attribute value. + 属性値ã¨ã—ã¦ã€å¤–部エンティティ '%1' ã‚’å†åº¦æŒ‡å®šã—ã¦ã„ã¾ã™ã€‚ - - - Volume: %1% - + + Invalid character reference. + ç„¡åŠ¹ãªæ–‡å­—ã¸ã®å‚ç…§ã§ã™ã€‚ -- cgit v0.12 From aef98360bfa5a5f3013c8fb29ed589545bb7a3cf Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 19 May 2009 10:20:53 +0200 Subject: Fix compiler warning: use C++ cast operator, not the old-style C cast. Reviewed-by: Marius Storm-Olsen --- src/corelib/tools/qbytearraymatcher.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h index 633e92c..970cbcc 100644 --- a/src/corelib/tools/qbytearraymatcher.h +++ b/src/corelib/tools/qbytearraymatcher.h @@ -70,7 +70,7 @@ public: inline QByteArray pattern() const { if (q_pattern.isNull()) - return QByteArray((const char*)p.p, p.l); + return QByteArray(reinterpret_cast(p.p), p.l); return q_pattern; } -- cgit v0.12 From 4bcc39e50b68d69f6b94b1095b35f678c42c5aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 19 May 2009 10:15:19 +0200 Subject: Fixed autotest failure in tst_QImage::smoothScale3() Some optimized smooth scaling functions were introduced in 4.5, so increase the tolerance level a small bit. Reviewed-by: Trond --- tests/auto/qimage/tst_qimage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index ee4ece2..88bbb50 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -1454,9 +1454,9 @@ void tst_QImage::smoothScale3() QRgb cb = b.pixel(x, y); // tolerate a little bit of rounding errors - QVERIFY(compare(qRed(ca), qRed(cb), 2)); - QVERIFY(compare(qGreen(ca), qGreen(cb), 2)); - QVERIFY(compare(qBlue(ca), qBlue(cb), 2)); + QVERIFY(compare(qRed(ca), qRed(cb), 3)); + QVERIFY(compare(qGreen(ca), qGreen(cb), 3)); + QVERIFY(compare(qBlue(ca), qBlue(cb), 3)); } } } -- cgit v0.12 From 9f9ede616079998f8ba7bf6fd446f39ce74b0400 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Mon, 18 May 2009 16:04:15 +0200 Subject: Modernize the output of qdoc a bit. Now we have explicit columns we cann make our docs look a bit better using some simple css additions. This adds light backgrounds in targetted places to make the text more readable. --- tools/qdoc3/test/classic.css | 64 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index 6cf7377..3704a15 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -1,7 +1,29 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { + text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} + h3.fn,span.fn { - margin-left: 1cm; - text-indent: -1cm; + background-color: #d5e1e8; + border-width: 1px; + border-style: solid; + border-color: #84b0c7; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; + padding: 6px 0px 6px 10px; } a:link @@ -56,6 +78,44 @@ body color: black } +table td.memItemLeft { + width: 200px; + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +table td.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} + table tr.odd { background: #f0f0f0; color: black; -- cgit v0.12 From 4871ff0563cf8a9691db8b084dce012aeb5abf47 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 19 May 2009 18:46:43 +1000 Subject: Add a SetProperties::restoreEntryValues property to store the state restoring property entry values --- src/declarative/util/qmlsetproperties.cpp | 18 +++++++++++++++++- src/declarative/util/qmlsetproperties.h | 4 ++++ src/declarative/util/qmlstate.cpp | 4 ++-- src/declarative/util/qmlstate.h | 1 + 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp index 34d3b00..c986864 100644 --- a/src/declarative/util/qmlsetproperties.cpp +++ b/src/declarative/util/qmlsetproperties.cpp @@ -113,13 +113,15 @@ class QmlSetPropertiesPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QmlSetProperties) public: - QmlSetPropertiesPrivate() : object(0), decoded(true) {} + QmlSetPropertiesPrivate() : object(0), decoded(true), restore(true) {} QObject *object; QByteArray data; bool decoded; void decode(); + bool restore; + QList > properties; QList > expressions; @@ -264,6 +266,18 @@ void QmlSetProperties::setObject(QObject *o) d->object = o; } +bool QmlSetProperties::restoreEntryValues() const +{ + Q_D(const QmlSetProperties); + return d->restore; +} + +void QmlSetProperties::setRestoreEntryValues(bool v) +{ + Q_D(QmlSetProperties); + d->restore = v; +} + QmlMetaProperty QmlSetPropertiesPrivate::property(const QByteArray &property) { @@ -314,6 +328,7 @@ QmlSetProperties::ActionList QmlSetProperties::actions() if (prop.isValid()) { Action a; + a.restore = restoreEntryValues(); a.property = prop; a.fromValue = a.property.read(); a.toValue = d->properties.at(ii).second; @@ -329,6 +344,7 @@ QmlSetProperties::ActionList QmlSetProperties::actions() if (prop.isValid()) { Action a; + a.restore = restoreEntryValues(); a.property = prop; a.fromValue = a.property.read(); a.toValue = d->expressions.at(ii).second->value(); diff --git a/src/declarative/util/qmlsetproperties.h b/src/declarative/util/qmlsetproperties.h index bd036c1..6d313b7 100644 --- a/src/declarative/util/qmlsetproperties.h +++ b/src/declarative/util/qmlsetproperties.h @@ -58,6 +58,7 @@ class Q_DECLARATIVE_EXPORT QmlSetProperties : public QmlStateOperation Q_DECLARE_PRIVATE(QmlSetProperties); Q_PROPERTY(QObject *target READ object WRITE setObject); + Q_PROPERTY(bool restoreEntryValues READ restoreEntryValues WRITE setRestoreEntryValues); public: QmlSetProperties(); ~QmlSetProperties(); @@ -65,6 +66,9 @@ public: QObject *object() const; void setObject(QObject *); + bool restoreEntryValues() const; + void setRestoreEntryValues(bool); + virtual ActionList actions(); }; QML_DECLARE_TYPE(QmlSetProperties); diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp index 194cc1b..6261003 100644 --- a/src/declarative/util/qmlstate.cpp +++ b/src/declarative/util/qmlstate.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG); -Action::Action() : bv(0), event(0), actionDone(false) +Action::Action() : restore(true), bv(0), event(0), actionDone(false) { } @@ -344,7 +344,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever for (int ii = 0; ii < applyList.count(); ++ii) { const Action &action = applyList.at(ii); - if (action.event) + if (action.event || !action.restore) continue; bool found = false; diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h index 68c43fa..dd9d6ab 100644 --- a/src/declarative/util/qmlstate.h +++ b/src/declarative/util/qmlstate.h @@ -61,6 +61,7 @@ public: Action(); QmlMetaProperty property; + bool restore; QVariant fromValue; QVariant toValue; QString fromBinding; -- cgit v0.12 From 48328daeb082385bd8f8074ee77c7cbee9cde637 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 19 May 2009 10:51:30 +0200 Subject: Fix autotest compile for qitemview on windows Reviewed-by: Thomas Zander --- tests/auto/qitemview/tst_qitemview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qitemview/tst_qitemview.cpp b/tests/auto/qitemview/tst_qitemview.cpp index 748bd50..3317c1d 100644 --- a/tests/auto/qitemview/tst_qitemview.cpp +++ b/tests/auto/qitemview/tst_qitemview.cpp @@ -42,7 +42,7 @@ #include #include -#include +#include "viewstotest.cpp" #include #if defined(Q_OS_WIN) -- cgit v0.12 From 46f776a1c6b7e72ebe69ecde130d514b69fe4319 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 19 May 2009 10:51:19 +0200 Subject: Fixed autotest tst_QPrinter::printDialogCompleter on Windows. QApplication::activeWindow() returns null for native dialogs, so null cannot be passed as the target widget when calling QTest::keyClick(). --- tests/auto/qprinter/tst_qprinter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index cde4ae5..221e3b0 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -953,8 +953,9 @@ void tst_QPrinter::printDialogCompleter() QTest::qWait(100); - QTest::keyClick(0, Qt::Key_Tab); - QTest::keyClick(0, 'P'); + QTest::keyClick(&dialog, Qt::Key_Tab); + QTest::keyClick(&dialog, 'P'); + // The test passes if it doesn't crash. #endif } -- cgit v0.12 From 589a8689705dc0572990b416f7ef085986ff2f57 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 19 May 2009 11:00:41 +0200 Subject: Fix autotest for qitemmodel on windows Fixed a broken include Reviewed-by: Thomas Zander --- tests/auto/qitemmodel/tst_qitemmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qitemmodel/tst_qitemmodel.cpp b/tests/auto/qitemmodel/tst_qitemmodel.cpp index ea1972e..d29a3e3 100644 --- a/tests/auto/qitemmodel/tst_qitemmodel.cpp +++ b/tests/auto/qitemmodel/tst_qitemmodel.cpp @@ -54,7 +54,7 @@ #include #include #include -#include +#include "modelstotest.cpp" #include Q_DECLARE_METATYPE(QModelIndex) -- cgit v0.12 From ba5fb9f05c891feac8ab69006189de1aaafebc18 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 19 May 2009 11:40:45 +0200 Subject: Cocoa 64: ssl does not work The reason is the tha config.test ssl failed building. And the reason for that was a bad makefile flag (i386_64). Task-number: 253887 Reviewed-by: Trenton Schulz --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index bd77174..20bf457 100755 --- a/configure +++ b/configure @@ -2717,6 +2717,7 @@ if [ "$PLATFORM_MAC" = "yes" ]; then # Build commmand line arguments we can pass to the compiler during configure tests # by prefixing each arch with "-arch". CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS/x86/i386}" + CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS/i386_64/x86_64}" for ARCH in $CFG_MAC_ARCHS_GCC_FORMAT; do MAC_ARCHS_COMMANDLINE="$MAC_ARCHS_COMMANDLINE -arch $ARCH" done -- cgit v0.12 From 30f7edc0aab629499b74263391ae529ad31b2ff8 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 19 May 2009 10:42:46 +0200 Subject: Ignore GCC warning of unsafe floating point comparisons. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to optimizations, there are few cases where comparing with a constant is needed, e.g. in operator*=. G++ will give us a warning for this. Since we know what we are doing, surpress the warning. The only drawback for this workaround is if somebody includes qtransform.h in his code and disable the float-equal warning since the warning will be activated again. Reviewed-by: Samuel Rødal --- src/gui/painting/qtransform.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index c76409b..4ea1be3 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -255,6 +255,13 @@ inline qreal QTransform::dy() const return affine._dy; } +#if defined(Q_CC_GNU) +# define Q_CC_GNU_VERSION (((__GNUC__)<<16)|((__GNUC_MINOR__)<<8)|(__GNUC_PATCHLEVEL__)) +# if Q_CC_GNU_VERSION >= 0x040201 +# pragma GCC diagnostic ignored "-Wfloat-equal" +# endif +#endif + inline QTransform &QTransform::operator*=(qreal num) { if (num == 1.) @@ -311,6 +318,13 @@ inline QTransform &QTransform::operator-=(qreal num) return *this; } +#if defined(Q_CC_GNU_VERSION) +# if Q_CC_GNU_VERSION >= 0x040201 +# pragma GCC diagnostic warning "-Wfloat-equal" +# endif +# undef Q_GCC_GNU_VERSION +#endif + /****** stream functions *******************/ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTransform &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTransform &); -- cgit v0.12 From ec9606bc65aaee81a4defea64afe58594349472a Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 19 May 2009 12:19:40 +0200 Subject: compile fixes with namespaces --- src/gui/image/qpixmapcache_p.h | 4 ++++ tools/kmap2qmap/main.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h index 66b30d2..5aa6eaf 100644 --- a/src/gui/image/qpixmapcache_p.h +++ b/src/gui/image/qpixmapcache_p.h @@ -58,6 +58,8 @@ #include #include "qcache.h" +QT_BEGIN_NAMESPACE + class QPixmapCache::KeyData { public: @@ -89,4 +91,6 @@ public: } }; +QT_END_NAMESPACE + #endif // QPIXMAPCACHE_P_H diff --git a/tools/kmap2qmap/main.cpp b/tools/kmap2qmap/main.cpp index b518392..12d91c6 100644 --- a/tools/kmap2qmap/main.cpp +++ b/tools/kmap2qmap/main.cpp @@ -384,10 +384,12 @@ static const symbol_synonyms_t symbol_synonyms[] = { static const int symbol_synonyms_size = sizeof(symbol_synonyms)/sizeof(symbol_synonyms_t); // makes the generated array in --header mode a bit more human readable +QT_BEGIN_NAMESPACE static bool operator<(const QWSKeyboard::Mapping &m1, const QWSKeyboard::Mapping &m2) { return m1.keycode != m2.keycode ? m1.keycode < m2.keycode : m1.modifiers < m2.modifiers; } +QT_END_NAMESPACE class KeymapParser { public: -- cgit v0.12 From c8f8405d154cf1c24b50777e5db2ac2ab1609b39 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 19 May 2009 12:29:55 +0200 Subject: qdoc: Corrected an escape sequence in the credits file. --- doc/src/credits.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/credits.qdoc b/doc/src/credits.qdoc index 114e28d..b492967 100644 --- a/doc/src/credits.qdoc +++ b/doc/src/credits.qdoc @@ -188,7 +188,7 @@ Jesper K. Pedersen \br Jim Lauchlan \br Joachim Backes \br - Jochen Römmler \br + Jochen \ouml\c{}mmler \br Jochen Scharrlach \br Joe Croft \br Joel Lindholm \br -- cgit v0.12 From e5608cd95684a010510b136361415d47cfc53e8a Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Tue, 19 May 2009 12:38:16 +0200 Subject: Clearifying QUrl docs Adding more details on QUrl::addQueryItem() Task-number: 234125 Rev-by: Thiago Macieira --- src/corelib/io/qurl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 9ce9a2e..d1a5cdd 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -4759,6 +4759,12 @@ void QUrl::setEncodedQueryItems(const QList > &que Inserts the pair \a key = \a value into the query string of the URL. + The key/value pair is encoded before it is added to the query. The + pair is converted into separate strings internally. The \a key and + \a value is first encoded into UTF-8 and then delimited by the + character returned by valueDelimiter(). Each key/value pair is + delimited by the character returned by pairDelimiter(). + \sa addEncodedQueryItem() */ void QUrl::addQueryItem(const QString &key, const QString &value) -- cgit v0.12 From 01fd310f47a4a0cf7a72366105cc36e07550494c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 19 May 2009 10:59:02 +0200 Subject: fix compiler warnings when qreal == float in tessellator autotest Reviewed-by: mauricek --- tests/auto/qtessellator/tst_tessellator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qtessellator/tst_tessellator.cpp b/tests/auto/qtessellator/tst_tessellator.cpp index 8958ac3..8899285 100644 --- a/tests/auto/qtessellator/tst_tessellator.cpp +++ b/tests/auto/qtessellator/tst_tessellator.cpp @@ -218,8 +218,8 @@ void tst_QTessellator::testArc() const int stop = 1000; #endif for (int i = 0; i < stop; ++i) { - mat.rotate(.01); - mat.scale(.99, .99); + mat.rotate(qreal(.01)); + mat.scale(qreal(.99), qreal(.99)); QPolygonF poly = arc.at(0); QPolygonF vec = poly * mat; QVERIFY(test_arc(vec, true)); @@ -361,11 +361,11 @@ void tst_QTessellator::testRects() QVector v(5); for (int i = 0; i < 5; ++i) v[i] = vec[5 * rect + i]; - if (!test(v.data(), v.size(), false, test_tessellate_polygon_rect, 0.05)) { + if (!test(v.data(), v.size(), false, test_tessellate_polygon_rect, qreal(0.05))) { simplifyTestFailure(v, false); ++failures; } - if (!test(v.data(), v.size(), true, test_tessellate_polygon_rect, 0.05)) { + if (!test(v.data(), v.size(), true, test_tessellate_polygon_rect, qreal(0.05))) { simplifyTestFailure(v, true); ++failures; } -- cgit v0.12 From ad9d9a93e1f63e2509e9cdb8c245853fb3c8674a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 19 May 2009 11:00:31 +0200 Subject: Windows CE autotest compile fixes Not always is "." in the includes path... Reviewed-by: mauricek --- tests/auto/qfuture/tst_qfuture.cpp | 2 +- tests/auto/qtessellator/testtessellator.cpp | 2 +- tests/auto/qtessellator/utils.cpp | 2 +- tests/auto/qthreadonce/tst_qthreadonce.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qfuture/tst_qfuture.cpp b/tests/auto/qfuture/tst_qfuture.cpp index 43fd614..383ecba 100644 --- a/tests/auto/qfuture/tst_qfuture.cpp +++ b/tests/auto/qfuture/tst_qfuture.cpp @@ -45,7 +45,7 @@ #include #include -#include +#include "versioncheck.h" #include #include #include diff --git a/tests/auto/qtessellator/testtessellator.cpp b/tests/auto/qtessellator/testtessellator.cpp index bd2795c..423c1e8 100644 --- a/tests/auto/qtessellator/testtessellator.cpp +++ b/tests/auto/qtessellator/testtessellator.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include +#include "testtessellator.h" #include #include "math.h" diff --git a/tests/auto/qtessellator/utils.cpp b/tests/auto/qtessellator/utils.cpp index 8a9dc1e..d408193 100644 --- a/tests/auto/qtessellator/utils.cpp +++ b/tests/auto/qtessellator/utils.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include "qnum.h" #define FloatToXFixed(i) (int)((i) * 65536) #define IntToXFixed(i) ((i) << 16) diff --git a/tests/auto/qthreadonce/tst_qthreadonce.cpp b/tests/auto/qthreadonce/tst_qthreadonce.cpp index 7e67dc3..f20788a 100644 --- a/tests/auto/qthreadonce/tst_qthreadonce.cpp +++ b/tests/auto/qthreadonce/tst_qthreadonce.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include "qthreadonce.h" //TESTED_CLASS= //TESTED_FILES=corelib/thread/qthreadonce.h corelib/thread/qthreadonce.cpp -- cgit v0.12 From c73a5b4abfb1f05f8f976c526e0954680a3ed00e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 19 May 2009 12:48:50 +0200 Subject: qdoc: Corrected a misspelled name. --- doc/src/credits.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/credits.qdoc b/doc/src/credits.qdoc index b492967..6b48514 100644 --- a/doc/src/credits.qdoc +++ b/doc/src/credits.qdoc @@ -188,7 +188,7 @@ Jesper K. Pedersen \br Jim Lauchlan \br Joachim Backes \br - Jochen \ouml\c{}mmler \br + Jochen R\ouml\c{}mmler \br Jochen Scharrlach \br Joe Croft \br Joel Lindholm \br -- cgit v0.12 From 29b1965fd198b35d8f1af20becf9ed9cab54a49f Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 19 May 2009 12:45:31 +0200 Subject: Updated WebKit from /home/ariya/dev/webkit/qtwebkit-4.5 to origin/qtwebkit-4.5 ( 7b8d6ab6f2b73862d11c2a41ab0223e55585d88f ) Changes in WebKit since the last update: ++ b/WebKit/qt/ChangeLog 2009-03-27 Erik L. Bunce Reviewed by Simon Hausmann. https://bugs.webkit.org/show_bug.cgi?id=24746 Improved selection tests. * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::textSelection): --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 11 ++++++ .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 39 ++++++++++++++++------ 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index f5402ce..9f85d76 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 - 1f83e4058bffd5a3fe7e44cf45add01953a772d4 + 7b8d6ab6f2b73862d11c2a41ab0223e55585d88f diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index c3bd633..2aeb8da 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,14 @@ +2009-03-27 Erik L. Bunce + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=24746 + + Improved selection tests. + + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::textSelection): + 2009-04-24 Simon Hausmann Rubber-stamped by Ariya Hidayat. diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index fe74fac..620aa31 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -872,14 +872,6 @@ void tst_QWebPage::textSelection() "

    May the source
    be with you!

    "); page->mainFrame()->setHtml(content); - // this will select the first paragraph - QString script = "var range = document.createRange(); " \ - "var node = document.getElementById(\"one\"); " \ - "range.selectNode(node); " \ - "getSelection().addRange(range);"; - page->mainFrame()->evaluateJavaScript(script); - QCOMPARE(page->selectedText().trimmed(), QString::fromLatin1("The quick brown fox")); - // these actions must exist QVERIFY(page->action(QWebPage::SelectAll) != 0); QVERIFY(page->action(QWebPage::SelectNextChar) != 0); @@ -895,7 +887,8 @@ void tst_QWebPage::textSelection() QVERIFY(page->action(QWebPage::SelectStartOfDocument) != 0); QVERIFY(page->action(QWebPage::SelectEndOfDocument) != 0); - // right now they are disabled because contentEditable is false + // right now they are disabled because contentEditable is false and + // there isn't an existing selection to modify QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectNextWord)->isEnabled(), false); @@ -912,11 +905,37 @@ void tst_QWebPage::textSelection() // ..but SelectAll is awalys enabled QCOMPARE(page->action(QWebPage::SelectAll)->isEnabled(), true); + // this will select the first paragraph + QString selectScript = "var range = document.createRange(); " \ + "var node = document.getElementById(\"one\"); " \ + "range.selectNode(node); " \ + "getSelection().addRange(range);"; + page->mainFrame()->evaluateJavaScript(selectScript); + QCOMPARE(page->selectedText().trimmed(), QString::fromLatin1("The quick brown fox")); + + // here the actions are enabled after a selection has been created + QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::SelectNextWord)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::SelectPreviousWord)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::SelectNextLine)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::SelectPreviousLine)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::SelectStartOfLine)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::SelectEndOfLine)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::SelectStartOfBlock)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::SelectEndOfBlock)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::SelectStartOfDocument)->isEnabled(), true); + QCOMPARE(page->action(QWebPage::SelectEndOfDocument)->isEnabled(), true); + // make it editable before navigating the cursor page->setContentEditable(true); + // cursor will be before the word "The", this makes sure there is a charet + page->triggerAction(QWebPage::MoveToStartOfDocument); + QVERIFY(page->isSelectionCollapsed()); + QCOMPARE(page->selectionStartOffset(), 0); + // here the actions are enabled after contentEditable is true - QCOMPARE(page->action(QWebPage::SelectAll)->isEnabled(), true); QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), true); QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), true); QCOMPARE(page->action(QWebPage::SelectNextWord)->isEnabled(), true); -- cgit v0.12 From cf427e8dcbfc63cbad67117d2da6d554aea495a9 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 19 May 2009 12:49:29 +0200 Subject: make splitter autotest pass on mac too It's not enough to call processEvents() just once on all platforms. --- tests/auto/qsplitter/tst_qsplitter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/auto/qsplitter/tst_qsplitter.cpp b/tests/auto/qsplitter/tst_qsplitter.cpp index b463f7f..51bd99f 100644 --- a/tests/auto/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/qsplitter/tst_qsplitter.cpp @@ -55,6 +55,7 @@ #include #include #include // for file error messages +#include "../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= @@ -1341,9 +1342,7 @@ void tst_QSplitter::task187373_addAbstractScrollAreas() if (addOutsideConstructor) splitter->addWidget(w); - qApp->processEvents(); - - QVERIFY(w->isVisible()); + QTRY_VERIFY(w->isVisible()); QVERIFY(!w->isHidden()); QVERIFY(w->viewport()->isVisible()); QVERIFY(!w->viewport()->isHidden()); -- cgit v0.12 From 071709fb6f3988f29767074c759436cccb33bcc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 19 May 2009 12:04:15 +0200 Subject: qmake autotest: Remove dependency on Qt3 Support on Windows Reviewed-by: jbache --- tests/auto/qmake/testcompiler.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/qmake/testcompiler.cpp index 122a2b8..7255d93 100644 --- a/tests/auto/qmake/testcompiler.cpp +++ b/tests/auto/qmake/testcompiler.cpp @@ -56,10 +56,8 @@ static QString targetName( BuildType buildMode, const QString& target, const QSt targetName.append(".exe"); break; case Dll: // dll - if (version != "") { - QStringList ver = QStringList::split(".", version); - targetName.append(ver.first()); - } + if (!version.empty()) + targetName.append(version.section(".", 0, 0)); targetName.append(".dll"); break; case Lib: // lib -- cgit v0.12 From 41ba7d4a000181607004d450a8130be902a42274 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 19 May 2009 10:39:50 +0200 Subject: grabWindow in MacGui test was grabbing the wrong area. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I think grabWindow was borken and we were compensating for it in the auto test. Now that it works as documented our workaround broke. Reviewed-by: Morten Sørvig --- tests/auto/macgui/tst_gui.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/auto/macgui/tst_gui.cpp b/tests/auto/macgui/tst_gui.cpp index b302f8b..641e596 100644 --- a/tests/auto/macgui/tst_gui.cpp +++ b/tests/auto/macgui/tst_gui.cpp @@ -69,8 +69,7 @@ private slots: QPixmap grabWindowContents(QWidget * widget) { - const int titleBarHeight = widget->frameGeometry().height() - widget->height(); - return QPixmap::grabWindow(widget->winId(), 0, titleBarHeight, -1, widget->height()); + return QPixmap::grabWindow(widget->winId()); } /* @@ -79,10 +78,6 @@ QPixmap grabWindowContents(QWidget * widget) */ void tst_gui::scrollbarPainting() { -#if defined (Q_WS_MAC) && defined (__i386__) - QSKIP("This test fails on scruffy when run by the autotest system (but not when you run it manually).", SkipAll); -#endif - ColorWidget colorWidget; colorWidget.resize(400, 400); -- cgit v0.12 From 8413073fe3946ed37f6424f179898af63767f060 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 19 May 2009 13:08:16 +0200 Subject: Don't "hope" that a connection gets picked up; do it right! While downloadProgress and uploadProgress both work on local files. There still may be a delay before the connection is actually picked up. This usually is caught by the processEvents(), but could be missed. Therefore, do a wait if we don't have any pending connections and work in ALL cases. Reviewed-by: Markus Goetz --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index bb199b9..d651ce5 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -2637,7 +2637,8 @@ void tst_QNetworkReply::downloadProgress() QVERIFY(spy.isValid()); QCoreApplication::instance()->processEvents(); - server.waitForNewConnection(0); // ignore result, since processEvents may have got it + if (!server.hasPendingConnections()) + server.waitForNewConnection(1000); QVERIFY(server.hasPendingConnections()); QCOMPARE(spy.count(), 0); @@ -2691,7 +2692,8 @@ void tst_QNetworkReply::uploadProgress() QVERIFY(finished.isValid()); QCoreApplication::instance()->processEvents(); - server.waitForNewConnection(0); // ignore result, since processEvents may have got it + if (!server.hasPendingConnections()) + server.waitForNewConnection(1000); QVERIFY(server.hasPendingConnections()); QTcpSocket *receiver = server.nextPendingConnection(); -- cgit v0.12 From 3fe79f2524b7d37ddbc93edbbd0530a7499b5450 Mon Sep 17 00:00:00 2001 From: Nils Christian Roscher-Nielsen Date: Tue, 19 May 2009 13:27:59 +0200 Subject: Clarifying what QLocale::C is and is not Reviewed-by: David Boddie --- src/corelib/tools/qlocale.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 559ba81..ab26945 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -1589,7 +1589,7 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l) defaults to the default locale (see setDefault()). \endlist - The "C" locale is identical to \l{English}/\l{UnitedStates}. + The "C" locale is identical in behavior to \l{English}/\l{UnitedStates}. Use language() and country() to determine the actual language and country values used. @@ -1632,7 +1632,7 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l) This enumerated type is used to specify a language. - \value C The "C" locale is English/UnitedStates. + \value C The "C" locale is identical in behavior to English/UnitedStates. \value Abkhazian \value Afan \value Afar -- cgit v0.12 From e85bab636c2ab5d5b538363150433f6a0269a659 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 19 May 2009 13:29:39 +0200 Subject: Use QtNetworkSettings, don't hard code IMAP host name. This should fix failures in Berlin. --- tests/auto/qiodevice/tst_qiodevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qiodevice/tst_qiodevice.cpp b/tests/auto/qiodevice/tst_qiodevice.cpp index 03a0665..367a2e0 100644 --- a/tests/auto/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/qiodevice/tst_qiodevice.cpp @@ -120,7 +120,7 @@ void tst_QIODevice::constructing_QTcpSocket() QVERIFY(!device->isOpen()); - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket.waitForConnected(5000)); QVERIFY(device->isOpen()); @@ -134,7 +134,7 @@ void tst_QIODevice::constructing_QTcpSocket() QCOMPARE(socket.pos(), qlonglong(0)); socket.close(); - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket.waitForConnected(5000)); while (!device->canReadLine()) -- cgit v0.12 From 78e46412675ba15ab16965d651e35c94c5861f90 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 19 May 2009 13:29:45 +0200 Subject: network autotests: do not use imap.troll.no for testing ... but use the test server instead Reviewed-by: Frans Englich --- tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp | 8 ++++---- tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp index 9ef8f9a..df83efe 100644 --- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -451,14 +451,14 @@ void tst_QHttpSocketEngine::tcpSocketBlockingTest() QTcpSocket socket; // Connect - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket.waitForConnected()); QCOMPARE(socket.state(), QTcpSocket::ConnectedState); // Read greeting QVERIFY(socket.waitForReadyRead(5000)); QString s = socket.readLine(); - QCOMPARE(s.toLatin1().constData(), "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + QCOMPARE(s.toLatin1().constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write NOOP QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8); @@ -508,7 +508,7 @@ void tst_QHttpSocketEngine::tcpSocketNonBlockingTest() tcpSocketNonBlocking_socket = &socket; // Connect - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QCOMPARE(socket.state(), QTcpSocket::HostLookupState); QTestEventLoop::instance().enterLoop(30); @@ -533,7 +533,7 @@ void tst_QHttpSocketEngine::tcpSocketNonBlockingTest() // Read greeting QVERIFY(!tcpSocketNonBlocking_data.isEmpty()); QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); tcpSocketNonBlocking_data.clear(); tcpSocketNonBlocking_totalWritten = 0; diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp index 86333e0..f8c2fdb 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -589,14 +589,14 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest() QTcpSocket socket; // Connect - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket.waitForConnected()); QCOMPARE(socket.state(), QTcpSocket::ConnectedState); // Read greeting QVERIFY(socket.waitForReadyRead(5000)); QString s = socket.readLine(); - QCOMPARE(s.toLatin1().constData(), "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + QCOMPARE(s.toLatin1().constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write NOOP QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8); @@ -646,7 +646,7 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest() tcpSocketNonBlocking_socket = &socket; // Connect - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QCOMPARE(socket.state(), QTcpSocket::HostLookupState); QTestEventLoop::instance().enterLoop(30); @@ -671,7 +671,7 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest() // Read greeting QVERIFY(!tcpSocketNonBlocking_data.isEmpty()); QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); tcpSocketNonBlocking_data.clear(); tcpSocketNonBlocking_totalWritten = 0; -- cgit v0.12 From fdce2331a7491b5452c63666267ca2b8b98d1298 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 19 May 2009 13:53:12 +0200 Subject: Use QtNetworkSettings for IMAP server, instead of hard coding. Reviewed-by: Peter Hartmann --- tests/auto/qsslsocket/tst_qsslsocket.cpp | 6 +++--- tests/auto/qtcpserver/tst_qtcpserver.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 432092a..79fbf1b 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -416,7 +416,7 @@ void tst_QSslSocket::simpleConnect() connect(&socket, SIGNAL(sslErrors(const QList &)), this, SLOT(exitLoop())); // Start connecting - socket.connectToHost("imap.troll.no", 993); + socket.connectToHost(QtNetworkSettings::serverName(), 993); QCOMPARE(socket.state(), QAbstractSocket::HostLookupState); enterLoop(10); @@ -471,7 +471,7 @@ void tst_QSslSocket::simpleConnectWithIgnore() connect(&socket, SIGNAL(sslErrors(const QList &)), this, SLOT(exitLoop())); // Start connecting - socket.connectToHost("imap.troll.no", 993); + socket.connectToHost(QtNetworkSettings::serverName(), 993); QCOMPARE(socket.state(), QAbstractSocket::HostLookupState); enterLoop(10); @@ -490,7 +490,7 @@ void tst_QSslSocket::simpleConnectWithIgnore() if (!socket.canReadLine()) enterLoop(10); - QCOMPARE(socket.readAll(), QByteArray("* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n")); + QCOMPARE(socket.readAll(), QByteArray("* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN SASL-IR] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n")); socket.disconnectFromHost(); } diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp index 50b293d..4fd1827 100644 --- a/tests/auto/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp @@ -364,7 +364,7 @@ void tst_QTcpServer::ipv6LoopbackPerformanceTest() void tst_QTcpServer::ipv4PerformanceTest() { QTcpSocket probeSocket; - probeSocket.connectToHost("imap.troll.no", 143); + probeSocket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(probeSocket.waitForConnected(5000)); QTcpServer server; -- cgit v0.12 From ac70ce3f2598f0f3aae64c2e39c580375fd62df0 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 19 May 2009 13:59:54 +0200 Subject: Set the resolution when saving a tiff file The resolution was not saved when the image was saved as tiff. This fix add the resolution, and try to guess if the user have set it in dpi or dot per centimeter Task-number: 245242 Reviewed-by: Samuel --- src/plugins/imageformats/tiff/qtiffhandler.cpp | 20 +++++++++++++- tests/auto/qimagewriter/tst_qimagewriter.cpp | 38 +++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp index 518e6d1..77dfeb3 100644 --- a/src/plugins/imageformats/tiff/qtiffhandler.cpp +++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp @@ -168,7 +168,7 @@ bool QTiffHandler::read(QImage *image) break; default: // do nothing as defaults have already - // been set within the QImage class + // been set within the QImage class break; } for (uint32 y=0; y(image.logicalDpiX())) + && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, static_cast(image.logicalDpiY())); + } + if (!resolutionSet) { + TIFFClose(tiff); + return false; + } // try to do the ARGB32 conversion in chunks no greater than 16 MB int chunks = (width * height * 4 / (1024 * 1024 * 16)) + 1; int chunkHeight = qMax(height / chunks, 1); diff --git a/tests/auto/qimagewriter/tst_qimagewriter.cpp b/tests/auto/qimagewriter/tst_qimagewriter.cpp index 878d398..70d9e70 100644 --- a/tests/auto/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/qimagewriter/tst_qimagewriter.cpp @@ -97,6 +97,9 @@ private slots: void saveWithNoFormat_data(); void saveWithNoFormat(); + void resolution_data(); + void resolution(); + void saveToTemporaryFile(); }; @@ -162,7 +165,7 @@ tst_QImageWriter::tst_QImageWriter() tst_QImageWriter::~tst_QImageWriter() { - QDir dir("images"); + QDir dir(prefix + QLatin1String("images")); QStringList filesToDelete = dir.entryList(QStringList() << "gen-*" , QDir::NoDotAndDotDot | QDir::Files); foreach( QString file, filesToDelete) { QFile::remove(dir.absoluteFilePath(file)); @@ -530,6 +533,39 @@ void tst_QImageWriter::saveWithNoFormat() QVERIFY2(!outImage.isNull(), qPrintable(reader.errorString())); } +void tst_QImageWriter::resolution_data() +{ + QTest::addColumn("filename"); + QTest::addColumn("expectedDotsPerMeterX"); + QTest::addColumn("expectedDotsPerMeterY"); +#if defined QTEST_HAVE_TIFF + QTest::newRow("TIFF: 100 dpi") << ("image_100dpi.tif") << qRound(100 * (100 / 2.54)) << qRound(100 * (100 / 2.54)); + QTest::newRow("TIFF: 50 dpi") << ("image_50dpi.tif") << qRound(50 * (100 / 2.54)) << qRound(50 * (100 / 2.54)); + QTest::newRow("TIFF: 300 dot per meter") << ("image_300dpm.tif") << 300 << 300; +#endif +} + +void tst_QImageWriter::resolution() +{ + QFETCH(QString, filename); + QFETCH(int, expectedDotsPerMeterX); + QFETCH(int, expectedDotsPerMeterY); + + QImage image(prefix + QLatin1String("colorful.bmp")); + image.setDotsPerMeterX(expectedDotsPerMeterX); + image.setDotsPerMeterY(expectedDotsPerMeterY); + const QString generatedFilepath = prefix + "gen-" + filename; + { + QImageWriter writer(generatedFilepath); + QVERIFY(writer.write(image)); + } + QImageReader reader(generatedFilepath); + const QImage generatedImage = reader.read(); + + QCOMPARE(expectedDotsPerMeterX, generatedImage.dotsPerMeterX()); + QCOMPARE(expectedDotsPerMeterY, generatedImage.dotsPerMeterY()); +} + void tst_QImageWriter::saveToTemporaryFile() { QImage image(prefix + "kollada.png"); -- cgit v0.12 From 21b1acda8aa202c6bd086344888ecb29757fe5bf Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 19 May 2009 12:43:51 +0200 Subject: make the web browser URL field work a little better The return key still doesn't do what it should do, but that's partly the fault of the KeyProxy's QML definition not working correctly. --- demos/declarative/webbrowser/webbrowser.qml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 4b03b63..df0e1a7 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -114,6 +114,7 @@ Item { opacity: 1-Header.progressOff clip: true } + /* KeyProxy { id: proxy @@ -140,24 +141,11 @@ Item { anchors.leftMargin: 6 anchors.verticalCenter: UrlBox.verticalCenter anchors.verticalCenterOffset: 1 - - opacity: 0 - } - Text { - id: ShowUrl - text: WebView.url == '' ? ' ' : WebView.url - font.size: 11 - color: "#555555" - anchors.left: UrlBox.left - anchors.right: UrlBox.right - anchors.leftMargin: 6 - anchors.verticalCenter: UrlBox.verticalCenter - anchors.verticalCenterOffset: 1 } } MouseRegion { anchors.fill: UrlBox - onClicked: { proxy.focus=true } + onClicked: { EditUrl.focus=true } } } -- cgit v0.12 From bfcc49068b99416af2711b48dc5cf6386224345b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 19 May 2009 12:54:22 +0200 Subject: better focus handling for the location bar --- demos/declarative/webbrowser/webbrowser.qml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index df0e1a7..a38d032 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -135,6 +135,7 @@ Item { wrap: false font.size: 11 color: "#555555" + focusOnPress: true anchors.left: UrlBox.left anchors.right: UrlBox.right @@ -143,10 +144,6 @@ Item { anchors.verticalCenterOffset: 1 } } - MouseRegion { - anchors.fill: UrlBox - onClicked: { EditUrl.focus=true } - } } property real progressOff : 1 -- cgit v0.12 From 07c879367e4a8e9038c5eb7d100ed0e4facd9329 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 19 May 2009 14:19:50 +0200 Subject: no need to translate graphics events to regular ones QTextControl can handle graphics mouse events directly, no need to translate them to regular mouse events. --- src/declarative/fx/qfxtextedit.cpp | 39 +++----------------------------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 35b1173..8667c9e 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -662,7 +662,6 @@ void QFxTextEdit::keyReleaseEvent(QKeyEvent *event) */ void QFxTextEdit::focusChanged(bool hasFocus) { - Q_D(QFxTextEdit); setCursorVisible(hasFocus); } @@ -675,29 +674,6 @@ void QFxTextEdit::selectAll() d->control->selectAll(); } -static QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e) -{ - QEvent::Type t; - switch(e->type()) { - default: - case QEvent::GraphicsSceneMousePress: - t = QEvent::MouseButtonPress; - break; - case QEvent::GraphicsSceneMouseRelease: - t = QEvent::MouseButtonRelease; - break; - case QEvent::GraphicsSceneMouseMove: - t = QEvent::MouseMove; - break; - case QGraphicsSceneEvent::GraphicsSceneMouseDoubleClick: - t = QEvent::MouseButtonDblClick; - break; - } - - QMouseEvent *me = new QMouseEvent(t, e->pos().toPoint(), e->button(), e->buttons(), 0); - return me; -} - /*! \overload Handles the given mouse \a event. @@ -707,10 +683,7 @@ void QFxTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) Q_D(QFxTextEdit); if (d->focusOnPress) setFocus(true); - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - d->control->processEvent(me, QPointF(0, 0)); - event->setAccepted(me->isAccepted()); - delete me; + d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) QFxPaintedItem::mousePressEvent(event); } @@ -722,10 +695,7 @@ Handles the given mouse \a event. void QFxTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_D(QFxTextEdit); - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - d->control->processEvent(me, QPointF(0, 0)); - event->setAccepted(me->isAccepted()); - delete me; + d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) QFxPaintedItem::mousePressEvent(event); } @@ -737,10 +707,7 @@ Handles the given mouse \a event. void QFxTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_D(QFxTextEdit); - QMouseEvent *me = sceneMouseEventToMouseEvent(event); - d->control->processEvent(me, QPointF(0, 0)); - event->setAccepted(me->isAccepted()); - delete me; + d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) QFxPaintedItem::mousePressEvent(event); } -- cgit v0.12 From 6402c393764c884e3e113a2bf155bf38ebcd9aa1 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 19 May 2009 14:38:27 +0200 Subject: Fix webkit import on cygwin and gentoo Use .XXXXX in mktemp. Reviewed-by: Janne Koskinen --- 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 d4e6d9e..c26fdc1 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -185,7 +185,7 @@ fi rev=`git ls-remote $repository | grep -E "^.+$tag$" | awk '{print $1}'` -tarball=`mktemp /tmp/webkit-snapshot.tar` || exit 1 +tarball=`mktemp /tmp/webkit-snapshot.tar.XXXXXX` || exit 1 echo "creating $tarball" echo "archiving webkit from $repository $tag ( $rev )" -- cgit v0.12 From 70429c33f0687afd489e1055bc0e1f1f340e13b9 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 19 May 2009 15:06:46 +0200 Subject: Adpot more code to use QtNetworkSettings instead of hard coded names. Reviewed-By: Peter Hartmann --- tests/auto/network-settings.h | 9 ++++++ tests/auto/q3socketdevice/tst_q3socketdevice.cpp | 7 +++-- .../qhttpsocketengine/tst_qhttpsocketengine.cpp | 23 ++++++--------- .../tst_qnativesocketengine.cpp | 16 ++++------- .../tst_qsocks5socketengine.cpp | 31 +++++++++----------- tests/auto/qsslsocket/tst_qsslsocket.cpp | 33 ++++++++++++---------- 6 files changed, 59 insertions(+), 60 deletions(-) diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index b2a449a..5a2f9c3 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include +#include class QtNetworkSettings { @@ -63,4 +64,12 @@ public: { return "qt-test-server.wildcard.dev." + serverDomainName(); } + +#ifdef QT_NETWORK_LIB + static QHostAddress serverIP() + { + return QHostInfo::fromName(serverName()).addresses().first(); + } +#endif + }; diff --git a/tests/auto/q3socketdevice/tst_q3socketdevice.cpp b/tests/auto/q3socketdevice/tst_q3socketdevice.cpp index 2b0c606..6255aee 100644 --- a/tests/auto/q3socketdevice/tst_q3socketdevice.cpp +++ b/tests/auto/q3socketdevice/tst_q3socketdevice.cpp @@ -45,6 +45,8 @@ #include +#include "../network-settings.h" + //TESTED_CLASS= //TESTED_FILES= @@ -97,8 +99,7 @@ void tst_Q3SocketDevice::readNull() int attempts = 10; while (attempts--) { - // connect to imap.troll.no - if (device.connect(QHostAddress("62.70.27.18"), 143)) + if (device.connect(QtNetworkSettings::serverIP(), 143)) break; } @@ -117,7 +118,7 @@ void tst_Q3SocketDevice::readNull() #endif QCOMPARE(device.peerPort(), quint16(143)); QCOMPARE(device.peerAddress().toString(), - QHostAddress("62.70.27.18").toString()); + QtNetworkSettings::serverIP().toString()); QCOMPARE(device.error(), Q3SocketDevice::NoError); // write a logout notice diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp index 9ef8f9a..4c92119 100644 --- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -137,8 +137,6 @@ public slots: } }; -static const char *IMAP_IP = "62.70.27.18"; - tst_QHttpSocketEngine::tst_QHttpSocketEngine() { } @@ -307,12 +305,11 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP() socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128)); - // Connect to imap.trolltech.com's IP - QVERIFY(!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); QVERIFY(!socketDevice.localAddress().isNull()); QVERIFY(socketDevice.localPort() > 0); @@ -328,7 +325,7 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP() // Check that the greeting is what we expect it to be QCOMPARE(array.constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; @@ -369,7 +366,6 @@ void tst_QHttpSocketEngine::simpleErrorsAndStates() QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverName()), 8088)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); if (socketDevice.waitForWrite(15000)) { - qDebug() << socketDevice.state(); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState || socketDevice.state() == QAbstractSocket::UnconnectedState); } else { @@ -451,14 +447,14 @@ void tst_QHttpSocketEngine::tcpSocketBlockingTest() QTcpSocket socket; // Connect - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket.waitForConnected()); QCOMPARE(socket.state(), QTcpSocket::ConnectedState); // Read greeting QVERIFY(socket.waitForReadyRead(5000)); QString s = socket.readLine(); - QCOMPARE(s.toLatin1().constData(), "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + QCOMPARE(s.toLatin1().constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write NOOP QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8); @@ -508,7 +504,7 @@ void tst_QHttpSocketEngine::tcpSocketNonBlockingTest() tcpSocketNonBlocking_socket = &socket; // Connect - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QCOMPARE(socket.state(), QTcpSocket::HostLookupState); QTestEventLoop::instance().enterLoop(30); @@ -696,12 +692,11 @@ void tst_QHttpSocketEngine::passwordAuth() socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128, "qsockstest", "password")); - // Connect to imap.trolltech.com's IP - QVERIFY(!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -715,7 +710,7 @@ void tst_QHttpSocketEngine::passwordAuth() // Check that the greeting is what we expect it to be QCOMPARE(array.constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; diff --git a/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp b/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp index 68ec414..90276f2 100644 --- a/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp +++ b/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp @@ -100,8 +100,6 @@ private slots: void receiveUrgentData(); }; -static const char *IMAP_IP = "62.70.27.18"; - tst_QNativeSocketEngine::tst_QNativeSocketEngine() { } @@ -155,15 +153,14 @@ void tst_QNativeSocketEngine::simpleConnectToIMAP() QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QVERIFY(socketDevice.state() == QAbstractSocket::UnconnectedState); - // Connect to imap.trolltech.com's IP - bool connected = socketDevice.connectToHost(QHostAddress(IMAP_IP), 143); - if (!connected) { + const bool isConnected = socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143); + if (!isConnected) { QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); } QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -176,7 +173,7 @@ void tst_QNativeSocketEngine::simpleConnectToIMAP() QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be - QCOMPARE(array.constData(), "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + QCOMPARE(array.constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "ZZZ LOGOUT\r\n"; @@ -580,9 +577,8 @@ void tst_QNativeSocketEngine::networkError() QVERIFY(client.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); - // Connect to imap.trolltech.com's IP - bool connected = client.connectToHost(QHostAddress(IMAP_IP), 143); - if (!connected) { + const bool isConnected = client.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143); + if (!isConnected) { QVERIFY(client.state() == QAbstractSocket::ConnectingState); QVERIFY(client.waitForWrite()); QVERIFY(client.state() == QAbstractSocket::ConnectedState); diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp index 86333e0..470f897 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -145,8 +145,6 @@ private slots: } }; -static const char *IMAP_IP = "62.70.27.18"; - tst_QSocks5SocketEngine::tst_QSocks5SocketEngine() { } @@ -321,12 +319,11 @@ void tst_QSocks5SocketEngine::simpleConnectToIMAP() socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); - // Connect to imap.trolltech.com's IP - QVERIFY(!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -340,7 +337,7 @@ void tst_QSocks5SocketEngine::simpleConnectToIMAP() // Check that the greeting is what we expect it to be QCOMPARE(array.constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; @@ -589,7 +586,7 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest() QTcpSocket socket; // Connect - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket.waitForConnected()); QCOMPARE(socket.state(), QTcpSocket::ConnectedState); @@ -646,7 +643,7 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest() tcpSocketNonBlocking_socket = &socket; // Connect - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QCOMPARE(socket.state(), QTcpSocket::HostLookupState); QTestEventLoop::instance().enterLoop(30); @@ -834,15 +831,14 @@ void tst_QSocks5SocketEngine::passwordAuth() socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080, "qsockstest", "password")); - // Connect to imap.trolltech.com's IP - QVERIFY(!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); - if (!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)) { + if (!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)) { qDebug("%d, %s", socketDevice.error(), socketDevice.errorString().toLatin1().constData()); } QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -856,7 +852,7 @@ void tst_QSocks5SocketEngine::passwordAuth() // Check that the greeting is what we expect it to be QCOMPARE(array.constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; @@ -902,17 +898,16 @@ void tst_QSocks5SocketEngine::passwordAuth2() socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1081)); socketDevice.setReceiver(this); - // Connect to imap.trolltech.com's IP - QVERIFY(!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); while (socketDevice.state() == QAbstractSocket::ConnectingState) { QVERIFY(socketDevice.waitForWrite()); - socketDevice.connectToHost(QHostAddress(IMAP_IP), 143); + socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143); } if (socketDevice.state() != QAbstractSocket::ConnectedState) qDebug("%d, %s", socketDevice.error(), socketDevice.errorString().toLatin1().constData()); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -926,7 +921,7 @@ void tst_QSocks5SocketEngine::passwordAuth2() // Check that the greeting is what we expect it to be QCOMPARE(array.constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 79fbf1b..d87ab7b 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -499,36 +499,39 @@ void tst_QSslSocket::sslErrors_data() { QTest::addColumn("host"); QTest::addColumn("port"); - QTest::addColumn("errors"); - - QTest::newRow("imap.troll.no") << "imap.troll.no" << 993 - << (SslErrorList() - << QSslError::HostNameMismatch - << QSslError::SelfSignedCertificateInChain); - QTest::newRow("imap.trolltech.com") << "imap.trolltech.com" << 993 - << (SslErrorList() - << QSslError::SelfSignedCertificateInChain); + QTest::addColumn("expected"); + + QTest::newRow(qPrintable(QtNetworkSettings::serverLocalName())) + << QtNetworkSettings::serverLocalName() + << 993 + << (SslErrorList() << QSslError::HostNameMismatch + << QSslError::SelfSignedCertificate); + + QTest::newRow("imap.trolltech.com") + << "imap.trolltech.com" + << 993 + << (SslErrorList() << QSslError::SelfSignedCertificateInChain); } void tst_QSslSocket::sslErrors() { QFETCH(QString, host); QFETCH(int, port); - QFETCH(SslErrorList, errors); + QFETCH(SslErrorList, expected); QSslSocketPtr socket = newSocket(); socket->connectToHostEncrypted(host, port); socket->waitForEncrypted(5000); - SslErrorList list; + SslErrorList output; foreach (QSslError error, socket->sslErrors()) - list << error.error(); + output << error.error(); #ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND - if (list.last() == QSslError::CertificateUntrusted) - list.takeLast(); + if (output.last() == QSslError::CertificateUntrusted) + output.takeLast(); #endif - QCOMPARE(list, errors); + QCOMPARE(output, expected); } void tst_QSslSocket::addCaCertificate() -- cgit v0.12 From bc5cf95c9622fee5bdcc97736dee11923aa9daf4 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 19 May 2009 13:29:39 +0200 Subject: Use QtNetworkSettings, don't hard code IMAP host name. This should fix failures in Berlin. --- tests/auto/qiodevice/tst_qiodevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qiodevice/tst_qiodevice.cpp b/tests/auto/qiodevice/tst_qiodevice.cpp index 03a0665..367a2e0 100644 --- a/tests/auto/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/qiodevice/tst_qiodevice.cpp @@ -120,7 +120,7 @@ void tst_QIODevice::constructing_QTcpSocket() QVERIFY(!device->isOpen()); - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket.waitForConnected(5000)); QVERIFY(device->isOpen()); @@ -134,7 +134,7 @@ void tst_QIODevice::constructing_QTcpSocket() QCOMPARE(socket.pos(), qlonglong(0)); socket.close(); - socket.connectToHost("imap.troll.no", 143); + socket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket.waitForConnected(5000)); while (!device->canReadLine()) -- cgit v0.12 From 879d5cf234bb06657b67a39969ea16d68f79fbeb Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 19 May 2009 13:53:12 +0200 Subject: Use QtNetworkSettings for IMAP server, instead of hard coding. Reviewed-by: Peter Hartmann --- tests/auto/qsslsocket/tst_qsslsocket.cpp | 6 +++--- tests/auto/qtcpserver/tst_qtcpserver.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 4f98624..3100dd5 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -415,7 +415,7 @@ void tst_QSslSocket::simpleConnect() connect(&socket, SIGNAL(sslErrors(const QList &)), this, SLOT(exitLoop())); // Start connecting - socket.connectToHost("imap.troll.no", 993); + socket.connectToHost(QtNetworkSettings::serverName(), 993); QCOMPARE(socket.state(), QAbstractSocket::HostLookupState); enterLoop(10); @@ -470,7 +470,7 @@ void tst_QSslSocket::simpleConnectWithIgnore() connect(&socket, SIGNAL(sslErrors(const QList &)), this, SLOT(exitLoop())); // Start connecting - socket.connectToHost("imap.troll.no", 993); + socket.connectToHost(QtNetworkSettings::serverName(), 993); QCOMPARE(socket.state(), QAbstractSocket::HostLookupState); enterLoop(10); @@ -489,7 +489,7 @@ void tst_QSslSocket::simpleConnectWithIgnore() if (!socket.canReadLine()) enterLoop(10); - QCOMPARE(socket.readAll(), QByteArray("* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n")); + QCOMPARE(socket.readAll(), QByteArray("* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN SASL-IR] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n")); socket.disconnectFromHost(); } diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp index 50b293d..4fd1827 100644 --- a/tests/auto/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp @@ -364,7 +364,7 @@ void tst_QTcpServer::ipv6LoopbackPerformanceTest() void tst_QTcpServer::ipv4PerformanceTest() { QTcpSocket probeSocket; - probeSocket.connectToHost("imap.troll.no", 143); + probeSocket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(probeSocket.waitForConnected(5000)); QTcpServer server; -- cgit v0.12 From 07e5f5f3b3b1936c5f5090b02cc2c02e344822b5 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 19 May 2009 15:06:46 +0200 Subject: Adpot more code to use QtNetworkSettings instead of hard coded names. Reviewed-By: Peter Hartmann --- tests/auto/network-settings.h | 9 ++++++ tests/auto/q3socketdevice/tst_q3socketdevice.cpp | 7 +++-- .../qhttpsocketengine/tst_qhttpsocketengine.cpp | 17 ++++------- .../tst_qnativesocketengine.cpp | 16 ++++------- .../tst_qsocks5socketengine.cpp | 27 ++++++++---------- tests/auto/qsslsocket/tst_qsslsocket.cpp | 33 ++++++++++++---------- 6 files changed, 54 insertions(+), 55 deletions(-) diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index b2a449a..5a2f9c3 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include +#include class QtNetworkSettings { @@ -63,4 +64,12 @@ public: { return "qt-test-server.wildcard.dev." + serverDomainName(); } + +#ifdef QT_NETWORK_LIB + static QHostAddress serverIP() + { + return QHostInfo::fromName(serverName()).addresses().first(); + } +#endif + }; diff --git a/tests/auto/q3socketdevice/tst_q3socketdevice.cpp b/tests/auto/q3socketdevice/tst_q3socketdevice.cpp index 2b0c606..6255aee 100644 --- a/tests/auto/q3socketdevice/tst_q3socketdevice.cpp +++ b/tests/auto/q3socketdevice/tst_q3socketdevice.cpp @@ -45,6 +45,8 @@ #include +#include "../network-settings.h" + //TESTED_CLASS= //TESTED_FILES= @@ -97,8 +99,7 @@ void tst_Q3SocketDevice::readNull() int attempts = 10; while (attempts--) { - // connect to imap.troll.no - if (device.connect(QHostAddress("62.70.27.18"), 143)) + if (device.connect(QtNetworkSettings::serverIP(), 143)) break; } @@ -117,7 +118,7 @@ void tst_Q3SocketDevice::readNull() #endif QCOMPARE(device.peerPort(), quint16(143)); QCOMPARE(device.peerAddress().toString(), - QHostAddress("62.70.27.18").toString()); + QtNetworkSettings::serverIP().toString()); QCOMPARE(device.error(), Q3SocketDevice::NoError); // write a logout notice diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp index df83efe..7eaf7c7 100644 --- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -137,8 +137,6 @@ public slots: } }; -static const char *IMAP_IP = "62.70.27.18"; - tst_QHttpSocketEngine::tst_QHttpSocketEngine() { } @@ -307,12 +305,11 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP() socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128)); - // Connect to imap.trolltech.com's IP - QVERIFY(!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); QVERIFY(!socketDevice.localAddress().isNull()); QVERIFY(socketDevice.localPort() > 0); @@ -328,7 +325,7 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP() // Check that the greeting is what we expect it to be QCOMPARE(array.constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; @@ -369,7 +366,6 @@ void tst_QHttpSocketEngine::simpleErrorsAndStates() QVERIFY(!socketDevice.connectToHost(QHostAddress(QtNetworkSettings::serverName()), 8088)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); if (socketDevice.waitForWrite(15000)) { - qDebug() << socketDevice.state(); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState || socketDevice.state() == QAbstractSocket::UnconnectedState); } else { @@ -696,12 +692,11 @@ void tst_QHttpSocketEngine::passwordAuth() socketDevice.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128, "qsockstest", "password")); - // Connect to imap.trolltech.com's IP - QVERIFY(!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -715,7 +710,7 @@ void tst_QHttpSocketEngine::passwordAuth() // Check that the greeting is what we expect it to be QCOMPARE(array.constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; diff --git a/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp b/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp index 68ec414..90276f2 100644 --- a/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp +++ b/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp @@ -100,8 +100,6 @@ private slots: void receiveUrgentData(); }; -static const char *IMAP_IP = "62.70.27.18"; - tst_QNativeSocketEngine::tst_QNativeSocketEngine() { } @@ -155,15 +153,14 @@ void tst_QNativeSocketEngine::simpleConnectToIMAP() QVERIFY(socketDevice.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); QVERIFY(socketDevice.state() == QAbstractSocket::UnconnectedState); - // Connect to imap.trolltech.com's IP - bool connected = socketDevice.connectToHost(QHostAddress(IMAP_IP), 143); - if (!connected) { + const bool isConnected = socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143); + if (!isConnected) { QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); } QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -176,7 +173,7 @@ void tst_QNativeSocketEngine::simpleConnectToIMAP() QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be - QCOMPARE(array.constData(), "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + QCOMPARE(array.constData(), "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "ZZZ LOGOUT\r\n"; @@ -580,9 +577,8 @@ void tst_QNativeSocketEngine::networkError() QVERIFY(client.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol)); - // Connect to imap.trolltech.com's IP - bool connected = client.connectToHost(QHostAddress(IMAP_IP), 143); - if (!connected) { + const bool isConnected = client.connectToHost(QHostAddress(QtNetworkSettings::serverIP()), 143); + if (!isConnected) { QVERIFY(client.state() == QAbstractSocket::ConnectingState); QVERIFY(client.waitForWrite()); QVERIFY(client.state() == QAbstractSocket::ConnectedState); diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp index f8c2fdb..f501e78 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -145,8 +145,6 @@ private slots: } }; -static const char *IMAP_IP = "62.70.27.18"; - tst_QSocks5SocketEngine::tst_QSocks5SocketEngine() { } @@ -321,12 +319,11 @@ void tst_QSocks5SocketEngine::simpleConnectToIMAP() socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); - // Connect to imap.trolltech.com's IP - QVERIFY(!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -340,7 +337,7 @@ void tst_QSocks5SocketEngine::simpleConnectToIMAP() // Check that the greeting is what we expect it to be QCOMPARE(array.constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; @@ -834,15 +831,14 @@ void tst_QSocks5SocketEngine::passwordAuth() socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080, "qsockstest", "password")); - // Connect to imap.trolltech.com's IP - QVERIFY(!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); QVERIFY(socketDevice.waitForWrite()); - if (!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)) { + if (!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)) { qDebug("%d, %s", socketDevice.error(), socketDevice.errorString().toLatin1().constData()); } QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -856,7 +852,7 @@ void tst_QSocks5SocketEngine::passwordAuth() // Check that the greeting is what we expect it to be QCOMPARE(array.constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; @@ -902,17 +898,16 @@ void tst_QSocks5SocketEngine::passwordAuth2() socketDevice.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1081)); socketDevice.setReceiver(this); - // Connect to imap.trolltech.com's IP - QVERIFY(!socketDevice.connectToHost(QHostAddress(IMAP_IP), 143)); + QVERIFY(!socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143)); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectingState); while (socketDevice.state() == QAbstractSocket::ConnectingState) { QVERIFY(socketDevice.waitForWrite()); - socketDevice.connectToHost(QHostAddress(IMAP_IP), 143); + socketDevice.connectToHost(QtNetworkSettings::serverIP(), 143); } if (socketDevice.state() != QAbstractSocket::ConnectedState) qDebug("%d, %s", socketDevice.error(), socketDevice.errorString().toLatin1().constData()); QVERIFY(socketDevice.state() == QAbstractSocket::ConnectedState); - QVERIFY(socketDevice.peerAddress() == QHostAddress(IMAP_IP)); + QVERIFY(socketDevice.peerAddress() == QtNetworkSettings::serverIP()); // Wait for the greeting QVERIFY(socketDevice.waitForRead()); @@ -926,7 +921,7 @@ void tst_QSocks5SocketEngine::passwordAuth2() // Check that the greeting is what we expect it to be QCOMPARE(array.constData(), - "* OK esparsett Cyrus IMAP4 v2.2.8 server ready\r\n"); + "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 3100dd5..5c99164 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -498,36 +498,39 @@ void tst_QSslSocket::sslErrors_data() { QTest::addColumn("host"); QTest::addColumn("port"); - QTest::addColumn("errors"); - - QTest::newRow("imap.troll.no") << "imap.troll.no" << 993 - << (SslErrorList() - << QSslError::HostNameMismatch - << QSslError::SelfSignedCertificateInChain); - QTest::newRow("imap.trolltech.com") << "imap.trolltech.com" << 993 - << (SslErrorList() - << QSslError::SelfSignedCertificateInChain); + QTest::addColumn("expected"); + + QTest::newRow(qPrintable(QtNetworkSettings::serverLocalName())) + << QtNetworkSettings::serverLocalName() + << 993 + << (SslErrorList() << QSslError::HostNameMismatch + << QSslError::SelfSignedCertificate); + + QTest::newRow("imap.trolltech.com") + << "imap.trolltech.com" + << 993 + << (SslErrorList() << QSslError::SelfSignedCertificateInChain); } void tst_QSslSocket::sslErrors() { QFETCH(QString, host); QFETCH(int, port); - QFETCH(SslErrorList, errors); + QFETCH(SslErrorList, expected); QSslSocketPtr socket = newSocket(); socket->connectToHostEncrypted(host, port); socket->waitForEncrypted(5000); - SslErrorList list; + SslErrorList output; foreach (QSslError error, socket->sslErrors()) - list << error.error(); + output << error.error(); #ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND - if (list.last() == QSslError::CertificateUntrusted) - list.takeLast(); + if (output.last() == QSslError::CertificateUntrusted) + output.takeLast(); #endif - QCOMPARE(list, errors); + QCOMPARE(output, expected); } void tst_QSslSocket::addCaCertificate() -- cgit v0.12 From 06cfcc9c8a328648d1000cc9fb1767a1b3e4d013 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Tue, 19 May 2009 15:21:40 +0200 Subject: Resolved reduce/reduce conflict between QML array literals and JS array literals. --- src/declarative/qml/parser/javascript.g | 102 +- src/declarative/qml/parser/javascriptgrammar.cpp | 1274 ++++++++++++---------- src/declarative/qml/parser/javascriptgrammar_p.h | 14 +- src/declarative/qml/parser/javascriptparser.cpp | 413 +++---- src/declarative/qml/parser/javascriptparser_p.h | 4 +- 5 files changed, 958 insertions(+), 849 deletions(-) diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g index 33847f2..155630b 100644 --- a/src/declarative/qml/parser/javascript.g +++ b/src/declarative/qml/parser/javascript.g @@ -823,25 +823,6 @@ case $rule_number: { } ./ -UiQualifiedId: JsIdentifier ; -/. -case $rule_number: { - AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).sval); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; -./ - -UiQualifiedId: UiQualifiedId T_DOT JsIdentifier ; -/. -case $rule_number: { - AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; -./ - - -------------------------------------------------------------------------------------------------------- -- Expressions -------------------------------------------------------------------------------------------------------- @@ -943,10 +924,20 @@ case $rule_number: { } break; ./ -PrimaryExpression: T_LBRACKET ElisionOpt T_RBRACKET ; +PrimaryExpression: T_LBRACKET T_RBRACKET ; /. case $rule_number: { - AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).Elision); + AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), (AST::Elision *) 0); + node->lbracketToken = loc(1); + node->rbracketToken = loc(2); + sym(1).Node = node; +} break; +./ + +PrimaryExpression: T_LBRACKET Elision T_RBRACKET ; +/. +case $rule_number: { + AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).Elision->finish()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; @@ -963,10 +954,23 @@ case $rule_number: { } break; ./ -PrimaryExpression: T_LBRACKET ElementList T_COMMA ElisionOpt T_RBRACKET ; +PrimaryExpression: T_LBRACKET ElementList T_COMMA T_RBRACKET ; +/. +case $rule_number: { + AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish (), + (AST::Elision *) 0); + node->lbracketToken = loc(1); + node->commaToken = loc(3); + node->rbracketToken = loc(4); + sym(1).Node = node; +} break; +./ + +PrimaryExpression: T_LBRACKET ElementList T_COMMA Elision T_RBRACKET ; /. case $rule_number: { - AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision); + AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish (), + sym(4).Elision->finish()); node->lbracketToken = loc(1); node->commaToken = loc(3); node->rbracketToken = loc(5); @@ -1017,51 +1021,73 @@ case $rule_number: { } break; ./ -ElementList: ElisionOpt AssignmentExpression ; +UiQualifiedId: JsIdentifier ; +/. +case $rule_number: { + AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).sval); + node->identifierToken = loc(1); + sym(1).Node = node; +} break; +./ + +UiQualifiedId: UiQualifiedId T_DOT JsIdentifier ; +/. +case $rule_number: { + AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval); + node->identifierToken = loc(3); + sym(1).Node = node; +} break; +./ + +ElementList: AssignmentExpression ; /. case $rule_number: { - sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Elision, sym(2).Expression); + sym(1).Node = makeAstNode (driver->nodePool(), (AST::Elision *) 0, sym(1).Expression); } break; ./ -ElementList: ElementList T_COMMA ElisionOpt AssignmentExpression ; +ElementList: Elision AssignmentExpression ; /. case $rule_number: { - AST::ElementList *node = makeAstNode (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression); - node->commaToken = loc(2); - sym(1).Node = node; + sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Elision->finish(), sym(2).Expression); } break; ./ -Elision: T_COMMA ; +ElementList: ElementList T_COMMA AssignmentExpression ; /. case $rule_number: { - AST::Elision *node = makeAstNode (driver->nodePool()); - node->commaToken = loc(1); + AST::ElementList *node = makeAstNode (driver->nodePool(), sym(1).ElementList, + (AST::Elision *) 0, sym(3).Expression); + node->commaToken = loc(2); sym(1).Node = node; } break; ./ -Elision: Elision T_COMMA ; +ElementList: ElementList T_COMMA Elision AssignmentExpression ; /. case $rule_number: { - AST::Elision *node = makeAstNode (driver->nodePool(), sym(1).Elision); + AST::ElementList *node = makeAstNode (driver->nodePool(), sym(1).ElementList, sym(3).Elision->finish(), + sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; ./ -ElisionOpt: %prec SHIFT_THERE ; +Elision: T_COMMA ; /. case $rule_number: { - sym(1).Node = 0; + AST::Elision *node = makeAstNode (driver->nodePool()); + node->commaToken = loc(1); + sym(1).Node = node; } break; ./ -ElisionOpt: Elision ; +Elision: Elision T_COMMA ; /. case $rule_number: { - sym(1).Elision = sym(1).Elision->finish (); + AST::Elision *node = makeAstNode (driver->nodePool(), sym(1).Elision); + node->commaToken = loc(2); + sym(1).Node = node; } break; ./ diff --git a/src/declarative/qml/parser/javascriptgrammar.cpp b/src/declarative/qml/parser/javascriptgrammar.cpp index db34464..a879bfe 100644 --- a/src/declarative/qml/parser/javascriptgrammar.cpp +++ b/src/declarative/qml/parser/javascriptgrammar.cpp @@ -59,404 +59,422 @@ const int JavaScriptGrammar::lhs [] = { 98, 100, 100, 101, 101, 97, 99, 99, 103, 104, 104, 99, 99, 99, 99, 99, 99, 99, 111, 111, 111, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 102, 102, 114, 114, 114, 102, 102, 115, + 99, 99, 102, 102, 114, 114, 114, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 117, 117, 121, 121, 116, 116, - 119, 119, 122, 122, 122, 122, 122, 122, 123, 123, - 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, - 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, - 123, 123, 123, 123, 123, 123, 123, 123, 123, 124, - 124, 125, 125, 125, 125, 125, 128, 128, 129, 129, - 129, 129, 127, 127, 130, 130, 131, 131, 132, 132, - 132, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 134, 134, 134, 134, 135, 135, 135, 136, 136, - 136, 136, 137, 137, 137, 137, 137, 137, 137, 138, - 138, 138, 138, 138, 138, 139, 139, 139, 139, 139, - 140, 140, 140, 140, 140, 141, 141, 142, 142, 143, - 143, 144, 144, 145, 145, 146, 146, 147, 147, 148, - 148, 149, 149, 150, 150, 151, 151, 152, 152, 120, - 120, 153, 153, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 105, 105, 155, 155, 156, - 156, 157, 157, 158, 158, 158, 158, 158, 158, 158, - 158, 158, 158, 158, 158, 158, 158, 158, 106, 169, - 169, 168, 168, 113, 113, 170, 170, 171, 171, 173, - 173, 172, 174, 177, 175, 175, 178, 176, 176, 107, - 108, 108, 110, 110, 159, 159, 159, 159, 159, 159, - 159, 160, 160, 160, 160, 161, 161, 161, 161, 162, - 162, 163, 165, 179, 179, 182, 182, 180, 180, 183, - 181, 164, 164, 164, 166, 166, 167, 167, 167, 184, - 185, 109, 109, 112, 126, 189, 189, 186, 186, 187, - 187, 190, 191, 191, 192, 192, 188, 188, 118, 118, - 193}; + 115, 115, 115, 115, 102, 102, 117, 117, 117, 117, + 116, 116, 119, 119, 121, 121, 121, 121, 121, 121, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 123, 123, 124, 124, 124, 124, 124, 127, 127, + 128, 128, 128, 128, 126, 126, 129, 129, 130, 130, + 131, 131, 131, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 133, 133, 133, 133, 134, 134, 134, + 135, 135, 135, 135, 136, 136, 136, 136, 136, 136, + 136, 137, 137, 137, 137, 137, 137, 138, 138, 138, + 138, 138, 139, 139, 139, 139, 139, 140, 140, 141, + 141, 142, 142, 143, 143, 144, 144, 145, 145, 146, + 146, 147, 147, 148, 148, 149, 149, 150, 150, 151, + 151, 120, 120, 152, 152, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 153, 105, 105, 154, + 154, 155, 155, 156, 156, 157, 157, 157, 157, 157, + 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, + 106, 168, 168, 167, 167, 113, 113, 169, 169, 170, + 170, 172, 172, 171, 173, 176, 174, 174, 177, 175, + 175, 107, 108, 108, 110, 110, 158, 158, 158, 158, + 158, 158, 158, 159, 159, 159, 159, 160, 160, 160, + 160, 161, 161, 162, 164, 178, 178, 181, 181, 179, + 179, 182, 180, 163, 163, 163, 165, 165, 166, 166, + 166, 183, 184, 109, 109, 112, 125, 188, 188, 185, + 185, 186, 186, 189, 190, 190, 191, 191, 187, 187, + 118, 118, 192}; const int JavaScriptGrammar:: rhs[] = { 2, 1, 1, 1, 2, 3, 3, 0, 1, 1, 2, 1, 3, 2, 3, 2, 1, 5, 1, 2, 2, 4, 3, 3, 3, 3, 3, 3, 1, 1, 1, 2, 4, 4, 5, 5, 6, 6, 7, 7, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, - 5, 3, 4, 3, 2, 4, 1, 2, 0, 1, - 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, + 5, 3, 4, 3, 1, 3, 1, 2, 3, 4, + 1, 2, 3, 5, 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, 4, 3, 5, 1, 2, 4, 4, - 4, 3, 0, 1, 1, 3, 1, 1, 1, 2, - 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 1, 3, 3, 3, 1, 3, 3, 1, 3, - 3, 3, 1, 3, 3, 3, 3, 3, 3, 1, - 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, - 1, 3, 3, 3, 3, 1, 3, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 4, 3, 5, 1, 2, + 4, 4, 4, 3, 0, 1, 1, 3, 1, 1, + 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 1, 3, 3, 3, 1, 3, 3, + 1, 3, 3, 3, 1, 3, 3, 3, 3, 3, + 3, 1, 3, 3, 3, 3, 3, 1, 3, 3, + 3, 3, 1, 3, 3, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 3, 1, 3, 1, 5, 1, 5, 1, - 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 0, 1, 1, - 3, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, - 2, 0, 1, 3, 3, 1, 1, 1, 3, 1, - 3, 2, 2, 2, 0, 1, 2, 0, 1, 1, - 2, 2, 7, 5, 7, 7, 5, 9, 10, 7, - 8, 2, 2, 3, 3, 2, 2, 3, 3, 3, - 3, 5, 5, 3, 5, 1, 2, 0, 1, 4, - 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, - 2, 2, 2, 8, 8, 1, 3, 0, 1, 0, - 1, 1, 1, 2, 1, 1, 0, 1, 0, 1, - 2}; + 3, 1, 3, 1, 3, 1, 3, 1, 5, 1, + 5, 1, 3, 1, 3, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 0, + 1, 1, 3, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 3, 1, 2, 0, 1, 3, 3, 1, 1, 1, + 3, 1, 3, 2, 2, 2, 0, 1, 2, 0, + 1, 1, 2, 2, 7, 5, 7, 7, 5, 9, + 10, 7, 8, 2, 2, 3, 3, 2, 2, 3, + 3, 3, 3, 5, 5, 3, 5, 1, 2, 0, + 1, 4, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 5, 2, 2, 2, 8, 8, 1, 3, 0, + 1, 0, 1, 1, 1, 2, 1, 1, 0, 1, + 0, 1, 2}; const int JavaScriptGrammar::action_default [] = { 8, 2, 0, 4, 3, 0, 0, 0, 6, 7, - 5, 48, 45, 46, 43, 44, 47, 9, 0, 1, - 0, 0, 16, 49, 41, 246, 0, 0, 46, 14, - 47, 247, 17, 10, 0, 0, 0, 42, 0, 31, - 30, 29, 0, 0, 35, 0, 36, 149, 216, 180, - 188, 184, 128, 200, 176, 0, 113, 51, 129, 192, - 196, 117, 146, 127, 132, 112, 166, 153, 0, 57, - 58, 54, 317, 319, 69, 0, 0, 0, 0, 0, - 52, 55, 0, 0, 56, 50, 0, 53, 0, 0, - 142, 0, 0, 129, 148, 131, 130, 0, 0, 0, - 144, 145, 143, 147, 0, 177, 0, 0, 0, 0, - 167, 0, 0, 0, 0, 0, 0, 157, 0, 0, - 0, 151, 152, 150, 155, 159, 158, 156, 154, 169, - 168, 170, 0, 185, 0, 181, 0, 0, 123, 110, - 122, 111, 79, 80, 81, 106, 82, 107, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 108, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 109, 0, 0, 121, 217, 124, 0, 125, - 0, 126, 120, 39, 40, 0, 213, 206, 204, 211, - 212, 210, 209, 215, 208, 207, 205, 214, 201, 0, - 189, 0, 0, 193, 0, 0, 197, 0, 0, 123, - 115, 0, 114, 0, 119, 133, 0, 318, 308, 309, - 0, 306, 0, 307, 0, 310, 224, 231, 230, 238, - 226, 0, 227, 311, 0, 316, 228, 229, 234, 232, - 313, 312, 315, 235, 0, 0, 0, 0, 0, 317, - 45, 0, 319, 46, 218, 260, 47, 0, 0, 0, - 0, 0, 236, 237, 225, 233, 261, 262, 305, 314, - 0, 276, 277, 278, 279, 0, 272, 273, 274, 275, - 302, 303, 0, 0, 0, 0, 0, 265, 266, 222, - 220, 182, 190, 186, 202, 178, 223, 0, 129, 194, - 198, 171, 160, 0, 0, 179, 0, 0, 0, 0, - 172, 0, 0, 0, 0, 0, 164, 162, 165, 163, - 161, 174, 173, 175, 0, 187, 0, 183, 0, 221, - 129, 0, 203, 218, 219, 0, 218, 0, 0, 268, - 0, 0, 0, 270, 0, 191, 0, 0, 195, 0, - 0, 199, 258, 0, 250, 259, 253, 0, 257, 0, - 218, 251, 0, 218, 0, 0, 269, 0, 0, 0, - 271, 318, 308, 0, 0, 310, 0, 304, 0, 294, - 0, 0, 0, 264, 0, 263, 0, 320, 0, 78, - 240, 243, 0, 79, 246, 82, 107, 84, 85, 54, - 89, 90, 45, 91, 94, 52, 55, 46, 218, 47, - 56, 97, 50, 99, 53, 101, 102, 247, 104, 105, - 109, 0, 71, 0, 0, 73, 77, 75, 63, 74, - 76, 0, 72, 62, 241, 239, 117, 118, 123, 0, - 116, 0, 293, 0, 280, 281, 0, 292, 0, 0, - 0, 283, 288, 286, 289, 0, 0, 287, 288, 0, - 284, 0, 285, 242, 291, 0, 242, 290, 0, 295, - 296, 0, 242, 297, 298, 0, 0, 299, 0, 0, - 0, 300, 301, 135, 134, 0, 0, 0, 267, 0, - 0, 0, 282, 0, 70, 0, 67, 69, 60, 0, - 66, 61, 68, 65, 59, 0, 64, 139, 137, 141, - 138, 136, 140, 0, 0, 0, 33, 0, 34, 0, - 37, 38, 32, 15, 11, 0, 23, 26, 24, 0, - 25, 28, 242, 69, 19, 0, 27, 22, 79, 246, - 82, 107, 84, 85, 54, 89, 90, 45, 91, 94, - 52, 55, 46, 218, 47, 56, 97, 50, 99, 53, - 101, 102, 247, 104, 105, 109, 0, 12, 0, 18, - 13, 20, 21, 255, 248, 0, 256, 252, 0, 254, - 244, 0, 245, 249, 321}; + 5, 65, 45, 46, 43, 44, 47, 9, 0, 1, + 0, 0, 16, 66, 41, 248, 0, 0, 46, 14, + 47, 249, 17, 10, 0, 0, 0, 42, 0, 31, + 30, 29, 0, 0, 35, 0, 36, 151, 218, 182, + 190, 186, 130, 202, 178, 0, 115, 49, 131, 194, + 198, 119, 148, 129, 134, 114, 168, 155, 0, 55, + 56, 52, 319, 321, 0, 0, 0, 0, 0, 0, + 50, 53, 0, 0, 54, 48, 0, 51, 0, 0, + 144, 0, 0, 131, 150, 133, 132, 0, 0, 0, + 146, 147, 145, 149, 0, 179, 0, 0, 0, 0, + 169, 0, 0, 0, 0, 0, 0, 159, 0, 0, + 0, 153, 154, 152, 157, 161, 160, 158, 156, 171, + 170, 172, 0, 187, 0, 183, 0, 0, 125, 112, + 124, 113, 81, 82, 83, 108, 84, 109, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 110, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 111, 0, 0, 123, 219, 126, 0, 127, + 0, 128, 122, 39, 40, 0, 215, 208, 206, 213, + 214, 212, 211, 217, 210, 209, 207, 216, 203, 0, + 191, 0, 0, 195, 0, 0, 199, 0, 0, 125, + 117, 0, 116, 0, 121, 135, 0, 320, 310, 311, + 0, 308, 0, 309, 0, 312, 226, 233, 232, 240, + 228, 0, 229, 313, 0, 318, 230, 231, 236, 234, + 315, 314, 317, 237, 0, 0, 0, 0, 0, 319, + 45, 0, 321, 46, 220, 262, 47, 0, 0, 0, + 0, 0, 238, 239, 227, 235, 263, 264, 307, 316, + 0, 278, 279, 280, 281, 0, 274, 275, 276, 277, + 304, 305, 0, 0, 0, 0, 0, 267, 268, 224, + 222, 184, 192, 188, 204, 180, 225, 0, 131, 196, + 200, 173, 162, 0, 0, 181, 0, 0, 0, 0, + 174, 0, 0, 0, 0, 0, 166, 164, 167, 165, + 163, 176, 175, 177, 0, 189, 0, 185, 0, 223, + 131, 0, 205, 220, 221, 0, 220, 0, 0, 270, + 0, 0, 0, 272, 0, 193, 0, 0, 197, 0, + 0, 201, 260, 0, 252, 261, 255, 0, 259, 0, + 220, 253, 0, 220, 0, 0, 271, 0, 0, 0, + 273, 320, 310, 0, 0, 312, 0, 306, 0, 296, + 0, 0, 0, 266, 0, 265, 0, 322, 0, 80, + 242, 245, 0, 81, 248, 84, 109, 86, 87, 52, + 91, 92, 45, 93, 96, 50, 53, 46, 220, 47, + 54, 99, 48, 101, 51, 103, 104, 249, 106, 107, + 111, 0, 73, 0, 0, 75, 79, 77, 63, 76, + 78, 0, 74, 62, 243, 241, 119, 120, 125, 0, + 118, 0, 295, 0, 282, 283, 0, 294, 0, 0, + 0, 285, 290, 288, 291, 0, 0, 289, 290, 0, + 286, 0, 287, 244, 293, 0, 244, 292, 0, 297, + 298, 0, 244, 299, 300, 0, 0, 301, 0, 0, + 0, 302, 303, 137, 136, 0, 0, 0, 269, 0, + 0, 0, 284, 67, 0, 0, 71, 57, 0, 59, + 69, 0, 60, 70, 72, 61, 68, 58, 0, 64, + 141, 139, 143, 140, 138, 142, 0, 0, 0, 33, + 0, 34, 0, 37, 38, 32, 15, 11, 0, 23, + 26, 24, 0, 25, 28, 244, 0, 19, 0, 27, + 22, 81, 248, 84, 109, 86, 87, 52, 91, 92, + 45, 93, 96, 50, 53, 46, 220, 47, 54, 99, + 48, 101, 51, 103, 104, 249, 106, 107, 111, 49, + 0, 12, 0, 18, 13, 20, 21, 257, 250, 0, + 258, 254, 0, 256, 246, 0, 247, 251, 323}; const int JavaScriptGrammar::goto_default [] = { - 6, 5, 19, 1, 4, 3, 32, 34, 33, 566, - 22, 18, 535, 536, 231, 226, 230, 232, 229, 236, - 514, 235, 264, 57, 65, 495, 493, 388, 387, 48, - 494, 386, 389, 140, 61, 56, 178, 63, 52, 177, - 58, 64, 90, 62, 47, 67, 66, 301, 54, 295, - 49, 291, 51, 293, 50, 292, 59, 299, 60, 300, - 53, 294, 290, 331, 443, 296, 297, 390, 237, 228, - 227, 239, 265, 238, 243, 262, 263, 392, 391, 36, - 575, 574, 353, 354, 577, 356, 576, 355, 451, 455, - 458, 454, 453, 473, 474, 220, 234, 216, 219, 233, - 241, 240, 0}; + 6, 5, 19, 1, 4, 3, 32, 34, 33, 570, + 22, 18, 538, 539, 231, 226, 230, 232, 229, 236, + 517, 235, 264, 57, 65, 495, 494, 388, 387, 48, + 386, 389, 140, 61, 56, 178, 63, 52, 177, 58, + 64, 90, 62, 47, 67, 66, 301, 54, 295, 49, + 291, 51, 293, 50, 292, 59, 299, 60, 300, 53, + 294, 290, 331, 443, 296, 297, 390, 237, 228, 227, + 239, 265, 238, 243, 262, 263, 392, 391, 36, 579, + 578, 353, 354, 581, 356, 580, 355, 451, 455, 458, + 454, 453, 473, 474, 220, 234, 216, 219, 233, 241, + 240, 0}; const int JavaScriptGrammar::action_index [] = { - 7, -91, 35, -91, 7, 304, 96, 111, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, 120, -91, - 136, 417, -91, -91, -91, -91, 64, 161, 160, -91, - 73, -91, -91, -91, 385, 262, 259, -91, 229, -91, - -91, -91, 65, 237, -91, 721, -91, 115, -91, 79, - 41, 3, 338, -91, 303, 228, -91, -91, 562, 68, - 77, 260, 243, -91, -91, -91, 400, 158, 721, -91, - -91, -91, 159, 1299, 93, 721, 721, 721, 515, 721, - -91, -91, 721, 721, -91, -91, 721, -91, 721, 721, - -91, 721, 721, 110, 150, -91, -91, 721, 721, 721, - -91, -91, -91, 175, 721, 310, 721, 721, 721, 721, - 474, 721, 721, 721, 721, 721, 721, 179, 721, 721, - 721, 70, 74, 78, 246, 253, 249, 241, 227, 474, - 474, 474, 721, 61, 721, 178, 1212, 721, 721, -91, + 8, -91, 14, -91, -15, 296, 67, 94, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, 109, -91, + 184, 408, -91, -91, -91, -91, 45, 125, 170, -91, + 46, -91, -91, -91, 429, 171, 130, -91, 120, -91, + -91, -91, -19, 169, -91, 733, -91, 72, -91, 22, + -26, -59, 173, -91, 278, 174, -91, -91, 574, 51, + 112, 183, 177, -91, -91, -91, 412, 214, 733, -91, + -91, -91, 161, 1566, 980, 733, 733, 733, 653, 733, + -91, -91, 733, 733, -91, -91, 733, -91, 733, 733, + -91, 733, 733, 98, 235, -91, -91, 733, 733, 733, + -91, -91, -91, 230, 733, 276, 733, 733, 733, 733, + 396, 733, 733, 733, 733, 733, 733, 288, 733, 733, + 733, 88, 87, 74, 288, 288, 288, 218, 221, 486, + 372, 362, 733, 4, 733, 76, 1479, 733, 733, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, 104, 721, -91, -91, 84, 56, -91, - 721, -91, -91, -91, -91, 721, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, 721, - 69, 721, 721, 95, 92, 721, -91, 1212, 721, 721, - -91, 112, -91, 14, -91, -91, 36, -91, 155, 67, - 53, -91, 176, -91, 43, 1560, -91, -91, -91, -91, - -91, 254, -91, -91, 33, -91, -91, -91, -91, -91, - -91, 1560, -91, -91, 339, 332, 85, 1473, 62, 252, - 66, 32, 1734, 71, 721, -91, 72, 55, 721, 60, - 50, 46, -91, -91, -91, -91, -91, -91, -91, -91, - 75, -91, -91, -91, -91, 80, -91, -91, -91, -91, - -91, -91, 1, 49, 721, 118, 119, -91, -91, 961, - -91, 86, 21, 6, -91, 305, 63, 22, 482, 88, - 121, 406, 282, 157, 721, 312, 721, 721, 721, 721, - 406, 721, 721, 721, 721, 721, 212, 208, 222, 226, - 234, 406, 406, 406, 721, -39, 721, -1, 721, -91, - 562, 721, -91, 721, -3, -57, 721, -54, 1473, -91, - 721, 116, 1473, -91, 721, -45, 721, 721, 88, -6, - 721, -91, -10, 130, -21, -91, -91, 721, -91, 238, - 721, -91, -44, 721, -46, 1473, -91, 721, 132, 1473, - -91, -23, 219, -49, -24, 1560, -47, -91, 1473, -91, - 721, 99, 1473, -4, 1473, -91, 40, 42, 2, -91, - -91, 1473, -2, 325, 39, 314, 108, 721, 1473, 34, - 12, 272, 38, 13, 641, 45, 48, -91, 1045, -91, - 57, 26, 47, 721, 8, 11, 721, 16, 721, -11, - -7, 721, -91, 1386, 17, -91, -91, -91, -91, -91, - -91, 721, -91, -91, -91, -91, 182, -91, 721, -41, - -91, 1473, -91, 89, -91, -91, 1473, -91, 721, 114, - -5, -91, 28, -91, 37, 109, 721, -91, 29, 25, - -91, -25, -91, 1473, -91, 125, 1473, -91, 221, -91, - -91, 103, 1473, 18, -91, 0, 4, -91, 164, -20, - 10, -91, -91, -91, -91, 721, 97, 1473, -91, 721, - 98, 1473, -91, 100, 27, 801, -91, 23, -91, 881, - -91, -91, -91, -91, -91, 107, -91, -91, -91, -91, - -91, -91, -91, -16, -8, 147, -91, 721, -91, 153, - -91, -91, -91, -91, -91, 1125, -91, -91, -91, 284, - -91, -91, 1647, 388, -91, 82, -91, -91, 359, 9, - 349, 87, 721, 1473, 15, -9, 298, 19, 24, 641, - 52, 51, -91, 1045, -91, 54, 31, 58, 721, 59, - 30, 721, 44, 721, 20, -18, 126, -91, 318, -91, - -91, -91, -91, -15, -91, 137, -91, -91, 721, -91, - -91, 190, -91, -91, -91, + -91, -91, -91, 102, 733, -91, -91, 60, 3, -91, + 733, -91, -91, -91, -91, 733, -91, -91, -91, -91, + -91, -91, -91, -91, -91, -91, -91, -91, -91, 733, + -6, 733, 733, 30, 32, 733, -91, 1479, 733, 733, + -91, 107, -91, -14, -91, -91, 69, -91, 191, 49, + 18, -91, 233, -91, 47, 1827, -91, -91, -91, -91, + -91, 204, -91, -91, 39, -91, -91, -91, -91, -91, + -91, 1827, -91, -91, 322, 281, 103, 1740, 50, 203, + 77, 40, 2001, 53, 733, -91, 52, 29, 733, 25, + 28, 35, -91, -91, -91, -91, -91, -91, -91, -91, + 113, -91, -91, -91, -91, 106, -91, -91, -91, -91, + -91, -91, 15, 68, 733, 135, 119, -91, -91, 897, + -91, 82, 58, 17, -91, 261, 84, 42, 494, 91, + 79, 304, 288, 208, 733, 245, 733, 733, 733, 733, + 418, 733, 733, 733, 733, 733, 288, 288, 288, 288, + 288, 343, 336, 279, 733, -57, 733, 19, 733, -91, + 574, 733, -91, 733, -7, -30, 733, -60, 1740, -91, + 733, 111, 1740, -91, 733, 2, 733, 733, 43, 37, + 733, -91, 34, 118, 23, -91, -91, 733, -91, 238, + 733, -91, -5, 733, -17, 1740, -91, 733, 133, 1740, + -91, -9, 194, -32, -8, 1827, -25, -91, 1740, -91, + 733, 100, 1740, 21, 1740, -91, 31, 26, -20, -91, + -91, 1740, -38, 283, 41, 291, 85, 733, 1740, -1, + -34, 252, 54, -27, 653, 9, 5, -91, 817, -91, + 6, -21, 7, 733, 11, -28, 733, 1, 733, -33, + -10, 733, -91, 1653, 33, -91, -91, -91, -91, -91, + -91, 733, -91, -91, -91, -91, 172, -91, 733, -24, + -91, 1740, -91, 73, -91, -91, 1740, -91, 733, 93, + 0, -91, 24, -91, 36, 122, 733, -91, 44, 48, + -91, -3, -91, 1740, -91, 110, 1740, -91, 192, -91, + -91, 124, 1740, 27, -91, -12, -29, -91, 155, -53, + -22, -91, -91, -91, -91, 733, 123, 1740, -91, 733, + 92, 1740, -91, -91, 105, 1229, -91, -91, 1146, -91, + -91, 1063, -91, -91, -91, -91, -91, -91, 90, -91, + -91, -91, -91, -91, -91, -91, 71, 70, 222, -91, + 733, -91, 164, -91, -91, -91, -91, -91, 1392, -91, + -91, -91, 268, -91, -91, 1914, 1312, -91, 75, -91, + -91, 350, 55, 303, 108, 733, 1740, 59, 38, 242, + 62, 40, 527, 63, 81, -91, 817, -91, 138, 29, + 65, 733, 78, 56, 733, 80, 733, 61, 66, 57, + 101, -91, 347, -91, -91, -91, -91, 64, -91, 140, + -91, -91, 733, -91, -91, 144, -91, -91, -91, - -103, -103, -103, -103, 7, 70, -103, -103, -103, -103, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - 20, 240, -103, -103, -103, -103, -103, 45, -103, -103, - -103, -103, -103, -103, 256, -103, -15, -103, -13, -103, - -103, -103, -103, -103, -103, -14, -103, -103, -103, -103, - -103, -103, -103, -103, -103, -103, -103, -103, -42, -103, - -103, -103, -103, -103, -103, -103, -103, -103, 142, -103, - -103, -103, 9, -103, -103, 0, 143, 132, 136, 114, - -103, -103, 146, 62, -103, -103, 129, -103, 125, 119, - -103, 151, 164, -103, -103, -103, -103, 157, 160, 122, - -103, -103, -103, -103, 65, -103, 77, 78, 89, 109, - -103, 82, 86, 80, 69, 47, 66, -103, 75, 72, - 137, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, -103, 101, -103, 107, -103, 120, 34, 17, -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, -103, -103, - -103, -103, -103, -103, 13, -103, -103, -103, -103, -103, - 28, -103, -103, -103, -103, 46, -103, -103, -103, -103, - -103, -103, -103, -103, -103, -103, -103, -103, -103, 135, - -103, 110, -5, -103, -103, -10, -103, 209, 6, 50, - -103, -103, -103, -103, -103, -103, -103, -103, -19, -103, - -103, -103, 39, -103, -103, 33, -103, -103, -103, -103, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, 79, -103, -103, -6, 4, -103, -38, -103, 29, - -103, -103, -103, -103, 36, -103, -103, -103, 40, 25, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, -103, -103, -103, 8, -103, -103, -103, -103, 200, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, -103, -103, 11, 169, -103, 212, 203, 263, 179, - -103, 165, 147, 150, 156, 163, -103, -103, -103, -103, - -103, -103, -103, -103, 182, -103, 204, -103, 185, -103, - -103, 194, -103, 134, -103, -103, 96, -103, 30, -103, - 59, -103, 2, -103, 191, -103, 172, 175, -103, -103, - 176, -103, -103, -103, -103, -103, -103, 166, -103, 85, - 76, -103, -103, 81, -103, -51, -103, 16, -103, -41, - -103, -103, 84, -103, -103, 67, -103, -103, -61, -103, - 53, -103, 3, -103, -3, -103, -103, -103, -103, -103, - -103, -31, -103, 21, -103, 15, -103, 102, -9, -103, - -103, 26, -103, -103, 99, -103, -103, -103, 37, -103, - -103, -103, -103, 31, -103, 38, 97, -103, 90, -103, - -103, 27, -103, 10, -103, -103, -103, -103, -103, -103, - -103, 18, -103, -103, -103, -103, -103, -103, 92, -103, - -103, 5, -103, -103, -103, -103, 32, -103, 52, -103, - -103, -103, -103, -103, -33, -103, 49, -103, -28, -103, - -103, -103, -103, -76, -103, -103, -72, -103, -103, -103, - -103, -103, -103, -84, -103, -103, -12, -103, -21, -103, - 74, -103, -103, -103, -103, 14, -103, -54, -103, 19, - -103, -36, -103, -103, -103, -4, -103, -2, -103, -11, - -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, -103, -103, -103, -103, -103, -103, 1, -103, -103, - -103, -103, -103, -103, -103, 254, -103, -103, -103, -1, - -103, -103, -103, 68, -103, -103, -103, -103, 12, -103, - 42, -103, 61, -7, -103, -103, 48, -103, -103, 44, - -103, -103, -103, 41, -103, -103, -103, -103, 23, -103, - 24, 56, -103, 43, -103, -103, -103, -103, 71, -103, - -103, -103, -103, -103, -103, -103, -103, -103, -18, -103, - -103, 57, -103, -103, -103}; + -102, -102, -102, -102, 19, 103, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -4, 249, -102, -102, -102, -102, -102, -7, -102, -102, + -102, -102, -102, -102, 257, -102, -13, -102, -11, -102, + -102, -102, -102, -102, -102, -3, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -44, -102, + -102, -102, -102, -102, -102, -102, -102, -102, 141, -102, + -102, -102, -8, -102, 0, 16, 116, 122, 129, 119, + -102, -102, 90, 64, -102, -102, 94, -102, 91, 86, + -102, 71, 79, -102, -102, -102, -102, 159, 81, 76, + -102, -102, -102, -102, 98, -102, 67, 63, 47, 163, + -102, 160, 115, 104, 105, 127, 133, -102, 151, 144, + 130, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, 145, -102, 152, -102, 162, 31, 21, -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, 23, -102, -102, -102, -102, -102, + 29, -102, -102, -102, -102, 34, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, 89, + -102, 68, 36, -102, -102, 42, -102, 235, 46, 49, + -102, -102, -102, -102, -102, -102, -102, -102, 33, -102, + -102, -102, 26, -102, -102, -18, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, 53, -102, -102, 8, 20, -102, -5, -102, 32, + -102, -102, -102, -102, 39, -102, -102, -102, 37, 73, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, 40, -102, -102, -102, -102, 97, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, 41, 213, -102, 186, 199, 203, 209, + -102, 50, 51, 38, 57, 60, -102, -102, -102, -102, + -102, -102, -102, -102, 212, -102, 174, -102, 166, -102, + -102, 168, -102, 125, -102, -102, 61, -102, 1, -102, + 45, -102, -9, -102, 172, -102, 184, 176, -102, -102, + 170, -102, -102, -102, -102, -102, -102, 215, -102, 124, + 132, -102, -102, 178, -102, -29, -102, 25, -102, 2, + -102, -102, 62, -102, -102, 102, -102, -102, -28, -102, + 22, -102, -31, -102, -33, -102, -102, -102, -102, -102, + -102, -34, -102, 17, -102, 18, -102, 111, -20, -102, + -102, 24, -102, -102, 153, -102, -102, -102, 30, -102, + -102, -102, -102, 28, -102, 73, 140, -102, 205, -102, + -102, 5, -102, 44, -102, -102, -102, -102, -102, -102, + -102, 43, -102, -102, -102, -102, -102, -102, 135, -102, + -102, 7, -102, -102, -102, -102, 4, -102, 55, -102, + -102, -102, -102, -102, -25, -102, 48, -102, 9, -102, + -102, -102, -102, -69, -102, -102, -70, -102, -102, -102, + -102, -102, -102, -92, -102, -102, -12, -102, -10, -102, + -1, -102, -102, -102, -102, 11, -102, -40, -102, 14, + -102, -39, -102, -102, -102, -17, -102, -102, 54, -102, + -102, -24, -102, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, + 3, -102, -102, -102, -102, -102, -102, -102, 267, -102, + -102, -102, 12, -102, -102, -102, 301, -102, -102, -102, + -102, -19, -102, -15, -102, 59, -64, -102, -102, -2, + -102, -102, 142, -102, -102, -102, -14, -102, -102, -102, + -102, 6, -102, 73, 52, -102, 75, -102, -102, -102, + -102, -102, 128, -102, -102, -102, -102, -102, -102, -102, + -102, -102, -6, -102, -102, 58, -102, -102, -102}; const int JavaScriptGrammar::action_info [] = { - 304, 350, 578, 324, 336, 174, 338, 357, 377, 375, - 367, 374, 384, 372, 365, -100, -106, 363, 489, 440, - 372, 515, -87, -103, 431, 485, -73, 289, 452, 489, - 462, 496, 463, 456, 456, 502, 478, 472, 476, 326, - 480, -87, 456, 472, 472, -73, -106, 421, 289, 380, - 423, -103, -95, 435, -98, -77, 485, 433, -77, -95, - 380, -76, 448, 472, -76, -98, -100, 448, 380, 324, - 199, 328, 218, 378, 214, 222, 225, 283, 441, 446, - 104, 134, 489, 333, 326, 284, 485, 304, 268, 132, - 344, 448, 180, 472, 43, 2, 584, 199, 289, 205, - 7, 496, 522, 0, 0, 174, 174, 174, 497, 475, - 91, 0, 174, 224, 91, 174, 182, 132, 91, 459, - 174, 92, 174, 476, 174, 92, 174, 201, 0, 92, - 38, 202, 466, 174, 568, 20, 274, 273, 359, 134, - 174, 279, 278, 572, 571, 581, 281, 280, 281, 280, - 445, 444, 95, 21, 517, 91, 498, 487, 491, 382, - 175, 174, 97, 96, 460, 12, 92, 506, 212, 281, - 280, 346, 9, 8, 450, 347, 342, 0, 286, 104, - 288, 287, 569, 118, 12, 119, 12, 97, 12, 39, - 12, 360, 369, 12, 0, 0, 120, 207, 582, 580, - 0, 0, 13, 16, 118, 12, 119, 98, 518, 516, - 0, 0, 0, 99, 521, 520, 208, 120, 438, 12, - 0, 13, 16, 13, 16, 13, 16, 13, 16, 174, - 13, 16, 98, 118, 41, 119, 174, 118, 99, 119, - 0, 0, 13, 16, 45, 40, 120, 118, 12, 119, - 120, 118, 118, 119, 119, 97, 13, 16, 39, 118, - 120, 119, 174, 0, 120, 120, 118, 12, 119, 525, - 0, 118, 120, 119, 118, 207, 119, 20, 118, 120, - 119, 12, 470, 469, 120, 13, 16, 120, 12, 184, - 183, 120, 174, 0, 208, 21, 209, 0, 46, 44, - 98, 12, 0, 41, 13, 16, 99, 118, -317, 119, - 0, 0, 0, 0, 40, 267, 266, 21, 13, 16, - 120, 106, 107, 306, 307, 13, 16, 12, 106, 107, - 306, 307, 0, 12, -317, 0, 0, 0, 13, 16, - 0, 0, 0, 12, 0, 267, 266, 12, 108, 109, - 308, 309, 0, 136, 12, 108, 109, 308, 309, 0, - 0, 12, 0, 15, 13, 16, 0, 0, 12, 0, - 13, 16, 137, 0, 138, 277, 276, 15, 12, 0, - 13, 16, 0, 0, 13, 16, 272, 271, 12, 14, - 0, 13, 16, 277, 276, 26, 496, 0, 13, 16, - 272, 271, 0, 14, 0, 13, 16, 27, 0, 0, - 277, 276, 0, 0, 12, 13, 16, 12, 0, 0, - 272, 271, 0, 111, 112, 13, 16, 26, 0, 311, - 312, 113, 114, 0, 0, 115, 0, 116, 313, 27, - 523, 314, 0, 315, 15, 0, 12, 15, 0, 0, - 0, 28, 30, 0, 13, 16, 0, 0, 0, 31, - 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, - 14, 0, 29, 14, 0, 0, 15, 0, 0, 0, - 0, 0, 0, 28, 30, 186, 0, 0, 0, 0, - 0, 31, 0, 0, 0, 187, 0, 111, 112, 188, - 25, 0, 14, 0, 0, 113, 114, 0, 189, 115, - 190, 116, 0, 340, 0, 0, 0, 0, 0, 0, - 0, 191, 0, 192, 95, 0, 0, 69, 70, 0, - 0, 193, 0, 0, 194, 96, 0, 72, 0, 0, - 195, 0, 0, 0, 12, 0, 196, 0, 73, 74, - 0, 75, 0, 0, 0, 0, 0, 0, 78, 0, - 0, 197, 81, 0, 0, 186, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 187, 0, 0, 0, 188, - 84, 13, 16, 0, 85, 0, 0, 0, 189, 0, - 190, 0, 0, 0, 0, 80, 87, 71, 0, 0, - 0, 191, 0, 192, 95, 0, 0, 0, 0, 0, - 0, 193, 0, 0, 194, 96, 0, 0, 0, 0, - 195, 0, 0, 0, 0, 0, 196, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 197, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 69, 70, 0, 0, 0, 0, 0, - 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 73, 74, 0, 75, 0, 0, - 0, 0, 0, 0, 78, 0, 0, 0, 81, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 84, 13, 16, 0, - 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 87, 71, 0, 0, 0, 0, 0, 0, - 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, - 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 73, 74, 0, 75, 0, 0, - 0, 76, 0, 77, 78, 79, 0, 0, 81, 0, - 0, 0, 82, 0, 83, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 84, 13, 16, 0, - 85, 0, 86, 0, 88, 0, 89, 0, 0, 0, - 0, 80, 87, 71, 0, 0, 0, 0, 0, 0, - 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, - 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 73, 74, 0, 75, 0, 0, - 0, 76, 0, 77, 78, 79, 0, 0, 81, 0, - 0, 0, 82, 0, 83, 0, 0, 504, 0, 0, - 0, 0, 0, 0, 0, 0, 84, 13, 16, 0, - 85, 0, 86, 0, 88, 0, 89, 0, 0, 0, - 0, 80, 87, 71, 0, 0, 0, 0, 0, 0, - 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, - 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 73, 74, 0, 75, 0, 0, - 0, 76, 0, 77, 78, 79, 0, 0, 81, 0, - 0, 0, 82, 0, 83, 0, 0, 501, 0, 0, - 0, 0, 0, 0, 0, 0, 84, 13, 16, 0, - 85, 0, 86, 0, 88, 0, 89, 0, 0, 0, - 0, 80, 87, 71, 0, 0, 0, 0, 0, 0, - 0, 0, 68, 69, 70, 0, 0, 0, 0, 0, - 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 73, 74, 0, 75, 0, 0, - 0, 76, 0, 77, 78, 79, 0, 0, 81, 0, - 0, 0, 82, 0, 83, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 84, 13, 16, 0, - 85, 0, 86, 0, 88, 303, 89, 0, 0, 0, - 0, 80, 87, 71, 0, 0, 0, 0, 0, 0, - 0, 0, -96, 0, 0, 0, 68, 69, 70, 0, - 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, - 0, 0, 0, 0, 12, 0, 0, 0, 73, 74, - 0, 75, 0, 0, 0, 76, 0, 77, 78, 79, - 0, 0, 81, 0, 0, 0, 82, 0, 83, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 84, 13, 16, 0, 85, 0, 86, 0, 88, 0, - 89, 0, 0, 0, 0, 80, 87, 71, 0, 0, - 0, 0, 0, 0, 0, 0, 68, 69, 70, 0, - 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, - 0, 0, 0, 0, 12, 251, 0, 0, 532, 533, - 0, 75, 0, 0, 0, 76, 0, 77, 78, 79, - 0, 0, 81, 0, 0, 0, 82, 0, 83, 0, - 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, - 84, 13, 16, 0, 85, 0, 86, 0, 88, 0, - 89, 0, 0, 0, 0, 80, 87, 71, 0, 246, - 0, 534, 0, 0, 0, 0, 142, 143, 144, 0, - 0, 146, 148, 149, 0, 0, 150, 0, 151, 0, - 0, 0, 153, 154, 155, 0, 0, 0, 0, 0, - 0, 12, 156, 157, 158, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 159, 0, 0, 0, 0, + 338, 174, 289, 485, 472, 472, -89, 480, -105, 380, + 43, 472, -79, -78, -100, 448, -97, 435, -102, 134, + 304, 326, 132, 104, 478, 375, 489, 372, 374, 456, + 377, 336, 199, 452, 423, 433, 440, 384, 421, 205, + 431, 456, 132, 365, 350, 344, 214, 476, -108, 456, + 324, 357, 462, 199, 367, 463, 363, 222, 472, 446, + 441, -75, -108, 182, 485, 448, -89, 588, 180, -75, + -97, 489, -100, 2, 289, 525, 380, 104, 224, 7, + 225, 582, 134, 304, 378, -102, 289, -105, -79, 472, + -65, 283, 328, 344, 268, 326, 2, 485, 174, 518, + 174, 174, 489, 333, 284, 218, 324, 372, 174, 572, + 174, 38, 91, 498, 91, 174, 0, 466, 174, 174, + 0, 0, 0, 92, 20, 92, 359, 91, 91, 346, + 475, 174, 459, 347, 445, 444, 576, 575, 92, 92, + 95, 174, 21, 174, 476, -78, 281, 280, 585, 39, + 509, 96, 491, 450, 12, 9, 8, 573, 175, 12, + 382, 499, 201, 212, 281, 280, 202, 279, 278, 281, + 280, 342, 174, 12, 274, 273, 45, 460, 528, 360, + 288, 287, 174, 487, 12, 0, 20, 207, 136, 97, + 12, 13, 16, 369, 41, 286, 13, 16, 207, 39, + 174, 586, 584, 0, 21, 40, 208, 137, 438, 138, + 13, 16, 174, 12, 0, 0, 0, 208, 0, 209, + 12, 13, 16, 12, 0, 524, 523, 13, 16, 520, + 46, 44, 12, 0, 98, 184, 183, 12, 0, 118, + 99, 119, 97, 118, 41, 119, 118, 97, 119, 0, + 13, 16, 120, 470, 469, 40, 120, 13, 16, 120, + 13, 16, 12, 306, 307, 267, 266, 12, 0, 13, + 16, 12, 0, 0, 13, 16, 174, 0, -319, 306, + 307, 12, 0, 521, 519, 0, 0, 98, -319, 0, + 308, 309, 98, 99, 106, 107, 106, 107, 99, 13, + 16, 21, 311, 312, 13, 16, 308, 309, 13, 16, + 12, 313, 12, 118, 314, 119, 315, 0, 13, 16, + 12, 108, 109, 108, 109, 12, 120, 311, 312, 267, + 266, 0, 12, 0, 0, 0, 313, 0, 0, 314, + 0, 315, 277, 276, 272, 271, 0, 13, 16, 13, + 16, 12, 277, 276, 0, 15, 0, 13, 16, 311, + 312, 0, 13, 16, 277, 276, 311, 312, 313, 13, + 16, 314, 0, 315, 0, 313, 12, 0, 314, 12, + 315, 14, 0, 272, 271, 111, 112, 0, 13, 16, + 0, 0, 0, 113, 114, 111, 112, 115, 0, 116, + 0, 0, 0, 113, 114, 0, 15, 115, 0, 116, + 0, 272, 271, 13, 16, 0, 13, 16, 26, 111, + 112, 0, 0, 0, 0, 0, 0, 113, 114, 0, + 27, 115, 14, 116, 0, 111, 112, 12, 0, 26, + 0, 311, 312, 113, 114, 0, 0, 115, 0, 116, + 313, 27, 0, 314, 0, 315, 0, 0, 12, 0, + 0, 0, 0, 29, 0, 0, 0, 15, 0, 0, + 0, 0, 0, 0, 28, 30, 0, 0, 0, 0, + 0, 0, 31, 0, 526, 0, 0, 0, 15, 0, + 0, 25, 0, 14, 0, 28, 30, 186, 0, 0, + 0, 0, 0, 31, 0, 0, 0, 187, 0, 111, + 112, 188, 25, 0, 14, 0, 0, 113, 114, 0, + 189, 115, 190, 116, 0, 340, 0, 0, 0, 0, + 0, 0, 0, 191, 0, 192, 95, 0, 0, 69, + 70, 0, 0, 193, 0, 0, 194, 96, 0, 72, + 0, 0, 195, 0, 0, 0, 12, 0, 196, 0, + 73, 74, 0, 75, 0, 0, 0, 0, 0, 0, + 78, 0, 0, 197, 81, 0, 0, 186, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 187, 0, 0, + 0, 188, 84, 13, 16, 0, 85, 0, 0, 0, + 189, 0, 190, 0, 0, 0, 0, 80, 87, 71, + 0, 0, 0, 191, 0, 192, 95, 0, 0, 0, + 0, 0, 0, 193, 0, 0, 194, 96, 0, 0, + 0, 0, 195, 0, 0, 0, 0, 0, 196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 162, 0, 0, 0, 0, 0, 0, 13, 16, - 163, 164, 165, 0, 167, 168, 169, 170, 171, 172, - 0, 0, 160, 166, 152, 145, 147, 161, 0, 0, + 0, 0, 0, 197, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 69, 70, 0, 0, 0, + 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, + 0, 0, 12, 0, 0, 0, 73, 74, 0, 75, + 0, 0, 0, 0, 0, 0, 78, 0, 0, 0, + 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 84, 13, + 16, 0, 85, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 80, 87, 71, 0, 0, 0, 0, + 0, 0, 0, 0, 68, 69, 70, 0, 0, 0, + 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, + 0, 0, 12, 0, 0, 0, 73, 74, 0, 75, + 0, 0, 0, 76, 0, 77, 78, 79, 0, 0, + 81, 0, 0, 0, 82, 0, 83, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 84, 13, + 16, 0, 85, 0, 86, 0, 88, 0, 89, 0, + 0, 0, 0, 80, 87, 71, 0, 0, 0, 0, + 0, 0, 0, 0, -98, 0, 0, 0, 68, 69, + 70, 0, 0, 0, 0, 0, 0, 0, 0, 72, + 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, + 73, 74, 0, 75, 0, 0, 0, 76, 0, 77, + 78, 79, 0, 0, 81, 0, 0, 0, 82, 0, + 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 84, 13, 16, 0, 85, 0, 86, 0, + 88, 0, 89, 0, 0, 0, 0, 80, 87, 71, + 0, 0, 0, 0, 0, 0, 0, 0, 68, 69, + 70, 0, 0, 0, 0, 0, 0, 0, 0, 72, + 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, + 73, 74, 0, 75, 0, 0, 0, 76, 0, 77, + 78, 79, 0, 0, 81, 0, 0, 0, 82, 0, + 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 84, 13, 16, 0, 85, 0, 86, 0, + 88, 303, 89, 0, 0, 0, 0, 80, 87, 71, + 0, 0, 0, 0, 0, 0, 0, 0, 496, 0, + 0, 68, 69, 70, 0, 0, 0, 0, 0, 0, + 0, 0, 72, 0, 0, 0, 0, 0, 0, 12, + 0, 0, 0, 73, 74, 0, 75, 0, 0, 0, + 76, 0, 77, 78, 79, 0, 0, 81, 0, 0, + 0, 82, 0, 83, 0, 0, 497, 0, 0, 0, + 0, 0, 0, 0, 0, 84, 13, 16, 0, 85, + 0, 86, 0, 88, 0, 89, 0, 0, 0, 0, + 80, 87, 71, 0, 0, 0, 0, 0, 0, 0, + 0, 504, 0, 0, 68, 69, 70, 0, 0, 0, + 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, + 0, 0, 12, 0, 0, 0, 73, 74, 0, 75, + 0, 0, 0, 76, 0, 77, 78, 79, 0, 0, + 81, 0, 0, 0, 82, 0, 83, 0, 0, 505, + 0, 0, 0, 0, 0, 0, 0, 0, 84, 13, + 16, 0, 85, 0, 86, 0, 88, 0, 89, 0, + 0, 0, 0, 80, 87, 71, 0, 0, 0, 0, + 0, 0, 0, 0, 496, 0, 0, 68, 69, 70, + 0, 0, 0, 0, 0, 0, 0, 0, 72, 0, + 0, 0, 0, 0, 0, 12, 0, 0, 0, 73, + 74, 0, 75, 0, 0, 0, 76, 0, 77, 78, + 79, 0, 0, 81, 0, 0, 0, 82, 0, 83, + 0, 0, 502, 0, 0, 0, 0, 0, 0, 0, + 0, 84, 13, 16, 0, 85, 0, 86, 0, 88, + 0, 89, 0, 0, 0, 0, 80, 87, 71, 0, + 0, 0, 0, 0, 0, 0, 0, 504, 0, 0, + 68, 69, 70, 0, 0, 0, 0, 0, 0, 0, + 0, 72, 0, 0, 0, 0, 0, 0, 12, 0, + 0, 0, 73, 74, 0, 75, 0, 0, 0, 76, + 0, 77, 78, 79, 0, 0, 81, 0, 0, 0, + 82, 0, 83, 0, 0, 507, 0, 0, 0, 0, + 0, 0, 0, 0, 84, 13, 16, 0, 85, 0, + 86, 0, 88, 0, 89, 0, 0, 0, 0, 80, + 87, 71, 0, 0, 0, 0, 0, 0, 0, 0, + 496, 0, 0, 68, 69, 70, 0, 0, 0, 0, + 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, + 0, 12, 0, 0, 0, 73, 74, 0, 75, 0, + 0, 0, 76, 0, 77, 78, 79, 0, 0, 81, + 0, 0, 0, 82, 0, 83, 0, 0, 497, 0, + 0, 15, 0, 0, 0, 0, 0, 84, 13, 16, + 0, 85, 0, 86, 0, 88, 0, 89, 0, 0, + 0, 0, 80, 87, 71, 0, 0, 14, 0, 0, + 0, 0, 0, 68, 69, 70, 0, 0, 0, 0, + 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, + 0, 12, 251, 0, 0, 535, 536, 0, 75, 0, + 0, 0, 76, 0, 77, 78, 79, 0, 0, 81, + 0, 0, 0, 82, 0, 83, 0, 0, 0, 0, + 0, 0, 0, 255, 0, 0, 0, 84, 13, 16, + 0, 85, 0, 86, 0, 88, 0, 89, 0, 0, + 0, 0, 80, 87, 71, 0, 246, 0, 537, 0, 0, 0, 0, 142, 143, 144, 0, 0, 146, 148, 149, 0, 0, 150, 0, 151, 0, 0, 0, 153, - 154, 155, 0, 0, 0, 0, 0, 0, 425, 156, + 154, 155, 0, 0, 0, 0, 0, 0, 12, 156, 157, 158, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 159, 0, 0, 0, 426, 0, 0, 0, + 0, 0, 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 162, 0, - 0, 0, 0, 0, 430, 427, 429, 163, 164, 165, + 0, 0, 0, 0, 0, 13, 16, 163, 164, 165, 0, 167, 168, 169, 170, 171, 172, 0, 0, 160, 166, 152, 145, 147, 161, 0, 0, 0, 0, 0, 142, 143, 144, 0, 0, 146, 148, 149, 0, 0, @@ -464,222 +482,253 @@ const int JavaScriptGrammar::action_info [] = { 0, 0, 0, 0, 0, 425, 156, 157, 158, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 159, 0, 0, 0, 426, 0, 0, 0, 0, 0, 0, - 0, 428, 0, 0, 0, 162, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 162, 0, 0, 0, 0, 0, 430, 427, 429, 163, 164, 165, 0, 167, 168, 169, 170, 171, 172, 0, 0, 160, 166, 152, 145, - 147, 161, 0, 0, 0, 0, 0, 244, 0, 0, - 0, 0, 245, 0, 68, 69, 70, 247, 0, 0, - 0, 0, 0, 0, 248, 72, 0, 0, 0, 0, - 0, 0, 250, 251, 0, 0, 252, 74, 0, 75, - 0, 0, 0, 76, 0, 77, 78, 79, 0, 0, - 81, 0, 0, 0, 82, 0, 83, 0, 0, 0, - 0, 0, 254, 0, 255, 0, 0, 0, 84, 253, - 256, 257, 85, 258, 86, 259, 88, 31, 89, 260, - 261, 0, 0, 80, 87, 71, 25, 246, 0, 0, + 147, 161, 0, 0, 0, 0, 0, 142, 143, 144, + 0, 0, 146, 148, 149, 0, 0, 150, 0, 151, + 0, 0, 0, 153, 154, 155, 0, 0, 0, 0, + 0, 0, 425, 156, 157, 158, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 159, 0, 0, 0, + 426, 0, 0, 0, 0, 0, 0, 0, 428, 0, + 0, 0, 162, 0, 0, 0, 0, 0, 430, 427, + 429, 163, 164, 165, 0, 167, 168, 169, 170, 171, + 172, 0, 0, 160, 166, 152, 145, 147, 161, 0, 0, 0, 0, 0, 244, 0, 0, 0, 0, 245, 0, 68, 69, 70, 247, 0, 0, 0, 0, 0, - 0, 248, 249, 0, 0, 0, 0, 0, 0, 250, + 0, 248, 72, 0, 0, 0, 0, 0, 0, 250, 251, 0, 0, 252, 74, 0, 75, 0, 0, 0, 76, 0, 77, 78, 79, 0, 0, 81, 0, 0, 0, 82, 0, 83, 0, 0, 0, 0, 0, 254, 0, 255, 0, 0, 0, 84, 253, 256, 257, 85, 258, 86, 259, 88, 31, 89, 260, 261, 0, 0, 80, 87, 71, 25, 246, 0, 0, 0, 0, 0, - 0, 538, 143, 144, 0, 0, 540, 148, 542, 69, - 70, 543, 0, 151, 0, 0, 0, 153, 545, 546, - 0, 0, 0, 0, 0, 0, 547, 548, 157, 158, + 0, 244, 0, 0, 0, 0, 245, 0, 68, 69, + 70, 247, 0, 0, 0, 0, 0, 0, 248, 249, + 0, 0, 0, 0, 0, 0, 250, 251, 0, 0, 252, 74, 0, 75, 0, 0, 0, 76, 0, 77, - 549, 79, 0, 0, 551, 0, 0, 0, 82, 0, - 83, 0, 0, 0, 0, 0, 553, 0, 255, 0, - 0, 0, 555, 552, 554, 556, 557, 558, 86, 560, - 561, 562, 563, 564, 565, 0, 0, 550, 559, 544, - 539, 541, 161, 0, 0, 0, 0, 0, 393, 143, - 144, 0, 0, 395, 148, 397, 69, 70, 398, 0, - 151, 0, 0, 0, 153, 400, 401, 0, 0, 0, - 0, 0, 0, 402, 403, 157, 158, 252, 74, 0, - 75, 0, 0, 0, 76, 0, 77, 404, 79, 0, - 0, 406, 0, 0, 0, 82, 0, 83, 0, -242, - 0, 0, 0, 408, 0, 255, 0, 0, 0, 410, - 407, 409, 411, 412, 413, 86, 415, 416, 417, 418, - 419, 420, 0, 0, 405, 414, 399, 394, 396, 161, - 0, 0, 0, 0, 0, + 78, 79, 0, 0, 81, 0, 0, 0, 82, 0, + 83, 0, 0, 0, 0, 0, 254, 0, 255, 0, + 0, 0, 84, 253, 256, 257, 85, 258, 86, 259, + 88, 31, 89, 260, 261, 0, 0, 80, 87, 71, + 25, 246, 0, 0, 0, 0, 0, 0, 541, 143, + 144, 0, 0, 543, 148, 545, 69, 70, 546, 0, + 151, 0, 0, 0, 153, 548, 549, 0, 0, 0, + 0, 0, 0, 550, 551, 157, 158, 252, 74, 0, + 75, 0, 0, 0, 76, 0, 77, 552, 79, 0, + 0, 554, 0, 0, 0, 82, 0, 83, 0, 0, + 0, 0, 0, 556, 0, 255, 0, 0, 0, 558, + 555, 557, 559, 560, 561, 86, 563, 564, 565, 566, + 567, 568, 0, 0, 553, 562, 547, 542, 544, 161, + 0, 0, 0, 0, 0, 393, 143, 144, 0, 0, + 395, 148, 397, 69, 70, 398, 0, 151, 0, 0, + 0, 153, 400, 401, 0, 0, 0, 0, 0, 0, + 402, 403, 157, 158, 252, 74, 0, 75, 0, 0, + 0, 76, 0, 77, 404, 79, 0, 0, 406, 0, + 0, 0, 82, 0, 83, 0, -244, 0, 0, 0, + 408, 0, 255, 0, 0, 0, 410, 407, 409, 411, + 412, 413, 86, 415, 416, 417, 418, 419, 420, 0, + 0, 405, 414, 399, 394, 396, 161, 0, 0, 0, + 0, 0, - 55, 464, 479, 482, 221, 467, 379, 42, 573, 537, - 477, 579, 10, 488, 505, 519, 366, 270, 500, 206, - 211, 185, 285, 499, 204, 503, 370, 275, 486, 282, - 368, 492, 217, 490, 352, 270, 434, 468, 275, 471, - 471, 424, 176, 23, 270, 468, 179, 432, 173, 217, - 334, 334, 371, 471, 468, 334, 422, 181, 282, 457, - 282, 461, 223, 465, 385, 275, 449, 381, 513, 343, - 383, 217, 442, 341, 567, 198, 17, 570, 436, 179, - 573, 437, 0, 93, 0, 484, 213, 93, 0, 481, - 334, 11, 127, 11, 11, 334, 93, 339, 483, 447, - 242, 93, 93, 215, 511, 93, 93, 221, 352, 93, - 334, 128, 93, 105, 126, 93, 122, 93, 93, 121, - 93, 179, 93, 110, 129, 125, 93, 117, 439, 93, - 93, 124, 484, 436, 242, 130, 437, 93, 583, 483, - 362, 93, 93, 139, 215, 364, 242, 93, 334, 93, - 93, 0, 141, 133, 93, 131, 509, 135, 0, 93, - 337, 484, 93, 376, 102, 93, 203, 483, 361, 93, - 436, 512, 93, 437, 508, 93, 0, 93, 0, 373, - 269, 123, 93, 93, 215, 507, 93, 93, 510, 200, - 93, 93, 317, 0, 94, 318, 93, 93, 335, 100, - 93, 319, 101, 93, 93, 93, 330, 103, 320, 93, - 316, 302, 93, 0, 302, 330, 330, 302, 305, 93, - 302, 302, 93, 0, 302, 330, 323, 302, 358, 348, - 302, 93, 139, 0, 330, 325, 302, 349, 351, 302, - 298, 141, 210, 93, 93, 302, 345, 329, 302, 302, - 321, 35, 93, 0, 0, 327, 332, 302, 0, 310, - 0, 24, 37, 11, 524, 0, 0, 35, 529, 526, - 528, 530, 527, 531, 0, 0, 0, 24, 37, 11, + 334, 477, 282, 482, 270, 503, 467, 464, 275, 42, + 577, 55, 506, 479, 481, 217, 516, 522, 185, 23, + 468, 217, 540, 583, 10, 486, 488, 492, 490, 493, + 508, 270, 434, 385, 422, 383, 381, 366, 379, 368, + 270, 275, 468, 275, 334, 173, 282, 217, 242, 223, + 179, 468, 176, 334, 285, 371, 221, 343, 181, 341, + 211, 282, 465, 198, 352, 204, 457, 339, 370, 449, + 447, 206, 432, 442, 424, 334, 0, 93, 179, 501, + 0, 577, 318, 500, 213, 221, 93, 0, 471, 93, + 93, 93, 130, 483, 316, 317, 93, 461, 93, 93, + 215, 319, 93, 93, 320, 514, 93, 93, 129, 17, + 93, 0, 110, 94, 93, 93, 484, 102, 93, 242, + 93, 103, 101, 203, 337, 93, 11, 484, 93, 93, + 93, 513, 483, 93, 574, 515, 298, 93, 587, 334, + 0, 302, 200, 93, 93, 105, 334, 352, 125, 126, + 93, 11, 215, 269, 93, 93, 373, 510, 93, 124, + 512, 93, 436, 511, 179, 437, 93, 0, 242, 93, + 439, 127, 93, 123, 0, 436, 0, 128, 437, 93, + 93, 483, 215, 93, 93, 139, 436, 122, 335, 437, + 93, 93, 334, 141, 121, 362, 133, 376, 93, 93, + 100, 135, 93, 0, 117, 330, 361, 330, 131, 330, + 302, 93, 302, 93, 302, 330, 302, 0, 302, 0, + 302, 0, 0, 93, 327, 93, 345, 329, 302, 332, + 302, 351, 310, 0, 0, 0, 0, 349, 93, 0, + 348, 364, 93, 302, 93, 321, 484, 302, 93, 322, + 0, 93, 93, 302, 330, 323, 302, 302, 139, 302, + 35, 305, 0, 0, 325, 527, 141, 210, 35, 0, + 24, 37, 11, 0, 0, 0, 358, 0, 24, 37, + 11, 532, 529, 531, 533, 530, 534, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 571, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 569, 0, 0, 0, 0, 0, + 493, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 0, 0, 0, 0, 302, 0, - 322, 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, 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, 0, 0, 0}; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0}; const int JavaScriptGrammar::action_check [] = { - 1, 7, 17, 48, 61, 8, 60, 17, 55, 33, - 31, 60, 16, 36, 60, 7, 7, 61, 36, 60, - 36, 29, 7, 7, 7, 36, 7, 36, 33, 36, - 55, 8, 7, 5, 5, 8, 36, 33, 20, 78, - 60, 7, 5, 33, 33, 7, 7, 7, 36, 36, - 8, 7, 7, 55, 7, 7, 36, 55, 7, 7, - 36, 7, 36, 33, 7, 7, 7, 36, 36, 48, - 2, 8, 36, 7, 60, 8, 33, 76, 7, 7, - 1, 78, 36, 61, 78, 36, 36, 1, 55, 48, - 2, 36, 8, 33, 29, 88, 0, 2, 36, 7, - 65, 8, 29, -1, -1, 8, 8, 8, 8, 6, - 40, -1, 8, 60, 40, 8, 60, 48, 40, 10, - 8, 51, 8, 20, 8, 51, 8, 50, -1, 51, - 66, 54, 7, 8, 8, 15, 61, 62, 8, 78, - 8, 61, 62, 61, 62, 8, 61, 62, 61, 62, - 61, 62, 42, 33, 7, 40, 56, 60, 60, 60, - 56, 8, 12, 53, 55, 29, 51, 60, 56, 61, - 62, 50, 61, 62, 60, 54, 60, -1, 60, 1, - 61, 62, 56, 25, 29, 27, 29, 12, 29, 29, - 29, 61, 60, 29, -1, -1, 38, 15, 61, 62, - -1, -1, 66, 67, 25, 29, 27, 57, 61, 62, - -1, -1, -1, 63, 61, 62, 34, 38, 36, 29, - -1, 66, 67, 66, 67, 66, 67, 66, 67, 8, - 66, 67, 57, 25, 74, 27, 8, 25, 63, 27, - -1, -1, 66, 67, 7, 85, 38, 25, 29, 27, - 38, 25, 25, 27, 27, 12, 66, 67, 29, 25, - 38, 27, 8, -1, 38, 38, 25, 29, 27, 7, - -1, 25, 38, 27, 25, 15, 27, 15, 25, 38, - 27, 29, 61, 62, 38, 66, 67, 38, 29, 61, - 62, 38, 8, -1, 34, 33, 36, -1, 61, 62, - 57, 29, -1, 74, 66, 67, 63, 25, 36, 27, - -1, -1, -1, -1, 85, 61, 62, 33, 66, 67, - 38, 18, 19, 18, 19, 66, 67, 29, 18, 19, - 18, 19, -1, 29, 36, -1, -1, -1, 66, 67, - -1, -1, -1, 29, -1, 61, 62, 29, 45, 46, - 45, 46, -1, 15, 29, 45, 46, 45, 46, -1, - -1, 29, -1, 59, 66, 67, -1, -1, 29, -1, - 66, 67, 34, -1, 36, 61, 62, 59, 29, -1, - 66, 67, -1, -1, 66, 67, 61, 62, 29, 85, - -1, 66, 67, 61, 62, 10, 8, -1, 66, 67, - 61, 62, -1, 85, -1, 66, 67, 22, -1, -1, - 61, 62, -1, -1, 29, 66, 67, 29, -1, -1, - 61, 62, -1, 23, 24, 66, 67, 10, -1, 23, - 24, 31, 32, -1, -1, 35, -1, 37, 32, 22, - 55, 35, -1, 37, 59, -1, 29, 59, -1, -1, - -1, 66, 67, -1, 66, 67, -1, -1, -1, 74, - -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, - 85, -1, 55, 85, -1, -1, 59, -1, -1, -1, - -1, -1, -1, 66, 67, 3, -1, -1, -1, -1, - -1, 74, -1, -1, -1, 13, -1, 23, 24, 17, - 83, -1, 85, -1, -1, 31, 32, -1, 26, 35, - 28, 37, -1, 31, -1, -1, -1, -1, -1, -1, - -1, 39, -1, 41, 42, -1, -1, 12, 13, -1, - -1, 49, -1, -1, 52, 53, -1, 22, -1, -1, - 58, -1, -1, -1, 29, -1, 64, -1, 33, 34, - -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, - -1, 79, 47, -1, -1, 3, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 13, -1, -1, -1, 17, - 65, 66, 67, -1, 69, -1, -1, -1, 26, -1, - 28, -1, -1, -1, -1, 80, 81, 82, -1, -1, - -1, 39, -1, 41, 42, -1, -1, -1, -1, -1, - -1, 49, -1, -1, 52, 53, -1, -1, -1, -1, - 58, -1, -1, -1, -1, -1, 64, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 12, 13, -1, -1, -1, -1, -1, - -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, - 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, - -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, + 60, 8, 36, 36, 33, 33, 7, 60, 7, 36, + 29, 33, 7, 7, 7, 36, 7, 55, 7, 78, + 1, 78, 48, 1, 36, 33, 36, 36, 60, 5, + 55, 61, 2, 33, 8, 55, 60, 16, 7, 7, + 7, 5, 48, 60, 7, 2, 60, 20, 7, 5, + 48, 17, 55, 2, 31, 7, 61, 8, 33, 7, + 7, 7, 7, 60, 36, 36, 7, 0, 8, 7, + 7, 36, 7, 88, 36, 29, 36, 1, 60, 65, + 33, 17, 78, 1, 7, 7, 36, 7, 7, 33, + 33, 76, 8, 2, 55, 78, 88, 36, 8, 29, + 8, 8, 36, 61, 36, 36, 48, 36, 8, 8, + 8, 66, 40, 8, 40, 8, -1, 7, 8, 8, + -1, -1, -1, 51, 15, 51, 8, 40, 40, 50, + 6, 8, 10, 54, 61, 62, 61, 62, 51, 51, + 42, 8, 33, 8, 20, 7, 61, 62, 8, 29, + 60, 53, 60, 60, 29, 61, 62, 56, 56, 29, + 60, 56, 50, 56, 61, 62, 54, 61, 62, 61, + 62, 60, 8, 29, 61, 62, 7, 55, 7, 61, + 61, 62, 8, 60, 29, -1, 15, 15, 15, 12, + 29, 66, 67, 60, 74, 60, 66, 67, 15, 29, + 8, 61, 62, -1, 33, 85, 34, 34, 36, 36, + 66, 67, 8, 29, -1, -1, -1, 34, -1, 36, + 29, 66, 67, 29, -1, 61, 62, 66, 67, 7, + 61, 62, 29, -1, 57, 61, 62, 29, -1, 25, + 63, 27, 12, 25, 74, 27, 25, 12, 27, -1, + 66, 67, 38, 61, 62, 85, 38, 66, 67, 38, + 66, 67, 29, 18, 19, 61, 62, 29, -1, 66, + 67, 29, -1, -1, 66, 67, 8, -1, 36, 18, + 19, 29, -1, 61, 62, -1, -1, 57, 36, -1, + 45, 46, 57, 63, 18, 19, 18, 19, 63, 66, + 67, 33, 23, 24, 66, 67, 45, 46, 66, 67, + 29, 32, 29, 25, 35, 27, 37, -1, 66, 67, + 29, 45, 46, 45, 46, 29, 38, 23, 24, 61, + 62, -1, 29, -1, -1, -1, 32, -1, -1, 35, + -1, 37, 61, 62, 61, 62, -1, 66, 67, 66, + 67, 29, 61, 62, -1, 59, -1, 66, 67, 23, + 24, -1, 66, 67, 61, 62, 23, 24, 32, 66, + 67, 35, -1, 37, -1, 32, 29, -1, 35, 29, + 37, 85, -1, 61, 62, 23, 24, -1, 66, 67, + -1, -1, -1, 31, 32, 23, 24, 35, -1, 37, + -1, -1, -1, 31, 32, -1, 59, 35, -1, 37, + -1, 61, 62, 66, 67, -1, 66, 67, 10, 23, + 24, -1, -1, -1, -1, -1, -1, 31, 32, -1, + 22, 35, 85, 37, -1, 23, 24, 29, -1, 10, + -1, 23, 24, 31, 32, -1, -1, 35, -1, 37, + 32, 22, -1, 35, -1, 37, -1, -1, 29, -1, + -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, + -1, -1, -1, -1, 66, 67, -1, -1, -1, -1, + -1, -1, 74, -1, 55, -1, -1, -1, 59, -1, + -1, 83, -1, 85, -1, 66, 67, 3, -1, -1, + -1, -1, -1, 74, -1, -1, -1, 13, -1, 23, + 24, 17, 83, -1, 85, -1, -1, 31, 32, -1, + 26, 35, 28, 37, -1, 31, -1, -1, -1, -1, + -1, -1, -1, 39, -1, 41, 42, -1, -1, 12, + 13, -1, -1, 49, -1, -1, 52, 53, -1, 22, + -1, -1, 58, -1, -1, -1, 29, -1, 64, -1, + 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, + 43, -1, -1, 79, 47, -1, -1, 3, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 13, -1, -1, + -1, 17, 65, 66, 67, -1, 69, -1, -1, -1, + 26, -1, 28, -1, -1, -1, -1, 80, 81, 82, + -1, -1, -1, 39, -1, 41, 42, -1, -1, -1, + -1, -1, -1, 49, -1, -1, 52, 53, -1, -1, + -1, -1, 58, -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, - 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, - -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, - -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, - 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, - -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, - -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, - 69, -1, 71, -1, 73, -1, 75, -1, -1, -1, - -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, - -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, - -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, - 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, - -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, - -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, - -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, - 69, -1, 71, -1, 73, -1, 75, -1, -1, -1, - -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, - -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, - -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, - 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, - -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, - -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, - -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, - 69, -1, 71, -1, 73, -1, 75, -1, -1, -1, - -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, - -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, - -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, - 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, - -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, - -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, - 69, -1, 71, -1, 73, 74, 75, -1, -1, -1, - -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, - -1, -1, 7, -1, -1, -1, 11, 12, 13, -1, - -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, - -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, - -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, - -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 65, 66, 67, -1, 69, -1, 71, -1, 73, -1, - 75, -1, -1, -1, -1, 80, 81, 82, -1, -1, - -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, - -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, - -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, - -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, - -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, - -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, - 65, 66, 67, -1, 69, -1, 71, -1, 73, -1, - 75, -1, -1, -1, -1, 80, 81, 82, -1, 84, - -1, 86, -1, -1, -1, -1, 4, 5, 6, -1, - -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, - -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, - -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 59, -1, -1, -1, -1, -1, -1, 66, 67, - 68, 69, 70, -1, 72, 73, 74, 75, 76, 77, - -1, -1, 80, 81, 82, 83, 84, 85, -1, -1, + -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, + 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, + 67, -1, 69, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, + -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, + 67, -1, 69, -1, 71, -1, 73, -1, 75, -1, + -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, + -1, -1, -1, -1, 7, -1, -1, -1, 11, 12, + 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, + -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, + 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, + 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, + 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, + 73, -1, 75, -1, -1, -1, -1, 80, 81, 82, + -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, + 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, + -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, + 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, + 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, + 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, + 73, 74, 75, -1, -1, -1, -1, 80, 81, 82, + -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, + -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, + -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, + -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, + 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, + -1, 51, -1, 53, -1, -1, 56, -1, -1, -1, + -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, + -1, 71, -1, 73, -1, 75, -1, -1, -1, -1, + 80, 81, 82, -1, -1, -1, -1, -1, -1, -1, + -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, -1, 56, + -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, + 67, -1, 69, -1, 71, -1, 73, -1, 75, -1, + -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, + -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, + -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, + -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, + 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, + 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, + -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, + -1, 65, 66, 67, -1, 69, -1, 71, -1, 73, + -1, 75, -1, -1, -1, -1, 80, 81, 82, -1, + -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, + 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, + -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, + -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, + -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, + 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, + -1, -1, -1, -1, 65, 66, 67, -1, 69, -1, + 71, -1, 73, -1, 75, -1, -1, -1, -1, 80, + 81, 82, -1, -1, -1, -1, -1, -1, -1, -1, + 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, + -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, + -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, + -1, 69, -1, 71, -1, 73, -1, 75, -1, -1, + -1, -1, 80, 81, 82, -1, -1, 85, -1, -1, + -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, + -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, + -1, -1, -1, 61, -1, -1, -1, 65, 66, 67, + -1, 69, -1, 71, -1, 73, -1, 75, -1, -1, + -1, -1, 80, 81, 82, -1, 84, -1, 86, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, + -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, - -1, -1, -1, -1, 65, 66, 67, 68, 69, 70, + -1, -1, -1, -1, -1, 66, 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, 84, 85, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, @@ -687,18 +736,18 @@ const int JavaScriptGrammar::action_check [] = { -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, - -1, 55, -1, -1, -1, 59, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, - 84, 85, -1, -1, -1, -1, -1, 4, -1, -1, - -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, - -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, - -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, - -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, - 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, - -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, -1, -1, 80, 81, 82, 83, 84, -1, -1, + 84, 85, -1, -1, -1, -1, -1, 4, 5, 6, + -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, + -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, + -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, + 47, -1, -1, -1, -1, -1, -1, -1, 55, -1, + -1, -1, 59, -1, -1, -1, -1, -1, 65, 66, + 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, + 77, -1, -1, 80, 81, 82, 83, 84, 85, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, -1, 29, @@ -708,60 +757,73 @@ const int JavaScriptGrammar::action_check [] = { -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, 84, -1, -1, -1, -1, -1, - -1, 4, 5, 6, -1, -1, 9, 10, 11, 12, - 13, 14, -1, 16, -1, -1, -1, 20, 21, 22, - -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, + -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, + 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, + -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, - 83, 84, 85, -1, -1, -1, -1, -1, 4, 5, + 83, 84, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, 12, 13, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, - -1, 47, -1, -1, -1, 51, -1, 53, -1, 55, + -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, 84, 85, - -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, + 9, 10, 11, 12, 13, 14, -1, 16, -1, -1, + -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, + 29, 30, 31, 32, 33, 34, -1, 36, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, + -1, -1, 51, -1, 53, -1, 55, -1, -1, -1, + 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, + -1, 80, 81, 82, 83, 84, 85, -1, -1, -1, + -1, -1, - 14, 77, 23, 15, 23, 77, 67, 20, 23, 10, - 94, 29, 5, 67, 14, 14, 67, 23, 29, 29, - 14, 63, 14, 25, 29, 29, 67, 23, 14, 67, - 14, 67, 23, 14, 23, 23, 67, 14, 23, 15, - 15, 31, 29, 23, 23, 14, 29, 29, 14, 23, - 14, 14, 23, 15, 14, 14, 29, 29, 67, 92, - 67, 89, 23, 14, 67, 23, 14, 14, 23, 67, - 67, 23, 67, 14, 6, 29, 6, 6, 34, 29, - 23, 37, -1, 40, -1, 42, 36, 40, -1, 15, - 14, 23, 45, 23, 23, 14, 40, 67, 42, 67, - 67, 40, 40, 42, 42, 40, 40, 23, 23, 40, - 14, 45, 40, 48, 45, 40, 44, 40, 40, 44, - 40, 29, 40, 46, 46, 45, 40, 45, 36, 40, - 40, 45, 42, 34, 67, 46, 37, 40, 81, 42, - 64, 40, 40, 23, 42, 64, 67, 40, 14, 40, - 40, -1, 32, 52, 40, 46, 42, 50, -1, 40, - 64, 42, 40, 96, 42, 40, 56, 42, 83, 40, - 34, 42, 40, 37, 42, 40, -1, 40, -1, 95, - 101, 44, 40, 40, 42, 42, 40, 40, 42, 54, - 40, 40, 45, -1, 43, 45, 40, 40, 64, 42, - 40, 45, 42, 40, 40, 40, 40, 43, 45, 40, - 45, 45, 40, -1, 45, 40, 40, 45, 49, 40, - 45, 45, 40, -1, 45, 40, 47, 45, 62, 57, - 45, 40, 23, -1, 40, 53, 45, 62, 62, 45, - 40, 32, 33, 40, 40, 45, 55, 62, 45, 45, - 47, 11, 40, -1, -1, 51, 62, 45, -1, 47, - -1, 21, 22, 23, 8, -1, -1, 11, 14, 15, - 16, 17, 18, 19, -1, -1, -1, 21, 22, 23, + 14, 93, 66, 15, 23, 29, 76, 76, 23, 20, + 23, 14, 29, 23, 15, 23, 23, 14, 62, 23, + 14, 23, 10, 29, 5, 14, 66, 66, 14, 29, + 14, 23, 66, 66, 29, 66, 14, 66, 66, 14, + 23, 23, 14, 23, 14, 14, 66, 23, 66, 23, + 29, 14, 29, 14, 14, 23, 23, 66, 29, 14, + 14, 66, 14, 29, 23, 29, 91, 66, 66, 14, + 66, 29, 29, 66, 30, 14, -1, 39, 29, 25, + -1, 23, 44, 29, 35, 23, 39, -1, 15, 39, + 39, 39, 45, 41, 44, 44, 39, 88, 39, 39, + 41, 44, 39, 39, 44, 41, 39, 39, 45, 6, + 39, -1, 45, 42, 39, 39, 41, 41, 39, 66, + 39, 42, 41, 55, 63, 39, 23, 41, 39, 39, + 39, 41, 41, 39, 6, 41, 39, 39, 80, 14, + -1, 44, 53, 39, 39, 47, 14, 23, 44, 44, + 39, 23, 41, 100, 39, 39, 94, 41, 39, 44, + 41, 39, 33, 41, 29, 36, 39, -1, 66, 39, + 35, 44, 39, 43, -1, 33, -1, 44, 36, 39, + 39, 41, 41, 39, 39, 23, 33, 43, 63, 36, + 39, 39, 14, 31, 43, 63, 51, 95, 39, 39, + 41, 49, 39, -1, 44, 39, 82, 39, 45, 39, + 44, 39, 44, 39, 44, 39, 44, -1, 44, -1, + 44, -1, -1, 39, 50, 39, 54, 61, 44, 61, + 44, 61, 46, -1, -1, -1, -1, 61, 39, -1, + 56, 63, 39, 44, 39, 46, 41, 44, 39, 46, + -1, 39, 39, 44, 39, 46, 44, 44, 23, 44, + 11, 48, -1, -1, 52, 8, 31, 32, 11, -1, + 21, 22, 23, -1, -1, -1, 61, -1, 21, 22, + 23, 14, 15, 16, 17, 18, 19, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, + 29, -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, -1, 40, -1, -1, -1, -1, 45, -1, - 47, -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, -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}; diff --git a/src/declarative/qml/parser/javascriptgrammar_p.h b/src/declarative/qml/parser/javascriptgrammar_p.h index de83cd0..830f533 100644 --- a/src/declarative/qml/parser/javascriptgrammar_p.h +++ b/src/declarative/qml/parser/javascriptgrammar_p.h @@ -150,15 +150,15 @@ public: T_XOR = 78, T_XOR_EQ = 79, - ACCEPT_STATE = 584, - RULE_COUNT = 321, - STATE_COUNT = 585, + ACCEPT_STATE = 588, + RULE_COUNT = 323, + STATE_COUNT = 589, TERMINAL_COUNT = 91, - NON_TERMINAL_COUNT = 103, + NON_TERMINAL_COUNT = 102, - GOTO_INDEX_OFFSET = 585, - GOTO_INFO_OFFSET = 1825, - GOTO_CHECK_OFFSET = 1825 + GOTO_INDEX_OFFSET = 589, + GOTO_INFO_OFFSET = 2092, + GOTO_CHECK_OFFSET = 2092 }; static const char *const spell []; diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp index 5d456c7..7ff438e 100644 --- a/src/declarative/qml/parser/javascriptparser.cpp +++ b/src/declarative/qml/parser/javascriptparser.cpp @@ -400,60 +400,48 @@ case 46: { } case 47: { - AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).sval); - node->identifierToken = loc(1); - sym(1).Node = node; -} break; - -case 48: { - AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval); - node->identifierToken = loc(3); - sym(1).Node = node; -} break; - -case 49: { AST::ThisExpression *node = makeAstNode (driver->nodePool()); node->thisToken = loc(1); sym(1).Node = node; } break; -case 50: { +case 48: { AST::IdentifierExpression *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 51: { +case 49: { AST::NullExpression *node = makeAstNode (driver->nodePool()); node->nullToken = loc(1); sym(1).Node = node; } break; -case 52: { +case 50: { AST::TrueLiteral *node = makeAstNode (driver->nodePool()); node->trueToken = loc(1); sym(1).Node = node; } break; -case 53: { +case 51: { AST::FalseLiteral *node = makeAstNode (driver->nodePool()); node->falseToken = loc(1); sym(1).Node = node; } break; -case 54: { +case 52: { AST::NumericLiteral *node = makeAstNode (driver->nodePool(), sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 55: { +case 53: { AST::StringLiteral *node = makeAstNode (driver->nodePool(), sym(1).sval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 56: { +case 54: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -464,7 +452,7 @@ case 56: { sym(1).Node = node; } break; -case 57: { +case 55: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -475,22 +463,39 @@ case 57: { sym(1).Node = node; } break; -case 58: { - AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).Elision); +case 56: { + AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), (AST::Elision *) 0); + node->lbracketToken = loc(1); + node->rbracketToken = loc(2); + sym(1).Node = node; +} break; + +case 57: { + AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).Elision->finish()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 59: { +case 58: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; +case 59: { + AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish (), + (AST::Elision *) 0); + node->lbracketToken = loc(1); + node->commaToken = loc(3); + node->rbracketToken = loc(4); + sym(1).Node = node; +} break; + case 60: { - AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision); + AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish (), + sym(4).Elision->finish()); node->lbracketToken = loc(1); node->commaToken = loc(3); node->rbracketToken = loc(5); @@ -525,43 +530,59 @@ case 63: { } break; case 64: { - sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Elision, sym(2).Expression); -} break; + AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).sval); + node->identifierToken = loc(1); + sym(1).Node = node; +} break; case 65: { - AST::ElementList *node = makeAstNode (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression); - node->commaToken = loc(2); - sym(1).Node = node; -} break; + AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval); + node->identifierToken = loc(3); + sym(1).Node = node; +} break; case 66: { - AST::Elision *node = makeAstNode (driver->nodePool()); - node->commaToken = loc(1); - sym(1).Node = node; + sym(1).Node = makeAstNode (driver->nodePool(), (AST::Elision *) 0, sym(1).Expression); } break; case 67: { - AST::Elision *node = makeAstNode (driver->nodePool(), sym(1).Elision); - node->commaToken = loc(2); - sym(1).Node = node; + sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Elision->finish(), sym(2).Expression); } break; case 68: { - sym(1).Node = 0; + AST::ElementList *node = makeAstNode (driver->nodePool(), sym(1).ElementList, + (AST::Elision *) 0, sym(3).Expression); + node->commaToken = loc(2); + sym(1).Node = node; } break; case 69: { - sym(1).Elision = sym(1).Elision->finish (); + AST::ElementList *node = makeAstNode (driver->nodePool(), sym(1).ElementList, sym(3).Elision->finish(), + sym(4).Expression); + node->commaToken = loc(2); + sym(1).Node = node; } break; case 70: { + AST::Elision *node = makeAstNode (driver->nodePool()); + node->commaToken = loc(1); + sym(1).Node = node; +} break; + +case 71: { + AST::Elision *node = makeAstNode (driver->nodePool(), sym(1).Elision); + node->commaToken = loc(2); + sym(1).Node = node; +} break; + +case 72: { AST::PropertyNameAndValueList *node = makeAstNode (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; -case 71: { +case 73: { AST::PropertyNameAndValueList *node = makeAstNode (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); @@ -569,40 +590,36 @@ case 71: { sym(1).Node = node; } break; -case 72: { +case 74: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 73: -case 74: { +case 75: +case 76: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 75: { +case 77: { AST::StringLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 76: { +case 78: { AST::NumericLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 77: { +case 79: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 78: - -case 79: - case 80: case 81: @@ -660,25 +677,29 @@ case 106: case 107: case 108: + +case 109: + +case 110: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); } break; -case 113: { +case 115: { AST::ArrayMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 114: { +case 116: { AST::FieldMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 115: { +case 117: { AST::NewMemberExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); @@ -686,316 +707,309 @@ case 115: { sym(1).Node = node; } break; -case 117: { +case 119: { AST::NewExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; -case 118: { +case 120: { AST::CallExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 119: { +case 121: { AST::CallExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 120: { +case 122: { AST::ArrayMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 121: { +case 123: { AST::FieldMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 122: { +case 124: { sym(1).Node = 0; } break; -case 123: { +case 125: { sym(1).Node = sym(1).ArgumentList->finish(); } break; -case 124: { +case 126: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Expression); } break; -case 125: { +case 127: { AST::ArgumentList *node = makeAstNode (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 129: { +case 131: { AST::PostIncrementExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; -case 130: { +case 132: { AST::PostDecrementExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; -case 132: { +case 134: { AST::DeleteExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; -case 133: { +case 135: { AST::VoidExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; -case 134: { +case 136: { AST::TypeOfExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; -case 135: { +case 137: { AST::PreIncrementExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; -case 136: { +case 138: { AST::PreDecrementExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; -case 137: { +case 139: { AST::UnaryPlusExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; -case 138: { +case 140: { AST::UnaryMinusExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; -case 139: { +case 141: { AST::TildeExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; -case 140: { +case 142: { AST::NotExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; -case 142: { +case 144: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 143: { +case 145: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 144: { +case 146: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 146: { +case 148: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 147: { +case 149: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 149: { +case 151: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 150: { +case 152: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 151: { +case 153: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 153: { +case 155: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 154: { +case 156: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 155: { +case 157: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 156: { +case 158: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 157: { +case 159: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 158: { +case 160: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 160: { +case 162: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 161: { +case 163: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 162: { +case 164: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 163: { +case 165: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 164: { +case 166: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 166: { +case 168: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 167: { +case 169: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 168: { +case 170: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 169: { +case 171: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 171: { +case 173: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 172: { +case 174: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 173: { +case 175: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 174: { - AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::StrictNotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; - case 176: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::BitAnd, sym(3).Expression); + QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1009,7 +1023,7 @@ case 178: { case 180: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::BitXor, sym(3).Expression); + QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1023,7 +1037,7 @@ case 182: { case 184: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::BitOr, sym(3).Expression); + QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1037,7 +1051,7 @@ case 186: { case 188: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::And, sym(3).Expression); + QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1051,7 +1065,7 @@ case 190: { case 192: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::Or, sym(3).Expression); + QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1064,6 +1078,13 @@ case 194: { } break; case 196: { + AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, + QSOperator::Or, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; +} break; + +case 198: { AST::ConditionalExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1071,7 +1092,7 @@ case 196: { sym(1).Node = node; } break; -case 198: { +case 200: { AST::ConditionalExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1079,112 +1100,112 @@ case 198: { sym(1).Node = node; } break; -case 200: { +case 202: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 202: { +case 204: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 203: { +case 205: { sym(1).ival = QSOperator::Assign; } break; -case 204: { +case 206: { sym(1).ival = QSOperator::InplaceMul; } break; -case 205: { +case 207: { sym(1).ival = QSOperator::InplaceDiv; } break; -case 206: { +case 208: { sym(1).ival = QSOperator::InplaceMod; } break; -case 207: { +case 209: { sym(1).ival = QSOperator::InplaceAdd; } break; -case 208: { +case 210: { sym(1).ival = QSOperator::InplaceSub; } break; -case 209: { +case 211: { sym(1).ival = QSOperator::InplaceLeftShift; } break; -case 210: { +case 212: { sym(1).ival = QSOperator::InplaceRightShift; } break; -case 211: { +case 213: { sym(1).ival = QSOperator::InplaceURightShift; } break; -case 212: { +case 214: { sym(1).ival = QSOperator::InplaceAnd; } break; -case 213: { +case 215: { sym(1).ival = QSOperator::InplaceXor; } break; -case 214: { +case 216: { sym(1).ival = QSOperator::InplaceOr; } break; -case 216: { +case 218: { AST::Expression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 217: { +case 219: { sym(1).Node = 0; } break; -case 220: { +case 222: { AST::Expression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 221: { +case 223: { sym(1).Node = 0; } break; -case 238: { +case 240: { AST::Block *node = makeAstNode (driver->nodePool(), sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 239: { +case 241: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Statement); } break; -case 240: { +case 242: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).StatementList, sym(2).Statement); } break; -case 241: { +case 243: { sym(1).Node = 0; } break; -case 242: { +case 244: { sym(1).Node = sym(1).StatementList->finish (); } break; -case 244: { +case 246: { AST::VariableStatement *node = makeAstNode (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); @@ -1192,76 +1213,76 @@ case 244: { sym(1).Node = node; } break; -case 245: { +case 247: { sym(1).ival = T_CONST; } break; -case 246: { +case 248: { sym(1).ival = T_VAR; } break; -case 247: { +case 249: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 248: { +case 250: { AST::VariableDeclarationList *node = makeAstNode (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; -case 249: { +case 251: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 250: { +case 252: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; -case 251: { +case 253: { AST::VariableDeclaration *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 252: { +case 254: { AST::VariableDeclaration *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 253: { +case 255: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 254: { +case 256: { sym(1).Node = 0; } break; -case 256: { +case 258: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 257: { +case 259: { sym(1).Node = 0; } break; -case 259: { +case 261: { AST::EmptyStatement *node = makeAstNode (driver->nodePool()); node->semicolonToken = loc(1); sym(1).Node = node; } break; -case 261: { +case 263: { AST::ExpressionStatement *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 262: { +case 264: { AST::IfStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1270,7 +1291,7 @@ case 262: { sym(1).Node = node; } break; -case 263: { +case 265: { AST::IfStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1278,7 +1299,7 @@ case 263: { sym(1).Node = node; } break; -case 265: { +case 267: { AST::DoWhileStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); @@ -1288,7 +1309,7 @@ case 265: { sym(1).Node = node; } break; -case 266: { +case 268: { AST::WhileStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); @@ -1296,7 +1317,7 @@ case 266: { sym(1).Node = node; } break; -case 267: { +case 269: { AST::ForStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); @@ -1307,7 +1328,7 @@ case 267: { sym(1).Node = node; } break; -case 268: { +case 270: { AST::LocalForStatement *node = makeAstNode (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); @@ -1320,7 +1341,7 @@ case 268: { sym(1).Node = node; } break; -case 269: { +case 271: { AST:: ForEachStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); @@ -1330,7 +1351,7 @@ case 269: { sym(1).Node = node; } break; -case 270: { +case 272: { AST::LocalForEachStatement *node = makeAstNode (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); @@ -1341,14 +1362,14 @@ case 270: { sym(1).Node = node; } break; -case 272: { +case 274: { AST::ContinueStatement *node = makeAstNode (driver->nodePool()); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 274: { +case 276: { AST::ContinueStatement *node = makeAstNode (driver->nodePool(), sym(2).sval); node->continueToken = loc(1); node->identifierToken = loc(2); @@ -1356,14 +1377,14 @@ case 274: { sym(1).Node = node; } break; -case 276: { +case 278: { AST::BreakStatement *node = makeAstNode (driver->nodePool()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 278: { +case 280: { AST::BreakStatement *node = makeAstNode (driver->nodePool(), sym(2).sval); node->breakToken = loc(1); node->identifierToken = loc(2); @@ -1371,14 +1392,14 @@ case 278: { sym(1).Node = node; } break; -case 280: { +case 282: { AST::ReturnStatement *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 281: { +case 283: { AST::WithStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); @@ -1386,7 +1407,7 @@ case 281: { sym(1).Node = node; } break; -case 282: { +case 284: { AST::SwitchStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); @@ -1394,90 +1415,90 @@ case 282: { sym(1).Node = node; } break; -case 283: { +case 285: { AST::CaseBlock *node = makeAstNode (driver->nodePool(), sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 284: { +case 286: { AST::CaseBlock *node = makeAstNode (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(5); sym(1).Node = node; } break; -case 285: { +case 287: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).CaseClause); } break; -case 286: { +case 288: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); } break; -case 287: { +case 289: { sym(1).Node = 0; } break; -case 288: { +case 290: { sym(1).Node = sym(1).CaseClauses->finish (); } break; -case 289: { +case 291: { AST::CaseClause *node = makeAstNode (driver->nodePool(), sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; -case 290: { +case 292: { AST::DefaultClause *node = makeAstNode (driver->nodePool(), sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 291: -case 292: { +case 293: +case 294: { AST::LabelledStatement *node = makeAstNode (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 293: { +case 295: { AST::LabelledStatement *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 295: { +case 297: { AST::ThrowStatement *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 296: { +case 298: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; -case 297: { +case 299: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 298: { +case 300: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 299: { +case 301: { AST::Catch *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); @@ -1486,20 +1507,20 @@ case 299: { sym(1).Node = node; } break; -case 300: { +case 302: { AST::Finally *node = makeAstNode (driver->nodePool(), sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; -case 302: { +case 304: { AST::DebuggerStatement *node = makeAstNode (driver->nodePool()); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 303: { +case 305: { AST::FunctionDeclaration *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); @@ -1510,7 +1531,7 @@ case 303: { sym(1).Node = node; } break; -case 304: { +case 306: { AST::FunctionExpression *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (sym(2).sval) @@ -1522,56 +1543,56 @@ case 304: { sym(1).Node = node; } break; -case 305: { +case 307: { AST::FormalParameterList *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 306: { +case 308: { AST::FormalParameterList *node = makeAstNode (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 307: { +case 309: { sym(1).Node = 0; } break; -case 308: { +case 310: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; -case 309: { +case 311: { sym(1).Node = 0; } break; -case 311: { +case 313: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElements->finish ()); } break; -case 312: { +case 314: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElement); } break; -case 313: { +case 315: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); } break; -case 314: { +case 316: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Statement); } break; -case 315: { +case 317: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).FunctionDeclaration); } break; -case 316: { +case 318: { sym(1).sval = 0; } break; -case 318: { +case 320: { sym(1).Node = 0; } break; diff --git a/src/declarative/qml/parser/javascriptparser_p.h b/src/declarative/qml/parser/javascriptparser_p.h index 4c5fef1..2ae4c34 100644 --- a/src/declarative/qml/parser/javascriptparser_p.h +++ b/src/declarative/qml/parser/javascriptparser_p.h @@ -196,9 +196,9 @@ protected: -#define J_SCRIPT_REGEXPLITERAL_RULE1 56 +#define J_SCRIPT_REGEXPLITERAL_RULE1 54 -#define J_SCRIPT_REGEXPLITERAL_RULE2 57 +#define J_SCRIPT_REGEXPLITERAL_RULE2 55 QT_END_NAMESPACE -- cgit v0.12 From 04fa2a69545fddbf96454972ebf243d4c6f7b6b2 Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Tue, 19 May 2009 15:37:18 +0200 Subject: Doc - changing the stylesheet to use a greeny color. Reviewed-By: David Boddie --- tools/qdoc3/test/classic.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index 3704a15..e53ea29 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -17,7 +17,7 @@ H3 { h3.fn,span.fn { - background-color: #d5e1e8; + background-color: #d5e1d5; border-width: 1px; border-style: solid; border-color: #84b0c7; @@ -112,7 +112,7 @@ table td.memItemRight { border-right-style: none; border-bottom-style: none; border-left-style: none; - background-color: #FAFAFA; + background-color: #d5e1d5; font-size: 80%; } -- cgit v0.12 From 1096c69365d14df903ad1dd0e842764146aee01d Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 19 May 2009 15:44:33 +0200 Subject: Fix stopping link loops in QDirIterator on Windows currentFileInfo is only used for returning from the public functions since the file info used in the algorithm is one step ahead. nextFileInfo is the one actually used in the algorithm. The bug was introduced in a compile fix for Windows and broke the stopLinkLoop test for QDirIterator. Reviewed-by: Olivier --- src/corelib/io/qdiriterator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index b14f436..81bfb27 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -201,8 +201,8 @@ void QDirIteratorPrivate::advance() QString subDir = it->currentFilePath(); #ifdef Q_OS_WIN - if (currentFileInfo.isSymLink()) - subDir = currentFileInfo.canonicalFilePath(); + if (nextFileInfo.isSymLink()) + subDir = nextFileInfo.canonicalFilePath(); #endif pushSubDirectory(subDir, it->nameFilters(), it->filters()); } -- cgit v0.12 From 9a512ee004535983e12a1dd38dc2e28eb35c1d5c Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 19 May 2009 15:52:55 +0200 Subject: make the changedSignal test more robust On some platforms (e.g. Mac) it's not sufficient to call processEvents() only once. Reviewed-by: Andreas Aardal Hanssen --- 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 da99c30..0c5ebf6 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -47,6 +47,7 @@ #include #include +#include "../../shared/util.h" #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #include @@ -3537,8 +3538,7 @@ void tst_QGraphicsScene::changedSignal() scene.addItem(rect); QCOMPARE(cl.changes.size(), 0); - qApp->processEvents(); - QCOMPARE(cl.changes.size(), 1); + QTRY_COMPARE(cl.changes.size(), 1); QCOMPARE(cl.changes.at(0).size(), 1); QCOMPARE(cl.changes.at(0).first(), QRectF(0, 0, 10, 10)); -- cgit v0.12 From bff689f3c5b127add96c50e4b2fdb2eadbf498a9 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 19 May 2009 16:15:32 +0200 Subject: qwidget autotest fixed for Windows CE translucentWidget: On Windows mobile the ColorRedWidget is initially moved to the taskbar position where it cannot be grabbed. Reviewed-by: mauricek --- tests/auto/qwidget/tst_qwidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 5896df9..5afaebf 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -8371,6 +8371,7 @@ void tst_QWidget::translucentWidget() ColorRedWidget label; label.setFixedSize(16,16); label.setAttribute(Qt::WA_TranslucentBackground); + label.move(qApp->desktop()->availableGeometry().topLeft()); label.show(); #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&label); -- cgit v0.12 From a29ede629a18f9e107bae5e9ca03059a66f25de5 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 2 Apr 2009 12:49:13 +0200 Subject: Doc: Added a note about copying by value in QMetaProperty and included details about BlockingQueuedConnection in QMetaObject::invokeMethod(). Task-number: 187869 Task-number: 216742 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qmetaobject.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 719398c..b65f956 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1007,6 +1007,11 @@ enum { MaximumParamCount = 11 }; // up to 10 arguments + 1 return value a QEvent will be sent and the member is invoked as soon as the application enters the main event loop. + \o If \a type is Qt::BlockingQueuedConnection, the method will be invoked in + the same way as for Qt::QueuedConnection, except that the current thread + will block until the event is delivered. Using this connection type to + communicate between objects in the same thread will lead to deadlocks. + \o If \a type is Qt::AutoConnection, the member is invoked synchronously if \a obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously. @@ -1897,6 +1902,12 @@ static QByteArray qualifiedName(const QMetaEnum &e) \ingroup objectmodel + Property meta-data is obtained from an object's meta-object. See + QMetaObject::property() and QMetaObject::propertyCount() for + details. + + \section1 Property Meta-Data + A property has a name() and a type(), as well as various attributes that specify its behavior: isReadable(), isWritable(), isDesignable(), isScriptable(), and isStored(). @@ -1912,9 +1923,10 @@ static QByteArray qualifiedName(const QMetaEnum &e) functions. See QObject::setProperty() and QObject::property() for details. - You get property meta-data through an object's meta-object. See - QMetaObject::property() and QMetaObject::propertyCount() for - details. + \section1 Copying and Assignment + + QMetaProperty objects can be copied by value. However, each copy will + refer to the same underlying property meta-data. \sa QMetaObject, QMetaEnum, QMetaMethod, {Qt's Property System} */ -- cgit v0.12 From fb869402dd5d061d1e5257f3c4b25d28ab9428a5 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 2 Apr 2009 12:49:13 +0200 Subject: Doc: Added a note about copying by value in QMetaProperty and included details about BlockingQueuedConnection in QMetaObject::invokeMethod(). Task-number: 187869 Task-number: 216742 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qmetaobject.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 719398c..b65f956 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1007,6 +1007,11 @@ enum { MaximumParamCount = 11 }; // up to 10 arguments + 1 return value a QEvent will be sent and the member is invoked as soon as the application enters the main event loop. + \o If \a type is Qt::BlockingQueuedConnection, the method will be invoked in + the same way as for Qt::QueuedConnection, except that the current thread + will block until the event is delivered. Using this connection type to + communicate between objects in the same thread will lead to deadlocks. + \o If \a type is Qt::AutoConnection, the member is invoked synchronously if \a obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously. @@ -1897,6 +1902,12 @@ static QByteArray qualifiedName(const QMetaEnum &e) \ingroup objectmodel + Property meta-data is obtained from an object's meta-object. See + QMetaObject::property() and QMetaObject::propertyCount() for + details. + + \section1 Property Meta-Data + A property has a name() and a type(), as well as various attributes that specify its behavior: isReadable(), isWritable(), isDesignable(), isScriptable(), and isStored(). @@ -1912,9 +1923,10 @@ static QByteArray qualifiedName(const QMetaEnum &e) functions. See QObject::setProperty() and QObject::property() for details. - You get property meta-data through an object's meta-object. See - QMetaObject::property() and QMetaObject::propertyCount() for - details. + \section1 Copying and Assignment + + QMetaProperty objects can be copied by value. However, each copy will + refer to the same underlying property meta-data. \sa QMetaObject, QMetaEnum, QMetaMethod, {Qt's Property System} */ -- cgit v0.12 From 2c5b7fe040575aa2ee560117c1c3455724c2f9ae Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 2 Apr 2009 12:49:13 +0200 Subject: Doc: Added a note about copying by value in QMetaProperty and included details about BlockingQueuedConnection in QMetaObject::invokeMethod(). Task-number: 187869 Task-number: 216742 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qmetaobject.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 719398c..b65f956 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1007,6 +1007,11 @@ enum { MaximumParamCount = 11 }; // up to 10 arguments + 1 return value a QEvent will be sent and the member is invoked as soon as the application enters the main event loop. + \o If \a type is Qt::BlockingQueuedConnection, the method will be invoked in + the same way as for Qt::QueuedConnection, except that the current thread + will block until the event is delivered. Using this connection type to + communicate between objects in the same thread will lead to deadlocks. + \o If \a type is Qt::AutoConnection, the member is invoked synchronously if \a obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously. @@ -1897,6 +1902,12 @@ static QByteArray qualifiedName(const QMetaEnum &e) \ingroup objectmodel + Property meta-data is obtained from an object's meta-object. See + QMetaObject::property() and QMetaObject::propertyCount() for + details. + + \section1 Property Meta-Data + A property has a name() and a type(), as well as various attributes that specify its behavior: isReadable(), isWritable(), isDesignable(), isScriptable(), and isStored(). @@ -1912,9 +1923,10 @@ static QByteArray qualifiedName(const QMetaEnum &e) functions. See QObject::setProperty() and QObject::property() for details. - You get property meta-data through an object's meta-object. See - QMetaObject::property() and QMetaObject::propertyCount() for - details. + \section1 Copying and Assignment + + QMetaProperty objects can be copied by value. However, each copy will + refer to the same underlying property meta-data. \sa QMetaObject, QMetaEnum, QMetaMethod, {Qt's Property System} */ -- cgit v0.12 From f7b3702719b85f0ecff069b15e80d4ebaab111f6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 19 May 2009 16:52:07 +0200 Subject: Doc: Added information about the third-party MD4, SHA-1 and DES code. Reviewed-by: Trust Me --- doc/src/3rdparty.qdoc | 136 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 82 insertions(+), 54 deletions(-) diff --git a/doc/src/3rdparty.qdoc b/doc/src/3rdparty.qdoc index a87878e..23dfb12 100644 --- a/doc/src/3rdparty.qdoc +++ b/doc/src/3rdparty.qdoc @@ -61,6 +61,15 @@ \tableofcontents + \section1 DES (\c des.cpp) + + \e{Implementation of DES encryption for NTLM\br + Copyright 1997-2005 Simon Tatham.\br + This software is released under the MIT license.} + + See \c src/3rdparty/des/des.cpp for more information about the terms and + conditions under which the code is supplied. + \section1 FreeType 2 (\c freetype) version 2.3.6 \e{The FreeType project is a team of volunteers who develop free, portable @@ -108,18 +117,6 @@ See \c src/3rdparty/harfbuzz/COPYING.FTL and src/3rdparty/harfbuzz/COPYING.GPL for license details. - \section1 MD5 (\c md5.cpp and \c md5.h) - - \e{This code implements the MD5 message-digest algorithm. - The algorithm is due to Ron Rivest. This code was - written by Colin Plumb in 1993, no copyright is claimed. - This code is in the public domain; do with it what you wish.} -- quoted from - \c src/3rdparty/md5/md5.h - - See \c src/3rdparty/md5/md5.cpp and \c src/3rdparty/md5/md5.h for more - information about the terms and conditions under which the code is - supplied. - \section1 The Independent JPEG Group's JPEG Software (\c libjpeg) version 6b \e{This package contains C software to implement JPEG image compression and @@ -132,6 +129,29 @@ See \c src/3rdparty/libjpeg/README for license details. + \section1 MD4 (\c md4.cpp and \c md4.h) + + \e{MD4 (RFC-1320) message digest.\br + Modified from MD5 code by Andrey Panin \br\br + Written by Solar Designer in 2001, and placed in\br + the public domain. There's absolutely no warranty.} + + See \c src/3rdparty/md4/md4.cpp and \c src/3rdparty/md4/md4.h for more + information about the terms and conditions under which the code is + supplied. + + \section1 MD5 (\c md5.cpp and \c md5.h) + + \e{This code implements the MD5 message-digest algorithm. + The algorithm is due to Ron Rivest. This code was + written by Colin Plumb in 1993, no copyright is claimed. + This code is in the public domain; do with it what you wish.} -- quoted from + \c src/3rdparty/md5/md5.h + + See \c src/3rdparty/md5/md5.cpp and \c src/3rdparty/md5/md5.h for more + information about the terms and conditions under which the code is + supplied. + \section1 MNG Library (\c libmng) version 1.0.10 \e{The libmng library supports decoding, displaying, encoding, and various @@ -152,6 +172,56 @@ See \c src/3rdparty/libpng/LICENSE for license details. + \section1 The ptmalloc memory allocator (\c ptmalloc3) version 1.8 + + \e ptmcalloc3 is a scalable concurrent memory allocator suitable + for use in multi-threaded programs. + + \hr + + Copyright (c) 2001-2006 Wolfram Gloger + + Permission to use, copy, modify, distribute, and sell this software + and its documentation for any purpose is hereby granted without fee, + provided that (i) the above copyright notices and this permission + notice appear in all copies of the software and related documentation, + and (ii) the name of Wolfram Gloger may not be used in any advertising + or publicity relating to the software. + + THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL, + INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY + DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY + OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + + \hr + + See \c src/3rdparty/ptmalloc/COPYRIGHT for license details. + + \section1 SHA-1 (\c sha1.cpp) + + \e{Based on the public domain implementation of the SHA-1 algorithm\br + Copyright (C) Dominik Reichl } + + See \c src/3rdparty/sha1/sha1.cpp for more information about the terms and + conditions under which the code is supplied. + + \section1 SQLite (\c sqlite) version 3.5.9 + + \e{SQLite is a small C library that implements a + self-contained, embeddable, zero-configuration SQL database engine.} + -- quoted from \l{http://www.sqlite.org/}{www.sqlite.org}. + + According to the comments in the source files, the code is in the public + domain. See the + \l{http://www.sqlite.org/copyright.html}{SQLite Copyright} page on the + SQLite web site for further information. + \section1 TIFF Software Distribution (\c libtiff) version 3.8.2 \e {libtiff is a set of C functions (a library) that support the @@ -212,17 +282,6 @@ See \c src/3rdparty/libtiff/COPYRIGHT for license details. - \section1 SQLite (\c sqlite) version 3.5.9 - - \e{SQLite is a small C library that implements a - self-contained, embeddable, zero-configuration SQL database engine.} - -- quoted from \l{http://www.sqlite.org/}{www.sqlite.org}. - - According to the comments in the source files, the code is in the public - domain. See the - \l{http://www.sqlite.org/copyright.html}{SQLite Copyright} page on the - SQLite web site for further information. - \section1 Wintab API (\c wintab) Wintab is a de facto API for pointing devices on Windows. The @@ -238,35 +297,4 @@ src/3rdparty/zlib/README. See \c src/3rdparty/zlib/README for license details. - - \section1 The ptmalloc memory allocator (\c ptmalloc3) version 1.8 - - \e ptmcalloc3 is a scalable concurrent memory allocator suitable - for use in multi-threaded programs. - - \hr - - Copyright (c) 2001-2006 Wolfram Gloger - - Permission to use, copy, modify, distribute, and sell this software - and its documentation for any purpose is hereby granted without fee, - provided that (i) the above copyright notices and this permission - notice appear in all copies of the software and related documentation, - and (ii) the name of Wolfram Gloger may not be used in any advertising - or publicity relating to the software. - - THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - - IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL, - INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY - DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY - OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - - \hr - - See \c src/3rdparty/ptmalloc/COPYRIGHT for license details. */ -- cgit v0.12 From 92b47ba61809de30eed205e7d1eafb1cde1087e1 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 19 May 2009 16:35:49 +0200 Subject: Ensure that the export symbols are correct. Patch supplied by Saleem/Dallas team. Reviewed-By: Thiago Reviewed-By: jbache --- src/3rdparty/phonon/phonon/phonon_export.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/phonon/phonon_export.h b/src/3rdparty/phonon/phonon/phonon_export.h index e579f67..5f93ea0 100644 --- a/src/3rdparty/phonon/phonon/phonon_export.h +++ b/src/3rdparty/phonon/phonon/phonon_export.h @@ -32,7 +32,11 @@ # define PHONON_EXPORT Q_DECL_IMPORT # endif # else /* UNIX */ -# define PHONON_EXPORT Q_DECL_EXPORT +# ifdef MAKE_PHONON_LIB /* We are building this library */ +# define PHONON_EXPORT Q_DECL_EXPORT +# else /* We are using this library */ +# define PHONON_EXPORT Q_DECL_IMPORT +# endif # endif #endif -- cgit v0.12 From 90b4f0ca7b9fe21f6c4b39a80f8f9cf98626690a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 19 May 2009 17:53:38 +0200 Subject: Revert "Makes the layout of many of the areas be in aligned columns to immensely increase readability" This was pushed accidentially. This reverts commit ffecdf0bf9f25f7ab9aa4f69e37507dd595fecea. --- tools/qdoc3/htmlgenerator.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 7702628..13d52bf 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -2079,7 +2079,17 @@ void HtmlGenerator::generateSectionList(const Section& section, const Node *rela CodeMarker *marker, CodeMarker::SynopsisStyle style) { if (!section.members.isEmpty()) { - out() << "\n"; + bool twoColumn = false; + if (style == CodeMarker::SeparateList) { + twoColumn = (section.members.count() >= 16); + } else if (section.members.first()->type() == Node::Property) { + twoColumn = (section.members.count() >= 5); + } + if (twoColumn) + out() << "

    \n" + << "\n"; + out() << "\n"; i++; ++m; } - out() << "
    "; + out() << "
      \n"; int i = 0; NodeList::ConstIterator m = section.members.begin(); @@ -2089,17 +2099,22 @@ void HtmlGenerator::generateSectionList(const Section& section, const Node *rela continue; } - out() << "
    "; + if (twoColumn && i == (int) (section.members.count() + 1) / 2) + out() << "
      \n"; + + out() << "
    • "; if (style == CodeMarker::Accessors) out() << ""; generateSynopsis(*m, relative, marker, style); if (style == CodeMarker::Accessors) out() << ""; - out() << "
    \n"; + out() << "\n"; + if (twoColumn) + out() << "\n

    \n"; } if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { @@ -2114,7 +2129,7 @@ void HtmlGenerator::generateSectionInheritedList(const Section& section, const N { QList >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { - out() << "
  • "; + out() << "
  • "; out() << (*p).second << " "; if ((*p).second == 1) { out() << section.singularMember; @@ -2410,9 +2425,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*()" static const QString linkTag("link"); for (int i = 0, n = src.size(); i < n;) { - if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { - if (i != 0) - html += " "; + if (src.at(i) == charLangle && src.at(i + 1) == charAt) { i += 2; if (parseArg(src, linkTag, &i, n, &arg, &par1)) { QString link = linkForNode( -- cgit v0.12 From a372fc602a3cb09379875ced99ec969c371917d7 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 19 May 2009 18:05:38 +0200 Subject: Updated WebKit from /home/ariya/dev/webkit/qtwebkit-4.5 to origin/qtwebkit-4.5 ( 7b8d6ab6f2b73862d11c2a41ab0223e55585d88f ) Changes in WebKit since the last update: --- .../webkit/WebCore/generated/CSSPropertyNames.cpp | 5 +- .../webkit/WebCore/generated/CSSValueKeywords.c | 5 +- src/3rdparty/webkit/WebCore/generated/ColorData.c | 5 +- .../webkit/WebCore/generated/DocTypeStrings.cpp | 5 +- .../webkit/WebCore/generated/HTMLEntityNames.c | 5 +- .../webkit/WebCore/generated/tokenizer.cpp | 2315 ++++++-------------- 6 files changed, 695 insertions(+), 1645 deletions(-) diff --git a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp index 25313ac..ca4ea5a 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp +++ b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp @@ -1,4 +1,4 @@ -/* ANSI-C code produced by gperf version 3.0.3 */ +/* ANSI-C code produced by gperf version 3.0.2 */ /* Command-line: gperf -a -L ANSI-C -E -C -c -o -t --key-positions='*' -NfindProp -Hhash_prop -Wwordlist_prop -D -s 2 CSSPropertyNames.gperf */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -217,9 +217,6 @@ hash_prop (register const char *str, register unsigned int len) #ifdef __GNUC__ __inline -#ifdef __GNUC_STDC_INLINE__ -__attribute__ ((__gnu_inline__)) -#endif #endif const struct props * findProp (register const char *str, register unsigned int len) diff --git a/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c b/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c index 5ff0858..d0433e0 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c +++ b/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c @@ -1,4 +1,4 @@ -/* ANSI-C code produced by gperf version 3.0.3 */ +/* ANSI-C code produced by gperf version 3.0.2 */ /* Command-line: gperf -L ANSI-C -E -C -n -o -t --key-positions='*' -NfindValue -Hhash_val -Wwordlist_value -D CSSValueKeywords.gperf */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -179,9 +179,6 @@ hash_val (register const char *str, register unsigned int len) #ifdef __GNUC__ __inline -#ifdef __GNUC_STDC_INLINE__ -__attribute__ ((__gnu_inline__)) -#endif #endif const struct css_value * findValue (register const char *str, register unsigned int len) diff --git a/src/3rdparty/webkit/WebCore/generated/ColorData.c b/src/3rdparty/webkit/WebCore/generated/ColorData.c index 478566c..18d9926 100644 --- a/src/3rdparty/webkit/WebCore/generated/ColorData.c +++ b/src/3rdparty/webkit/WebCore/generated/ColorData.c @@ -1,5 +1,5 @@ #include // bogus -/* ANSI-C code produced by gperf version 3.0.3 */ +/* ANSI-C code produced by gperf version 3.0.2 */ /* Command-line: gperf -CDEot -L ANSI-C --key-positions='*' -N findColor -D -s 2 */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -141,9 +141,6 @@ hash (register const char *str, register unsigned int len) #ifdef __GNUC__ __inline -#ifdef __GNUC_STDC_INLINE__ -__attribute__ ((__gnu_inline__)) -#endif #endif const struct NamedColor * findColor (register const char *str, register unsigned int len) diff --git a/src/3rdparty/webkit/WebCore/generated/DocTypeStrings.cpp b/src/3rdparty/webkit/WebCore/generated/DocTypeStrings.cpp index 686629c..ad63b9e 100644 --- a/src/3rdparty/webkit/WebCore/generated/DocTypeStrings.cpp +++ b/src/3rdparty/webkit/WebCore/generated/DocTypeStrings.cpp @@ -1,5 +1,5 @@ #include // bogus -/* ANSI-C code produced by gperf version 3.0.3 */ +/* ANSI-C code produced by gperf version 3.0.2 */ /* Command-line: gperf -CEot -L ANSI-C --key-positions='*' -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -331,9 +331,6 @@ hash (register const char *str, register unsigned int len) #ifdef __GNUC__ __inline -#ifdef __GNUC_STDC_INLINE__ -__attribute__ ((__gnu_inline__)) -#endif #endif const struct PubIDInfo * findDoctypeEntry (register const char *str, register unsigned int len) diff --git a/src/3rdparty/webkit/WebCore/generated/HTMLEntityNames.c b/src/3rdparty/webkit/WebCore/generated/HTMLEntityNames.c index 993e106..470c4cd 100644 --- a/src/3rdparty/webkit/WebCore/generated/HTMLEntityNames.c +++ b/src/3rdparty/webkit/WebCore/generated/HTMLEntityNames.c @@ -1,4 +1,4 @@ -/* ANSI-C code produced by gperf version 3.0.3 */ +/* ANSI-C code produced by gperf version 3.0.2 */ /* Command-line: gperf -a -L ANSI-C -C -G -c -o -t --key-positions='*' -N findEntity -D -s 2 */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -520,9 +520,6 @@ static const short lookup[] = #ifdef __GNUC__ __inline -#ifdef __GNUC_STDC_INLINE__ -__attribute__ ((__gnu_inline__)) -#endif #endif const struct Entity * findEntity (register const char *str, register unsigned int len) diff --git a/src/3rdparty/webkit/WebCore/generated/tokenizer.cpp b/src/3rdparty/webkit/WebCore/generated/tokenizer.cpp index 8462f51..1da1a0b 100644 --- a/src/3rdparty/webkit/WebCore/generated/tokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/generated/tokenizer.cpp @@ -78,42 +78,42 @@ static yyconst flex_int16_t yy_accept[479] = { 0, 0, 0, 0, 0, 0, 0, 69, 67, 2, 2, 67, 67, 67, 67, 67, 67, 67, 67, 67, 56, - 67, 67, 15, 15, 15, 67, 67, 67, 67, 66, + 67, 67, 67, 67, 15, 15, 15, 67, 67, 66, 15, 15, 15, 65, 15, 2, 0, 0, 0, 14, - 0, 0, 0, 18, 18, 0, 8, 0, 0, 9, - 0, 0, 15, 15, 15, 0, 57, 0, 55, 0, - 0, 56, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 16, 54, 54, 51, 54, 0, 54, 0, 0, - 35, 35, 35, 35, 35, 35, 35, 0, 62, 15, - 0, 0, 15, 15, 0, 15, 15, 15, 7, 6, + 0, 0, 0, 0, 18, 18, 8, 0, 0, 9, + 0, 0, 0, 15, 15, 15, 57, 0, 55, 0, + 0, 56, 0, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 16, 54, 54, 51, 54, 0, 0, + 0, 35, 35, 35, 35, 35, 35, 35, 15, 15, + 7, 62, 15, 0, 0, 15, 15, 0, 15, 6, 5, 15, 15, 15, 15, 0, 0, 0, 14, 0, - 0, 0, 18, 18, 0, 18, 18, 0, 0, 14, - 0, 0, 4, 16, 15, 0, 0, 54, 0, 41, - 54, 37, 39, 54, 52, 43, 54, 42, 50, 54, - 45, 44, 40, 54, 54, 54, 54, 54, 0, 35, - 35, 0, 35, 35, 35, 35, 35, 35, 35, 35, - 15, 15, 16, 15, 15, 63, 63, 15, 15, 12, - 10, 15, 13, 0, 0, 0, 17, 17, 18, 18, - 18, 0, 0, 15, 0, 1, 54, 54, 46, 54, - 53, 16, 47, 54, 54, 54, 3, 35, 35, 35, - - 35, 35, 35, 35, 35, 35, 35, 15, 58, 0, - 63, 63, 63, 62, 15, 11, 0, 0, 0, 18, - 18, 18, 0, 15, 0, 0, 54, 48, 49, 54, - 54, 35, 35, 35, 35, 35, 35, 35, 20, 35, - 15, 64, 63, 63, 63, 63, 0, 0, 0, 0, - 60, 0, 15, 0, 0, 0, 18, 18, 18, 0, - 15, 54, 54, 38, 35, 35, 35, 35, 35, 21, - 35, 35, 15, 64, 63, 63, 63, 63, 63, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, - 0, 15, 0, 0, 17, 17, 18, 18, 0, 15, - - 54, 54, 35, 35, 35, 35, 19, 35, 35, 15, - 64, 63, 63, 63, 63, 63, 63, 0, 59, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 15, 0, 0, 18, 18, 0, 15, 54, 54, 35, - 35, 23, 35, 35, 35, 15, 64, 63, 63, 63, + 0, 0, 18, 18, 18, 0, 18, 0, 0, 14, + 0, 0, 4, 16, 15, 0, 0, 54, 54, 54, + 0, 54, 41, 54, 37, 39, 54, 52, 43, 54, + 42, 50, 54, 45, 44, 40, 54, 54, 0, 35, + 35, 35, 35, 0, 35, 35, 35, 35, 35, 35, + 15, 15, 15, 16, 15, 15, 63, 63, 15, 12, + 10, 15, 13, 0, 0, 0, 17, 18, 18, 18, + 17, 0, 0, 15, 0, 1, 54, 54, 54, 54, + 46, 54, 53, 16, 47, 54, 3, 35, 35, 35, + + 35, 35, 35, 35, 35, 35, 35, 15, 15, 58, + 0, 63, 63, 63, 62, 11, 0, 0, 0, 18, + 18, 18, 0, 15, 0, 0, 54, 54, 54, 48, + 49, 35, 35, 35, 35, 35, 35, 35, 35, 20, + 15, 15, 64, 63, 63, 63, 63, 0, 0, 0, + 0, 60, 0, 0, 0, 0, 18, 18, 18, 0, + 15, 54, 54, 38, 35, 35, 35, 35, 35, 35, + 21, 35, 15, 15, 64, 63, 63, 63, 63, 63, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, + 0, 0, 0, 0, 17, 18, 18, 17, 0, 15, + + 54, 54, 35, 35, 35, 35, 35, 19, 35, 15, + 15, 64, 63, 63, 63, 63, 63, 63, 0, 59, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 18, 18, 0, 15, 54, 54, 35, + 35, 35, 23, 35, 35, 15, 64, 63, 63, 63, 63, 63, 63, 63, 0, 59, 0, 0, 0, 59, 0, 0, 0, 0, 18, 15, 54, 35, 35, 35, 35, 64, 0, 0, 0, 36, 15, 35, 35, 35, @@ -122,7 +122,7 @@ static yyconst flex_int16_t yy_accept[479] = 35, 35, 35, 35, 35, 35, 35, 35, 0, 0, 0, 0, 0, 0, 35, 35, 35, 35, 25, 35, - 35, 35, 0, 61, 0, 0, 0, 0, 26, 35, + 35, 35, 0, 0, 0, 61, 0, 0, 26, 35, 35, 35, 35, 27, 35, 0, 0, 0, 0, 31, 35, 35, 35, 35, 0, 0, 0, 35, 35, 35, 35, 0, 0, 35, 35, 29, 35, 0, 0, 35, @@ -138,909 +138,437 @@ static yyconst flex_int32_t yy_ec[256] = 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 12, 18, 19, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 12, 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, - 12, 54, 12, 55, 56, 12, 57, 58, 59, 60, - - 61, 62, 63, 64, 65, 37, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 12, 84, 1, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85 + 24, 25, 26, 27, 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, + 12, 28, 12, 29, 30, 12, 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, 12, 59, 1, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60 } ; -static yyconst flex_int32_t yy_meta[86] = +static yyconst flex_int32_t yy_meta[61] = { 0, - 1, 2, 3, 4, 4, 5, 6, 7, 6, 6, - 6, 6, 7, 8, 9, 6, 6, 10, 6, 6, - 11, 6, 6, 6, 6, 12, 6, 13, 13, 13, - 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 6, 14, 13, 13, 13, 13, - 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 6, 6, 6, 14 + 1, 2, 3, 3, 3, 4, 5, 5, 5, 5, + 5, 5, 5, 6, 7, 5, 5, 8, 5, 5, + 9, 5, 5, 5, 5, 10, 5, 11, 5, 11, + 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 5, 5, 5, 11 } ; -static yyconst flex_int16_t yy_base[550] = +static yyconst flex_int16_t yy_base[517] = { 0, - 0, 0, 64, 66, 54, 56, 1407, 6578, 93, 98, - 107, 83, 155, 1376, 77, 1350, 99, 1345, 1328, 207, - 1334, 275, 100, 108, 125, 326, 1315, 1313, 1312, 6578, - 141, 110, 151, 6578, 105, 197, 295, 89, 107, 6578, - 387, 120, 0, 429, 1281, 471, 6578, 117, 532, 6578, - 1283, 269, 137, 176, 281, 574, 283, 1289, 1292, 1246, - 1257, 0, 1221, 249, 135, 282, 276, 153, 91, 169, - 299, 308, 318, 266, 1219, 320, 616, 102, 1246, 348, - 1209, 316, 127, 359, 346, 347, 375, 658, 6578, 208, - 700, 1241, 400, 409, 1220, 397, 327, 761, 6578, 6578, - - 6578, 411, 419, 414, 424, 248, 368, 355, 356, 822, - 883, 0, 1191, 925, 967, 1190, 1028, 381, 421, 464, - 1089, 1150, 6578, 214, 456, 1225, 312, 1151, 1192, 1142, - 442, 1139, 1134, 452, 1131, 1104, 458, 1082, 1060, 358, - 1046, 1028, 1027, 462, 453, 1000, 1253, 469, 1023, 463, - 986, 1295, 492, 486, 500, 484, 502, 513, 969, 1356, - 425, 1417, 1001, 545, 494, 193, 993, 543, 1459, 544, - 554, 558, 555, 508, 398, 1520, 0, 1562, 956, 1623, - 1684, 570, 1745, 563, 993, 6578, 948, 1806, 935, 520, - 921, 498, 914, 546, 1848, 564, 6578, 585, 913, 1909, - - 568, 576, 586, 606, 631, 640, 1951, 2012, 6578, 0, - 203, 924, 907, 694, 2054, 565, 543, 2115, 0, 2157, - 2218, 2279, 2340, 669, 912, 505, 2401, 856, 840, 2443, - 612, 615, 2504, 608, 557, 639, 682, 668, 839, 2546, - 2607, 0, 288, 863, 841, 819, 741, 794, 573, 418, - 6578, 2668, 2710, 620, 2771, 0, 2813, 2874, 2935, 2996, - 3057, 3131, 3173, 3234, 670, 3295, 718, 719, 729, 763, - 684, 3337, 3398, 0, 456, 782, 777, 760, 742, 829, - 649, 834, 3459, 572, 3520, 854, 894, 915, 920, 3581, - 3642, 3684, 593, 3745, 6578, 697, 3806, 3867, 3928, 3989, - - 4050, 4111, 730, 4172, 731, 683, 672, 759, 4214, 4275, - 0, 762, 682, 429, 417, 414, 411, 859, 6578, 650, - 838, 957, 4336, 4397, 607, 926, 988, 4458, 4519, 4580, - 1002, 672, 1010, 4622, 4664, 1042, 752, 4706, 4767, 756, - 4828, 376, 812, 847, 1069, 1033, 0, 387, 6578, 6578, - 6578, 6578, 6578, 6578, 1122, 924, 963, 4870, 1162, 1049, - 1050, 4912, 4973, 678, 1063, 850, 1074, 5005, 1103, 841, - 989, 0, 5062, 5104, 5146, 6578, 1066, 1080, 1081, 1084, - 1108, 1137, 877, 328, 273, 6578, 5188, 5230, 5272, 641, - 1140, 884, 916, 836, 1105, 1161, 5314, 5356, 1233, 1286, - - 1147, 1138, 919, 1206, 1165, 1186, 1141, 1207, 1291, 1263, - 1316, 1345, 1327, 5398, 1086, 1029, 1225, 1133, 258, 1247, - 1248, 1310, 1388, 6578, 1427, 5440, 1449, 5501, 242, 1311, - 1341, 1324, 1326, 173, 1317, 1454, 5562, 1480, 5604, 170, - 1061, 1328, 1355, 1372, 1552, 5646, 5688, 1351, 1374, 1389, - 1409, 5730, 5772, 1419, 1456, 154, 1453, 5814, 5856, 1457, - 112, 897, 793, 5898, 1557, 1418, 109, 1348, 1582, 1550, - 1477, 1481, 1485, 90, 1564, 1458, 39, 6578, 5959, 5964, - 5977, 5982, 5987, 5994, 6004, 6017, 296, 6022, 6032, 6045, - 6059, 651, 6064, 6074, 6079, 6089, 6099, 6103, 571, 6112, - - 6125, 6138, 6152, 6166, 6176, 6186, 6191, 6203, 657, 6217, - 758, 6222, 6234, 6247, 801, 6261, 859, 6266, 6278, 6291, - 6304, 6317, 6330, 1086, 6335, 6348, 1120, 6353, 6365, 6378, - 6391, 6404, 6417, 6430, 6435, 6448, 1216, 6453, 6465, 6478, - 6491, 6504, 6517, 1219, 1220, 6530, 6543, 6553, 6563 + 0, 0, 39, 41, 1573, 1566, 1594, 2399, 62, 71, + 76, 61, 69, 1560, 78, 1559, 89, 1561, 1565, 132, + 1573, 91, 123, 1555, 80, 104, 97, 1554, 1551, 2399, + 85, 176, 175, 2399, 177, 193, 204, 1531, 84, 2399, + 242, 110, 180, 196, 1545, 205, 2399, 113, 277, 2399, + 1547, 72, 221, 133, 206, 234, 181, 1555, 1548, 1530, + 1528, 0, 268, 118, 1515, 221, 60, 240, 92, 230, + 95, 223, 244, 267, 238, 286, 1512, 268, 1521, 279, + 294, 1510, 278, 190, 290, 232, 292, 293, 308, 335, + 2399, 2399, 317, 326, 1516, 351, 336, 356, 366, 2399, + + 2399, 320, 367, 369, 370, 1478, 393, 327, 345, 420, + 455, 398, 1495, 490, 1481, 446, 481, 372, 365, 386, + 525, 560, 2399, 325, 388, 1491, 387, 1477, 595, 1476, + 516, 399, 1475, 34, 1472, 1461, 378, 1438, 1430, 318, + 1429, 1426, 323, 1424, 1423, 1422, 231, 387, 1430, 377, + 1411, 630, 1396, 551, 382, 108, 415, 408, 419, 412, + 586, 436, 665, 1400, 624, 456, 419, 1382, 457, 490, + 491, 625, 492, 1362, 526, 656, 672, 681, 1378, 716, + 707, 527, 723, 561, 1374, 2399, 732, 1346, 767, 437, + 1322, 410, 1312, 445, 1311, 546, 2399, 469, 758, 1303, + + 802, 576, 482, 580, 470, 440, 472, 793, 809, 2399, + 818, 515, 1288, 1273, 853, 552, 1205, 839, 855, 861, + 877, 883, 899, 645, 1227, 483, 905, 921, 612, 1183, + 1168, 609, 927, 943, 626, 517, 628, 508, 629, 1167, + 949, 965, 971, 550, 1167, 1157, 1123, 1006, 1020, 666, + 682, 2399, 1047, 1091, 1006, 1038, 1055, 1063, 1071, 1079, + 632, 1087, 1095, 1105, 539, 1103, 1111, 542, 543, 681, + 1097, 683, 1119, 1127, 1135, 585, 1091, 1083, 1067, 1039, + 721, 752, 772, 1170, 717, 1205, 1184, 1217, 1244, 1258, + 1285, 1320, 984, 1244, 2399, 1276, 1311, 917, 1328, 767, + + 1336, 1344, 733, 1352, 1360, 734, 578, 899, 582, 1395, + 1381, 1397, 623, 853, 822, 794, 793, 760, 807, 2399, + 875, 788, 1432, 1459, 1494, 818, 769, 1440, 1529, 1564, + 1438, 702, 1485, 919, 1520, 1555, 849, 963, 1572, 587, + 1299, 1580, 706, 441, 614, 1615, 1601, 715, 2399, 2399, + 2399, 2399, 2399, 2399, 1473, 839, 856, 1617, 1652, 804, + 852, 1638, 1654, 633, 1480, 871, 1508, 1650, 1542, 644, + 834, 1673, 1679, 1695, 1701, 2399, 1015, 872, 915, 916, + 877, 959, 704, 616, 586, 2399, 1717, 1723, 1739, 1002, + 1148, 514, 961, 989, 990, 1016, 1745, 1761, 1767, 1802, + + 1137, 1008, 1018, 1017, 985, 1129, 878, 1038, 1790, 1806, + 1829, 1211, 1827, 1849, 944, 1057, 1152, 787, 584, 615, + 1196, 918, 1863, 1890, 1279, 2399, 1869, 1867, 516, 1199, + 1154, 943, 1242, 515, 653, 1904, 1906, 1941, 1968, 480, + 945, 1200, 1149, 1214, 1927, 1949, 1947, 1239, 1301, 1207, + 1302, 1974, 1990, 1392, 1267, 411, 1354, 1996, 2012, 1310, + 376, 1241, 1039, 2018, 2034, 1338, 348, 1377, 2040, 1216, + 1391, 1421, 1394, 324, 1226, 1376, 263, 2399, 2075, 2080, + 2091, 2096, 2101, 2110, 2117, 2128, 2137, 2142, 2153, 2165, + 2167, 2176, 2181, 2190, 2195, 2204, 2213, 2225, 2234, 2243, + + 2248, 2260, 2265, 2276, 2281, 2292, 2303, 2314, 2319, 2330, + 2341, 2346, 2357, 2366, 2377, 2386 } ; -static yyconst flex_int16_t yy_def[550] = +static yyconst flex_int16_t yy_def[517] = { 0, 478, 1, 1, 1, 1, 1, 478, 478, 478, 478, 478, 479, 480, 478, 481, 478, 482, 478, 478, 478, - 478, 483, 484, 484, 484, 485, 478, 478, 478, 478, - 484, 484, 484, 478, 484, 478, 478, 478, 479, 478, - 486, 480, 487, 488, 488, 489, 478, 481, 490, 478, - 478, 478, 484, 484, 484, 485, 20, 491, 478, 492, - 478, 20, 493, 493, 493, 493, 493, 493, 493, 493, - 493, 493, 493, 493, 493, 493, 494, 493, 478, 483, - 495, 495, 495, 495, 495, 495, 495, 496, 478, 484, - 497, 478, 484, 484, 498, 484, 484, 484, 478, 478, - - 478, 484, 484, 484, 484, 478, 479, 479, 479, 479, - 486, 499, 488, 488, 500, 488, 114, 501, 501, 501, - 501, 502, 478, 478, 484, 503, 504, 493, 505, 493, - 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, + 478, 483, 484, 478, 485, 485, 485, 478, 478, 478, + 485, 485, 485, 478, 485, 478, 478, 478, 479, 478, + 486, 480, 478, 487, 488, 488, 478, 481, 489, 478, + 478, 478, 484, 485, 485, 485, 20, 490, 478, 491, + 478, 20, 492, 493, 493, 493, 493, 493, 493, 493, + 493, 493, 493, 493, 493, 493, 493, 493, 478, 483, + 494, 495, 495, 495, 495, 495, 495, 495, 485, 485, + 478, 478, 485, 496, 478, 485, 485, 478, 485, 478, + + 478, 485, 485, 485, 485, 478, 479, 479, 479, 479, + 486, 478, 488, 46, 488, 497, 46, 481, 481, 481, + 481, 489, 478, 478, 485, 490, 498, 493, 493, 493, + 499, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 478, 495, - 495, 506, 495, 495, 495, 495, 495, 495, 495, 495, - 484, 98, 478, 484, 484, 507, 478, 484, 98, 484, - 484, 484, 484, 478, 508, 508, 509, 114, 488, 114, - 114, 501, 501, 484, 510, 478, 493, 147, 493, 493, - 493, 493, 493, 493, 147, 493, 478, 495, 495, 160, - - 495, 495, 495, 495, 495, 495, 160, 98, 478, 511, - 512, 478, 478, 513, 98, 484, 478, 514, 515, 114, - 114, 114, 501, 484, 510, 516, 147, 493, 493, 147, - 493, 495, 160, 495, 495, 495, 495, 495, 495, 160, - 98, 517, 518, 478, 478, 478, 519, 519, 520, 521, - 478, 522, 98, 478, 523, 524, 525, 525, 258, 526, - 98, 147, 147, 147, 495, 160, 495, 495, 495, 495, - 495, 160, 98, 527, 528, 478, 478, 478, 478, 478, - 520, 478, 529, 530, 531, 532, 532, 532, 532, 532, - 533, 98, 478, 534, 478, 535, 535, 297, 536, 98, - - 147, 301, 495, 160, 495, 495, 495, 495, 160, 98, - 537, 538, 478, 478, 478, 478, 478, 478, 478, 539, - 539, 539, 539, 540, 541, 541, 541, 541, 542, 543, - 300, 478, 534, 297, 298, 536, 300, 301, 301, 495, - 160, 495, 495, 495, 495, 300, 544, 478, 478, 478, - 478, 478, 478, 478, 539, 539, 539, 323, 541, 541, - 541, 328, 543, 478, 335, 300, 339, 495, 495, 495, - 495, 545, 323, 328, 363, 478, 300, 495, 495, 495, - 495, 495, 495, 495, 495, 478, 323, 328, 363, 300, - 495, 495, 495, 495, 495, 495, 323, 328, 543, 546, - - 495, 495, 495, 495, 495, 495, 495, 495, 539, 541, - 546, 546, 547, 548, 495, 495, 495, 495, 495, 495, - 495, 495, 478, 478, 547, 549, 547, 547, 495, 495, - 495, 495, 495, 495, 495, 547, 428, 547, 428, 495, - 495, 495, 495, 495, 547, 437, 428, 495, 495, 495, - 495, 437, 428, 495, 495, 495, 495, 437, 428, 495, - 495, 495, 495, 437, 547, 495, 495, 495, 547, 495, + 495, 495, 495, 500, 495, 495, 495, 495, 495, 495, + 90, 485, 90, 478, 485, 485, 501, 478, 485, 485, + 485, 485, 485, 478, 479, 110, 478, 114, 488, 114, + 46, 481, 121, 485, 502, 478, 129, 493, 129, 493, + 493, 493, 493, 493, 493, 493, 478, 495, 152, 495, + + 152, 495, 495, 495, 495, 495, 495, 90, 163, 478, + 478, 503, 478, 478, 504, 485, 478, 110, 478, 114, + 180, 46, 121, 485, 502, 498, 129, 189, 493, 493, + 493, 495, 152, 201, 495, 495, 495, 495, 495, 495, + 90, 163, 478, 505, 478, 478, 478, 504, 504, 506, + 507, 478, 508, 478, 110, 478, 114, 180, 46, 121, + 485, 129, 189, 493, 495, 152, 201, 495, 495, 495, + 495, 495, 90, 163, 478, 509, 478, 478, 478, 478, + 478, 506, 478, 510, 507, 511, 504, 504, 504, 504, + 504, 508, 478, 110, 478, 114, 180, 488, 121, 485, + + 129, 189, 495, 152, 201, 495, 495, 495, 495, 485, + 163, 478, 512, 478, 478, 478, 478, 478, 478, 478, + 506, 506, 506, 506, 510, 507, 507, 507, 507, 511, + 291, 478, 110, 488, 180, 121, 485, 493, 189, 495, + 495, 201, 495, 495, 495, 485, 478, 478, 478, 478, + 478, 478, 478, 478, 506, 506, 506, 324, 507, 507, + 507, 329, 291, 478, 488, 485, 493, 495, 495, 495, + 495, 478, 324, 329, 291, 478, 485, 495, 495, 495, + 495, 495, 495, 495, 495, 478, 324, 329, 291, 485, + 495, 495, 495, 495, 495, 495, 324, 329, 291, 513, + + 495, 495, 495, 495, 495, 495, 495, 495, 324, 329, + 513, 411, 514, 515, 495, 495, 495, 495, 495, 495, + 495, 495, 515, 515, 478, 478, 515, 516, 495, 495, + 495, 495, 495, 495, 495, 515, 424, 515, 424, 495, + 495, 495, 495, 495, 424, 515, 439, 495, 495, 495, + 495, 424, 439, 495, 495, 495, 495, 424, 439, 495, + 495, 495, 495, 424, 439, 495, 495, 495, 439, 495, 495, 495, 495, 495, 495, 495, 495, 0, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478 + 478, 478, 478, 478, 478, 478 } ; -static yyconst flex_int16_t yy_nxt[6664] = +static yyconst flex_int16_t yy_nxt[2460] = { 0, 8, 9, 10, 9, 9, 9, 11, 12, 13, 14, 8, 8, 15, 8, 8, 16, 8, 17, 18, 19, - 20, 8, 21, 8, 8, 8, 22, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 24, 23, 23, 23, 23, 23, 23, 25, 23, 23, - 23, 23, 23, 26, 27, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 24, 23, - 23, 23, 23, 23, 23, 25, 23, 23, 23, 23, - 23, 8, 28, 29, 23, 30, 35, 30, 35, 40, - 40, 31, 152, 31, 36, 36, 36, 36, 36, 36, - - 36, 36, 36, 36, 32, 33, 32, 33, 37, 37, - 37, 37, 37, 89, 40, 35, 51, 35, 89, 52, - 31, 89, 31, 89, 92, 93, 92, 93, 106, 40, - 49, 136, 32, 33, 32, 33, 41, 478, 89, 54, - 478, 95, 38, 152, 129, 34, 105, 34, 55, 94, - 89, 103, 56, 91, 89, 129, 106, 148, 91, 136, - 41, 91, 152, 91, 89, 152, 131, 54, 154, 96, - 49, 38, 42, 46, 105, 43, 55, 94, 91, 103, - 152, 102, 44, 44, 44, 44, 44, 44, 129, 89, - 91, 104, 92, 93, 91, 131, 154, 96, 36, 36, - - 36, 36, 36, 137, 91, 135, 129, 152, 46, 102, - 210, 44, 44, 44, 44, 44, 44, 59, 212, 104, - 210, 89, 129, 152, 60, 61, 152, 62, 244, 91, - 92, 92, 137, 135, 63, 63, 64, 65, 66, 63, - 67, 68, 69, 63, 70, 63, 71, 72, 63, 73, - 63, 74, 75, 76, 63, 63, 63, 63, 63, 63, - 77, 91, 78, 63, 63, 64, 65, 66, 63, 67, - 68, 69, 70, 63, 71, 72, 63, 73, 63, 74, - 75, 76, 63, 63, 63, 63, 63, 63, 130, 52, - 174, 63, 80, 144, 89, 152, 37, 37, 37, 37, - - 37, 478, 129, 57, 82, 210, 112, 83, 112, 124, - 84, 152, 125, 276, 85, 86, 130, 87, 174, 129, - 134, 132, 144, 63, 92, 140, 152, 127, 88, 129, - 38, 186, 133, 82, 91, 129, 83, 124, 138, 84, - 89, 125, 85, 86, 139, 87, 98, 141, 134, 132, - 153, 63, 129, 98, 98, 98, 98, 98, 98, 38, - 133, 129, 40, 40, 142, 478, 138, 145, 143, 152, - 39, 129, 139, 129, 157, 40, 141, 156, 192, 153, - 91, 152, 98, 98, 98, 98, 98, 98, 39, 39, - 39, 107, 142, 40, 109, 145, 143, 150, 155, 152, - - 152, 88, 158, 157, 210, 40, 156, 110, 41, 41, - 89, 129, 152, 89, 110, 110, 110, 110, 110, 110, - 164, 41, 89, 478, 89, 150, 155, 89, 152, 152, - 282, 158, 89, 40, 49, 168, 354, 89, 89, 353, - 111, 170, 352, 110, 110, 110, 110, 110, 110, 114, - 91, 41, 172, 91, 351, 165, 114, 114, 114, 114, - 114, 114, 91, 168, 91, 171, 478, 91, 173, 89, - 170, 285, 91, 210, 49, 189, 40, 91, 91, 190, - 172, 313, 115, 165, 184, 114, 114, 114, 114, 114, - 114, 117, 193, 171, 198, 129, 173, 194, 117, 117, - - 117, 117, 117, 117, 189, 129, 129, 209, 190, 91, - 191, 129, 196, 184, 204, 129, 152, 49, 192, 201, - 226, 193, 129, 198, 186, 194, 202, 117, 117, 117, - 117, 117, 117, 48, 48, 48, 118, 152, 191, 152, - 196, 205, 203, 204, 120, 152, 206, 91, 201, 217, - 228, 129, 121, 152, 202, 152, 214, 89, 89, 121, - 121, 121, 121, 121, 121, 164, 152, 209, 89, 205, - 203, 89, 478, 129, 268, 206, 89, 217, 89, 228, - 282, 177, 40, 177, 282, 122, 229, 254, 121, 121, - 121, 121, 121, 121, 98, 231, 91, 91, 91, 129, - - 224, 98, 98, 98, 98, 98, 98, 91, 91, 216, - 152, 91, 234, 232, 229, 254, 91, 129, 91, 282, - 332, 152, 235, 49, 231, 285, 283, 236, 224, 152, - 98, 98, 98, 98, 98, 98, 147, 216, 152, 152, - 234, 237, 232, 147, 147, 147, 147, 147, 147, 332, - 235, 264, 265, 267, 400, 236, 282, 282, 90, 152, - 285, 152, 238, 63, 63, 129, 293, 219, 152, 219, - 237, 239, 147, 147, 147, 147, 147, 147, 160, 264, - 265, 267, 89, 269, 152, 160, 160, 160, 160, 160, - 160, 238, 152, 152, 293, 247, 247, 247, 247, 247, - - 239, 249, 283, 283, 261, 303, 250, 350, 251, 270, - 343, 269, 364, 271, 160, 160, 160, 160, 160, 160, - 162, 152, 91, 152, 376, 152, 308, 162, 162, 162, - 162, 162, 162, 261, 303, 152, 152, 152, 270, 343, - 364, 271, 247, 247, 247, 247, 247, 252, 249, 305, - 115, 306, 376, 250, 308, 251, 162, 162, 162, 162, - 162, 162, 97, 97, 97, 97, 97, 317, 242, 90, - 242, 152, 152, 368, 89, 307, 340, 342, 305, 210, - 306, 169, 152, 152, 152, 316, 344, 349, 169, 169, - 169, 169, 169, 169, 252, 280, 280, 280, 280, 280, - - 366, 478, 315, 307, 340, 342, 478, 314, 251, 152, - 468, 256, 152, 256, 91, 344, 152, 169, 169, 169, - 169, 169, 169, 108, 175, 175, 175, 108, 366, 40, - 280, 280, 280, 280, 280, 318, 318, 318, 318, 318, - 478, 370, 176, 251, 279, 282, 152, 252, 319, 176, - 176, 176, 176, 176, 176, 280, 280, 280, 280, 280, - 318, 318, 318, 318, 318, 152, 278, 90, 251, 274, - 370, 274, 384, 319, 405, 41, 371, 377, 176, 176, - 176, 176, 176, 176, 39, 39, 39, 107, 277, 152, - 109, 283, 152, 129, 152, 280, 280, 280, 280, 280, - - 152, 384, 405, 110, 396, 371, 377, 252, 251, 129, - 110, 110, 110, 110, 110, 110, 280, 280, 280, 280, - 280, 280, 280, 280, 280, 280, 478, 226, 478, 251, - 152, 282, 246, 396, 251, 403, 111, 152, 282, 110, - 110, 110, 110, 110, 110, 178, 404, 252, 467, 245, - 152, 417, 178, 178, 178, 178, 178, 178, 355, 318, - 318, 318, 355, 403, 282, 478, 152, 129, 252, 152, - 282, 356, 152, 252, 129, 404, 467, 283, 115, 285, - 417, 178, 178, 178, 178, 178, 178, 180, 129, 359, - 318, 318, 318, 359, 180, 180, 180, 180, 180, 180, - - 282, 129, 360, 97, 97, 97, 97, 97, 226, 115, - 283, 108, 175, 175, 175, 108, 283, 40, 213, 90, - 385, 163, 152, 180, 180, 180, 180, 180, 180, 116, - 116, 116, 116, 116, 161, 161, 161, 161, 161, 152, - 197, 285, 152, 119, 182, 182, 182, 119, 181, 385, - 90, 478, 478, 129, 40, 181, 181, 181, 181, 181, - 181, 282, 282, 41, 179, 179, 179, 179, 179, 430, - 159, 159, 159, 159, 159, 187, 187, 187, 187, 187, - 129, 129, 152, 90, 181, 181, 181, 181, 181, 181, - 119, 182, 182, 182, 119, 49, 295, 430, 295, 129, - - 448, 40, 285, 285, 199, 199, 199, 199, 199, 183, - 390, 391, 392, 129, 152, 393, 183, 183, 183, 183, - 183, 183, 152, 355, 318, 318, 318, 355, 448, 282, - 311, 429, 311, 152, 152, 129, 356, 152, 390, 152, - 391, 392, 49, 406, 393, 183, 183, 183, 183, 183, - 183, 48, 48, 48, 118, 394, 152, 129, 152, 429, - 432, 152, 120, 359, 318, 318, 318, 359, 395, 401, - 121, 406, 402, 416, 282, 283, 360, 121, 121, 121, - 121, 121, 121, 394, 129, 415, 152, 129, 421, 432, - 152, 152, 129, 152, 152, 129, 419, 395, 401, 407, - - 152, 402, 416, 122, 129, 408, 121, 121, 121, 121, - 121, 121, 188, 415, 152, 285, 421, 420, 152, 188, - 188, 188, 188, 188, 188, 419, 347, 407, 347, 372, - 386, 372, 386, 408, 286, 286, 286, 286, 286, 152, - 127, 418, 422, 115, 115, 167, 420, 251, 188, 188, - 188, 188, 188, 188, 146, 146, 146, 146, 146, 152, - 152, 163, 152, 149, 326, 361, 361, 361, 326, 431, - 418, 422, 129, 195, 129, 282, 433, 57, 152, 434, - 195, 195, 195, 195, 195, 195, 252, 411, 411, 411, - 411, 411, 321, 357, 357, 357, 321, 431, 282, 77, - - 152, 152, 59, 412, 127, 433, 129, 123, 434, 195, - 195, 195, 195, 195, 195, 200, 285, 411, 411, 411, - 411, 411, 200, 200, 200, 200, 200, 200, 423, 423, - 423, 423, 423, 412, 115, 101, 100, 435, 99, 414, - 79, 424, 440, 58, 283, 444, 478, 478, 478, 478, - 478, 200, 200, 200, 200, 200, 200, 159, 159, 159, - 159, 159, 478, 152, 152, 57, 435, 442, 441, 414, - 152, 440, 443, 50, 444, 449, 207, 152, 471, 152, - 426, 152, 454, 207, 207, 207, 207, 207, 207, 423, - 423, 423, 423, 423, 152, 442, 450, 441, 414, 47, - - 443, 152, 424, 449, 152, 455, 478, 471, 152, 152, - 451, 454, 207, 207, 207, 207, 207, 207, 161, 161, - 161, 161, 161, 478, 450, 152, 478, 152, 423, 423, - 423, 423, 423, 456, 455, 478, 460, 208, 451, 478, - 457, 424, 152, 478, 208, 208, 208, 208, 208, 208, - 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, - 478, 456, 152, 424, 461, 470, 478, 478, 424, 457, - 478, 152, 152, 208, 208, 208, 208, 208, 208, 215, - 426, 423, 423, 423, 423, 423, 215, 215, 215, 215, - 215, 215, 461, 470, 424, 478, 478, 478, 463, 478, - - 462, 466, 426, 477, 478, 478, 152, 426, 473, 152, - 152, 152, 474, 478, 475, 215, 215, 215, 215, 215, - 215, 108, 175, 175, 175, 108, 463, 40, 462, 466, - 152, 477, 478, 426, 152, 478, 478, 473, 152, 478, - 218, 474, 478, 475, 478, 478, 478, 218, 218, 218, - 218, 218, 218, 423, 423, 423, 423, 423, 438, 438, - 438, 438, 438, 478, 478, 478, 424, 478, 478, 478, - 478, 424, 478, 41, 478, 478, 218, 218, 218, 218, - 218, 218, 220, 445, 445, 445, 445, 445, 472, 220, - 220, 220, 220, 220, 220, 478, 424, 478, 478, 478, - - 478, 478, 476, 152, 478, 426, 478, 478, 478, 478, - 426, 478, 478, 478, 478, 478, 472, 152, 220, 220, - 220, 220, 220, 220, 179, 179, 179, 179, 179, 478, - 476, 478, 478, 478, 478, 426, 478, 478, 478, 478, - 478, 478, 478, 221, 478, 478, 478, 478, 478, 478, - 221, 221, 221, 221, 221, 221, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 221, - 221, 221, 221, 221, 221, 116, 116, 116, 116, 116, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 222, 478, 478, 478, 478, 478, - 478, 222, 222, 222, 222, 222, 222, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 222, 222, 222, 222, 222, 222, 119, 182, 182, 182, - 119, 478, 478, 478, 478, 478, 478, 40, 478, 478, - 478, 478, 478, 478, 478, 223, 478, 478, 478, 478, - 478, 478, 223, 223, 223, 223, 223, 223, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 49, 478, - - 478, 223, 223, 223, 223, 223, 223, 187, 187, 187, - 187, 187, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 227, 478, 478, 478, - 478, 478, 478, 227, 227, 227, 227, 227, 227, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 227, 227, 227, 227, 227, 227, 230, 478, - 478, 478, 478, 478, 478, 230, 230, 230, 230, 230, - 230, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 230, 230, 230, 230, 230, 230, - 199, 199, 199, 199, 199, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 233, - 478, 478, 478, 478, 478, 478, 233, 233, 233, 233, - 233, 233, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 233, 233, 233, 233, 233, - 233, 240, 478, 478, 478, 478, 478, 478, 240, 240, - 240, 240, 240, 240, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 478, 240, 240, 240, - 240, 240, 240, 161, 161, 161, 161, 161, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 241, 478, 478, 478, 478, 478, 478, 241, - 241, 241, 241, 241, 241, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 241, 241, - 241, 241, 241, 241, 253, 478, 478, 478, 478, 478, - 478, 253, 253, 253, 253, 253, 253, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 253, 253, 253, 253, 253, 253, 108, 175, 175, 175, - 108, 478, 40, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 255, 478, 478, 478, 478, - 478, 478, 255, 255, 255, 255, 255, 255, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 41, 478, - 478, 255, 255, 255, 255, 255, 255, 257, 478, 478, - 478, 478, 478, 478, 257, 257, 257, 257, 257, 257, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 257, 257, 257, 257, 257, 257, 179, - 179, 179, 179, 179, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 258, 478, - 478, 478, 478, 478, 478, 258, 258, 258, 258, 258, - 258, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 258, 258, 258, 258, 258, 258, - 116, 116, 116, 116, 116, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 259, - - 478, 478, 478, 478, 478, 478, 259, 259, 259, 259, - 259, 259, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 259, 259, 259, 259, 259, - 259, 119, 182, 182, 182, 119, 478, 478, 478, 478, - 478, 478, 40, 478, 478, 478, 478, 478, 478, 478, - 260, 478, 478, 478, 478, 478, 478, 260, 260, 260, - 260, 260, 260, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 49, 478, 478, 260, 260, 260, 260, - - 260, 260, 187, 187, 187, 187, 187, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 262, 478, 478, 478, 478, 478, 478, 262, 262, - 262, 262, 262, 262, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 262, 262, 262, - 262, 262, 262, 263, 478, 478, 478, 478, 478, 478, - 263, 263, 263, 263, 263, 263, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 263, - - 263, 263, 263, 263, 263, 199, 199, 199, 199, 199, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 266, 478, 478, 478, 478, 478, - 478, 266, 266, 266, 266, 266, 266, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 266, 266, 266, 266, 266, 266, 272, 478, 478, 478, - 478, 478, 478, 272, 272, 272, 272, 272, 272, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 272, 272, 272, 272, 272, 272, 161, 161, - 161, 161, 161, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 273, 478, 478, - 478, 478, 478, 478, 273, 273, 273, 273, 273, 273, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 273, 273, 273, 273, 273, 273, 280, - 280, 280, 280, 286, 478, 288, 478, 478, 478, 478, - 288, 288, 289, 478, 478, 478, 478, 478, 290, 478, - 478, 478, 478, 478, 478, 290, 290, 290, 290, 290, - - 290, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 291, 478, 478, 290, 290, 290, 290, 290, 290, - 292, 478, 478, 478, 478, 478, 478, 292, 292, 292, - 292, 292, 292, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 292, 292, 292, 292, - 292, 292, 108, 175, 175, 175, 108, 478, 40, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 294, 478, 478, 478, 478, 478, 478, 294, 294, - - 294, 294, 294, 294, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 41, 478, 478, 294, 294, 294, - 294, 294, 294, 296, 478, 478, 478, 478, 478, 478, - 296, 296, 296, 296, 296, 296, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 115, 478, 478, 296, - 296, 296, 296, 296, 296, 179, 179, 179, 179, 179, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 297, 478, 478, 478, 478, 478, - - 478, 297, 297, 297, 297, 297, 297, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 115, 478, 478, - 297, 297, 297, 297, 297, 297, 116, 116, 116, 116, - 116, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 298, 478, 478, 478, 478, - 478, 478, 298, 298, 298, 298, 298, 298, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 298, 298, 298, 298, 298, 298, 119, 182, 182, - - 182, 119, 478, 478, 478, 478, 478, 478, 40, 478, - 478, 478, 478, 478, 478, 478, 299, 478, 478, 478, - 478, 478, 478, 299, 299, 299, 299, 299, 299, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 49, - 478, 478, 299, 299, 299, 299, 299, 299, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 90, 478, 478, - 478, 478, 478, 478, 90, 90, 90, 90, 90, 90, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 300, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 90, 90, 90, 90, 90, 90, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 300, 187, 187, 187, 187, 187, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 301, 478, 478, 478, 478, 478, 478, 301, 301, - 301, 301, 301, 301, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 301, 301, 301, - 301, 301, 301, 302, 478, 478, 478, 478, 478, 478, - - 302, 302, 302, 302, 302, 302, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 302, - 302, 302, 302, 302, 302, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 128, 478, 478, 478, 478, 478, - 478, 128, 128, 128, 128, 128, 128, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 128, 128, 128, 128, 128, 128, 199, 199, 199, 199, - - 199, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 304, 478, 478, 478, 478, - 478, 478, 304, 304, 304, 304, 304, 304, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 304, 304, 304, 304, 304, 304, 309, 478, 478, - 478, 478, 478, 478, 309, 309, 309, 309, 309, 309, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 309, 309, 309, 309, 309, 309, 161, - - 161, 161, 161, 161, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 310, 478, - 478, 478, 478, 478, 478, 310, 310, 310, 310, 310, - 310, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 310, 310, 310, 310, 310, 310, - 281, 281, 281, 320, 478, 478, 322, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 323, - 478, 478, 478, 478, 478, 478, 323, 323, 323, 323, - 323, 323, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 324, 478, 478, 323, 323, 323, 323, 323, - 323, 284, 284, 284, 325, 478, 478, 478, 478, 478, - 478, 478, 327, 478, 478, 478, 478, 478, 478, 478, - 328, 478, 478, 478, 478, 478, 478, 328, 328, 328, - 328, 328, 328, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 329, 478, 478, 328, 328, 328, 328, - 328, 328, 286, 286, 286, 286, 286, 478, 478, 478, - 478, 478, 478, 478, 478, 251, 478, 478, 478, 478, - - 478, 330, 478, 478, 478, 478, 478, 478, 330, 330, - 330, 330, 330, 330, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 252, 478, 478, 330, 330, 330, - 330, 330, 330, 280, 280, 280, 280, 286, 478, 288, - 478, 478, 478, 478, 288, 288, 289, 478, 478, 478, - 478, 478, 290, 478, 478, 478, 478, 478, 478, 290, - 290, 290, 290, 290, 290, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 291, 478, 478, 290, 290, - - 290, 290, 290, 290, 331, 478, 478, 478, 478, 478, - 478, 331, 331, 331, 331, 331, 331, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 331, 331, 331, 331, 331, 331, 108, 175, 175, 175, - 108, 478, 40, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 333, 478, 478, 478, 478, - 478, 478, 333, 333, 333, 333, 333, 333, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 41, 478, - - 478, 333, 333, 333, 333, 333, 333, 179, 179, 179, - 179, 179, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 334, 478, 478, 478, - 478, 478, 478, 334, 334, 334, 334, 334, 334, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 115, - 478, 478, 334, 334, 334, 334, 334, 334, 116, 116, - 116, 116, 116, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 335, 478, 478, - 478, 478, 478, 478, 335, 335, 335, 335, 335, 335, - - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 335, 335, 335, 335, 335, 335, 119, - 182, 182, 182, 119, 478, 478, 478, 478, 478, 478, - 40, 478, 478, 478, 478, 478, 478, 478, 336, 478, - 478, 478, 478, 478, 478, 336, 336, 336, 336, 336, - 336, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 49, 478, 478, 336, 336, 336, 336, 336, 336, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 337, 478, 478, 90, - 478, 478, 478, 478, 478, 478, 90, 90, 90, 90, - 90, 90, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 90, 90, 90, 90, 90, - 90, 187, 187, 187, 187, 187, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 338, 478, 478, 478, 478, 478, 478, 338, 338, 338, - 338, 338, 338, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 338, 338, 338, 338, - 338, 338, 146, 146, 146, 146, 146, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 339, 478, 478, 478, 478, 478, 478, 339, 339, - 339, 339, 339, 339, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 339, 339, 339, - 339, 339, 339, 199, 199, 199, 199, 199, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 341, 478, 478, 478, 478, 478, 478, 341, - - 341, 341, 341, 341, 341, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 341, 341, - 341, 341, 341, 341, 345, 478, 478, 478, 478, 478, - 478, 345, 345, 345, 345, 345, 345, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 345, 345, 345, 345, 345, 345, 161, 161, 161, 161, - 161, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 346, 478, 478, 478, 478, - - 478, 478, 346, 346, 346, 346, 346, 346, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 346, 346, 346, 346, 346, 346, 321, 357, 357, - 357, 321, 478, 282, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 358, 478, 478, 478, - 478, 478, 478, 358, 358, 358, 358, 358, 358, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 283, - 478, 478, 358, 358, 358, 358, 358, 358, 281, 281, - - 281, 320, 478, 478, 322, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 323, 478, 478, - 478, 478, 478, 478, 323, 323, 323, 323, 323, 323, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 324, 478, 478, 323, 323, 323, 323, 323, 323, 326, - 361, 361, 361, 326, 478, 478, 478, 478, 478, 478, - 282, 478, 478, 478, 478, 478, 478, 478, 362, 478, - 478, 478, 478, 478, 478, 362, 362, 362, 362, 362, - 362, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 285, 478, 478, 362, 362, 362, 362, 362, 362, - 284, 284, 284, 325, 478, 478, 478, 478, 478, 478, - 478, 327, 478, 478, 478, 478, 478, 478, 478, 328, - 478, 478, 478, 478, 478, 478, 328, 328, 328, 328, - 328, 328, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 329, 478, 478, 328, 328, 328, 328, 328, - 328, 286, 286, 286, 286, 286, 478, 478, 478, 478, - 478, 478, 478, 478, 251, 478, 478, 478, 478, 478, - - 363, 478, 478, 478, 478, 478, 478, 363, 363, 363, - 363, 363, 363, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 252, 478, 478, 363, 363, 363, 363, - 363, 363, 365, 478, 478, 478, 478, 478, 478, 365, - 365, 365, 365, 365, 365, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 365, 365, - 365, 365, 365, 365, 113, 478, 478, 478, 478, 478, - 478, 113, 113, 113, 113, 113, 113, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 113, 113, 113, 113, 113, 113, 367, 478, 478, 478, - 478, 478, 478, 367, 367, 367, 367, 367, 367, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 367, 367, 367, 367, 367, 367, 146, 146, - 146, 146, 146, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 128, 478, 478, - 478, 478, 478, 478, 128, 128, 128, 128, 128, 128, - - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 128, 128, 128, 128, 128, 128, 199, - 199, 199, 199, 199, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 369, 478, - 478, 478, 478, 478, 478, 369, 369, 369, 369, 369, - 369, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 369, 369, 369, 369, 369, 369, - 373, 478, 478, 478, 478, 478, 478, 373, 373, 373, - - 373, 373, 373, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 373, 373, 373, 373, - 373, 373, 374, 478, 478, 478, 478, 478, 478, 374, - 374, 374, 374, 374, 374, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 374, 374, - 374, 374, 374, 374, 286, 286, 286, 286, 286, 478, - 478, 478, 478, 478, 478, 478, 478, 251, 478, 478, - 478, 478, 478, 375, 478, 478, 478, 478, 478, 478, - - 375, 375, 375, 375, 375, 375, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 252, 478, 478, 375, - 375, 375, 375, 375, 375, 378, 478, 478, 478, 478, - 478, 478, 379, 478, 380, 478, 478, 478, 478, 381, - 382, 478, 478, 383, 478, 478, 478, 478, 152, 478, - 478, 478, 478, 478, 378, 478, 478, 478, 478, 478, - 379, 478, 380, 478, 478, 478, 478, 381, 382, 478, - 478, 383, 387, 478, 478, 478, 478, 478, 478, 387, - 387, 387, 387, 387, 387, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 387, 387, - 387, 387, 387, 387, 388, 478, 478, 478, 478, 478, - 478, 388, 388, 388, 388, 388, 388, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 388, 388, 388, 388, 388, 388, 389, 478, 478, 478, - 478, 478, 478, 389, 389, 389, 389, 389, 389, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 389, 389, 389, 389, 389, 389, 397, 478, - 478, 478, 478, 478, 478, 397, 397, 397, 397, 397, - 397, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 397, 397, 397, 397, 397, 397, - 398, 478, 478, 478, 478, 478, 478, 398, 398, 398, - 398, 398, 398, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 398, 398, 398, 398, - 398, 398, 399, 478, 478, 478, 478, 478, 478, 399, - - 399, 399, 399, 399, 399, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 399, 399, - 399, 399, 399, 399, 409, 478, 478, 478, 478, 478, - 478, 409, 409, 409, 409, 409, 409, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 409, 409, 409, 409, 409, 409, 410, 478, 478, 478, - 478, 478, 478, 410, 410, 410, 410, 410, 410, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 410, 410, 410, 410, 410, 410, 428, 478, - 478, 478, 478, 478, 478, 428, 428, 428, 428, 428, - 428, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 428, 428, 428, 428, 428, 428, - 437, 478, 478, 478, 478, 478, 478, 437, 437, 437, - 437, 437, 437, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 437, 437, 437, 437, - - 437, 437, 438, 438, 438, 438, 438, 478, 478, 478, - 478, 478, 478, 478, 478, 424, 478, 478, 478, 478, - 478, 439, 478, 478, 478, 478, 478, 478, 439, 439, - 439, 439, 439, 439, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 426, 478, 478, 439, 439, 439, - 439, 439, 439, 445, 445, 445, 445, 445, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 446, 478, 478, 478, 478, 478, 478, 446, - 446, 446, 446, 446, 446, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 446, 446, - 446, 446, 446, 446, 447, 478, 478, 478, 478, 478, - 478, 447, 447, 447, 447, 447, 447, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 447, 447, 447, 447, 447, 447, 452, 478, 478, 478, - 478, 478, 478, 452, 452, 452, 452, 452, 452, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 452, 452, 452, 452, 452, 452, 453, 478, - 478, 478, 478, 478, 478, 453, 453, 453, 453, 453, - 453, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 453, 453, 453, 453, 453, 453, - 458, 478, 478, 478, 478, 478, 478, 458, 458, 458, - 458, 458, 458, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 458, 458, 458, 458, - 458, 458, 459, 478, 478, 478, 478, 478, 478, 459, - - 459, 459, 459, 459, 459, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 459, 459, - 459, 459, 459, 459, 464, 478, 478, 478, 478, 478, - 478, 464, 464, 464, 464, 464, 464, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 464, 464, 464, 464, 464, 464, 465, 478, 478, 478, - 478, 478, 478, 465, 465, 465, 465, 465, 465, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 465, 465, 465, 465, 465, 465, 469, 478, - 478, 478, 478, 478, 478, 469, 469, 469, 469, 469, - 469, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 469, 469, 469, 469, 469, 469, - 39, 478, 478, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 45, 45, 478, 45, 45, 48, 478, - 478, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 53, 53, 478, 53, 53, 81, 478, 478, 81, - - 81, 90, 478, 90, 90, 478, 90, 90, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 108, 108, + 20, 8, 21, 8, 8, 8, 22, 23, 24, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 26, 25, 25, 25, 25, 25, 25, + 27, 25, 25, 25, 25, 25, 8, 28, 29, 25, + 30, 131, 30, 36, 36, 36, 36, 36, 40, 31, + 191, 31, 36, 36, 36, 36, 36, 37, 37, 37, + 37, 37, 32, 33, 32, 33, 42, 131, 41, 43, + 40, 40, 52, 92, 134, 34, 44, 34, 92, 46, + + 46, 46, 46, 46, 46, 49, 51, 94, 80, 52, + 92, 41, 94, 98, 38, 124, 53, 92, 81, 131, + 95, 96, 131, 83, 94, 40, 84, 478, 102, 85, + 478, 94, 55, 86, 87, 154, 88, 44, 139, 137, + 49, 56, 59, 90, 99, 131, 92, 132, 97, 60, + 61, 203, 62, 90, 90, 90, 90, 90, 90, 63, + 94, 64, 65, 65, 66, 67, 68, 65, 69, 70, + 71, 65, 72, 65, 73, 74, 65, 75, 65, 76, + 77, 78, 65, 65, 65, 65, 65, 65, 92, 92, + 92, 65, 95, 96, 36, 36, 36, 36, 36, 478, + + 112, 57, 94, 94, 94, 37, 37, 37, 37, 37, + 112, 112, 112, 112, 112, 112, 114, 154, 104, 92, + 103, 105, 95, 96, 65, 117, 114, 114, 114, 114, + 114, 114, 116, 94, 156, 117, 117, 117, 117, 117, + 117, 90, 38, 39, 39, 39, 107, 92, 131, 109, + 131, 90, 90, 90, 90, 90, 90, 131, 131, 154, + 140, 94, 110, 133, 195, 131, 158, 131, 125, 111, + 144, 131, 110, 110, 110, 110, 110, 110, 48, 48, + 48, 118, 135, 95, 143, 138, 141, 145, 129, 120, + 154, 146, 142, 136, 131, 131, 478, 121, 129, 129, + + 129, 129, 129, 129, 122, 154, 81, 121, 121, 121, + 121, 121, 121, 131, 152, 155, 147, 154, 148, 154, + 154, 92, 159, 160, 152, 152, 152, 152, 152, 152, + 92, 150, 157, 92, 40, 94, 89, 89, 89, 89, + 89, 95, 95, 194, 94, 131, 163, 94, 92, 92, + 131, 154, 40, 170, 41, 161, 163, 163, 163, 163, + 163, 163, 94, 94, 92, 161, 161, 161, 161, 161, + 161, 165, 41, 193, 48, 154, 167, 40, 94, 92, + 92, 168, 92, 92, 40, 166, 167, 167, 167, 167, + 167, 167, 49, 94, 94, 39, 94, 94, 40, 49, + + 40, 92, 127, 154, 154, 131, 186, 169, 192, 154, + 172, 198, 202, 49, 131, 94, 171, 173, 177, 184, + 41, 108, 175, 175, 175, 108, 131, 40, 177, 177, + 177, 177, 177, 177, 196, 154, 211, 131, 154, 154, + 176, 205, 154, 230, 213, 190, 154, 41, 207, 92, + 176, 176, 176, 176, 176, 176, 39, 39, 39, 107, + 204, 206, 109, 94, 131, 194, 180, 154, 154, 210, + 215, 229, 131, 370, 239, 110, 180, 180, 180, 180, + 180, 180, 111, 94, 94, 110, 110, 110, 110, 110, + 110, 113, 113, 113, 113, 113, 154, 154, 226, 154, + + 232, 181, 186, 92, 210, 92, 240, 154, 238, 154, + 178, 181, 181, 181, 181, 181, 181, 94, 94, 94, + 178, 178, 178, 178, 178, 178, 119, 182, 182, 182, + 119, 236, 211, 40, 269, 154, 189, 40, 271, 40, + 245, 154, 154, 154, 154, 183, 189, 189, 189, 189, + 189, 189, 49, 41, 49, 183, 183, 183, 183, 183, + 183, 48, 48, 48, 118, 92, 154, 211, 403, 154, + 154, 201, 120, 131, 92, 277, 306, 303, 307, 94, + 121, 201, 201, 201, 201, 201, 201, 122, 94, 231, + 121, 121, 121, 121, 121, 121, 128, 128, 128, 128, + + 128, 224, 211, 154, 368, 154, 208, 154, 344, 154, + 314, 154, 345, 154, 154, 187, 208, 208, 208, 208, + 208, 208, 131, 235, 237, 187, 187, 187, 187, 187, + 187, 151, 151, 151, 151, 151, 154, 92, 92, 131, + 211, 154, 154, 154, 165, 92, 371, 433, 349, 265, + 199, 94, 94, 154, 264, 154, 154, 154, 92, 94, + 199, 199, 199, 199, 199, 199, 162, 162, 162, 162, + 162, 154, 94, 283, 268, 270, 218, 272, 384, 216, + 154, 300, 376, 261, 444, 209, 218, 218, 218, 218, + 218, 218, 219, 284, 283, 209, 209, 209, 209, 209, + + 209, 220, 219, 219, 219, 219, 219, 219, 154, 286, + 154, 220, 220, 220, 220, 220, 220, 179, 179, 179, + 179, 179, 281, 281, 281, 281, 281, 222, 309, 283, + 308, 154, 211, 154, 396, 252, 221, 222, 222, 222, + 222, 222, 222, 223, 286, 364, 221, 221, 221, 221, + 221, 221, 227, 223, 223, 223, 223, 223, 223, 283, + 154, 154, 227, 227, 227, 227, 227, 227, 188, 188, + 188, 188, 188, 319, 319, 319, 319, 319, 233, 284, + 92, 283, 340, 343, 337, 354, 320, 228, 233, 233, + 233, 233, 233, 233, 94, 283, 286, 228, 228, 228, + + 228, 228, 228, 200, 200, 200, 200, 200, 319, 319, + 319, 319, 319, 241, 154, 284, 283, 432, 353, 352, + 285, 320, 234, 241, 241, 241, 241, 241, 241, 242, + 283, 286, 234, 234, 234, 234, 234, 234, 243, 242, + 242, 242, 242, 242, 242, 286, 283, 351, 243, 243, + 243, 243, 243, 243, 248, 248, 248, 248, 248, 255, + 250, 154, 92, 283, 283, 251, 284, 252, 385, 255, + 255, 255, 255, 255, 255, 256, 94, 282, 350, 286, + 253, 257, 283, 284, 92, 256, 256, 256, 256, 256, + 256, 257, 257, 257, 257, 257, 257, 258, 94, 154, + + 366, 377, 284, 259, 154, 154, 391, 258, 258, 258, + 258, 258, 258, 259, 259, 259, 259, 259, 259, 260, + 113, 113, 113, 113, 113, 262, 154, 394, 421, 260, + 260, 260, 260, 260, 260, 262, 262, 262, 262, 262, + 262, 263, 154, 154, 116, 154, 116, 266, 435, 392, + 393, 263, 263, 263, 263, 263, 263, 266, 266, 266, + 266, 266, 266, 267, 128, 128, 128, 128, 128, 273, + 154, 154, 154, 267, 267, 267, 267, 267, 267, 273, + 273, 273, 273, 273, 273, 274, 154, 448, 154, 442, + 131, 275, 429, 395, 404, 274, 274, 274, 274, 274, + + 274, 275, 275, 275, 275, 275, 275, 248, 248, 248, + 248, 248, 154, 250, 332, 400, 154, 154, 251, 419, + 252, 281, 281, 281, 281, 281, 294, 478, 92, 94, + 405, 406, 478, 253, 252, 154, 294, 294, 294, 294, + 294, 294, 94, 154, 154, 154, 416, 253, 281, 281, + 281, 281, 287, 417, 289, 418, 468, 407, 295, 289, + 289, 290, 390, 408, 318, 154, 154, 291, 295, 295, + 295, 295, 295, 295, 292, 296, 422, 291, 291, 291, + 291, 291, 291, 297, 154, 296, 296, 296, 296, 296, + 296, 298, 317, 297, 297, 297, 297, 297, 297, 299, + + 430, 298, 298, 298, 298, 298, 298, 301, 316, 299, + 299, 299, 299, 299, 299, 302, 315, 301, 301, 301, + 301, 301, 301, 304, 154, 302, 302, 302, 302, 302, + 302, 305, 131, 304, 304, 304, 304, 304, 304, 310, + 293, 305, 305, 305, 305, 305, 305, 311, 280, 310, + 310, 310, 310, 310, 310, 312, 154, 311, 311, 311, + 311, 311, 311, 420, 154, 312, 312, 312, 312, 312, + 312, 282, 282, 282, 321, 154, 154, 323, 415, 154, + 401, 154, 279, 402, 441, 281, 281, 281, 281, 281, + 324, 478, 278, 450, 154, 131, 478, 325, 252, 431, + + 324, 324, 324, 324, 324, 324, 285, 285, 285, 326, + 131, 253, 478, 478, 478, 478, 478, 328, 281, 281, + 281, 281, 281, 154, 478, 329, 154, 154, 478, 478, + 434, 252, 330, 440, 154, 329, 329, 329, 329, 329, + 329, 154, 226, 154, 253, 281, 281, 281, 281, 281, + 449, 478, 254, 154, 456, 451, 478, 472, 252, 281, + 281, 281, 281, 281, 333, 478, 154, 476, 154, 154, + 478, 253, 252, 454, 333, 333, 333, 333, 333, 333, + 425, 425, 425, 425, 425, 253, 287, 287, 287, 287, + 287, 443, 478, 426, 154, 467, 334, 478, 247, 252, + + 151, 151, 151, 151, 151, 331, 334, 334, 334, 334, + 334, 334, 253, 246, 462, 331, 331, 331, 331, 331, + 331, 281, 281, 281, 281, 287, 154, 289, 154, 154, + 154, 335, 289, 289, 290, 455, 457, 154, 131, 131, + 291, 335, 335, 335, 335, 335, 335, 292, 336, 131, + 291, 291, 291, 291, 291, 291, 338, 466, 336, 336, + 336, 336, 336, 336, 339, 154, 338, 338, 338, 338, + 338, 338, 341, 131, 339, 339, 339, 339, 339, 339, + 342, 154, 341, 341, 341, 341, 341, 341, 470, 226, + 342, 342, 342, 342, 342, 342, 89, 89, 89, 89, + + 89, 346, 463, 154, 154, 116, 217, 214, 92, 460, + 471, 346, 346, 346, 346, 346, 346, 347, 154, 154, + 164, 154, 94, 154, 477, 473, 475, 347, 347, 347, + 347, 347, 347, 355, 319, 319, 319, 355, 154, 283, + 461, 359, 319, 319, 319, 359, 356, 197, 154, 131, + 131, 131, 283, 131, 360, 474, 131, 131, 363, 284, + 322, 357, 357, 357, 322, 131, 283, 286, 363, 363, + 363, 363, 363, 363, 355, 319, 319, 319, 355, 358, + 283, 179, 179, 179, 179, 179, 284, 356, 131, 358, + 358, 358, 358, 358, 358, 282, 282, 282, 321, 131, + + 284, 323, 131, 131, 131, 39, 127, 116, 116, 188, + 188, 188, 188, 188, 324, 39, 39, 39, 39, 39, + 39, 325, 116, 174, 324, 324, 324, 324, 324, 324, + 327, 361, 361, 361, 327, 131, 164, 154, 149, 131, + 365, 283, 131, 200, 200, 200, 200, 200, 57, 362, + 365, 365, 365, 365, 365, 365, 286, 63, 59, 362, + 362, 362, 362, 362, 362, 285, 285, 285, 326, 154, + 127, 123, 116, 106, 101, 48, 328, 100, 91, 79, + 58, 57, 50, 47, 329, 48, 48, 48, 48, 48, + 48, 330, 367, 478, 329, 329, 329, 329, 329, 329, + + 369, 35, 367, 367, 367, 367, 367, 367, 35, 478, + 369, 369, 369, 369, 369, 369, 162, 162, 162, 162, + 162, 372, 478, 478, 478, 478, 478, 478, 92, 478, + 478, 372, 372, 372, 372, 372, 372, 373, 478, 478, + 478, 478, 94, 478, 478, 478, 478, 373, 373, 373, + 373, 373, 373, 359, 319, 319, 319, 359, 374, 478, + 478, 478, 478, 478, 283, 478, 360, 478, 374, 374, + 374, 374, 374, 374, 375, 478, 478, 154, 478, 286, + 478, 478, 478, 378, 375, 375, 375, 375, 375, 375, + 379, 478, 380, 386, 478, 478, 478, 381, 382, 387, + + 478, 383, 478, 386, 386, 386, 386, 386, 386, 387, + 387, 387, 387, 387, 387, 388, 478, 478, 478, 478, + 478, 389, 478, 478, 478, 388, 388, 388, 388, 388, + 388, 389, 389, 389, 389, 389, 389, 397, 478, 478, + 478, 478, 478, 398, 478, 478, 478, 397, 397, 397, + 397, 397, 397, 398, 398, 398, 398, 398, 398, 399, + 478, 478, 478, 478, 478, 409, 478, 478, 478, 399, + 399, 399, 399, 399, 399, 409, 409, 409, 409, 409, + 409, 410, 478, 478, 478, 478, 478, 249, 478, 478, + 478, 410, 410, 410, 410, 410, 410, 249, 249, 249, + + 249, 249, 249, 411, 411, 411, 411, 411, 478, 478, + 282, 478, 478, 478, 478, 478, 478, 478, 478, 412, + 282, 282, 282, 282, 282, 282, 285, 478, 478, 413, + 411, 411, 411, 411, 411, 478, 285, 285, 285, 285, + 285, 285, 478, 478, 478, 478, 412, 424, 478, 478, + 425, 425, 425, 425, 425, 478, 413, 424, 424, 424, + 424, 424, 424, 426, 425, 425, 425, 425, 425, 478, + 425, 425, 425, 425, 425, 478, 428, 426, 478, 478, + 478, 478, 478, 426, 478, 478, 478, 439, 478, 478, + 428, 436, 436, 436, 436, 436, 428, 439, 439, 439, + + 439, 439, 439, 478, 426, 425, 425, 425, 425, 425, + 437, 478, 478, 478, 478, 478, 478, 428, 426, 478, + 437, 437, 437, 437, 437, 437, 445, 478, 478, 478, + 478, 428, 478, 478, 478, 478, 445, 445, 445, 445, + 445, 445, 425, 425, 425, 425, 425, 452, 478, 478, + 425, 425, 425, 425, 425, 426, 478, 452, 452, 452, + 452, 452, 452, 426, 478, 478, 478, 453, 428, 446, + 446, 446, 446, 446, 478, 478, 428, 453, 453, 453, + 453, 453, 453, 478, 478, 478, 478, 478, 447, 478, + 478, 478, 478, 478, 458, 478, 478, 478, 447, 447, + + 447, 447, 447, 447, 458, 458, 458, 458, 458, 458, + 459, 478, 478, 478, 478, 478, 464, 478, 478, 478, + 459, 459, 459, 459, 459, 459, 464, 464, 464, 464, + 464, 464, 465, 478, 478, 478, 478, 478, 427, 478, + 478, 478, 465, 465, 465, 465, 465, 465, 427, 427, + 427, 427, 427, 427, 469, 478, 478, 478, 478, 478, + 427, 478, 478, 478, 469, 469, 469, 469, 469, 469, + 427, 427, 427, 427, 427, 427, 39, 478, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 45, 45, 478, + 45, 45, 48, 478, 48, 48, 48, 48, 48, 48, + + 48, 48, 48, 54, 54, 478, 54, 54, 82, 478, + 478, 82, 82, 89, 89, 89, 89, 89, 89, 89, + 89, 89, 93, 478, 93, 93, 478, 93, 93, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, - 108, 113, 113, 478, 113, 113, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 128, 128, 478, 128, 128, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 151, 151, - 478, 151, 151, 159, 159, 159, 159, 159, 159, 159, - - 159, 159, 159, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 166, 166, 166, 179, 179, 179, 179, - 179, 179, 179, 179, 179, 179, 48, 48, 478, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - - 211, 211, 211, 211, 39, 478, 478, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 225, 225, 225, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 115, + 115, 478, 115, 115, 119, 119, 119, 119, 119, 119, + 119, 119, 119, 119, 119, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 65, 65, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 130, 130, + 478, 130, 130, 151, 151, 151, 151, 151, 151, 151, + + 151, 151, 153, 153, 478, 153, 153, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 179, 179, 179, 179, + 179, 179, 179, 179, 179, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 212, 212, 212, 478, 212, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 243, 243, 243, 243, 248, 248, 248, 248, 248, - 248, 478, 248, 248, 248, 248, 248, 248, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 185, 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 275, 275, 275, 275, 248, - 248, 248, 248, 248, 248, 478, 248, 248, 248, 248, - 248, 248, 281, 478, 478, 281, 281, 281, 281, 281, - - 281, 281, 281, 281, 281, 284, 478, 478, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 284, 287, 287, - 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, - 287, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 113, 113, 478, 113, 113, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 312, 312, 312, 312, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 284, - 478, 478, 284, 284, 284, 284, 284, 284, 284, 284, - 284, 284, 326, 326, 326, 326, 326, 326, 326, 326, - - 326, 326, 326, 326, 326, 248, 248, 248, 248, 248, - 478, 478, 248, 248, 248, 248, 248, 248, 287, 287, - 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, - 287, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 113, 113, 478, 113, 113, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 348, 348, 348, 348, 281, 281, 478, 281, - 281, 281, 281, 281, 281, 281, 281, 281, 281, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 284, 284, 478, 284, 284, 284, 284, 284, - - 284, 284, 284, 284, 284, 326, 326, 326, 326, 326, - 326, 326, 326, 326, 326, 326, 326, 326, 248, 248, - 248, 248, 248, 478, 478, 248, 248, 248, 248, 248, - 248, 413, 413, 413, 413, 478, 478, 478, 478, 413, - 478, 478, 413, 413, 425, 425, 425, 425, 478, 478, - 478, 425, 425, 425, 478, 425, 425, 427, 427, 427, - 427, 427, 427, 427, 427, 427, 427, 436, 436, 436, - 436, 436, 436, 436, 436, 436, 436, 7, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 225, 225, 244, 244, 244, 478, 244, 249, 249, 249, + 249, 478, 249, 249, 249, 249, 249, 249, 276, 276, + 276, 478, 276, 282, 478, 282, 282, 282, 282, 282, + + 282, 282, 282, 282, 285, 478, 285, 285, 285, 285, + 285, 285, 285, 285, 285, 288, 288, 288, 288, 288, + 288, 288, 288, 288, 288, 288, 313, 313, 313, 478, + 313, 322, 322, 322, 322, 322, 322, 322, 322, 322, + 322, 322, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 348, 348, 348, 478, 348, 414, 414, + 414, 478, 478, 478, 414, 478, 478, 414, 414, 423, + 423, 423, 423, 423, 423, 423, 423, 423, 427, 427, + 427, 478, 478, 427, 427, 427, 478, 427, 427, 438, + 438, 438, 438, 438, 438, 438, 438, 438, 7, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478 + 478, 478, 478, 478, 478, 478, 478, 478, 478 } ; -static yyconst flex_int16_t yy_chk[6664] = +static yyconst flex_int16_t yy_chk[2460] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1048,733 +576,270 @@ static yyconst flex_int16_t yy_chk[6664] = 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 5, 4, 6, 15, - 12, 3, 477, 4, 9, 9, 9, 9, 9, 10, - - 10, 10, 10, 10, 3, 3, 4, 4, 11, 11, - 11, 11, 11, 23, 39, 5, 17, 6, 35, 17, - 3, 24, 4, 32, 24, 24, 32, 32, 38, 48, - 15, 69, 3, 3, 4, 4, 12, 42, 25, 17, - 42, 25, 11, 474, 69, 3, 35, 4, 17, 24, - 53, 32, 17, 23, 31, 78, 38, 78, 35, 69, - 39, 24, 467, 32, 33, 461, 65, 17, 83, 25, - 48, 11, 13, 42, 35, 13, 17, 24, 25, 32, - 83, 31, 13, 13, 13, 13, 13, 13, 65, 54, - 53, 33, 54, 54, 31, 65, 83, 25, 36, 36, - - 36, 36, 36, 70, 33, 68, 68, 456, 13, 31, - 166, 13, 13, 13, 13, 13, 13, 20, 166, 33, - 211, 90, 70, 440, 20, 20, 434, 20, 211, 54, - 124, 124, 70, 68, 20, 20, 20, 20, 20, 20, + 3, 134, 4, 9, 9, 9, 9, 9, 12, 3, + 134, 4, 10, 10, 10, 10, 10, 11, 11, 11, + 11, 11, 3, 3, 4, 4, 13, 67, 12, 13, + 15, 39, 52, 25, 67, 3, 13, 4, 31, 13, + + 13, 13, 13, 13, 13, 15, 17, 25, 22, 17, + 27, 39, 31, 27, 11, 52, 17, 26, 22, 69, + 26, 26, 71, 22, 27, 48, 22, 42, 31, 22, + 42, 26, 17, 22, 22, 156, 22, 42, 71, 69, + 48, 17, 20, 23, 27, 64, 54, 64, 26, 20, + 20, 156, 20, 23, 23, 23, 23, 23, 23, 20, + 54, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 90, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 64, 52, - 106, 20, 22, 74, 55, 429, 37, 37, 37, 37, - - 37, 57, 64, 57, 22, 243, 487, 22, 487, 52, - 22, 419, 55, 243, 22, 22, 64, 22, 106, 74, - 67, 66, 74, 57, 72, 72, 385, 127, 22, 67, - 37, 127, 66, 22, 55, 66, 22, 52, 71, 22, - 97, 55, 22, 22, 71, 22, 26, 73, 67, 66, - 82, 57, 71, 26, 26, 26, 26, 26, 26, 37, - 66, 72, 108, 109, 73, 80, 71, 76, 73, 82, - 107, 73, 71, 76, 86, 107, 73, 85, 140, 82, - 97, 384, 26, 26, 26, 26, 26, 26, 41, 41, - 41, 41, 73, 118, 41, 76, 73, 80, 84, 85, - - 86, 80, 87, 86, 348, 175, 85, 41, 108, 109, - 96, 140, 84, 93, 41, 41, 41, 41, 41, 41, - 93, 107, 94, 119, 102, 80, 84, 104, 87, 342, - 250, 87, 103, 119, 118, 96, 317, 105, 161, 316, - 41, 102, 315, 41, 41, 41, 41, 41, 41, 44, - 96, 175, 104, 93, 314, 94, 44, 44, 44, 44, - 44, 44, 94, 96, 102, 103, 120, 104, 105, 125, - 102, 250, 103, 275, 119, 131, 120, 105, 161, 134, - 104, 275, 44, 94, 125, 44, 44, 44, 44, 44, - 44, 46, 144, 103, 150, 131, 105, 145, 46, 46, - - 46, 46, 46, 46, 131, 134, 145, 165, 134, 125, - 137, 137, 148, 125, 156, 144, 150, 120, 192, 153, - 226, 144, 148, 150, 226, 145, 154, 46, 46, 46, - 46, 46, 46, 49, 49, 49, 49, 156, 137, 154, - 148, 157, 155, 156, 49, 153, 158, 165, 153, 174, - 190, 192, 49, 155, 154, 157, 168, 170, 164, 49, - 49, 49, 49, 49, 49, 164, 158, 171, 173, 157, - 155, 172, 182, 190, 235, 158, 184, 174, 216, 190, - 249, 499, 182, 499, 284, 49, 194, 217, 49, 49, - 49, 49, 49, 49, 56, 196, 168, 170, 164, 194, - - 184, 56, 56, 56, 56, 56, 56, 171, 173, 172, - 235, 172, 201, 198, 194, 217, 184, 196, 216, 325, - 293, 201, 202, 182, 196, 284, 249, 203, 184, 202, - 56, 56, 56, 56, 56, 56, 77, 172, 198, 203, - 201, 204, 198, 77, 77, 77, 77, 77, 77, 293, - 202, 231, 232, 234, 390, 203, 281, 320, 390, 204, - 325, 234, 205, 492, 492, 231, 254, 509, 232, 509, - 204, 206, 77, 77, 77, 77, 77, 77, 88, 231, - 232, 234, 224, 236, 205, 88, 88, 88, 88, 88, - 88, 205, 236, 206, 254, 214, 214, 214, 214, 214, - - 206, 214, 281, 320, 224, 265, 214, 313, 214, 237, - 306, 236, 332, 238, 88, 88, 88, 88, 88, 88, - 91, 238, 224, 265, 364, 307, 271, 91, 91, 91, - 91, 91, 91, 224, 265, 237, 306, 271, 237, 306, - 332, 238, 247, 247, 247, 247, 247, 214, 247, 267, - 296, 268, 364, 247, 271, 247, 91, 91, 91, 91, - 91, 91, 98, 98, 98, 98, 98, 279, 511, 337, - 511, 267, 268, 340, 98, 269, 303, 305, 267, 312, - 268, 98, 269, 303, 305, 278, 308, 312, 98, 98, - 98, 98, 98, 98, 247, 248, 248, 248, 248, 248, - - 337, 248, 277, 269, 303, 305, 248, 276, 248, 340, - 463, 515, 308, 515, 98, 308, 270, 98, 98, 98, - 98, 98, 98, 110, 110, 110, 110, 110, 337, 110, - 280, 280, 280, 280, 280, 282, 282, 282, 282, 282, - 321, 343, 110, 280, 246, 321, 463, 248, 282, 110, - 110, 110, 110, 110, 110, 286, 286, 286, 286, 286, - 318, 318, 318, 318, 318, 343, 245, 366, 286, 517, - 343, 517, 370, 318, 394, 110, 344, 366, 110, 110, - 110, 110, 110, 110, 111, 111, 111, 111, 244, 394, - 111, 321, 239, 229, 370, 287, 287, 287, 287, 287, - - 344, 370, 394, 111, 383, 344, 366, 286, 287, 228, - 111, 111, 111, 111, 111, 111, 288, 288, 288, 288, - 288, 289, 289, 289, 289, 289, 356, 225, 326, 288, - 383, 356, 213, 383, 289, 392, 111, 392, 326, 111, - 111, 111, 111, 111, 111, 114, 393, 287, 462, 212, - 462, 403, 114, 114, 114, 114, 114, 114, 322, 322, - 322, 322, 322, 392, 322, 357, 199, 193, 288, 393, - 357, 322, 403, 289, 191, 393, 462, 356, 114, 326, - 403, 114, 114, 114, 114, 114, 114, 115, 189, 327, - 327, 327, 327, 327, 115, 115, 115, 115, 115, 115, - - 327, 187, 327, 331, 331, 331, 331, 331, 185, 179, - 322, 333, 333, 333, 333, 333, 357, 333, 167, 331, - 371, 163, 159, 115, 115, 115, 115, 115, 115, 117, - 117, 117, 117, 117, 346, 346, 346, 346, 346, 151, - 149, 327, 371, 336, 336, 336, 336, 336, 117, 371, - 346, 360, 361, 146, 336, 117, 117, 117, 117, 117, - 117, 360, 361, 333, 365, 365, 365, 365, 365, 416, - 345, 345, 345, 345, 345, 367, 367, 367, 367, 367, - 143, 142, 416, 377, 117, 117, 117, 117, 117, 117, - 121, 121, 121, 121, 121, 336, 524, 416, 524, 141, - - 441, 121, 360, 361, 369, 369, 369, 369, 369, 121, - 377, 378, 379, 139, 441, 380, 121, 121, 121, 121, - 121, 121, 345, 355, 355, 355, 355, 355, 441, 355, - 527, 415, 527, 378, 379, 138, 355, 380, 377, 415, - 378, 379, 121, 395, 380, 121, 121, 121, 121, 121, - 121, 122, 122, 122, 122, 381, 369, 136, 395, 415, - 418, 381, 122, 359, 359, 359, 359, 359, 382, 391, - 122, 395, 391, 402, 359, 355, 359, 122, 122, 122, - 122, 122, 122, 381, 135, 401, 418, 133, 407, 418, - 382, 402, 132, 391, 407, 130, 405, 382, 391, 396, - - 401, 391, 402, 122, 128, 396, 122, 122, 122, 122, - 122, 122, 129, 401, 396, 359, 407, 406, 405, 129, - 129, 129, 129, 129, 129, 405, 537, 396, 537, 544, - 545, 544, 545, 396, 399, 399, 399, 399, 399, 406, - 126, 404, 408, 116, 113, 95, 406, 399, 129, 129, - 129, 129, 129, 129, 147, 147, 147, 147, 147, 404, - 408, 92, 81, 79, 410, 410, 410, 410, 410, 417, - 404, 408, 75, 147, 63, 410, 420, 61, 417, 421, - 147, 147, 147, 147, 147, 147, 399, 400, 400, 400, - 400, 400, 409, 409, 409, 409, 409, 417, 409, 60, - - 420, 421, 59, 400, 58, 420, 147, 51, 421, 147, - 147, 147, 147, 147, 147, 152, 410, 411, 411, 411, - 411, 411, 152, 152, 152, 152, 152, 152, 413, 413, - 413, 413, 413, 411, 45, 29, 28, 422, 27, 400, - 21, 413, 430, 19, 409, 435, 412, 412, 412, 412, - 412, 152, 152, 152, 152, 152, 152, 160, 160, 160, - 160, 160, 412, 422, 430, 18, 422, 432, 431, 411, - 435, 430, 433, 16, 435, 442, 160, 432, 468, 433, - 413, 442, 448, 160, 160, 160, 160, 160, 160, 423, - 423, 423, 423, 423, 431, 432, 443, 431, 412, 14, - - 433, 468, 423, 442, 448, 449, 7, 468, 443, 160, - 444, 448, 160, 160, 160, 160, 160, 160, 162, 162, - 162, 162, 162, 0, 443, 444, 0, 449, 425, 425, - 425, 425, 425, 450, 449, 0, 454, 162, 444, 0, - 451, 425, 450, 0, 162, 162, 162, 162, 162, 162, - 427, 427, 427, 427, 427, 436, 436, 436, 436, 436, - 0, 450, 451, 427, 454, 466, 0, 0, 436, 451, - 0, 466, 454, 162, 162, 162, 162, 162, 162, 169, - 425, 438, 438, 438, 438, 438, 169, 169, 169, 169, - 169, 169, 454, 466, 438, 0, 0, 0, 457, 0, - - 455, 460, 427, 476, 0, 0, 457, 436, 471, 455, - 460, 476, 472, 0, 473, 169, 169, 169, 169, 169, - 169, 176, 176, 176, 176, 176, 457, 176, 455, 460, - 471, 476, 0, 438, 472, 0, 0, 471, 473, 0, - 176, 472, 0, 473, 0, 0, 0, 176, 176, 176, - 176, 176, 176, 445, 445, 445, 445, 445, 465, 465, - 465, 465, 465, 0, 0, 0, 445, 0, 0, 0, - 0, 465, 0, 176, 0, 0, 176, 176, 176, 176, - 176, 176, 178, 469, 469, 469, 469, 469, 470, 178, - 178, 178, 178, 178, 178, 0, 469, 0, 0, 0, - - 0, 0, 475, 470, 0, 445, 0, 0, 0, 0, - 465, 0, 0, 0, 0, 0, 470, 475, 178, 178, - 178, 178, 178, 178, 180, 180, 180, 180, 180, 0, - 475, 0, 0, 0, 0, 469, 0, 0, 0, 0, - 0, 0, 0, 180, 0, 0, 0, 0, 0, 0, - 180, 180, 180, 180, 180, 180, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, - 180, 180, 180, 180, 180, 181, 181, 181, 181, 181, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 181, 0, 0, 0, 0, 0, - 0, 181, 181, 181, 181, 181, 181, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 181, 181, 181, 181, 181, 181, 183, 183, 183, 183, - 183, 0, 0, 0, 0, 0, 0, 183, 0, 0, - 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, - 0, 0, 183, 183, 183, 183, 183, 183, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 183, 0, - - 0, 183, 183, 183, 183, 183, 183, 188, 188, 188, - 188, 188, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 188, 0, 0, 0, - 0, 0, 0, 188, 188, 188, 188, 188, 188, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 188, 188, 188, 188, 188, 188, 195, 0, - 0, 0, 0, 0, 0, 195, 195, 195, 195, 195, - 195, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 195, 195, 195, 195, 195, 195, - 200, 200, 200, 200, 200, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 200, - 0, 0, 0, 0, 0, 0, 200, 200, 200, 200, - 200, 200, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 200, 200, 200, 200, 200, - 200, 207, 0, 0, 0, 0, 0, 0, 207, 207, - 207, 207, 207, 207, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 207, 207, 207, - 207, 207, 207, 208, 208, 208, 208, 208, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 208, 0, 0, 0, 0, 0, 0, 208, - 208, 208, 208, 208, 208, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 208, 208, - 208, 208, 208, 208, 215, 0, 0, 0, 0, 0, - 0, 215, 215, 215, 215, 215, 215, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 215, 215, 215, 215, 215, 215, 218, 218, 218, 218, - 218, 0, 218, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 218, 0, 0, 0, 0, - 0, 0, 218, 218, 218, 218, 218, 218, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 218, 0, - 0, 218, 218, 218, 218, 218, 218, 220, 0, 0, - 0, 0, 0, 0, 220, 220, 220, 220, 220, 220, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 220, 220, 220, 220, 220, 220, 221, - 221, 221, 221, 221, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 221, 0, - 0, 0, 0, 0, 0, 221, 221, 221, 221, 221, - 221, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 221, 221, 221, 221, 221, 221, - 222, 222, 222, 222, 222, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 222, - - 0, 0, 0, 0, 0, 0, 222, 222, 222, 222, - 222, 222, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 222, 222, 222, 222, 222, - 222, 223, 223, 223, 223, 223, 0, 0, 0, 0, - 0, 0, 223, 0, 0, 0, 0, 0, 0, 0, - 223, 0, 0, 0, 0, 0, 0, 223, 223, 223, - 223, 223, 223, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 223, 0, 0, 223, 223, 223, 223, - - 223, 223, 227, 227, 227, 227, 227, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 227, 0, 0, 0, 0, 0, 0, 227, 227, - 227, 227, 227, 227, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 227, 227, 227, - 227, 227, 227, 230, 0, 0, 0, 0, 0, 0, - 230, 230, 230, 230, 230, 230, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 230, - - 230, 230, 230, 230, 230, 233, 233, 233, 233, 233, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 233, 0, 0, 0, 0, 0, - 0, 233, 233, 233, 233, 233, 233, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 233, 233, 233, 233, 233, 233, 240, 0, 0, 0, - 0, 0, 0, 240, 240, 240, 240, 240, 240, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 240, 240, 240, 240, 240, 240, 241, 241, - 241, 241, 241, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 241, 0, 0, - 0, 0, 0, 0, 241, 241, 241, 241, 241, 241, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 241, 241, 241, 241, 241, 241, 252, - 252, 252, 252, 252, 0, 252, 0, 0, 0, 0, - 252, 252, 252, 0, 0, 0, 0, 0, 252, 0, - 0, 0, 0, 0, 0, 252, 252, 252, 252, 252, - - 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 252, 0, 0, 252, 252, 252, 252, 252, 252, - 253, 0, 0, 0, 0, 0, 0, 253, 253, 253, - 253, 253, 253, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 253, 253, 253, 253, - 253, 253, 255, 255, 255, 255, 255, 0, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 255, 0, 0, 0, 0, 0, 0, 255, 255, - - 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 0, 0, 255, 255, 255, - 255, 255, 255, 257, 0, 0, 0, 0, 0, 0, - 257, 257, 257, 257, 257, 257, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 257, 0, 0, 257, - 257, 257, 257, 257, 257, 258, 258, 258, 258, 258, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 258, 0, 0, 0, 0, 0, - - 0, 258, 258, 258, 258, 258, 258, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 258, 0, 0, - 258, 258, 258, 258, 258, 258, 259, 259, 259, 259, - 259, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 259, 0, 0, 0, 0, - 0, 0, 259, 259, 259, 259, 259, 259, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 259, 259, 259, 259, 259, 259, 260, 260, 260, - - 260, 260, 0, 0, 0, 0, 0, 0, 260, 0, - 0, 0, 0, 0, 0, 0, 260, 0, 0, 0, - 0, 0, 0, 260, 260, 260, 260, 260, 260, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 260, - 0, 0, 260, 260, 260, 260, 260, 260, 261, 261, - 261, 261, 261, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 261, 0, 0, - 0, 0, 0, 0, 261, 261, 261, 261, 261, 261, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 261, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 261, 261, 261, 261, 261, 261, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 261, 262, 262, 262, 262, 262, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 262, 0, 0, 0, 0, 0, 0, 262, 262, - 262, 262, 262, 262, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 262, 262, 262, - 262, 262, 262, 263, 0, 0, 0, 0, 0, 0, - - 263, 263, 263, 263, 263, 263, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 263, - 263, 263, 263, 263, 263, 264, 264, 264, 264, 264, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 264, 0, 0, 0, 0, 0, - 0, 264, 264, 264, 264, 264, 264, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 264, 264, 264, 264, 264, 264, 266, 266, 266, 266, - - 266, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 266, 0, 0, 0, 0, - 0, 0, 266, 266, 266, 266, 266, 266, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 266, 266, 266, 266, 266, 266, 272, 0, 0, - 0, 0, 0, 0, 272, 272, 272, 272, 272, 272, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 272, 272, 272, 272, 272, 272, 273, - - 273, 273, 273, 273, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 273, 0, - 0, 0, 0, 0, 0, 273, 273, 273, 273, 273, - 273, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 273, 273, 273, 273, 273, 273, - 283, 283, 283, 283, 0, 0, 283, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 283, - 0, 0, 0, 0, 0, 0, 283, 283, 283, 283, - 283, 283, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 283, 0, 0, 283, 283, 283, 283, 283, - 283, 285, 285, 285, 285, 0, 0, 0, 0, 0, - 0, 0, 285, 0, 0, 0, 0, 0, 0, 0, - 285, 0, 0, 0, 0, 0, 0, 285, 285, 285, - 285, 285, 285, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 285, 0, 0, 285, 285, 285, 285, - 285, 285, 290, 290, 290, 290, 290, 0, 0, 0, - 0, 0, 0, 0, 0, 290, 0, 0, 0, 0, - - 0, 290, 0, 0, 0, 0, 0, 0, 290, 290, - 290, 290, 290, 290, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 290, 0, 0, 290, 290, 290, - 290, 290, 290, 291, 291, 291, 291, 291, 0, 291, - 0, 0, 0, 0, 291, 291, 291, 0, 0, 0, - 0, 0, 291, 0, 0, 0, 0, 0, 0, 291, - 291, 291, 291, 291, 291, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 291, 0, 0, 291, 291, - - 291, 291, 291, 291, 292, 0, 0, 0, 0, 0, - 0, 292, 292, 292, 292, 292, 292, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 292, 292, 292, 292, 292, 292, 294, 294, 294, 294, - 294, 0, 294, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 294, 0, 0, 0, 0, - 0, 0, 294, 294, 294, 294, 294, 294, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 294, 0, - - 0, 294, 294, 294, 294, 294, 294, 297, 297, 297, - 297, 297, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 297, 0, 0, 0, - 0, 0, 0, 297, 297, 297, 297, 297, 297, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 297, - 0, 0, 297, 297, 297, 297, 297, 297, 298, 298, - 298, 298, 298, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 298, 0, 0, - 0, 0, 0, 0, 298, 298, 298, 298, 298, 298, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 298, 298, 298, 298, 298, 298, 299, - 299, 299, 299, 299, 0, 0, 0, 0, 0, 0, - 299, 0, 0, 0, 0, 0, 0, 0, 299, 0, - 0, 0, 0, 0, 0, 299, 299, 299, 299, 299, - 299, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 299, 0, 0, 299, 299, 299, 299, 299, 299, - 300, 300, 300, 300, 300, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 300, 0, 0, 300, - 0, 0, 0, 0, 0, 0, 300, 300, 300, 300, - 300, 300, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 300, 300, 300, 300, 300, - 300, 301, 301, 301, 301, 301, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 301, 0, 0, 0, 0, 0, 0, 301, 301, 301, - 301, 301, 301, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 301, 301, 301, 301, - 301, 301, 302, 302, 302, 302, 302, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 302, 0, 0, 0, 0, 0, 0, 302, 302, - 302, 302, 302, 302, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 302, 302, 302, - 302, 302, 302, 304, 304, 304, 304, 304, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 304, 0, 0, 0, 0, 0, 0, 304, - - 304, 304, 304, 304, 304, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 304, 304, - 304, 304, 304, 304, 309, 0, 0, 0, 0, 0, - 0, 309, 309, 309, 309, 309, 309, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 309, 309, 309, 309, 309, 309, 310, 310, 310, 310, - 310, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 310, 0, 0, 0, 0, - - 0, 0, 310, 310, 310, 310, 310, 310, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 310, 310, 310, 310, 310, 310, 323, 323, 323, - 323, 323, 0, 323, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 323, 0, 0, 0, - 0, 0, 0, 323, 323, 323, 323, 323, 323, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 323, - 0, 0, 323, 323, 323, 323, 323, 323, 324, 324, - - 324, 324, 0, 0, 324, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 324, 0, 0, - 0, 0, 0, 0, 324, 324, 324, 324, 324, 324, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 324, 0, 0, 324, 324, 324, 324, 324, 324, 328, - 328, 328, 328, 328, 0, 0, 0, 0, 0, 0, - 328, 0, 0, 0, 0, 0, 0, 0, 328, 0, - 0, 0, 0, 0, 0, 328, 328, 328, 328, 328, - 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 328, 0, 0, 328, 328, 328, 328, 328, 328, - 329, 329, 329, 329, 0, 0, 0, 0, 0, 0, - 0, 329, 0, 0, 0, 0, 0, 0, 0, 329, - 0, 0, 0, 0, 0, 0, 329, 329, 329, 329, - 329, 329, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 329, 0, 0, 329, 329, 329, 329, 329, - 329, 330, 330, 330, 330, 330, 0, 0, 0, 0, - 0, 0, 0, 0, 330, 0, 0, 0, 0, 0, - - 330, 0, 0, 0, 0, 0, 0, 330, 330, 330, - 330, 330, 330, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 330, 0, 0, 330, 330, 330, 330, - 330, 330, 334, 0, 0, 0, 0, 0, 0, 334, - 334, 334, 334, 334, 334, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 334, 334, - 334, 334, 334, 334, 335, 0, 0, 0, 0, 0, - 0, 335, 335, 335, 335, 335, 335, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 335, 335, 335, 335, 335, 335, 338, 0, 0, 0, - 0, 0, 0, 338, 338, 338, 338, 338, 338, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 338, 338, 338, 338, 338, 338, 339, 339, - 339, 339, 339, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 339, 0, 0, - 0, 0, 0, 0, 339, 339, 339, 339, 339, 339, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 339, 339, 339, 339, 339, 339, 341, - 341, 341, 341, 341, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 341, 0, - 0, 0, 0, 0, 0, 341, 341, 341, 341, 341, - 341, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 341, 341, 341, 341, 341, 341, - 358, 0, 0, 0, 0, 0, 0, 358, 358, 358, - - 358, 358, 358, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 358, 358, 358, 358, - 358, 358, 362, 0, 0, 0, 0, 0, 0, 362, - 362, 362, 362, 362, 362, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 362, 362, - 362, 362, 362, 362, 363, 363, 363, 363, 363, 0, - 0, 0, 0, 0, 0, 0, 0, 363, 0, 0, - 0, 0, 0, 363, 0, 0, 0, 0, 0, 0, - - 363, 363, 363, 363, 363, 363, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 363, 0, 0, 363, - 363, 363, 363, 363, 363, 368, 0, 0, 0, 0, - 0, 0, 368, 0, 368, 0, 0, 0, 0, 368, - 368, 0, 0, 368, 0, 0, 0, 0, 368, 0, - 0, 0, 0, 0, 368, 0, 0, 0, 0, 0, - 368, 0, 368, 0, 0, 0, 0, 368, 368, 0, - 0, 368, 373, 0, 0, 0, 0, 0, 0, 373, - 373, 373, 373, 373, 373, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 373, 373, - 373, 373, 373, 373, 374, 0, 0, 0, 0, 0, - 0, 374, 374, 374, 374, 374, 374, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 374, 374, 374, 374, 374, 374, 375, 0, 0, 0, - 0, 0, 0, 375, 375, 375, 375, 375, 375, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 375, 375, 375, 375, 375, 375, 387, 0, - 0, 0, 0, 0, 0, 387, 387, 387, 387, 387, - 387, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 387, 387, 387, 387, 387, 387, - 388, 0, 0, 0, 0, 0, 0, 388, 388, 388, - 388, 388, 388, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 388, 388, 388, 388, - 388, 388, 389, 0, 0, 0, 0, 0, 0, 389, - - 389, 389, 389, 389, 389, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 389, 389, - 389, 389, 389, 389, 397, 0, 0, 0, 0, 0, - 0, 397, 397, 397, 397, 397, 397, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 397, 397, 397, 397, 397, 397, 398, 0, 0, 0, - 0, 0, 0, 398, 398, 398, 398, 398, 398, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 398, 398, 398, 398, 398, 398, 414, 0, - 0, 0, 0, 0, 0, 414, 414, 414, 414, 414, - 414, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 414, 414, 414, 414, 414, 414, - 426, 0, 0, 0, 0, 0, 0, 426, 426, 426, - 426, 426, 426, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 426, 426, 426, 426, - - 426, 426, 428, 428, 428, 428, 428, 0, 0, 0, - 0, 0, 0, 0, 0, 428, 0, 0, 0, 0, - 0, 428, 0, 0, 0, 0, 0, 0, 428, 428, - 428, 428, 428, 428, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 428, 0, 0, 428, 428, 428, - 428, 428, 428, 437, 437, 437, 437, 437, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 437, 0, 0, 0, 0, 0, 0, 437, - 437, 437, 437, 437, 437, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 437, 437, - 437, 437, 437, 437, 439, 0, 0, 0, 0, 0, - 0, 439, 439, 439, 439, 439, 439, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 439, 439, 439, 439, 439, 439, 446, 0, 0, 0, - 0, 0, 0, 446, 446, 446, 446, 446, 446, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 446, 446, 446, 446, 446, 446, 447, 0, - 0, 0, 0, 0, 0, 447, 447, 447, 447, 447, - 447, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 447, 447, 447, 447, 447, 447, - 452, 0, 0, 0, 0, 0, 0, 452, 452, 452, - 452, 452, 452, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 452, 452, 452, 452, - 452, 452, 453, 0, 0, 0, 0, 0, 0, 453, - - 453, 453, 453, 453, 453, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 453, 453, - 453, 453, 453, 453, 458, 0, 0, 0, 0, 0, - 0, 458, 458, 458, 458, 458, 458, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 458, 458, 458, 458, 458, 458, 459, 0, 0, 0, - 0, 0, 0, 459, 459, 459, 459, 459, 459, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 459, 459, 459, 459, 459, 459, 464, 0, - 0, 0, 0, 0, 0, 464, 464, 464, 464, 464, - 464, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 464, 464, 464, 464, 464, 464, - 479, 0, 0, 479, 479, 479, 479, 479, 479, 479, - 479, 479, 479, 480, 480, 0, 480, 480, 481, 0, - 0, 481, 481, 481, 481, 481, 481, 481, 481, 481, - 481, 482, 482, 0, 482, 482, 483, 0, 0, 483, - - 483, 484, 0, 484, 484, 0, 484, 484, 485, 485, - 485, 485, 485, 485, 485, 485, 485, 485, 486, 486, + 20, 20, 20, 20, 20, 20, 20, 20, 33, 32, + 35, 20, 32, 32, 36, 36, 36, 36, 36, 57, + + 43, 57, 33, 32, 35, 37, 37, 37, 37, 37, + 43, 43, 43, 43, 43, 43, 44, 84, 33, 55, + 32, 35, 55, 55, 57, 46, 44, 44, 44, 44, + 44, 44, 46, 55, 84, 46, 46, 46, 46, 46, + 46, 53, 37, 41, 41, 41, 41, 56, 66, 41, + 72, 53, 53, 53, 53, 53, 53, 70, 147, 86, + 72, 56, 41, 66, 147, 75, 86, 68, 56, 41, + 75, 73, 41, 41, 41, 41, 41, 41, 49, 49, + 49, 49, 68, 74, 74, 70, 73, 75, 63, 49, + 477, 75, 73, 68, 74, 78, 80, 49, 63, 63, + + 63, 63, 63, 63, 49, 83, 80, 49, 49, 49, + 49, 49, 49, 76, 81, 83, 76, 85, 78, 87, + 88, 89, 87, 88, 81, 81, 81, 81, 81, 81, + 93, 80, 85, 102, 108, 89, 90, 90, 90, 90, + 90, 124, 124, 143, 93, 140, 94, 102, 90, 97, + 143, 474, 109, 102, 108, 90, 94, 94, 94, 94, + 94, 94, 90, 97, 96, 90, 90, 90, 90, 90, + 90, 96, 109, 140, 118, 467, 98, 119, 96, 99, + 103, 98, 104, 105, 118, 97, 98, 98, 98, 98, + 98, 98, 119, 99, 103, 107, 104, 105, 120, 118, + + 107, 125, 127, 461, 150, 137, 127, 99, 137, 155, + 104, 150, 155, 120, 148, 125, 103, 105, 112, 125, + 107, 110, 110, 110, 110, 110, 132, 110, 112, 112, + 112, 112, 112, 112, 148, 158, 167, 192, 456, 160, + 110, 158, 157, 192, 167, 132, 159, 110, 160, 162, + 110, 110, 110, 110, 110, 110, 111, 111, 111, 111, + 157, 159, 111, 162, 190, 194, 116, 206, 344, 166, + 169, 190, 194, 344, 206, 111, 116, 116, 116, 116, + 116, 116, 111, 166, 169, 111, 111, 111, 111, 111, + 111, 114, 114, 114, 114, 114, 198, 205, 226, 207, + + 198, 117, 226, 170, 171, 173, 207, 440, 205, 203, + 114, 117, 117, 117, 117, 117, 117, 170, 171, 173, + 114, 114, 114, 114, 114, 114, 121, 121, 121, 121, + 121, 203, 212, 175, 236, 238, 131, 121, 238, 182, + 212, 392, 434, 429, 236, 121, 131, 131, 131, 131, + 131, 131, 121, 175, 182, 121, 121, 121, 121, 121, + 121, 122, 122, 122, 122, 216, 265, 244, 392, 268, + 269, 154, 122, 196, 184, 244, 268, 265, 269, 216, + 122, 154, 154, 154, 154, 154, 154, 122, 184, 196, + 122, 122, 122, 122, 122, 122, 129, 129, 129, 129, + + 129, 184, 276, 202, 340, 307, 161, 204, 307, 309, + 276, 419, 309, 385, 340, 129, 161, 161, 161, 161, + 161, 161, 129, 202, 204, 129, 129, 129, 129, 129, + 129, 152, 152, 152, 152, 152, 232, 165, 172, 229, + 313, 345, 420, 384, 165, 261, 345, 420, 313, 232, + 152, 165, 172, 235, 229, 237, 239, 152, 224, 261, + 152, 152, 152, 152, 152, 152, 163, 163, 163, 163, + 163, 370, 224, 250, 235, 237, 176, 239, 370, 172, + 435, 261, 364, 224, 435, 163, 176, 176, 176, 176, + 176, 176, 177, 250, 251, 163, 163, 163, 163, 163, + + 163, 178, 177, 177, 177, 177, 177, 177, 270, 251, + 272, 178, 178, 178, 178, 178, 178, 180, 180, 180, + 180, 180, 281, 281, 281, 281, 281, 181, 272, 285, + 270, 383, 348, 343, 383, 281, 180, 181, 181, 181, + 181, 181, 181, 183, 285, 332, 180, 180, 180, 180, + 180, 180, 187, 183, 183, 183, 183, 183, 183, 282, + 303, 306, 187, 187, 187, 187, 187, 187, 189, 189, + 189, 189, 189, 283, 283, 283, 283, 283, 199, 282, + 300, 327, 303, 306, 300, 318, 283, 189, 199, 199, + 199, 199, 199, 199, 300, 322, 327, 189, 189, 189, + + 189, 189, 189, 201, 201, 201, 201, 201, 319, 319, + 319, 319, 319, 208, 418, 322, 360, 418, 317, 316, + 326, 319, 201, 208, 208, 208, 208, 208, 208, 209, + 326, 360, 201, 201, 201, 201, 201, 201, 211, 209, + 209, 209, 209, 209, 209, 326, 356, 315, 211, 211, + 211, 211, 211, 211, 215, 215, 215, 215, 215, 218, + 215, 371, 337, 357, 361, 215, 356, 215, 371, 218, + 218, 218, 218, 218, 218, 219, 337, 321, 314, 361, + 215, 220, 321, 357, 366, 219, 219, 219, 219, 219, + 219, 220, 220, 220, 220, 220, 220, 221, 366, 378, + + 337, 366, 321, 222, 381, 407, 378, 221, 221, 221, + 221, 221, 221, 222, 222, 222, 222, 222, 222, 223, + 334, 334, 334, 334, 334, 227, 308, 381, 407, 223, + 223, 223, 223, 223, 223, 227, 227, 227, 227, 227, + 227, 228, 379, 380, 298, 422, 334, 233, 422, 379, + 380, 228, 228, 228, 228, 228, 228, 233, 233, 233, + 233, 233, 233, 234, 338, 338, 338, 338, 338, 241, + 432, 415, 441, 234, 234, 234, 234, 234, 234, 241, + 241, 241, 241, 241, 241, 242, 382, 441, 393, 432, + 338, 243, 415, 382, 393, 242, 242, 242, 242, 242, + + 242, 243, 243, 243, 243, 243, 243, 248, 248, 248, + 248, 248, 405, 248, 293, 390, 394, 395, 248, 405, + 248, 249, 249, 249, 249, 249, 255, 249, 377, 390, + 394, 395, 249, 248, 249, 402, 255, 255, 255, 255, + 255, 255, 377, 396, 404, 403, 402, 249, 253, 253, + 253, 253, 253, 403, 253, 404, 463, 396, 256, 253, + 253, 253, 377, 396, 280, 408, 463, 253, 256, 256, + 256, 256, 256, 256, 253, 257, 408, 253, 253, 253, + 253, 253, 253, 258, 416, 257, 257, 257, 257, 257, + 257, 259, 279, 258, 258, 258, 258, 258, 258, 260, + + 416, 259, 259, 259, 259, 259, 259, 262, 278, 260, + 260, 260, 260, 260, 260, 263, 277, 262, 262, 262, + 262, 262, 262, 266, 271, 263, 263, 263, 263, 263, + 263, 267, 264, 266, 266, 266, 266, 266, 266, 273, + 254, 267, 267, 267, 267, 267, 267, 274, 247, 273, + 273, 273, 273, 273, 273, 275, 406, 274, 274, 274, + 274, 274, 274, 406, 401, 275, 275, 275, 275, 275, + 275, 284, 284, 284, 284, 391, 443, 284, 401, 417, + 391, 431, 246, 391, 431, 287, 287, 287, 287, 287, + 284, 287, 245, 443, 240, 231, 287, 284, 287, 417, + + 284, 284, 284, 284, 284, 284, 286, 286, 286, 286, + 230, 287, 412, 412, 412, 412, 412, 286, 288, 288, + 288, 288, 288, 421, 288, 286, 430, 442, 412, 288, + 421, 288, 286, 430, 450, 286, 286, 286, 286, 286, + 286, 444, 225, 470, 288, 289, 289, 289, 289, 289, + 442, 289, 217, 475, 450, 444, 289, 470, 289, 290, + 290, 290, 290, 290, 294, 290, 448, 475, 462, 433, + 290, 289, 290, 448, 294, 294, 294, 294, 294, 294, + 425, 425, 425, 425, 425, 290, 291, 291, 291, 291, + 291, 433, 291, 425, 455, 462, 296, 291, 214, 291, + + 341, 341, 341, 341, 341, 291, 296, 296, 296, 296, + 296, 296, 291, 213, 455, 291, 291, 291, 291, 291, + 291, 292, 292, 292, 292, 292, 341, 292, 449, 451, + 200, 297, 292, 292, 292, 449, 451, 460, 195, 193, + 292, 297, 297, 297, 297, 297, 297, 292, 299, 191, + 292, 292, 292, 292, 292, 292, 301, 460, 299, 299, + 299, 299, 299, 299, 302, 466, 301, 301, 301, 301, + 301, 301, 304, 188, 302, 302, 302, 302, 302, 302, + 305, 457, 304, 304, 304, 304, 304, 304, 466, 185, + 305, 305, 305, 305, 305, 305, 310, 310, 310, 310, + + 310, 311, 457, 476, 468, 179, 174, 168, 310, 454, + 468, 311, 311, 311, 311, 311, 311, 312, 471, 454, + 164, 473, 310, 153, 476, 471, 473, 312, 312, 312, + 312, 312, 312, 323, 323, 323, 323, 323, 151, 323, + 454, 328, 328, 328, 328, 328, 323, 149, 472, 146, + 145, 144, 328, 142, 328, 472, 141, 139, 331, 323, + 324, 324, 324, 324, 324, 138, 324, 328, 331, 331, + 331, 331, 331, 331, 355, 355, 355, 355, 355, 324, + 355, 365, 365, 365, 365, 365, 324, 355, 136, 324, + 324, 324, 324, 324, 324, 325, 325, 325, 325, 135, + + 355, 325, 133, 130, 128, 333, 126, 365, 115, 367, + 367, 367, 367, 367, 325, 333, 333, 333, 333, 333, + 333, 325, 113, 106, 325, 325, 325, 325, 325, 325, + 329, 329, 329, 329, 329, 367, 95, 82, 79, 77, + 335, 329, 65, 369, 369, 369, 369, 369, 61, 329, + 335, 335, 335, 335, 335, 335, 329, 60, 59, 329, + 329, 329, 329, 329, 329, 330, 330, 330, 330, 369, + 58, 51, 45, 38, 29, 336, 330, 28, 24, 21, + 19, 18, 16, 14, 330, 336, 336, 336, 336, 336, + 336, 330, 339, 7, 330, 330, 330, 330, 330, 330, + + 342, 6, 339, 339, 339, 339, 339, 339, 5, 0, + 342, 342, 342, 342, 342, 342, 346, 346, 346, 346, + 346, 347, 0, 0, 0, 0, 0, 0, 346, 0, + 0, 347, 347, 347, 347, 347, 347, 358, 0, 0, + 0, 0, 346, 0, 0, 0, 0, 358, 358, 358, + 358, 358, 358, 359, 359, 359, 359, 359, 362, 0, + 0, 0, 0, 0, 359, 0, 359, 0, 362, 362, + 362, 362, 362, 362, 363, 0, 0, 368, 0, 359, + 0, 0, 0, 368, 363, 363, 363, 363, 363, 363, + 368, 0, 368, 372, 0, 0, 0, 368, 368, 373, + + 0, 368, 0, 372, 372, 372, 372, 372, 372, 373, + 373, 373, 373, 373, 373, 374, 0, 0, 0, 0, + 0, 375, 0, 0, 0, 374, 374, 374, 374, 374, + 374, 375, 375, 375, 375, 375, 375, 387, 0, 0, + 0, 0, 0, 388, 0, 0, 0, 387, 387, 387, + 387, 387, 387, 388, 388, 388, 388, 388, 388, 389, + 0, 0, 0, 0, 0, 397, 0, 0, 0, 389, + 389, 389, 389, 389, 389, 397, 397, 397, 397, 397, + 397, 398, 0, 0, 0, 0, 0, 399, 0, 0, + 0, 398, 398, 398, 398, 398, 398, 399, 399, 399, + + 399, 399, 399, 400, 400, 400, 400, 400, 0, 0, + 409, 0, 0, 0, 0, 0, 0, 0, 0, 400, + 409, 409, 409, 409, 409, 409, 410, 0, 0, 400, + 411, 411, 411, 411, 411, 0, 410, 410, 410, 410, + 410, 410, 0, 0, 0, 0, 411, 413, 0, 0, + 414, 414, 414, 414, 414, 0, 411, 413, 413, 413, + 413, 413, 413, 414, 423, 423, 423, 423, 423, 0, + 427, 427, 427, 427, 427, 0, 414, 423, 0, 0, + 0, 0, 0, 427, 0, 0, 0, 428, 0, 0, + 423, 424, 424, 424, 424, 424, 427, 428, 428, 428, + + 428, 428, 428, 0, 424, 436, 436, 436, 436, 436, + 424, 0, 0, 0, 0, 0, 0, 424, 436, 0, + 424, 424, 424, 424, 424, 424, 437, 0, 0, 0, + 0, 436, 0, 0, 0, 0, 437, 437, 437, 437, + 437, 437, 438, 438, 438, 438, 438, 445, 0, 0, + 446, 446, 446, 446, 446, 438, 0, 445, 445, 445, + 445, 445, 445, 446, 0, 0, 0, 447, 438, 439, + 439, 439, 439, 439, 0, 0, 446, 447, 447, 447, + 447, 447, 447, 0, 0, 0, 0, 0, 439, 0, + 0, 0, 0, 0, 452, 0, 0, 0, 439, 439, + + 439, 439, 439, 439, 452, 452, 452, 452, 452, 452, + 453, 0, 0, 0, 0, 0, 458, 0, 0, 0, + 453, 453, 453, 453, 453, 453, 458, 458, 458, 458, + 458, 458, 459, 0, 0, 0, 0, 0, 464, 0, + 0, 0, 459, 459, 459, 459, 459, 459, 464, 464, + 464, 464, 464, 464, 465, 0, 0, 0, 0, 0, + 469, 0, 0, 0, 465, 465, 465, 465, 465, 465, + 469, 469, 469, 469, 469, 469, 479, 0, 479, 479, + 479, 479, 479, 479, 479, 479, 479, 480, 480, 0, + 480, 480, 481, 0, 481, 481, 481, 481, 481, 481, + + 481, 481, 481, 482, 482, 0, 482, 482, 483, 0, + 0, 483, 483, 484, 484, 484, 484, 484, 484, 484, + 484, 484, 485, 0, 485, 485, 0, 485, 485, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, - 486, 488, 488, 0, 488, 488, 489, 489, 489, 489, - 489, 489, 489, 489, 489, 489, 490, 490, 490, 490, - 490, 490, 490, 490, 490, 490, 490, 490, 490, 491, - 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, - 491, 491, 491, 493, 493, 0, 493, 493, 494, 494, - 494, 494, 494, 494, 494, 494, 494, 494, 495, 495, - 0, 495, 495, 496, 496, 496, 496, 496, 496, 496, - - 496, 496, 496, 497, 497, 497, 497, 497, 497, 497, - 497, 497, 497, 498, 498, 498, 500, 500, 500, 500, - 500, 500, 500, 500, 500, 500, 501, 501, 0, 501, - 501, 501, 501, 501, 501, 501, 501, 501, 501, 502, + 487, 487, 487, 487, 487, 487, 487, 487, 487, 488, + 488, 0, 488, 488, 489, 489, 489, 489, 489, 489, + 489, 489, 489, 489, 489, 490, 490, 490, 490, 490, + 490, 490, 490, 490, 490, 490, 490, 491, 491, 492, + 492, 492, 492, 492, 492, 492, 492, 492, 493, 493, + 0, 493, 493, 494, 494, 494, 494, 494, 494, 494, + + 494, 494, 495, 495, 0, 495, 495, 496, 496, 496, + 496, 496, 496, 496, 496, 496, 497, 497, 497, 497, + 497, 497, 497, 497, 497, 498, 498, 498, 498, 498, + 498, 498, 498, 498, 498, 498, 498, 499, 499, 499, + 499, 499, 499, 499, 499, 499, 500, 500, 500, 500, + 500, 500, 500, 500, 500, 501, 501, 501, 0, 501, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, - 502, 502, 503, 503, 503, 503, 503, 503, 503, 503, - 503, 503, 503, 503, 503, 503, 504, 504, 504, 504, - 504, 504, 504, 504, 504, 504, 504, 504, 504, 504, - 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, - 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, - - 507, 507, 507, 507, 508, 0, 0, 508, 508, 508, - 508, 508, 508, 508, 508, 508, 508, 510, 510, 510, - 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, - 510, 512, 512, 512, 512, 513, 513, 513, 513, 513, - 513, 0, 513, 513, 513, 513, 513, 513, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 516, 516, 516, 516, 516, 516, 516, 516, 516, - 516, 516, 516, 516, 516, 518, 518, 518, 518, 519, - 519, 519, 519, 519, 519, 0, 519, 519, 519, 519, - 519, 519, 520, 0, 0, 520, 520, 520, 520, 520, - - 520, 520, 520, 520, 520, 521, 0, 0, 521, 521, - 521, 521, 521, 521, 521, 521, 521, 521, 522, 522, - 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, - 522, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 525, 525, 0, 525, 525, 526, - 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, - 526, 526, 528, 528, 528, 528, 529, 529, 529, 529, - 529, 529, 529, 529, 529, 529, 529, 529, 529, 530, - 0, 0, 530, 530, 530, 530, 530, 530, 530, 530, - 530, 530, 531, 531, 531, 531, 531, 531, 531, 531, - - 531, 531, 531, 531, 531, 532, 532, 532, 532, 532, - 0, 0, 532, 532, 532, 532, 532, 532, 533, 533, - 533, 533, 533, 533, 533, 533, 533, 533, 533, 533, - 533, 534, 534, 534, 534, 534, 534, 534, 534, 534, - 534, 534, 534, 534, 535, 535, 0, 535, 535, 536, - 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, - 536, 536, 538, 538, 538, 538, 539, 539, 0, 539, - 539, 539, 539, 539, 539, 539, 539, 539, 539, 540, - 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, - 540, 540, 541, 541, 0, 541, 541, 541, 541, 541, - - 541, 541, 541, 541, 541, 542, 542, 542, 542, 542, - 542, 542, 542, 542, 542, 542, 542, 542, 543, 543, - 543, 543, 543, 0, 0, 543, 543, 543, 543, 543, - 543, 546, 546, 546, 546, 0, 0, 0, 0, 546, - 0, 0, 546, 546, 547, 547, 547, 547, 0, 0, - 0, 547, 547, 547, 0, 547, 547, 548, 548, 548, - 548, 548, 548, 548, 548, 548, 548, 549, 549, 549, - 549, 549, 549, 549, 549, 549, 549, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 502, 502, 503, 503, 503, 0, 503, 504, 504, 504, + 504, 0, 504, 504, 504, 504, 504, 504, 505, 505, + 505, 0, 505, 506, 0, 506, 506, 506, 506, 506, + + 506, 506, 506, 506, 507, 0, 507, 507, 507, 507, + 507, 507, 507, 507, 507, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 509, 509, 509, 0, + 509, 510, 510, 510, 510, 510, 510, 510, 510, 510, + 510, 510, 511, 511, 511, 511, 511, 511, 511, 511, + 511, 511, 511, 512, 512, 512, 0, 512, 513, 513, + 513, 0, 0, 0, 513, 0, 0, 513, 513, 514, + 514, 514, 514, 514, 514, 514, 514, 514, 515, 515, + 515, 0, 0, 515, 515, 515, 0, 515, 515, 516, + 516, 516, 516, 516, 516, 516, 516, 516, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478 + 478, 478, 478, 478, 478, 478, 478, 478, 478 } ; #line 1 "" @@ -1813,7 +878,7 @@ YY_DECL yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 6578 ); + while ( yy_base[yy_current_state] != 2399 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -2185,7 +1250,7 @@ YY_RULE_SETUP #line 110 "" ECHO; YY_BREAK -#line 2738 "" +#line 1761 "" case YY_STATE_EOF(INITIAL): case YY_END_OF_BUFFER: case YY_STATE_EOF(mediaquery): -- cgit v0.12 From 33cfbbe50e2da5b6cdebb169613a6d975c4b2a1a Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 19 May 2009 19:05:26 +0200 Subject: Mentioned the new fancy browser example in the changes-4.5.2. Reviewed-by: TrustMe --- dist/changes-4.5.2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/changes-4.5.2 b/dist/changes-4.5.2 index a132028..d467b95 100644 --- a/dist/changes-4.5.2 +++ b/dist/changes-4.5.2 @@ -24,6 +24,8 @@ General Improvements -------------------- - Documentation and Examples + * Added a new example (fancy browser) which shows how to use jQuery + in QtWebKit. Third party components ---------------------- -- cgit v0.12 From 25952e13fb840cd1af3e1adbf60369b587e91fba Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 19 May 2009 19:13:30 +0200 Subject: Revert commit a372fc602a3cb09379875ced99ec969c371917d7. This was accidentally committed. --- .../webkit/WebCore/generated/CSSPropertyNames.cpp | 5 +- .../webkit/WebCore/generated/CSSValueKeywords.c | 5 +- src/3rdparty/webkit/WebCore/generated/ColorData.c | 5 +- .../webkit/WebCore/generated/DocTypeStrings.cpp | 5 +- .../webkit/WebCore/generated/HTMLEntityNames.c | 5 +- .../webkit/WebCore/generated/tokenizer.cpp | 2315 ++++++++++++++------ 6 files changed, 1645 insertions(+), 695 deletions(-) diff --git a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp index ca4ea5a..25313ac 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp +++ b/src/3rdparty/webkit/WebCore/generated/CSSPropertyNames.cpp @@ -1,4 +1,4 @@ -/* ANSI-C code produced by gperf version 3.0.2 */ +/* ANSI-C code produced by gperf version 3.0.3 */ /* Command-line: gperf -a -L ANSI-C -E -C -c -o -t --key-positions='*' -NfindProp -Hhash_prop -Wwordlist_prop -D -s 2 CSSPropertyNames.gperf */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -217,6 +217,9 @@ hash_prop (register const char *str, register unsigned int len) #ifdef __GNUC__ __inline +#ifdef __GNUC_STDC_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif #endif const struct props * findProp (register const char *str, register unsigned int len) diff --git a/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c b/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c index d0433e0..5ff0858 100644 --- a/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c +++ b/src/3rdparty/webkit/WebCore/generated/CSSValueKeywords.c @@ -1,4 +1,4 @@ -/* ANSI-C code produced by gperf version 3.0.2 */ +/* ANSI-C code produced by gperf version 3.0.3 */ /* Command-line: gperf -L ANSI-C -E -C -n -o -t --key-positions='*' -NfindValue -Hhash_val -Wwordlist_value -D CSSValueKeywords.gperf */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -179,6 +179,9 @@ hash_val (register const char *str, register unsigned int len) #ifdef __GNUC__ __inline +#ifdef __GNUC_STDC_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif #endif const struct css_value * findValue (register const char *str, register unsigned int len) diff --git a/src/3rdparty/webkit/WebCore/generated/ColorData.c b/src/3rdparty/webkit/WebCore/generated/ColorData.c index 18d9926..478566c 100644 --- a/src/3rdparty/webkit/WebCore/generated/ColorData.c +++ b/src/3rdparty/webkit/WebCore/generated/ColorData.c @@ -1,5 +1,5 @@ #include // bogus -/* ANSI-C code produced by gperf version 3.0.2 */ +/* ANSI-C code produced by gperf version 3.0.3 */ /* Command-line: gperf -CDEot -L ANSI-C --key-positions='*' -N findColor -D -s 2 */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -141,6 +141,9 @@ hash (register const char *str, register unsigned int len) #ifdef __GNUC__ __inline +#ifdef __GNUC_STDC_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif #endif const struct NamedColor * findColor (register const char *str, register unsigned int len) diff --git a/src/3rdparty/webkit/WebCore/generated/DocTypeStrings.cpp b/src/3rdparty/webkit/WebCore/generated/DocTypeStrings.cpp index ad63b9e..686629c 100644 --- a/src/3rdparty/webkit/WebCore/generated/DocTypeStrings.cpp +++ b/src/3rdparty/webkit/WebCore/generated/DocTypeStrings.cpp @@ -1,5 +1,5 @@ #include // bogus -/* ANSI-C code produced by gperf version 3.0.2 */ +/* ANSI-C code produced by gperf version 3.0.3 */ /* Command-line: gperf -CEot -L ANSI-C --key-positions='*' -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -331,6 +331,9 @@ hash (register const char *str, register unsigned int len) #ifdef __GNUC__ __inline +#ifdef __GNUC_STDC_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif #endif const struct PubIDInfo * findDoctypeEntry (register const char *str, register unsigned int len) diff --git a/src/3rdparty/webkit/WebCore/generated/HTMLEntityNames.c b/src/3rdparty/webkit/WebCore/generated/HTMLEntityNames.c index 470c4cd..993e106 100644 --- a/src/3rdparty/webkit/WebCore/generated/HTMLEntityNames.c +++ b/src/3rdparty/webkit/WebCore/generated/HTMLEntityNames.c @@ -1,4 +1,4 @@ -/* ANSI-C code produced by gperf version 3.0.2 */ +/* ANSI-C code produced by gperf version 3.0.3 */ /* Command-line: gperf -a -L ANSI-C -C -G -c -o -t --key-positions='*' -N findEntity -D -s 2 */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -520,6 +520,9 @@ static const short lookup[] = #ifdef __GNUC__ __inline +#ifdef __GNUC_STDC_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif #endif const struct Entity * findEntity (register const char *str, register unsigned int len) diff --git a/src/3rdparty/webkit/WebCore/generated/tokenizer.cpp b/src/3rdparty/webkit/WebCore/generated/tokenizer.cpp index 1da1a0b..8462f51 100644 --- a/src/3rdparty/webkit/WebCore/generated/tokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/generated/tokenizer.cpp @@ -78,42 +78,42 @@ static yyconst flex_int16_t yy_accept[479] = { 0, 0, 0, 0, 0, 0, 0, 69, 67, 2, 2, 67, 67, 67, 67, 67, 67, 67, 67, 67, 56, - 67, 67, 67, 67, 15, 15, 15, 67, 67, 66, + 67, 67, 15, 15, 15, 67, 67, 67, 67, 66, 15, 15, 15, 65, 15, 2, 0, 0, 0, 14, - 0, 0, 0, 0, 18, 18, 8, 0, 0, 9, - 0, 0, 0, 15, 15, 15, 57, 0, 55, 0, - 0, 56, 0, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 16, 54, 54, 51, 54, 0, 0, - 0, 35, 35, 35, 35, 35, 35, 35, 15, 15, - 7, 62, 15, 0, 0, 15, 15, 0, 15, 6, + 0, 0, 0, 18, 18, 0, 8, 0, 0, 9, + 0, 0, 15, 15, 15, 0, 57, 0, 55, 0, + 0, 56, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 16, 54, 54, 51, 54, 0, 54, 0, 0, + 35, 35, 35, 35, 35, 35, 35, 0, 62, 15, + 0, 0, 15, 15, 0, 15, 15, 15, 7, 6, 5, 15, 15, 15, 15, 0, 0, 0, 14, 0, - 0, 0, 18, 18, 18, 0, 18, 0, 0, 14, - 0, 0, 4, 16, 15, 0, 0, 54, 54, 54, - 0, 54, 41, 54, 37, 39, 54, 52, 43, 54, - 42, 50, 54, 45, 44, 40, 54, 54, 0, 35, - 35, 35, 35, 0, 35, 35, 35, 35, 35, 35, - 15, 15, 15, 16, 15, 15, 63, 63, 15, 12, - 10, 15, 13, 0, 0, 0, 17, 18, 18, 18, - 17, 0, 0, 15, 0, 1, 54, 54, 54, 54, - 46, 54, 53, 16, 47, 54, 3, 35, 35, 35, - - 35, 35, 35, 35, 35, 35, 35, 15, 15, 58, - 0, 63, 63, 63, 62, 11, 0, 0, 0, 18, - 18, 18, 0, 15, 0, 0, 54, 54, 54, 48, - 49, 35, 35, 35, 35, 35, 35, 35, 35, 20, - 15, 15, 64, 63, 63, 63, 63, 0, 0, 0, - 0, 60, 0, 0, 0, 0, 18, 18, 18, 0, - 15, 54, 54, 38, 35, 35, 35, 35, 35, 35, - 21, 35, 15, 15, 64, 63, 63, 63, 63, 63, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, - 0, 0, 0, 0, 17, 18, 18, 17, 0, 15, - - 54, 54, 35, 35, 35, 35, 35, 19, 35, 15, - 15, 64, 63, 63, 63, 63, 63, 63, 0, 59, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 18, 18, 0, 15, 54, 54, 35, - 35, 35, 23, 35, 35, 15, 64, 63, 63, 63, + 0, 0, 18, 18, 0, 18, 18, 0, 0, 14, + 0, 0, 4, 16, 15, 0, 0, 54, 0, 41, + 54, 37, 39, 54, 52, 43, 54, 42, 50, 54, + 45, 44, 40, 54, 54, 54, 54, 54, 0, 35, + 35, 0, 35, 35, 35, 35, 35, 35, 35, 35, + 15, 15, 16, 15, 15, 63, 63, 15, 15, 12, + 10, 15, 13, 0, 0, 0, 17, 17, 18, 18, + 18, 0, 0, 15, 0, 1, 54, 54, 46, 54, + 53, 16, 47, 54, 54, 54, 3, 35, 35, 35, + + 35, 35, 35, 35, 35, 35, 35, 15, 58, 0, + 63, 63, 63, 62, 15, 11, 0, 0, 0, 18, + 18, 18, 0, 15, 0, 0, 54, 48, 49, 54, + 54, 35, 35, 35, 35, 35, 35, 35, 20, 35, + 15, 64, 63, 63, 63, 63, 0, 0, 0, 0, + 60, 0, 15, 0, 0, 0, 18, 18, 18, 0, + 15, 54, 54, 38, 35, 35, 35, 35, 35, 21, + 35, 35, 15, 64, 63, 63, 63, 63, 63, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, + 0, 15, 0, 0, 17, 17, 18, 18, 0, 15, + + 54, 54, 35, 35, 35, 35, 19, 35, 35, 15, + 64, 63, 63, 63, 63, 63, 63, 0, 59, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 15, 0, 0, 18, 18, 0, 15, 54, 54, 35, + 35, 23, 35, 35, 35, 15, 64, 63, 63, 63, 63, 63, 63, 63, 0, 59, 0, 0, 0, 59, 0, 0, 0, 0, 18, 15, 54, 35, 35, 35, 35, 64, 0, 0, 0, 36, 15, 35, 35, 35, @@ -122,7 +122,7 @@ static yyconst flex_int16_t yy_accept[479] = 35, 35, 35, 35, 35, 35, 35, 35, 0, 0, 0, 0, 0, 0, 35, 35, 35, 35, 25, 35, - 35, 35, 0, 0, 0, 61, 0, 0, 26, 35, + 35, 35, 0, 61, 0, 0, 0, 0, 26, 35, 35, 35, 35, 27, 35, 0, 0, 0, 0, 31, 35, 35, 35, 35, 0, 0, 0, 35, 35, 35, 35, 0, 0, 35, 35, 29, 35, 0, 0, 35, @@ -138,437 +138,909 @@ static yyconst flex_int32_t yy_ec[256] = 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 12, 18, 19, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 12, 22, 23, - 24, 25, 26, 27, 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, - 12, 28, 12, 29, 30, 12, 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, 12, 59, 1, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60 + 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, + 12, 54, 12, 55, 56, 12, 57, 58, 59, 60, + + 61, 62, 63, 64, 65, 37, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 12, 84, 1, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85 } ; -static yyconst flex_int32_t yy_meta[61] = +static yyconst flex_int32_t yy_meta[86] = { 0, - 1, 2, 3, 3, 3, 4, 5, 5, 5, 5, - 5, 5, 5, 6, 7, 5, 5, 8, 5, 5, - 9, 5, 5, 5, 5, 10, 5, 11, 5, 11, - 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 5, 5, 5, 11 + 1, 2, 3, 4, 4, 5, 6, 7, 6, 6, + 6, 6, 7, 8, 9, 6, 6, 10, 6, 6, + 11, 6, 6, 6, 6, 12, 6, 13, 13, 13, + 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 6, 14, 13, 13, 13, 13, + 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 6, 6, 6, 14 } ; -static yyconst flex_int16_t yy_base[517] = +static yyconst flex_int16_t yy_base[550] = { 0, - 0, 0, 39, 41, 1573, 1566, 1594, 2399, 62, 71, - 76, 61, 69, 1560, 78, 1559, 89, 1561, 1565, 132, - 1573, 91, 123, 1555, 80, 104, 97, 1554, 1551, 2399, - 85, 176, 175, 2399, 177, 193, 204, 1531, 84, 2399, - 242, 110, 180, 196, 1545, 205, 2399, 113, 277, 2399, - 1547, 72, 221, 133, 206, 234, 181, 1555, 1548, 1530, - 1528, 0, 268, 118, 1515, 221, 60, 240, 92, 230, - 95, 223, 244, 267, 238, 286, 1512, 268, 1521, 279, - 294, 1510, 278, 190, 290, 232, 292, 293, 308, 335, - 2399, 2399, 317, 326, 1516, 351, 336, 356, 366, 2399, - - 2399, 320, 367, 369, 370, 1478, 393, 327, 345, 420, - 455, 398, 1495, 490, 1481, 446, 481, 372, 365, 386, - 525, 560, 2399, 325, 388, 1491, 387, 1477, 595, 1476, - 516, 399, 1475, 34, 1472, 1461, 378, 1438, 1430, 318, - 1429, 1426, 323, 1424, 1423, 1422, 231, 387, 1430, 377, - 1411, 630, 1396, 551, 382, 108, 415, 408, 419, 412, - 586, 436, 665, 1400, 624, 456, 419, 1382, 457, 490, - 491, 625, 492, 1362, 526, 656, 672, 681, 1378, 716, - 707, 527, 723, 561, 1374, 2399, 732, 1346, 767, 437, - 1322, 410, 1312, 445, 1311, 546, 2399, 469, 758, 1303, - - 802, 576, 482, 580, 470, 440, 472, 793, 809, 2399, - 818, 515, 1288, 1273, 853, 552, 1205, 839, 855, 861, - 877, 883, 899, 645, 1227, 483, 905, 921, 612, 1183, - 1168, 609, 927, 943, 626, 517, 628, 508, 629, 1167, - 949, 965, 971, 550, 1167, 1157, 1123, 1006, 1020, 666, - 682, 2399, 1047, 1091, 1006, 1038, 1055, 1063, 1071, 1079, - 632, 1087, 1095, 1105, 539, 1103, 1111, 542, 543, 681, - 1097, 683, 1119, 1127, 1135, 585, 1091, 1083, 1067, 1039, - 721, 752, 772, 1170, 717, 1205, 1184, 1217, 1244, 1258, - 1285, 1320, 984, 1244, 2399, 1276, 1311, 917, 1328, 767, - - 1336, 1344, 733, 1352, 1360, 734, 578, 899, 582, 1395, - 1381, 1397, 623, 853, 822, 794, 793, 760, 807, 2399, - 875, 788, 1432, 1459, 1494, 818, 769, 1440, 1529, 1564, - 1438, 702, 1485, 919, 1520, 1555, 849, 963, 1572, 587, - 1299, 1580, 706, 441, 614, 1615, 1601, 715, 2399, 2399, - 2399, 2399, 2399, 2399, 1473, 839, 856, 1617, 1652, 804, - 852, 1638, 1654, 633, 1480, 871, 1508, 1650, 1542, 644, - 834, 1673, 1679, 1695, 1701, 2399, 1015, 872, 915, 916, - 877, 959, 704, 616, 586, 2399, 1717, 1723, 1739, 1002, - 1148, 514, 961, 989, 990, 1016, 1745, 1761, 1767, 1802, - - 1137, 1008, 1018, 1017, 985, 1129, 878, 1038, 1790, 1806, - 1829, 1211, 1827, 1849, 944, 1057, 1152, 787, 584, 615, - 1196, 918, 1863, 1890, 1279, 2399, 1869, 1867, 516, 1199, - 1154, 943, 1242, 515, 653, 1904, 1906, 1941, 1968, 480, - 945, 1200, 1149, 1214, 1927, 1949, 1947, 1239, 1301, 1207, - 1302, 1974, 1990, 1392, 1267, 411, 1354, 1996, 2012, 1310, - 376, 1241, 1039, 2018, 2034, 1338, 348, 1377, 2040, 1216, - 1391, 1421, 1394, 324, 1226, 1376, 263, 2399, 2075, 2080, - 2091, 2096, 2101, 2110, 2117, 2128, 2137, 2142, 2153, 2165, - 2167, 2176, 2181, 2190, 2195, 2204, 2213, 2225, 2234, 2243, - - 2248, 2260, 2265, 2276, 2281, 2292, 2303, 2314, 2319, 2330, - 2341, 2346, 2357, 2366, 2377, 2386 + 0, 0, 64, 66, 54, 56, 1407, 6578, 93, 98, + 107, 83, 155, 1376, 77, 1350, 99, 1345, 1328, 207, + 1334, 275, 100, 108, 125, 326, 1315, 1313, 1312, 6578, + 141, 110, 151, 6578, 105, 197, 295, 89, 107, 6578, + 387, 120, 0, 429, 1281, 471, 6578, 117, 532, 6578, + 1283, 269, 137, 176, 281, 574, 283, 1289, 1292, 1246, + 1257, 0, 1221, 249, 135, 282, 276, 153, 91, 169, + 299, 308, 318, 266, 1219, 320, 616, 102, 1246, 348, + 1209, 316, 127, 359, 346, 347, 375, 658, 6578, 208, + 700, 1241, 400, 409, 1220, 397, 327, 761, 6578, 6578, + + 6578, 411, 419, 414, 424, 248, 368, 355, 356, 822, + 883, 0, 1191, 925, 967, 1190, 1028, 381, 421, 464, + 1089, 1150, 6578, 214, 456, 1225, 312, 1151, 1192, 1142, + 442, 1139, 1134, 452, 1131, 1104, 458, 1082, 1060, 358, + 1046, 1028, 1027, 462, 453, 1000, 1253, 469, 1023, 463, + 986, 1295, 492, 486, 500, 484, 502, 513, 969, 1356, + 425, 1417, 1001, 545, 494, 193, 993, 543, 1459, 544, + 554, 558, 555, 508, 398, 1520, 0, 1562, 956, 1623, + 1684, 570, 1745, 563, 993, 6578, 948, 1806, 935, 520, + 921, 498, 914, 546, 1848, 564, 6578, 585, 913, 1909, + + 568, 576, 586, 606, 631, 640, 1951, 2012, 6578, 0, + 203, 924, 907, 694, 2054, 565, 543, 2115, 0, 2157, + 2218, 2279, 2340, 669, 912, 505, 2401, 856, 840, 2443, + 612, 615, 2504, 608, 557, 639, 682, 668, 839, 2546, + 2607, 0, 288, 863, 841, 819, 741, 794, 573, 418, + 6578, 2668, 2710, 620, 2771, 0, 2813, 2874, 2935, 2996, + 3057, 3131, 3173, 3234, 670, 3295, 718, 719, 729, 763, + 684, 3337, 3398, 0, 456, 782, 777, 760, 742, 829, + 649, 834, 3459, 572, 3520, 854, 894, 915, 920, 3581, + 3642, 3684, 593, 3745, 6578, 697, 3806, 3867, 3928, 3989, + + 4050, 4111, 730, 4172, 731, 683, 672, 759, 4214, 4275, + 0, 762, 682, 429, 417, 414, 411, 859, 6578, 650, + 838, 957, 4336, 4397, 607, 926, 988, 4458, 4519, 4580, + 1002, 672, 1010, 4622, 4664, 1042, 752, 4706, 4767, 756, + 4828, 376, 812, 847, 1069, 1033, 0, 387, 6578, 6578, + 6578, 6578, 6578, 6578, 1122, 924, 963, 4870, 1162, 1049, + 1050, 4912, 4973, 678, 1063, 850, 1074, 5005, 1103, 841, + 989, 0, 5062, 5104, 5146, 6578, 1066, 1080, 1081, 1084, + 1108, 1137, 877, 328, 273, 6578, 5188, 5230, 5272, 641, + 1140, 884, 916, 836, 1105, 1161, 5314, 5356, 1233, 1286, + + 1147, 1138, 919, 1206, 1165, 1186, 1141, 1207, 1291, 1263, + 1316, 1345, 1327, 5398, 1086, 1029, 1225, 1133, 258, 1247, + 1248, 1310, 1388, 6578, 1427, 5440, 1449, 5501, 242, 1311, + 1341, 1324, 1326, 173, 1317, 1454, 5562, 1480, 5604, 170, + 1061, 1328, 1355, 1372, 1552, 5646, 5688, 1351, 1374, 1389, + 1409, 5730, 5772, 1419, 1456, 154, 1453, 5814, 5856, 1457, + 112, 897, 793, 5898, 1557, 1418, 109, 1348, 1582, 1550, + 1477, 1481, 1485, 90, 1564, 1458, 39, 6578, 5959, 5964, + 5977, 5982, 5987, 5994, 6004, 6017, 296, 6022, 6032, 6045, + 6059, 651, 6064, 6074, 6079, 6089, 6099, 6103, 571, 6112, + + 6125, 6138, 6152, 6166, 6176, 6186, 6191, 6203, 657, 6217, + 758, 6222, 6234, 6247, 801, 6261, 859, 6266, 6278, 6291, + 6304, 6317, 6330, 1086, 6335, 6348, 1120, 6353, 6365, 6378, + 6391, 6404, 6417, 6430, 6435, 6448, 1216, 6453, 6465, 6478, + 6491, 6504, 6517, 1219, 1220, 6530, 6543, 6553, 6563 } ; -static yyconst flex_int16_t yy_def[517] = +static yyconst flex_int16_t yy_def[550] = { 0, 478, 1, 1, 1, 1, 1, 478, 478, 478, 478, 478, 479, 480, 478, 481, 478, 482, 478, 478, 478, - 478, 483, 484, 478, 485, 485, 485, 478, 478, 478, - 485, 485, 485, 478, 485, 478, 478, 478, 479, 478, - 486, 480, 478, 487, 488, 488, 478, 481, 489, 478, - 478, 478, 484, 485, 485, 485, 20, 490, 478, 491, - 478, 20, 492, 493, 493, 493, 493, 493, 493, 493, - 493, 493, 493, 493, 493, 493, 493, 493, 478, 483, - 494, 495, 495, 495, 495, 495, 495, 495, 485, 485, - 478, 478, 485, 496, 478, 485, 485, 478, 485, 478, - - 478, 485, 485, 485, 485, 478, 479, 479, 479, 479, - 486, 478, 488, 46, 488, 497, 46, 481, 481, 481, - 481, 489, 478, 478, 485, 490, 498, 493, 493, 493, - 499, 493, 493, 493, 493, 493, 493, 493, 493, 493, + 478, 483, 484, 484, 484, 485, 478, 478, 478, 478, + 484, 484, 484, 478, 484, 478, 478, 478, 479, 478, + 486, 480, 487, 488, 488, 489, 478, 481, 490, 478, + 478, 478, 484, 484, 484, 485, 20, 491, 478, 492, + 478, 20, 493, 493, 493, 493, 493, 493, 493, 493, + 493, 493, 493, 493, 493, 493, 494, 493, 478, 483, + 495, 495, 495, 495, 495, 495, 495, 496, 478, 484, + 497, 478, 484, 484, 498, 484, 484, 484, 478, 478, + + 478, 484, 484, 484, 484, 478, 479, 479, 479, 479, + 486, 499, 488, 488, 500, 488, 114, 501, 501, 501, + 501, 502, 478, 478, 484, 503, 504, 493, 505, 493, + 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 493, 478, 495, - 495, 495, 495, 500, 495, 495, 495, 495, 495, 495, - 90, 485, 90, 478, 485, 485, 501, 478, 485, 485, - 485, 485, 485, 478, 479, 110, 478, 114, 488, 114, - 46, 481, 121, 485, 502, 478, 129, 493, 129, 493, - 493, 493, 493, 493, 493, 493, 478, 495, 152, 495, - - 152, 495, 495, 495, 495, 495, 495, 90, 163, 478, - 478, 503, 478, 478, 504, 485, 478, 110, 478, 114, - 180, 46, 121, 485, 502, 498, 129, 189, 493, 493, - 493, 495, 152, 201, 495, 495, 495, 495, 495, 495, - 90, 163, 478, 505, 478, 478, 478, 504, 504, 506, - 507, 478, 508, 478, 110, 478, 114, 180, 46, 121, - 485, 129, 189, 493, 495, 152, 201, 495, 495, 495, - 495, 495, 90, 163, 478, 509, 478, 478, 478, 478, - 478, 506, 478, 510, 507, 511, 504, 504, 504, 504, - 504, 508, 478, 110, 478, 114, 180, 488, 121, 485, - - 129, 189, 495, 152, 201, 495, 495, 495, 495, 485, - 163, 478, 512, 478, 478, 478, 478, 478, 478, 478, - 506, 506, 506, 506, 510, 507, 507, 507, 507, 511, - 291, 478, 110, 488, 180, 121, 485, 493, 189, 495, - 495, 201, 495, 495, 495, 485, 478, 478, 478, 478, - 478, 478, 478, 478, 506, 506, 506, 324, 507, 507, - 507, 329, 291, 478, 488, 485, 493, 495, 495, 495, - 495, 478, 324, 329, 291, 478, 485, 495, 495, 495, - 495, 495, 495, 495, 495, 478, 324, 329, 291, 485, - 495, 495, 495, 495, 495, 495, 324, 329, 291, 513, - - 495, 495, 495, 495, 495, 495, 495, 495, 324, 329, - 513, 411, 514, 515, 495, 495, 495, 495, 495, 495, - 495, 495, 515, 515, 478, 478, 515, 516, 495, 495, - 495, 495, 495, 495, 495, 515, 424, 515, 424, 495, - 495, 495, 495, 495, 424, 515, 439, 495, 495, 495, - 495, 424, 439, 495, 495, 495, 495, 424, 439, 495, - 495, 495, 495, 424, 439, 495, 495, 495, 439, 495, + 495, 506, 495, 495, 495, 495, 495, 495, 495, 495, + 484, 98, 478, 484, 484, 507, 478, 484, 98, 484, + 484, 484, 484, 478, 508, 508, 509, 114, 488, 114, + 114, 501, 501, 484, 510, 478, 493, 147, 493, 493, + 493, 493, 493, 493, 147, 493, 478, 495, 495, 160, + + 495, 495, 495, 495, 495, 495, 160, 98, 478, 511, + 512, 478, 478, 513, 98, 484, 478, 514, 515, 114, + 114, 114, 501, 484, 510, 516, 147, 493, 493, 147, + 493, 495, 160, 495, 495, 495, 495, 495, 495, 160, + 98, 517, 518, 478, 478, 478, 519, 519, 520, 521, + 478, 522, 98, 478, 523, 524, 525, 525, 258, 526, + 98, 147, 147, 147, 495, 160, 495, 495, 495, 495, + 495, 160, 98, 527, 528, 478, 478, 478, 478, 478, + 520, 478, 529, 530, 531, 532, 532, 532, 532, 532, + 533, 98, 478, 534, 478, 535, 535, 297, 536, 98, + + 147, 301, 495, 160, 495, 495, 495, 495, 160, 98, + 537, 538, 478, 478, 478, 478, 478, 478, 478, 539, + 539, 539, 539, 540, 541, 541, 541, 541, 542, 543, + 300, 478, 534, 297, 298, 536, 300, 301, 301, 495, + 160, 495, 495, 495, 495, 300, 544, 478, 478, 478, + 478, 478, 478, 478, 539, 539, 539, 323, 541, 541, + 541, 328, 543, 478, 335, 300, 339, 495, 495, 495, + 495, 545, 323, 328, 363, 478, 300, 495, 495, 495, + 495, 495, 495, 495, 495, 478, 323, 328, 363, 300, + 495, 495, 495, 495, 495, 495, 323, 328, 543, 546, + + 495, 495, 495, 495, 495, 495, 495, 495, 539, 541, + 546, 546, 547, 548, 495, 495, 495, 495, 495, 495, + 495, 495, 478, 478, 547, 549, 547, 547, 495, 495, + 495, 495, 495, 495, 495, 547, 428, 547, 428, 495, + 495, 495, 495, 495, 547, 437, 428, 495, 495, 495, + 495, 437, 428, 495, 495, 495, 495, 437, 428, 495, + 495, 495, 495, 437, 547, 495, 495, 495, 547, 495, 495, 495, 495, 495, 495, 495, 495, 0, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478 + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478 } ; -static yyconst flex_int16_t yy_nxt[2460] = +static yyconst flex_int16_t yy_nxt[6664] = { 0, 8, 9, 10, 9, 9, 9, 11, 12, 13, 14, 8, 8, 15, 8, 8, 16, 8, 17, 18, 19, - 20, 8, 21, 8, 8, 8, 22, 23, 24, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 26, 25, 25, 25, 25, 25, 25, - 27, 25, 25, 25, 25, 25, 8, 28, 29, 25, - 30, 131, 30, 36, 36, 36, 36, 36, 40, 31, - 191, 31, 36, 36, 36, 36, 36, 37, 37, 37, - 37, 37, 32, 33, 32, 33, 42, 131, 41, 43, - 40, 40, 52, 92, 134, 34, 44, 34, 92, 46, - - 46, 46, 46, 46, 46, 49, 51, 94, 80, 52, - 92, 41, 94, 98, 38, 124, 53, 92, 81, 131, - 95, 96, 131, 83, 94, 40, 84, 478, 102, 85, - 478, 94, 55, 86, 87, 154, 88, 44, 139, 137, - 49, 56, 59, 90, 99, 131, 92, 132, 97, 60, - 61, 203, 62, 90, 90, 90, 90, 90, 90, 63, - 94, 64, 65, 65, 66, 67, 68, 65, 69, 70, - 71, 65, 72, 65, 73, 74, 65, 75, 65, 76, - 77, 78, 65, 65, 65, 65, 65, 65, 92, 92, - 92, 65, 95, 96, 36, 36, 36, 36, 36, 478, - - 112, 57, 94, 94, 94, 37, 37, 37, 37, 37, - 112, 112, 112, 112, 112, 112, 114, 154, 104, 92, - 103, 105, 95, 96, 65, 117, 114, 114, 114, 114, - 114, 114, 116, 94, 156, 117, 117, 117, 117, 117, - 117, 90, 38, 39, 39, 39, 107, 92, 131, 109, - 131, 90, 90, 90, 90, 90, 90, 131, 131, 154, - 140, 94, 110, 133, 195, 131, 158, 131, 125, 111, - 144, 131, 110, 110, 110, 110, 110, 110, 48, 48, - 48, 118, 135, 95, 143, 138, 141, 145, 129, 120, - 154, 146, 142, 136, 131, 131, 478, 121, 129, 129, - - 129, 129, 129, 129, 122, 154, 81, 121, 121, 121, - 121, 121, 121, 131, 152, 155, 147, 154, 148, 154, - 154, 92, 159, 160, 152, 152, 152, 152, 152, 152, - 92, 150, 157, 92, 40, 94, 89, 89, 89, 89, - 89, 95, 95, 194, 94, 131, 163, 94, 92, 92, - 131, 154, 40, 170, 41, 161, 163, 163, 163, 163, - 163, 163, 94, 94, 92, 161, 161, 161, 161, 161, - 161, 165, 41, 193, 48, 154, 167, 40, 94, 92, - 92, 168, 92, 92, 40, 166, 167, 167, 167, 167, - 167, 167, 49, 94, 94, 39, 94, 94, 40, 49, - - 40, 92, 127, 154, 154, 131, 186, 169, 192, 154, - 172, 198, 202, 49, 131, 94, 171, 173, 177, 184, - 41, 108, 175, 175, 175, 108, 131, 40, 177, 177, - 177, 177, 177, 177, 196, 154, 211, 131, 154, 154, - 176, 205, 154, 230, 213, 190, 154, 41, 207, 92, - 176, 176, 176, 176, 176, 176, 39, 39, 39, 107, - 204, 206, 109, 94, 131, 194, 180, 154, 154, 210, - 215, 229, 131, 370, 239, 110, 180, 180, 180, 180, - 180, 180, 111, 94, 94, 110, 110, 110, 110, 110, - 110, 113, 113, 113, 113, 113, 154, 154, 226, 154, - - 232, 181, 186, 92, 210, 92, 240, 154, 238, 154, - 178, 181, 181, 181, 181, 181, 181, 94, 94, 94, - 178, 178, 178, 178, 178, 178, 119, 182, 182, 182, - 119, 236, 211, 40, 269, 154, 189, 40, 271, 40, - 245, 154, 154, 154, 154, 183, 189, 189, 189, 189, - 189, 189, 49, 41, 49, 183, 183, 183, 183, 183, - 183, 48, 48, 48, 118, 92, 154, 211, 403, 154, - 154, 201, 120, 131, 92, 277, 306, 303, 307, 94, - 121, 201, 201, 201, 201, 201, 201, 122, 94, 231, - 121, 121, 121, 121, 121, 121, 128, 128, 128, 128, - - 128, 224, 211, 154, 368, 154, 208, 154, 344, 154, - 314, 154, 345, 154, 154, 187, 208, 208, 208, 208, - 208, 208, 131, 235, 237, 187, 187, 187, 187, 187, - 187, 151, 151, 151, 151, 151, 154, 92, 92, 131, - 211, 154, 154, 154, 165, 92, 371, 433, 349, 265, - 199, 94, 94, 154, 264, 154, 154, 154, 92, 94, - 199, 199, 199, 199, 199, 199, 162, 162, 162, 162, - 162, 154, 94, 283, 268, 270, 218, 272, 384, 216, - 154, 300, 376, 261, 444, 209, 218, 218, 218, 218, - 218, 218, 219, 284, 283, 209, 209, 209, 209, 209, - - 209, 220, 219, 219, 219, 219, 219, 219, 154, 286, - 154, 220, 220, 220, 220, 220, 220, 179, 179, 179, - 179, 179, 281, 281, 281, 281, 281, 222, 309, 283, - 308, 154, 211, 154, 396, 252, 221, 222, 222, 222, - 222, 222, 222, 223, 286, 364, 221, 221, 221, 221, - 221, 221, 227, 223, 223, 223, 223, 223, 223, 283, - 154, 154, 227, 227, 227, 227, 227, 227, 188, 188, - 188, 188, 188, 319, 319, 319, 319, 319, 233, 284, - 92, 283, 340, 343, 337, 354, 320, 228, 233, 233, - 233, 233, 233, 233, 94, 283, 286, 228, 228, 228, - - 228, 228, 228, 200, 200, 200, 200, 200, 319, 319, - 319, 319, 319, 241, 154, 284, 283, 432, 353, 352, - 285, 320, 234, 241, 241, 241, 241, 241, 241, 242, - 283, 286, 234, 234, 234, 234, 234, 234, 243, 242, - 242, 242, 242, 242, 242, 286, 283, 351, 243, 243, - 243, 243, 243, 243, 248, 248, 248, 248, 248, 255, - 250, 154, 92, 283, 283, 251, 284, 252, 385, 255, - 255, 255, 255, 255, 255, 256, 94, 282, 350, 286, - 253, 257, 283, 284, 92, 256, 256, 256, 256, 256, - 256, 257, 257, 257, 257, 257, 257, 258, 94, 154, - - 366, 377, 284, 259, 154, 154, 391, 258, 258, 258, - 258, 258, 258, 259, 259, 259, 259, 259, 259, 260, - 113, 113, 113, 113, 113, 262, 154, 394, 421, 260, - 260, 260, 260, 260, 260, 262, 262, 262, 262, 262, - 262, 263, 154, 154, 116, 154, 116, 266, 435, 392, - 393, 263, 263, 263, 263, 263, 263, 266, 266, 266, - 266, 266, 266, 267, 128, 128, 128, 128, 128, 273, - 154, 154, 154, 267, 267, 267, 267, 267, 267, 273, - 273, 273, 273, 273, 273, 274, 154, 448, 154, 442, - 131, 275, 429, 395, 404, 274, 274, 274, 274, 274, - - 274, 275, 275, 275, 275, 275, 275, 248, 248, 248, - 248, 248, 154, 250, 332, 400, 154, 154, 251, 419, - 252, 281, 281, 281, 281, 281, 294, 478, 92, 94, - 405, 406, 478, 253, 252, 154, 294, 294, 294, 294, - 294, 294, 94, 154, 154, 154, 416, 253, 281, 281, - 281, 281, 287, 417, 289, 418, 468, 407, 295, 289, - 289, 290, 390, 408, 318, 154, 154, 291, 295, 295, - 295, 295, 295, 295, 292, 296, 422, 291, 291, 291, - 291, 291, 291, 297, 154, 296, 296, 296, 296, 296, - 296, 298, 317, 297, 297, 297, 297, 297, 297, 299, - - 430, 298, 298, 298, 298, 298, 298, 301, 316, 299, - 299, 299, 299, 299, 299, 302, 315, 301, 301, 301, - 301, 301, 301, 304, 154, 302, 302, 302, 302, 302, - 302, 305, 131, 304, 304, 304, 304, 304, 304, 310, - 293, 305, 305, 305, 305, 305, 305, 311, 280, 310, - 310, 310, 310, 310, 310, 312, 154, 311, 311, 311, - 311, 311, 311, 420, 154, 312, 312, 312, 312, 312, - 312, 282, 282, 282, 321, 154, 154, 323, 415, 154, - 401, 154, 279, 402, 441, 281, 281, 281, 281, 281, - 324, 478, 278, 450, 154, 131, 478, 325, 252, 431, - - 324, 324, 324, 324, 324, 324, 285, 285, 285, 326, - 131, 253, 478, 478, 478, 478, 478, 328, 281, 281, - 281, 281, 281, 154, 478, 329, 154, 154, 478, 478, - 434, 252, 330, 440, 154, 329, 329, 329, 329, 329, - 329, 154, 226, 154, 253, 281, 281, 281, 281, 281, - 449, 478, 254, 154, 456, 451, 478, 472, 252, 281, - 281, 281, 281, 281, 333, 478, 154, 476, 154, 154, - 478, 253, 252, 454, 333, 333, 333, 333, 333, 333, - 425, 425, 425, 425, 425, 253, 287, 287, 287, 287, - 287, 443, 478, 426, 154, 467, 334, 478, 247, 252, - - 151, 151, 151, 151, 151, 331, 334, 334, 334, 334, - 334, 334, 253, 246, 462, 331, 331, 331, 331, 331, - 331, 281, 281, 281, 281, 287, 154, 289, 154, 154, - 154, 335, 289, 289, 290, 455, 457, 154, 131, 131, - 291, 335, 335, 335, 335, 335, 335, 292, 336, 131, - 291, 291, 291, 291, 291, 291, 338, 466, 336, 336, - 336, 336, 336, 336, 339, 154, 338, 338, 338, 338, - 338, 338, 341, 131, 339, 339, 339, 339, 339, 339, - 342, 154, 341, 341, 341, 341, 341, 341, 470, 226, - 342, 342, 342, 342, 342, 342, 89, 89, 89, 89, - - 89, 346, 463, 154, 154, 116, 217, 214, 92, 460, - 471, 346, 346, 346, 346, 346, 346, 347, 154, 154, - 164, 154, 94, 154, 477, 473, 475, 347, 347, 347, - 347, 347, 347, 355, 319, 319, 319, 355, 154, 283, - 461, 359, 319, 319, 319, 359, 356, 197, 154, 131, - 131, 131, 283, 131, 360, 474, 131, 131, 363, 284, - 322, 357, 357, 357, 322, 131, 283, 286, 363, 363, - 363, 363, 363, 363, 355, 319, 319, 319, 355, 358, - 283, 179, 179, 179, 179, 179, 284, 356, 131, 358, - 358, 358, 358, 358, 358, 282, 282, 282, 321, 131, - - 284, 323, 131, 131, 131, 39, 127, 116, 116, 188, - 188, 188, 188, 188, 324, 39, 39, 39, 39, 39, - 39, 325, 116, 174, 324, 324, 324, 324, 324, 324, - 327, 361, 361, 361, 327, 131, 164, 154, 149, 131, - 365, 283, 131, 200, 200, 200, 200, 200, 57, 362, - 365, 365, 365, 365, 365, 365, 286, 63, 59, 362, - 362, 362, 362, 362, 362, 285, 285, 285, 326, 154, - 127, 123, 116, 106, 101, 48, 328, 100, 91, 79, - 58, 57, 50, 47, 329, 48, 48, 48, 48, 48, - 48, 330, 367, 478, 329, 329, 329, 329, 329, 329, - - 369, 35, 367, 367, 367, 367, 367, 367, 35, 478, - 369, 369, 369, 369, 369, 369, 162, 162, 162, 162, - 162, 372, 478, 478, 478, 478, 478, 478, 92, 478, - 478, 372, 372, 372, 372, 372, 372, 373, 478, 478, - 478, 478, 94, 478, 478, 478, 478, 373, 373, 373, - 373, 373, 373, 359, 319, 319, 319, 359, 374, 478, - 478, 478, 478, 478, 283, 478, 360, 478, 374, 374, - 374, 374, 374, 374, 375, 478, 478, 154, 478, 286, - 478, 478, 478, 378, 375, 375, 375, 375, 375, 375, - 379, 478, 380, 386, 478, 478, 478, 381, 382, 387, - - 478, 383, 478, 386, 386, 386, 386, 386, 386, 387, - 387, 387, 387, 387, 387, 388, 478, 478, 478, 478, - 478, 389, 478, 478, 478, 388, 388, 388, 388, 388, - 388, 389, 389, 389, 389, 389, 389, 397, 478, 478, - 478, 478, 478, 398, 478, 478, 478, 397, 397, 397, - 397, 397, 397, 398, 398, 398, 398, 398, 398, 399, - 478, 478, 478, 478, 478, 409, 478, 478, 478, 399, - 399, 399, 399, 399, 399, 409, 409, 409, 409, 409, - 409, 410, 478, 478, 478, 478, 478, 249, 478, 478, - 478, 410, 410, 410, 410, 410, 410, 249, 249, 249, - - 249, 249, 249, 411, 411, 411, 411, 411, 478, 478, - 282, 478, 478, 478, 478, 478, 478, 478, 478, 412, - 282, 282, 282, 282, 282, 282, 285, 478, 478, 413, - 411, 411, 411, 411, 411, 478, 285, 285, 285, 285, - 285, 285, 478, 478, 478, 478, 412, 424, 478, 478, - 425, 425, 425, 425, 425, 478, 413, 424, 424, 424, - 424, 424, 424, 426, 425, 425, 425, 425, 425, 478, - 425, 425, 425, 425, 425, 478, 428, 426, 478, 478, - 478, 478, 478, 426, 478, 478, 478, 439, 478, 478, - 428, 436, 436, 436, 436, 436, 428, 439, 439, 439, - - 439, 439, 439, 478, 426, 425, 425, 425, 425, 425, - 437, 478, 478, 478, 478, 478, 478, 428, 426, 478, - 437, 437, 437, 437, 437, 437, 445, 478, 478, 478, - 478, 428, 478, 478, 478, 478, 445, 445, 445, 445, - 445, 445, 425, 425, 425, 425, 425, 452, 478, 478, - 425, 425, 425, 425, 425, 426, 478, 452, 452, 452, - 452, 452, 452, 426, 478, 478, 478, 453, 428, 446, - 446, 446, 446, 446, 478, 478, 428, 453, 453, 453, - 453, 453, 453, 478, 478, 478, 478, 478, 447, 478, - 478, 478, 478, 478, 458, 478, 478, 478, 447, 447, - - 447, 447, 447, 447, 458, 458, 458, 458, 458, 458, - 459, 478, 478, 478, 478, 478, 464, 478, 478, 478, - 459, 459, 459, 459, 459, 459, 464, 464, 464, 464, - 464, 464, 465, 478, 478, 478, 478, 478, 427, 478, - 478, 478, 465, 465, 465, 465, 465, 465, 427, 427, - 427, 427, 427, 427, 469, 478, 478, 478, 478, 478, - 427, 478, 478, 478, 469, 469, 469, 469, 469, 469, - 427, 427, 427, 427, 427, 427, 39, 478, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 45, 45, 478, - 45, 45, 48, 478, 48, 48, 48, 48, 48, 48, - - 48, 48, 48, 54, 54, 478, 54, 54, 82, 478, - 478, 82, 82, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 93, 478, 93, 93, 478, 93, 93, 108, + 20, 8, 21, 8, 8, 8, 22, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 24, 23, 23, 23, 23, 23, 23, 25, 23, 23, + 23, 23, 23, 26, 27, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 24, 23, + 23, 23, 23, 23, 23, 25, 23, 23, 23, 23, + 23, 8, 28, 29, 23, 30, 35, 30, 35, 40, + 40, 31, 152, 31, 36, 36, 36, 36, 36, 36, + + 36, 36, 36, 36, 32, 33, 32, 33, 37, 37, + 37, 37, 37, 89, 40, 35, 51, 35, 89, 52, + 31, 89, 31, 89, 92, 93, 92, 93, 106, 40, + 49, 136, 32, 33, 32, 33, 41, 478, 89, 54, + 478, 95, 38, 152, 129, 34, 105, 34, 55, 94, + 89, 103, 56, 91, 89, 129, 106, 148, 91, 136, + 41, 91, 152, 91, 89, 152, 131, 54, 154, 96, + 49, 38, 42, 46, 105, 43, 55, 94, 91, 103, + 152, 102, 44, 44, 44, 44, 44, 44, 129, 89, + 91, 104, 92, 93, 91, 131, 154, 96, 36, 36, + + 36, 36, 36, 137, 91, 135, 129, 152, 46, 102, + 210, 44, 44, 44, 44, 44, 44, 59, 212, 104, + 210, 89, 129, 152, 60, 61, 152, 62, 244, 91, + 92, 92, 137, 135, 63, 63, 64, 65, 66, 63, + 67, 68, 69, 63, 70, 63, 71, 72, 63, 73, + 63, 74, 75, 76, 63, 63, 63, 63, 63, 63, + 77, 91, 78, 63, 63, 64, 65, 66, 63, 67, + 68, 69, 70, 63, 71, 72, 63, 73, 63, 74, + 75, 76, 63, 63, 63, 63, 63, 63, 130, 52, + 174, 63, 80, 144, 89, 152, 37, 37, 37, 37, + + 37, 478, 129, 57, 82, 210, 112, 83, 112, 124, + 84, 152, 125, 276, 85, 86, 130, 87, 174, 129, + 134, 132, 144, 63, 92, 140, 152, 127, 88, 129, + 38, 186, 133, 82, 91, 129, 83, 124, 138, 84, + 89, 125, 85, 86, 139, 87, 98, 141, 134, 132, + 153, 63, 129, 98, 98, 98, 98, 98, 98, 38, + 133, 129, 40, 40, 142, 478, 138, 145, 143, 152, + 39, 129, 139, 129, 157, 40, 141, 156, 192, 153, + 91, 152, 98, 98, 98, 98, 98, 98, 39, 39, + 39, 107, 142, 40, 109, 145, 143, 150, 155, 152, + + 152, 88, 158, 157, 210, 40, 156, 110, 41, 41, + 89, 129, 152, 89, 110, 110, 110, 110, 110, 110, + 164, 41, 89, 478, 89, 150, 155, 89, 152, 152, + 282, 158, 89, 40, 49, 168, 354, 89, 89, 353, + 111, 170, 352, 110, 110, 110, 110, 110, 110, 114, + 91, 41, 172, 91, 351, 165, 114, 114, 114, 114, + 114, 114, 91, 168, 91, 171, 478, 91, 173, 89, + 170, 285, 91, 210, 49, 189, 40, 91, 91, 190, + 172, 313, 115, 165, 184, 114, 114, 114, 114, 114, + 114, 117, 193, 171, 198, 129, 173, 194, 117, 117, + + 117, 117, 117, 117, 189, 129, 129, 209, 190, 91, + 191, 129, 196, 184, 204, 129, 152, 49, 192, 201, + 226, 193, 129, 198, 186, 194, 202, 117, 117, 117, + 117, 117, 117, 48, 48, 48, 118, 152, 191, 152, + 196, 205, 203, 204, 120, 152, 206, 91, 201, 217, + 228, 129, 121, 152, 202, 152, 214, 89, 89, 121, + 121, 121, 121, 121, 121, 164, 152, 209, 89, 205, + 203, 89, 478, 129, 268, 206, 89, 217, 89, 228, + 282, 177, 40, 177, 282, 122, 229, 254, 121, 121, + 121, 121, 121, 121, 98, 231, 91, 91, 91, 129, + + 224, 98, 98, 98, 98, 98, 98, 91, 91, 216, + 152, 91, 234, 232, 229, 254, 91, 129, 91, 282, + 332, 152, 235, 49, 231, 285, 283, 236, 224, 152, + 98, 98, 98, 98, 98, 98, 147, 216, 152, 152, + 234, 237, 232, 147, 147, 147, 147, 147, 147, 332, + 235, 264, 265, 267, 400, 236, 282, 282, 90, 152, + 285, 152, 238, 63, 63, 129, 293, 219, 152, 219, + 237, 239, 147, 147, 147, 147, 147, 147, 160, 264, + 265, 267, 89, 269, 152, 160, 160, 160, 160, 160, + 160, 238, 152, 152, 293, 247, 247, 247, 247, 247, + + 239, 249, 283, 283, 261, 303, 250, 350, 251, 270, + 343, 269, 364, 271, 160, 160, 160, 160, 160, 160, + 162, 152, 91, 152, 376, 152, 308, 162, 162, 162, + 162, 162, 162, 261, 303, 152, 152, 152, 270, 343, + 364, 271, 247, 247, 247, 247, 247, 252, 249, 305, + 115, 306, 376, 250, 308, 251, 162, 162, 162, 162, + 162, 162, 97, 97, 97, 97, 97, 317, 242, 90, + 242, 152, 152, 368, 89, 307, 340, 342, 305, 210, + 306, 169, 152, 152, 152, 316, 344, 349, 169, 169, + 169, 169, 169, 169, 252, 280, 280, 280, 280, 280, + + 366, 478, 315, 307, 340, 342, 478, 314, 251, 152, + 468, 256, 152, 256, 91, 344, 152, 169, 169, 169, + 169, 169, 169, 108, 175, 175, 175, 108, 366, 40, + 280, 280, 280, 280, 280, 318, 318, 318, 318, 318, + 478, 370, 176, 251, 279, 282, 152, 252, 319, 176, + 176, 176, 176, 176, 176, 280, 280, 280, 280, 280, + 318, 318, 318, 318, 318, 152, 278, 90, 251, 274, + 370, 274, 384, 319, 405, 41, 371, 377, 176, 176, + 176, 176, 176, 176, 39, 39, 39, 107, 277, 152, + 109, 283, 152, 129, 152, 280, 280, 280, 280, 280, + + 152, 384, 405, 110, 396, 371, 377, 252, 251, 129, + 110, 110, 110, 110, 110, 110, 280, 280, 280, 280, + 280, 280, 280, 280, 280, 280, 478, 226, 478, 251, + 152, 282, 246, 396, 251, 403, 111, 152, 282, 110, + 110, 110, 110, 110, 110, 178, 404, 252, 467, 245, + 152, 417, 178, 178, 178, 178, 178, 178, 355, 318, + 318, 318, 355, 403, 282, 478, 152, 129, 252, 152, + 282, 356, 152, 252, 129, 404, 467, 283, 115, 285, + 417, 178, 178, 178, 178, 178, 178, 180, 129, 359, + 318, 318, 318, 359, 180, 180, 180, 180, 180, 180, + + 282, 129, 360, 97, 97, 97, 97, 97, 226, 115, + 283, 108, 175, 175, 175, 108, 283, 40, 213, 90, + 385, 163, 152, 180, 180, 180, 180, 180, 180, 116, + 116, 116, 116, 116, 161, 161, 161, 161, 161, 152, + 197, 285, 152, 119, 182, 182, 182, 119, 181, 385, + 90, 478, 478, 129, 40, 181, 181, 181, 181, 181, + 181, 282, 282, 41, 179, 179, 179, 179, 179, 430, + 159, 159, 159, 159, 159, 187, 187, 187, 187, 187, + 129, 129, 152, 90, 181, 181, 181, 181, 181, 181, + 119, 182, 182, 182, 119, 49, 295, 430, 295, 129, + + 448, 40, 285, 285, 199, 199, 199, 199, 199, 183, + 390, 391, 392, 129, 152, 393, 183, 183, 183, 183, + 183, 183, 152, 355, 318, 318, 318, 355, 448, 282, + 311, 429, 311, 152, 152, 129, 356, 152, 390, 152, + 391, 392, 49, 406, 393, 183, 183, 183, 183, 183, + 183, 48, 48, 48, 118, 394, 152, 129, 152, 429, + 432, 152, 120, 359, 318, 318, 318, 359, 395, 401, + 121, 406, 402, 416, 282, 283, 360, 121, 121, 121, + 121, 121, 121, 394, 129, 415, 152, 129, 421, 432, + 152, 152, 129, 152, 152, 129, 419, 395, 401, 407, + + 152, 402, 416, 122, 129, 408, 121, 121, 121, 121, + 121, 121, 188, 415, 152, 285, 421, 420, 152, 188, + 188, 188, 188, 188, 188, 419, 347, 407, 347, 372, + 386, 372, 386, 408, 286, 286, 286, 286, 286, 152, + 127, 418, 422, 115, 115, 167, 420, 251, 188, 188, + 188, 188, 188, 188, 146, 146, 146, 146, 146, 152, + 152, 163, 152, 149, 326, 361, 361, 361, 326, 431, + 418, 422, 129, 195, 129, 282, 433, 57, 152, 434, + 195, 195, 195, 195, 195, 195, 252, 411, 411, 411, + 411, 411, 321, 357, 357, 357, 321, 431, 282, 77, + + 152, 152, 59, 412, 127, 433, 129, 123, 434, 195, + 195, 195, 195, 195, 195, 200, 285, 411, 411, 411, + 411, 411, 200, 200, 200, 200, 200, 200, 423, 423, + 423, 423, 423, 412, 115, 101, 100, 435, 99, 414, + 79, 424, 440, 58, 283, 444, 478, 478, 478, 478, + 478, 200, 200, 200, 200, 200, 200, 159, 159, 159, + 159, 159, 478, 152, 152, 57, 435, 442, 441, 414, + 152, 440, 443, 50, 444, 449, 207, 152, 471, 152, + 426, 152, 454, 207, 207, 207, 207, 207, 207, 423, + 423, 423, 423, 423, 152, 442, 450, 441, 414, 47, + + 443, 152, 424, 449, 152, 455, 478, 471, 152, 152, + 451, 454, 207, 207, 207, 207, 207, 207, 161, 161, + 161, 161, 161, 478, 450, 152, 478, 152, 423, 423, + 423, 423, 423, 456, 455, 478, 460, 208, 451, 478, + 457, 424, 152, 478, 208, 208, 208, 208, 208, 208, + 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, + 478, 456, 152, 424, 461, 470, 478, 478, 424, 457, + 478, 152, 152, 208, 208, 208, 208, 208, 208, 215, + 426, 423, 423, 423, 423, 423, 215, 215, 215, 215, + 215, 215, 461, 470, 424, 478, 478, 478, 463, 478, + + 462, 466, 426, 477, 478, 478, 152, 426, 473, 152, + 152, 152, 474, 478, 475, 215, 215, 215, 215, 215, + 215, 108, 175, 175, 175, 108, 463, 40, 462, 466, + 152, 477, 478, 426, 152, 478, 478, 473, 152, 478, + 218, 474, 478, 475, 478, 478, 478, 218, 218, 218, + 218, 218, 218, 423, 423, 423, 423, 423, 438, 438, + 438, 438, 438, 478, 478, 478, 424, 478, 478, 478, + 478, 424, 478, 41, 478, 478, 218, 218, 218, 218, + 218, 218, 220, 445, 445, 445, 445, 445, 472, 220, + 220, 220, 220, 220, 220, 478, 424, 478, 478, 478, + + 478, 478, 476, 152, 478, 426, 478, 478, 478, 478, + 426, 478, 478, 478, 478, 478, 472, 152, 220, 220, + 220, 220, 220, 220, 179, 179, 179, 179, 179, 478, + 476, 478, 478, 478, 478, 426, 478, 478, 478, 478, + 478, 478, 478, 221, 478, 478, 478, 478, 478, 478, + 221, 221, 221, 221, 221, 221, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 221, + 221, 221, 221, 221, 221, 116, 116, 116, 116, 116, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 222, 478, 478, 478, 478, 478, + 478, 222, 222, 222, 222, 222, 222, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 222, 222, 222, 222, 222, 222, 119, 182, 182, 182, + 119, 478, 478, 478, 478, 478, 478, 40, 478, 478, + 478, 478, 478, 478, 478, 223, 478, 478, 478, 478, + 478, 478, 223, 223, 223, 223, 223, 223, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 49, 478, + + 478, 223, 223, 223, 223, 223, 223, 187, 187, 187, + 187, 187, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 227, 478, 478, 478, + 478, 478, 478, 227, 227, 227, 227, 227, 227, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 227, 227, 227, 227, 227, 227, 230, 478, + 478, 478, 478, 478, 478, 230, 230, 230, 230, 230, + 230, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 230, 230, 230, 230, 230, 230, + 199, 199, 199, 199, 199, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 233, + 478, 478, 478, 478, 478, 478, 233, 233, 233, 233, + 233, 233, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 233, 233, 233, 233, 233, + 233, 240, 478, 478, 478, 478, 478, 478, 240, 240, + 240, 240, 240, 240, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 478, 240, 240, 240, + 240, 240, 240, 161, 161, 161, 161, 161, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 241, 478, 478, 478, 478, 478, 478, 241, + 241, 241, 241, 241, 241, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 241, 241, + 241, 241, 241, 241, 253, 478, 478, 478, 478, 478, + 478, 253, 253, 253, 253, 253, 253, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 253, 253, 253, 253, 253, 253, 108, 175, 175, 175, + 108, 478, 40, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 255, 478, 478, 478, 478, + 478, 478, 255, 255, 255, 255, 255, 255, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 41, 478, + 478, 255, 255, 255, 255, 255, 255, 257, 478, 478, + 478, 478, 478, 478, 257, 257, 257, 257, 257, 257, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 257, 257, 257, 257, 257, 257, 179, + 179, 179, 179, 179, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 258, 478, + 478, 478, 478, 478, 478, 258, 258, 258, 258, 258, + 258, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 258, 258, 258, 258, 258, 258, + 116, 116, 116, 116, 116, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 259, + + 478, 478, 478, 478, 478, 478, 259, 259, 259, 259, + 259, 259, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 259, 259, 259, 259, 259, + 259, 119, 182, 182, 182, 119, 478, 478, 478, 478, + 478, 478, 40, 478, 478, 478, 478, 478, 478, 478, + 260, 478, 478, 478, 478, 478, 478, 260, 260, 260, + 260, 260, 260, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 49, 478, 478, 260, 260, 260, 260, + + 260, 260, 187, 187, 187, 187, 187, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 262, 478, 478, 478, 478, 478, 478, 262, 262, + 262, 262, 262, 262, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 262, 262, 262, + 262, 262, 262, 263, 478, 478, 478, 478, 478, 478, + 263, 263, 263, 263, 263, 263, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 263, + + 263, 263, 263, 263, 263, 199, 199, 199, 199, 199, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 266, 478, 478, 478, 478, 478, + 478, 266, 266, 266, 266, 266, 266, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 266, 266, 266, 266, 266, 266, 272, 478, 478, 478, + 478, 478, 478, 272, 272, 272, 272, 272, 272, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 272, 272, 272, 272, 272, 272, 161, 161, + 161, 161, 161, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 273, 478, 478, + 478, 478, 478, 478, 273, 273, 273, 273, 273, 273, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 273, 273, 273, 273, 273, 273, 280, + 280, 280, 280, 286, 478, 288, 478, 478, 478, 478, + 288, 288, 289, 478, 478, 478, 478, 478, 290, 478, + 478, 478, 478, 478, 478, 290, 290, 290, 290, 290, + + 290, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 291, 478, 478, 290, 290, 290, 290, 290, 290, + 292, 478, 478, 478, 478, 478, 478, 292, 292, 292, + 292, 292, 292, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 292, 292, 292, 292, + 292, 292, 108, 175, 175, 175, 108, 478, 40, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 294, 478, 478, 478, 478, 478, 478, 294, 294, + + 294, 294, 294, 294, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 41, 478, 478, 294, 294, 294, + 294, 294, 294, 296, 478, 478, 478, 478, 478, 478, + 296, 296, 296, 296, 296, 296, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 115, 478, 478, 296, + 296, 296, 296, 296, 296, 179, 179, 179, 179, 179, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 297, 478, 478, 478, 478, 478, + + 478, 297, 297, 297, 297, 297, 297, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 115, 478, 478, + 297, 297, 297, 297, 297, 297, 116, 116, 116, 116, + 116, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 298, 478, 478, 478, 478, + 478, 478, 298, 298, 298, 298, 298, 298, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 298, 298, 298, 298, 298, 298, 119, 182, 182, + + 182, 119, 478, 478, 478, 478, 478, 478, 40, 478, + 478, 478, 478, 478, 478, 478, 299, 478, 478, 478, + 478, 478, 478, 299, 299, 299, 299, 299, 299, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 49, + 478, 478, 299, 299, 299, 299, 299, 299, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 90, 478, 478, + 478, 478, 478, 478, 90, 90, 90, 90, 90, 90, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 300, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 90, 90, 90, 90, 90, 90, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 300, 187, 187, 187, 187, 187, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 301, 478, 478, 478, 478, 478, 478, 301, 301, + 301, 301, 301, 301, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 301, 301, 301, + 301, 301, 301, 302, 478, 478, 478, 478, 478, 478, + + 302, 302, 302, 302, 302, 302, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 302, + 302, 302, 302, 302, 302, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 128, 478, 478, 478, 478, 478, + 478, 128, 128, 128, 128, 128, 128, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 128, 128, 128, 128, 128, 128, 199, 199, 199, 199, + + 199, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 304, 478, 478, 478, 478, + 478, 478, 304, 304, 304, 304, 304, 304, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 304, 304, 304, 304, 304, 304, 309, 478, 478, + 478, 478, 478, 478, 309, 309, 309, 309, 309, 309, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 309, 309, 309, 309, 309, 309, 161, + + 161, 161, 161, 161, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 310, 478, + 478, 478, 478, 478, 478, 310, 310, 310, 310, 310, + 310, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 310, 310, 310, 310, 310, 310, + 281, 281, 281, 320, 478, 478, 322, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 323, + 478, 478, 478, 478, 478, 478, 323, 323, 323, 323, + 323, 323, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 324, 478, 478, 323, 323, 323, 323, 323, + 323, 284, 284, 284, 325, 478, 478, 478, 478, 478, + 478, 478, 327, 478, 478, 478, 478, 478, 478, 478, + 328, 478, 478, 478, 478, 478, 478, 328, 328, 328, + 328, 328, 328, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 329, 478, 478, 328, 328, 328, 328, + 328, 328, 286, 286, 286, 286, 286, 478, 478, 478, + 478, 478, 478, 478, 478, 251, 478, 478, 478, 478, + + 478, 330, 478, 478, 478, 478, 478, 478, 330, 330, + 330, 330, 330, 330, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 252, 478, 478, 330, 330, 330, + 330, 330, 330, 280, 280, 280, 280, 286, 478, 288, + 478, 478, 478, 478, 288, 288, 289, 478, 478, 478, + 478, 478, 290, 478, 478, 478, 478, 478, 478, 290, + 290, 290, 290, 290, 290, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 291, 478, 478, 290, 290, + + 290, 290, 290, 290, 331, 478, 478, 478, 478, 478, + 478, 331, 331, 331, 331, 331, 331, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 331, 331, 331, 331, 331, 331, 108, 175, 175, 175, + 108, 478, 40, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 333, 478, 478, 478, 478, + 478, 478, 333, 333, 333, 333, 333, 333, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 41, 478, + + 478, 333, 333, 333, 333, 333, 333, 179, 179, 179, + 179, 179, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 334, 478, 478, 478, + 478, 478, 478, 334, 334, 334, 334, 334, 334, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 115, + 478, 478, 334, 334, 334, 334, 334, 334, 116, 116, + 116, 116, 116, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 335, 478, 478, + 478, 478, 478, 478, 335, 335, 335, 335, 335, 335, + + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 335, 335, 335, 335, 335, 335, 119, + 182, 182, 182, 119, 478, 478, 478, 478, 478, 478, + 40, 478, 478, 478, 478, 478, 478, 478, 336, 478, + 478, 478, 478, 478, 478, 336, 336, 336, 336, 336, + 336, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 49, 478, 478, 336, 336, 336, 336, 336, 336, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 337, 478, 478, 90, + 478, 478, 478, 478, 478, 478, 90, 90, 90, 90, + 90, 90, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 90, 90, 90, 90, 90, + 90, 187, 187, 187, 187, 187, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 338, 478, 478, 478, 478, 478, 478, 338, 338, 338, + 338, 338, 338, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 338, 338, 338, 338, + 338, 338, 146, 146, 146, 146, 146, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 339, 478, 478, 478, 478, 478, 478, 339, 339, + 339, 339, 339, 339, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 339, 339, 339, + 339, 339, 339, 199, 199, 199, 199, 199, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 341, 478, 478, 478, 478, 478, 478, 341, + + 341, 341, 341, 341, 341, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 341, 341, + 341, 341, 341, 341, 345, 478, 478, 478, 478, 478, + 478, 345, 345, 345, 345, 345, 345, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 345, 345, 345, 345, 345, 345, 161, 161, 161, 161, + 161, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 346, 478, 478, 478, 478, + + 478, 478, 346, 346, 346, 346, 346, 346, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 346, 346, 346, 346, 346, 346, 321, 357, 357, + 357, 321, 478, 282, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 358, 478, 478, 478, + 478, 478, 478, 358, 358, 358, 358, 358, 358, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 283, + 478, 478, 358, 358, 358, 358, 358, 358, 281, 281, + + 281, 320, 478, 478, 322, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 323, 478, 478, + 478, 478, 478, 478, 323, 323, 323, 323, 323, 323, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 324, 478, 478, 323, 323, 323, 323, 323, 323, 326, + 361, 361, 361, 326, 478, 478, 478, 478, 478, 478, + 282, 478, 478, 478, 478, 478, 478, 478, 362, 478, + 478, 478, 478, 478, 478, 362, 362, 362, 362, 362, + 362, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 285, 478, 478, 362, 362, 362, 362, 362, 362, + 284, 284, 284, 325, 478, 478, 478, 478, 478, 478, + 478, 327, 478, 478, 478, 478, 478, 478, 478, 328, + 478, 478, 478, 478, 478, 478, 328, 328, 328, 328, + 328, 328, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 329, 478, 478, 328, 328, 328, 328, 328, + 328, 286, 286, 286, 286, 286, 478, 478, 478, 478, + 478, 478, 478, 478, 251, 478, 478, 478, 478, 478, + + 363, 478, 478, 478, 478, 478, 478, 363, 363, 363, + 363, 363, 363, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 252, 478, 478, 363, 363, 363, 363, + 363, 363, 365, 478, 478, 478, 478, 478, 478, 365, + 365, 365, 365, 365, 365, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 365, 365, + 365, 365, 365, 365, 113, 478, 478, 478, 478, 478, + 478, 113, 113, 113, 113, 113, 113, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 113, 113, 113, 113, 113, 113, 367, 478, 478, 478, + 478, 478, 478, 367, 367, 367, 367, 367, 367, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 367, 367, 367, 367, 367, 367, 146, 146, + 146, 146, 146, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 128, 478, 478, + 478, 478, 478, 478, 128, 128, 128, 128, 128, 128, + + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 128, 128, 128, 128, 128, 128, 199, + 199, 199, 199, 199, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 369, 478, + 478, 478, 478, 478, 478, 369, 369, 369, 369, 369, + 369, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 369, 369, 369, 369, 369, 369, + 373, 478, 478, 478, 478, 478, 478, 373, 373, 373, + + 373, 373, 373, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 373, 373, 373, 373, + 373, 373, 374, 478, 478, 478, 478, 478, 478, 374, + 374, 374, 374, 374, 374, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 374, 374, + 374, 374, 374, 374, 286, 286, 286, 286, 286, 478, + 478, 478, 478, 478, 478, 478, 478, 251, 478, 478, + 478, 478, 478, 375, 478, 478, 478, 478, 478, 478, + + 375, 375, 375, 375, 375, 375, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 252, 478, 478, 375, + 375, 375, 375, 375, 375, 378, 478, 478, 478, 478, + 478, 478, 379, 478, 380, 478, 478, 478, 478, 381, + 382, 478, 478, 383, 478, 478, 478, 478, 152, 478, + 478, 478, 478, 478, 378, 478, 478, 478, 478, 478, + 379, 478, 380, 478, 478, 478, 478, 381, 382, 478, + 478, 383, 387, 478, 478, 478, 478, 478, 478, 387, + 387, 387, 387, 387, 387, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 387, 387, + 387, 387, 387, 387, 388, 478, 478, 478, 478, 478, + 478, 388, 388, 388, 388, 388, 388, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 388, 388, 388, 388, 388, 388, 389, 478, 478, 478, + 478, 478, 478, 389, 389, 389, 389, 389, 389, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 389, 389, 389, 389, 389, 389, 397, 478, + 478, 478, 478, 478, 478, 397, 397, 397, 397, 397, + 397, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 397, 397, 397, 397, 397, 397, + 398, 478, 478, 478, 478, 478, 478, 398, 398, 398, + 398, 398, 398, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 398, 398, 398, 398, + 398, 398, 399, 478, 478, 478, 478, 478, 478, 399, + + 399, 399, 399, 399, 399, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 399, 399, + 399, 399, 399, 399, 409, 478, 478, 478, 478, 478, + 478, 409, 409, 409, 409, 409, 409, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 409, 409, 409, 409, 409, 409, 410, 478, 478, 478, + 478, 478, 478, 410, 410, 410, 410, 410, 410, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 410, 410, 410, 410, 410, 410, 428, 478, + 478, 478, 478, 478, 478, 428, 428, 428, 428, 428, + 428, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 428, 428, 428, 428, 428, 428, + 437, 478, 478, 478, 478, 478, 478, 437, 437, 437, + 437, 437, 437, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 437, 437, 437, 437, + + 437, 437, 438, 438, 438, 438, 438, 478, 478, 478, + 478, 478, 478, 478, 478, 424, 478, 478, 478, 478, + 478, 439, 478, 478, 478, 478, 478, 478, 439, 439, + 439, 439, 439, 439, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 426, 478, 478, 439, 439, 439, + 439, 439, 439, 445, 445, 445, 445, 445, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 446, 478, 478, 478, 478, 478, 478, 446, + 446, 446, 446, 446, 446, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 446, 446, + 446, 446, 446, 446, 447, 478, 478, 478, 478, 478, + 478, 447, 447, 447, 447, 447, 447, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 447, 447, 447, 447, 447, 447, 452, 478, 478, 478, + 478, 478, 478, 452, 452, 452, 452, 452, 452, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 452, 452, 452, 452, 452, 452, 453, 478, + 478, 478, 478, 478, 478, 453, 453, 453, 453, 453, + 453, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 453, 453, 453, 453, 453, 453, + 458, 478, 478, 478, 478, 478, 478, 458, 458, 458, + 458, 458, 458, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 458, 458, 458, 458, + 458, 458, 459, 478, 478, 478, 478, 478, 478, 459, + + 459, 459, 459, 459, 459, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 459, 459, + 459, 459, 459, 459, 464, 478, 478, 478, 478, 478, + 478, 464, 464, 464, 464, 464, 464, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 464, 464, 464, 464, 464, 464, 465, 478, 478, 478, + 478, 478, 478, 465, 465, 465, 465, 465, 465, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 465, 465, 465, 465, 465, 465, 469, 478, + 478, 478, 478, 478, 478, 469, 469, 469, 469, 469, + 469, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 469, 469, 469, 469, 469, 469, + 39, 478, 478, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 45, 45, 478, 45, 45, 48, 478, + 478, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 53, 53, 478, 53, 53, 81, 478, 478, 81, + + 81, 90, 478, 90, 90, 478, 90, 90, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 97, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, - 113, 113, 113, 113, 113, 113, 113, 113, 113, 115, - 115, 478, 115, 115, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 65, 65, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 130, 130, - 478, 130, 130, 151, 151, 151, 151, 151, 151, 151, - - 151, 151, 153, 153, 478, 153, 153, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 179, 179, 179, 179, - 179, 179, 179, 179, 179, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 185, 185, 185, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 212, 212, 212, 478, 212, + 108, 113, 113, 478, 113, 113, 116, 116, 116, 116, + 116, 116, 116, 116, 116, 116, 119, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 119, 119, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 128, 128, 478, 128, 128, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 151, 151, + 478, 151, 151, 159, 159, 159, 159, 159, 159, 159, + + 159, 159, 159, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 166, 166, 166, 179, 179, 179, 179, + 179, 179, 179, 179, 179, 179, 48, 48, 478, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 119, + 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, + 119, 119, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + + 211, 211, 211, 211, 39, 478, 478, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 244, 244, 244, 478, 244, 249, 249, 249, - 249, 478, 249, 249, 249, 249, 249, 249, 276, 276, - 276, 478, 276, 282, 478, 282, 282, 282, 282, 282, - - 282, 282, 282, 282, 285, 478, 285, 285, 285, 285, - 285, 285, 285, 285, 285, 288, 288, 288, 288, 288, - 288, 288, 288, 288, 288, 288, 313, 313, 313, 478, - 313, 322, 322, 322, 322, 322, 322, 322, 322, 322, - 322, 322, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 348, 348, 348, 478, 348, 414, 414, - 414, 478, 478, 478, 414, 478, 478, 414, 414, 423, - 423, 423, 423, 423, 423, 423, 423, 423, 427, 427, - 427, 478, 478, 427, 427, 427, 478, 427, 427, 438, - 438, 438, 438, 438, 438, 438, 438, 438, 7, 478, + 225, 243, 243, 243, 243, 248, 248, 248, 248, 248, + 248, 478, 248, 248, 248, 248, 248, 248, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 275, 275, 275, 275, 248, + 248, 248, 248, 248, 248, 478, 248, 248, 248, 248, + 248, 248, 281, 478, 478, 281, 281, 281, 281, 281, + + 281, 281, 281, 281, 281, 284, 478, 478, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 287, 287, + 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, + 287, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 113, 113, 478, 113, 113, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 312, 312, 312, 312, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 284, + 478, 478, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 326, 326, 326, 326, 326, 326, 326, 326, + + 326, 326, 326, 326, 326, 248, 248, 248, 248, 248, + 478, 478, 248, 248, 248, 248, 248, 248, 287, 287, + 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, + 287, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 113, 113, 478, 113, 113, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 348, 348, 348, 348, 281, 281, 478, 281, + 281, 281, 281, 281, 281, 281, 281, 281, 281, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 284, 284, 478, 284, 284, 284, 284, 284, + + 284, 284, 284, 284, 284, 326, 326, 326, 326, 326, + 326, 326, 326, 326, 326, 326, 326, 326, 248, 248, + 248, 248, 248, 478, 478, 248, 248, 248, 248, 248, + 248, 413, 413, 413, 413, 478, 478, 478, 478, 413, + 478, 478, 413, 413, 425, 425, 425, 425, 478, 478, + 478, 425, 425, 425, 478, 425, 425, 427, 427, 427, + 427, 427, 427, 427, 427, 427, 427, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 7, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478 + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478 } ; -static yyconst flex_int16_t yy_chk[2460] = +static yyconst flex_int16_t yy_chk[6664] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -576,270 +1048,733 @@ static yyconst flex_int16_t yy_chk[2460] = 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, - 3, 134, 4, 9, 9, 9, 9, 9, 12, 3, - 134, 4, 10, 10, 10, 10, 10, 11, 11, 11, - 11, 11, 3, 3, 4, 4, 13, 67, 12, 13, - 15, 39, 52, 25, 67, 3, 13, 4, 31, 13, - - 13, 13, 13, 13, 13, 15, 17, 25, 22, 17, - 27, 39, 31, 27, 11, 52, 17, 26, 22, 69, - 26, 26, 71, 22, 27, 48, 22, 42, 31, 22, - 42, 26, 17, 22, 22, 156, 22, 42, 71, 69, - 48, 17, 20, 23, 27, 64, 54, 64, 26, 20, - 20, 156, 20, 23, 23, 23, 23, 23, 23, 20, - 54, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 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, 3, 5, 4, 6, 15, + 12, 3, 477, 4, 9, 9, 9, 9, 9, 10, + + 10, 10, 10, 10, 3, 3, 4, 4, 11, 11, + 11, 11, 11, 23, 39, 5, 17, 6, 35, 17, + 3, 24, 4, 32, 24, 24, 32, 32, 38, 48, + 15, 69, 3, 3, 4, 4, 12, 42, 25, 17, + 42, 25, 11, 474, 69, 3, 35, 4, 17, 24, + 53, 32, 17, 23, 31, 78, 38, 78, 35, 69, + 39, 24, 467, 32, 33, 461, 65, 17, 83, 25, + 48, 11, 13, 42, 35, 13, 17, 24, 25, 32, + 83, 31, 13, 13, 13, 13, 13, 13, 65, 54, + 53, 33, 54, 54, 31, 65, 83, 25, 36, 36, + + 36, 36, 36, 70, 33, 68, 68, 456, 13, 31, + 166, 13, 13, 13, 13, 13, 13, 20, 166, 33, + 211, 90, 70, 440, 20, 20, 434, 20, 211, 54, + 124, 124, 70, 68, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 33, 32, - 35, 20, 32, 32, 36, 36, 36, 36, 36, 57, - - 43, 57, 33, 32, 35, 37, 37, 37, 37, 37, - 43, 43, 43, 43, 43, 43, 44, 84, 33, 55, - 32, 35, 55, 55, 57, 46, 44, 44, 44, 44, - 44, 44, 46, 55, 84, 46, 46, 46, 46, 46, - 46, 53, 37, 41, 41, 41, 41, 56, 66, 41, - 72, 53, 53, 53, 53, 53, 53, 70, 147, 86, - 72, 56, 41, 66, 147, 75, 86, 68, 56, 41, - 75, 73, 41, 41, 41, 41, 41, 41, 49, 49, - 49, 49, 68, 74, 74, 70, 73, 75, 63, 49, - 477, 75, 73, 68, 74, 78, 80, 49, 63, 63, - - 63, 63, 63, 63, 49, 83, 80, 49, 49, 49, - 49, 49, 49, 76, 81, 83, 76, 85, 78, 87, - 88, 89, 87, 88, 81, 81, 81, 81, 81, 81, - 93, 80, 85, 102, 108, 89, 90, 90, 90, 90, - 90, 124, 124, 143, 93, 140, 94, 102, 90, 97, - 143, 474, 109, 102, 108, 90, 94, 94, 94, 94, - 94, 94, 90, 97, 96, 90, 90, 90, 90, 90, - 90, 96, 109, 140, 118, 467, 98, 119, 96, 99, - 103, 98, 104, 105, 118, 97, 98, 98, 98, 98, - 98, 98, 119, 99, 103, 107, 104, 105, 120, 118, - - 107, 125, 127, 461, 150, 137, 127, 99, 137, 155, - 104, 150, 155, 120, 148, 125, 103, 105, 112, 125, - 107, 110, 110, 110, 110, 110, 132, 110, 112, 112, - 112, 112, 112, 112, 148, 158, 167, 192, 456, 160, - 110, 158, 157, 192, 167, 132, 159, 110, 160, 162, - 110, 110, 110, 110, 110, 110, 111, 111, 111, 111, - 157, 159, 111, 162, 190, 194, 116, 206, 344, 166, - 169, 190, 194, 344, 206, 111, 116, 116, 116, 116, - 116, 116, 111, 166, 169, 111, 111, 111, 111, 111, - 111, 114, 114, 114, 114, 114, 198, 205, 226, 207, - - 198, 117, 226, 170, 171, 173, 207, 440, 205, 203, - 114, 117, 117, 117, 117, 117, 117, 170, 171, 173, - 114, 114, 114, 114, 114, 114, 121, 121, 121, 121, - 121, 203, 212, 175, 236, 238, 131, 121, 238, 182, - 212, 392, 434, 429, 236, 121, 131, 131, 131, 131, - 131, 131, 121, 175, 182, 121, 121, 121, 121, 121, - 121, 122, 122, 122, 122, 216, 265, 244, 392, 268, - 269, 154, 122, 196, 184, 244, 268, 265, 269, 216, - 122, 154, 154, 154, 154, 154, 154, 122, 184, 196, - 122, 122, 122, 122, 122, 122, 129, 129, 129, 129, - - 129, 184, 276, 202, 340, 307, 161, 204, 307, 309, - 276, 419, 309, 385, 340, 129, 161, 161, 161, 161, - 161, 161, 129, 202, 204, 129, 129, 129, 129, 129, - 129, 152, 152, 152, 152, 152, 232, 165, 172, 229, - 313, 345, 420, 384, 165, 261, 345, 420, 313, 232, - 152, 165, 172, 235, 229, 237, 239, 152, 224, 261, - 152, 152, 152, 152, 152, 152, 163, 163, 163, 163, - 163, 370, 224, 250, 235, 237, 176, 239, 370, 172, - 435, 261, 364, 224, 435, 163, 176, 176, 176, 176, - 176, 176, 177, 250, 251, 163, 163, 163, 163, 163, - - 163, 178, 177, 177, 177, 177, 177, 177, 270, 251, - 272, 178, 178, 178, 178, 178, 178, 180, 180, 180, - 180, 180, 281, 281, 281, 281, 281, 181, 272, 285, - 270, 383, 348, 343, 383, 281, 180, 181, 181, 181, - 181, 181, 181, 183, 285, 332, 180, 180, 180, 180, - 180, 180, 187, 183, 183, 183, 183, 183, 183, 282, - 303, 306, 187, 187, 187, 187, 187, 187, 189, 189, - 189, 189, 189, 283, 283, 283, 283, 283, 199, 282, - 300, 327, 303, 306, 300, 318, 283, 189, 199, 199, - 199, 199, 199, 199, 300, 322, 327, 189, 189, 189, - - 189, 189, 189, 201, 201, 201, 201, 201, 319, 319, - 319, 319, 319, 208, 418, 322, 360, 418, 317, 316, - 326, 319, 201, 208, 208, 208, 208, 208, 208, 209, - 326, 360, 201, 201, 201, 201, 201, 201, 211, 209, - 209, 209, 209, 209, 209, 326, 356, 315, 211, 211, - 211, 211, 211, 211, 215, 215, 215, 215, 215, 218, - 215, 371, 337, 357, 361, 215, 356, 215, 371, 218, - 218, 218, 218, 218, 218, 219, 337, 321, 314, 361, - 215, 220, 321, 357, 366, 219, 219, 219, 219, 219, - 219, 220, 220, 220, 220, 220, 220, 221, 366, 378, - - 337, 366, 321, 222, 381, 407, 378, 221, 221, 221, - 221, 221, 221, 222, 222, 222, 222, 222, 222, 223, - 334, 334, 334, 334, 334, 227, 308, 381, 407, 223, - 223, 223, 223, 223, 223, 227, 227, 227, 227, 227, - 227, 228, 379, 380, 298, 422, 334, 233, 422, 379, - 380, 228, 228, 228, 228, 228, 228, 233, 233, 233, - 233, 233, 233, 234, 338, 338, 338, 338, 338, 241, - 432, 415, 441, 234, 234, 234, 234, 234, 234, 241, - 241, 241, 241, 241, 241, 242, 382, 441, 393, 432, - 338, 243, 415, 382, 393, 242, 242, 242, 242, 242, - - 242, 243, 243, 243, 243, 243, 243, 248, 248, 248, - 248, 248, 405, 248, 293, 390, 394, 395, 248, 405, - 248, 249, 249, 249, 249, 249, 255, 249, 377, 390, - 394, 395, 249, 248, 249, 402, 255, 255, 255, 255, - 255, 255, 377, 396, 404, 403, 402, 249, 253, 253, - 253, 253, 253, 403, 253, 404, 463, 396, 256, 253, - 253, 253, 377, 396, 280, 408, 463, 253, 256, 256, - 256, 256, 256, 256, 253, 257, 408, 253, 253, 253, - 253, 253, 253, 258, 416, 257, 257, 257, 257, 257, - 257, 259, 279, 258, 258, 258, 258, 258, 258, 260, - - 416, 259, 259, 259, 259, 259, 259, 262, 278, 260, - 260, 260, 260, 260, 260, 263, 277, 262, 262, 262, - 262, 262, 262, 266, 271, 263, 263, 263, 263, 263, - 263, 267, 264, 266, 266, 266, 266, 266, 266, 273, - 254, 267, 267, 267, 267, 267, 267, 274, 247, 273, - 273, 273, 273, 273, 273, 275, 406, 274, 274, 274, - 274, 274, 274, 406, 401, 275, 275, 275, 275, 275, - 275, 284, 284, 284, 284, 391, 443, 284, 401, 417, - 391, 431, 246, 391, 431, 287, 287, 287, 287, 287, - 284, 287, 245, 443, 240, 231, 287, 284, 287, 417, - - 284, 284, 284, 284, 284, 284, 286, 286, 286, 286, - 230, 287, 412, 412, 412, 412, 412, 286, 288, 288, - 288, 288, 288, 421, 288, 286, 430, 442, 412, 288, - 421, 288, 286, 430, 450, 286, 286, 286, 286, 286, - 286, 444, 225, 470, 288, 289, 289, 289, 289, 289, - 442, 289, 217, 475, 450, 444, 289, 470, 289, 290, - 290, 290, 290, 290, 294, 290, 448, 475, 462, 433, - 290, 289, 290, 448, 294, 294, 294, 294, 294, 294, - 425, 425, 425, 425, 425, 290, 291, 291, 291, 291, - 291, 433, 291, 425, 455, 462, 296, 291, 214, 291, - - 341, 341, 341, 341, 341, 291, 296, 296, 296, 296, - 296, 296, 291, 213, 455, 291, 291, 291, 291, 291, - 291, 292, 292, 292, 292, 292, 341, 292, 449, 451, - 200, 297, 292, 292, 292, 449, 451, 460, 195, 193, - 292, 297, 297, 297, 297, 297, 297, 292, 299, 191, - 292, 292, 292, 292, 292, 292, 301, 460, 299, 299, - 299, 299, 299, 299, 302, 466, 301, 301, 301, 301, - 301, 301, 304, 188, 302, 302, 302, 302, 302, 302, - 305, 457, 304, 304, 304, 304, 304, 304, 466, 185, - 305, 305, 305, 305, 305, 305, 310, 310, 310, 310, - - 310, 311, 457, 476, 468, 179, 174, 168, 310, 454, - 468, 311, 311, 311, 311, 311, 311, 312, 471, 454, - 164, 473, 310, 153, 476, 471, 473, 312, 312, 312, - 312, 312, 312, 323, 323, 323, 323, 323, 151, 323, - 454, 328, 328, 328, 328, 328, 323, 149, 472, 146, - 145, 144, 328, 142, 328, 472, 141, 139, 331, 323, - 324, 324, 324, 324, 324, 138, 324, 328, 331, 331, - 331, 331, 331, 331, 355, 355, 355, 355, 355, 324, - 355, 365, 365, 365, 365, 365, 324, 355, 136, 324, - 324, 324, 324, 324, 324, 325, 325, 325, 325, 135, - - 355, 325, 133, 130, 128, 333, 126, 365, 115, 367, - 367, 367, 367, 367, 325, 333, 333, 333, 333, 333, - 333, 325, 113, 106, 325, 325, 325, 325, 325, 325, - 329, 329, 329, 329, 329, 367, 95, 82, 79, 77, - 335, 329, 65, 369, 369, 369, 369, 369, 61, 329, - 335, 335, 335, 335, 335, 335, 329, 60, 59, 329, - 329, 329, 329, 329, 329, 330, 330, 330, 330, 369, - 58, 51, 45, 38, 29, 336, 330, 28, 24, 21, - 19, 18, 16, 14, 330, 336, 336, 336, 336, 336, - 336, 330, 339, 7, 330, 330, 330, 330, 330, 330, - - 342, 6, 339, 339, 339, 339, 339, 339, 5, 0, - 342, 342, 342, 342, 342, 342, 346, 346, 346, 346, - 346, 347, 0, 0, 0, 0, 0, 0, 346, 0, - 0, 347, 347, 347, 347, 347, 347, 358, 0, 0, - 0, 0, 346, 0, 0, 0, 0, 358, 358, 358, - 358, 358, 358, 359, 359, 359, 359, 359, 362, 0, - 0, 0, 0, 0, 359, 0, 359, 0, 362, 362, - 362, 362, 362, 362, 363, 0, 0, 368, 0, 359, - 0, 0, 0, 368, 363, 363, 363, 363, 363, 363, - 368, 0, 368, 372, 0, 0, 0, 368, 368, 373, - - 0, 368, 0, 372, 372, 372, 372, 372, 372, 373, - 373, 373, 373, 373, 373, 374, 0, 0, 0, 0, - 0, 375, 0, 0, 0, 374, 374, 374, 374, 374, - 374, 375, 375, 375, 375, 375, 375, 387, 0, 0, - 0, 0, 0, 388, 0, 0, 0, 387, 387, 387, - 387, 387, 387, 388, 388, 388, 388, 388, 388, 389, - 0, 0, 0, 0, 0, 397, 0, 0, 0, 389, - 389, 389, 389, 389, 389, 397, 397, 397, 397, 397, - 397, 398, 0, 0, 0, 0, 0, 399, 0, 0, - 0, 398, 398, 398, 398, 398, 398, 399, 399, 399, - - 399, 399, 399, 400, 400, 400, 400, 400, 0, 0, - 409, 0, 0, 0, 0, 0, 0, 0, 0, 400, - 409, 409, 409, 409, 409, 409, 410, 0, 0, 400, - 411, 411, 411, 411, 411, 0, 410, 410, 410, 410, - 410, 410, 0, 0, 0, 0, 411, 413, 0, 0, - 414, 414, 414, 414, 414, 0, 411, 413, 413, 413, - 413, 413, 413, 414, 423, 423, 423, 423, 423, 0, - 427, 427, 427, 427, 427, 0, 414, 423, 0, 0, - 0, 0, 0, 427, 0, 0, 0, 428, 0, 0, - 423, 424, 424, 424, 424, 424, 427, 428, 428, 428, - - 428, 428, 428, 0, 424, 436, 436, 436, 436, 436, - 424, 0, 0, 0, 0, 0, 0, 424, 436, 0, - 424, 424, 424, 424, 424, 424, 437, 0, 0, 0, - 0, 436, 0, 0, 0, 0, 437, 437, 437, 437, - 437, 437, 438, 438, 438, 438, 438, 445, 0, 0, - 446, 446, 446, 446, 446, 438, 0, 445, 445, 445, - 445, 445, 445, 446, 0, 0, 0, 447, 438, 439, - 439, 439, 439, 439, 0, 0, 446, 447, 447, 447, - 447, 447, 447, 0, 0, 0, 0, 0, 439, 0, - 0, 0, 0, 0, 452, 0, 0, 0, 439, 439, - - 439, 439, 439, 439, 452, 452, 452, 452, 452, 452, - 453, 0, 0, 0, 0, 0, 458, 0, 0, 0, - 453, 453, 453, 453, 453, 453, 458, 458, 458, 458, - 458, 458, 459, 0, 0, 0, 0, 0, 464, 0, - 0, 0, 459, 459, 459, 459, 459, 459, 464, 464, - 464, 464, 464, 464, 465, 0, 0, 0, 0, 0, - 469, 0, 0, 0, 465, 465, 465, 465, 465, 465, - 469, 469, 469, 469, 469, 469, 479, 0, 479, 479, - 479, 479, 479, 479, 479, 479, 479, 480, 480, 0, - 480, 480, 481, 0, 481, 481, 481, 481, 481, 481, - - 481, 481, 481, 482, 482, 0, 482, 482, 483, 0, - 0, 483, 483, 484, 484, 484, 484, 484, 484, 484, - 484, 484, 485, 0, 485, 485, 0, 485, 485, 486, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 90, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 64, 52, + 106, 20, 22, 74, 55, 429, 37, 37, 37, 37, + + 37, 57, 64, 57, 22, 243, 487, 22, 487, 52, + 22, 419, 55, 243, 22, 22, 64, 22, 106, 74, + 67, 66, 74, 57, 72, 72, 385, 127, 22, 67, + 37, 127, 66, 22, 55, 66, 22, 52, 71, 22, + 97, 55, 22, 22, 71, 22, 26, 73, 67, 66, + 82, 57, 71, 26, 26, 26, 26, 26, 26, 37, + 66, 72, 108, 109, 73, 80, 71, 76, 73, 82, + 107, 73, 71, 76, 86, 107, 73, 85, 140, 82, + 97, 384, 26, 26, 26, 26, 26, 26, 41, 41, + 41, 41, 73, 118, 41, 76, 73, 80, 84, 85, + + 86, 80, 87, 86, 348, 175, 85, 41, 108, 109, + 96, 140, 84, 93, 41, 41, 41, 41, 41, 41, + 93, 107, 94, 119, 102, 80, 84, 104, 87, 342, + 250, 87, 103, 119, 118, 96, 317, 105, 161, 316, + 41, 102, 315, 41, 41, 41, 41, 41, 41, 44, + 96, 175, 104, 93, 314, 94, 44, 44, 44, 44, + 44, 44, 94, 96, 102, 103, 120, 104, 105, 125, + 102, 250, 103, 275, 119, 131, 120, 105, 161, 134, + 104, 275, 44, 94, 125, 44, 44, 44, 44, 44, + 44, 46, 144, 103, 150, 131, 105, 145, 46, 46, + + 46, 46, 46, 46, 131, 134, 145, 165, 134, 125, + 137, 137, 148, 125, 156, 144, 150, 120, 192, 153, + 226, 144, 148, 150, 226, 145, 154, 46, 46, 46, + 46, 46, 46, 49, 49, 49, 49, 156, 137, 154, + 148, 157, 155, 156, 49, 153, 158, 165, 153, 174, + 190, 192, 49, 155, 154, 157, 168, 170, 164, 49, + 49, 49, 49, 49, 49, 164, 158, 171, 173, 157, + 155, 172, 182, 190, 235, 158, 184, 174, 216, 190, + 249, 499, 182, 499, 284, 49, 194, 217, 49, 49, + 49, 49, 49, 49, 56, 196, 168, 170, 164, 194, + + 184, 56, 56, 56, 56, 56, 56, 171, 173, 172, + 235, 172, 201, 198, 194, 217, 184, 196, 216, 325, + 293, 201, 202, 182, 196, 284, 249, 203, 184, 202, + 56, 56, 56, 56, 56, 56, 77, 172, 198, 203, + 201, 204, 198, 77, 77, 77, 77, 77, 77, 293, + 202, 231, 232, 234, 390, 203, 281, 320, 390, 204, + 325, 234, 205, 492, 492, 231, 254, 509, 232, 509, + 204, 206, 77, 77, 77, 77, 77, 77, 88, 231, + 232, 234, 224, 236, 205, 88, 88, 88, 88, 88, + 88, 205, 236, 206, 254, 214, 214, 214, 214, 214, + + 206, 214, 281, 320, 224, 265, 214, 313, 214, 237, + 306, 236, 332, 238, 88, 88, 88, 88, 88, 88, + 91, 238, 224, 265, 364, 307, 271, 91, 91, 91, + 91, 91, 91, 224, 265, 237, 306, 271, 237, 306, + 332, 238, 247, 247, 247, 247, 247, 214, 247, 267, + 296, 268, 364, 247, 271, 247, 91, 91, 91, 91, + 91, 91, 98, 98, 98, 98, 98, 279, 511, 337, + 511, 267, 268, 340, 98, 269, 303, 305, 267, 312, + 268, 98, 269, 303, 305, 278, 308, 312, 98, 98, + 98, 98, 98, 98, 247, 248, 248, 248, 248, 248, + + 337, 248, 277, 269, 303, 305, 248, 276, 248, 340, + 463, 515, 308, 515, 98, 308, 270, 98, 98, 98, + 98, 98, 98, 110, 110, 110, 110, 110, 337, 110, + 280, 280, 280, 280, 280, 282, 282, 282, 282, 282, + 321, 343, 110, 280, 246, 321, 463, 248, 282, 110, + 110, 110, 110, 110, 110, 286, 286, 286, 286, 286, + 318, 318, 318, 318, 318, 343, 245, 366, 286, 517, + 343, 517, 370, 318, 394, 110, 344, 366, 110, 110, + 110, 110, 110, 110, 111, 111, 111, 111, 244, 394, + 111, 321, 239, 229, 370, 287, 287, 287, 287, 287, + + 344, 370, 394, 111, 383, 344, 366, 286, 287, 228, + 111, 111, 111, 111, 111, 111, 288, 288, 288, 288, + 288, 289, 289, 289, 289, 289, 356, 225, 326, 288, + 383, 356, 213, 383, 289, 392, 111, 392, 326, 111, + 111, 111, 111, 111, 111, 114, 393, 287, 462, 212, + 462, 403, 114, 114, 114, 114, 114, 114, 322, 322, + 322, 322, 322, 392, 322, 357, 199, 193, 288, 393, + 357, 322, 403, 289, 191, 393, 462, 356, 114, 326, + 403, 114, 114, 114, 114, 114, 114, 115, 189, 327, + 327, 327, 327, 327, 115, 115, 115, 115, 115, 115, + + 327, 187, 327, 331, 331, 331, 331, 331, 185, 179, + 322, 333, 333, 333, 333, 333, 357, 333, 167, 331, + 371, 163, 159, 115, 115, 115, 115, 115, 115, 117, + 117, 117, 117, 117, 346, 346, 346, 346, 346, 151, + 149, 327, 371, 336, 336, 336, 336, 336, 117, 371, + 346, 360, 361, 146, 336, 117, 117, 117, 117, 117, + 117, 360, 361, 333, 365, 365, 365, 365, 365, 416, + 345, 345, 345, 345, 345, 367, 367, 367, 367, 367, + 143, 142, 416, 377, 117, 117, 117, 117, 117, 117, + 121, 121, 121, 121, 121, 336, 524, 416, 524, 141, + + 441, 121, 360, 361, 369, 369, 369, 369, 369, 121, + 377, 378, 379, 139, 441, 380, 121, 121, 121, 121, + 121, 121, 345, 355, 355, 355, 355, 355, 441, 355, + 527, 415, 527, 378, 379, 138, 355, 380, 377, 415, + 378, 379, 121, 395, 380, 121, 121, 121, 121, 121, + 121, 122, 122, 122, 122, 381, 369, 136, 395, 415, + 418, 381, 122, 359, 359, 359, 359, 359, 382, 391, + 122, 395, 391, 402, 359, 355, 359, 122, 122, 122, + 122, 122, 122, 381, 135, 401, 418, 133, 407, 418, + 382, 402, 132, 391, 407, 130, 405, 382, 391, 396, + + 401, 391, 402, 122, 128, 396, 122, 122, 122, 122, + 122, 122, 129, 401, 396, 359, 407, 406, 405, 129, + 129, 129, 129, 129, 129, 405, 537, 396, 537, 544, + 545, 544, 545, 396, 399, 399, 399, 399, 399, 406, + 126, 404, 408, 116, 113, 95, 406, 399, 129, 129, + 129, 129, 129, 129, 147, 147, 147, 147, 147, 404, + 408, 92, 81, 79, 410, 410, 410, 410, 410, 417, + 404, 408, 75, 147, 63, 410, 420, 61, 417, 421, + 147, 147, 147, 147, 147, 147, 399, 400, 400, 400, + 400, 400, 409, 409, 409, 409, 409, 417, 409, 60, + + 420, 421, 59, 400, 58, 420, 147, 51, 421, 147, + 147, 147, 147, 147, 147, 152, 410, 411, 411, 411, + 411, 411, 152, 152, 152, 152, 152, 152, 413, 413, + 413, 413, 413, 411, 45, 29, 28, 422, 27, 400, + 21, 413, 430, 19, 409, 435, 412, 412, 412, 412, + 412, 152, 152, 152, 152, 152, 152, 160, 160, 160, + 160, 160, 412, 422, 430, 18, 422, 432, 431, 411, + 435, 430, 433, 16, 435, 442, 160, 432, 468, 433, + 413, 442, 448, 160, 160, 160, 160, 160, 160, 423, + 423, 423, 423, 423, 431, 432, 443, 431, 412, 14, + + 433, 468, 423, 442, 448, 449, 7, 468, 443, 160, + 444, 448, 160, 160, 160, 160, 160, 160, 162, 162, + 162, 162, 162, 0, 443, 444, 0, 449, 425, 425, + 425, 425, 425, 450, 449, 0, 454, 162, 444, 0, + 451, 425, 450, 0, 162, 162, 162, 162, 162, 162, + 427, 427, 427, 427, 427, 436, 436, 436, 436, 436, + 0, 450, 451, 427, 454, 466, 0, 0, 436, 451, + 0, 466, 454, 162, 162, 162, 162, 162, 162, 169, + 425, 438, 438, 438, 438, 438, 169, 169, 169, 169, + 169, 169, 454, 466, 438, 0, 0, 0, 457, 0, + + 455, 460, 427, 476, 0, 0, 457, 436, 471, 455, + 460, 476, 472, 0, 473, 169, 169, 169, 169, 169, + 169, 176, 176, 176, 176, 176, 457, 176, 455, 460, + 471, 476, 0, 438, 472, 0, 0, 471, 473, 0, + 176, 472, 0, 473, 0, 0, 0, 176, 176, 176, + 176, 176, 176, 445, 445, 445, 445, 445, 465, 465, + 465, 465, 465, 0, 0, 0, 445, 0, 0, 0, + 0, 465, 0, 176, 0, 0, 176, 176, 176, 176, + 176, 176, 178, 469, 469, 469, 469, 469, 470, 178, + 178, 178, 178, 178, 178, 0, 469, 0, 0, 0, + + 0, 0, 475, 470, 0, 445, 0, 0, 0, 0, + 465, 0, 0, 0, 0, 0, 470, 475, 178, 178, + 178, 178, 178, 178, 180, 180, 180, 180, 180, 0, + 475, 0, 0, 0, 0, 469, 0, 0, 0, 0, + 0, 0, 0, 180, 0, 0, 0, 0, 0, 0, + 180, 180, 180, 180, 180, 180, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, + 180, 180, 180, 180, 180, 181, 181, 181, 181, 181, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 181, 0, 0, 0, 0, 0, + 0, 181, 181, 181, 181, 181, 181, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 181, 181, 181, 181, 181, 181, 183, 183, 183, 183, + 183, 0, 0, 0, 0, 0, 0, 183, 0, 0, + 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, + 0, 0, 183, 183, 183, 183, 183, 183, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 183, 0, + + 0, 183, 183, 183, 183, 183, 183, 188, 188, 188, + 188, 188, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 188, 0, 0, 0, + 0, 0, 0, 188, 188, 188, 188, 188, 188, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 188, 188, 188, 188, 188, 188, 195, 0, + 0, 0, 0, 0, 0, 195, 195, 195, 195, 195, + 195, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 195, 195, 195, 195, 195, 195, + 200, 200, 200, 200, 200, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 200, + 0, 0, 0, 0, 0, 0, 200, 200, 200, 200, + 200, 200, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 200, 200, 200, 200, 200, + 200, 207, 0, 0, 0, 0, 0, 0, 207, 207, + 207, 207, 207, 207, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 207, 207, 207, + 207, 207, 207, 208, 208, 208, 208, 208, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 208, 0, 0, 0, 0, 0, 0, 208, + 208, 208, 208, 208, 208, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 208, 208, + 208, 208, 208, 208, 215, 0, 0, 0, 0, 0, + 0, 215, 215, 215, 215, 215, 215, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 215, 215, 215, 215, 215, 215, 218, 218, 218, 218, + 218, 0, 218, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 218, 0, 0, 0, 0, + 0, 0, 218, 218, 218, 218, 218, 218, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 218, 0, + 0, 218, 218, 218, 218, 218, 218, 220, 0, 0, + 0, 0, 0, 0, 220, 220, 220, 220, 220, 220, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 220, 220, 220, 220, 220, 220, 221, + 221, 221, 221, 221, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 221, 0, + 0, 0, 0, 0, 0, 221, 221, 221, 221, 221, + 221, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 221, 221, 221, 221, 221, 221, + 222, 222, 222, 222, 222, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 222, + + 0, 0, 0, 0, 0, 0, 222, 222, 222, 222, + 222, 222, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 222, 222, 222, 222, 222, + 222, 223, 223, 223, 223, 223, 0, 0, 0, 0, + 0, 0, 223, 0, 0, 0, 0, 0, 0, 0, + 223, 0, 0, 0, 0, 0, 0, 223, 223, 223, + 223, 223, 223, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 223, 0, 0, 223, 223, 223, 223, + + 223, 223, 227, 227, 227, 227, 227, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 227, 0, 0, 0, 0, 0, 0, 227, 227, + 227, 227, 227, 227, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 227, 227, 227, + 227, 227, 227, 230, 0, 0, 0, 0, 0, 0, + 230, 230, 230, 230, 230, 230, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 230, + + 230, 230, 230, 230, 230, 233, 233, 233, 233, 233, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 233, 0, 0, 0, 0, 0, + 0, 233, 233, 233, 233, 233, 233, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 233, 233, 233, 233, 233, 233, 240, 0, 0, 0, + 0, 0, 0, 240, 240, 240, 240, 240, 240, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 240, 240, 240, 240, 240, 240, 241, 241, + 241, 241, 241, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 241, 0, 0, + 0, 0, 0, 0, 241, 241, 241, 241, 241, 241, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 241, 241, 241, 241, 241, 241, 252, + 252, 252, 252, 252, 0, 252, 0, 0, 0, 0, + 252, 252, 252, 0, 0, 0, 0, 0, 252, 0, + 0, 0, 0, 0, 0, 252, 252, 252, 252, 252, + + 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 252, 0, 0, 252, 252, 252, 252, 252, 252, + 253, 0, 0, 0, 0, 0, 0, 253, 253, 253, + 253, 253, 253, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 253, 253, 253, 253, + 253, 253, 255, 255, 255, 255, 255, 0, 255, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 255, 0, 0, 0, 0, 0, 0, 255, 255, + + 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 0, 0, 255, 255, 255, + 255, 255, 255, 257, 0, 0, 0, 0, 0, 0, + 257, 257, 257, 257, 257, 257, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 257, 0, 0, 257, + 257, 257, 257, 257, 257, 258, 258, 258, 258, 258, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 258, 0, 0, 0, 0, 0, + + 0, 258, 258, 258, 258, 258, 258, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 258, 0, 0, + 258, 258, 258, 258, 258, 258, 259, 259, 259, 259, + 259, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 259, 0, 0, 0, 0, + 0, 0, 259, 259, 259, 259, 259, 259, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 259, 259, 259, 259, 259, 259, 260, 260, 260, + + 260, 260, 0, 0, 0, 0, 0, 0, 260, 0, + 0, 0, 0, 0, 0, 0, 260, 0, 0, 0, + 0, 0, 0, 260, 260, 260, 260, 260, 260, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 260, + 0, 0, 260, 260, 260, 260, 260, 260, 261, 261, + 261, 261, 261, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 261, 0, 0, + 0, 0, 0, 0, 261, 261, 261, 261, 261, 261, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 261, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 261, 261, 261, 261, 261, 261, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 261, 262, 262, 262, 262, 262, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 262, 0, 0, 0, 0, 0, 0, 262, 262, + 262, 262, 262, 262, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 262, 262, 262, + 262, 262, 262, 263, 0, 0, 0, 0, 0, 0, + + 263, 263, 263, 263, 263, 263, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 263, + 263, 263, 263, 263, 263, 264, 264, 264, 264, 264, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 264, 0, 0, 0, 0, 0, + 0, 264, 264, 264, 264, 264, 264, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 264, 264, 264, 264, 264, 264, 266, 266, 266, 266, + + 266, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 266, 0, 0, 0, 0, + 0, 0, 266, 266, 266, 266, 266, 266, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 266, 266, 266, 266, 266, 266, 272, 0, 0, + 0, 0, 0, 0, 272, 272, 272, 272, 272, 272, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 272, 272, 272, 272, 272, 272, 273, + + 273, 273, 273, 273, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 273, 0, + 0, 0, 0, 0, 0, 273, 273, 273, 273, 273, + 273, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 273, 273, 273, 273, 273, 273, + 283, 283, 283, 283, 0, 0, 283, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 283, + 0, 0, 0, 0, 0, 0, 283, 283, 283, 283, + 283, 283, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 283, 0, 0, 283, 283, 283, 283, 283, + 283, 285, 285, 285, 285, 0, 0, 0, 0, 0, + 0, 0, 285, 0, 0, 0, 0, 0, 0, 0, + 285, 0, 0, 0, 0, 0, 0, 285, 285, 285, + 285, 285, 285, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 285, 0, 0, 285, 285, 285, 285, + 285, 285, 290, 290, 290, 290, 290, 0, 0, 0, + 0, 0, 0, 0, 0, 290, 0, 0, 0, 0, + + 0, 290, 0, 0, 0, 0, 0, 0, 290, 290, + 290, 290, 290, 290, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 290, 0, 0, 290, 290, 290, + 290, 290, 290, 291, 291, 291, 291, 291, 0, 291, + 0, 0, 0, 0, 291, 291, 291, 0, 0, 0, + 0, 0, 291, 0, 0, 0, 0, 0, 0, 291, + 291, 291, 291, 291, 291, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 291, 0, 0, 291, 291, + + 291, 291, 291, 291, 292, 0, 0, 0, 0, 0, + 0, 292, 292, 292, 292, 292, 292, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 292, 292, 292, 292, 292, 292, 294, 294, 294, 294, + 294, 0, 294, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 294, 0, 0, 0, 0, + 0, 0, 294, 294, 294, 294, 294, 294, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 294, 0, + + 0, 294, 294, 294, 294, 294, 294, 297, 297, 297, + 297, 297, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 297, 0, 0, 0, + 0, 0, 0, 297, 297, 297, 297, 297, 297, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 297, + 0, 0, 297, 297, 297, 297, 297, 297, 298, 298, + 298, 298, 298, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 298, 0, 0, + 0, 0, 0, 0, 298, 298, 298, 298, 298, 298, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 298, 298, 298, 298, 298, 298, 299, + 299, 299, 299, 299, 0, 0, 0, 0, 0, 0, + 299, 0, 0, 0, 0, 0, 0, 0, 299, 0, + 0, 0, 0, 0, 0, 299, 299, 299, 299, 299, + 299, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 299, 0, 0, 299, 299, 299, 299, 299, 299, + 300, 300, 300, 300, 300, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 300, 0, 0, 300, + 0, 0, 0, 0, 0, 0, 300, 300, 300, 300, + 300, 300, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 300, 300, 300, 300, 300, + 300, 301, 301, 301, 301, 301, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 301, 0, 0, 0, 0, 0, 0, 301, 301, 301, + 301, 301, 301, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 301, 301, 301, 301, + 301, 301, 302, 302, 302, 302, 302, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 302, 0, 0, 0, 0, 0, 0, 302, 302, + 302, 302, 302, 302, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 302, 302, 302, + 302, 302, 302, 304, 304, 304, 304, 304, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 304, 0, 0, 0, 0, 0, 0, 304, + + 304, 304, 304, 304, 304, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 304, 304, + 304, 304, 304, 304, 309, 0, 0, 0, 0, 0, + 0, 309, 309, 309, 309, 309, 309, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 309, 309, 309, 309, 309, 309, 310, 310, 310, 310, + 310, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 310, 0, 0, 0, 0, + + 0, 0, 310, 310, 310, 310, 310, 310, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 310, 310, 310, 310, 310, 310, 323, 323, 323, + 323, 323, 0, 323, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 323, 0, 0, 0, + 0, 0, 0, 323, 323, 323, 323, 323, 323, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 323, + 0, 0, 323, 323, 323, 323, 323, 323, 324, 324, + + 324, 324, 0, 0, 324, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 324, 0, 0, + 0, 0, 0, 0, 324, 324, 324, 324, 324, 324, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 324, 0, 0, 324, 324, 324, 324, 324, 324, 328, + 328, 328, 328, 328, 0, 0, 0, 0, 0, 0, + 328, 0, 0, 0, 0, 0, 0, 0, 328, 0, + 0, 0, 0, 0, 0, 328, 328, 328, 328, 328, + 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 328, 0, 0, 328, 328, 328, 328, 328, 328, + 329, 329, 329, 329, 0, 0, 0, 0, 0, 0, + 0, 329, 0, 0, 0, 0, 0, 0, 0, 329, + 0, 0, 0, 0, 0, 0, 329, 329, 329, 329, + 329, 329, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 329, 0, 0, 329, 329, 329, 329, 329, + 329, 330, 330, 330, 330, 330, 0, 0, 0, 0, + 0, 0, 0, 0, 330, 0, 0, 0, 0, 0, + + 330, 0, 0, 0, 0, 0, 0, 330, 330, 330, + 330, 330, 330, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 330, 0, 0, 330, 330, 330, 330, + 330, 330, 334, 0, 0, 0, 0, 0, 0, 334, + 334, 334, 334, 334, 334, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 334, 334, + 334, 334, 334, 334, 335, 0, 0, 0, 0, 0, + 0, 335, 335, 335, 335, 335, 335, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 335, 335, 335, 335, 335, 335, 338, 0, 0, 0, + 0, 0, 0, 338, 338, 338, 338, 338, 338, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 338, 338, 338, 338, 338, 338, 339, 339, + 339, 339, 339, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 339, 0, 0, + 0, 0, 0, 0, 339, 339, 339, 339, 339, 339, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 339, 339, 339, 339, 339, 339, 341, + 341, 341, 341, 341, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 341, 0, + 0, 0, 0, 0, 0, 341, 341, 341, 341, 341, + 341, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 341, 341, 341, 341, 341, 341, + 358, 0, 0, 0, 0, 0, 0, 358, 358, 358, + + 358, 358, 358, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 358, 358, 358, 358, + 358, 358, 362, 0, 0, 0, 0, 0, 0, 362, + 362, 362, 362, 362, 362, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 362, 362, + 362, 362, 362, 362, 363, 363, 363, 363, 363, 0, + 0, 0, 0, 0, 0, 0, 0, 363, 0, 0, + 0, 0, 0, 363, 0, 0, 0, 0, 0, 0, + + 363, 363, 363, 363, 363, 363, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 363, 0, 0, 363, + 363, 363, 363, 363, 363, 368, 0, 0, 0, 0, + 0, 0, 368, 0, 368, 0, 0, 0, 0, 368, + 368, 0, 0, 368, 0, 0, 0, 0, 368, 0, + 0, 0, 0, 0, 368, 0, 0, 0, 0, 0, + 368, 0, 368, 0, 0, 0, 0, 368, 368, 0, + 0, 368, 373, 0, 0, 0, 0, 0, 0, 373, + 373, 373, 373, 373, 373, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 373, 373, + 373, 373, 373, 373, 374, 0, 0, 0, 0, 0, + 0, 374, 374, 374, 374, 374, 374, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 374, 374, 374, 374, 374, 374, 375, 0, 0, 0, + 0, 0, 0, 375, 375, 375, 375, 375, 375, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 375, 375, 375, 375, 375, 375, 387, 0, + 0, 0, 0, 0, 0, 387, 387, 387, 387, 387, + 387, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 387, 387, 387, 387, 387, 387, + 388, 0, 0, 0, 0, 0, 0, 388, 388, 388, + 388, 388, 388, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 388, 388, 388, 388, + 388, 388, 389, 0, 0, 0, 0, 0, 0, 389, + + 389, 389, 389, 389, 389, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 389, 389, + 389, 389, 389, 389, 397, 0, 0, 0, 0, 0, + 0, 397, 397, 397, 397, 397, 397, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 397, 397, 397, 397, 397, 397, 398, 0, 0, 0, + 0, 0, 0, 398, 398, 398, 398, 398, 398, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 398, 398, 398, 398, 398, 398, 414, 0, + 0, 0, 0, 0, 0, 414, 414, 414, 414, 414, + 414, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 414, 414, 414, 414, 414, 414, + 426, 0, 0, 0, 0, 0, 0, 426, 426, 426, + 426, 426, 426, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 426, 426, 426, 426, + + 426, 426, 428, 428, 428, 428, 428, 0, 0, 0, + 0, 0, 0, 0, 0, 428, 0, 0, 0, 0, + 0, 428, 0, 0, 0, 0, 0, 0, 428, 428, + 428, 428, 428, 428, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 428, 0, 0, 428, 428, 428, + 428, 428, 428, 437, 437, 437, 437, 437, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 437, 0, 0, 0, 0, 0, 0, 437, + 437, 437, 437, 437, 437, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 437, 437, + 437, 437, 437, 437, 439, 0, 0, 0, 0, 0, + 0, 439, 439, 439, 439, 439, 439, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 439, 439, 439, 439, 439, 439, 446, 0, 0, 0, + 0, 0, 0, 446, 446, 446, 446, 446, 446, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 446, 446, 446, 446, 446, 446, 447, 0, + 0, 0, 0, 0, 0, 447, 447, 447, 447, 447, + 447, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 447, 447, 447, 447, 447, 447, + 452, 0, 0, 0, 0, 0, 0, 452, 452, 452, + 452, 452, 452, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 452, 452, 452, 452, + 452, 452, 453, 0, 0, 0, 0, 0, 0, 453, + + 453, 453, 453, 453, 453, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 453, 453, + 453, 453, 453, 453, 458, 0, 0, 0, 0, 0, + 0, 458, 458, 458, 458, 458, 458, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 458, 458, 458, 458, 458, 458, 459, 0, 0, 0, + 0, 0, 0, 459, 459, 459, 459, 459, 459, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 459, 459, 459, 459, 459, 459, 464, 0, + 0, 0, 0, 0, 0, 464, 464, 464, 464, 464, + 464, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 464, 464, 464, 464, 464, 464, + 479, 0, 0, 479, 479, 479, 479, 479, 479, 479, + 479, 479, 479, 480, 480, 0, 480, 480, 481, 0, + 0, 481, 481, 481, 481, 481, 481, 481, 481, 481, + 481, 482, 482, 0, 482, 482, 483, 0, 0, 483, + + 483, 484, 0, 484, 484, 0, 484, 484, 485, 485, + 485, 485, 485, 485, 485, 485, 485, 485, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, - 487, 487, 487, 487, 487, 487, 487, 487, 487, 488, - 488, 0, 488, 488, 489, 489, 489, 489, 489, 489, - 489, 489, 489, 489, 489, 490, 490, 490, 490, 490, - 490, 490, 490, 490, 490, 490, 490, 491, 491, 492, - 492, 492, 492, 492, 492, 492, 492, 492, 493, 493, - 0, 493, 493, 494, 494, 494, 494, 494, 494, 494, - - 494, 494, 495, 495, 0, 495, 495, 496, 496, 496, - 496, 496, 496, 496, 496, 496, 497, 497, 497, 497, - 497, 497, 497, 497, 497, 498, 498, 498, 498, 498, - 498, 498, 498, 498, 498, 498, 498, 499, 499, 499, - 499, 499, 499, 499, 499, 499, 500, 500, 500, 500, - 500, 500, 500, 500, 500, 501, 501, 501, 0, 501, + 486, 488, 488, 0, 488, 488, 489, 489, 489, 489, + 489, 489, 489, 489, 489, 489, 490, 490, 490, 490, + 490, 490, 490, 490, 490, 490, 490, 490, 490, 491, + 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, + 491, 491, 491, 493, 493, 0, 493, 493, 494, 494, + 494, 494, 494, 494, 494, 494, 494, 494, 495, 495, + 0, 495, 495, 496, 496, 496, 496, 496, 496, 496, + + 496, 496, 496, 497, 497, 497, 497, 497, 497, 497, + 497, 497, 497, 498, 498, 498, 500, 500, 500, 500, + 500, 500, 500, 500, 500, 500, 501, 501, 0, 501, + 501, 501, 501, 501, 501, 501, 501, 501, 501, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, - 502, 502, 503, 503, 503, 0, 503, 504, 504, 504, - 504, 0, 504, 504, 504, 504, 504, 504, 505, 505, - 505, 0, 505, 506, 0, 506, 506, 506, 506, 506, - - 506, 506, 506, 506, 507, 0, 507, 507, 507, 507, - 507, 507, 507, 507, 507, 508, 508, 508, 508, 508, - 508, 508, 508, 508, 508, 508, 509, 509, 509, 0, - 509, 510, 510, 510, 510, 510, 510, 510, 510, 510, - 510, 510, 511, 511, 511, 511, 511, 511, 511, 511, - 511, 511, 511, 512, 512, 512, 0, 512, 513, 513, - 513, 0, 0, 0, 513, 0, 0, 513, 513, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 515, 515, - 515, 0, 0, 515, 515, 515, 0, 515, 515, 516, - 516, 516, 516, 516, 516, 516, 516, 516, 478, 478, + 502, 502, 503, 503, 503, 503, 503, 503, 503, 503, + 503, 503, 503, 503, 503, 503, 504, 504, 504, 504, + 504, 504, 504, 504, 504, 504, 504, 504, 504, 504, + 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, + 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, + + 507, 507, 507, 507, 508, 0, 0, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 510, 510, 510, + 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, + 510, 512, 512, 512, 512, 513, 513, 513, 513, 513, + 513, 0, 513, 513, 513, 513, 513, 513, 514, 514, + 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, + 514, 516, 516, 516, 516, 516, 516, 516, 516, 516, + 516, 516, 516, 516, 516, 518, 518, 518, 518, 519, + 519, 519, 519, 519, 519, 0, 519, 519, 519, 519, + 519, 519, 520, 0, 0, 520, 520, 520, 520, 520, + + 520, 520, 520, 520, 520, 521, 0, 0, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 522, 522, + 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, + 522, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 525, 525, 0, 525, 525, 526, + 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, + 526, 526, 528, 528, 528, 528, 529, 529, 529, 529, + 529, 529, 529, 529, 529, 529, 529, 529, 529, 530, + 0, 0, 530, 530, 530, 530, 530, 530, 530, 530, + 530, 530, 531, 531, 531, 531, 531, 531, 531, 531, + + 531, 531, 531, 531, 531, 532, 532, 532, 532, 532, + 0, 0, 532, 532, 532, 532, 532, 532, 533, 533, + 533, 533, 533, 533, 533, 533, 533, 533, 533, 533, + 533, 534, 534, 534, 534, 534, 534, 534, 534, 534, + 534, 534, 534, 534, 535, 535, 0, 535, 535, 536, + 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 538, 538, 538, 538, 539, 539, 0, 539, + 539, 539, 539, 539, 539, 539, 539, 539, 539, 540, + 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, + 540, 540, 541, 541, 0, 541, 541, 541, 541, 541, + + 541, 541, 541, 541, 541, 542, 542, 542, 542, 542, + 542, 542, 542, 542, 542, 542, 542, 542, 543, 543, + 543, 543, 543, 0, 0, 543, 543, 543, 543, 543, + 543, 546, 546, 546, 546, 0, 0, 0, 0, 546, + 0, 0, 546, 546, 547, 547, 547, 547, 0, 0, + 0, 547, 547, 547, 0, 547, 547, 548, 548, 548, + 548, 548, 548, 548, 548, 548, 548, 549, 549, 549, + 549, 549, 549, 549, 549, 549, 549, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, - 478, 478, 478, 478, 478, 478, 478, 478, 478 + 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, + 478, 478, 478 } ; #line 1 "" @@ -878,7 +1813,7 @@ YY_DECL yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 2399 ); + while ( yy_base[yy_current_state] != 6578 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1250,7 +2185,7 @@ YY_RULE_SETUP #line 110 "" ECHO; YY_BREAK -#line 1761 "" +#line 2738 "" case YY_STATE_EOF(INITIAL): case YY_END_OF_BUFFER: case YY_STATE_EOF(mediaquery): -- cgit v0.12 From c06dd76ca4b30fa71297e640a8eaf702d606e937 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 19 May 2009 19:17:08 +0200 Subject: Updated WebKit from /home/ariya/dev/webkit/qtwebkit-4.5 to origin/qtwebkit-4.5 ( 40b523e9eaaba38c182e5a9c319f0069ebf98330 ) Changes in WebKit since the last update: ++ b/WebCore/ChangeLog 2009-05-11 Yael Aharon Reviewed by Holger Freyther. Change Qt port to match the mac and windows ports, and unregister plugins when plugins are stopped. Not doing that can cause assersion failure. https://bugs.webkit.org/show_bug.cgi?id=25702 * plugins/qt/PluginViewQt.cpp: (WebCore::PluginView::stop): --- dist/changes-4.5.2 | 2 +- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 11 +++++++++++ src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.5.2 b/dist/changes-4.5.2 index d467b95..b3e808f 100644 --- a/dist/changes-4.5.2 +++ b/dist/changes-4.5.2 @@ -43,7 +43,7 @@ Third party components JavaScript (r39882, r40086, r40131, r40133) Rendering (r41285, r41296, r41659, r42887) Network (r41664, r42516) - Plugins (r41346) + Plugins (r41346, r43550) Clipboard (r41360) **************************************************************************** diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 9f85d76..7adbd6f 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 - 7b8d6ab6f2b73862d11c2a41ab0223e55585d88f + 40b523e9eaaba38c182e5a9c319f0069ebf98330 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 23f3ca6..a4cb62d 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,14 @@ +2009-05-11 Yael Aharon + + Reviewed by Holger Freyther. + + Change Qt port to match the mac and windows ports, and unregister plugins when plugins are stopped. + Not doing that can cause assersion failure. + https://bugs.webkit.org/show_bug.cgi?id=25702 + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::stop): + 2009-05-18 Ariya Hidayat Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp index c8dd0e5..43c772f 100644 --- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp @@ -58,6 +58,7 @@ #include "MouseEvent.h" #include "Page.h" #include "PlatformMouseEvent.h" +#include "PluginMainThreadScheduler.h" #include "RenderLayer.h" #include "Settings.h" @@ -225,6 +226,8 @@ void PluginView::stop() JSC::JSLock::DropAllLocks dropAllLocks(false); + PluginMainThreadScheduler::scheduler().unregisterPlugin(m_instance); + // Clear the window m_npWindow.window = 0; if (m_plugin->pluginFuncs()->setwindow && !m_plugin->quirks().contains(PluginQuirkDontSetNullWindowHandleOnDestroy)) { -- cgit v0.12 From 4e4ff34e3c4c905f17aa02160a17fdb7b9ad61ed Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 14 May 2009 14:18:59 +0200 Subject: qdoc: Ensure that all inner class methods are included in the function index. Since the original code only used the parent class name as a key in the map that collects functions, you would only ever see either QHash::iterator::key() or QMap::iterator::key() in the index. This patch changes the key to the fully-qualified name for the parent class so that inner class methods are included. Reviewed-by: Martin Smith --- tools/qdoc3/htmlgenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 13d52bf..f5b5a2d 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -2851,7 +2851,7 @@ void HtmlGenerator::findAllFunctions(const InnerNode *node) const FunctionNode *func = static_cast(*c); if (func->status() > Node::Obsolete && func->metaness() != FunctionNode::Ctor && func->metaness() != FunctionNode::Dtor) { - funcIndex[(*c)->name()].insert((*c)->parent()->name(), *c); + funcIndex[(*c)->name()].insert(tre->fullDocumentName((*c)->parent()), *c); } } } -- cgit v0.12 From cc51d0f166354ad5acdc5ce054a83a02eeb21229 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 20 May 2009 09:36:07 +1000 Subject: Fix docs. --- doc/src/declarative/qmlforcpp.qdoc | 6 ++++-- src/declarative/qml/qmlcontext.cpp | 4 ++-- src/declarative/qml/qmlengine.cpp | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/src/declarative/qmlforcpp.qdoc b/doc/src/declarative/qmlforcpp.qdoc index e29b962..2898499 100644 --- a/doc/src/declarative/qmlforcpp.qdoc +++ b/doc/src/declarative/qmlforcpp.qdoc @@ -28,7 +28,8 @@ based on a simple declarative component description. \code - QmlComponent redRectangle("Rect { color: \"red\"; width: 100; height: 100 }"); + QmlEngine engine; + QmlComponent redRectangle(&engine, "Rect { color: \"red\"; width: 100; height: 100 }"); for (int ii = 0; ii < 100; ++ii) { QObject *rectangle = redRectangle.create(); // ... do something with the rectangle ... @@ -581,7 +582,8 @@ \row \o \code - QmlComponent component(xmlData); + QmlEngine engine; + QmlComponent component(&engine, qmlData); QObject *object = component.create(); // Will print "Hello world!" qDebug() << object->property("text2"); diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index fa36eb1..ea72ebf 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -149,7 +149,7 @@ void QmlContextPrivate::addDefaultObject(QObject *object, Priority priority) QmlContext context(engine.rootContext()); context.setContextProperty("myModel", modelData); - QmlComponent component("ListView { model=myModel }"); + QmlComponent component(&engine, "ListView { model=myModel }"); component.create(&context); \endcode @@ -176,7 +176,7 @@ void QmlContextPrivate::addDefaultObject(QObject *object, Priority priority) QmlContext context(engine.rootContext()); context.addDefaultObject(&myDataSet); - QmlComponent component("ListView { model=myModel }"); + QmlComponent component(&engine, "ListView { model=myModel }"); component.create(&context); \endcode diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 425cba4..c0ea463 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -425,8 +425,8 @@ bool QmlEnginePrivate::loadCache(QmlBasicScriptNodeCache &cache, const QString & \code QmlEngine engine; - QmlComponent component("Text { text: \"Hello world!\" }"); - QFxItem *item = qobject_cast(component.create(&engine)); + QmlComponent component(&engine, "Text { text: \"Hello world!\" }"); + QFxItem *item = qobject_cast(component.create()); //add item to view, etc ... -- cgit v0.12 From ccc5039c22d2e507b61cf3fc3b9be9684638db12 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 20 May 2009 09:43:58 +1000 Subject: Don't recreate text layout everytime it is used. --- src/declarative/fx/qfxtext.cpp | 18 ++++++------------ src/declarative/fx/qfxtext_p.h | 7 ++++++- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index bc3856d..e84255d 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -458,10 +458,11 @@ void QFxTextPrivate::updateSize() singleline = !tmp.contains(QChar::LineSeparator); if (singleline && elideMode != Qt::ElideNone && q->widthValid()) tmp = fm.elidedText(tmp,elideMode,q->width()); // XXX still worth layout...? - QTextLayout layout; + layout.clearLayout(); layout.setFont(f); layout.setText(tmp); size = setupTextLayout(&layout); + cachedLayoutSize = size; } if (richText) { singleline = false; // richtext can't elide or be optimized for single-line case @@ -608,18 +609,11 @@ QImage QFxTextPrivate::wrappedTextImage(bool drawStyle) //do layout Q_Q(const QFxText); QFont f; if (_font) f = _font->font(); - QString tmp = text; - if (singleline && elideMode != Qt::ElideNone && q->widthValid()) { - QFontMetrics fm(f); - tmp = fm.elidedText(tmp,elideMode,q->width()); // XXX still worth layout...? - } - tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); - QTextLayout textLayout(tmp, f); - QSize size = setupTextLayout(&textLayout); + QSize size = cachedLayoutSize; int x = 0; - for (int i = 0; i < textLayout.lineCount(); ++i) { - QTextLine line = textLayout.lineAt(i); + for (int i = 0; i < layout.lineCount(); ++i) { + QTextLine line = layout.lineAt(i); if (hAlign == QFxText::AlignLeft) { x = 0; } else if (hAlign == QFxText::AlignRight) { @@ -640,7 +634,7 @@ QImage QFxTextPrivate::wrappedTextImage(bool drawStyle) else p.setPen(color); p.setFont(f); - textLayout.draw(&p, QPointF(0, 0)); + layout.draw(&p, QPointF(0, 0)); return img; } diff --git a/src/declarative/fx/qfxtext_p.h b/src/declarative/fx/qfxtext_p.h index 4296891..8bb3142 100644 --- a/src/declarative/fx/qfxtext_p.h +++ b/src/declarative/fx/qfxtext_p.h @@ -56,6 +56,7 @@ #include "qfxitem.h" #include "qfxitem_p.h" #include "qml.h" +#include #if defined(QFX_RENDER_OPENGL) #include "gltexture.h" @@ -72,7 +73,9 @@ class QFxTextPrivate : public QFxItemPrivate Q_DECLARE_PUBLIC(QFxText) public: QFxTextPrivate() - : _font(0), color((QRgb)0), style(QFxText::Normal), imgDirty(true), hAlign(QFxText::AlignLeft), vAlign(QFxText::AlignTop), elideMode(Qt::ElideNone), dirty(false), wrap(false), richText(false), singleline(false), control(0), doc(0) + : _font(0), color((QRgb)0), style(QFxText::Normal), imgDirty(true), + hAlign(QFxText::AlignLeft), vAlign(QFxText::AlignTop), elideMode(Qt::ElideNone), + dirty(false), wrap(false), richText(false), singleline(false), control(0), doc(0) { } @@ -126,6 +129,8 @@ public: bool singleline; QTextControl *control; QTextDocument *doc; + QTextLayout layout; + QSize cachedLayoutSize; }; QT_END_NAMESPACE -- cgit v0.12 From 5dfacf0602c7337efe90576eeb90f1326e94d500 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 20 May 2009 10:19:54 +1000 Subject: typo --- src/declarative/canvas/qsimplecanvasitem.cpp | 2 +- src/declarative/canvas/qsimplecanvasitem.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp index fb20e95..3666b82 100644 --- a/src/declarative/canvas/qsimplecanvasitem.cpp +++ b/src/declarative/canvas/qsimplecanvasitem.cpp @@ -181,7 +181,7 @@ void QSimpleCanvasItem::childrenChanged() { } -int QSimpleCanvasItem::setPaintMargin(qreal margin) +void QSimpleCanvasItem::setPaintMargin(qreal margin) { Q_D(QSimpleCanvasItem); if (margin < d->paintmargin) diff --git a/src/declarative/canvas/qsimplecanvasitem.h b/src/declarative/canvas/qsimplecanvasitem.h index 2d65469..cf23fc6 100644 --- a/src/declarative/canvas/qsimplecanvasitem.h +++ b/src/declarative/canvas/qsimplecanvasitem.h @@ -183,7 +183,7 @@ public: }; - int setPaintMargin(qreal margin); + void setPaintMargin(qreal margin); QRectF boundingRect() const; virtual void paintContents(QPainter &); virtual void paintGLContents(GLPainter &); -- cgit v0.12 From 5b3b730c915f806cc6eb7d63779f8c45a4c2df69 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 20 May 2009 10:21:30 +1000 Subject: compile --- src/declarative/fx/qfxparticles.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp index 930d7a3..67c1208 100644 --- a/src/declarative/fx/qfxparticles.cpp +++ b/src/declarative/fx/qfxparticles.cpp @@ -1129,7 +1129,7 @@ void QFxParticlesPainter::paintContents(QPainter &p) update();//Should I need this? (GV does) } #elif defined(QFX_RENDER_OPENGL2) -void QFxParticles::paintGLContents(GLPainter &p) +void QFxParticles::paintGLContents(GLPainter &) { //painting is done by the ParticlesPainter, so it can have the right size } @@ -1155,8 +1155,8 @@ void QFxParticlesPainter::paintGLContents(GLPainter &p) glBindTexture(GL_TEXTURE_2D, d->tex.texture()); - const int myX = (int)(x() + parent->x()); - const int myY = (int)(y() + parent->y()); + const int myX = (int)(x() + parent()->x()); + const int myY = (int)(y() + parent()->y()); float widthV = d->image.width(); float heightV = d->image.height(); for (int i = 0; i < d->particles.count(); ++i) { -- cgit v0.12 From 19845ac3f4f7e3288cfdf7add68754758cd3145b Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 20 May 2009 10:54:06 +1000 Subject: Adds thread initialisation/cleanup code to mysql. Allows for cleaner multi-thread working for mysql clients. Task-number: 253407 --- src/sql/drivers/mysql/qsql_mysql.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index fbefa0c..51fc306 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -1279,6 +1279,11 @@ bool QMYSQLDriver::open(const QString& db, d->preparedQuerysEnabled = false; #endif +#ifndef QT_NO_THREAD + mysql_thread_init(); +#endif + + setOpen(true); setOpenError(false); return true; @@ -1287,6 +1292,9 @@ bool QMYSQLDriver::open(const QString& db, void QMYSQLDriver::close() { if (isOpen()) { +#ifndef QT_NO_THREAD + mysql_thread_end(); +#endif mysql_close(d->mysql); d->mysql = NULL; setOpen(false); -- cgit v0.12 From 7f872ea70d357788bbda18f28d4765d5c3a1510e Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 20 May 2009 11:08:20 +1000 Subject: Fix breakage. Line was accidentally deleted. --- src/declarative/fx/qfxrect.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index b61baec..f1cbb58 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -751,6 +751,8 @@ void QFxRect::paintGLContents(GLPainter &p) 1, 1, 1, texbottom }; + glBindTexture(GL_TEXTURE_2D, d->_rectTexture.texture()); + shader->setAttributeArray(SingleTextureShader::Vertices, vert1, 2); shader->setAttributeArray(SingleTextureShader::TextureCoords, tex1, 2); glDrawArrays(GL_TRIANGLE_STRIP, 0, 8); -- cgit v0.12 From 82a5d55502f465f17e1a6f16d9c64a19aa9dfe5e Mon Sep 17 00:00:00 2001 From: Stian Sandvik Thomassen Date: Wed, 20 May 2009 11:18:01 +1000 Subject: Added auto-test for QComboBox::setItemDelegate and task 253944 --- tests/auto/qcombobox/tst_qcombobox.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 6a87e3c..2fff6d0 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -76,6 +76,7 @@ #endif #include #include "../../shared/util.h" +#include //TESTED_CLASS= //TESTED_FILES= @@ -141,6 +142,8 @@ private slots: void setModelColumn(); void noScrollbar_data(); void noScrollbar(); + void setItemDelegate(); + void task253944_itemDelegateIsReset(); protected slots: void onEditTextChanged( const QString &newString ); @@ -2206,5 +2209,26 @@ void tst_QComboBox::noScrollbar() } } +void tst_QComboBox::setItemDelegate() +{ + QComboBox comboBox; + QStyledItemDelegate *itemDelegate = new QStyledItemDelegate; + comboBox.setItemDelegate(itemDelegate); + QCOMPARE(comboBox.itemDelegate(), itemDelegate); +} + +void tst_QComboBox::task253944_itemDelegateIsReset() +{ + QComboBox comboBox; + QStyledItemDelegate *itemDelegate = new QStyledItemDelegate; + comboBox.setItemDelegate(itemDelegate); + + comboBox.setEditable(true); + QCOMPARE(comboBox.itemDelegate(), itemDelegate); + + comboBox.setStyleSheet("QComboBox { border: 1px solid gray; }"); + QCOMPARE(comboBox.itemDelegate(), itemDelegate); +} + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" -- cgit v0.12 From 34bcce7616b2e2b8fae05174ca881bbbb0bc8b79 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 20 May 2009 11:26:15 +1000 Subject: Fix width=0 pens without radius. --- src/declarative/fx/qfxrect.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index f1cbb58..f81f9b3 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -55,7 +55,7 @@ QML_DEFINE_TYPE(QFxPen,Pen); By default, the pen is invalid and nothing is drawn. You must either set a color (then the default width is 0) or a width (then the default color is black). - A width of 0 is a single-pixel line on the border of the item being painted. + A width of 0 indicates a cosmetic pen, a single-pixel line on the border of the item being painted. Example: \qml @@ -401,7 +401,7 @@ void QFxRect::generateRoundedRect() Q_D(QFxRect); if (d->_rectImage.isNull()) { const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0; - d->_rectImage = QImage(d->_radius*2 + 1 + pw*2, d->_radius*2 + 1 + pw*2, QImage::Format_ARGB32_Premultiplied); + d->_rectImage = QImage(d->_radius*2 + 3 + pw*2, d->_radius*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied); d->_rectImage.fill(0); QPainter p(&(d->_rectImage)); p.setRenderHint(QPainter::Antialiasing); @@ -421,7 +421,7 @@ void QFxRect::generateBorderedRect() Q_D(QFxRect); if (d->_rectImage.isNull()) { const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0; - d->_rectImage = QImage(d->pen()->width()*2 + 1 + pw*2, d->pen()->width()*2 + 1 + pw*2, QImage::Format_ARGB32_Premultiplied); + d->_rectImage = QImage(d->pen()->width()*2 + 3 + pw*2, d->pen()->width()*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied); d->_rectImage.fill(0); QPainter p(&(d->_rectImage)); p.setRenderHint(QPainter::Antialiasing); @@ -533,10 +533,10 @@ void QFxRect::drawRect(QPainter &p) if (d->_radius > 0) { generateRoundedRect(); //### implicit conversion to int - offset = int(d->_radius+0.5+pw); + offset = int(d->_radius+1.5+pw); } else { generateBorderedRect(); - offset = pw; + offset = pw+1; } //basically same code as QFxImage uses to paint sci images -- cgit v0.12 From 73e645e2d0594d31b8e4945469b74bb6e230faed Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 20 May 2009 11:56:48 +1000 Subject: Remove unnecessary code --- src/declarative/qml/qmlvme.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index f4ce891..1552cb5 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -87,7 +87,6 @@ Q_DECLARE_PERFORMANCE_LOG(QFxCompiler) { Q_DECLARE_PERFORMANCE_METRIC(InstrStoreObject); Q_DECLARE_PERFORMANCE_METRIC(InstrStoreSignal); Q_DECLARE_PERFORMANCE_METRIC(InstrStoreObjectQmlList); - Q_DECLARE_PERFORMANCE_METRIC(InstrAssignConstant); Q_DECLARE_PERFORMANCE_METRIC(InstrAssignSignalObject); Q_DECLARE_PERFORMANCE_METRIC(InstrAssignValueSource); Q_DECLARE_PERFORMANCE_METRIC(InstrStoreBinding); @@ -134,7 +133,6 @@ Q_DEFINE_PERFORMANCE_LOG(QFxCompiler, "QFxCompiler") { Q_DEFINE_PERFORMANCE_METRIC(InstrStoreObject, "StoreObject"); Q_DEFINE_PERFORMANCE_METRIC(InstrStoreSignal, "StoreSignal"); Q_DEFINE_PERFORMANCE_METRIC(InstrStoreObjectQmlList, "StoreObjectQmlList"); - Q_DEFINE_PERFORMANCE_METRIC(InstrAssignConstant, "AssignConstant"); Q_DEFINE_PERFORMANCE_METRIC(InstrAssignSignalObject, "AssignSignalObject"); Q_DEFINE_PERFORMANCE_METRIC(InstrAssignValueSource, "AssignValueSource"); Q_DEFINE_PERFORMANCE_METRIC(InstrStoreBinding, "StoreBinding"); -- cgit v0.12 From 3158bf19bd49f72ca379203ea259e7b2d371f0d4 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 20 May 2009 12:03:29 +1000 Subject: Fix some test data --- tests/auto/declarative/qmlparser/empty.errors.txt | 2 +- tests/auto/declarative/qmlparser/missingSignal.errors.txt | 2 +- .../declarative/qmlparser/nonexistantProperty.1.errors.txt | 2 +- .../declarative/qmlparser/nonexistantProperty.2.errors.txt | 2 +- .../declarative/qmlparser/nonexistantProperty.3.errors.txt | 2 +- .../declarative/qmlparser/nonexistantProperty.4.errors.txt | 2 +- tests/auto/declarative/qmlparser/tst_qmlparser.cpp | 12 ++++++------ .../declarative/qmlparser/unsupportedProperty.errors.txt | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/auto/declarative/qmlparser/empty.errors.txt b/tests/auto/declarative/qmlparser/empty.errors.txt index 101b6a2..e0ed268 100644 --- a/tests/auto/declarative/qmlparser/empty.errors.txt +++ b/tests/auto/declarative/qmlparser/empty.errors.txt @@ -1 +1 @@ -0:0:Syntax error +0:0:Expected token `identifier' diff --git a/tests/auto/declarative/qmlparser/missingSignal.errors.txt b/tests/auto/declarative/qmlparser/missingSignal.errors.txt index 9815b99..5c612cc 100644 --- a/tests/auto/declarative/qmlparser/missingSignal.errors.txt +++ b/tests/auto/declarative/qmlparser/missingSignal.errors.txt @@ -1 +1 @@ -2:-1:Unknown property "onClicked" +2:5:Cannot assign binding to non-existant property "onClicked" diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.1.errors.txt b/tests/auto/declarative/qmlparser/nonexistantProperty.1.errors.txt index 406ad83..e8f1a91 100644 --- a/tests/auto/declarative/qmlparser/nonexistantProperty.1.errors.txt +++ b/tests/auto/declarative/qmlparser/nonexistantProperty.1.errors.txt @@ -1 +1 @@ -1:-1:Unknown property "something" +1:15:Cannot assign value to non-existant property "something" diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.2.errors.txt b/tests/auto/declarative/qmlparser/nonexistantProperty.2.errors.txt index b371a0f..c154f91 100644 --- a/tests/auto/declarative/qmlparser/nonexistantProperty.2.errors.txt +++ b/tests/auto/declarative/qmlparser/nonexistantProperty.2.errors.txt @@ -1 +1 @@ -2:-1:Unknown property "something" +2:5:Cannot assign value to non-existant property "something" diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.3.errors.txt b/tests/auto/declarative/qmlparser/nonexistantProperty.3.errors.txt index b371a0f..a254d7d 100644 --- a/tests/auto/declarative/qmlparser/nonexistantProperty.3.errors.txt +++ b/tests/auto/declarative/qmlparser/nonexistantProperty.3.errors.txt @@ -1 +1 @@ -2:-1:Unknown property "something" +2:5:Cannot assign binding to non-existant property "something" diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.4.errors.txt b/tests/auto/declarative/qmlparser/nonexistantProperty.4.errors.txt index b371a0f..a254d7d 100644 --- a/tests/auto/declarative/qmlparser/nonexistantProperty.4.errors.txt +++ b/tests/auto/declarative/qmlparser/nonexistantProperty.4.errors.txt @@ -1 +1 @@ -2:-1:Unknown property "something" +2:5:Cannot assign binding to non-existant property "something" diff --git a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp index 089c116..91433ba 100644 --- a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp +++ b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp @@ -92,10 +92,10 @@ void tst_qmlparser::errors_data() QTest::addColumn("errorFile"); QTest::addColumn("create"); - QTest::newRow("nonExistantProperty.1") << "nonexistantProperty.1.txt" << "nonexistantProperty.1.errors.txt" << true; - QTest::newRow("nonExistantProperty.2") << "nonexistantProperty.2.txt" << "nonexistantProperty.2.errors.txt" << true; - QTest::newRow("nonExistantProperty.3") << "nonexistantProperty.3.txt" << "nonexistantProperty.3.errors.txt" << true; - QTest::newRow("nonExistantProperty.4") << "nonexistantProperty.4.txt" << "nonexistantProperty.4.errors.txt" << true; + QTest::newRow("nonExistantProperty.1") << "nonexistantProperty.1.txt" << "nonexistantProperty.1.errors.txt" << false; + QTest::newRow("nonExistantProperty.2") << "nonexistantProperty.2.txt" << "nonexistantProperty.2.errors.txt" << false; + QTest::newRow("nonExistantProperty.3") << "nonexistantProperty.3.txt" << "nonexistantProperty.3.errors.txt" << false; + QTest::newRow("nonExistantProperty.4") << "nonexistantProperty.4.txt" << "nonexistantProperty.4.errors.txt" << false; QTest::newRow("nonExistantProperty.5") << "nonexistantProperty.5.txt" << "nonexistantProperty.5.errors.txt" << false; QTest::newRow("nonExistantProperty.6") << "nonexistantProperty.6.txt" << "nonexistantProperty.6.errors.txt" << true; @@ -127,7 +127,7 @@ void tst_qmlparser::errors_data() QTest::newRow("invalidID.3") << "invalidID.3.txt" << "invalidID.3.errors.txt" << false; QTest::newRow("invalidID.4") << "invalidID.4.txt" << "invalidID.4.errors.txt" << false; - QTest::newRow("unsupportedProperty") << "unsupportedProperty.txt" << "unsupportedProperty.errors.txt" << true; + QTest::newRow("unsupportedProperty") << "unsupportedProperty.txt" << "unsupportedProperty.errors.txt" << false; QTest::newRow("nullDotProperty") << "nullDotProperty.txt" << "nullDotProperty.errors.txt" << true; QTest::newRow("fakeDotProperty") << "fakeDotProperty.txt" << "fakeDotProperty.errors.txt" << true; QTest::newRow("duplicateIDs") << "duplicateIDs.txt" << "duplicateIDs.errors.txt" << false; @@ -135,7 +135,7 @@ void tst_qmlparser::errors_data() QTest::newRow("empty") << "empty.txt" << "empty.errors.txt" << false; QTest::newRow("missingObject") << "missingObject.txt" << "missingObject.errors.txt" << false; QTest::newRow("failingComponent") << "failingComponent.txt" << "failingComponent.errors.txt" << true; - QTest::newRow("missingSignal") << "missingSignal.txt" << "missingSignal.errors.txt" << true; + QTest::newRow("missingSignal") << "missingSignal.txt" << "missingSignal.errors.txt" << false; } void tst_qmlparser::errors() diff --git a/tests/auto/declarative/qmlparser/unsupportedProperty.errors.txt b/tests/auto/declarative/qmlparser/unsupportedProperty.errors.txt index f396e7e..a067ecb 100644 --- a/tests/auto/declarative/qmlparser/unsupportedProperty.errors.txt +++ b/tests/auto/declarative/qmlparser/unsupportedProperty.errors.txt @@ -1 +1 @@ -2:-1:Property matrix is of an unknown type +2:5:Cannot assign value to property matrix of unknown type -- cgit v0.12 From 8ccd6b9dfea90b9d12b77d789484fbb5881b1463 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 20 May 2009 12:34:24 +1000 Subject: Add support for qsTranslate, QT_TR_NOOP, and QT_TRANSLATE_NOOP. --- tools/linguist/lupdate/qml.cpp | 43 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/tools/linguist/lupdate/qml.cpp b/tools/linguist/lupdate/qml.cpp index 6eec72e..78a9afd 100644 --- a/tools/linguist/lupdate/qml.cpp +++ b/tools/linguist/lupdate/qml.cpp @@ -88,7 +88,8 @@ protected: virtual void endVisit(AST::CallExpression *node) { if (AST::IdentifierExpression *idExpr = AST::cast(node->base)) { - if (idExpr->name->asString() == QLatin1String("qsTr")) { + if (idExpr->name->asString() == QLatin1String("qsTr") || + idExpr->name->asString() == QLatin1String("QT_TR_NOOP")) { if (node->arguments && AST::cast(node->arguments->expression)) { AST::StringLiteral *literal = AST::cast(node->arguments->expression); const QString source = literal->value->asString(); @@ -102,8 +103,8 @@ protected: AST::ArgumentList *nNode = commentNode->next; if (nNode) { - AST::NumericLiteral *literal3 = AST::cast(nNode->expression); - if (literal3) { + AST::NumericLiteral *numLiteral = AST::cast(nNode->expression); + if (numLiteral) { plural = true; } } @@ -115,8 +116,42 @@ protected: TranslatorMessage::Unfinished, plural); m_translator->extend(msg); } + } else if (idExpr->name->asString() == QLatin1String("qsTranslate") || + idExpr->name->asString() == QLatin1String("QT_TRANSLATE_NOOP")) { + if (node->arguments && AST::cast(node->arguments->expression)) { + AST::StringLiteral *literal = AST::cast(node->arguments->expression); + const QString context = literal->value->asString(); + + QString source; + QString comment; + bool plural = false; + AST::ArgumentList *sourceNode = node->arguments->next; + if (sourceNode) { + literal = AST::cast(sourceNode->expression); + source = literal->value->asString(); + AST::ArgumentList *commentNode = sourceNode->next; + if (commentNode) { + literal = AST::cast(commentNode->expression); + comment = literal->value->asString(); + + AST::ArgumentList *nNode = commentNode->next; + if (nNode) { + AST::NumericLiteral *numLiteral = AST::cast(nNode->expression); + if (numLiteral) { + plural = true; + } + } + } + } + + TranslatorMessage msg(context, source, + comment, QString(), m_fileName, + node->firstSourceLocation().startLine, QStringList(), + TranslatorMessage::Unfinished, plural); + m_translator->extend(msg); + } + } - //### support qsTranslate, QT_TR_NOOP, and QT_TRANSLATE_NOOP } } -- cgit v0.12 From d1f1f2c91f63609ca1ffad32efdd6590f9f0ce6a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 20 May 2009 13:15:29 +1000 Subject: Fix Rotation element for OpenGL. --- src/declarative/fx/qfxtransform.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp index bc59e0a..d99af27 100644 --- a/src/declarative/fx/qfxtransform.cpp +++ b/src/declarative/fx/qfxtransform.cpp @@ -272,7 +272,9 @@ QMatrix4x4 QFxRotation::transform() const if (_dirty) { _transform = QMatrix4x4(); _dirty = false; - _transform.rotate(_angle, _originX, _originY); + _transform.translate(_originX, _originY); + _transform.rotate(_angle, 0, 0, 1); + _transform.translate(-_originX, -_originY); } return _transform; } -- cgit v0.12 From 121b9bfaf404c602f40056d6c82c9cb2bb477ab6 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 20 May 2009 14:40:31 +1000 Subject: Use a thread for QXmlQuery to avoid its event loop messing with us. --- src/declarative/extra/qmlxmllistmodel.cpp | 407 +++++++++++++++++++----------- src/declarative/extra/qmlxmllistmodel.h | 5 +- 2 files changed, 264 insertions(+), 148 deletions(-) diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp index bba817d..3732323 100644 --- a/src/declarative/extra/qmlxmllistmodel.cpp +++ b/src/declarative/extra/qmlxmllistmodel.cpp @@ -45,6 +45,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -57,6 +61,197 @@ QT_BEGIN_NAMESPACE QML_DEFINE_TYPE(XmlListModelRole, Role); QML_DEFINE_TYPE(QmlXmlListModel, XmlListModel); + +class QmlXmlListModelPrivate; +struct QmlXmlRoleList : public QmlConcreteList +{ + QmlXmlRoleList(QmlXmlListModelPrivate *p) + : model(p) {} + virtual void append(XmlListModelRole *role); + //XXX clear, removeAt, and insert need to invalidate any cached data (in data table) as well + // (and the model should emit the appropriate signals) + virtual void clear(); + virtual void removeAt(int i); + virtual void insert(int i, XmlListModelRole *role); + + QmlXmlListModelPrivate *model; +}; + + + +class QmlXmlQuery : public QThread +{ + Q_OBJECT +public: + QmlXmlQuery(QObject *parent=0) + : QThread(parent), m_quit(false), m_restart(false), m_abort(false), m_queryId(0) { + } + ~QmlXmlQuery() { + m_mutex.lock(); + m_quit = true; + m_condition.wakeOne(); + m_mutex.unlock(); + + wait(); + } + + void abort() { + QMutexLocker locker(&m_mutex); + m_abort = true; + } + + int doQuery(QString query, QString namespaces, QByteArray data, QmlXmlRoleList *roleObjects) { + QMutexLocker locker(&m_mutex); + m_modelData.clear(); + m_size = 0; + m_data = data; + m_query = query; + m_namespaces = namespaces; + m_roleObjects = roleObjects; + if (!isRunning()) { + m_abort = false; + start(); + } else { + m_restart = true; + m_condition.wakeOne(); + } + m_queryId++; + return m_queryId; + } + + QList > modelData() { + QMutexLocker locker(&m_mutex); + return m_modelData; + } + +signals: + void queryCompleted(int queryId, int size); + +protected: + void run() { + while (!m_quit) { + m_mutex.lock(); + int queryId = m_queryId; + doQueryJob(); + if (m_size > 0) + doSubQueryJob(); + m_data.clear(); // no longer needed + m_mutex.unlock(); + + m_mutex.lock(); + if (!m_abort && m_size > 0) + emit queryCompleted(queryId, m_size); + if (!m_restart) + m_condition.wait(&m_mutex); + m_abort = false; + m_restart = false; + m_mutex.unlock(); + } + } + +private: + void doQueryJob(); + void doSubQueryJob(); + +private: + QMutex m_mutex; + QWaitCondition m_condition; + bool m_quit; + bool m_restart; + bool m_abort; + QByteArray m_data; + QString m_query; + QString m_namespaces; + QString m_prefix; + int m_size; + int m_queryId; + const QmlXmlRoleList *m_roleObjects; + QList > m_modelData; +}; + +void QmlXmlQuery::doQueryJob() +{ + QString r; + QXmlQuery query; + QBuffer buffer(&m_data); + buffer.open(QIODevice::ReadOnly); + query.bindVariable(QLatin1String("src"), &buffer); + query.setQuery(m_namespaces + m_query); + query.evaluateTo(&r); + + //qDebug() << r; + + //always need a single root element + QByteArray xml = "\n" + r.toUtf8() + ""; + QBuffer b(&xml); + b.open(QIODevice::ReadOnly); + //qDebug() << xml; + + QString namespaces = QLatin1String("declare namespace dummy=\"http://qtsotware.com/dummy\";\n") + m_namespaces; + QString prefix = QLatin1String("doc($inputDocument)/dummy:items") + + m_query.mid(m_query.lastIndexOf(QLatin1Char('/'))); + + //figure out how many items we are dealing with + int count = -1; + { + QXmlResultItems result; + QXmlQuery countquery; + countquery.bindVariable(QLatin1String("inputDocument"), &b); + countquery.setQuery(namespaces + QLatin1String("count(") + prefix + QLatin1String(")")); + countquery.evaluateTo(&result); + QXmlItem item(result.next()); + if (item.isAtomicValue()) + count = item.toAtomicValue().toInt(); + prefix += QLatin1String("[%1]/"); + } + //qDebug() << count; + + m_prefix = namespaces + prefix; + m_data = xml; + if (count > 0) + m_size = count; +} + +void QmlXmlQuery::doSubQueryJob() +{ + m_modelData.clear(); + + QBuffer b(&m_data); + b.open(QIODevice::ReadOnly); + + QXmlQuery subquery; + subquery.bindVariable(QLatin1String("inputDocument"), &b); + + //XXX should we use an array of objects or something else rather than a table? + for (int j = 0; j < m_size; ++j) { + QList resultList; + for (int i = 0; i < m_roleObjects->size(); ++i) { + XmlListModelRole *role = m_roleObjects->at(i); + subquery.setQuery(m_prefix.arg(j+1) + role->query()); + if (role->isStringList()) { + QStringList data; + subquery.evaluateTo(&data); + resultList << QVariant(data); + //qDebug() << data; + } else { + QString s; + subquery.evaluateTo(&s); + if (role->isCData()) { + //un-escape + s.replace(QLatin1String("<"), QLatin1String("<")); + s.replace(QLatin1String(">"), QLatin1String(">")); + s.replace(QLatin1String("&"), QLatin1String("&")); + } + resultList << s.trimmed(); + //qDebug() << s; + } + b.seek(0); + } + m_modelData << resultList; + } +} + + //TODO: do something smart while waiting for data to load // error handling (currently quite fragile) // profile doQuery and doSubquery @@ -64,6 +259,59 @@ QML_DEFINE_TYPE(QmlXmlListModel, XmlListModel); // support complex/nested objects? // how do we handle data updates (like rss feed -- usually items inserted at beginning) + +class QmlXmlListModelPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QmlXmlListModel) +public: + QmlXmlListModelPrivate() + : isClassComplete(false), size(-1), highestRole(Qt::UserRole) + , reply(0), queryId(-1), roleObjects(this) {} + + bool isClassComplete; + QString src; + QString query; + QString namespaces; + int size; + QList roles; + QStringList roleNames; + int highestRole; + QNetworkReply *reply; + QmlXmlQuery qmlXmlQuery; + int queryId; + QmlXmlRoleList roleObjects; + QList > data; +}; + + +void QmlXmlRoleList::append(XmlListModelRole *role) { + QmlConcreteList::append(role); + model->roles << model->highestRole; + model->roleNames << role->name(); + ++model->highestRole; +} +//XXX clear, removeAt, and insert need to invalidate any cached data (in data table) as well +// (and the model should emit the appropriate signals) +void QmlXmlRoleList::clear() +{ + model->roles.clear(); + model->roleNames.clear(); + QmlConcreteList::clear(); +} +void QmlXmlRoleList::removeAt(int i) +{ + model->roles.removeAt(i); + model->roleNames.removeAt(i); + QmlConcreteList::removeAt(i); +} +void QmlXmlRoleList::insert(int i, XmlListModelRole *role) +{ + QmlConcreteList::insert(i, role); + model->roles.insert(i, model->highestRole); + model->roleNames.insert(i, role->name()); + ++model->highestRole; +} + /*! \qmlclass XmlListModel \brief The XmlListModel class allows you to specify a model using XQuery. @@ -86,71 +334,17 @@ QML_DEFINE_TYPE(QmlXmlListModel, XmlListModel); \note The model is currently static, so the above is really just a snapshot of an RSS feed. */ -class QmlXmlListModelPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QmlXmlListModel) -public: - QmlXmlListModelPrivate() : isClassComplete(false), size(-1), highestRole(Qt::UserRole), reply(0), roleObjects(this) {} - - bool isClassComplete; - QString src; - QString query; - QString namespaces; - QList roles; - QStringList roleNames; - mutable QList > data; - int size; - int highestRole; - QNetworkReply *reply; - mutable QByteArray xml; - QString prefix; - - struct RoleList : public QmlConcreteList - { - RoleList(QmlXmlListModelPrivate *p) - : model(p) {} - virtual void append(XmlListModelRole *role) { - QmlConcreteList::append(role); - model->roles << model->highestRole; - model->roleNames << role->name(); - ++model->highestRole; - } - //XXX clear, removeAt, and insert need to invalidate any cached data (in data table) as well - // (and the model should emit the appropriate signals) - virtual void clear() - { - model->roles.clear(); - model->roleNames.clear(); - QmlConcreteList::clear(); - } - virtual void removeAt(int i) - { - model->roles.removeAt(i); - model->roleNames.removeAt(i); - QmlConcreteList::removeAt(i); - } - virtual void insert(int i, XmlListModelRole *role) - { - QmlConcreteList::insert(i, role); - model->roles.insert(i, model->highestRole); - model->roleNames.insert(i, role->name()); - ++model->highestRole; - } - - QmlXmlListModelPrivate *model; - }; - - RoleList roleObjects; -}; - QmlXmlListModel::QmlXmlListModel(QObject *parent) : QListModelInterface(*(new QmlXmlListModelPrivate), parent) { Q_D(QmlXmlListModel); + connect(&d->qmlXmlQuery, SIGNAL(queryCompleted(int,int)), + this, SLOT(queryCompleted(int,int))); } QmlXmlListModel::~QmlXmlListModel() { + Q_D(QmlXmlListModel); } QmlList *QmlXmlListModel::roleObjects() @@ -163,10 +357,6 @@ QHash QmlXmlListModel::data(int index, const QList &roles) co { Q_D(const QmlXmlListModel); QHash rv; - - if (index > d->data.count() - 1) - doSubquery(index); - for (int i = 0; i < roles.size(); ++i) { int role = roles.at(i); int roleIndex = d->roles.indexOf(role); @@ -255,6 +445,9 @@ void QmlXmlListModel::reload() if (!d->isClassComplete) return; + d->qmlXmlQuery.abort(); + d->queryId = -1; + //clear existing data d->size = 0; int count = d->data.count(); @@ -288,98 +481,24 @@ void QmlXmlListModel::requestFinished() d->reply = 0; } else { QByteArray data = d->reply->readAll(); - doQuery(data); + d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, data, &d->roleObjects); d->reply->deleteLater(); d->reply = 0; } } -void QmlXmlListModel::doQuery(QByteArray &rawData) +void QmlXmlListModel::queryCompleted(int id, int size) { Q_D(QmlXmlListModel); - QString r; - QXmlQuery query; - QBuffer rawBuffer(&rawData); - rawBuffer.open(QIODevice::ReadOnly); - query.bindVariable(QLatin1String("src"), &rawBuffer); - query.setQuery(d->namespaces + d->query); - query.evaluateTo(&r); - //qDebug() << r; - - //always need a single root element - QByteArray xml = "\n" + r.toUtf8() + ""; - QBuffer b(&xml); - b.open(QIODevice::ReadOnly); - //qDebug() << xml; - - QString namespaces = QLatin1String("declare namespace dummy=\"http://qtsotware.com/dummy\";\n") + d->namespaces; - QString prefix = QLatin1String("doc($inputDocument)/dummy:items") + - d->query.mid(d->query.lastIndexOf(QLatin1Char('/'))); - - //figure out how many items we are dealing with - int count = -1; - { - QXmlResultItems result; - QXmlQuery countquery; - countquery.bindVariable(QLatin1String("inputDocument"), &b); - countquery.setQuery(namespaces + QLatin1String("count(") + prefix + QLatin1String(")")); - countquery.evaluateTo(&result); - QXmlItem item(result.next()); - if (item.isAtomicValue()) - count = item.toAtomicValue().toInt(); - b.seek(0); - prefix += QLatin1String("[%1]/"); + if (id != d->queryId) + return; + d->size = size; + if (size > 0) { + d->data = d->qmlXmlQuery.modelData(); + emit itemsInserted(0, d->size); } - //qDebug() << count; - - QXmlQuery subquery; - subquery.bindVariable(QLatin1String("inputDocument"), &b); - d->prefix = namespaces + prefix; - d->xml = xml; - - d->size = count; - - if (count > 0) - emit itemsInserted(0, count); } -void QmlXmlListModel::doSubquery(int index) const -{ - Q_D(const QmlXmlListModel); - //qDebug() << "doSubQuery" << index; - QBuffer b(&d->xml); - b.open(QIODevice::ReadOnly); - - QXmlQuery subquery; - subquery.bindVariable(QLatin1String("inputDocument"), &b); - - //XXX should we use an array of objects or something else rather than a table? - for (int j = d->data.count(); j <= index; ++j) { - QList resultList; - for (int i = 0; i < d->roleObjects.size(); ++i) { - XmlListModelRole *role = d->roleObjects.at(i); - subquery.setQuery(d->prefix.arg(j+1) + role->query()); - if (role->isStringList()) { - QStringList data; - subquery.evaluateTo(&data); - resultList << QVariant(data); - //qDebug() << data; - } else { - QString s; - subquery.evaluateTo(&s); - if (role->isCData()) { - //un-escape - s.replace(QLatin1String("<"), QLatin1String("<")); - s.replace(QLatin1String(">"), QLatin1String(">")); - s.replace(QLatin1String("&"), QLatin1String("&")); - } - resultList << s.trimmed(); - //qDebug() << s; - } - b.seek(0); - } - d->data << resultList; - } -} +#include "qmlxmllistmodel.moc" QT_END_NAMESPACE diff --git a/src/declarative/extra/qmlxmllistmodel.h b/src/declarative/extra/qmlxmllistmodel.h index 2e932cb..1fbe923 100644 --- a/src/declarative/extra/qmlxmllistmodel.h +++ b/src/declarative/extra/qmlxmllistmodel.h @@ -120,12 +120,9 @@ public: public Q_SLOTS: void reload(); -protected: - void doQuery(QByteArray &rawData); - void doSubquery(int index) const; - private Q_SLOTS: void requestFinished(); + void queryCompleted(int,int); private: Q_DECLARE_PRIVATE(QmlXmlListModel) -- cgit v0.12 From ded29009f766a8373193d94bcb8309270f66a266 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 20 May 2009 14:42:44 +1000 Subject: Make VisualItemModel with packages work properly. The views can all now deal with items that they have not requested appearing, and will lay them out appropriately. --- src/declarative/fx/qfxgridview.cpp | 158 +++++++++++++++----------- src/declarative/fx/qfxgridview.h | 2 + src/declarative/fx/qfxlistview.cpp | 181 +++++++++++++++++------------- src/declarative/fx/qfxlistview.h | 2 + src/declarative/fx/qfxpathview.cpp | 14 ++- src/declarative/fx/qfxpathview.h | 2 +- src/declarative/fx/qfxpathview_p.h | 3 + src/declarative/fx/qfxvisualitemmodel.cpp | 178 ++++++++++++++++++----------- src/declarative/fx/qfxvisualitemmodel.h | 13 ++- src/declarative/util/qmlpackage.cpp | 5 + 10 files changed, 339 insertions(+), 219 deletions(-) diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 876172d..c14408a 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -121,9 +121,9 @@ public: qreal rowPos() const { return (view->flow() == QFxGridView::LeftToRight ? item->y() : item->x()); } qreal colPos() const { return (view->flow() == QFxGridView::LeftToRight ? item->x() : item->y()); } qreal endRowPos() const { - return (view->flow() == QFxGridView::LeftToRight - ? item->y() + (item->height() > 0 ? item->height() : 1) - : item->x() + (item->width() > 0 ? item->width() : 1)) - 1; + return view->flow() == QFxGridView::LeftToRight + ? item->y() + view->cellHeight() - 1 + : item->x() + view->cellWidth() - 1; } void setPosition(qreal col, qreal row) { if (view->flow() == QFxGridView::LeftToRight) { @@ -149,7 +149,7 @@ public: QFxGridViewPrivate() : model(0), currentItem(0), tmpCurrent(0), flow(QFxGridView::LeftToRight) , visiblePos(0), visibleIndex(0) , currentIndex(-1) - , cellWidth(100), cellHeight(100), columns(1) + , cellWidth(100), cellHeight(100), columns(1), requestedIndex(-1) , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0) , keyPressed(false), ownModel(false), wrap(false), autoHighlight(true) @@ -157,13 +157,14 @@ public: void init(); void clear(); - FxGridItem *getItem(int modelIndex); FxGridItem *createItem(int modelIndex); void releaseItem(FxGridItem *item); void refill(qreal from, qreal to); void updateGrid(); void layout(bool removed=false); + void updateUnrequestedIndexes(); + void updateUnrequestedPositions(); void updateTrackedItem(); void createHighlight(); void updateHighlight(); @@ -290,6 +291,7 @@ public: QFxVisualItemModel *model; QVariant modelVariant; QList visibleItems; + QHash unrequestedItems; FxGridItem *currentItem; QFxItem *tmpCurrent; QFxGridView::Flow flow; @@ -299,6 +301,7 @@ public: int cellWidth; int cellHeight; int columns; + int requestedIndex; QmlComponent *highlightComponent; FxGridItem *highlight; FxGridItem *trackedItem; @@ -330,29 +333,18 @@ void QFxGridViewPrivate::clear() visibleItems.clear(); visiblePos = 0; visibleIndex = 0; - if (currentItem) { - FxGridItem *tmpItem = currentItem; - currentItem = 0; - currentIndex = -1; - releaseItem(tmpItem); - } + releaseItem(currentItem); + currentItem = 0; + currentIndex = -1; createHighlight(); trackedItem = 0; } -FxGridItem *QFxGridViewPrivate::getItem(int modelIndex) -{ - if (currentItem && modelIndex == currentIndex) - return currentItem; - if (FxGridItem *listItem = visibleItem(modelIndex)) - return listItem; - return createItem(modelIndex); -} - FxGridItem *QFxGridViewPrivate::createItem(int modelIndex) { Q_Q(QFxGridView); // create object + requestedIndex = modelIndex; FxGridItem *listItem = 0; if (QFxItem *item = model->item(modelIndex, false)) { listItem = new FxGridItem(item, q); @@ -362,6 +354,7 @@ FxGridItem *QFxGridViewPrivate::createItem(int modelIndex) listItem->item->setZ(modelIndex + 1); listItem->item->setParent(q->viewport()); } + requestedIndex = 0; return listItem; } @@ -369,15 +362,18 @@ FxGridItem *QFxGridViewPrivate::createItem(int modelIndex) void QFxGridViewPrivate::releaseItem(FxGridItem *item) { Q_Q(QFxGridView); - if (item != currentItem) { - if (trackedItem == item) { - QObject::disconnect(trackedItem->item, SIGNAL(topChanged()), q, SLOT(trackedPositionChanged())); - QObject::disconnect(trackedItem->item, SIGNAL(leftChanged()), q, SLOT(trackedPositionChanged())); - trackedItem = 0; - } - model->release(item->item); - delete item; + if (!item) + return; + if (trackedItem == item) { + QObject::disconnect(trackedItem->item, SIGNAL(topChanged()), q, SLOT(trackedPositionChanged())); + QObject::disconnect(trackedItem->item, SIGNAL(leftChanged()), q, SLOT(trackedPositionChanged())); + trackedItem = 0; } + if (model->release(item->item) == 0) { + // item was not destroyed, and we no longer reference it. + unrequestedItems.insert(item->item, model->indexOf(item->item, q)); + } + delete item; } void QFxGridViewPrivate::refill(qreal from, qreal to) @@ -409,7 +405,7 @@ void QFxGridViewPrivate::refill(qreal from, qreal to) FxGridItem *item = 0; while (modelIndex < model->count() && rowPos <= to) { //qDebug() << "refill: append item" << modelIndex; - if (!(item = getItem(modelIndex))) + if (!(item = createItem(modelIndex))) break; item->setPosition(colPos, rowPos); visibleItems.append(item); @@ -432,7 +428,7 @@ void QFxGridViewPrivate::refill(qreal from, qreal to) } while (visibleIndex > 0 && rowPos + rowSize() - 1 >= from){ //qDebug() << "refill: prepend item" << visibleIndex-1 << "top pos" << rowPos << colPos; - if (!(item = getItem(visibleIndex-1))) + if (!(item = createItem(visibleIndex-1))) break; --visibleIndex; item->setPosition(colPos, rowPos); @@ -518,6 +514,28 @@ void QFxGridViewPrivate::layout(bool removed) q->setViewportWidth(endPosition() - startPosition()); fixupX(); } + updateUnrequestedPositions(); +} + +void QFxGridViewPrivate::updateUnrequestedIndexes() +{ + Q_Q(QFxGridView); + QHash::iterator it; + for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) + *it = model->indexOf(it.key(), q); +} + +void QFxGridViewPrivate::updateUnrequestedPositions() +{ + QHash::const_iterator it; + for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) { + qDebug() << "pos of" << (*it) << colPosAt(*it) << rowPosAt(*it); + if (flow == QFxGridView::LeftToRight) { + it.key()->setPos(QPointF(colPosAt(*it), rowPosAt(*it))); + } else { + it.key()->setPos(QPointF(rowPosAt(*it), colPosAt(*it))); + } + } } void QFxGridViewPrivate::updateTrackedItem() @@ -606,11 +624,11 @@ void QFxGridViewPrivate::updateCurrent(int modelIndex) Q_Q(QFxGridView); if (!isValid() || modelIndex < 0 || modelIndex >= model->count()) { if (currentItem) { - FxGridItem *item = currentItem; + currentItem->attached->setIsCurrentItem(false); + releaseItem(currentItem); currentItem = 0; - currentIndex = 0; + currentIndex = -1; updateHighlight(); - releaseItem(item); emit q->currentIndexChanged(); } return; @@ -625,28 +643,21 @@ void QFxGridViewPrivate::updateCurrent(int modelIndex) delete tmpCurrent; tmpCurrent = 0; } - int oldCurrentIndex = currentIndex; FxGridItem *oldCurrentItem = currentItem; - currentIndex = -1; - currentItem = visibleItem(modelIndex); - if (!currentItem) { - currentItem = getItem(modelIndex); - if (currentItem) - currentItem->setPosition(colPosAt(modelIndex), rowPosAt(modelIndex)); - } currentIndex = modelIndex; + currentItem = createItem(modelIndex); + qDebug() << "got current" << currentItem->item; fixCurrentVisibility = true; if (oldCurrentItem && (!currentItem || oldCurrentItem->item != currentItem->item)) oldCurrentItem->attached->setIsCurrentItem(false); if (currentItem) { + currentItem->setPosition(colPosAt(modelIndex), rowPosAt(modelIndex)); currentItem->item->setFocus(true); currentItem->attached->setIsCurrentItem(true); } updateHighlight(); emit q->currentIndexChanged(); - // Release the old current item - if (oldCurrentItem && !visibleItem(oldCurrentIndex)) - releaseItem(oldCurrentItem); + releaseItem(oldCurrentItem); } //---------------------------------------------------------------------------- @@ -711,6 +722,8 @@ void QFxGridView::setModel(const QVariant &model) if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); + disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); + disconnect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); } d->clear(); d->modelVariant = model; @@ -736,6 +749,8 @@ void QFxGridView::setModel(const QVariant &model) d->updateCurrent(d->currentIndex); connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); + connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); + connect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); refill(); emit countChanged(); } @@ -1182,7 +1197,7 @@ void QFxGridView::itemsInserted(int modelIndex, int count) d->visibleIndex += count; for (int i = 0; i < d->visibleItems.count(); ++i) { FxGridItem *listItem = d->visibleItems.at(i); - if (listItem->index != -1 && listItem != d->currentItem) + if (listItem->index != -1) listItem->index += count; } } @@ -1258,10 +1273,8 @@ void QFxGridView::itemsInserted(int modelIndex, int count) // Update the indexes of the following visible items. for (; index < d->visibleItems.count(); ++index) { FxGridItem *listItem = d->visibleItems.at(index); - if (listItem != d->currentItem) { - if (listItem->index != -1) - listItem->index += count; - } + if (listItem->index != -1) + listItem->index += count; } } // everything is in order now - emit add() signal @@ -1274,7 +1287,7 @@ void QFxGridView::itemsInserted(int modelIndex, int count) void QFxGridView::itemsRemoved(int modelIndex, int count) { Q_D(QFxGridView); - + qDebug() << "QFxGridView::itemsRemoved"; int index = d->mapFromModel(modelIndex); if (index == -1) { if (modelIndex + count - 1 < d->visibleIndex) { @@ -1282,7 +1295,7 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) d->visibleIndex -= count; for (int i = 0; i < d->visibleItems.count(); ++i) { FxGridItem *listItem = d->visibleItems.at(i); - if (listItem->index != -1 && listItem != d->currentItem) + if (listItem->index != -1) listItem->index -= count; } } @@ -1292,11 +1305,8 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) d->currentItem->index -= count; } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { // current item has been removed. - if (d->currentItem) { - FxGridItem *item = d->currentItem; - d->currentItem = 0; - d->releaseItem(item); - } + d->releaseItem(d->currentItem); + d->currentItem = 0; d->currentIndex = -1; d->updateCurrent(qMin(modelIndex, d->model->count()-1)); } @@ -1305,6 +1315,8 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) return; } + qDebug() << "release gridview"; + // Remove the items from the visible list, skipping anything already marked for removal QList::Iterator it = d->visibleItems.begin(); while (it != d->visibleItems.end()) { @@ -1314,8 +1326,7 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) ++it; } else if (item->index >= modelIndex + count) { // after removed items - if (item != d->currentItem) - item->index -= count; + item->index -= count; ++it; } else { // removed item @@ -1338,11 +1349,9 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) d->currentItem->index -= count; } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { // current item has been removed. - if (d->currentItem && !d->currentItem->attached->delayRemove()) { - FxGridItem *item = d->currentItem; - d->currentItem = 0; - d->releaseItem(item); - } + qDebug() << "release current" << d->currentItem; + d->releaseItem(d->currentItem); + qDebug() << "done"; d->currentItem = 0; d->currentIndex = -1; d->updateCurrent(qMin(modelIndex, d->model->count()-1)); @@ -1385,6 +1394,29 @@ void QFxGridView::destroyRemoved() d->layout(); } +void QFxGridView::createdItem(int index, QFxItem *item) +{ + Q_D(QFxGridView); + item->setItemParent(this); + if (d->requestedIndex != index) { + qDebug() << "Added unrequested" << index; + item->setItemParent(this); + d->unrequestedItems.insert(item, index); + if (d->flow == QFxGridView::LeftToRight) { + item->setPos(QPointF(d->colPosAt(index), d->rowPosAt(index))); + } else { + item->setPos(QPointF(d->rowPosAt(index), d->colPosAt(index))); + } + } +} + +void QFxGridView::destroyingItem(QFxItem *item) +{ + Q_D(QFxGridView); + d->unrequestedItems.remove(item); +} + + void QFxGridView::refill() { Q_D(QFxGridView); diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h index 2bbfc40..90bf1ce 100644 --- a/src/declarative/fx/qfxgridview.h +++ b/src/declarative/fx/qfxgridview.h @@ -131,6 +131,8 @@ private Q_SLOTS: void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void destroyRemoved(); + void createdItem(int index, QFxItem *item); + void destroyingItem(QFxItem *item); void sizeChange(); private: diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 46166e2..27f7ff1 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -171,15 +171,14 @@ public: QFxListViewPrivate() : model(0), currentItem(0), tmpCurrent(0), orient(Qt::Vertical) , visiblePos(0), visibleIndex(0) - , averageSize(100), currentIndex(-1), currItemMode(QFxListView::Free) - , snapPos(0), highlightComponent(0), highlight(0), trackedItem(0) + , averageSize(100), currentIndex(-1), requestedIndex(-1) + , currItemMode(QFxListView::Free), snapPos(0), highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0) , keyPressed(false), ownModel(false), wrap(false), autoHighlight(true) , fixCurrentVisibility(false) {} void init(); void clear(); - FxListItem *getItem(int modelIndex); FxListItem *createItem(int modelIndex); void releaseItem(FxListItem *item); @@ -333,6 +332,8 @@ public: void refill(qreal from, qreal to); void layout(); + void updateUnrequestedIndexes(); + void updateUnrequestedPositions(); void updateTrackedItem(); void createHighlight(); void updateHighlight(); @@ -347,6 +348,7 @@ public: QFxVisualItemModel *model; QVariant modelVariant; QList visibleItems; + QHash unrequestedItems; FxListItem *currentItem; QFxItem *tmpCurrent; Qt::Orientation orient; @@ -354,6 +356,7 @@ public: int visibleIndex; qreal averageSize; int currentIndex; + int requestedIndex; QFxListView::CurrentItemPositioning currItemMode; int snapPos; QmlComponent *highlightComponent; @@ -390,29 +393,18 @@ void QFxListViewPrivate::clear() visibleItems.clear(); visiblePos = 0; visibleIndex = 0; - if (currentItem) { - FxListItem *tmpItem = currentItem; - currentItem = 0; - currentIndex = -1; - releaseItem(tmpItem); - } + releaseItem(currentItem); + currentItem = 0; + currentIndex = -1; createHighlight(); trackedItem = 0; } -FxListItem *QFxListViewPrivate::getItem(int modelIndex) -{ - if (currentItem && modelIndex == currentIndex) - return currentItem; - if (FxListItem *listItem = visibleItem(modelIndex)) - return listItem; - return createItem(modelIndex); -} - FxListItem *QFxListViewPrivate::createItem(int modelIndex) { Q_Q(QFxListView); // create object + requestedIndex = modelIndex; FxListItem *listItem = 0; if (QFxItem *item = model->item(modelIndex, false)) { listItem = new FxListItem(item, q); @@ -438,6 +430,7 @@ FxListItem *QFxListViewPrivate::createItem(int modelIndex) else QObject::connect(listItem->item, SIGNAL(widthChanged()), q, SLOT(itemResized())); } + requestedIndex = -1; return listItem; } @@ -445,21 +438,24 @@ FxListItem *QFxListViewPrivate::createItem(int modelIndex) void QFxListViewPrivate::releaseItem(FxListItem *item) { Q_Q(QFxListView); - if (item != currentItem) { - if (orient == Qt::Vertical) - QObject::disconnect(item->item, SIGNAL(heightChanged()), q, SLOT(itemResized())); - else - QObject::disconnect(item->item, SIGNAL(widthChanged()), q, SLOT(itemResized())); - if (trackedItem == item) { - const char *notifier1 = orient == Qt::Vertical ? SIGNAL(topChanged()) : SIGNAL(leftChanged()); - const char *notifier2 = orient == Qt::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged()); - QObject::disconnect(trackedItem->item, notifier1, q, SLOT(trackedPositionChanged())); - QObject::disconnect(trackedItem->item, notifier2, q, SLOT(trackedPositionChanged())); - trackedItem = 0; - } - model->release(item->item); - delete item; + if (!item) + return; + if (orient == Qt::Vertical) + QObject::disconnect(item->item, SIGNAL(heightChanged()), q, SLOT(itemResized())); + else + QObject::disconnect(item->item, SIGNAL(widthChanged()), q, SLOT(itemResized())); + if (trackedItem == item) { + const char *notifier1 = orient == Qt::Vertical ? SIGNAL(topChanged()) : SIGNAL(leftChanged()); + const char *notifier2 = orient == Qt::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged()); + QObject::disconnect(trackedItem->item, notifier1, q, SLOT(trackedPositionChanged())); + QObject::disconnect(trackedItem->item, notifier2, q, SLOT(trackedPositionChanged())); + trackedItem = 0; } + if (model->release(item->item) == 0) { + // item was not destroyed, and we no longer reference it. + unrequestedItems.insert(item->item, model->indexOf(item->item, q)); + } + delete item; } void QFxListViewPrivate::refill(qreal from, qreal to) @@ -485,7 +481,7 @@ void QFxListViewPrivate::refill(qreal from, qreal to) int pos = itemEnd + 1; while (modelIndex < model->count() && pos <= to) { //qDebug() << "refill: append item" << modelIndex; - if (!(item = getItem(modelIndex))) + if (!(item = createItem(modelIndex))) break; item->setPosition(pos); pos += item->size(); @@ -495,7 +491,7 @@ void QFxListViewPrivate::refill(qreal from, qreal to) } while (visibleIndex > 0 && visibleIndex <= model->count() && visiblePos > from) { //qDebug() << "refill: prepend item" << visibleIndex-1 << "current top pos" << visiblePos; - if (!(item = getItem(visibleIndex-1))) + if (!(item = createItem(visibleIndex-1))) break; --visibleIndex; visiblePos -= item->size(); @@ -562,6 +558,29 @@ void QFxListViewPrivate::layout() fixupX(); q->setViewportWidth(endPosition() - startPosition()); } + updateUnrequestedPositions(); +} + +void QFxListViewPrivate::updateUnrequestedIndexes() +{ + Q_Q(QFxListView); + QHash::iterator it; + for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) + *it = model->indexOf(it.key(), q); +} + +void QFxListViewPrivate::updateUnrequestedPositions() +{ + QHash::const_iterator it; + for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) { + qDebug() << "pos of" << (*it) << positionAt(*it); + if (visibleItem(*it)) + continue; + if (orient == Qt::Vertical) + it.key()->setY(positionAt(*it)); + else + it.key()->setX(positionAt(*it)); + } } void QFxListViewPrivate::updateTrackedItem() @@ -695,13 +714,11 @@ void QFxListViewPrivate::updateCurrent(int modelIndex) Q_Q(QFxListView); if (!isValid() || modelIndex < 0 || modelIndex >= model->count()) { if (currentItem) { - FxListItem *item = currentItem; - int index = currentIndex; + currentItem->attached->setIsCurrentItem(false); + releaseItem(currentItem); currentItem = 0; - currentIndex = 0; + currentIndex = -1; updateHighlight(); - if (!visibleItem(index)) - releaseItem(item); emit q->currentIndexChanged(); } return; @@ -716,40 +733,28 @@ void QFxListViewPrivate::updateCurrent(int modelIndex) delete tmpCurrent; tmpCurrent = 0; } - int oldCurrentIndex = currentIndex; FxListItem *oldCurrentItem = currentItem; - currentIndex = -1; - currentItem = visibleItem(modelIndex); - if (!currentItem) { - currentItem = getItem(modelIndex); - if (currentItem) { - if (modelIndex == visibleIndex - 1) { - // We can calculate exact postion in this case - currentItem->setPosition(visibleItems.first()->position() - currentItem->size()); - } else { - // Create current item now and position as best we can. - // Its position will be corrected when it becomes visible. - currentItem->setPosition(positionAt(modelIndex)); - } - } - } currentIndex = modelIndex; + currentItem = createItem(modelIndex); fixCurrentVisibility = true; if (oldCurrentItem && (!currentItem || oldCurrentItem->item != currentItem->item)) oldCurrentItem->attached->setIsCurrentItem(false); if (currentItem) { + if (modelIndex == visibleIndex - 1) { + // We can calculate exact postion in this case + currentItem->setPosition(visibleItems.first()->position() - currentItem->size()); + } else { + // Create current item now and position as best we can. + // Its position will be corrected when it becomes visible. + currentItem->setPosition(positionAt(modelIndex)); + } currentItem->item->setFocus(true); currentItem->attached->setIsCurrentItem(true); } updateHighlight(); emit q->currentIndexChanged(); // Release the old current item - if (oldCurrentItem && !visibleItem(oldCurrentIndex)) { - if (!currentItem || oldCurrentItem->item == currentItem->item) - delete oldCurrentItem; - else - releaseItem(oldCurrentItem); - } + releaseItem(oldCurrentItem); } void QFxListViewPrivate::updateAverage() @@ -884,6 +889,8 @@ void QFxListView::setModel(const QVariant &model) if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); + disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); + disconnect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); } d->clear(); d->modelVariant = model; @@ -909,6 +916,8 @@ void QFxListView::setModel(const QVariant &model) d->updateCurrent(d->currentIndex); connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); + connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); + connect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); refill(); emit countChanged(); } @@ -1417,6 +1426,7 @@ void QFxListView::itemResized() void QFxListView::itemsInserted(int modelIndex, int count) { Q_D(QFxListView); + d->updateUnrequestedIndexes(); if (!d->visibleItems.count() || d->model->count() <= 1) { d->layout(); d->updateCurrent(qMax(0, qMin(d->currentIndex, d->model->count()-1))); @@ -1437,7 +1447,7 @@ void QFxListView::itemsInserted(int modelIndex, int count) d->visibleIndex += count; for (int i = 0; i < d->visibleItems.count(); ++i) { FxListItem *listItem = d->visibleItems.at(i); - if (listItem->index != -1 && listItem != d->currentItem) + if (listItem->index != -1) listItem->index += count; } } @@ -1487,29 +1497,29 @@ void QFxListView::itemsInserted(int modelIndex, int count) // Update the indexes of the following visible items. for (; index < d->visibleItems.count(); ++index) { FxListItem *listItem = d->visibleItems.at(index); - if (listItem != d->currentItem) { - listItem->setPosition(listItem->position() + (pos - initialPos)); - if (listItem->index != -1) - listItem->index += count; - } + listItem->setPosition(listItem->position() + (pos - initialPos)); + if (listItem->index != -1) + listItem->index += count; } } // everything is in order now - emit add() signal for (int j = 0; j < added.count(); ++j) added.at(j)->attached->emitAdd(); + d->updateUnrequestedPositions(); emit countChanged(); } void QFxListView::itemsRemoved(int modelIndex, int count) { Q_D(QFxListView); + d->updateUnrequestedIndexes(); if (!d->mapRangeFromModel(modelIndex, count)) { if (modelIndex + count - 1 < d->visibleIndex) { // Items removed before our visible items. d->visibleIndex -= count; for (int i = 0; i < d->visibleItems.count(); ++i) { FxListItem *listItem = d->visibleItems.at(i); - if (listItem->index != -1 && listItem != d->currentItem) + if (listItem->index != -1) listItem->index -= count; } } @@ -1519,11 +1529,8 @@ void QFxListView::itemsRemoved(int modelIndex, int count) d->currentItem->index -= count; } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { // current item has been removed. - if (d->currentItem) { - FxListItem *item = d->currentItem; - d->currentItem = 0; - d->releaseItem(item); - } + d->releaseItem(d->currentItem); + d->currentItem = 0; d->currentIndex = -1; d->updateCurrent(qMin(modelIndex, d->model->count()-1)); } @@ -1541,8 +1548,7 @@ void QFxListView::itemsRemoved(int modelIndex, int count) ++it; } else if (item->index >= modelIndex + count) { // after removed items - if (item != d->currentItem) - item->index -= count; + item->index -= count; ++it; } else { // removed item @@ -1565,11 +1571,7 @@ void QFxListView::itemsRemoved(int modelIndex, int count) d->currentItem->index -= count; } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { // current item has been removed. - if (d->currentItem && !d->currentItem->attached->delayRemove()) { - FxListItem *item = d->currentItem; - d->currentItem = 0; - d->releaseItem(item); - } + d->releaseItem(d->currentItem); d->currentItem = 0; d->currentIndex = -1; d->updateCurrent(qMin(modelIndex, d->model->count()-1)); @@ -1618,6 +1620,25 @@ void QFxListView::destroyRemoved() d->layout(); } +void QFxListView::createdItem(int index, QFxItem *item) +{ + Q_D(QFxListView); + if (d->requestedIndex != index) { + item->setItemParent(viewport()); + d->unrequestedItems.insert(item, index); + if (d->orient == Qt::Vertical) + item->setY(d->positionAt(index)); + else + item->setX(d->positionAt(index)); + } +} + +void QFxListView::destroyingItem(QFxItem *item) +{ + Q_D(QFxListView); + d->unrequestedItems.remove(item); +} + QObject *QFxListView::qmlAttachedProperties(QObject *obj) { return QFxListViewAttached::properties(obj); diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index 40c2496..42f7773 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -141,6 +141,8 @@ private Q_SLOTS: void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void destroyRemoved(); + void createdItem(int index, QFxItem *item); + void destroyingItem(QFxItem *item); }; QML_DECLARE_TYPE(QFxListView); diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index b7215cf..b1c78e9 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -159,7 +159,7 @@ void QFxPathView::setModel(const QVariant &model) if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); - disconnect(d->model, SIGNAL(itemCreated(int, QFxItem*)), this, SLOT(itemCreated(int,QFxItem*))); + disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); for (int i=0; iitems.count(); i++){ QFxItem *p = d->items[i]; d->model->release(p); @@ -186,7 +186,7 @@ void QFxPathView::setModel(const QVariant &model) if (d->model) { connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); - connect(d->model, SIGNAL(itemCreated(int, QFxItem*)), this, SLOT(itemCreated(int,QFxItem*))); + connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); } d->firstIndex = 0; d->pathOffset = 0; @@ -559,9 +559,10 @@ bool QFxPathView::mouseFilter(QGraphicsSceneMouseEvent *e) void QFxPathViewPrivate::regenerate() { Q_Q(QFxPathView); + qDebug() << "relaease all pathview"; for (int i=0; irelease(p); + releaseItem(p); } items.clear(); @@ -634,7 +635,7 @@ void QFxPathView::refill() while(wrapIndex-- >= 0){ QFxItem* p = d->items.takeFirst(); d->updateItem(p, 0.0); - d->model->release(p); + d->releaseItem(p); d->firstIndex++; d->firstIndex %= d->model->count(); int index = (d->firstIndex + d->items.count())%d->model->count(); @@ -647,7 +648,7 @@ void QFxPathView::refill() while(wrapIndex++ < d->items.count()-1){ QFxItem* p = d->items.takeLast(); d->updateItem(p, 1.0); - d->model->release(p); + d->releaseItem(p); d->firstIndex--; if (d->firstIndex < 0) d->firstIndex = d->model->count() - 1; @@ -698,6 +699,7 @@ void QFxPathView::itemsInserted(int modelIndex, int count) void QFxPathView::itemsRemoved(int modelIndex, int count) { + qDebug() << "QFxPathView::itemsRemoved"; //XXX support animated removal Q_D(QFxPathView); if (!d->isValid()) @@ -733,7 +735,7 @@ void QFxPathView::itemsRemoved(int modelIndex, int count) d->moveOffset.setValue(targetOffset); } -void QFxPathView::itemCreated(int index, QFxItem *item) +void QFxPathView::createdItem(int index, QFxItem *item) { Q_D(QFxPathView); if (d->requestedIndex != index) { diff --git a/src/declarative/fx/qfxpathview.h b/src/declarative/fx/qfxpathview.h index 2ecd04e..04804b7 100644 --- a/src/declarative/fx/qfxpathview.h +++ b/src/declarative/fx/qfxpathview.h @@ -115,7 +115,7 @@ private Q_SLOTS: void ticked(); void itemsInserted(int index, int count); void itemsRemoved(int index, int count); - void itemCreated(int index, QFxItem *item); + void createdItem(int index, QFxItem *item); void destroyingItem(QFxItem *item); protected: diff --git a/src/declarative/fx/qfxpathview_p.h b/src/declarative/fx/qfxpathview_p.h index 358daf6..b5c5ba2 100644 --- a/src/declarative/fx/qfxpathview_p.h +++ b/src/declarative/fx/qfxpathview_p.h @@ -101,6 +101,9 @@ public: requestedIndex = -1; return item; } + void releaseItem(QFxItem *item) { + model->release(item); + } bool isValid() const { return model && model->count() > 0 && model->delegate() && path; diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index 533917e..c631d33 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -73,9 +73,53 @@ public: QList m_roles; QHash m_roleNames; - QHash m_cache; + struct ObjectRef { + ObjectRef(QObject *object=0) : obj(object), ref(1) {} + QObject *obj; + int ref; + }; + class Cache : public QHash { + public: + QObject *getItem(int index) { + QObject *item = 0; + QHash::iterator it = find(index); + if (it != end()) { + (*it).ref++; + item = (*it).obj; + qDebug() << "ref" << item << (*it).ref; + } + return item; + } + QObject *item(int index) { + QObject *item = 0; + QHash::const_iterator it = find(index); + if (it != end()) + item = (*it).obj; + return item; + } + void insertItem(int index, QObject *obj) { + insert(index, ObjectRef(obj)); + } + bool releaseItem(QObject *obj) { + QHash::iterator it = begin(); + for (; it != end(); ++it) { + ObjectRef &objRef = *it; + if (objRef.obj == obj) { + if (--objRef.ref == 0) { + erase(it); + qDebug() << "released item" << obj << "item count" << count(); + return true; + } + qDebug() << "not releasing" << obj << "ref" << objRef.ref; + break; + } + } + return false; + } + }; + + Cache m_cache; QHash m_packaged; - QHash m_packageRef; QFxVisualItemModelParts *m_parts; friend class QFxVisualItemParts; @@ -337,8 +381,8 @@ void QFxVisualItemModel::setModel(const QVariant &model) this, SIGNAL(itemsRemoved(int,int))); QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsMoved(int,int,int)), this, SIGNAL(itemsMoved(int,int,int))); - QObject::disconnect(d->m_visualItemModel, SIGNAL(packageCreated(int,QmlPackage*)), - this, SLOT(_q_packageCreated(int,QmlPackage*))); + QObject::disconnect(d->m_visualItemModel, SIGNAL(createdPackage(int,QmlPackage*)), + this, SLOT(_q_createdPackage(int,QmlPackage*))); QObject::disconnect(d->m_visualItemModel, SIGNAL(destroyingPackage(QmlPackage*)), this, SLOT(_q_destroyingPackage(QmlPackage*))); d->m_visualItemModel = 0; @@ -390,8 +434,8 @@ void QFxVisualItemModel::setModel(const QVariant &model) this, SIGNAL(itemsRemoved(int,int))); QObject::connect(d->m_visualItemModel, SIGNAL(itemsMoved(int,int,int)), this, SIGNAL(itemsMoved(int,int,int))); - QObject::connect(d->m_visualItemModel, SIGNAL(packageCreated(int,QmlPackage*)), - this, SLOT(_q_packageCreated(int,QmlPackage*))); + QObject::connect(d->m_visualItemModel, SIGNAL(createdPackage(int,QmlPackage*)), + this, SLOT(_q_createdPackage(int,QmlPackage*))); QObject::connect(d->m_visualItemModel, SIGNAL(destroyingPackage(QmlPackage*)), this, SLOT(_q_destroyingPackage(QmlPackage*))); return; @@ -445,41 +489,39 @@ QFxItem *QFxVisualItemModel::item(int index, bool complete) return item(index, QByteArray(), complete); } -void QFxVisualItemModel::release(QFxItem *item) +/* + Returns ReleaseStatus flags. +*/ +QFxVisualItemModel::ReleaseFlags QFxVisualItemModel::release(QFxItem *item) { Q_D(QFxVisualItemModel); - if (d->m_visualItemModel) { - d->m_visualItemModel->release(item); - return; - } - item->setItemParent(0); - QObject *obj = item; + if (d->m_visualItemModel) + return d->m_visualItemModel->release(item); + ReleaseFlags stat = 0; + QObject *obj = item; bool inPackage = false; - if (QmlPackage *package = d->m_packaged.value(item)) { - static_cast(item)->setParent(package); - d->m_packaged.remove(item); - //XXX Inefficient - for (QHash::Iterator iter = d->m_packaged.begin(); - iter != d->m_packaged.end(); ++iter) { - if (*iter == package) - return; - } + + QHash::iterator it = d->m_packaged.find(item); + if (it != d->m_packaged.end()) { + QmlPackage *package = *it; + d->m_packaged.erase(it); + if (d->m_packaged.contains(item)) + stat |= Referenced; inPackage = true; obj = package; // fall through and delete } - //XXX Inefficient - for (QHash::Iterator iter = d->m_cache.begin(); - iter != d->m_cache.end(); ++iter) { - if (*iter == obj) { - if (inPackage) - emit destroyingPackage(qobject_cast(obj)); - delete obj; - d->m_cache.erase(iter); - return; - } + if (d->m_cache.releaseItem(obj)) { + if (inPackage) + emit destroyingPackage(qobject_cast(obj)); + stat |= Destroyed; + delete obj; + } else if (!inPackage) { + stat |= Referenced; } + + return stat; } QObject *QFxVisualItemModel::parts() @@ -499,10 +541,8 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp if (d->modelCount() <= 0 || !d->m_delegate) return 0; - QObject *nobj = 0; - if (d->m_cache.contains(index)) { - nobj = d->m_cache[index]; - } else { + QObject *nobj = d->m_cache.getItem(index); + if (!nobj) { QmlContext *ccontext = d->m_context; if (!ccontext) ccontext = qmlContext(this); QmlContext *ctxt = new QmlContext(ccontext); @@ -515,8 +555,9 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp if (nobj) { ctxt->setParent(nobj); data->setParent(nobj); - - d->m_cache.insert(index, nobj); + d->m_cache.insertItem(index, nobj); + if (QmlPackage *package = qobject_cast(nobj)) + emit createdPackage(index, package); } else { delete data; delete ctxt; @@ -529,8 +570,7 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp if (package) { QObject *o = package->part(QLatin1String(viewId)); item = qobject_cast(o); - d->m_packaged[o] = package; - emit packageCreated(index, package); + d->m_packaged.insertMulti(item, package); } } @@ -558,8 +598,8 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj return QVariant(); QVariant value; - if (d->m_cache.contains(index)) { - QObject *nobj = d->m_cache[index]; + QObject *nobj = d->m_cache.item(index); + if (nobj) { QFxItem *item = qobject_cast(nobj); if (item) { QmlExpression e(qmlContext(item), expression, objectContext); @@ -582,6 +622,16 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj return value; } +int QFxVisualItemModel::indexOf(QFxItem *item, QObject *objectContext) const +{ + QmlExpression e(qmlContext(item), "index", objectContext); + e.setTrackChange(false); + QVariant value = e.value(); + if (value.isValid()) + return value.toInt(); + return -1; +} + void QFxVisualItemModel::_q_itemsChanged(int index, int count, const QList &roles) { @@ -589,9 +639,7 @@ void QFxVisualItemModel::_q_itemsChanged(int index, int count, // XXX - highly inefficient for (int ii = index; ii < index + count; ++ii) { - if (d->m_cache.contains(ii)) { - - QObject *item = d->m_cache[ii]; + if (QObject *item = d->m_cache.item(ii)) { QFxVisualItemModelData *data = d->data(item); for (int prop = 0; prop < data->count(); ++prop) { @@ -615,18 +663,18 @@ void QFxVisualItemModel::_q_itemsInserted(int index, int count) { Q_D(QFxVisualItemModel); // XXX - highly inefficient - QHash items; - for (QHash::Iterator iter = d->m_cache.begin(); + QHash items; + for (QHash::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { if (iter.key() >= index) { - QObject *item = *iter; + QFxVisualItemModelPrivate::ObjectRef objRef = *iter; int index = iter.key() + count; iter = d->m_cache.erase(iter); - items.insert(index, item); + items.insert(index, objRef); - QFxVisualItemModelData *data = d->data(item); + QFxVisualItemModelData *data = d->data(objRef.obj); data->setIndex(index); } else { ++iter; @@ -641,21 +689,21 @@ void QFxVisualItemModel::_q_itemsRemoved(int index, int count) { Q_D(QFxVisualItemModel); // XXX - highly inefficient - QHash items; - for (QHash::Iterator iter = d->m_cache.begin(); + QHash items; + for (QHash::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { if (iter.key() >= index && iter.key() < index + count) { - QObject *item = *iter; + QFxVisualItemModelPrivate::ObjectRef objRef = *iter; iter = d->m_cache.erase(iter); - items.insertMulti(-1, item); //XXX perhaps better to maintain separately - QFxVisualItemModelData *data = d->data(item); + items.insertMulti(-1, objRef); //XXX perhaps better to maintain separately + QFxVisualItemModelData *data = d->data(objRef.obj); data->setIndex(-1); } else if (iter.key() >= index + count) { - QObject *item = *iter; + QFxVisualItemModelPrivate::ObjectRef objRef = *iter; int index = iter.key() - count; iter = d->m_cache.erase(iter); - items.insert(index, item); - QFxVisualItemModelData *data = d->data(item); + items.insert(index, objRef); + QFxVisualItemModelData *data = d->data(objRef.obj); data->setIndex(index); } else { ++iter; @@ -670,18 +718,18 @@ void QFxVisualItemModel::_q_itemsMoved(int from, int to, int count) { Q_D(QFxVisualItemModel); // XXX - highly inefficient - QHash items; - for (QHash::Iterator iter = d->m_cache.begin(); + QHash items; + for (QHash::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { if (iter.key() >= from && iter.key() < from + count) { - QObject *item = *iter; + QFxVisualItemModelPrivate::ObjectRef objRef = *iter; int index = iter.key() - from + to; iter = d->m_cache.erase(iter); - items.insert(index, item); + items.insert(index, objRef); - QFxVisualItemModelData *data = d->data(item); + QFxVisualItemModelData *data = d->data(objRef.obj); data->setIndex(index); } else { ++iter; @@ -708,10 +756,10 @@ void QFxVisualItemModel::_q_dataChanged(const QModelIndex &begin, const QModelIn _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, d->m_roles); } -void QFxVisualItemModel::_q_packageCreated(int index, QmlPackage *package) +void QFxVisualItemModel::_q_createdPackage(int index, QmlPackage *package) { Q_D(QFxVisualItemModel); - emit itemCreated(index, qobject_cast(package->part(d->m_part))); + emit createdItem(index, qobject_cast(package->part(d->m_part))); } void QFxVisualItemModel::_q_destroyingPackage(QmlPackage *package) diff --git a/src/declarative/fx/qfxvisualitemmodel.h b/src/declarative/fx/qfxvisualitemmodel.h index 33017e2..7156d70 100644 --- a/src/declarative/fx/qfxvisualitemmodel.h +++ b/src/declarative/fx/qfxvisualitemmodel.h @@ -86,21 +86,26 @@ public: QString part() const; void setPart(const QString &); + enum ReleaseFlag { Referenced = 0x01, Destroyed = 0x02 }; + Q_DECLARE_FLAGS(ReleaseFlags, ReleaseFlag) + int count() const; QFxItem *item(int index, bool complete=true); QFxItem *item(int index, const QByteArray &, bool complete=true); - void release(QFxItem *item); + ReleaseFlags release(QFxItem *item); void completeItem(); QVariant evaluate(int index, const QString &expression, QObject *objectContext); + int indexOf(QFxItem *item, QObject *objectContext) const; + QObject *parts(); Q_SIGNALS: void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); - void itemCreated(int index, QFxItem *item); - void packageCreated(int index, QmlPackage *package); + void createdItem(int index, QFxItem *item); + void createdPackage(int index, QmlPackage *package); void destroyingItem(QFxItem *item); void destroyingPackage(QmlPackage *package); @@ -112,7 +117,7 @@ private Q_SLOTS: void _q_rowsInserted(const QModelIndex &,int,int); void _q_rowsRemoved(const QModelIndex &,int,int); void _q_dataChanged(const QModelIndex&,const QModelIndex&); - void _q_packageCreated(int index, QmlPackage *package); + void _q_createdPackage(int index, QmlPackage *package); void _q_destroyingPackage(QmlPackage *package); private: diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp index aa7ed38..bfad44c 100644 --- a/src/declarative/util/qmlpackage.cpp +++ b/src/declarative/util/qmlpackage.cpp @@ -98,6 +98,11 @@ QmlPackage::QmlPackage(QObject *parent) QmlPackage::~QmlPackage() { + Q_D(QmlPackage); + for (int ii = 0; ii < d->dataList.count(); ++ii) { + QObject *obj = d->dataList.at(ii); + delete obj; + } } QmlList *QmlPackage::data() -- cgit v0.12 From ccca1883cf621eb78768962e9e6476ae0ce57a70 Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 20 May 2009 14:48:12 +1000 Subject: Fixes a memory leak in the interbase sql driver. As suggested in gitorius merge request 421, solution supplied by Harald. Reviewed-by: Harald Fernengel --- src/sql/drivers/ibase/qsql_ibase.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 4f3d79d..1645555 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -55,6 +55,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -583,7 +584,7 @@ QVariant QIBaseResultPrivate::fetchArray(int pos, ISC_QUAD *arr) int arraySize = 1, subArraySize; short dimensions = desc.array_desc_dimensions; - short *numElements = new short[dimensions]; + QVarLengthArray numElements(dimensions); for(int i = 0; i < dimensions; ++i) { subArraySize = (desc.array_desc_bounds[i].array_bound_upper - @@ -612,9 +613,7 @@ QVariant QIBaseResultPrivate::fetchArray(int pos, ISC_QUAD *arr) QSqlError::StatementError)) return list; - readArrayBuffer(list, ba.data(), 0, numElements, &desc, tc); - - delete[] numElements; + readArrayBuffer(list, ba.data(), 0, numElements.data(), &desc, tc); return QVariant(list); } -- cgit v0.12 From e4d41f8090838359ae0deb1af410e8a501a6a9b6 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 20 May 2009 15:13:28 +1000 Subject: Fix possible X11/EGL crash. Changed-by: Rhys Weatherley Reviewed-by: Tom Cooksey --- src/opengl/qgl_x11egl.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 480a2dc..f8ea8de 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -268,10 +268,16 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, XVisualInfo vi; - int err = XMatchVisualInfo(x11Info().display(), x11Info().screen(), x11Info().depth(), TrueColor, &vi); - if (err == 0) { - qWarning("Error: Couldn't get a matching X visual for format"); - return; + if (parentWidget()) { + vi.depth = parentWidget()->x11Info().depth(); + vi.screen = parentWidget()->x11Info().screen(); + vi.visual = (Visual *)(parentWidget()->x11Info().visual()); + } else { + int err = XMatchVisualInfo(x11Info().display(), x11Info().screen(), x11Info().depth(), TrueColor, &vi); + if (err == 0) { + qWarning("Error: Couldn't get a matching X visual for format"); + return; + } } XSetWindowAttributes a; -- cgit v0.12 From 1aeab18c1e78e201a38d76a24e8cfd2733e4f5e7 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 20 May 2009 15:36:25 +1000 Subject: Basic qualified type support. Can now: DialLibrary.Dial { ... } without any import statement. Can also run qmlviewer with -L DialLibrary then use Dial { ... }. The exact way this works will almost definitely change to ensure predictable behaviour under future type additions to scopes. --- src/declarative/qml/qmlscriptparser.cpp | 17 +++++++++++++---- tools/qmlviewer/main.cpp | 6 ++++++ tools/qmlviewer/qmlviewer.cpp | 4 ++++ tools/qmlviewer/qmlviewer.h | 1 + 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index ead7ee5..64f0bac 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -203,7 +203,10 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, LocationSpan location, AST::UiObjectInitializer *initializer) { - bool isType = !objectType.isEmpty() && objectType.at(0).isUpper() && !objectType.contains(QLatin1Char('.')); + int lastTypeDot = objectType.lastIndexOf(QLatin1Char('.')); + bool isType = !objectType.isEmpty() && + (objectType.at(0).isUpper() | + lastTypeDot >= 0 && objectType.at(lastTypeDot+1).isUpper()); int propertyCount = 0; for (; propertyName; propertyName = propertyName->next){ @@ -234,15 +237,21 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, return 0; } else { - // Class - const int typeId = _parser->findOrCreateTypeId(objectType); + + QString resolvableObjectType = objectType; + if (lastTypeDot >= 0) + resolvableObjectType.replace(QLatin1Char('.'),QLatin1Char('/')); + const int typeId = _parser->findOrCreateTypeId(resolvableObjectType); Object *obj = new Object; obj->type = typeId; - _scope.append(objectType); + + // XXX this doesn't do anything (_scope never builds up) + _scope.append(resolvableObjectType); obj->typeName = qualifiedNameId().toLatin1(); _scope.removeLast(); + obj->location = location; if (propertyCount) { diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp index f59918f..38a00bb 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qmlviewer/main.cpp @@ -41,6 +41,7 @@ void usage() qWarning(" -recordtest .................. record an autotest"); qWarning(" -runtest ..................... run a previously recorded test"); qWarning(" -translation ........... set the language to run in"); + qWarning(" -L ........................... prepend to the library search path"); qWarning(" "); qWarning(" Press F1 for interactive help"); exit(1); @@ -81,6 +82,7 @@ int main(int argc, char ** argv) QString dither = "none"; QString recordfile; QStringList recordargs; + QStringList libraries; QString skin; bool devkeys = false; bool cache = false; @@ -132,6 +134,8 @@ int main(int argc, char ** argv) usage(); translationFile = newargv[i + 1]; ++i; + } else if (arg == "-L") { + libraries << QString(argv[++i]); } else if (arg[0] != '-') { fileName = arg; } else if (1 || arg == "-help") { @@ -146,6 +150,8 @@ int main(int argc, char ** argv) } QmlViewer viewer(testMode, testDir, 0, frameless ? Qt::FramelessWindowHint : Qt::Widget); + foreach (QString lib, libraries) + viewer.addLibraryPath(lib); viewer.setCacheEnabled(cache); viewer.setRecordFile(recordfile); if (period>0) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 97db22e..4b0a83a 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -314,6 +314,10 @@ void QmlViewer::toggleRecording() setRecording(recording); } +void QmlViewer::addLibraryPath(const QString& lib) +{ + canvas->engine()->addNameSpacePath("",lib); +} void QmlViewer::reload() { diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index 09b2b5b..967af49 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -42,6 +42,7 @@ public: void setAutoRecord(int from, int to); void setDeviceKeys(bool); void setCacheEnabled(bool); + void addLibraryPath(const QString& lib); QSize sizeHint() const; -- cgit v0.12 From b5bada2b06d85ea74a851b98d3652aff8e64a723 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 20 May 2009 15:44:34 +1000 Subject: Cleanup and fixes for performance logging. --- src/declarative/fx/qfximage.cpp | 3 +++ src/declarative/qml/qmlscriptparser.cpp | 5 +++++ src/declarative/util/qfxperf.cpp | 17 ++++++++--------- src/declarative/util/qfxperf.h | 13 ++++++------- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 4197a80..064580e 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -863,6 +863,9 @@ QString QFxImage::source() const void QFxImage::setSource(const QString &url) { +#ifdef Q_ENABLE_PERFORMANCE_LOG + QFxPerfTimer perf; +#endif Q_D(QFxImage); if (url == d->source) return; diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index ead7ee5..435a586 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -12,6 +12,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE using namespace JavaScript; @@ -621,6 +623,9 @@ QmlScriptParser::~QmlScriptParser() bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url) { +#ifdef Q_ENABLE_PERFORMANCE_LOG + QFxPerfTimer pt; +#endif const QString fileName = url.toString(); QTextStream stream(data, QIODevice::ReadOnly); diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp index 5ce8646..ae51157 100644 --- a/src/declarative/util/qfxperf.cpp +++ b/src/declarative/util/qfxperf.cpp @@ -44,16 +44,20 @@ QT_BEGIN_NAMESPACE Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { - Q_DEFINE_PERFORMANCE_METRIC(XmlParsing, "XML Parsing"); - Q_DEFINE_PERFORMANCE_METRIC(Compile, "XML Compilation"); - Q_DEFINE_PERFORMANCE_METRIC(CompileRun, "XML Compilation Run"); - Q_DEFINE_PERFORMANCE_METRIC(CssParsing, "CSS Parsing"); + Q_DEFINE_PERFORMANCE_METRIC(QmlParsing, "QML Parsing"); + Q_DEFINE_PERFORMANCE_METRIC(Compile, "QML Compilation"); + Q_DEFINE_PERFORMANCE_METRIC(CompileRun, "QML Compilation Run"); Q_DEFINE_PERFORMANCE_METRIC(CreateComponent, "Component creation"); Q_DEFINE_PERFORMANCE_METRIC(BindInit, "BindValue Initialization"); Q_DEFINE_PERFORMANCE_METRIC(BindCompile, "BindValue compile"); Q_DEFINE_PERFORMANCE_METRIC(BindValue, "BindValue execution"); Q_DEFINE_PERFORMANCE_METRIC(BindValueSSE, "BindValue execution SSE"); Q_DEFINE_PERFORMANCE_METRIC(BindValueQt, "BindValue execution QtScript"); + Q_DEFINE_PERFORMANCE_METRIC(ContextQuery, "QtScript: Query Context"); + Q_DEFINE_PERFORMANCE_METRIC(ContextProperty, "QtScript: Context Property"); + Q_DEFINE_PERFORMANCE_METRIC(ObjectQuery, "QtScript: Query Object"); + Q_DEFINE_PERFORMANCE_METRIC(ObjectProperty, "QtScript: Object Property"); + Q_DEFINE_PERFORMANCE_METRIC(ObjectSetProperty, "QtScript: Set Object Property"); Q_DEFINE_PERFORMANCE_METRIC(BindableValueUpdate, "QmlBindableValue::update"); Q_DEFINE_PERFORMANCE_METRIC(PixmapLoad, "Pixmap loading"); Q_DEFINE_PERFORMANCE_METRIC(MetaProperty, "Meta property resolution"); @@ -65,11 +69,6 @@ Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { Q_DEFINE_PERFORMANCE_METRIC(ComponentInstanceComponentComplete, "QFxComponentInstance::componentComplete"); Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, "QFxBaseLayout::componentComplete"); Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, "QFxText::componentComplete"); - Q_DEFINE_PERFORMANCE_METRIC(ContextQuery, "QtScript: Query Context"); - Q_DEFINE_PERFORMANCE_METRIC(ContextProperty, "QtScript: Context Property"); - Q_DEFINE_PERFORMANCE_METRIC(ObjectQuery, "QtScript: Query Object"); - Q_DEFINE_PERFORMANCE_METRIC(ObjectProperty, "QtScript: Object Property"); - Q_DEFINE_PERFORMANCE_METRIC(ObjectSetProperty, "QtScript: Set Object Property"); Q_DEFINE_PERFORMANCE_METRIC(QFxText_setText, "QFxText::setText"); } QT_END_NAMESPACE diff --git a/src/declarative/util/qfxperf.h b/src/declarative/util/qfxperf.h index b1f9bd0..d1f3a5b 100644 --- a/src/declarative/util/qfxperf.h +++ b/src/declarative/util/qfxperf.h @@ -50,16 +50,20 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { - Q_DECLARE_PERFORMANCE_METRIC(XmlParsing); + Q_DECLARE_PERFORMANCE_METRIC(QmlParsing); Q_DECLARE_PERFORMANCE_METRIC(Compile); Q_DECLARE_PERFORMANCE_METRIC(CompileRun); - Q_DECLARE_PERFORMANCE_METRIC(CssParsing); Q_DECLARE_PERFORMANCE_METRIC(CreateComponent); Q_DECLARE_PERFORMANCE_METRIC(BindInit); Q_DECLARE_PERFORMANCE_METRIC(BindCompile); Q_DECLARE_PERFORMANCE_METRIC(BindValue); Q_DECLARE_PERFORMANCE_METRIC(BindValueSSE); Q_DECLARE_PERFORMANCE_METRIC(BindValueQt); + Q_DECLARE_PERFORMANCE_METRIC(ContextQuery); + Q_DECLARE_PERFORMANCE_METRIC(ContextProperty); + Q_DECLARE_PERFORMANCE_METRIC(ObjectQuery); + Q_DECLARE_PERFORMANCE_METRIC(ObjectProperty); + Q_DECLARE_PERFORMANCE_METRIC(ObjectSetProperty); Q_DECLARE_PERFORMANCE_METRIC(BindableValueUpdate); Q_DECLARE_PERFORMANCE_METRIC(PixmapLoad); Q_DECLARE_PERFORMANCE_METRIC(MetaProperty); @@ -71,11 +75,6 @@ Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { Q_DECLARE_PERFORMANCE_METRIC(ComponentInstanceComponentComplete); Q_DECLARE_PERFORMANCE_METRIC(BaseLayoutComponentComplete); Q_DECLARE_PERFORMANCE_METRIC(TextComponentComplete); - Q_DECLARE_PERFORMANCE_METRIC(ContextQuery); - Q_DECLARE_PERFORMANCE_METRIC(ContextProperty); - Q_DECLARE_PERFORMANCE_METRIC(ObjectQuery); - Q_DECLARE_PERFORMANCE_METRIC(ObjectProperty); - Q_DECLARE_PERFORMANCE_METRIC(ObjectSetProperty); Q_DECLARE_PERFORMANCE_METRIC(QFxText_setText); } -- cgit v0.12 From 9852730f6a1fe66aab5a8e6a2b7c139bbd9fb011 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 20 May 2009 16:06:58 +1000 Subject: Log performance of adding script to the engine. --- src/declarative/util/qfxperf.cpp | 1 + src/declarative/util/qfxperf.h | 1 + src/declarative/util/qmlscript.cpp | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp index ae51157..01ac878 100644 --- a/src/declarative/util/qfxperf.cpp +++ b/src/declarative/util/qfxperf.cpp @@ -70,5 +70,6 @@ Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, "QFxBaseLayout::componentComplete"); Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, "QFxText::componentComplete"); Q_DEFINE_PERFORMANCE_METRIC(QFxText_setText, "QFxText::setText"); + Q_DEFINE_PERFORMANCE_METRIC(AddScript, "QmlScript::addScriptToEngine"); } QT_END_NAMESPACE diff --git a/src/declarative/util/qfxperf.h b/src/declarative/util/qfxperf.h index d1f3a5b..3430658 100644 --- a/src/declarative/util/qfxperf.h +++ b/src/declarative/util/qfxperf.h @@ -76,6 +76,7 @@ Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { Q_DECLARE_PERFORMANCE_METRIC(BaseLayoutComponentComplete); Q_DECLARE_PERFORMANCE_METRIC(TextComponentComplete); Q_DECLARE_PERFORMANCE_METRIC(QFxText_setText); + Q_DECLARE_PERFORMANCE_METRIC(AddScript); } #endif // _QFXPERF_H_ diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp index d986b7a..d6d610a 100644 --- a/src/declarative/util/qmlscript.cpp +++ b/src/declarative/util/qmlscript.cpp @@ -55,11 +55,10 @@ #include #include #include +#include QT_BEGIN_NAMESPACE - - class QmlScriptPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QmlScript); @@ -183,6 +182,9 @@ void QmlScript::replyFinished() void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &fileName) { +#ifdef Q_ENABLE_PERFORMANCE_LOG + QFxPerfTimer pt; +#endif Q_Q(QmlScript); QmlEngine *engine = qmlEngine(q); QmlContext *context = qmlContext(q); -- cgit v0.12 From 63b7592be90d17be954bbfb9fd194dccb09741ea Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 20 May 2009 16:14:55 +1000 Subject: Remove debug --- src/declarative/fx/qfxgridview.cpp | 8 -------- src/declarative/fx/qfxlistview.cpp | 1 - src/declarative/fx/qfxpathview.cpp | 2 -- src/declarative/fx/qfxvisualitemmodel.cpp | 3 --- 4 files changed, 14 deletions(-) diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index c14408a..db54aea 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -529,7 +529,6 @@ void QFxGridViewPrivate::updateUnrequestedPositions() { QHash::const_iterator it; for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) { - qDebug() << "pos of" << (*it) << colPosAt(*it) << rowPosAt(*it); if (flow == QFxGridView::LeftToRight) { it.key()->setPos(QPointF(colPosAt(*it), rowPosAt(*it))); } else { @@ -646,7 +645,6 @@ void QFxGridViewPrivate::updateCurrent(int modelIndex) FxGridItem *oldCurrentItem = currentItem; currentIndex = modelIndex; currentItem = createItem(modelIndex); - qDebug() << "got current" << currentItem->item; fixCurrentVisibility = true; if (oldCurrentItem && (!currentItem || oldCurrentItem->item != currentItem->item)) oldCurrentItem->attached->setIsCurrentItem(false); @@ -1287,7 +1285,6 @@ void QFxGridView::itemsInserted(int modelIndex, int count) void QFxGridView::itemsRemoved(int modelIndex, int count) { Q_D(QFxGridView); - qDebug() << "QFxGridView::itemsRemoved"; int index = d->mapFromModel(modelIndex); if (index == -1) { if (modelIndex + count - 1 < d->visibleIndex) { @@ -1315,8 +1312,6 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) return; } - qDebug() << "release gridview"; - // Remove the items from the visible list, skipping anything already marked for removal QList::Iterator it = d->visibleItems.begin(); while (it != d->visibleItems.end()) { @@ -1349,9 +1344,7 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) d->currentItem->index -= count; } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { // current item has been removed. - qDebug() << "release current" << d->currentItem; d->releaseItem(d->currentItem); - qDebug() << "done"; d->currentItem = 0; d->currentIndex = -1; d->updateCurrent(qMin(modelIndex, d->model->count()-1)); @@ -1399,7 +1392,6 @@ void QFxGridView::createdItem(int index, QFxItem *item) Q_D(QFxGridView); item->setItemParent(this); if (d->requestedIndex != index) { - qDebug() << "Added unrequested" << index; item->setItemParent(this); d->unrequestedItems.insert(item, index); if (d->flow == QFxGridView::LeftToRight) { diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 27f7ff1..247f64b 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -573,7 +573,6 @@ void QFxListViewPrivate::updateUnrequestedPositions() { QHash::const_iterator it; for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) { - qDebug() << "pos of" << (*it) << positionAt(*it); if (visibleItem(*it)) continue; if (orient == Qt::Vertical) diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index b1c78e9..e315547 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -559,7 +559,6 @@ bool QFxPathView::mouseFilter(QGraphicsSceneMouseEvent *e) void QFxPathViewPrivate::regenerate() { Q_Q(QFxPathView); - qDebug() << "relaease all pathview"; for (int i=0; iisValid()) diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index c631d33..b9ddcb9 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -86,7 +86,6 @@ public: if (it != end()) { (*it).ref++; item = (*it).obj; - qDebug() << "ref" << item << (*it).ref; } return item; } @@ -107,10 +106,8 @@ public: if (objRef.obj == obj) { if (--objRef.ref == 0) { erase(it); - qDebug() << "released item" << obj << "item count" << count(); return true; } - qDebug() << "not releasing" << obj << "ref" << objRef.ref; break; } } -- cgit v0.12 From 74fd2979aed842bee3b841974c6b13c466d272a6 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 20 May 2009 16:15:25 +1000 Subject: Add status and feedback info to XmlListModel --- demos/declarative/flickr/flickr.qml | 2 ++ src/declarative/extra/qmlxmllistmodel.cpp | 40 +++++++++++++++++++++++++++---- src/declarative/extra/qmlxmllistmodel.h | 12 ++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml index b113f56..da77d93 100644 --- a/demos/declarative/flickr/flickr.qml +++ b/demos/declarative/flickr/flickr.qml @@ -122,6 +122,8 @@ Item { Image { source: "content/pics/background.png"; opaque: true; anchors.fill: parent } + Loading { anchors.centeredIn: parent; visible: FeedModel.status != 0 } + GridView { id: PhotoGridView; model: FeedModel; delegate: PhotoDelegate; cacheBuffer: 100 cellWidth: 105; cellHeight: 105; x:32; y: 80; width: 800; height: 330; z: 1 diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp index 3732323..9259c83 100644 --- a/src/declarative/extra/qmlxmllistmodel.cpp +++ b/src/declarative/extra/qmlxmllistmodel.cpp @@ -266,7 +266,8 @@ class QmlXmlListModelPrivate : public QObjectPrivate public: QmlXmlListModelPrivate() : isClassComplete(false), size(-1), highestRole(Qt::UserRole) - , reply(0), queryId(-1), roleObjects(this) {} + , reply(0), status(QmlXmlListModel::Idle), progress(0.0) + , queryId(-1), roleObjects(this) {} bool isClassComplete; QString src; @@ -277,6 +278,8 @@ public: QStringList roleNames; int highestRole; QNetworkReply *reply; + QmlXmlListModel::Status status; + qreal progress; QmlXmlQuery qmlXmlQuery; int queryId; QmlXmlRoleList roleObjects; @@ -344,7 +347,6 @@ QmlXmlListModel::QmlXmlListModel(QObject *parent) QmlXmlListModel::~QmlXmlListModel() { - Q_D(QmlXmlListModel); } QmlList *QmlXmlListModel::roleObjects() @@ -430,6 +432,17 @@ void QmlXmlListModel::setNamespaceDeclarations(const QString &declarations) reload(); } } +QmlXmlListModel::Status QmlXmlListModel::status() const +{ + Q_D(const QmlXmlListModel); + return d->status; +} + +qreal QmlXmlListModel::progress() const +{ + Q_D(const QmlXmlListModel); + return d->progress; +} void QmlXmlListModel::classComplete() { @@ -465,12 +478,17 @@ void QmlXmlListModel::reload() d->reply->deleteLater(); d->reply = 0; } + d->progress = 0.0; + d->status = Loading; + emit progressChanged(d->progress); + emit statusChanged(d->status); QNetworkRequest req((QUrl(d->src))); req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); d->reply = qmlContext(this)->engine()->networkAccessManager()->get(req); - QObject::connect(d->reply, SIGNAL(finished()), - this, SLOT(requestFinished())); + QObject::connect(d->reply, SIGNAL(finished()), this, SLOT(requestFinished())); + QObject::connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)), + this, SLOT(requestProgress(qint64,qint64))); } void QmlXmlListModel::requestFinished() @@ -479,12 +497,26 @@ void QmlXmlListModel::requestFinished() if (d->reply->error() != QNetworkReply::NoError) { d->reply->deleteLater(); d->reply = 0; + d->status = Error; } else { + d->status = Idle; QByteArray data = d->reply->readAll(); d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, data, &d->roleObjects); d->reply->deleteLater(); d->reply = 0; } + d->progress = 1.0; + emit progressChanged(d->progress); + emit statusChanged(d->status); +} + +void QmlXmlListModel::requestProgress(qint64 received, qint64 total) +{ + Q_D(QmlXmlListModel); + if (d->status == Loading && total > 0) { + d->progress = qreal(received)/total; + emit progressChanged(d->progress); + } } void QmlXmlListModel::queryCompleted(int id, int size) diff --git a/src/declarative/extra/qmlxmllistmodel.h b/src/declarative/extra/qmlxmllistmodel.h index f837040..cf2f5f4 100644 --- a/src/declarative/extra/qmlxmllistmodel.h +++ b/src/declarative/extra/qmlxmllistmodel.h @@ -89,7 +89,10 @@ class Q_DECLARATIVE_EXPORT QmlXmlListModel : public QListModelInterface, public { Q_OBJECT Q_INTERFACES(QmlParserStatus) + Q_ENUMS(Status) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(QString source READ source WRITE setSource) Q_PROPERTY(QString query READ query WRITE setQuery) Q_PROPERTY(QString namespaceDeclarations READ namespaceDeclarations WRITE setNamespaceDeclarations) @@ -115,13 +118,22 @@ public: QString namespaceDeclarations() const; void setNamespaceDeclarations(const QString&); + enum Status { Idle, Loading, Error }; + Status status() const; + qreal progress() const; + virtual void classComplete(); +signals: + void statusChanged(Status); + void progressChanged(qreal progress); + public Q_SLOTS: void reload(); private Q_SLOTS: void requestFinished(); + void requestProgress(qint64,qint64); void queryCompleted(int,int); private: -- cgit v0.12 From 96fbcbfe543e609cc6c244f605c8b7c9b51be535 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 19 May 2009 17:29:01 +0200 Subject: Optimize QIoDevice::readAll() to possibly do less (re)allocations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Olivier Goffart Reviewed-by: Peter Hartmann Reviewed-by: João Abecasis --- src/corelib/io/qiodevice.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index c739054..efa4b25 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -945,9 +945,9 @@ QByteArray QIODevice::readAll() QByteArray tmp; if (d->isSequential() || size() == 0) { - // Read it in chunks, bytesAvailable() is unreliable for sequential - // devices. - const int chunkSize = 4096; + // Read it in chunks. Use bytesAvailable() as an unreliable hint for + // sequential devices, but try to read 4K as a minimum. + int chunkSize = qMax(qint64(4096), bytesAvailable()); qint64 totalRead = 0; forever { tmp.resize(tmp.size() + chunkSize); @@ -956,6 +956,7 @@ QByteArray QIODevice::readAll() if (readBytes <= 0) return tmp; totalRead += readBytes; + chunkSize = qMax(qint64(4096), bytesAvailable()); } } else { // Read it all in one go. -- cgit v0.12 From c51204359b7c9c2e63e4101f771d07774b921fee Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 May 2009 17:00:37 +1000 Subject: Remove unused variables from various About dialogs. Reviewed-by: Trust Me --- tools/assistant/compat/mainwindow.cpp | 11 ++--------- tools/assistant/tools/assistant/mainwindow.cpp | 13 +++---------- tools/designer/src/designer/versiondialog.cpp | 6 +----- tools/linguist/linguist/mainwindow.cpp | 6 +----- tools/qdbus/qdbusviewer/qdbusviewer.cpp | 11 ++--------- 5 files changed, 9 insertions(+), 38 deletions(-) diff --git a/tools/assistant/compat/mainwindow.cpp b/tools/assistant/compat/mainwindow.cpp index 9f91f9b..5de0d3c 100644 --- a/tools/assistant/compat/mainwindow.cpp +++ b/tools/assistant/compat/mainwindow.cpp @@ -312,21 +312,14 @@ void MainWindow::about() { QMessageBox box(this); - // TODO: Remove these variables for 4.6.0. Must keep this way for 4.5.x due to string freeze. - QString edition; - QString info; - QString moreInfo; - box.setText(QString::fromLatin1("
    " "

    %1

    " - "

    Version %2 %3

    " - "

    %4

    " - "

    %5

    " + "

    Version %2

    " "

    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).

    " "

    The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" " PARTICULAR PURPOSE.

    ") - .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR)).arg(edition).arg(info).arg(moreInfo)); + .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR))); box.setWindowTitle(tr("Qt Assistant")); box.setIcon(QMessageBox::NoIcon); box.exec(); diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 1db3bc2..2b53f09 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -797,23 +797,16 @@ void MainWindow::showAboutDialog() aboutDia.setPixmap(pix); aboutDia.setWindowTitle(aboutDia.documentTitle()); } else { - // TODO: Remove these variables for 4.6.0. Must keep this way for 4.5.x due to string freeze. - QString edition; - QString info; - QString moreInfo; - QByteArray resources; aboutDia.setText(QString::fromLatin1("

    " "

    %1

    " - "

    Version %2 %3

    " - "

    %4

    " - "

    %5

    " + "

    Version %2

    " "

    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)" ".

    The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" " PARTICULAR PURPOSE.

    ") - .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR)) - .arg(edition).arg(info).arg(moreInfo), resources); + .arg(tr("Qt Assistant")).arg(QLatin1String(QT_VERSION_STR)), + resources); QLatin1String path(":/trolltech/assistant/images/assistant-128.png"); aboutDia.setPixmap(QString(path)); } diff --git a/tools/designer/src/designer/versiondialog.cpp b/tools/designer/src/designer/versiondialog.cpp index c21912b..97dc5a1 100644 --- a/tools/designer/src/designer/versiondialog.cpp +++ b/tools/designer/src/designer/versiondialog.cpp @@ -172,15 +172,11 @@ VersionDialog::VersionDialog(QWidget *parent) version = version.arg(tr("Qt Designer")).arg(QLatin1String(QT_VERSION_STR)); version.append(tr("
    Qt Designer is a graphical user interface designer for Qt applications.
    ")); - // TODO: Remove this variable for 4.6.0. Must keep this way for 4.5.x due to string freeze - QString edition; - lbl->setText(tr("%1" - "
    %2" "
    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)." "

    The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" - " PARTICULAR PURPOSE.
    ").arg(version).arg(edition)); + " PARTICULAR PURPOSE.
    ").arg(version)); lbl->setWordWrap(true); lbl->setOpenExternalLinks(true); diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 5157fbe..921b8b6 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -1342,17 +1342,13 @@ void MainWindow::about() QString version = tr("Version %1"); version = version.arg(QLatin1String(QT_VERSION_STR)); - // TODO: Remove this variable for 4.6.0. Must keep this way for 4.5.x due to string freeze. - QString edition; - box.setText(tr("

    %1

    " "

    Qt Linguist is a tool for adding translations to Qt " "applications.

    " - "

    %2

    " "

    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)." "

    The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" - " PARTICULAR PURPOSE.

    ").arg(version).arg(edition)); + " PARTICULAR PURPOSE.

    ").arg(version)); box.setWindowTitle(QApplication::translate("AboutDialog", "Qt Linguist")); box.setIcon(QMessageBox::NoIcon); diff --git a/tools/qdbus/qdbusviewer/qdbusviewer.cpp b/tools/qdbus/qdbusviewer/qdbusviewer.cpp index 9c25a89..fcb63a8 100644 --- a/tools/qdbus/qdbusviewer/qdbusviewer.cpp +++ b/tools/qdbus/qdbusviewer/qdbusviewer.cpp @@ -441,21 +441,14 @@ void QDBusViewer::about() { QMessageBox box(this); - // TODO: Remove these variables for 4.6.0. Must keep this way for 4.5.x due to string freeze. - QString edition; - QString info; - QString moreInfo; - box.setText(QString::fromLatin1("
    " "

    %1

    " - "

    Version %2 %3

    " - "

    %4

    " - "

    %5

    " + "

    Version %2

    " "

    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).

    " "

    The program is provided AS IS with NO WARRANTY OF ANY KIND," " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A" " PARTICULAR PURPOSE.

    ") - .arg(tr("D-Bus Viewer")).arg(QLatin1String(QT_VERSION_STR)).arg(edition).arg(info).arg(moreInfo)); + .arg(tr("D-Bus Viewer")).arg(QLatin1String(QT_VERSION_STR))); box.setWindowTitle(tr("D-Bus Viewer")); box.exec(); } -- cgit v0.12 From 6526b67bb64cc9d4db081101a5eb4a5c6f7c2456 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 20 May 2009 09:37:55 +0200 Subject: Fix a typo in the class documentation for QItemDelegate --- src/gui/itemviews/qitemdelegate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index bf9b5c5..3b7eb2d 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -218,7 +218,7 @@ QSizeF QItemDelegatePrivate::doTextLayout(int lineWidth) const editor widget, which is a widget that is placed on top of the view while editing takes place. Editors are created with a QItemEditorFactory; a default static instance provided by - QItemEditorFactory is installed on all item delagates. You can set + QItemEditorFactory is installed on all item delegates. You can set a custom factory using setItemEditorFactory() or set a new default factory with QItemEditorFactory::setDefaultFactory(). It is the data stored in the item model with the Qt::EditRole that is edited. -- cgit v0.12 From 23a0475c4676797de987c7a1e11e9593f57631a8 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 20 May 2009 09:42:26 +0200 Subject: Fix parsing method calls with null arguments in Java code In Java, "null" is represented as a keyword, not as the integer 0. The old code assumed the latter. Code such as translate("fooBar", "fooBar", null); would thus not be detected by lupdate when parsing Java files. Reviewed-by: ossi --- tools/linguist/shared/java.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/linguist/shared/java.cpp b/tools/linguist/shared/java.cpp index 912a8d7..4c244d2 100644 --- a/tools/linguist/shared/java.cpp +++ b/tools/linguist/shared/java.cpp @@ -58,7 +58,7 @@ enum { Tok_Eof, Tok_class, Tok_return, Tok_tr, Tok_Comment, Tok_String, Tok_Colon, Tok_Dot, Tok_LeftBrace, Tok_RightBrace, Tok_LeftParen, Tok_RightParen, Tok_Comma, Tok_Semicolon, - Tok_Integer, Tok_Plus, Tok_PlusPlus, Tok_PlusEq }; + Tok_Integer, Tok_Plus, Tok_PlusPlus, Tok_PlusEq, Tok_null }; class Scope { @@ -142,7 +142,11 @@ static int getToken() case 'c': if ( yyIdent == QLatin1String("class") ) return Tok_class; - break; + break; + case 'n': + if ( yyIdent == QLatin1String("null") ) + return Tok_null; + break; } } switch ( yyIdent.at(0).toLatin1() ) { @@ -382,9 +386,11 @@ static bool matchInteger( qlonglong *number) static bool matchStringOrNull(QString &s) { bool matches = matchString(s); - qlonglong num = 0; - if (!matches) matches = matchInteger(&num); - return matches && num == 0; + if (!matches) { + matches = (yyTok == Tok_null); + if (matches) yyTok = getToken(); + } + return matches; } /* -- cgit v0.12 From 023d03ca888cf0e335bcbd413ea57db92e2e2ab5 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 May 2009 17:48:10 +1000 Subject: Fix incorrect copyright year in some license headers. Reviewed-by: Trust Me --- doc/src/examples/trafficinfo.qdoc | 2 +- examples/xmlpatterns/trafficinfo/main.cpp | 2 +- examples/xmlpatterns/trafficinfo/mainwindow.cpp | 2 +- examples/xmlpatterns/trafficinfo/mainwindow.h | 2 +- examples/xmlpatterns/trafficinfo/stationdialog.cpp | 2 +- examples/xmlpatterns/trafficinfo/stationdialog.h | 2 +- examples/xmlpatterns/trafficinfo/stationquery.cpp | 2 +- examples/xmlpatterns/trafficinfo/stationquery.h | 2 +- examples/xmlpatterns/trafficinfo/timequery.cpp | 2 +- examples/xmlpatterns/trafficinfo/timequery.h | 2 +- tests/auto/utf8/tst_utf8.cpp | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/src/examples/trafficinfo.qdoc b/doc/src/examples/trafficinfo.qdoc index c9b6890..13181cd 100644 --- a/doc/src/examples/trafficinfo.qdoc +++ b/doc/src/examples/trafficinfo.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** 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. diff --git a/examples/xmlpatterns/trafficinfo/main.cpp b/examples/xmlpatterns/trafficinfo/main.cpp index 97b2bf7..544260d 100644 --- a/examples/xmlpatterns/trafficinfo/main.cpp +++ b/examples/xmlpatterns/trafficinfo/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. diff --git a/examples/xmlpatterns/trafficinfo/mainwindow.cpp b/examples/xmlpatterns/trafficinfo/mainwindow.cpp index 1f754d5..47c51c9 100644 --- a/examples/xmlpatterns/trafficinfo/mainwindow.cpp +++ b/examples/xmlpatterns/trafficinfo/mainwindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. diff --git a/examples/xmlpatterns/trafficinfo/mainwindow.h b/examples/xmlpatterns/trafficinfo/mainwindow.h index d48109d..5362bcd 100644 --- a/examples/xmlpatterns/trafficinfo/mainwindow.h +++ b/examples/xmlpatterns/trafficinfo/mainwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. diff --git a/examples/xmlpatterns/trafficinfo/stationdialog.cpp b/examples/xmlpatterns/trafficinfo/stationdialog.cpp index 9876bdb..54ed904 100644 --- a/examples/xmlpatterns/trafficinfo/stationdialog.cpp +++ b/examples/xmlpatterns/trafficinfo/stationdialog.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. diff --git a/examples/xmlpatterns/trafficinfo/stationdialog.h b/examples/xmlpatterns/trafficinfo/stationdialog.h index 5ac1635..0e87f61 100644 --- a/examples/xmlpatterns/trafficinfo/stationdialog.h +++ b/examples/xmlpatterns/trafficinfo/stationdialog.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. diff --git a/examples/xmlpatterns/trafficinfo/stationquery.cpp b/examples/xmlpatterns/trafficinfo/stationquery.cpp index ab42ad9..3db0fdb 100644 --- a/examples/xmlpatterns/trafficinfo/stationquery.cpp +++ b/examples/xmlpatterns/trafficinfo/stationquery.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. diff --git a/examples/xmlpatterns/trafficinfo/stationquery.h b/examples/xmlpatterns/trafficinfo/stationquery.h index 5cbf28a..d1e4d2f 100644 --- a/examples/xmlpatterns/trafficinfo/stationquery.h +++ b/examples/xmlpatterns/trafficinfo/stationquery.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. diff --git a/examples/xmlpatterns/trafficinfo/timequery.cpp b/examples/xmlpatterns/trafficinfo/timequery.cpp index bd63560..d6bf695 100644 --- a/examples/xmlpatterns/trafficinfo/timequery.cpp +++ b/examples/xmlpatterns/trafficinfo/timequery.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. diff --git a/examples/xmlpatterns/trafficinfo/timequery.h b/examples/xmlpatterns/trafficinfo/timequery.h index f88e62c..2435c71 100644 --- a/examples/xmlpatterns/trafficinfo/timequery.h +++ b/examples/xmlpatterns/trafficinfo/timequery.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. diff --git a/tests/auto/utf8/tst_utf8.cpp b/tests/auto/utf8/tst_utf8.cpp index 3aef69f..e21e5a3 100644 --- a/tests/auto/utf8/tst_utf8.cpp +++ b/tests/auto/utf8/tst_utf8.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** 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. -- cgit v0.12 From ba71f22dbee3e5bd4e0db0054b8ba57bde89d224 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 20 May 2009 10:21:11 +0200 Subject: Refactor the qimagereader autotest to work with shadow build Refactor the test of QImageReader to work with shadow build. Add two tests for the TIFF format Fix an error of the test of QImageWriter that prevented the cleaning of the created files after the test. Reviewed-by: Olivier --- tests/auto/qimage/images/image.tif | Bin 0 -> 2242 bytes tests/auto/qimage/tst_qimage.cpp | 3 + tests/auto/qimagereader/images/image_100dpi.tif | Bin 0 -> 2242 bytes tests/auto/qimagereader/qimagereader.pro | 2 + tests/auto/qimagereader/qimagereader.qrc | 1 + tests/auto/qimagereader/tst_qimagereader.cpp | 421 ++++++++++++------------ tests/auto/qimagewriter/tst_qimagewriter.cpp | 8 +- 7 files changed, 224 insertions(+), 211 deletions(-) create mode 100644 tests/auto/qimage/images/image.tif create mode 100644 tests/auto/qimagereader/images/image_100dpi.tif diff --git a/tests/auto/qimage/images/image.tif b/tests/auto/qimage/images/image.tif new file mode 100644 index 0000000..ee0637c Binary files /dev/null and b/tests/auto/qimage/images/image.tif differ diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 88bbb50..c6b0560 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -274,6 +274,9 @@ void tst_QImage::formatHandlersInput_data() QTest::newRow("PPM") << "PPM" << prefix + "image.ppm"; QTest::newRow("XBM") << "XBM" << prefix + "image.xbm"; QTest::newRow("XPM") << "XPM" << prefix + "image.xpm"; +#if defined QTEST_HAVE_TIFF + QTest::newRow("TIFF") << "TIFF" << prefix + "image.tif"; +#endif } void tst_QImage::formatHandlersInput() diff --git a/tests/auto/qimagereader/images/image_100dpi.tif b/tests/auto/qimagereader/images/image_100dpi.tif new file mode 100644 index 0000000..fcf3cd8 Binary files /dev/null and b/tests/auto/qimagereader/images/image_100dpi.tif differ diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/qimagereader/qimagereader.pro index b178823..2c9510e 100644 --- a/tests/auto/qimagereader/qimagereader.pro +++ b/tests/auto/qimagereader/qimagereader.pro @@ -3,6 +3,7 @@ SOURCES += tst_qimagereader.cpp MOC_DIR=tmp QT += network RESOURCES += qimagereader.qrc +DEFINES += SRCDIR=\\\"$$PWD\\\" !contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF !contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG @@ -22,5 +23,6 @@ wince*: { imagePlugins.path = imageformats DEPLOYMENT += images imagePlugins + DEFINES += SRCDIR=\\\".\\\" } diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc index 13ce582..3c674ad 100644 --- a/tests/auto/qimagereader/qimagereader.qrc +++ b/tests/auto/qimagereader/qimagereader.qrc @@ -30,6 +30,7 @@ images/image.pgm images/image.png images/image.ppm + images/image.tif images/kollada.png images/marble.xpm images/namedcolors.xpm diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 8f7094c..f5313eb 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -158,6 +158,8 @@ private slots: void pixelCompareWithBaseline(); }; +static const QLatin1String prefix(SRCDIR "/images/"); + // Testing get/set functions void tst_QImageReader::getSetCheck() { @@ -232,7 +234,7 @@ void tst_QImageReader::readImage() QFETCH(QByteArray, format); for (int i = 0; i < 2; ++i) { - QImageReader io("images/" + fileName, i ? QByteArray() : format); + QImageReader io(prefix + fileName, i ? QByteArray() : format); if (success) { if (!io.supportsAnimation()) QVERIFY(io.imageCount() > 0); @@ -248,16 +250,16 @@ void tst_QImageReader::readImage() QVERIFY2(!image.isNull(), io.errorString().toLatin1().constData()); // No format - QImageReader io2("images/" + fileName); + QImageReader io2(prefix + fileName); QVERIFY2(!io2.read().isNull(), io.errorString().toLatin1().constData()); // No extension, no format - QImageReader io3("images/" + fileName.left(fileName.lastIndexOf(QLatin1Char('.')))); + QImageReader io3(prefix + fileName.left(fileName.lastIndexOf(QLatin1Char('.')))); QVERIFY2(!io3.read().isNull(), io.errorString().toLatin1().constData()); // Read into \a image2 QImage image2; - QImageReader image2Reader("images/" + fileName, i ? QByteArray() : format); + QImageReader image2Reader(prefix + fileName, i ? QByteArray() : format); QCOMPARE(image2Reader.format(), format); QVERIFY(image2Reader.read(&image2)); if (image2Reader.canRead()) { @@ -281,8 +283,8 @@ void tst_QImageReader::readImage() void tst_QImageReader::jpegRgbCmyk() { - QImage image1(QLatin1String("images/YCbCr_cmyk.jpg")); - QImage image2(QLatin1String("images/YCbCr_cmyk.png")); + QImage image1(prefix + QLatin1String("YCbCr_cmyk.jpg")); + QImage image2(prefix + QLatin1String("YCbCr_cmyk.png")); QCOMPARE(image1, image2); } @@ -293,24 +295,24 @@ void tst_QImageReader::setScaledSize_data() QTest::addColumn("newSize"); QTest::addColumn("format"); - QTest::newRow("BMP: colorful") << "images/colorful" << QSize(200, 200) << QByteArray("bmp"); - QTest::newRow("BMP: font") << "images/font" << QSize(200, 200) << QByteArray("bmp"); - QTest::newRow("XPM: marble") << "images/marble" << QSize(200, 200) << QByteArray("xpm"); - QTest::newRow("PNG: kollada") << "images/kollada" << QSize(200, 200) << QByteArray("png"); - QTest::newRow("PPM: teapot") << "images/teapot" << QSize(200, 200) << QByteArray("ppm"); - QTest::newRow("PPM: runners") << "images/runners.ppm" << QSize(400, 400) << QByteArray("ppm"); - QTest::newRow("PPM: test") << "images/test.ppm" << QSize(10, 10) << QByteArray("ppm"); - QTest::newRow("XBM: gnus") << "images/gnus" << QSize(200, 200) << QByteArray("xbm"); + QTest::newRow("BMP: colorful") << "colorful" << QSize(200, 200) << QByteArray("bmp"); + QTest::newRow("BMP: font") << "font" << QSize(200, 200) << QByteArray("bmp"); + QTest::newRow("XPM: marble") << "marble" << QSize(200, 200) << QByteArray("xpm"); + QTest::newRow("PNG: kollada") << "kollada" << QSize(200, 200) << QByteArray("png"); + QTest::newRow("PPM: teapot") << "teapot" << QSize(200, 200) << QByteArray("ppm"); + QTest::newRow("PPM: runners") << "runners.ppm" << QSize(400, 400) << QByteArray("ppm"); + QTest::newRow("PPM: test") << "test.ppm" << QSize(10, 10) << QByteArray("ppm"); + QTest::newRow("XBM: gnus") << "gnus" << QSize(200, 200) << QByteArray("xbm"); #ifdef QTEST_HAVE_JPEG - QTest::newRow("JPEG: beavis") << "images/beavis" << QSize(200, 200) << QByteArray("jpeg"); + QTest::newRow("JPEG: beavis") << "beavis" << QSize(200, 200) << QByteArray("jpeg"); #endif // QTEST_HAVE_JPEG #ifdef QTEST_HAVE_GIF - QTest::newRow("GIF: earth") << "images/earth" << QSize(200, 200) << QByteArray("gif"); - QTest::newRow("GIF: trolltech") << "images/trolltech" << QSize(200, 200) << QByteArray("gif"); + QTest::newRow("GIF: earth") << "earth" << QSize(200, 200) << QByteArray("gif"); + QTest::newRow("GIF: trolltech") << "trolltech" << QSize(200, 200) << QByteArray("gif"); #endif // QTEST_HAVE_GIF #ifdef QTEST_HAVE_MNG - QTest::newRow("MNG: ball") << "images/ball" << QSize(200, 200) << QByteArray("mng"); - QTest::newRow("MNG: fire") << "images/fire" << QSize(200, 200) << QByteArray("mng"); + QTest::newRow("MNG: ball") << "ball" << QSize(200, 200) << QByteArray("mng"); + QTest::newRow("MNG: fire") << "fire" << QSize(200, 200) << QByteArray("mng"); #endif // QTEST_HAVE_MNG } @@ -323,7 +325,7 @@ void tst_QImageReader::setScaledSize() if (!format.isEmpty() && !QImageReader::supportedImageFormats().contains(format)) QSKIP("Qt does not support reading the \"" + format + "\" format", SkipSingle); - QImageReader reader(fileName); + QImageReader reader(prefix + fileName); reader.setScaledSize(newSize); QImage image = reader.read(); QVERIFY(!image.isNull()); @@ -336,25 +338,25 @@ void tst_QImageReader::setClipRect_data() QTest::addColumn("fileName"); QTest::addColumn("newRect"); QTest::addColumn("format"); - QTest::newRow("BMP: colorful") << "images/colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp"); - QTest::newRow("BMP: font") << "images/font" << QRect(0, 0, 50, 50) << QByteArray("bmp"); - QTest::newRow("BMP: 4bpp uncompressed") << "images/tst7.bmp" << QRect(0, 0, 31, 31) << QByteArray("bmp"); - QTest::newRow("XPM: marble") << "images/marble" << QRect(0, 0, 50, 50) << QByteArray("xpm"); - QTest::newRow("PNG: kollada") << "images/kollada" << QRect(0, 0, 50, 50) << QByteArray("png"); - QTest::newRow("PPM: teapot") << "images/teapot" << QRect(0, 0, 50, 50) << QByteArray("ppm"); - QTest::newRow("PPM: runners") << "images/runners.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm"); - QTest::newRow("PPM: test") << "images/test.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm"); - QTest::newRow("XBM: gnus") << "images/gnus" << QRect(0, 0, 50, 50) << QByteArray("xbm"); + QTest::newRow("BMP: colorful") << "colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp"); + QTest::newRow("BMP: font") << "font" << QRect(0, 0, 50, 50) << QByteArray("bmp"); + QTest::newRow("BMP: 4bpp uncompressed") << "tst7.bmp" << QRect(0, 0, 31, 31) << QByteArray("bmp"); + QTest::newRow("XPM: marble") << "marble" << QRect(0, 0, 50, 50) << QByteArray("xpm"); + QTest::newRow("PNG: kollada") << "kollada" << QRect(0, 0, 50, 50) << QByteArray("png"); + QTest::newRow("PPM: teapot") << "teapot" << QRect(0, 0, 50, 50) << QByteArray("ppm"); + QTest::newRow("PPM: runners") << "runners.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm"); + QTest::newRow("PPM: test") << "test.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm"); + QTest::newRow("XBM: gnus") << "gnus" << QRect(0, 0, 50, 50) << QByteArray("xbm"); #ifdef QTEST_HAVE_JPEG - QTest::newRow("JPEG: beavis") << "images/beavis" << QRect(0, 0, 50, 50) << QByteArray("jpeg"); + QTest::newRow("JPEG: beavis") << "beavis" << QRect(0, 0, 50, 50) << QByteArray("jpeg"); #endif // QTEST_HAVE_JPEG #ifdef QTEST_HAVE_GIF - QTest::newRow("GIF: earth") << "images/earth" << QRect(0, 0, 50, 50) << QByteArray("gif"); - QTest::newRow("GIF: trolltech") << "images/trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif"); + QTest::newRow("GIF: earth") << "earth" << QRect(0, 0, 50, 50) << QByteArray("gif"); + QTest::newRow("GIF: trolltech") << "trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif"); #endif // QTEST_HAVE_GIF #ifdef QTEST_HAVE_MNG - QTest::newRow("MNG: ball") << "images/ball" << QRect(0, 0, 50, 50) << QByteArray("mng"); - QTest::newRow("MNG: fire") << "images/fire" << QRect(0, 0, 50, 50) << QByteArray("mng"); + QTest::newRow("MNG: ball") << "ball" << QRect(0, 0, 50, 50) << QByteArray("mng"); + QTest::newRow("MNG: fire") << "fire" << QRect(0, 0, 50, 50) << QByteArray("mng"); #endif // QTEST_HAVE_MNG } @@ -367,13 +369,13 @@ void tst_QImageReader::setClipRect() if (!format.isEmpty() && !QImageReader::supportedImageFormats().contains(format)) QSKIP("Qt does not support reading the \"" + format + "\" format", SkipSingle); - QImageReader reader(fileName); + QImageReader reader(prefix + fileName); reader.setClipRect(newRect); QImage image = reader.read(); QVERIFY(!image.isNull()); QCOMPARE(image.rect(), newRect); - QImageReader originalReader(fileName); + QImageReader originalReader(prefix + fileName); QImage originalImage = originalReader.read(); QCOMPARE(originalImage.copy(newRect), image); } @@ -384,24 +386,24 @@ void tst_QImageReader::setScaledClipRect_data() QTest::addColumn("newRect"); QTest::addColumn("format"); - QTest::newRow("BMP: colorful") << "images/colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp"); - QTest::newRow("BMP: font") << "images/font" << QRect(0, 0, 50, 50) << QByteArray("bmp"); - QTest::newRow("XPM: marble") << "images/marble" << QRect(0, 0, 50, 50) << QByteArray("xpm"); - QTest::newRow("PNG: kollada") << "images/kollada" << QRect(0, 0, 50, 50) << QByteArray("png"); - QTest::newRow("PPM: teapot") << "images/teapot" << QRect(0, 0, 50, 50) << QByteArray("ppm"); - QTest::newRow("PPM: runners") << "images/runners.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm"); - QTest::newRow("PPM: test") << "images/test.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm"); - QTest::newRow("XBM: gnus") << "images/gnus" << QRect(0, 0, 50, 50) << QByteArray("xbm"); + QTest::newRow("BMP: colorful") << "colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp"); + QTest::newRow("BMP: font") << "font" << QRect(0, 0, 50, 50) << QByteArray("bmp"); + QTest::newRow("XPM: marble") << "marble" << QRect(0, 0, 50, 50) << QByteArray("xpm"); + QTest::newRow("PNG: kollada") << "kollada" << QRect(0, 0, 50, 50) << QByteArray("png"); + QTest::newRow("PPM: teapot") << "teapot" << QRect(0, 0, 50, 50) << QByteArray("ppm"); + QTest::newRow("PPM: runners") << "runners.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm"); + QTest::newRow("PPM: test") << "test.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm"); + QTest::newRow("XBM: gnus") << "gnus" << QRect(0, 0, 50, 50) << QByteArray("xbm"); #ifdef QTEST_HAVE_JPEG - QTest::newRow("JPEG: beavis") << "images/beavis" << QRect(0, 0, 50, 50) << QByteArray("jpeg"); + QTest::newRow("JPEG: beavis") << "beavis" << QRect(0, 0, 50, 50) << QByteArray("jpeg"); #endif // QTEST_HAVE_JPEG #ifdef QTEST_HAVE_GIF - QTest::newRow("GIF: earth") << "images/earth" << QRect(0, 0, 50, 50) << QByteArray("gif"); - QTest::newRow("GIF: trolltech") << "images/trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif"); + QTest::newRow("GIF: earth") << "earth" << QRect(0, 0, 50, 50) << QByteArray("gif"); + QTest::newRow("GIF: trolltech") << "trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif"); #endif // QTEST_HAVE_GIF #ifdef QTEST_HAVE_MNG - QTest::newRow("MNG: ball") << "images/ball" << QRect(0, 0, 50, 50) << QByteArray("mng"); - QTest::newRow("MNG: fire") << "images/fire" << QRect(0, 0, 50, 50) << QByteArray("mng"); + QTest::newRow("MNG: ball") << "ball" << QRect(0, 0, 50, 50) << QByteArray("mng"); + QTest::newRow("MNG: fire") << "fire" << QRect(0, 0, 50, 50) << QByteArray("mng"); #endif // QTEST_HAVE_MNG } @@ -414,14 +416,14 @@ void tst_QImageReader::setScaledClipRect() if (!format.isEmpty() && !QImageReader::supportedImageFormats().contains(format)) QSKIP("Qt does not support reading the \"" + format + "\" format", SkipSingle); - QImageReader reader(fileName); + QImageReader reader(prefix + fileName); reader.setScaledSize(QSize(300, 300)); reader.setScaledClipRect(newRect); QImage image = reader.read(); QVERIFY(!image.isNull()); QCOMPARE(image.rect(), newRect); - QImageReader originalReader(fileName); + QImageReader originalReader(prefix + fileName); originalReader.setScaledSize(QSize(300, 300)); QImage originalImage = originalReader.read(); QCOMPARE(originalImage.copy(newRect), image); @@ -433,29 +435,29 @@ void tst_QImageReader::imageFormat_data() QTest::addColumn("format"); QTest::addColumn("imageFormat"); - QTest::newRow("pbm") << QString("images/image.pbm") << QByteArray("pbm") << QImage::Format_Mono; - QTest::newRow("pgm") << QString("images/image.pgm") << QByteArray("pgm") << QImage::Format_Indexed8; - QTest::newRow("ppm-1") << QString("images/image.ppm") << QByteArray("ppm") << QImage::Format_RGB32; - QTest::newRow("ppm-2") << QString("images/teapot.ppm") << QByteArray("ppm") << QImage::Format_RGB32; - QTest::newRow("ppm-3") << QString("images/runners.ppm") << QByteArray("ppm") << QImage::Format_RGB32; - QTest::newRow("ppm-4") << QString("images/test.ppm") << QByteArray("ppm") << QImage::Format_RGB32; + QTest::newRow("pbm") << QString("image.pbm") << QByteArray("pbm") << QImage::Format_Mono; + QTest::newRow("pgm") << QString("image.pgm") << QByteArray("pgm") << QImage::Format_Indexed8; + QTest::newRow("ppm-1") << QString("image.ppm") << QByteArray("ppm") << QImage::Format_RGB32; + QTest::newRow("ppm-2") << QString("teapot.ppm") << QByteArray("ppm") << QImage::Format_RGB32; + QTest::newRow("ppm-3") << QString("runners.ppm") << QByteArray("ppm") << QImage::Format_RGB32; + QTest::newRow("ppm-4") << QString("test.ppm") << QByteArray("ppm") << QImage::Format_RGB32; #ifdef QTEST_HAVE_JPEG - QTest::newRow("jpeg-1") << QString("images/beavis.jpg") << QByteArray("jpeg") << QImage::Format_Indexed8; - QTest::newRow("jpeg-2") << QString("images/YCbCr_cmyk.jpg") << QByteArray("jpeg") << QImage::Format_RGB32; - QTest::newRow("jpeg-3") << QString("images/YCbCr_rgb.jpg") << QByteArray("jpeg") << QImage::Format_RGB32; + QTest::newRow("jpeg-1") << QString("beavis.jpg") << QByteArray("jpeg") << QImage::Format_Indexed8; + QTest::newRow("jpeg-2") << QString("YCbCr_cmyk.jpg") << QByteArray("jpeg") << QImage::Format_RGB32; + QTest::newRow("jpeg-3") << QString("YCbCr_rgb.jpg") << QByteArray("jpeg") << QImage::Format_RGB32; #endif #if defined QTEST_HAVE_GIF - QTest::newRow("gif-1") << QString("images/earth.gif") << QByteArray("gif") << QImage::Format_Invalid; - QTest::newRow("gif-2") << QString("images/trolltech.gif") << QByteArray("gif") << QImage::Format_Invalid; + QTest::newRow("gif-1") << QString("earth.gif") << QByteArray("gif") << QImage::Format_Invalid; + QTest::newRow("gif-2") << QString("trolltech.gif") << QByteArray("gif") << QImage::Format_Invalid; #endif - QTest::newRow("xbm") << QString("images/gnus.xbm") << QByteArray("xbm") << QImage::Format_MonoLSB; - QTest::newRow("xpm") << QString("images/marble.xpm") << QByteArray("xpm") << QImage::Format_Indexed8; - QTest::newRow("bmp-1") << QString("images/colorful.bmp") << QByteArray("bmp") << QImage::Format_Indexed8; - QTest::newRow("bmp-2") << QString("images/font.bmp") << QByteArray("bmp") << QImage::Format_Indexed8; - QTest::newRow("png") << QString("images/kollada.png") << QByteArray("png") << QImage::Format_ARGB32; - QTest::newRow("png-2") << QString("images/YCbCr_cmyk.png") << QByteArray("png") << QImage::Format_RGB32; - QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng") << QImage::Format_Invalid; - QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng") << QImage::Format_Invalid; + QTest::newRow("xbm") << QString("gnus.xbm") << QByteArray("xbm") << QImage::Format_MonoLSB; + QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm") << QImage::Format_Indexed8; + QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp") << QImage::Format_Indexed8; + QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp") << QImage::Format_Indexed8; + QTest::newRow("png") << QString("kollada.png") << QByteArray("png") << QImage::Format_ARGB32; + QTest::newRow("png-2") << QString("YCbCr_cmyk.png") << QByteArray("png") << QImage::Format_RGB32; + QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng") << QImage::Format_Invalid; + QTest::newRow("mng-2") << QString("fire.mng") << QByteArray("mng") << QImage::Format_Invalid; } void tst_QImageReader::imageFormat() @@ -463,7 +465,8 @@ void tst_QImageReader::imageFormat() QFETCH(QString, fileName); QFETCH(QByteArray, format); QFETCH(QImage::Format, imageFormat); - if (QImageReader::imageFormat(fileName).isEmpty()) { + + if (QImageReader::imageFormat(prefix + fileName).isEmpty()) { if (QByteArray("jpeg") == format) #ifndef QTEST_HAVE_JPEG return; @@ -478,31 +481,31 @@ void tst_QImageReader::imageFormat() #endif // !QTEST_HAVE_MNG QSKIP(("Qt does not support the " + format + " format.").constData(), SkipSingle); } else { - QCOMPARE(QImageReader::imageFormat(fileName), format); + QCOMPARE(QImageReader::imageFormat(prefix + fileName), format); } - QImageReader reader(fileName); + QImageReader reader(prefix + fileName); QCOMPARE(reader.imageFormat(), imageFormat); } void tst_QImageReader::blackXPM() { - QImage image(QLatin1String("images/black.xpm")); - QImage image2(QLatin1String("images/black.png")); + QImage image(prefix + QLatin1String("black.xpm")); + QImage image2(prefix + QLatin1String("black.png")); QCOMPARE(image.pixel(25, 25), qRgb(190, 190, 190)); QCOMPARE(image.pixel(25, 25), image2.pixel(25, 25)); } void tst_QImageReader::transparentXPM() { - QImage image(QLatin1String("images/nontransparent.xpm")); - QImage image2(QLatin1String("images/transparent.xpm")); + QImage image(prefix + QLatin1String("nontransparent.xpm")); + QImage image2(prefix + QLatin1String("transparent.xpm")); QCOMPARE(image.format(), QImage::Format_RGB32); QCOMPARE(image2.format(), QImage::Format_ARGB32); } void tst_QImageReader::multiWordNamedColorXPM() { - QImage image(QLatin1String("images/namedcolors.xpm")); + QImage image(prefix + QLatin1String("namedcolors.xpm")); QCOMPARE(image.pixel(0, 0), qRgb(102, 139, 139)); // pale turquoise 4 QCOMPARE(image.pixel(0, 1), qRgb(250, 250, 210)); // light golden rod yellow QCOMPARE(image.pixel(0, 2), qRgb(255, 250, 205)); // lemon chiffon @@ -593,7 +596,7 @@ void tst_QImageReader::supportsAnimation() { QFETCH(QString, fileName); QFETCH(bool, success); - QImageReader io("images/" + fileName); + QImageReader io(prefix + fileName); QCOMPARE(io.supportsAnimation(), success); } @@ -606,7 +609,7 @@ void tst_QImageReader::sizeBeforeRead() { QFETCH(QString, fileName); QFETCH(QByteArray, format); - QImageReader reader(fileName); + QImageReader reader(prefix + fileName); QVERIFY(reader.canRead()); if (format == "mng") { QCOMPARE(reader.size(), QSize()); @@ -644,7 +647,7 @@ void tst_QImageReader::imageFormatBeforeRead() void tst_QImageReader::gifHandlerBugs() { { - QImageReader io("images/trolltech.gif"); + QImageReader io(prefix + "trolltech.gif"); QVERIFY(io.loopCount() != 1); int count=0; for (; io.canRead(); io.read(), ++count) ; @@ -653,8 +656,8 @@ void tst_QImageReader::gifHandlerBugs() // Task 95166 { - QImageReader io1("images/bat1.gif"); - QImageReader io2("images/bat2.gif"); + QImageReader io1(prefix + "bat1.gif"); + QImageReader io2(prefix + "bat2.gif"); QVERIFY(io1.canRead()); QVERIFY(io2.canRead()); QImage im1 = io1.read(); @@ -666,8 +669,8 @@ void tst_QImageReader::gifHandlerBugs() // Task 9994 { - QImageReader io1("images/noclearcode.gif"); - QImageReader io2("images/noclearcode.bmp"); + QImageReader io1(prefix + "noclearcode.gif"); + QImageReader io2(prefix + "noclearcode.bmp"); QVERIFY(io1.canRead()); QVERIFY(io2.canRead()); QImage im1 = io1.read(); QImage im2 = io2.read(); QVERIFY(!im1.isNull()); QVERIFY(!im2.isNull()); @@ -731,29 +734,29 @@ void tst_QImageReader::readFromDevice_data() QTest::addColumn("fileName"); QTest::addColumn("format"); - QTest::newRow("pbm") << QString("images/image.pbm") << QByteArray("pbm"); - QTest::newRow("pgm") << QString("images/image.pgm") << QByteArray("pgm"); - QTest::newRow("ppm-1") << QString("images/image.ppm") << QByteArray("ppm"); - QTest::newRow("ppm-2") << QString("images/teapot.ppm") << QByteArray("ppm"); - QTest::newRow("ppm-3") << QString("images/teapot.ppm") << QByteArray("ppm"); - QTest::newRow("ppm-4") << QString("images/runners.ppm") << QByteArray("ppm"); + QTest::newRow("pbm") << QString("image.pbm") << QByteArray("pbm"); + QTest::newRow("pgm") << QString("image.pgm") << QByteArray("pgm"); + QTest::newRow("ppm-1") << QString("image.ppm") << QByteArray("ppm"); + QTest::newRow("ppm-2") << QString("teapot.ppm") << QByteArray("ppm"); + QTest::newRow("ppm-3") << QString("teapot.ppm") << QByteArray("ppm"); + QTest::newRow("ppm-4") << QString("runners.ppm") << QByteArray("ppm"); #ifdef QTEST_HAVE_JPEG - QTest::newRow("jpeg-1") << QString("images/beavis.jpg") << QByteArray("jpeg"); - QTest::newRow("jpeg-2") << QString("images/YCbCr_cmyk.jpg") << QByteArray("jpeg"); - QTest::newRow("jpeg-3") << QString("images/YCbCr_rgb.jpg") << QByteArray("jpeg"); + QTest::newRow("jpeg-1") << QString("beavis.jpg") << QByteArray("jpeg"); + QTest::newRow("jpeg-2") << QString("YCbCr_cmyk.jpg") << QByteArray("jpeg"); + QTest::newRow("jpeg-3") << QString("YCbCr_rgb.jpg") << QByteArray("jpeg"); #endif // QTEST_HAVE_JPEG #ifdef QTEST_HAVE_GIF - QTest::newRow("gif-1") << QString("images/earth.gif") << QByteArray("gif"); - QTest::newRow("gif-2") << QString("images/trolltech.gif") << QByteArray("gif"); + QTest::newRow("gif-1") << QString("earth.gif") << QByteArray("gif"); + QTest::newRow("gif-2") << QString("trolltech.gif") << QByteArray("gif"); #endif // QTEST_HAVE_GIF - QTest::newRow("xbm") << QString("images/gnus.xbm") << QByteArray("xbm"); - QTest::newRow("xpm") << QString("images/marble.xpm") << QByteArray("xpm"); - QTest::newRow("bmp-1") << QString("images/colorful.bmp") << QByteArray("bmp"); - QTest::newRow("bmp-2") << QString("images/font.bmp") << QByteArray("bmp"); - QTest::newRow("png") << QString("images/kollada.png") << QByteArray("png"); + QTest::newRow("xbm") << QString("gnus.xbm") << QByteArray("xbm"); + QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm"); + QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp"); + QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp"); + QTest::newRow("png") << QString("kollada.png") << QByteArray("png"); #ifdef QTEST_HAVE_MNG - QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng"); - QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng"); + QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng"); + QTest::newRow("mng-2") << QString("fire.mng") << QByteArray("mng"); #endif // QTEST_HAVE_MNG } @@ -762,9 +765,9 @@ void tst_QImageReader::readFromDevice() QFETCH(QString, fileName); QFETCH(QByteArray, format); - QImage expectedImage(fileName, format); + QImage expectedImage(prefix + fileName, format); - QFile file(fileName); + QFile file(prefix + fileName); QVERIFY(file.open(QFile::ReadOnly)); QByteArray imageData = file.readAll(); QVERIFY(!imageData.isEmpty()); @@ -813,26 +816,26 @@ void tst_QImageReader::readFromFileAfterJunk_data() QTest::addColumn("fileName"); QTest::addColumn("format"); - QTest::newRow("pbm") << QString("images/image.pbm") << QByteArray("pbm"); - QTest::newRow("pgm") << QString("images/image.pgm") << QByteArray("pgm"); - QTest::newRow("ppm-1") << QString("images/image.ppm") << QByteArray("ppm"); - QTest::newRow("ppm-2") << QString("images/teapot.ppm") << QByteArray("ppm"); - QTest::newRow("ppm-3") << QString("images/teapot.ppm") << QByteArray("ppm"); - QTest::newRow("ppm-4") << QString("images/runners.ppm") << QByteArray("ppm"); + QTest::newRow("pbm") << QString("image.pbm") << QByteArray("pbm"); + QTest::newRow("pgm") << QString("image.pgm") << QByteArray("pgm"); + QTest::newRow("ppm-1") << QString("image.ppm") << QByteArray("ppm"); + QTest::newRow("ppm-2") << QString("teapot.ppm") << QByteArray("ppm"); + QTest::newRow("ppm-3") << QString("teapot.ppm") << QByteArray("ppm"); + QTest::newRow("ppm-4") << QString("runners.ppm") << QByteArray("ppm"); #ifdef QTEST_HAVE_JPEG - QTest::newRow("jpeg-1") << QString("images/beavis.jpg") << QByteArray("jpeg"); - QTest::newRow("jpeg-2") << QString("images/YCbCr_cmyk.jpg") << QByteArray("jpeg"); - QTest::newRow("jpeg-3") << QString("images/YCbCr_rgb.jpg") << QByteArray("jpeg"); + QTest::newRow("jpeg-1") << QString("beavis.jpg") << QByteArray("jpeg"); + QTest::newRow("jpeg-2") << QString("YCbCr_cmyk.jpg") << QByteArray("jpeg"); + QTest::newRow("jpeg-3") << QString("YCbCr_rgb.jpg") << QByteArray("jpeg"); #endif #if defined QTEST_HAVE_GIF // QTest::newRow("gif-1") << QString("images/earth.gif") << QByteArray("gif"); // QTest::newRow("gif-2") << QString("images/trolltech.gif") << QByteArray("gif"); #endif - QTest::newRow("xbm") << QString("images/gnus.xbm") << QByteArray("xbm"); - QTest::newRow("xpm") << QString("images/marble.xpm") << QByteArray("xpm"); - QTest::newRow("bmp-1") << QString("images/colorful.bmp") << QByteArray("bmp"); - QTest::newRow("bmp-2") << QString("images/font.bmp") << QByteArray("bmp"); - QTest::newRow("png") << QString("images/kollada.png") << QByteArray("png"); + QTest::newRow("xbm") << QString("gnus.xbm") << QByteArray("xbm"); + QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm"); + QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp"); + QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp"); + QTest::newRow("png") << QString("kollada.png") << QByteArray("png"); // QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng"); // QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng"); } @@ -851,7 +854,7 @@ void tst_QImageReader::readFromFileAfterJunk() QFile junkFile("junk"); QVERIFY(junkFile.open(QFile::WriteOnly)); - QFile imageFile(fileName); + QFile imageFile(prefix + fileName); QVERIFY(imageFile.open(QFile::ReadOnly)); QByteArray imageData = imageFile.readAll(); QVERIFY(!imageData.isNull()); @@ -869,7 +872,7 @@ void tst_QImageReader::readFromFileAfterJunk() for (int i = 0; i < iterations; ++i) { QImageWriter writer(&junkFile, format); junkFile.write("deadbeef", 9); - QVERIFY(writer.write(QImage(fileName))); + QVERIFY(writer.write(QImage(prefix + fileName))); } } junkFile.close(); @@ -903,8 +906,8 @@ void tst_QImageReader::description_data() willem["Software"] = "Created on a NeXTstation color using \"pnmtopng\"."; willem["Disclaimer"] = "Freeware."; - QTest::newRow("PNG") << QString("images/pngwithtext.png") << willem; - QTest::newRow("PNG Compressed") << QString("images/pngwithcompressedtext.png") << willem; + QTest::newRow("PNG") << QString("pngwithtext.png") << willem; + QTest::newRow("PNG Compressed") << QString("pngwithcompressedtext.png") << willem; } void tst_QImageReader::description() @@ -913,9 +916,9 @@ void tst_QImageReader::description() QFETCH(QStringMap, description); // Sanity check - QVERIFY(!QImage(fileName).isNull()); + QVERIFY(!QImage(prefix + fileName).isNull()); - QImageReader reader(fileName); + QImageReader reader(prefix + fileName); foreach (QString key, description.keys()) QCOMPARE(reader.text(key), description.value(key)); @@ -940,143 +943,143 @@ void tst_QImageReader::readFromResources_data() QTest::addColumn("size"); QTest::addColumn("message"); - QTest::newRow("images/corrupt.bmp") << QString("images/corrupt.bmp") + QTest::newRow("corrupt.bmp") << QString("corrupt.bmp") << QByteArray("bmp") << QSize(0, 0) << QString(""); - QTest::newRow("images/negativeheight.bmp") << QString("images/negativeheight.bmp") + QTest::newRow("negativeheight.bmp") << QString("negativeheight.bmp") << QByteArray("bmp") << QSize(127, 64) << QString(""); - QTest::newRow("images/font.bmp") << QString("images/font.bmp") + QTest::newRow("font.bmp") << QString("font.bmp") << QByteArray("bmp") << QSize(240, 8) << QString(""); - QTest::newRow("images/noclearcode.bmp") << QString("images/noclearcode.bmp") + QTest::newRow("noclearcode.bmp") << QString("noclearcode.bmp") << QByteArray("bmp") << QSize(29, 18) << QString(""); - QTest::newRow("images/colorful.bmp") << QString("images/colorful.bmp") + QTest::newRow("colorful.bmp") << QString("colorful.bmp") << QByteArray("bmp") << QSize(320, 200) << QString(""); - QTest::newRow("images/16bpp.bmp") << QString("images/16bpp.bmp") + QTest::newRow("16bpp.bmp") << QString("16bpp.bmp") << QByteArray("bmp") << QSize(320, 240) << QString(""); - QTest::newRow("images/crash-signed-char.bmp") << QString("images/crash-signed-char.bmp") + QTest::newRow("crash-signed-char.bmp") << QString("crash-signed-char.bmp") << QByteArray("bmp") << QSize(360, 280) << QString(""); - QTest::newRow("images/4bpp-rle.bmp") << QString("images/4bpp-rle.bmp") + QTest::newRow("4bpp-rle.bmp") << QString("4bpp-rle.bmp") << QByteArray("bmp") << QSize(640, 480) << QString(""); #ifdef QTEST_HAVE_GIF - QTest::newRow("images/corrupt.gif") << QString("images/corrupt.gif") + QTest::newRow("corrupt.gif") << QString("corrupt.gif") << QByteArray("gif") << QSize(0, 0) << QString(""); - QTest::newRow("images/trolltech.gif") << QString("images/trolltech.gif") + QTest::newRow("trolltech.gif") << QString("trolltech.gif") << QByteArray("gif") << QSize(128, 64) << QString(""); - QTest::newRow("images/noclearcode.gif") << QString("images/noclearcode.gif") + QTest::newRow("noclearcode.gif") << QString("noclearcode.gif") << QByteArray("gif") << QSize(29, 18) << QString(""); - QTest::newRow("images/earth.gif") << QString("images/earth.gif") + QTest::newRow("earth.gif") << QString("earth.gif") << QByteArray("gif") << QSize(320, 200) << QString(""); - QTest::newRow("images/bat1.gif") << QString("images/bat1.gif") + QTest::newRow("bat1.gif") << QString("bat1.gif") << QByteArray("gif") << QSize(32, 32) << QString(""); - QTest::newRow("images/bat2.gif") << QString("images/bat2.gif") + QTest::newRow("bat2.gif") << QString("bat2.gif") << QByteArray("gif") << QSize(32, 32) << QString(""); #endif #ifdef QTEST_HAVE_JPEG - QTest::newRow("images/corrupt.jpg") << QString("images/corrupt.jpg") + QTest::newRow("corrupt.jpg") << QString("corrupt.jpg") << QByteArray("jpg") << QSize(0, 0) << QString("JPEG datastream contains no image"); - QTest::newRow("images/beavis.jpg") << QString("images/beavis.jpg") + QTest::newRow("beavis.jpg") << QString("beavis.jpg") << QByteArray("jpg") << QSize(350, 350) << QString(""); - QTest::newRow("images/YCbCr_cmyk.jpg") << QString("images/YCbCr_cmyk.jpg") + QTest::newRow("YCbCr_cmyk.jpg") << QString("YCbCr_cmyk.jpg") << QByteArray("jpg") << QSize(75, 50) << QString(""); - QTest::newRow("images/YCbCr_rgb.jpg") << QString("images/YCbCr_rgb.jpg") + QTest::newRow("YCbCr_rgb.jpg") << QString("YCbCr_rgb.jpg") << QByteArray("jpg") << QSize(75, 50) << QString(""); #endif #ifdef QTEST_HAVE_MNG - QTest::newRow("images/corrupt.mng") << QString("images/corrupt.mng") + QTest::newRow("corrupt.mng") << QString("corrupt.mng") << QByteArray("mng") << QSize(0, 0) << QString("MNG error 901: Application signalled I/O error; chunk IHDR; subcode 0:0"); - QTest::newRow("images/fire.mng") << QString("images/fire.mng") + QTest::newRow("fire.mng") << QString("fire.mng") << QByteArray("mng") << QSize(30, 60) << QString(""); - QTest::newRow("images/ball.mng") << QString("images/ball.mng") + QTest::newRow("ball.mng") << QString("ball.mng") << QByteArray("mng") << QSize(32, 32) << QString(""); #endif - QTest::newRow("images/image.pbm") << QString("images/image.pbm") + QTest::newRow("image.pbm") << QString("image.pbm") << QByteArray("pbm") << QSize(16, 6) << QString(""); - QTest::newRow("images/image.pgm") << QString("images/image.pgm") + QTest::newRow("image.pgm") << QString("image.pgm") << QByteArray("pgm") << QSize(24, 7) << QString(""); - QTest::newRow("images/corrupt.png") << QString("images/corrupt.png") + QTest::newRow("corrupt.png") << QString("corrupt.png") << QByteArray("png") << QSize(0, 0) << QString(""); - QTest::newRow("images/away.png") << QString("images/away.png") + QTest::newRow("away.png") << QString("away.png") << QByteArray("png") << QSize(16, 16) << QString(""); - QTest::newRow("images/image.png") << QString("images/image.png") + QTest::newRow("image.png") << QString("image.png") << QByteArray("png") << QSize(22, 22) << QString(""); - QTest::newRow("images/pngwithcompressedtext.png") << QString("images/pngwithcompressedtext.png") + QTest::newRow("pngwithcompressedtext.png") << QString("pngwithcompressedtext.png") << QByteArray("png") << QSize(32, 32) << QString(""); - QTest::newRow("images/pngwithtext.png") << QString("images/pngwithtext.png") + QTest::newRow("pngwithtext.png") << QString("pngwithtext.png") << QByteArray("png") << QSize(32, 32) << QString(""); - QTest::newRow("images/kollada.png") << QString("images/kollada.png") + QTest::newRow("kollada.png") << QString("kollada.png") << QByteArray("png") << QSize(436, 160) << QString(""); - QTest::newRow("images/black.png") << QString("images/black.png") + QTest::newRow("black.png") << QString("black.png") << QByteArray("png") << QSize(48, 48) << QString(""); - QTest::newRow("images/YCbCr_cmyk.png") << QString("images/YCbCr_cmyk.png") + QTest::newRow("YCbCr_cmyk.png") << QString("YCbCr_cmyk.png") << QByteArray("png") << QSize(75, 50) << QString(""); - QTest::newRow("images/teapot.ppm") << QString("images/teapot.ppm") + QTest::newRow("teapot.ppm") << QString("teapot.ppm") << QByteArray("ppm") << QSize(256, 256) << QString(""); - QTest::newRow("images/image.ppm") << QString("images/image.ppm") + QTest::newRow("image.ppm") << QString("image.ppm") << QByteArray("ppm") << QSize(4, 4) << QString(""); - QTest::newRow("images/runners.ppm") << QString("images/runners.ppm") + QTest::newRow("runners.ppm") << QString("runners.ppm") << QByteArray("ppm") << QSize(400, 400) << QString(""); - QTest::newRow("images/test.ppm") << QString("images/test.ppm") + QTest::newRow("test.ppm") << QString("test.ppm") << QByteArray("ppm") << QSize(10, 10) << QString(""); -// QTest::newRow("images/corrupt.xbm") << QString("images/corrupt.xbm") << QByteArray("xbm") << QSize(0, 0); - QTest::newRow("images/gnus.xbm") << QString("images/gnus.xbm") +// QTest::newRow("corrupt.xbm") << QString("corrupt.xbm") << QByteArray("xbm") << QSize(0, 0); + QTest::newRow("gnus.xbm") << QString("gnus.xbm") << QByteArray("xbm") << QSize(271, 273) << QString(""); - QTest::newRow("images/corrupt-colors.xpm") << QString("images/corrupt-colors.xpm") + QTest::newRow("corrupt-colors.xpm") << QString("corrupt-colors.xpm") << QByteArray("xpm") << QSize(0, 0) << QString("QImage: XPM color specification is missing: bla9an.n#x"); - QTest::newRow("images/corrupt-pixels.xpm") << QString("images/corrupt-pixels.xpm") + QTest::newRow("corrupt-pixels.xpm") << QString("corrupt-pixels.xpm") << QByteArray("xpm") << QSize(0, 0) << QString("QImage: XPM pixels missing on image line 3"); - QTest::newRow("images/marble.xpm") << QString("images/marble.xpm") + QTest::newRow("marble.xpm") << QString("marble.xpm") << QByteArray("xpm") << QSize(240, 240) << QString(""); - QTest::newRow("images/test.xpm") << QString("images/test.xpm") + QTest::newRow("test.xpm") << QString("test.xpm") << QByteArray("xpm") << QSize(256, 256) << QString(""); - QTest::newRow("images/black.xpm") << QString("images/black.xpm") + QTest::newRow("black.xpm") << QString("black.xpm") << QByteArray("xpm") << QSize(48, 48) << QString(""); - QTest::newRow("images/namedcolors.xpm") << QString("images/namedcolors.xpm") + QTest::newRow("namedcolors.xpm") << QString("namedcolors.xpm") << QByteArray("xpm") << QSize(8, 8) << QString(""); - QTest::newRow("images/nontransparent.xpm") << QString("images/nontransparent.xpm") + QTest::newRow("nontransparent.xpm") << QString("nontransparent.xpm") << QByteArray("xpm") << QSize(8, 8) << QString(""); - QTest::newRow("images/transparent.xpm") << QString("images/transparent.xpm") + QTest::newRow("transparent.xpm") << QString("transparent.xpm") << QByteArray("xpm") << QSize(8, 8) << QString(""); } @@ -1087,9 +1090,8 @@ void tst_QImageReader::readFromResources() QFETCH(QByteArray, format); QFETCH(QSize, size); QFETCH(QString, message); - for (int i = 0; i < 2; ++i) { - QString file = i ? (":/" + fileName) : fileName; + QString file = i ? (":/images/" + fileName) : (prefix + fileName); { // suppress warnings if we expect them if (!message.isEmpty()) { @@ -1153,7 +1155,7 @@ void tst_QImageReader::readFromResources() QTest::ignoreMessage(QtWarningMsg, message.toLatin1()); QTest::ignoreMessage(QtWarningMsg, message.toLatin1()); } - QCOMPARE(QImageReader(fileName).read(), QImageReader(":/" + fileName).read()); + QCOMPARE(QImageReader(prefix + fileName).read(), QImageReader(":/images/" + fileName).read()); } void tst_QImageReader::readCorruptImage_data() @@ -1162,25 +1164,25 @@ void tst_QImageReader::readCorruptImage_data() QTest::addColumn("shouldFail"); QTest::addColumn("message"); #if defined QTEST_HAVE_JPEG - QTest::newRow("corrupt jpeg") << QString("images/corrupt.jpg") << true + QTest::newRow("corrupt jpeg") << QString("corrupt.jpg") << true << QString("JPEG datastream contains no image"); #endif #if defined QTEST_HAVE_GIF - QTest::newRow("corrupt gif") << QString("images/corrupt.gif") << true << QString(""); + QTest::newRow("corrupt gif") << QString("corrupt.gif") << true << QString(""); #endif #ifdef QTEST_HAVE_MNG - QTest::newRow("corrupt mng") << QString("images/corrupt.mng") << true + QTest::newRow("corrupt mng") << QString("corrupt.mng") << true << QString("MNG error 901: Application signalled I/O error; chunk IHDR; subcode 0:0"); #endif - QTest::newRow("corrupt png") << QString("images/corrupt.png") << true << QString(""); - QTest::newRow("corrupt bmp") << QString("images/corrupt.bmp") << true << QString(""); - QTest::newRow("corrupt xpm (colors)") << QString("images/corrupt-colors.xpm") << true + QTest::newRow("corrupt png") << QString("corrupt.png") << true << QString(""); + QTest::newRow("corrupt bmp") << QString("corrupt.bmp") << true << QString(""); + QTest::newRow("corrupt xpm (colors)") << QString("corrupt-colors.xpm") << true << QString("QImage: XPM color specification is missing: bla9an.n#x"); - QTest::newRow("corrupt xpm (pixels)") << QString("images/corrupt-pixels.xpm") << true + QTest::newRow("corrupt xpm (pixels)") << QString("corrupt-pixels.xpm") << true << QString("QImage: XPM pixels missing on image line 3"); - QTest::newRow("corrupt xbm") << QString("images/corrupt.xbm") << false << QString(""); + QTest::newRow("corrupt xbm") << QString("corrupt.xbm") << false << QString(""); #if defined QTEST_HAVE_TIFF - QTest::newRow("corrupt tiff") << QString("images/corrupt-data.tif") << true << QString(""); + QTest::newRow("corrupt tiff") << QString("corrupt-data.tif") << true << QString(""); #endif } @@ -1189,16 +1191,17 @@ void tst_QImageReader::readCorruptImage() QFETCH(QString, fileName); QFETCH(bool, shouldFail); QFETCH(QString, message); + if (!message.isEmpty()) QTest::ignoreMessage(QtWarningMsg, message.toLatin1()); - QImageReader reader(fileName); + QImageReader reader(prefix + fileName); QVERIFY(reader.canRead()); QCOMPARE(reader.read().isNull(), shouldFail); } void tst_QImageReader::readCorruptBmp() { - QCOMPARE(QImage("images/tst7.bmp").convertToFormat(QImage::Format_ARGB32_Premultiplied), QImage("images/tst7.png").convertToFormat(QImage::Format_ARGB32_Premultiplied)); + QCOMPARE(QImage("tst7.bmp").convertToFormat(QImage::Format_ARGB32_Premultiplied), QImage("images/tst7.png").convertToFormat(QImage::Format_ARGB32_Premultiplied)); } void tst_QImageReader::supportsOption_data() @@ -1206,7 +1209,7 @@ void tst_QImageReader::supportsOption_data() QTest::addColumn("fileName"); QTest::addColumn("options"); - QTest::newRow("png") << QString("images/black.png") + QTest::newRow("png") << QString("black.png") << (QIntList() << QImageIOHandler::Gamma << QImageIOHandler::Description << QImageIOHandler::Quality @@ -1234,7 +1237,7 @@ void tst_QImageReader::supportsOption() << QImageIOHandler::Animation << QImageIOHandler::BackgroundColor; - QImageReader reader(fileName); + QImageReader reader(prefix + fileName); for (int i = 0; i < options.size(); ++i) { QVERIFY(reader.supportsOption(QImageIOHandler::ImageOption(options.at(i)))); allOptions.remove(QImageIOHandler::ImageOption(options.at(i))); @@ -1250,14 +1253,14 @@ void tst_QImageReader::tiffCompression_data() QTest::addColumn("uncompressedFile"); QTest::addColumn("compressedFile"); - QTest::newRow("TIFF: adobedeflate") << "images/rgba_nocompression_littleendian.tif" - << "images/rgba_adobedeflate_littleendian.tif"; - QTest::newRow("TIFF: lzw") << "images/rgba_nocompression_littleendian.tif" - << "images/rgba_lzw_littleendian.tif"; - QTest::newRow("TIFF: packbits") << "images/rgba_nocompression_littleendian.tif" - << "images/rgba_packbits_littleendian.tif"; - QTest::newRow("TIFF: zipdeflate") << "images/rgba_nocompression_littleendian.tif" - << "images/rgba_zipdeflate_littleendian.tif"; + QTest::newRow("TIFF: adobedeflate") << "rgba_nocompression_littleendian.tif" + << "rgba_adobedeflate_littleendian.tif"; + QTest::newRow("TIFF: lzw") << "rgba_nocompression_littleendian.tif" + << "rgba_lzw_littleendian.tif"; + QTest::newRow("TIFF: packbits") << "rgba_nocompression_littleendian.tif" + << "rgba_packbits_littleendian.tif"; + QTest::newRow("TIFF: zipdeflate") << "rgba_nocompression_littleendian.tif" + << "rgba_zipdeflate_littleendian.tif"; } void tst_QImageReader::tiffCompression() @@ -1265,16 +1268,16 @@ void tst_QImageReader::tiffCompression() QFETCH(QString, uncompressedFile); QFETCH(QString, compressedFile); - QImage uncompressedImage(uncompressedFile); - QImage compressedImage(compressedFile); + QImage uncompressedImage(prefix + uncompressedFile); + QImage compressedImage(prefix + compressedFile); QCOMPARE(uncompressedImage, compressedImage); } void tst_QImageReader::tiffEndianness() { - QImage littleEndian("images/rgba_nocompression_littleendian.tif"); - QImage bigEndian("images/rgba_nocompression_bigendian.tif"); + QImage littleEndian(prefix + "rgba_nocompression_littleendian.tif"); + QImage bigEndian(prefix + "rgba_nocompression_bigendian.tif"); QCOMPARE(littleEndian, bigEndian); } @@ -1286,8 +1289,10 @@ void tst_QImageReader::dotsPerMeter_data() QTest::addColumn("fileName"); QTest::addColumn("expectedDotsPerMeterX"); QTest::addColumn("expectedDotsPerMeterY"); - - QTest::newRow("TIFF: 72 dpi") << "images/rgba_nocompression_littleendian.tif" << qRound(72 * (100 / 2.54)) << qRound(72 * (100 / 2.54)); +#if defined QTEST_HAVE_TIFF + QTest::newRow("TIFF: 72 dpi") << ("rgba_nocompression_littleendian.tif") << qRound(72 * (100 / 2.54)) << qRound(72 * (100 / 2.54)); + QTest::newRow("TIFF: 100 dpi") << ("image_100dpi.tif") << qRound(100 * (100 / 2.54)) << qRound(100 * (100 / 2.54)); +#endif } void tst_QImageReader::dotsPerMeter() @@ -1296,7 +1301,7 @@ void tst_QImageReader::dotsPerMeter() QFETCH(int, expectedDotsPerMeterX); QFETCH(int, expectedDotsPerMeterY); - QImage image(fileName); + QImage image(prefix + fileName); QCOMPARE(image.dotsPerMeterX(), expectedDotsPerMeterX); QCOMPARE(image.dotsPerMeterY(), expectedDotsPerMeterY); @@ -1307,8 +1312,10 @@ void tst_QImageReader::physicalDpi_data() QTest::addColumn("fileName"); QTest::addColumn("expectedPhysicalDpiX"); QTest::addColumn("expectedPhysicalDpiY"); - - QTest::newRow("TIFF: 72 dpi") << "images/rgba_nocompression_littleendian.tif" << 72 << 72; +#if defined QTEST_HAVE_TIFF + QTest::newRow("TIFF: 72 dpi") << "rgba_nocompression_littleendian.tif" << 72 << 72; + QTest::newRow("TIFF: 100 dpi") << "image_100dpi.tif" << 100 << 100; +#endif } void tst_QImageReader::physicalDpi() @@ -1317,7 +1324,7 @@ void tst_QImageReader::physicalDpi() QFETCH(int, expectedPhysicalDpiX); QFETCH(int, expectedPhysicalDpiY); - QImage image(fileName); + QImage image(prefix + fileName); QCOMPARE(image.physicalDpiX(), expectedPhysicalDpiX); QCOMPARE(image.physicalDpiY(), expectedPhysicalDpiY); @@ -1328,7 +1335,7 @@ void tst_QImageReader::autoDetectImageFormat() // Assume PNG is supported :-) { // Disables file name extension probing - QImageReader reader("images/kollada"); + QImageReader reader(prefix + "kollada"); reader.setAutoDetectImageFormat(false); QVERIFY(!reader.canRead()); QVERIFY(reader.read().isNull()); @@ -1338,7 +1345,7 @@ void tst_QImageReader::autoDetectImageFormat() } { // Disables detection based on suffix - QImageReader reader("images/kollada.png"); + QImageReader reader(prefix + "kollada.png"); reader.setAutoDetectImageFormat(false); QVERIFY(!reader.canRead()); QVERIFY(reader.read().isNull()); @@ -1348,7 +1355,7 @@ void tst_QImageReader::autoDetectImageFormat() } { // Disables detection based on content - QImageReader reader("images/kollada-noext"); + QImageReader reader(prefix + "kollada-noext"); reader.setAutoDetectImageFormat(false); QVERIFY(!reader.canRead()); QVERIFY(reader.read().isNull()); diff --git a/tests/auto/qimagewriter/tst_qimagewriter.cpp b/tests/auto/qimagewriter/tst_qimagewriter.cpp index 70d9e70..349afa5 100644 --- a/tests/auto/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/qimagewriter/tst_qimagewriter.cpp @@ -165,7 +165,7 @@ tst_QImageWriter::tst_QImageWriter() tst_QImageWriter::~tst_QImageWriter() { - QDir dir(prefix + QLatin1String("images")); + QDir dir(prefix); QStringList filesToDelete = dir.entryList(QStringList() << "gen-*" , QDir::NoDotAndDotDot | QDir::Files); foreach( QString file, filesToDelete) { QFile::remove(dir.absoluteFilePath(file)); @@ -445,13 +445,13 @@ void tst_QImageWriter::supportsOption_data() QTest::addColumn("fileName"); QTest::addColumn("options"); - QTest::newRow("png") << QString(prefix + "gen-black.png") + QTest::newRow("png") << QString("gen-black.png") << (QIntList() << QImageIOHandler::Gamma << QImageIOHandler::Description << QImageIOHandler::Quality << QImageIOHandler::Size); #if defined QTEST_HAVE_TIFF - QTest::newRow("tiff") << QString("images/gen-black.tiff") + QTest::newRow("tiff") << QString("gen-black.tiff") << (QIntList() << QImageIOHandler::Size << QImageIOHandler::CompressionRatio); #endif @@ -478,7 +478,7 @@ void tst_QImageWriter::supportsOption() << QImageIOHandler::Animation << QImageIOHandler::BackgroundColor; - QImageWriter writer(fileName); + QImageWriter writer(prefix + fileName); for (int i = 0; i < options.size(); ++i) { QVERIFY(writer.supportsOption(QImageIOHandler::ImageOption(options.at(i)))); allOptions.remove(QImageIOHandler::ImageOption(options.at(i))); -- cgit v0.12 From e2d70563652a89384d13c9a1d7ac1c839a81e9be Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Wed, 20 May 2009 10:40:46 +0200 Subject: Inject some more Qt colors into the css to make it look a bit more QtSoftware Reviewed-By: Kavindra Palaraja --- tools/qdoc3/test/classic.css | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index e53ea29..8e9eb78 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -1,5 +1,5 @@ BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { - font-family: Geneva, Arial, Helvetica, sans-serif; + font-family: Arial, Geneva, Helvetica, sans-serif; } BODY,TD { font-size: 90%; @@ -20,7 +20,7 @@ h3.fn,span.fn background-color: #d5e1d5; border-width: 1px; border-style: solid; - border-color: #84b0c7; + border-color: #66bc29; font-weight: bold; -moz-border-radius: 8px 8px 8px 8px; padding: 6px 0px 6px 10px; @@ -28,7 +28,7 @@ h3.fn,span.fn a:link { - color: #004faf; + color: #0046ad; text-decoration: none } @@ -62,16 +62,6 @@ a.compat:visited text-decoration: none } -td.postheader -{ - font-family: sans-serif -} - -tr.address -{ - font-family: sans-serif -} - body { background: #ffffff; @@ -86,10 +76,10 @@ table td.memItemLeft { border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; + border-top-color: #66bc29; + border-right-color: #66bc29; + border-bottom-color: #66bc29; + border-left-color: #66bc29; border-top-style: solid; border-right-style: none; border-bottom-style: none; @@ -104,15 +94,15 @@ table td.memItemRight { border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; + border-top-color: #66bc29; + border-right-color: #66bc29; + border-bottom-color: #66bc29; + border-left-color: #66bc29; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: none; - background-color: #d5e1d5; + background-color: #FAFAFA; font-size: 80%; } -- cgit v0.12 From 4a8c7e432931b27e7a5440a6d15bde999e962f35 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Wed, 20 May 2009 11:25:32 +0200 Subject: Fix a crash where QCocoaWindow get events after its widget is dead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The invariant that QCocoaWindow's lifetime is contained in a QWidget is simply not true. A top-level QWidget gets associated with a QCocoaWindow (which is reference counted). However, it can be the case that we've destroyed our QWidget, the link is removed, the window is hidden, but the window still gets an event. In that case we would crash with an eventual null pointer access. However, we don't really need to do anything in this case, so just call super and return. Task-number: 253402 Reviewed-by: Morten Sørvig --- src/gui/kernel/qcocoapanel_mac.mm | 11 +++++++++-- src/gui/kernel/qcocoawindow_mac.mm | 13 ++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qcocoapanel_mac.mm b/src/gui/kernel/qcocoapanel_mac.mm index c69826f..b2941fe 100644 --- a/src/gui/kernel/qcocoapanel_mac.mm +++ b/src/gui/kernel/qcocoapanel_mac.mm @@ -107,9 +107,16 @@ QT_USE_NAMESPACE - (void)sendEvent:(NSEvent *)event { - [self retain]; - QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self]; + + // Cocoa can hold onto the window after we've disavowed its knowledge. So, + // if we get sent an event afterwards just have it go through the super's + // version and don't do any stuff with Qt. + if (!widget) { + [super sendEvent:event]; + return; + } + [self retain]; QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast(qt_mac_nativeview_for(widget)); Qt::MouseButton mouseButton = cocoaButton2QtButton([event buttonNumber]); diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm index 89f481f..8e62f02 100644 --- a/src/gui/kernel/qcocoawindow_mac.mm +++ b/src/gui/kernel/qcocoawindow_mac.mm @@ -128,12 +128,19 @@ QT_USE_NAMESPACE - (void)sendEvent:(NSEvent *)event { - [self retain]; - QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self]; + + // Cocoa can hold onto the window after we've disavowed its knowledge. So, + // if we get sent an event afterwards just have it go through the super's + // version and don't do any stuff with Qt. + if (!widget) { + [super sendEvent:event]; + return; + } + + [self retain]; QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast(qt_mac_nativeview_for(widget)); Qt::MouseButton mouseButton = cocoaButton2QtButton([event buttonNumber]); - // sometimes need to redirect mouse events to the popup. QWidget *popup = qAppInstance()->activePopupWidget(); if (popup && popup != widget) { -- cgit v0.12 From 691e83425ac5883922837bc5fd1efb5385db9871 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 20 May 2009 11:57:08 +0200 Subject: Add string-->enum conversion for properties and slots --- src/script/qscriptengine_p.cpp | 5 ++ src/script/qscriptenginefwd_p.h | 1 + src/script/qscriptextqobject.cpp | 33 +++++++++--- tests/auto/qscriptqobject/tst_qscriptqobject.cpp | 66 +++++++++++++++++++++++- 4 files changed, 96 insertions(+), 9 deletions(-) diff --git a/src/script/qscriptengine_p.cpp b/src/script/qscriptengine_p.cpp index a2e58de..84a420d 100644 --- a/src/script/qscriptengine_p.cpp +++ b/src/script/qscriptengine_p.cpp @@ -1662,6 +1662,11 @@ bool QScriptEnginePrivate::convert(const QScriptValueImpl &value, return false; } +QScriptEngine::DemarshalFunction QScriptEnginePrivate::demarshalFunction(int type) const +{ + return m_customTypes.value(type).demarshal; +} + QScriptValuePrivate *QScriptEnginePrivate::registerValue(const QScriptValueImpl &value) { if (value.isString()) { diff --git a/src/script/qscriptenginefwd_p.h b/src/script/qscriptenginefwd_p.h index 2ea66c5..855317c 100644 --- a/src/script/qscriptenginefwd_p.h +++ b/src/script/qscriptenginefwd_p.h @@ -350,6 +350,7 @@ public: QScriptValueImpl create(int type, const void *ptr); static bool convert(const QScriptValueImpl &value, int type, void *ptr, QScriptEnginePrivate *eng); + QScriptEngine::DemarshalFunction demarshalFunction(int type) const; QScriptValueImpl arrayFromStringList(const QStringList &lst); static QStringList stringListFromArray(const QScriptValueImpl &arr); diff --git a/src/script/qscriptextqobject.cpp b/src/script/qscriptextqobject.cpp index d18c3da..4522807 100644 --- a/src/script/qscriptextqobject.cpp +++ b/src/script/qscriptextqobject.cpp @@ -425,7 +425,7 @@ static void callQtMethod(QScriptContextPrivate *context, QMetaMethod::MethodType matchDistance += 10; } } - } else if (actual.isNumber()) { + } else if (actual.isNumber() || actual.isString()) { // see if it's an enum value QMetaEnum m; if (argType.isMetaEnum()) { @@ -436,11 +436,21 @@ static void callQtMethod(QScriptContextPrivate *context, QMetaMethod::MethodType m = meta->enumerator(mi); } if (m.isValid()) { - int ival = actual.toInt32(); - if (m.valueToKey(ival) != 0) { - qVariantSetValue(v, ival); - converted = true; - matchDistance += 10; + if (actual.isNumber()) { + int ival = actual.toInt32(); + if (m.valueToKey(ival) != 0) { + qVariantSetValue(v, ival); + converted = true; + matchDistance += 10; + } + } else { + QString sval = actual.toString(); + int ival = m.keyToValue(sval.toLatin1()); + if (ival != -1) { + qVariantSetValue(v, ival); + converted = true; + matchDistance += 10; + } } } } @@ -1809,7 +1819,16 @@ void QScript::QtPropertyFunction::execute(QScriptContextPrivate *context) } } else { // set - QVariant v = variantFromValue(eng_p, prop.userType(), context->argument(0)); + QScriptValueImpl arg = context->argument(0); + QVariant v; + if (prop.isEnumType() && arg.isString() + && !eng_p->demarshalFunction(prop.userType())) { + // give QMetaProperty::write() a chance to convert from + // string to enum value + v = arg.toString(); + } else { + v = variantFromValue(eng_p, prop.userType(), arg); + } QScriptable *scriptable = scriptableFromQObject(qobject); QScriptEngine *oldEngine = 0; diff --git a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp index 9b9dd16..1025d2a 100644 --- a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp +++ b/tests/auto/qscriptqobject/tst_qscriptqobject.cpp @@ -107,6 +107,7 @@ class MyQObject : public QObject Q_PROPERTY(int readOnlyProperty READ readOnlyProperty) Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut) Q_PROPERTY(CustomType propWithCustomType READ propWithCustomType WRITE setPropWithCustomType) + Q_PROPERTY(Policy enumProperty READ enumProperty WRITE setEnumProperty) Q_ENUMS(Policy Strategy) Q_FLAGS(Ability) @@ -144,6 +145,7 @@ public: m_hiddenValue(456.0), m_writeOnlyValue(789), m_readOnlyValue(987), + m_enumValue(BarPolicy), m_qtFunctionInvoked(-1) { } @@ -205,6 +207,11 @@ public: void setPropWithCustomType(const CustomType &c) { m_customType = c; } + Policy enumProperty() const + { return m_enumValue; } + void setEnumProperty(Policy policy) + { m_enumValue = policy; } + int qtFunctionInvoked() const { return m_qtFunctionInvoked; } @@ -255,8 +262,8 @@ public: { m_qtFunctionInvoked = 36; m_actuals << policy; } Q_INVOKABLE Policy myInvokableReturningEnum() { m_qtFunctionInvoked = 37; return BazPolicy; } - Q_INVOKABLE MyQObject::Policy myInvokableReturningQualifiedEnum() - { m_qtFunctionInvoked = 38; return BazPolicy; } + Q_INVOKABLE MyQObject::Strategy myInvokableReturningQualifiedEnum() + { m_qtFunctionInvoked = 38; return BazStrategy; } Q_INVOKABLE QVector myInvokableReturningVectorOfInt() { m_qtFunctionInvoked = 11; return QVector(); } Q_INVOKABLE void myInvokableWithVectorOfIntArg(const QVector &) @@ -410,6 +417,7 @@ protected: int m_readOnlyValue; QKeySequence m_shortcut; CustomType m_customType; + Policy m_enumValue; int m_qtFunctionInvoked; QVariantList m_actuals; QByteArray m_connectedSignal; @@ -417,6 +425,7 @@ protected: }; Q_DECLARE_METATYPE(MyQObject*) +Q_DECLARE_METATYPE(MyQObject::Policy) class MyOtherQObject : public MyQObject { @@ -530,6 +539,24 @@ static QScriptValue getSetProperty(QScriptContext *ctx, QScriptEngine *) return ctx->callee().property("value"); } +static QScriptValue policyToScriptValue(QScriptEngine *engine, const MyQObject::Policy &policy) +{ + return qScriptValueFromValue(engine, policy); +} + +static void policyFromScriptValue(const QScriptValue &value, MyQObject::Policy &policy) +{ + QString str = value.toString(); + if (str == QLatin1String("red")) + policy = MyQObject::FooPolicy; + else if (str == QLatin1String("green")) + policy = MyQObject::BarPolicy; + else if (str == QLatin1String("blue")) + policy = MyQObject::BazPolicy; + else + policy = (MyQObject::Policy)-1; +} + void tst_QScriptExtQObject::getSetStaticProperty() { QCOMPARE(m_engine->evaluate("myObject.noSuchProperty").isUndefined(), true); @@ -751,6 +778,31 @@ void tst_QScriptExtQObject::getSetStaticProperty() QScriptValue::ReadOnly); } + // enum property + QCOMPARE(m_myObject->enumProperty(), MyQObject::BarPolicy); + { + QScriptValue val = m_engine->evaluate("myObject.enumProperty"); + QVERIFY(val.isNumber()); + QCOMPARE(val.toInt32(), (int)MyQObject::BarPolicy); + } + m_engine->evaluate("myObject.enumProperty = 2"); + QCOMPARE(m_myObject->enumProperty(), MyQObject::BazPolicy); + m_engine->evaluate("myObject.enumProperty = 'BarPolicy'"); + QCOMPARE(m_myObject->enumProperty(), MyQObject::BarPolicy); + m_engine->evaluate("myObject.enumProperty = 'ScoobyDoo'"); + // ### ouch! Shouldn't QMetaProperty::write() rather not change the value...? + QCOMPARE(m_myObject->enumProperty(), (MyQObject::Policy)-1); + // enum property with custom conversion + qScriptRegisterMetaType(m_engine, policyToScriptValue, policyFromScriptValue); + m_engine->evaluate("myObject.enumProperty = 'red'"); + QCOMPARE(m_myObject->enumProperty(), MyQObject::FooPolicy); + m_engine->evaluate("myObject.enumProperty = 'green'"); + QCOMPARE(m_myObject->enumProperty(), MyQObject::BarPolicy); + m_engine->evaluate("myObject.enumProperty = 'blue'"); + QCOMPARE(m_myObject->enumProperty(), MyQObject::BazPolicy); + m_engine->evaluate("myObject.enumProperty = 'nada'"); + QCOMPARE(m_myObject->enumProperty(), (MyQObject::Policy)-1); + // auto-dereferencing of pointers { QBrush b = QColor(0xCA, 0xFE, 0xBA, 0xBE); @@ -1879,6 +1931,16 @@ void tst_QScriptExtQObject::classEnums() QCOMPARE(m_myObject->qtFunctionActuals().at(0).toInt(), int(MyQObject::BazPolicy)); m_myObject->resetQtFunctionInvoked(); + QCOMPARE(m_engine->evaluate("myObject.myInvokableWithEnumArg('BarPolicy')").isUndefined(), true); + QCOMPARE(m_myObject->qtFunctionInvoked(), 10); + QCOMPARE(m_myObject->qtFunctionActuals().size(), 1); + QCOMPARE(m_myObject->qtFunctionActuals().at(0).toInt(), int(MyQObject::BarPolicy)); + + m_myObject->resetQtFunctionInvoked(); + QVERIFY(m_engine->evaluate("myObject.myInvokableWithEnumArg('NoSuchPolicy')").isError()); + QCOMPARE(m_myObject->qtFunctionInvoked(), -1); + + m_myObject->resetQtFunctionInvoked(); QCOMPARE(m_engine->evaluate("myObject.myInvokableWithQualifiedEnumArg(MyQObject.BazPolicy)").isUndefined(), true); QCOMPARE(m_myObject->qtFunctionInvoked(), 36); QCOMPARE(m_myObject->qtFunctionActuals().size(), 1); -- cgit v0.12 From 387db114cf09e60b43b13c36c83ef8cf07ee6553 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 May 2009 11:59:54 +0200 Subject: qdoc: Moved qdoc comments from qmacstyle_mac.mm to qstyles.qdoc The .mm file is not read by qdoc for packages other than for the MAC. This problem is overcome by moving the qdoc comments from the .mm file to a .qdoc file in doc/src, because all these files are read by qdoc for each of the packages. #Task-number: 252566 --- .commit-template | 14 +-- doc/src/qstyles.qdoc | 261 ++++++++++++++++++++++++++++++++++++++++ src/gui/styles/qmacstyle_mac.mm | 158 +----------------------- 3 files changed, 273 insertions(+), 160 deletions(-) create mode 100644 doc/src/qstyles.qdoc diff --git a/.commit-template b/.commit-template index 589ca89..171b67b 100644 --- a/.commit-template +++ b/.commit-template @@ -1,10 +1,8 @@ -# ===[ Subject ]==========[ one line, please wrap at 72 characters ]===| +qdoc: Moved qdoc comments from qmacstyle_mac.mm to qstyles.qdoc -# ---[ Details ]---------[ remember extra blank line after subject ]---| +The .mm file is not read by qdoc for packages other than for the MAC. +This problem is overcome by moving the qdoc comments from the .mm file +to a .qdoc file in doc/src, because all these files are read by qdoc +for each of the packages. -# ---[ Fields ]-----------------[ uncomment and edit as applicable ]---| - -#Task-number: -#Reviewed-by: - -# ==================================[ please wrap at 72 characters ]===| +#Task-number: 252566 diff --git a/doc/src/qstyles.qdoc b/doc/src/qstyles.qdoc new file mode 100644 index 0000000..e17097a --- /dev/null +++ b/doc/src/qstyles.qdoc @@ -0,0 +1,261 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + + +/*! + \class QMacStyle + \brief The QMacStyle class provides a Mac OS X style using the Apple Appearance Manager. + + \ingroup appearance + + This class is implemented as a wrapper to the HITheme + APIs, allowing applications to be styled according to the current + theme in use on Mac OS X. This is done by having primitives + in QStyle implemented in terms of what Mac OS X would normally theme. + + \warning This style is only available on Mac OS X because it relies on the + HITheme APIs. + + There are additional issues that should be taken + into consideration to make an application compatible with the + \link http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html + Apple Human Interface Guidelines \endlink. Some of these issues are outlined + below. + + \list + + \i Layout - The restrictions on window layout are such that some + aspects of layout that are style-dependent cannot be achieved + using QLayout. Changes are being considered (and feedback would be + appreciated) to make layouts QStyle-able. Some of the restrictions + involve horizontal and vertical widget alignment and widget size + (covered below). + + \i Widget size - Mac OS X allows widgets to have specific fixed sizes. Qt + does not fully implement this behavior so as to maintain cross-platform + compatibility. As a result some widgets sizes may be inappropriate (and + subsequently not rendered correctly by the HITheme APIs).The + QWidget::sizeHint() will return the appropriate size for many + managed widgets (widgets enumerated in \l QStyle::ContentsType). + + \i Effects - QMacStyle uses HITheme for performing most of the drawing, but + also uses emulation in a few cases where HITheme does not provide the + required functionality (for example, tab bars on Panther, the toolbar + separator, etc). We tried to make the emulation as close to the original as + possible. Please report any issues you see in effects or non-standard + widgets. + + \endlist + + There are other issues that need to be considered in the feel of + your application (including the general color scheme to match the + Aqua colors). The Guidelines mentioned above will remain current + with new advances and design suggestions for Mac OS X. + + Note that the functions provided by QMacStyle are + reimplementations of QStyle functions; see QStyle for their + documentation. + + \img qmacstyle.png + \sa QWindowsXPStyle, QWindowsStyle, QPlastiqueStyle, QCDEStyle, QMotifStyle +*/ + + +/*! + \enum QMacStyle::WidgetSizePolicy + + \value SizeSmall + \value SizeLarge + \value SizeMini + \value SizeDefault + \omitvalue SizeNone +*/ + +/*! \fn QMacStyle::QMacStyle() + Constructs a QMacStyle object. +*/ + +/*! \fn QMacStyle::~QMacStyle() + Destructs a QMacStyle object. +*/ + +/*! \fn void QMacStyle::polish(QPalette &pal) + \reimp +*/ + +/*! \fn void QMacStyle::polish(QApplication *) + \reimp +*/ + +/*! \fn void QMacStyle::unpolish(QApplication *) + \reimp +*/ + +/*! \fn void QMacStyle::polish(QWidget* w) + \reimp +*/ + +/*! \fn void QMacStyle::unpolish(QWidget* w) + \reimp +*/ + +/*! \fn int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *widget) const + \reimp +*/ + +/*! \fn QPalette QMacStyle::standardPalette() const + \reimp +*/ + +/*! \fn int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *hret) const + \reimp +*/ + +/*! \fn QPixmap QMacStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const + \reimp +*/ + +/*! \fn QPixmap QMacStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const + \reimp +*/ + +/*! + \enum QMacStyle::FocusRectPolicy + + This type is used to signify a widget's focus rectangle policy. + + \value FocusEnabled show a focus rectangle when the widget has focus. + \value FocusDisabled never show a focus rectangle for the widget. + \value FocusDefault show a focus rectangle when the widget has + focus and the widget is a QSpinWidget, QDateTimeEdit, QLineEdit, + QListBox, QListView, editable QTextEdit, or one of their + subclasses. +*/ + +/*! \fn void QMacStyle::setFocusRectPolicy(QWidget *w, FocusRectPolicy policy) + \obsolete + Sets the focus rectangle policy of \a w. The \a policy can be one of + \l{QMacStyle::FocusRectPolicy}. + + This is now simply an interface to the Qt::WA_MacShowFocusRect attribute and the + FocusDefault value does nothing anymore. If you want to set a widget back + to its default value, you must save the old value of the attribute before + you change it. + + \sa focusRectPolicy() QWidget::setAttribute() +*/ + +/*! \fn QMacStyle::FocusRectPolicy QMacStyle::focusRectPolicy(const QWidget *w) + \obsolete + Returns the focus rectangle policy for the widget \a w. + + The focus rectangle policy can be one of \l{QMacStyle::FocusRectPolicy}. + + In 4.3 and up this function will simply test for the + Qt::WA_MacShowFocusRect attribute and will never return + QMacStyle::FocusDefault. + + \sa setFocusRectPolicy(), QWidget::testAttribute() +*/ + +/*! \fn void QMacStyle::setWidgetSizePolicy(const QWidget *widget, WidgetSizePolicy policy) + + \obsolete + + Call QWidget::setAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize, + or Qt::WA_MacNormalSize instead. +*/ + +/*! \fn QMacStyle::WidgetSizePolicy QMacStyle::widgetSizePolicy(const QWidget *widget) + \obsolete + + Call QWidget::testAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize, + or Qt::WA_MacNormalSize instead. +*/ + +/*! \fn void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const + + \reimp +*/ + +/*! \fn void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p, const QWidget *w) const + + \reimp +*/ + +/*! \fn QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *widget) const + + \reimp +*/ + +/*! \fn void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const + \reimp +*/ + +/*! \fn QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget) const + \reimp +*/ + +/*! \fn QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const + \reimp +*/ + +/*! \fn QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &csz, const QWidget *widget) const + \reimp +*/ + +/*! \fn void QMacStyle::drawItemText(QPainter *p, const QRect &r, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole) const + \reimp +*/ + +/*! \fn bool QMacStyle::event(QEvent *e) + \reimp +*/ + +/*! \fn QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt, const QWidget *widget) const + \internal +*/ + +/*! \fn int QMacStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const + + \internal +*/ + diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 7a870fe..2e47526 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -39,6 +39,11 @@ ** ****************************************************************************/ +/*! + Note: The qdoc comments for QMacStyle are contained in + .../doc/src/qstyles.qdoc. +*/ + #include "qmacstyle_mac.h" #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) @@ -1988,87 +1993,12 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD p->drawPixmap(int(macRect.origin.x), int(macRect.origin.y) + finalyoff, width, height, pm); } -/*! - \class QMacStyle - \brief The QMacStyle class provides a Mac OS X style using the Apple Appearance Manager. - - \ingroup appearance - - This class is implemented as a wrapper to the HITheme - APIs, allowing applications to be styled according to the current - theme in use on Mac OS X. This is done by having primitives - in QStyle implemented in terms of what Mac OS X would normally theme. - - \warning This style is only available on Mac OS X because it relies on the - HITheme APIs. - - There are additional issues that should be taken - into consideration to make an application compatible with the - \link http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html - Apple Human Interface Guidelines \endlink. Some of these issues are outlined - below. - - \list - - \i Layout - The restrictions on window layout are such that some - aspects of layout that are style-dependent cannot be achieved - using QLayout. Changes are being considered (and feedback would be - appreciated) to make layouts QStyle-able. Some of the restrictions - involve horizontal and vertical widget alignment and widget size - (covered below). - - \i Widget size - Mac OS X allows widgets to have specific fixed sizes. Qt - does not fully implement this behavior so as to maintain cross-platform - compatibility. As a result some widgets sizes may be inappropriate (and - subsequently not rendered correctly by the HITheme APIs).The - QWidget::sizeHint() will return the appropriate size for many - managed widgets (widgets enumerated in \l QStyle::ContentsType). - - \i Effects - QMacStyle uses HITheme for performing most of the drawing, but - also uses emulation in a few cases where HITheme does not provide the - required functionality (for example, tab bars on Panther, the toolbar - separator, etc). We tried to make the emulation as close to the original as - possible. Please report any issues you see in effects or non-standard - widgets. - - \endlist - - There are other issues that need to be considered in the feel of - your application (including the general color scheme to match the - Aqua colors). The Guidelines mentioned above will remain current - with new advances and design suggestions for Mac OS X. - - Note that the functions provided by QMacStyle are - reimplementations of QStyle functions; see QStyle for their - documentation. - - \img qmacstyle.png - \sa QWindowsXPStyle, QWindowsStyle, QPlastiqueStyle, QCDEStyle, QMotifStyle -*/ - - -/*! - \enum QMacStyle::WidgetSizePolicy - - \value SizeSmall - \value SizeLarge - \value SizeMini - \value SizeDefault - \omitvalue SizeNone -*/ - -/*! - Constructs a QMacStyle object. -*/ QMacStyle::QMacStyle() : QWindowsStyle() { d = new QMacStylePrivate(this); } -/*! - Destructs a QMacStyle object. -*/ QMacStyle::~QMacStyle() { delete qt_mac_backgroundPattern; @@ -2142,7 +2072,6 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint } } -/*! \reimp */ void QMacStyle::polish(QPalette &pal) { if (!qt_mac_backgroundPattern) { @@ -2166,17 +2095,14 @@ void QMacStyle::polish(QPalette &pal) } } -/*! \reimp */ void QMacStyle::polish(QApplication *) { } -/*! \reimp */ void QMacStyle::unpolish(QApplication *) { } -/*! \reimp */ void QMacStyle::polish(QWidget* w) { d->addWidget(w); @@ -2240,7 +2166,6 @@ void QMacStyle::polish(QWidget* w) } } -/*! \reimp */ void QMacStyle::unpolish(QWidget* w) { d->removeWidget(w); @@ -2271,7 +2196,6 @@ void QMacStyle::unpolish(QWidget* w) QWindowsStyle::unpolish(w); } -/*! \reimp */ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *widget) const { int controlSize = getControlSize(opt, widget); @@ -2650,7 +2574,6 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW return ret; } -/*! \reimp */ QPalette QMacStyle::standardPalette() const { QPalette pal = QWindowsStyle::standardPalette(); @@ -2660,7 +2583,6 @@ QPalette QMacStyle::standardPalette() const return pal; } -/*! \reimp */ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *hret) const { @@ -2955,7 +2877,6 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w return ret; } -/*! \reimp */ QPixmap QMacStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const { @@ -2981,7 +2902,6 @@ QPixmap QMacStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixm } -/*! \reimp */ QPixmap QMacStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const { @@ -3012,31 +2932,7 @@ QPixmap QMacStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOpt } return icon.pixmap(size, size); } -/*! - \enum QMacStyle::FocusRectPolicy - - This type is used to signify a widget's focus rectangle policy. - - \value FocusEnabled show a focus rectangle when the widget has focus. - \value FocusDisabled never show a focus rectangle for the widget. - \value FocusDefault show a focus rectangle when the widget has - focus and the widget is a QSpinWidget, QDateTimeEdit, QLineEdit, - QListBox, QListView, editable QTextEdit, or one of their - subclasses. -*/ - -/*! - \obsolete - Sets the focus rectangle policy of \a w. The \a policy can be one of - \l{QMacStyle::FocusRectPolicy}. - - This is now simply an interface to the Qt::WA_MacShowFocusRect attribute and the - FocusDefault value does nothing anymore. If you want to set a widget back - to its default value, you must save the old value of the attribute before - you change it. - \sa focusRectPolicy() QWidget::setAttribute() -*/ void QMacStyle::setFocusRectPolicy(QWidget *w, FocusRectPolicy policy) { switch (policy) { @@ -3049,29 +2945,11 @@ void QMacStyle::setFocusRectPolicy(QWidget *w, FocusRectPolicy policy) } } -/*! - \obsolete - Returns the focus rectangle policy for the widget \a w. - - The focus rectangle policy can be one of \l{QMacStyle::FocusRectPolicy}. - - In 4.3 and up this function will simply test for the - Qt::WA_MacShowFocusRect attribute and will never return - QMacStyle::FocusDefault. - - \sa setFocusRectPolicy(), QWidget::testAttribute() -*/ QMacStyle::FocusRectPolicy QMacStyle::focusRectPolicy(const QWidget *w) { return w->testAttribute(Qt::WA_MacShowFocusRect) ? FocusEnabled : FocusDisabled; } -/*! - \obsolete - - Call QWidget::setAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize, - or Qt::WA_MacNormalSize instead. -*/ void QMacStyle::setWidgetSizePolicy(const QWidget *widget, WidgetSizePolicy policy) { QWidget *wadget = const_cast(widget); @@ -3080,12 +2958,6 @@ void QMacStyle::setWidgetSizePolicy(const QWidget *widget, WidgetSizePolicy poli wadget->setAttribute(Qt::WA_MacMiniSize, policy == SizeMini); } -/*! - \obsolete - - Call QWidget::testAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize, - or Qt::WA_MacNormalSize instead. -*/ QMacStyle::WidgetSizePolicy QMacStyle::widgetSizePolicy(const QWidget *widget) { while (widget) { @@ -3101,7 +2973,6 @@ QMacStyle::WidgetSizePolicy QMacStyle::widgetSizePolicy(const QWidget *widget) return SizeDefault; } -/*! \reimp */ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const { @@ -3534,7 +3405,6 @@ static inline QPixmap darkenPixmap(const QPixmap &pixmap) -/*! \reimp */ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p, const QWidget *w) const { @@ -4558,7 +4428,7 @@ static void setLayoutItemMargins(int left, int top, int right, int bottom, QRect rect->adjust(left, top, right, bottom); } } -/*! \reimp */ + QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *widget) const { @@ -4852,7 +4722,6 @@ static inline void drawToolbarButtonArrow(const QRect &toolButtonRect, ThemeDraw HIThemeDrawPopupArrow(&hirect, &padi, cg, kHIThemeOrientationNormal); } -/*! \reimp */ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const { @@ -5349,7 +5218,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex } } -/*! \reimp */ QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget) const @@ -5480,7 +5348,6 @@ QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc, return sc; } -/*! \reimp */ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const { @@ -5820,7 +5687,6 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op return ret; } -/*! \reimp */ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &csz, const QWidget *widget) const { @@ -6107,9 +5973,6 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, return sz; } -/*! - \reimp -*/ void QMacStyle::drawItemText(QPainter *p, const QRect &r, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole) const { @@ -6118,9 +5981,6 @@ void QMacStyle::drawItemText(QPainter *p, const QRect &r, int flags, const QPale QWindowsStyle::drawItemText(p, r, flags, pal, enabled, text, textRole); } -/*! - \reimp -*/ bool QMacStyle::event(QEvent *e) { if(e->type() == QEvent::FocusIn) { @@ -6195,9 +6055,6 @@ void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayI } } -/*! - \internal -*/ QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt, const QWidget *widget) const { @@ -6311,9 +6168,6 @@ QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const Q return QWindowsStyle::standardIconImplementation(standardIcon, opt, widget); } -/*! - \internal -*/ int QMacStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, -- cgit v0.12 From a9722dffb48559c27f2f4cd99ebc082f717a9e60 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 20 May 2009 11:57:52 +0200 Subject: make QSslSocket test work also for shadow builds ... by being able to load the certificates also in a shadow build directory Reviewed-by: Thiago --- tests/auto/qsslsocket/qsslsocket.pro | 6 ++++++ tests/auto/qsslsocket/tst_qsslsocket.cpp | 30 +++++++++++++++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/tests/auto/qsslsocket/qsslsocket.pro b/tests/auto/qsslsocket/qsslsocket.pro index 147b40d..c29fc68 100644 --- a/tests/auto/qsslsocket/qsslsocket.pro +++ b/tests/auto/qsslsocket/qsslsocket.pro @@ -7,6 +7,12 @@ QT -= gui TARGET = tst_qsslsocket +!wince* { +DEFINES += SRCDIR=\\\"$$PWD/\\\" +} else { +DEFINES += SRCDIR=\\\"./\\\" +} + win32 { CONFIG(debug, debug|release) { DESTDIR = debug diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 5c99164..0aa93fe 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -577,7 +577,7 @@ void tst_QSslSocket::connectToHostEncrypted() QSslSocketPtr socket = newSocket(); this->socket = socket; - socket->addCaCertificates(QLatin1String("certs/qt-test-server-cacert.pem")); + QVERIFY(socket->addCaCertificates(QLatin1String(SRCDIR "certs/qt-test-server-cacert.pem"))); #ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND connect(&socket, SIGNAL(sslErrors(QList)), this, SLOT(untrustedWorkaroundSlot(QList))); @@ -648,7 +648,7 @@ void tst_QSslSocket::peerCertificateChain() QSslSocketPtr socket = newSocket(); this->socket = socket; - QList caCertificates = QSslCertificate::fromPath(QLatin1String("certs/qt-test-server-cacert.pem")); + QList caCertificates = QSslCertificate::fromPath(QLatin1String(SRCDIR "certs/qt-test-server-cacert.pem")); QVERIFY(caCertificates.count() == 1); socket->addCaCertificates(caCertificates); @@ -709,7 +709,7 @@ void tst_QSslSocket::protocol() QSslSocketPtr socket = newSocket(); this->socket = socket; - QList certs = QSslCertificate::fromPath("certs/qt-test-server-cacert.pem"); + QList certs = QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem"); // qDebug() << "certs:" << certs.at(0).issuerInfo(QSslCertificate::CommonName); socket->setCaCertificates(certs); @@ -792,7 +792,7 @@ void tst_QSslSocket::setCaCertificates() QSslSocket socket; QCOMPARE(socket.caCertificates(), QSslSocket::defaultCaCertificates()); - socket.setCaCertificates(QSslCertificate::fromPath("certs/qt-test-server-cacert.pem")); + socket.setCaCertificates(QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem")); QCOMPARE(socket.caCertificates().size(), 1); socket.setCaCertificates(socket.defaultCaCertificates()); QCOMPARE(socket.caCertificates(), QSslSocket::defaultCaCertificates()); @@ -823,13 +823,13 @@ protected: socket = new QSslSocket(this); connect(socket, SIGNAL(sslErrors(const QList &)), this, SLOT(ignoreErrorSlot())); - QFile file("certs/fluke.key"); + QFile file(SRCDIR "certs/fluke.key"); QVERIFY(file.open(QIODevice::ReadOnly)); QSslKey key(file.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey); QVERIFY(!key.isNull()); socket->setPrivateKey(key); - QList localCert = QSslCertificate::fromPath("certs/fluke.cert"); + QList localCert = QSslCertificate::fromPath(SRCDIR "certs/fluke.cert"); QVERIFY(!localCert.isEmpty()); QVERIFY(localCert.first().handle()); socket->setLocalCertificate(localCert.first()); @@ -930,7 +930,7 @@ void tst_QSslSocket::addDefaultCaCertificate() // Reset the global CA chain QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates()); - QList flukeCerts = QSslCertificate::fromPath("certs/qt-test-server-cacert.pem"); + QList flukeCerts = QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem"); QCOMPARE(flukeCerts.size(), 1); QList globalCerts = QSslSocket::defaultCaCertificates(); QVERIFY(!globalCerts.contains(flukeCerts.first())); @@ -1014,7 +1014,7 @@ void tst_QSslSocket::wildcard() // responds with the wildcard, and QSslSocket should accept that as a // valid connection. This was broken in 4.3.0. QSslSocketPtr socket = newSocket(); - socket->addCaCertificates(QLatin1String("certs/qt-test-server-cacert.pem")); + socket->addCaCertificates(QLatin1String(SRCDIR "certs/qt-test-server-cacert.pem")); this->socket = socket; #ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND connect(socket, SIGNAL(sslErrors(QList)), @@ -1040,7 +1040,7 @@ protected: socket->ignoreSslErrors(); // Only set the certificate - QList localCert = QSslCertificate::fromPath("certs/fluke.cert"); + QList localCert = QSslCertificate::fromPath(SRCDIR "certs/fluke.cert"); QVERIFY(!localCert.isEmpty()); QVERIFY(localCert.first().handle()); socket->setLocalCertificate(localCert.first()); @@ -1199,13 +1199,13 @@ protected: socket = new QSslSocket(this); connect(socket, SIGNAL(sslErrors(const QList &)), this, SLOT(ignoreErrorSlot())); - QFile file("certs/fluke.key"); + QFile file(SRCDIR "certs/fluke.key"); QVERIFY(file.open(QIODevice::ReadOnly)); QSslKey key(file.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey); QVERIFY(!key.isNull()); socket->setPrivateKey(key); - QList localCert = QSslCertificate::fromPath("certs/fluke.cert"); + QList localCert = QSslCertificate::fromPath(SRCDIR "certs/fluke.cert"); QVERIFY(!localCert.isEmpty()); QVERIFY(localCert.first().handle()); socket->setLocalCertificate(localCert.first()); @@ -1363,8 +1363,8 @@ protected: { socket = new QSslSocket(this); - socket->setPrivateKey("certs/fluke.key"); - socket->setLocalCertificate("certs/fluke.cert"); + socket->setPrivateKey(SRCDIR "certs/fluke.key"); + socket->setLocalCertificate(SRCDIR "certs/fluke.cert"); socket->setSocketDescriptor(socketDescriptor); socket->startServerEncryption(); } @@ -1487,7 +1487,7 @@ void tst_QSslSocket::resetProxy() // make sure the connection works, and then set a nonsense proxy, and then // make sure it does not work anymore QSslSocket socket; - socket.addCaCertificates(QLatin1String("certs/qt-test-server-cacert.pem")); + socket.addCaCertificates(QLatin1String(SRCDIR "certs/qt-test-server-cacert.pem")); socket.setProxy(goodProxy); socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); QVERIFY2(socket.waitForConnected(10000), qPrintable(socket.errorString())); @@ -1500,7 +1500,7 @@ void tst_QSslSocket::resetProxy() // set the nonsense proxy and make sure the connection does not work, // and then set the right proxy and make sure it works QSslSocket socket2; - socket2.addCaCertificates(QLatin1String("certs/qt-test-server-cacert.pem")); + socket2.addCaCertificates(QLatin1String(SRCDIR "certs/qt-test-server-cacert.pem")); socket2.setProxy(badProxy); socket2.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); QVERIFY(! socket2.waitForConnected(10000)); -- cgit v0.12 From c02f3b1934a4ab300f593b91ee9fd302207a96f5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 May 2009 12:04:37 +0200 Subject: qdoc: I overwrote the commit template. --- .commit-template | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.commit-template b/.commit-template index 171b67b..589ca89 100644 --- a/.commit-template +++ b/.commit-template @@ -1,8 +1,10 @@ -qdoc: Moved qdoc comments from qmacstyle_mac.mm to qstyles.qdoc +# ===[ Subject ]==========[ one line, please wrap at 72 characters ]===| -The .mm file is not read by qdoc for packages other than for the MAC. -This problem is overcome by moving the qdoc comments from the .mm file -to a .qdoc file in doc/src, because all these files are read by qdoc -for each of the packages. +# ---[ Details ]---------[ remember extra blank line after subject ]---| -#Task-number: 252566 +# ---[ Fields ]-----------------[ uncomment and edit as applicable ]---| + +#Task-number: +#Reviewed-by: + +# ==================================[ please wrap at 72 characters ]===| -- cgit v0.12 From b28e95cd2fbdd0f8ad5030e6fc3beede057548da Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Wed, 20 May 2009 12:16:11 +0200 Subject: Remove bad documentation about window modality and QMessageBox. QMessageBox is like QDialog. It doesn't have any extra magic with window modality on creation, so don't advertise that it does. The note about using message boxes as sheets is also updated. --- src/gui/dialogs/qmessagebox.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index 5e59501..fb3bcb8 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -706,15 +706,10 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button) Constructs a message box with no text and no buttons. \a parent is passed to the QDialog constructor. - If \a parent is 0, the message box is an \l{Qt::ApplicationModal} - {application modal} dialog box. If \a parent is a widget, the - message box is \l{Qt::WindowModal} {window modal} relative to \a - parent. - - On Mac OS X, if \a parent is not 0 and you want your message box - to appear as a Qt::Sheet of that parent, set the message box's - \l{setWindowModality()} {window modality} to Qt::WindowModal - (default). Otherwise, the message box will be a standard dialog. + On Mac OS X, if you want your message box to appear + as a Qt::Sheet of its \a parent, set the message box's + \l{setWindowModality()} {window modality} to Qt::WindowModal or use open(). + Otherwise, the message box will be a standard dialog. */ QMessageBox::QMessageBox(QWidget *parent) -- cgit v0.12 From b7e01ff7d994d704cbcd876a77bf32cbdf66c17b Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 20 May 2009 12:45:11 +0200 Subject: Revert focus apparance on itemviews for X11 We changed this primarily for the mac as active appearance on widgets in itemviews should depend on the window activation state and not on the focus widget. It was explicitly added back for windows only but has been reported as a bug on X11 as well so we might as well keep it mac-only for now. Reviewed-by: mortens --- src/gui/itemviews/qabstractitemview.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 7a3d674..c77395a 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -3220,9 +3220,9 @@ QStyleOptionViewItem QAbstractItemView::viewOptions() const option.state &= ~QStyle::State_MouseOver; option.font = font(); -#ifdef Q_WS_WIN - // Note this is currently required on Windows - // do give non-focused item views inactive appearance +#ifndef Q_WS_MAC + // On mac the focus appearance follows window activation + // not widget activation if (!hasFocus()) option.state &= ~QStyle::State_Active; #endif -- cgit v0.12 From 25f86fbab2e7d23832b0bb8ae8530289258e2aa5 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 20 May 2009 12:59:41 +0200 Subject: Silence warning by MSVC. Reviewed-By: TrustMe --- src/xmlpatterns/expr/qpath.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xmlpatterns/expr/qpath.cpp b/src/xmlpatterns/expr/qpath.cpp index 33bfa0f..a60f622 100644 --- a/src/xmlpatterns/expr/qpath.cpp +++ b/src/xmlpatterns/expr/qpath.cpp @@ -170,7 +170,7 @@ Expression::Ptr Path::compress(const StaticContext::Ptr &context) /* We do this as late as we can, such that we pick up the most recent type * from the operand. */ - if(m_isLast && !m_kind == XSLTForEach && m_operand2->staticType()->itemType() == BuiltinTypes::item) + if(m_isLast && m_kind != XSLTForEach && m_operand2->staticType()->itemType() == BuiltinTypes::item) m_checkXPTY0018 = true; return me; -- cgit v0.12 From fdefbb820f1ebf9fbde0f683ea6d05923e8c04e4 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 20 May 2009 13:25:27 +0200 Subject: QComboBox: style change event should not resets custom item delegates Regression from 4.4 introduced while fixing task 167106 Autotest: tst_QComboBox::task253944_itemDelegateIsReset() Task-number: 253944 Reviewed-by: jbache --- src/gui/widgets/qcombobox.cpp | 22 ++++++++++++++++------ src/gui/widgets/qcombobox_p.h | 6 +++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 09a51fe..a5a98d4 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -947,7 +947,7 @@ QComboBoxPrivateContainer* QComboBoxPrivate::viewContainer() container = new QComboBoxPrivateContainer(new QComboBoxListView(q), q); container->itemView()->setModel(model); container->itemView()->setTextElideMode(Qt::ElideMiddle); - updateDelegate(); + updateDelegate(true); updateLayoutDirection(); QObject::connect(container, SIGNAL(itemSelected(QModelIndex)), q, SLOT(_q_itemSelected(QModelIndex))); @@ -1567,15 +1567,25 @@ bool QComboBox::isEditable() const return d->lineEdit != 0; } -void QComboBoxPrivate::updateDelegate() +/*! \internal + update the default delegate + depending on the style's SH_ComboBox_Popup hint, we use a different default delegate. + + but we do not change the delegate is the combobox use a custom delegate, + unless \a force is set to true. + */ +void QComboBoxPrivate::updateDelegate(bool force) { Q_Q(QComboBox); QStyleOptionComboBox opt; q->initStyleOption(&opt); - if (q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)) - q->setItemDelegate(new QComboMenuDelegate(q->view(), q)); - else - q->setItemDelegate(new QComboBoxDelegate(q->view(), q)); + if (q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)) { + if (force || qobject_cast(q->itemDelegate())) + q->setItemDelegate(new QComboMenuDelegate(q->view(), q)); + } else { + if (force || qobject_cast(q->itemDelegate())) + q->setItemDelegate(new QComboBoxDelegate(q->view(), q)); + } } QIcon QComboBoxPrivate::itemIcon(const QModelIndex &index) const diff --git a/src/gui/widgets/qcombobox_p.h b/src/gui/widgets/qcombobox_p.h index c39a231..a55b439 100644 --- a/src/gui/widgets/qcombobox_p.h +++ b/src/gui/widgets/qcombobox_p.h @@ -256,7 +256,7 @@ private: }; class QComboMenuDelegate : public QAbstractItemDelegate -{ +{ Q_OBJECT public: QComboMenuDelegate(QObject *parent, QComboBox *cmb) : QAbstractItemDelegate(parent), mCombo(cmb) {} @@ -285,7 +285,7 @@ private: // Vista does not use the new theme for combo boxes and there might // be other side effects from using the new class class QComboBoxDelegate : public QItemDelegate -{ +{ Q_OBJECT public: QComboBoxDelegate(QObject *parent, QComboBox *cmb) : QItemDelegate(parent), mCombo(cmb) {} @@ -367,7 +367,7 @@ public: int itemRole() const; void updateLayoutDirection(); void setCurrentIndex(const QModelIndex &index); - void updateDelegate(); + void updateDelegate(bool force = false); void keyboardSearchString(const QString &text); void modelChanged(); -- cgit v0.12 From 675c41f92fa72753fea364b73639fd9e0c7cc0d5 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 20 May 2009 14:14:22 +0200 Subject: Doc: Fixed the paper sizes again. Task-number: 254179 Reviewed-by: Norwegian Rock Cat --- src/gui/painting/qprinter.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index 5090b3a..ed72077 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -480,26 +480,26 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value A7 74 x 105 mm \value A8 52 x 74 mm \value A9 37 x 52 mm - \value B0 1030 x 1456 mm - \value B1 728 x 1030 mm - \value B10 32 x 45 mm - \value B2 515 x 728 mm - \value B3 364 x 515 mm - \value B4 257 x 364 mm - \value B5 182 x 257 mm, 7.17 x 10.13 inches - \value B6 128 x 182 mm - \value B7 91 x 128 mm - \value B8 64 x 91 mm - \value B9 45 x 64 mm + \value B0 1000 x 1414 mm + \value B1 707 x 1000 mm + \value B2 500 x 707 mm + \value B3 353 x 500 mm + \value B4 250 x 353 mm + \value B5 176 x 250 mm, 6.93 x 9.84 inches + \value B6 125 x 176 mm + \value B7 88 x 125 mm + \value B8 62 x 88 mm + \value B9 33 x 62 mm + \value B10 31 x 44 mm \value C5E 163 x 229 mm \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope \value DLE 110 x 220 mm - \value Executive 7.5 x 10 inches, 191 x 254 mm + \value Executive 7.5 x 10 inches, 190.5 x 254 mm \value Folio 210 x 330 mm - \value Ledger 432 x 279 mm - \value Legal 8.5 x 14 inches, 216 x 356 mm - \value Letter 8.5 x 11 inches, 216 x 279 mm - \value Tabloid 279 x 432 mm + \value Ledger 431.8 x 279.4 mm + \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm + \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm + \value Tabloid 279.4 x 431.8 mm \value Custom Unknown, or a user defined size. With setFullPage(false) (the default), the metrics will be a bit -- cgit v0.12 From fc6e0155cc3fa9beb3b48704a1effe87a74c2779 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 20 May 2009 14:23:47 +0200 Subject: Doc: First attempt at a simpler widgets tutorial. Task-number: 253710 Reviewed-by: Trust Me --- doc/src/snippets/widgets-tutorial/template.cpp | 14 +++ doc/src/tutorials/widgets-tutorial.qdoc | 132 +++++++++++++++++++-- .../tutorials/widgets/childwidget/childwidget.pro | 7 ++ examples/tutorials/widgets/childwidget/main.cpp | 60 ++++++++++ examples/tutorials/widgets/nestedlayouts/main.cpp | 100 ++++++++++++++++ .../widgets/nestedlayouts/nestedlayouts.pro | 7 ++ examples/tutorials/widgets/toplevel/main.cpp | 56 +++++++++ examples/tutorials/widgets/toplevel/toplevel.pro | 7 ++ examples/tutorials/widgets/widgets.pro | 8 ++ examples/tutorials/widgets/windowlayout/main.cpp | 62 ++++++++++ .../widgets/windowlayout/windowlayout.pro | 7 ++ 11 files changed, 449 insertions(+), 11 deletions(-) create mode 100644 doc/src/snippets/widgets-tutorial/template.cpp create mode 100644 examples/tutorials/widgets/childwidget/childwidget.pro create mode 100644 examples/tutorials/widgets/childwidget/main.cpp create mode 100644 examples/tutorials/widgets/nestedlayouts/main.cpp create mode 100644 examples/tutorials/widgets/nestedlayouts/nestedlayouts.pro create mode 100644 examples/tutorials/widgets/toplevel/main.cpp create mode 100644 examples/tutorials/widgets/toplevel/toplevel.pro create mode 100644 examples/tutorials/widgets/widgets.pro create mode 100644 examples/tutorials/widgets/windowlayout/main.cpp create mode 100644 examples/tutorials/widgets/windowlayout/windowlayout.pro diff --git a/doc/src/snippets/widgets-tutorial/template.cpp b/doc/src/snippets/widgets-tutorial/template.cpp new file mode 100644 index 0000000..5958676 --- /dev/null +++ b/doc/src/snippets/widgets-tutorial/template.cpp @@ -0,0 +1,14 @@ +#include + +// Include header files for application components. +// ... + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + // Set up and show widgets. + // ... + + return app.exec(); +} diff --git a/doc/src/tutorials/widgets-tutorial.qdoc b/doc/src/tutorials/widgets-tutorial.qdoc index ead44af..1e89431 100644 --- a/doc/src/tutorials/widgets-tutorial.qdoc +++ b/doc/src/tutorials/widgets-tutorial.qdoc @@ -41,11 +41,14 @@ /*! \page widgets-tutorial.html + \startpage {index.html}{Qt Reference Documentation} + \nextpage {tutorials/widgets/toplevel}{Creating a Window} \title Widgets Tutorial \ingroup tutorials - \brief This tutorial covers basic usage of widgets and layouts, showing how they are used to build GUI applications. + \brief This tutorial covers basic usage of widgets and layouts, showing how + they are used to build GUI applications. \section1 Introduction @@ -68,7 +71,60 @@ occupied by its parent. This means that, when a window is deleted, all the widgets it contains are automatically deleted. - \section1 Creating a Window + \section1 Writing a main Function + + Many of the GUI examples in Qt follow the pattern of having a \c{main.cpp} + file containing code to initialize the application, and a number of other + source and header files containing the application logic and custom GUI + components. + + A typical \c main() function, written in \c{main.cpp}, looks like this: + + \quotefile doc/src/snippets/widgets-tutorial/template.cpp + + We first construct a QApplication object which is configured using any + arguments passed in from the command line. After any widgets have been + created and shown, we call QApplication::exec() to start Qt's event loop. + Control passes to Qt until this function returns, at which point we return + the value we obtain from this function. + + In each part of this tutorial, we provide an example that is written + entirely within a \c main() function. In more sophisticated examples, the + code to set up widgets and layouts is written in other parts of the + example. For example, the GUI for a main window may be set up in the + constructor of a QMainWindow subclass. + + The \l{Qt Examples#Widgets}{Widgets examples} are a good place to look for + more complex and complete examples and applications. + + \section1 Building Examples and Tutorials + + If you obtained a binary package of Qt or compiled it yourself, the + examples described in this tutorial should already be ready to run. + However, if you may wish to modify them and recompile them, you need to + perform the following steps: + + \list 1 + \o At the command line, enter the directory containing the example you + wish to recompile. + \o Type \c qmake and press \key{Return}. If this doesn't work, make sure + that the executable is on your path, or enter its full location. + \o On Linux/Unix and Mac OS X, type \c make and press \key{Return}; + on Windows with Visual Studio, type \c nmake and press \key{Return}. + \endlist + + An executable file should have been created within the current directory. + On Windows, this file may be located within a \c debug or \c release + subdirectory. You can run this file to see the example code at work. +*/ + +/*! + \page widgets-tutorial-toplevel.html + \contentspage {Widgets Tutorial}{Contents} + \previouspage {Widgets Tutorial} + \nextpage {Widgets Tutorial - Child Widgets} + \example tutorials/widgets/toplevel + \title Widgets Tutorial - Creating a Window If a widget is created without a parent, it is treated as a window, or \e{top-level widget}, when it is shown. Since it has no parent object to @@ -82,7 +138,7 @@
    \endraw - \snippet snippets/widgets-tutorial/toplevel/main.cpp create, resize and show + \snippet tutorials/widgets/toplevel/main.cpp main program \raw HTML \endraw @@ -92,15 +148,28 @@
    \endraw - We can add a child widget to this window by passing \c window as the - parent to its constructor. In this case, we add a button to the window - and place it in a specific location: + To create a real GUI, we need to place widgets inside the window. To do + this, we pass a QWidget instance to a widget's constructor, as we will + demonstrate in the next part of this tutorial. +*/ + +/*! + \page widgets-tutorial-childwidget.html + \contentspage {Widgets Tutorial}{Contents} + \previouspage {Widgets Tutorial - Creating a Window} + \nextpage {Widgets Tutorial - Using Layouts} + \example tutorials/widgets/childwidget + \title Widgets Tutorial - Child Widgets + + We can add a child widget to the window created in the previous example by + passing \c window as the parent to its constructor. In this case, we add a + button to the window and place it in a specific location: \raw HTML
    \endraw - \snippet snippets/widgets-tutorial/childwidget/main.cpp create, position and show + \snippet tutorials/widgets/childwidget/main.cpp main program \raw HTML \endraw @@ -112,9 +181,16 @@ The button is now a child of the window and will be deleted when the window is destroyed. Note that hiding or closing the window does not - automatically destroy it. + automatically destroy it. It will be destroyed when the example exits. +*/ - \section1 Using Layouts +/*! + \page widgets-tutorial-windowlayout.html + \contentspage {Widgets Tutorial}{Contents} + \previouspage {Widgets Tutorial - Child Widgets} + \nextpage {Widgets Tutorial - Nested Layouts} + \example tutorials/widgets/windowlayout + \title Widgets Tutorial - Using Layouts Usually, child widgets are arranged inside a window using layout objects rather than by specifying positions and sizes explicitly. Here, we @@ -125,7 +201,7 @@ " - -static void qDumpUnknown(QDumper &d) -{ - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", ""); - P(d, "type", d.outertype); - P(d, "numchild", "0"); - d.disarm(); -} - -static void qDumpQPropertyList(QDumper &d) -{ - const QObject *ob = (const QObject *)d.data; - const QMetaObject *mo = ob->metaObject(); - P(d, "iname", d.iname); - P(d, "addr", ""); - P(d, "type", "QObject"); - P(d, "numchild", mo->propertyCount()); - if (d.dumpChildren) { - d << ",children=["; - for (int i = mo->propertyCount(); --i >= 0; ) { - const QMetaProperty & prop = mo->property(i); - d.beginHash(); - P(d, "name", prop.name()); - if (QLatin1String(prop.typeName()) == QLatin1String("QString")) { - P(d, "value", prop.read(ob).toString()); - P(d, "numchild", "0"); - } else if (QLatin1String(prop.typeName()) == QLatin1String("bool")) { - P(d, "value", (prop.read(ob).toBool() ? "true" : "false")); - P(d, "numchild", "0"); - } else if (QLatin1String(prop.typeName()) == QLatin1String("int")) { - P(d, "value", prop.read(ob).toInt()); - P(d, "numchild", "0"); - } else { - P(d, "exp", "((" << mo->className() << "*)" << ob - << ")->" << prop.name() << "()"); - } - P(d, "type", prop.typeName()); - P(d, "numchild", "1"); - d.endHash(); - } - d << "]"; - } - d.disarm(); -} - -static void qDumpQObject(QDumper &d) -{ - const QObject *ob = reinterpret_cast(d.data); - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", (void*)d.data); - P(d, "type", "QObject"); - P(d, "numchild", 4); - if (d.dumpChildren) { - const QMetaObject *mo = ob->metaObject(); - const QObjectList &children = ob->children(); - d << ",children=["; - S(d, "objectName", ob->objectName()); - d.beginHash(); - P(d, "name", "properties"); - // FIXME: Note that when simply using '(QObject*)' - // in the cast below, Gdb/MI _sometimes misparses - // expressions further down in the tree. - P(d, "exp", "*(class QObject*)" << d.data); - P(d, "type", "QPropertyList"); - P(d, "value", "<" << mo->propertyCount() << " items>"); - P(d, "numchild", mo->propertyCount()); - d.endHash(); - d.beginHash(); - P(d, "name", "children"); - P(d, "exp", "((class QObject*)" << d.data << ")->children()"); - P(d, "type", "QList"); - P(d, "value", "<" << children.size() << " items>"); - P(d, "numchild", children.size()); - d.endHash(); - d.beginHash(); - P(d, "name", "parent"); - P(d, "exp", "((class QObject*)" << d.data << ")->parent()"); - P(d, "type", "QObject *"); - P(d, "numchild", (ob->parent() ? "1" : "0")); - d.endHash(); - d << "]"; - } - d.disarm(); -} - -static void qDumpQDir(QDumper &d) -{ - const QDir &dir = *reinterpret_cast(d.data); - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", dir.path()); - P(d, "type", "QDir"); - P(d, "numchild", "3"); - if (d.dumpChildren) { - d << ",children=["; - S(d, "absolutePath", dir.absolutePath()); - S(d, "canonicalPath", dir.canonicalPath()); - d << "]"; - } - d.disarm(); -} - -static void qDumpQFileInfo(QDumper &d) -{ - const QFileInfo &info = *reinterpret_cast(d.data); - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", info.filePath()); - P(d, "type", "QDir"); - P(d, "numchild", "3"); - if (d.dumpChildren) { - d << ",children=["; - S(d, "absolutePath", info.absolutePath()); - S(d, "absoluteFilePath", info.absoluteFilePath()); - S(d, "canonicalPath", info.canonicalPath()); - S(d, "canonicalFilePath", info.canonicalFilePath()); - S(d, "completeBaseName", info.completeBaseName()); - S(d, "completeSuffix", info.completeSuffix()); - S(d, "baseName", info.baseName()); -#ifdef Q_OS_MACX - BL(d, "isBundle", info.isBundle()); - S(d, "bundleName", info.bundleName()); -#endif - S(d, "completeSuffix", info.completeSuffix()); - S(d, "fileName", info.fileName()); - S(d, "filePath", info.filePath()); - S(d, "group", info.group()); - S(d, "owner", info.owner()); - S(d, "path", info.path()); - - I(d, "groupid", (long)info.groupId()); - I(d, "ownerid", (long)info.ownerId()); - //QFile::Permissions permissions () const - I(d, "permissions", info.permissions()); - - //QDir absoluteDir () const - //QDir dir () const - - BL(d, "caching", info.caching()); - BL(d, "exists", info.exists()); - BL(d, "isAbsolute", info.isAbsolute()); - BL(d, "isDir", info.isDir()); - BL(d, "isExecutable", info.isExecutable()); - BL(d, "isFile", info.isFile()); - BL(d, "isHidden", info.isHidden()); - BL(d, "isReadable", info.isReadable()); - BL(d, "isRelative", info.isRelative()); - BL(d, "isRoot", info.isRoot()); - BL(d, "isSymLink", info.isSymLink()); - BL(d, "isWritable", info.isWritable()); - -#ifndef QT_NO_DATESTRING - d.beginHash(); - P(d, "name", "created"); - P(d, "value", info.created().toString()); - P(d, "exp", "((QFileInfo*)" << d.data << ")->created()"); - P(d, "type", "QDateTime"); - P(d, "numchild", "1"); - d.endHash(); - - d.beginHash(); - P(d, "name", "lastModified"); - P(d, "value", info.lastModified().toString()); - P(d, "exp", "((QFileInfo*)" << d.data << ")->lastModified()"); - P(d, "type", "QDateTime"); - P(d, "numchild", "1"); - d.endHash(); - - d.beginHash(); - P(d, "name", "lastRead"); - P(d, "value", info.lastRead().toString()); - P(d, "exp", "((QFileInfo*)" << d.data << ")->lastRead()"); - P(d, "type", "QDateTime"); - P(d, "numchild", "1"); - d.endHash(); -#endif - - d << "]"; - } - d.disarm(); -} - -static void qDumpQDateTime(QDumper &d) -{ -#ifdef QT_NO_DATESTRING - qDumpUnknown(d); -#else - const QDateTime &date = *reinterpret_cast(d.data); - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", date.toString()); - P(d, "type", "QDateTime"); - P(d, "numchild", "3"); - if (d.dumpChildren) { - d << ",children=["; - BL(d, "isNull", date.isNull()); - I(d, "toTime_t", (long)date.toTime_t()); - S(d, "toString", date.toString()); - S(d, "toString_(ISO)", date.toString(Qt::ISODate)); - S(d, "toString_(SystemLocale)", date.toString(Qt::SystemLocaleDate)); - S(d, "toString_(Locale)", date.toString(Qt::LocaleDate)); - S(d, "toString", date.toString()); - - d.beginHash(); - P(d, "name", "toUTC"); - P(d, "exp", "((QDateTime*)" << d.data << ")->toTimeSpec(Qt::UTC)"); - P(d, "type", "QDateTime"); - P(d, "numchild", "1"); - d.endHash(); - - d.beginHash(); - P(d, "name", "toLocalTime"); - P(d, "exp", "((QDateTime*)" << d.data << ")->toTimeSpec(Qt::LocalTime)"); - P(d, "type", "QDateTime"); - P(d, "numchild", "1"); - d.endHash(); - - d << "]"; - } - d.disarm(); -#endif // ifdef QT_NO_DATESTRING -} - -static void qDumpQString(QDumper &d) -{ - const QString &str = *reinterpret_cast(d.data); - - // Try to provoke segfaults early to prevent the frontend - // from asking for unavailable child details - if (!str.isEmpty()) { - volatile ushort dummy = 0; - dummy += str.at(0).unicode(); - dummy += str.at(str.size() - 1).unicode(); - } - - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", str); - P(d, "type", "QString"); - P(d, "numchild", "0"); - d.disarm(); -} - -static void qDumpQStringList(QDumper &d) -{ - const QStringList &list = *reinterpret_cast(d.data); - int n = list.size(); - if (n < 0) - qProvokeSegFault(); - if (n > 0) { - qCheckAccess(&list.front()); - qCheckAccess(&list.back()); - } - - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", "<" << n << " items>"); - P(d, "valuedisabled", "true"); - P(d, "numchild", n); - if (d.dumpChildren) { - if (n > 100) - n = 100; - d << ",children=["; - for (int i = 0; i != n; ++i) { - S(d, "[" << i << "]", list[i]); - } - if (n < list.size()) { - d.beginHash(); - P(d, "value", ""); - P(d, "type", " "); - P(d, "numchild", "0"); - d.endHash(); - } - d << "]"; - } - d.disarm(); -} - -static void qDumpQVariantHelper(const void *data, QString *value, - QString *exp, int *numchild) -{ - const QVariant &v = *reinterpret_cast(data); - switch (v.type()) { - case QVariant::Invalid: - *value = QLatin1String(""); - *numchild = 0; - break; - case QVariant::String: - *value = QLatin1Char('"') + v.toString() + QLatin1Char('"'); - *numchild = 0; - break; - case QVariant::StringList: - *exp = QString(QLatin1String("((QVariant*)%1)->d.data.c")) - .arg((qulonglong)data); - *numchild = v.toStringList().size(); - break; - case QVariant::Int: - *value = QString::number(v.toInt()); - *numchild= 0; - break; - case QVariant::Double: - *value = QString::number(v.toDouble()); - *numchild = 0; - break; - default: - // FIXME - //*exp = QString("qVariantValue<" << v.typeName() << ">" - // << "(*(QVariant*)" << data << ")"); - break; - } -} - -static void qDumpQVariant(QDumper &d) -{ - const QVariant &v = *reinterpret_cast(d.data); - QString value; - QString exp; - int numchild = 0; - qDumpQVariantHelper(d.data, &value, &exp, &numchild); - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", "(" << v.typeName() << ") " << qPrintable(value)); - P(d, "type", "QVariant"); - P(d, "numchild", 1); - if (d.dumpChildren) { - d << ",children=["; - d.beginHash(); - P(d, "name", "value"); - if (!exp.isEmpty()) - P(d, "exp", qPrintable(exp)); - if (!value.isEmpty()) - P(d, "value", qPrintable(value)); - P(d, "type", v.typeName()); - P(d, "numchild", numchild); - d.endHash(); - d << "]"; - } - d.disarm(); -} - -static void qDumpQList(QDumper &d) -{ - // This uses the knowledge that QList has only a single member - // of type union { QListData p; QListData::Data *d; }; - const QListData &ldata = *reinterpret_cast(d.data); - const QListData::Data *pdata = *reinterpret_cast(d.data); - int nn = ldata.size(); - if (nn < 0) - qProvokeSegFault(); - if (nn > 0) { - qCheckAccess(ldata.d->array); - //qCheckAccess(ldata.d->array[0]); - //qCheckAccess(ldata.d->array[nn - 1]); - } - - int n = nn; - P(d, "iname", d.iname); - P(d, "value", "<" << n << " items>"); - P(d, "valuedisabled", "true"); - P(d, "numchild", n); - if (d.dumpChildren) { - if (n > 100) - n = 100; - d << ",children=["; - for (int i = 0; i != n; ++i) { - d.beginHash(); - P(d, "name", "[" << i << "]"); - // The exact condition here is: - // QTypeInfo::isLarge || QTypeInfo::isStatic - // but this data is not available in the compiled binary. - // So as first approximation only do the 'isLarge' check: - void *p = &(ldata.d->array[i + pdata->begin]); - unsigned long voidpsize = sizeof(void*); - P(d, "exp", "(sizeof(" << d.innertype << ")>" << voidpsize << - "?(**(" << d.innertype << "**)(" << p << "))" - ":(*(" << d.innertype << "*)(" << p << ")))"); - P(d, "type", d.innertype); - d.endHash(); - } - if (n < nn) { - d << ",{"; - P(d, "value", ""); - d.endHash(); - } - d << "]"; - } - d.disarm(); -} - -static void qDumpQVector(QDumper &d) -{ - // Use 'int' as representative value. No way (and no need) - // to deduce proper type here. - const QVector &vec = *reinterpret_cast *>(d.data); - const int nn = vec.size(); - - // Try to provoke segfaults early to prevent the frontend - // from asking for unavailable child details - if (nn < 0) - qProvokeSegFault(); - if (nn > 0) { - qCheckAccess(&vec.front()); - qCheckAccess(&vec.back()); - } - - //int innersize = 0; - //scanf(qDumpInBuffer, "%d", &innersize); - - int n = nn; - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", "<" << n << " items>"); - P(d, "valuedisabled", "true"); - P(d, "numchild", n); - if (d.dumpChildren) { - if (n > 100) - n = 100; - d << ",children=["; - for (int i = 0; i != n; ++i) { - if (i) - d << ","; - d.beginHash(); - P(d, "name", "[" << i << "]"); - P(d, "exp", "(" << d.exp << ".d->array[" << i << "])"); - P(d, "type", d.innertype); - d.endHash(); - } - if (n < nn) { - d << ",{"; - P(d, "value", ""); - d.endHash(); - } - d << "]"; - } - d.disarm(); -} - -static void qDumpQHashNode(QDumper &d) -{ - struct NodeOS { void *next; uint k; uint v; } nodeOS; // int-key optimization, small value - struct NodeOL { void *next; uint k; void *v; } nodeOL; // int-key optimiatzion, large value - struct NodeNS { void *next; uint h; uint k; uint v; } nodeNS; // no optimization, small value - struct NodeNL { void *next; uint h; uint k; void *v; } nodeNL; // no optimization, large value - struct NodeL { void *next; uint h; void *k; void *v; } nodeL; // complex key - - // offsetof(...,...) not yet in Standard C++ - const ulong nodeOSk ( (char *)&nodeOS.k - (char *)&nodeOS ); - const ulong nodeOSv ( (char *)&nodeOS.v - (char *)&nodeOS ); - const ulong nodeOLk ( (char *)&nodeOL.k - (char *)&nodeOL ); - const ulong nodeOLv ( (char *)&nodeOL.v - (char *)&nodeOL ); - const ulong nodeNSk ( (char *)&nodeNS.k - (char *)&nodeNS ); - const ulong nodeNSv ( (char *)&nodeNS.v - (char *)&nodeNS ); - const ulong nodeNLk ( (char *)&nodeNL.k - (char *)&nodeNL ); - const ulong nodeNLv ( (char *)&nodeNL.v - (char *)&nodeNL ); - const ulong nodeLk ( (char *)&nodeL.k - (char *)&nodeL ); - const ulong nodeLv ( (char *)&nodeL.v - (char *)&nodeL ); - - const QHashData *h = reinterpret_cast(d.data); - const char *keyType = d.templateParameters[0]; - const char *valueType = d.templateParameters[1]; - - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", ""); - P(d, "numchild", 2); - if (d.dumpChildren) { - // there is a hash specialization in cast the key are integers or shorts - bool isOptimizedIntKey = qstrcmp(keyType, "int") == 0 -#if defined(Q_BYTE_ORDER) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN - || qstrcmp(keyType, "short") == 0 - || qstrcmp(keyType, "ushort") == 0 -#endif - || qstrcmp(keyType, "uint") == 0; - - d << ",children=["; - d.beginHash(); - P(d, "name", "key"); - P(d, "type", keyType); - unsigned long intsize = sizeof(int); - if (isOptimizedIntKey) { - P(d, "exp", "*(" << keyType << "*)" - "(((sizeof(" << valueType << ")>" << intsize << ")?" - << nodeOLk << ":" << nodeOSk << - ")+(char*)" << h << ")"); - } else { - P(d, "exp", "*(" << keyType << "*)" - "(((sizeof(" << keyType << ")>" << intsize << ")?" - << nodeLk << ":" - "((sizeof(" << valueType << ")>" << intsize << ")?" - << nodeNLk << ":" << nodeNSk << "))+(char*)" << h << ")"); - } - d.endHash(); - d.beginHash(); - P(d, "name", "value"); - P(d, "type", valueType); - if (isOptimizedIntKey) { - P(d, "exp", "*(" << valueType << "*)" - "(((sizeof(" << valueType << ")>" << intsize << ")?" - << nodeOLv << ":" << nodeOSv << ")+(char*)" << h << ")"); - } else { - P(d, "exp", "*(" << valueType << "*)" - "(((sizeof(" << keyType << ")>" << intsize << ")?" << nodeLv << ":" - "((sizeof(" << valueType << ")>" << intsize << ")?" - << nodeNLv << ":" << nodeNSv << "))+(char*)" << h << ")"); - } - d.endHash(); - d << "]"; - } - d.disarm(); -} - -static void qDumpQHash(QDumper &d) -{ - QHashData *h = *reinterpret_cast(d.data); - const char *keyType = d.templateParameters[0]; - const char *valueType = d.templateParameters[1]; - - qCheckPointer(h->fakeNext); - qCheckPointer(h->buckets); - - int n = h->size; - - if (n < 0) - qProvokeSegFault(); - if (n > 0) { - qCheckPointer(h->fakeNext); - qCheckPointer(*h->buckets); - } - - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", "<" << n << " items>"); - P(d, "numchild", n); - if (d.dumpChildren) { - if (n > 100) - n = 100; - d << ",children=["; - - QHashData::Node *node = h->firstNode(); - QHashData::Node *end = reinterpret_cast(h); - int i = 0; - - while (node != end) { - d.beginHash(); - P(d, "name", "[" << i << "]"); - P(d, "type", "QHashNode<" << keyType << "," << valueType << " >"); - P(d, "exp", "*(QHashNode<" << keyType << "," << valueType << " >*)" << node); - d.endHash(); - - ++i; - node = QHashData::nextNode(node); - } - d << "]"; - } - d.disarm(); -} - -static void qDumpQMapNode(QDumper &d) -{ - const QMapData *h = reinterpret_cast(d.data); - const char *keyType = d.templateParameters[0]; - const char *valueType = d.templateParameters[1]; - - qCheckAccess(h->backward); - qCheckAccess(h->forward[0]); - - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", ""); - P(d, "numchild", 2); - if (d.dumpChildren) { - unsigned long voidpsize = sizeof(void*); - d << ",children=["; - d.beginHash(); - P(d, "name", "key"); - P(d, "type", keyType); - P(d, "exp", "*(" << keyType << "*)" - << "(" - << 2 * voidpsize - << "-sizeof('QMap<" << keyType << "," << valueType << ">::Node')" - << "+(char*)" << h - << ")"); - d.endHash(); - d.beginHash(); - P(d, "name", "value"); - P(d, "type", valueType); - P(d, "exp", "*(" << valueType << "*)" - << "(" - << "(size_t)&(('QMap<" << keyType << "," << valueType << ">::Node'*)0)->value" - << "+" << 2 * voidpsize - << "-sizeof('QMap<" << keyType << "," << valueType << ">::Node')" - << "+(char*)" << h - << ")"); - d.endHash(); - d << "]"; - } - - d.disarm(); -} - -static void qDumpQMap(QDumper &d) -{ - QMapData *h = *reinterpret_cast(d.data); - const char *keyType = d.templateParameters[0]; - const char *valueType = d.templateParameters[1]; - - int n = h->size; - - if (n < 0) - qProvokeSegFault(); - if (n > 0) { - qCheckAccess(h->backward); - qCheckAccess(h->forward[0]); - qCheckPointer(h->backward->backward); - qCheckPointer(h->forward[0]->backward); - } - - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", "<" << n << " items>"); - P(d, "numchild", n); - if (d.dumpChildren) { - if (n > 100) - n = 100; - d << ",children=["; - - QMapData::Node *node = reinterpret_cast(h->forward[0]); - QMapData::Node *end = reinterpret_cast(h); - int i = 0; - - while (node != end) { - d.beginHash(); - P(d, "name", "[" << i << "]"); - P(d, "type", "QMap<" << keyType << "," << valueType << ">::Node"); - P(d, "exp", "*('QMap<" << keyType << "," << valueType << ">::Node'*)" << node); - d.endHash(); - - ++i; - node = node->forward[0]; - } - d << "]"; - } - - d.disarm(); -} - -static void qDumpQSet(QDumper &d) -{ - // This uses the knowledge that QHash has only a single member - // of union { QHashData *d; QHashNode *e; }; - QHashData *hd = *(QHashData**)d.data; - QHashData::Node *node = hd->firstNode(); - - int n = hd->size; - if (n < 0) - qProvokeSegFault(); - if (n > 0) { - qCheckAccess(node); - qCheckPointer(node->next); - } - - P(d, "iname", d.iname); - P(d, "addr", d.data); - P(d, "value", "<" << n << " items>"); - P(d, "valuedisabled", "true"); - P(d, "numchild", 2 * n); - if (d.dumpChildren) { - if (n > 100) - n = 100; - d << ",children=["; - int i = 0; - for (int bucket = 0; bucket != hd->numBuckets; ++bucket) { - for (node = hd->buckets[bucket]; node->next; node = node->next) { - d.beginHash(); - P(d, "name", "[" << i << "]"); - P(d, "type", d.innertype); - P(d, "exp", "(('QHashNode<" << d.innertype - << ",QHashDummyValue>'*)" - << static_cast(node) << ")->key" - ); - d.endHash(); - ++i; - } - } - d << "]"; - } - d.disarm(); -} - -static void handleProtocolVersion2(QDumper & d) -{ - if (!d.outertype[0]) { - qDumpUnknown(d); - return; - } - - d.setupTemplateParameters(); - // d.outertype[0] is usally 'Q', so don't use it - switch (d.outertype[1]) { - case 'D': - if (qstrcmp(d.outertype, "QDateTime") == 0) - qDumpQDateTime(d); - else if (qstrcmp(d.outertype, "QDir") == 0) - qDumpQDir(d); - break; - case 'F': - if (qstrcmp(d.outertype, "QFileInfo") == 0) - qDumpQFileInfo(d); - break; - case 'H': - if (qstrcmp(d.outertype, "QHash") == 0) - qDumpQHash(d); - else if (qstrcmp(d.outertype, "QHashNode") == 0) - qDumpQHashNode(d); - break; - case 'L': - if (qstrcmp(d.outertype, "QList") == 0) - qDumpQList(d); - break; - case 'M': - if (qstrcmp(d.outertype, "QMap") == 0) - qDumpQMap(d); - else if (qstrcmp(d.outertype, "QMap::Node") == 0) - qDumpQMapNode(d); - break; - case 'O': - if (qstrcmp(d.outertype, "QObject") == 0) - qDumpQObject(d); - break; - case 'P': - if (qstrcmp(d.outertype, "QPropertyList") == 0) - qDumpQPropertyList(d); - break; - case 'S': - if (qstrcmp(d.outertype, "QSet") == 0) - qDumpQSet(d); - else if (qstrcmp(d.outertype, "QString") == 0) - qDumpQString(d); - else if (qstrcmp(d.outertype, "QStringList") == 0) - qDumpQStringList(d); - break; - case 'V': - if (qstrcmp(d.outertype, "QVariant") == 0) - qDumpQVariant(d); - else if (qstrcmp(d.outertype, "QVector") == 0) - qDumpQVector(d); - break; - } - - if (!d.success) - qDumpUnknown(d); -} - -} // anonymous namespace - - -extern "C" Q_CORE_EXPORT void qDumpObjectData( - int protocolVersion, - int token, - const char *outertype, - const char *iname, - const char *exp, - const char *innertype, - const void *data, - bool dumpChildren) -{ - if (protocolVersion == 1) { - // used to test whether error output gets through - //fprintf(stderr, "using stderr, qDebug follows: %d\n", token); - //qDebug() << "using qDebug, stderr already used: " << token; - } - - else if (protocolVersion == 2) { - QDumper d; - d.protocolVersion = protocolVersion; - d.token = token; - d.outertype = outertype ? outertype : ""; - d.iname = iname ? iname : ""; - d.exp = exp ? exp : ""; - d.innertype = innertype ? innertype : ""; - d.data = data ? data : ""; - d.dumpChildren = dumpChildren; - handleProtocolVersion2(d); - } - - else { - qDebug() << "Unsupported protocol version" << protocolVersion; - } -} - -QT_END_NAMESPACE - -#endif // !Q_OS_WINCE && !QT_NO_QDUMPER diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index aaf3f21..a6fdac7 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -46,7 +46,6 @@ SOURCES += \ tools/qbytearraymatcher.cpp \ tools/qcryptographichash.cpp \ tools/qdatetime.cpp \ - tools/qdumper.cpp \ tools/qhash.cpp \ tools/qline.cpp \ tools/qlinkedlist.cpp \ -- cgit v0.12 From 81780cd10a0901966a34d2805e56d106464e124d Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 20 May 2009 16:41:38 +0200 Subject: Make the range controls accessible --- src/plugins/accessible/widgets/rangecontrols.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/accessible/widgets/rangecontrols.h b/src/plugins/accessible/widgets/rangecontrols.h index aea91e1..57073ee 100644 --- a/src/plugins/accessible/widgets/rangecontrols.h +++ b/src/plugins/accessible/widgets/rangecontrols.h @@ -60,6 +60,7 @@ class QDial; #ifndef QT_NO_SPINBOX class QAccessibleAbstractSpinBox: public QAccessibleWidgetEx, public QAccessibleValueInterface { + Q_ACCESSIBLE_OBJECT public: explicit QAccessibleAbstractSpinBox(QWidget *w); @@ -132,6 +133,7 @@ protected: class QAccessibleAbstractSlider: public QAccessibleWidgetEx, public QAccessibleValueInterface { + Q_ACCESSIBLE_OBJECT public: explicit QAccessibleAbstractSlider(QWidget *w, Role r = Slider); -- cgit v0.12 From d46fd15e337421c723d56fd62582ac4ccc76395a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 20 May 2009 17:07:06 +0200 Subject: Compile on Solaris with broken GL headers. Reviewed-by: Samuel --- demos/boxes/glextensions.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/demos/boxes/glextensions.h b/demos/boxes/glextensions.h index 74617d6..7ba3b32 100644 --- a/demos/boxes/glextensions.h +++ b/demos/boxes/glextensions.h @@ -120,8 +120,11 @@ glUnmapBuffer //#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #endif +#ifndef GL_ARB_vertex_buffer_object +typedef ptrdiff_t GLsizeiptrARB; +#endif + #ifndef GL_VERSION_1_5 -typedef ptrdiff_t GLsizeiptr; #define GL_ARRAY_BUFFER 0x8892 #define GL_ELEMENT_ARRAY_BUFFER 0x8893 #define GL_READ_WRITE 0x88BA @@ -185,7 +188,7 @@ typedef void (APIENTRY *_glTexImage3D) (GLenum, GLint, GLenum, GLsizei, GLsizei, typedef void (APIENTRY *_glGenBuffers) (GLsizei, GLuint *); typedef void (APIENTRY *_glBindBuffer) (GLenum, GLuint); -typedef void (APIENTRY *_glBufferData) (GLenum, GLsizeiptr, const GLvoid *, GLenum); +typedef void (APIENTRY *_glBufferData) (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); typedef void (APIENTRY *_glDeleteBuffers) (GLsizei, const GLuint *); typedef void *(APIENTRY *_glMapBuffer) (GLenum, GLenum); typedef GLboolean (APIENTRY *_glUnmapBuffer) (GLenum); -- cgit v0.12 From f5772762c9da55157e11249da00715def2b693f5 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 20 May 2009 17:26:34 +0200 Subject: Sync the French addressbook tutorial with the English version Reviewed-by: Thierry --- doc/src/tutorials/addressbook-fr.qdoc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/src/tutorials/addressbook-fr.qdoc b/doc/src/tutorials/addressbook-fr.qdoc index 2847f1b..512a404 100644 --- a/doc/src/tutorials/addressbook-fr.qdoc +++ b/doc/src/tutorials/addressbook-fr.qdoc @@ -239,13 +239,16 @@ \snippet tutorials/addressbook/part1/main.cpp main function - On construit un nouveau widget \c AddressBook sur le tas en utilisant le mot-clé - \c new et en invoquant sa méthode \l{QWidget::show()}{show()} pour l'afficher. + On construit un nouveau widget \c AddressBook sur la pile et on invoque + sa méthode \l{QWidget::show()}{show()} pour l'afficher. Cependant, le widget ne sera pas visible tant que la boucle d'évènements n'aura pas été lancée. On démarre la boucle d'évènements en appelant la méthode \l{QApplication::}{exec()} de l'application; le résultat renvoyé par cette méthode est lui même utilisé comme valeur de retour pour la méthode \c main(). + On comprend maintenant pourquoi \c AddressBook a été créé sur la pile: à la fin + du programme, l'objet sort du scope de la fonction \c main() et tous ses widgets enfants + sont supprimés, assurant ainsi qu'il n'y aura pas de fuites de mémoire. */ /*! -- cgit v0.12 From 1ea9fd89e39ce519fd406174a0b5fb4efee67ab7 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 20 May 2009 17:25:25 +0200 Subject: tst_QHttpNetworkConnection: Compile fix Reviewed-by: Peter Hartmann --- tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index b22397f..eb30147 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -42,6 +42,7 @@ #include #include "private/qhttpnetworkconnection_p.h" +#include "private/qnoncontiguousbytedevice_p.h" #include #include "../network-settings.h" @@ -303,8 +304,8 @@ void tst_QHttpNetworkConnection::put() QHttpNetworkRequest request(protocol + host + path, QHttpNetworkRequest::Put); QByteArray array = data.toLatin1(); - QBuffer buffer(&array); - request.setData(&buffer); + QNonContiguousByteDevice *bd = QNonContiguousByteDeviceFactory::create(&array); + request.setUploadByteDevice(bd); finishedCalled = false; finishedWithErrorCalled = false; @@ -393,8 +394,8 @@ void tst_QHttpNetworkConnection::post() QHttpNetworkRequest request(protocol + host + path, QHttpNetworkRequest::Post); QByteArray array = data.toLatin1(); - QBuffer buffer(&array); - request.setData(&buffer); + QNonContiguousByteDevice *bd = QNonContiguousByteDeviceFactory::create(&array); + request.setUploadByteDevice(bd); QHttpNetworkReply *reply = connection.sendRequest(request); -- cgit v0.12 From d5fad16bb0810ad2961643b54aef9674224f2509 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 20 May 2009 17:35:01 +0200 Subject: Doc: Used QApplication::translate() instead of QObject::tr(). At some point, we may revise this to use plain C strings at first, then introduce the concept of translations. Reviewed-by: Trust Me --- examples/tutorials/widgets/childwidget/main.cpp | 5 +++-- examples/tutorials/widgets/nestedlayouts/main.cpp | 9 ++++++--- examples/tutorials/widgets/toplevel/main.cpp | 3 ++- examples/tutorials/widgets/windowlayout/main.cpp | 5 +++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/examples/tutorials/widgets/childwidget/main.cpp b/examples/tutorials/widgets/childwidget/main.cpp index 8674b6e..fd50b1d 100644 --- a/examples/tutorials/widgets/childwidget/main.cpp +++ b/examples/tutorials/widgets/childwidget/main.cpp @@ -47,11 +47,12 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); QWidget window; window.resize(320, 240); - window.setWindowTitle(QObject::tr("Child widget")); + window.setWindowTitle(QApplication::translate("childwidget", "Child widget")); window.show(); //! [create, position and show] - QPushButton *button = new QPushButton(QObject::tr("Press me"), &window); + QPushButton *button = new QPushButton( + QApplication::translate("childwidget", "Press me"), &window); button->move(100, 100); button->show(); //! [create, position and show] diff --git a/examples/tutorials/widgets/nestedlayouts/main.cpp b/examples/tutorials/widgets/nestedlayouts/main.cpp index 33f9ad2..226d0f9 100644 --- a/examples/tutorials/widgets/nestedlayouts/main.cpp +++ b/examples/tutorials/widgets/nestedlayouts/main.cpp @@ -48,7 +48,8 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); QWidget window; - QLabel *queryLabel = new QLabel(QObject::tr("Query:")); + QLabel *queryLabel = new QLabel( + QApplication::translate("nestedlayouts", "Query:")); QLineEdit *queryEdit = new QLineEdit(); QTableView *resultView = new QTableView(); @@ -67,7 +68,8 @@ int main(int argc, char *argv[]) //! [set up the model] QStandardItemModel model; model.setHorizontalHeaderLabels( - QStringList() << QObject::tr("Name") << QObject::tr("Office")); + QStringList() << QApplication::translate("nestedlayouts", "Name") + << QApplication::translate("nestedlayouts", "Office")); QList rows = QList() << (QStringList() << "Verne Nilsen" << "123") @@ -93,7 +95,8 @@ int main(int argc, char *argv[]) resultView->horizontalHeader()->setStretchLastSection(true); //! [set up the model] //! [last part] - window.setWindowTitle(QObject::tr("Nested layouts")); + window.setWindowTitle( + QApplication::translate("nestedlayouts", "Nested layouts")); window.show(); return app.exec(); } diff --git a/examples/tutorials/widgets/toplevel/main.cpp b/examples/tutorials/widgets/toplevel/main.cpp index 25ebd3f..f18fa6b 100644 --- a/examples/tutorials/widgets/toplevel/main.cpp +++ b/examples/tutorials/widgets/toplevel/main.cpp @@ -50,7 +50,8 @@ int main(int argc, char *argv[]) window.resize(320, 240); window.show(); //! [create, resize and show] - window.setWindowTitle(QObject::tr("Top-level widget")); + window.setWindowTitle( + QApplication::translate("toplevel", "Top-level widget")); return app.exec(); } //! [main program] diff --git a/examples/tutorials/widgets/windowlayout/main.cpp b/examples/tutorials/widgets/windowlayout/main.cpp index 15a11e1..c30d669 100644 --- a/examples/tutorials/widgets/windowlayout/main.cpp +++ b/examples/tutorials/widgets/windowlayout/main.cpp @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); QWidget window; //! [create, lay out widgets and show] - QLabel *label = new QLabel(QObject::tr("Name:")); + QLabel *label = new QLabel(QApplication::translate("windowlayout", "Name:")); QLineEdit *lineEdit = new QLineEdit(); QHBoxLayout *layout = new QHBoxLayout(); @@ -55,7 +55,8 @@ int main(int argc, char *argv[]) layout->addWidget(lineEdit); window.setLayout(layout); //! [create, lay out widgets and show] - window.setWindowTitle(QObject::tr("Window layout")); + window.setWindowTitle( + QApplication::translate("windowlayout", "Window layout")); window.show(); return app.exec(); } -- cgit v0.12 From 3bcc706cabb61d58d7e6c005f5268747a5e65307 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Wed, 20 May 2009 17:39:21 +0200 Subject: Fix a wrong compiler define (was a typo). The typo was in commit 30f7edc0aab629499b74263391ae529ad31b2ff8. --- src/gui/painting/qtransform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 4ea1be3..4a33969 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -322,7 +322,7 @@ inline QTransform &QTransform::operator-=(qreal num) # if Q_CC_GNU_VERSION >= 0x040201 # pragma GCC diagnostic warning "-Wfloat-equal" # endif -# undef Q_GCC_GNU_VERSION +# undef Q_CC_GNU_VERSION #endif /****** stream functions *******************/ -- cgit v0.12 From 56a8e78869325453010fb6c41a5e2b9e6f8f1c95 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 20 May 2009 17:56:51 +0200 Subject: Fix a compile error on MSVC 64bits due to qhash casting a pointer. I tested it with 32 bits compilation and there is no warning any more. Task-number: 247325 Reviewed-by: ogoffart --- src/corelib/tools/qhash.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index a18b531..632c422 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -97,10 +97,7 @@ Q_CORE_EXPORT uint qHash(const QBitArray &key); #endif template inline uint qHash(const T *key) { - if (sizeof(const T *) > sizeof(uint)) - return qHash(reinterpret_cast(key)); - else - return uint(reinterpret_cast(key)); + return qHash(reinterpret_cast(key)); } #if defined(Q_CC_MSVC) #pragma warning( pop ) -- cgit v0.12 From 942ea5202d4a329376c27015b07406c2018437ff Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 21 May 2009 11:45:41 +1000 Subject: Add a preserveSelection property to TextEdit. This property will allow us to get line edit-like behavior, where the selection is removed when the item loses focus. --- src/declarative/fx/qfxtextedit.cpp | 22 ++++++++++++++++++++++ src/declarative/fx/qfxtextedit.h | 4 ++++ src/declarative/fx/qfxtextedit_p.h | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index b2da051..f59e0ae 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -427,6 +427,8 @@ void QFxTextEdit::setCursorVisible(bool on) return; d->cursorVisible = on; QFocusEvent focusEvent(on ? QEvent::FocusIn : QEvent::FocusOut); + if (!on && !d->preserveSelection) + d->control->setCursorIsFocusIndicator(true); d->control->processEvent(&focusEvent, QPointF(0, 0)); } @@ -450,6 +452,26 @@ void QFxTextEdit::setFocusOnPress(bool on) d->focusOnPress = on; } +/*! + \qmlproperty bool TextEdit::preserveSelection + + Whether the TextEdit should keep the selection visible when it loses focus to another + item in the scene. By default this is set to true; +*/ +bool QFxTextEdit::preserveSelection() const +{ + Q_D(const QFxTextEdit); + return d->preserveSelection; +} + +void QFxTextEdit::setPreserveSelection(bool on) +{ + Q_D(QFxTextEdit); + if (d->preserveSelection == on) + return; + d->preserveSelection = on; +} + void QFxTextEdit::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index d195a80..1456cd8 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -78,6 +78,7 @@ class Q_DECLARATIVE_EXPORT QFxTextEdit : public QFxPaintedItem Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible) Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress) + Q_PROPERTY(bool preserveSelection READ preserveSelection WRITE setPreserveSelection) Q_CLASSINFO("DefaultProperty", "text") public: @@ -131,6 +132,9 @@ public: bool focusOnPress() const; void setFocusOnPress(bool on); + bool preserveSelection() const; + void setPreserveSelection(bool on); + virtual void dump(int depth); virtual QString propertyInfo() const; diff --git a/src/declarative/fx/qfxtextedit_p.h b/src/declarative/fx/qfxtextedit_p.h index a9b7237..78b0018 100644 --- a/src/declarative/fx/qfxtextedit_p.h +++ b/src/declarative/fx/qfxtextedit_p.h @@ -69,7 +69,7 @@ class QFxTextEditPrivate : public QFxPaintedItemPrivate public: QFxTextEditPrivate() : font(0), color("black"), imgDirty(true), hAlign(QFxTextEdit::AlignLeft), vAlign(QFxTextEdit::AlignTop), - dirty(false), wrap(false), richText(false), cursorVisible(false), focusOnPress(false), + dirty(false), wrap(false), richText(false), cursorVisible(false), focusOnPress(false), preserveSelection(true), format(QFxTextEdit::AutoText), document(0) { } @@ -98,6 +98,7 @@ public: bool richText; bool cursorVisible; bool focusOnPress; + bool preserveSelection; QFxTextEdit::TextFormat format; QTextDocument *document; QTextControl *control; -- cgit v0.12 From cbffed3af04495f7bd28a054a1c04ee33ca43a80 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 21 May 2009 11:50:11 +1000 Subject: Convert visual autotests. --- .../declarative/visual/ListView/basic1/basic1.qml | 25 +++ .../declarative/visual/ListView/basic1/basic1.xml | 19 --- .../declarative/visual/ListView/basic2/basic2.qml | 29 ++++ .../declarative/visual/ListView/basic2/basic2.xml | 20 --- .../declarative/visual/ListView/basic3/basic3.qml | 27 +++ .../declarative/visual/ListView/basic3/basic3.xml | 18 -- .../declarative/visual/ListView/basic4/basic4.qml | 31 ++++ .../declarative/visual/ListView/basic4/basic4.xml | 19 --- .../visual/bindinganimation/bindinganimation.qml | 40 +++++ .../visual/bindinganimation/bindinganimation.xml | 19 --- .../auto/declarative/visual/bindinganimation/test | 2 +- .../visual/colorAnimation/colorAnimation.qml | 40 +++++ .../visual/colorAnimation/colorAnimation.xml | 18 -- tests/auto/declarative/visual/easing/easing.qml | 186 +++++++++++++++++++++ tests/auto/declarative/visual/easing/easing.xml | 70 -------- tests/auto/declarative/visual/flickable/Day.qml | 32 +++- .../declarative/visual/flickable/flickable.qml | 53 ++++++ .../declarative/visual/flickable/flickable.xml | 43 ----- .../visual/pauseAnimation/pauseAnimation.qml | 28 ++++ .../visual/pauseAnimation/pauseAnimation.xml | 13 -- .../declarative/visual/qfxtext/elide/elide.qml | 33 ++++ .../declarative/visual/qfxtext/elide/elide.xml | 6 - .../declarative/visual/repeater/basic1/basic1.qml | 26 +++ .../declarative/visual/repeater/basic1/basic1.xml | 21 --- .../declarative/visual/repeater/basic2/basic2.qml | 30 ++++ .../declarative/visual/repeater/basic2/basic2.xml | 22 --- .../declarative/visual/repeater/basic3/basic3.qml | 28 ++++ .../declarative/visual/repeater/basic3/basic3.xml | 19 --- .../declarative/visual/repeater/basic4/basic4.qml | 32 ++++ .../declarative/visual/repeater/basic4/basic4.xml | 18 -- tests/auto/declarative/visual/runtests.sh | 1 + 31 files changed, 635 insertions(+), 333 deletions(-) create mode 100644 tests/auto/declarative/visual/ListView/basic1/basic1.qml delete mode 100644 tests/auto/declarative/visual/ListView/basic1/basic1.xml create mode 100644 tests/auto/declarative/visual/ListView/basic2/basic2.qml delete mode 100644 tests/auto/declarative/visual/ListView/basic2/basic2.xml create mode 100644 tests/auto/declarative/visual/ListView/basic3/basic3.qml delete mode 100644 tests/auto/declarative/visual/ListView/basic3/basic3.xml create mode 100644 tests/auto/declarative/visual/ListView/basic4/basic4.qml delete mode 100644 tests/auto/declarative/visual/ListView/basic4/basic4.xml create mode 100644 tests/auto/declarative/visual/bindinganimation/bindinganimation.qml delete mode 100644 tests/auto/declarative/visual/bindinganimation/bindinganimation.xml create mode 100644 tests/auto/declarative/visual/colorAnimation/colorAnimation.qml delete mode 100644 tests/auto/declarative/visual/colorAnimation/colorAnimation.xml create mode 100644 tests/auto/declarative/visual/easing/easing.qml delete mode 100644 tests/auto/declarative/visual/easing/easing.xml create mode 100644 tests/auto/declarative/visual/flickable/flickable.qml delete mode 100644 tests/auto/declarative/visual/flickable/flickable.xml create mode 100644 tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml delete mode 100644 tests/auto/declarative/visual/pauseAnimation/pauseAnimation.xml create mode 100644 tests/auto/declarative/visual/qfxtext/elide/elide.qml delete mode 100644 tests/auto/declarative/visual/qfxtext/elide/elide.xml create mode 100644 tests/auto/declarative/visual/repeater/basic1/basic1.qml delete mode 100644 tests/auto/declarative/visual/repeater/basic1/basic1.xml create mode 100644 tests/auto/declarative/visual/repeater/basic2/basic2.qml delete mode 100644 tests/auto/declarative/visual/repeater/basic2/basic2.xml create mode 100644 tests/auto/declarative/visual/repeater/basic3/basic3.qml delete mode 100644 tests/auto/declarative/visual/repeater/basic3/basic3.xml create mode 100644 tests/auto/declarative/visual/repeater/basic4/basic4.qml delete mode 100644 tests/auto/declarative/visual/repeater/basic4/basic4.xml diff --git a/tests/auto/declarative/visual/ListView/basic1/basic1.qml b/tests/auto/declarative/visual/ListView/basic1/basic1.qml new file mode 100644 index 0000000..605457b --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic1/basic1.qml @@ -0,0 +1,25 @@ +Rect { + color: "blue" + width: 300 + height: 200 + id: Page + ListView { + anchors.fill: parent + delegate: Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + model: ListModel { + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + } +} diff --git a/tests/auto/declarative/visual/ListView/basic1/basic1.xml b/tests/auto/declarative/visual/ListView/basic1/basic1.xml deleted file mode 100644 index 5038c0a..0000000 --- a/tests/auto/declarative/visual/ListView/basic1/basic1.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - January - - - February - - - - - diff --git a/tests/auto/declarative/visual/ListView/basic2/basic2.qml b/tests/auto/declarative/visual/ListView/basic2/basic2.qml new file mode 100644 index 0000000..e5996cf --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic2/basic2.qml @@ -0,0 +1,29 @@ +Rect { + color: "blue" + width: 200 + height: 300 + id: Page + Component { + id: Delegate + Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } + ListView { + anchors.fill: parent + delegate: Delegate + model: ListModel { + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + } +} diff --git a/tests/auto/declarative/visual/ListView/basic2/basic2.xml b/tests/auto/declarative/visual/ListView/basic2/basic2.xml deleted file mode 100644 index 5e139fe..0000000 --- a/tests/auto/declarative/visual/ListView/basic2/basic2.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - January - - - February - - - - - diff --git a/tests/auto/declarative/visual/ListView/basic3/basic3.qml b/tests/auto/declarative/visual/ListView/basic3/basic3.qml new file mode 100644 index 0000000..98aa5fb --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic3/basic3.qml @@ -0,0 +1,27 @@ +Rect { + color: "blue" + width: 200 + height: 300 + id: Page + ListModel { + id: Model + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + ListView { + anchors.fill: parent + model: Model + delegate: Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } +} diff --git a/tests/auto/declarative/visual/ListView/basic3/basic3.xml b/tests/auto/declarative/visual/ListView/basic3/basic3.xml deleted file mode 100644 index a587b82..0000000 --- a/tests/auto/declarative/visual/ListView/basic3/basic3.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - January - - - February - - - - - - - - - - - diff --git a/tests/auto/declarative/visual/ListView/basic4/basic4.qml b/tests/auto/declarative/visual/ListView/basic4/basic4.qml new file mode 100644 index 0000000..9e5229a --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic4/basic4.qml @@ -0,0 +1,31 @@ +Rect { + color: "blue" + width: 200 + height: 300 + id: Page + ListModel { + id: Model + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + Component { + id: Delegate + Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } + ListView { + anchors.fill: parent + model: Model + delegate: Delegate + } +} diff --git a/tests/auto/declarative/visual/ListView/basic4/basic4.xml b/tests/auto/declarative/visual/ListView/basic4/basic4.xml deleted file mode 100644 index 4b9201c..0000000 --- a/tests/auto/declarative/visual/ListView/basic4/basic4.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - January - - - February - - - - - - - - - - - - diff --git a/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml new file mode 100644 index 0000000..56878dc --- /dev/null +++ b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml @@ -0,0 +1,40 @@ +Rect { + color: "blue" + width: 320 + height: 240 + id: Page + Rect { + id: MyRect + width: 100 + height: 100 + color: "red" + x: 10 + } + states: [ + State { + name: "hello" + SetProperty { + target: MyRect + property: "x" + binding: 100 + } + SetProperty { + target: MyMouseRegion + property: "onClicked" + value: "Page.currentState = ''" + } + } + ] + transitions: [ + Transition { + NumericAnimation { + properties: "x" + } + } + ] + MouseRegion { + id: MyMouseRegion + anchors.fill: parent + onClicked: { Page.currentState= 'hello' } + } +} diff --git a/tests/auto/declarative/visual/bindinganimation/bindinganimation.xml b/tests/auto/declarative/visual/bindinganimation/bindinganimation.xml deleted file mode 100644 index 30b0b6a..0000000 --- a/tests/auto/declarative/visual/bindinganimation/bindinganimation.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/tests/auto/declarative/visual/bindinganimation/test b/tests/auto/declarative/visual/bindinganimation/test index 964c489..bb59333 100644 --- a/tests/auto/declarative/visual/bindinganimation/test +++ b/tests/auto/declarative/visual/bindinganimation/test @@ -1 +1 @@ -bindinganimation.xml +bindinganimation.qml diff --git a/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml b/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml new file mode 100644 index 0000000..69460c5 --- /dev/null +++ b/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml @@ -0,0 +1,40 @@ +Rect { + id: mainrect + state: "first" + states: [ + State { + name: "first" + SetProperty { + target: mainrect + property: "color" + value: "red" + } + }, + State { + name: "second" + SetProperty { + target: mainrect + property: "color" + value: "blue" + } + } + ] + transitions: [ + Transition { + fromState: "first" + toState: "second" + reversible: true + SequentialAnimation { + ColorAnimation { + duration: 2000 + target: mainrect + property: "color" + } + } + } + ] + MouseRegion { + anchors.fill: parent + onClicked: { mainrect.state = 'second' } + } +} diff --git a/tests/auto/declarative/visual/colorAnimation/colorAnimation.xml b/tests/auto/declarative/visual/colorAnimation/colorAnimation.xml deleted file mode 100644 index 39d08be..0000000 --- a/tests/auto/declarative/visual/colorAnimation/colorAnimation.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/tests/auto/declarative/visual/easing/easing.qml b/tests/auto/declarative/visual/easing/easing.qml new file mode 100644 index 0000000..4a0ed14 --- /dev/null +++ b/tests/auto/declarative/visual/easing/easing.qml @@ -0,0 +1,186 @@ +Rect { + id: item + width: 600 + height: layout.height + color: "white" + resources: [ + ListModel { + id: easingtypes + ListElement { + type: "easeNone" + } + ListElement { + type: "easeInQuad" + } + ListElement { + type: "easeOutQuad" + } + ListElement { + type: "easeInOutQuad" + } + ListElement { + type: "easeOutInQuad" + } + ListElement { + type: "easeInCubic" + } + ListElement { + type: "easeOutCubic" + } + ListElement { + type: "easeInOutCubic" + } + ListElement { + type: "easeOutInCubic" + } + ListElement { + type: "easeInQuart" + } + ListElement { + type: "easeOutQuart" + } + ListElement { + type: "easeInOutQuart" + } + ListElement { + type: "easeOutInQuart" + } + ListElement { + type: "easeInQuint" + } + ListElement { + type: "easeOutQuint" + } + ListElement { + type: "easeInOutQuint" + } + ListElement { + type: "easeOutInQuint" + } + ListElement { + type: "easeInSine" + } + ListElement { + type: "easeOutSine" + } + ListElement { + type: "easeInOutSine" + } + ListElement { + type: "easeOutInSine" + } + ListElement { + type: "easeInExpo" + } + ListElement { + type: "easeOutExpo" + } + ListElement { + type: "easeInOutExpo" + } + ListElement { + type: "easeOutInExpo" + } + ListElement { + type: "easeInCirc" + } + ListElement { + type: "easeOutCirc" + } + ListElement { + type: "easeInOutCirc" + } + ListElement { + type: "easeOutInCirc" + } + ListElement { + type: "easeInElastic" + } + ListElement { + type: "easeOutElastic" + } + ListElement { + type: "easeInOutElastic" + } + ListElement { + type: "easeOutInElastic" + } + ListElement { + type: "easeInBack" + } + ListElement { + type: "easeOutBack" + } + ListElement { + type: "easeInOutBack" + } + ListElement { + type: "easeOutInBack" + } + ListElement { + type: "easeOutBounce" + } + ListElement { + type: "easeInBounce" + } + ListElement { + type: "easeInOutBounce" + } + ListElement { + type: "easeOutInBounce" + } + } + ] + VerticalLayout { + id: layout + anchors.left: item.left + anchors.right: item.right + Repeater { + dataSource: easingtypes + Component { + Text { + id: text + text: type + height: 18 + font.italic: true + color: "black" + states: [ + State { + name: "from" + when: !mouse.pressed + SetProperty { + target: text + property: "x" + value: 0 + } + }, + State { + name: "to" + when: mouse.pressed + SetProperty { + target: text + property: "x" + value: item.width-100 + } + } + ] + transitions: [ + Transition { + fromState: "*" + toState: "to" + reversible: true + NumericAnimation { + properties: "x" + easing: type + } + } + ] + } + } + } + } + MouseRegion { + id: mouse + anchors.fill: layout + } +} diff --git a/tests/auto/declarative/visual/easing/easing.xml b/tests/auto/declarative/visual/easing/easing.xml deleted file mode 100644 index 01a7d6c..0000000 --- a/tests/auto/declarative/visual/easing/easing.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - easeNone - easeInQuad - easeOutQuad - easeInOutQuad - easeOutInQuad - easeInCubic - easeOutCubic - easeInOutCubic - easeOutInCubic - easeInQuart - easeOutQuart - easeInOutQuart - easeOutInQuart - easeInQuint - easeOutQuint - easeInOutQuint - easeOutInQuint - easeInSine - easeOutSine - easeInOutSine - easeOutInSine - easeInExpo - easeOutExpo - easeInOutExpo - easeOutInExpo - easeInCirc - easeOutCirc - easeInOutCirc - easeOutInCirc - easeInElastic - easeOutElastic - easeInOutElastic - easeOutInElastic - easeInBack - easeOutBack - easeInOutBack - easeOutInBack - easeOutBounce - easeInBounce - easeInOutBounce - easeOutInBounce - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/auto/declarative/visual/flickable/Day.qml b/tests/auto/declarative/visual/flickable/Day.qml index 0765e2f..63fbc78 100644 --- a/tests/auto/declarative/visual/flickable/Day.qml +++ b/tests/auto/declarative/visual/flickable/Day.qml @@ -1,8 +1,26 @@ - - - - +Rect { + property string day - - - + width: 400 + height: 500 + radius: 7 + pen.color: "black" + id: Page + Image { + x: 10 + y: 10 + source: "cork.jpg" + opaque: true + } + Text { + x: 20 + y: 20 + height: 40 + font.size: 14 + font.bold: true + width: 370 + text: day + style: "Outline" + styleColor: "#dedede" + } +} diff --git a/tests/auto/declarative/visual/flickable/flickable.qml b/tests/auto/declarative/visual/flickable/flickable.qml new file mode 100644 index 0000000..5946c40 --- /dev/null +++ b/tests/auto/declarative/visual/flickable/flickable.qml @@ -0,0 +1,53 @@ +Rect { + color: "lightSteelBlue" + width: 800 + height: 500 + ListModel { + id: List + ListElement { + name: "Sunday" + dayColor: "#808080" + } + ListElement { + name: "Monday" + dayColor: "blue" + } + ListElement { + name: "Tuesday" + dayColor: "yellow" + } + ListElement { + name: "Wednesday" + dayColor: "purple" + } + ListElement { + name: "Thursday" + dayColor: "blue" + } + ListElement { + name: "Friday" + dayColor: "green" + } + ListElement { + name: "Saturday" + dayColor: "orange" + } + } + Flickable { + id: Flick + anchors.fill: parent + viewportWidth: Lay.width + HorizontalLayout { + id: Lay + Repeater { + dataSource: List + Component { + Day { + day: name + color: dayColor + } + } + } + } + } +} diff --git a/tests/auto/declarative/visual/flickable/flickable.xml b/tests/auto/declarative/visual/flickable/flickable.xml deleted file mode 100644 index 78bf42f..0000000 --- a/tests/auto/declarative/visual/flickable/flickable.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - Sunday - #808080 - - - Monday - blue - - - Tuesday - yellow - - - Wednesday - purple - - - Thursday - blue - - - Friday - green - - - Saturday - orange - - - - - - - - - - - - - - diff --git a/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml b/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml new file mode 100644 index 0000000..5c00f58 --- /dev/null +++ b/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml @@ -0,0 +1,28 @@ +Rect { + id: rect + width: 120 + height: 200 + color: "white" + Image { + id: img + source: "pics/qtlogo.png" + x: 60-width/2 + y: 200-height + y: SequentialAnimation { + running: true + repeat: true + NumericAnimation { + to: 0; duration: 500 + easing: "easeInOutQuad" + } + NumericAnimation { + to: 200-img.height + easing: "easeOutBounce" + duration: 2000 + } + PauseAnimation { + duration: 1000 + } + } + } +} diff --git a/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.xml b/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.xml deleted file mode 100644 index bb411e2..0000000 --- a/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/tests/auto/declarative/visual/qfxtext/elide/elide.qml b/tests/auto/declarative/visual/qfxtext/elide/elide.qml new file mode 100644 index 0000000..23e6885 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/elide/elide.qml @@ -0,0 +1,33 @@ +Rect { + width: contents.width + height: contents.height + VerticalLayout { + width: 80 + height: Text.height*4 + Text { + elide: "ElideLeft" + text: "aaa bbb ccc ddd eee fff" + width: 80 + color: "white" + id: Text + } + Text { + elide: "ElideMiddle" + text: "aaa bbb ccc ddd eee fff" + width: 80 + color: "white" + } + Text { + elide: "ElideRight" + text: "aaa bbb ccc ddd eee fff" + width: 80 + color: "white" + } + Text { + elide: "ElideNone" + text: "aaa bbb ccc ddd eee fff" + width: 80 + color: "white" + } + } +} diff --git a/tests/auto/declarative/visual/qfxtext/elide/elide.xml b/tests/auto/declarative/visual/qfxtext/elide/elide.xml deleted file mode 100644 index 398da82..0000000 --- a/tests/auto/declarative/visual/qfxtext/elide/elide.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/auto/declarative/visual/repeater/basic1/basic1.qml b/tests/auto/declarative/visual/repeater/basic1/basic1.qml new file mode 100644 index 0000000..3c66508 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic1/basic1.qml @@ -0,0 +1,26 @@ +Rect { + color: "blue" + width: 800 + height: 600 + id: Page + HorizontalLayout { + Repeater { + component: Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + dataSource: ListModel { + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + } + } +} diff --git a/tests/auto/declarative/visual/repeater/basic1/basic1.xml b/tests/auto/declarative/visual/repeater/basic1/basic1.xml deleted file mode 100644 index def809f..0000000 --- a/tests/auto/declarative/visual/repeater/basic1/basic1.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - January - - - February - - - - - - diff --git a/tests/auto/declarative/visual/repeater/basic2/basic2.qml b/tests/auto/declarative/visual/repeater/basic2/basic2.qml new file mode 100644 index 0000000..1228be8 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic2/basic2.qml @@ -0,0 +1,30 @@ +Rect { + color: "blue" + width: 800 + height: 600 + id: Page + Component { + id: Delegate + Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } + HorizontalLayout { + Repeater { + component: Delegate + dataSource: ListModel { + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + } + } +} diff --git a/tests/auto/declarative/visual/repeater/basic2/basic2.xml b/tests/auto/declarative/visual/repeater/basic2/basic2.xml deleted file mode 100644 index b16fbfe..0000000 --- a/tests/auto/declarative/visual/repeater/basic2/basic2.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - January - - - February - - - - - - diff --git a/tests/auto/declarative/visual/repeater/basic3/basic3.qml b/tests/auto/declarative/visual/repeater/basic3/basic3.qml new file mode 100644 index 0000000..7b8b9ef --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic3/basic3.qml @@ -0,0 +1,28 @@ +Rect { + color: "blue" + width: 800 + height: 600 + id: Page + ListModel { + id: DataSource + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + HorizontalLayout { + Repeater { + dataSource: DataSource + component: Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } + } +} diff --git a/tests/auto/declarative/visual/repeater/basic3/basic3.xml b/tests/auto/declarative/visual/repeater/basic3/basic3.xml deleted file mode 100644 index 1135f16..0000000 --- a/tests/auto/declarative/visual/repeater/basic3/basic3.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - January - - - February - - - - - - - - - - - - diff --git a/tests/auto/declarative/visual/repeater/basic4/basic4.qml b/tests/auto/declarative/visual/repeater/basic4/basic4.qml new file mode 100644 index 0000000..2111c24 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic4/basic4.qml @@ -0,0 +1,32 @@ +Rect { + color: "blue" + width: 800 + height: 600 + id: Page + ListModel { + id: DataSource + ListElement { + name: "January" + } + ListElement { + name: "February" + } + } + Component { + id: Delegate + Rect { + color: "red" + width: 100 + height: 100 + Text { + text: name + } + } + } + HorizontalLayout { + Repeater { + dataSource: DataSource + component: Delegate + } + } +} diff --git a/tests/auto/declarative/visual/repeater/basic4/basic4.xml b/tests/auto/declarative/visual/repeater/basic4/basic4.xml deleted file mode 100644 index 53b8ff9..0000000 --- a/tests/auto/declarative/visual/repeater/basic4/basic4.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - January - - - February - - - - - - - - - - - diff --git a/tests/auto/declarative/visual/runtests.sh b/tests/auto/declarative/visual/runtests.sh index f690381..4380884 100755 --- a/tests/auto/declarative/visual/runtests.sh +++ b/tests/auto/declarative/visual/runtests.sh @@ -1,2 +1,3 @@ #!/bin/sh +export QFX_USE_SIMPLECANVAS=1 for a in `cat tests`; do ./tst_visual -testdir $a; done -- cgit v0.12 From de01908d736b407e4d230e4360de5515d5fccf43 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 21 May 2009 11:50:49 +1000 Subject: Fix Contents --- src/declarative/fx/qfxitem.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 3cbcd6a..17fe36a 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -197,8 +197,10 @@ void QFxContents::setItem(QFxItem *item) const QList &children = _item->QSimpleCanvasItem::children(); for (int i = 0; i < children.count(); ++i) { const QSimpleCanvasItem *child = children.at(i); - connect(child, SIGNAL(bottomChanged()), this, SLOT(calcHeight())); - connect(child, SIGNAL(rightChanged()), this, SLOT(calcWidth())); + connect(child, SIGNAL(heightChanged()), this, SLOT(calcHeight())); + connect(child, SIGNAL(topChanged()), this, SLOT(calcHeight())); + connect(child, SIGNAL(widthChanged()), this, SLOT(calcWidth())); + connect(child, SIGNAL(leftChanged()), this, SLOT(calcWidth())); } calcHeight(); -- cgit v0.12 From 69b6c7f5bb5ca2cd2ddc625d49d5b39075dc833b Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 21 May 2009 11:51:18 +1000 Subject: Make bouncing work in follow example. --- examples/declarative/follow/follow.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/declarative/follow/follow.qml b/examples/declarative/follow/follow.qml index 5368e75..3258ea6 100644 --- a/examples/declarative/follow/follow.qml +++ b/examples/declarative/follow/follow.qml @@ -8,8 +8,12 @@ Rect { y: SequentialAnimation { running: true; repeat: true NumericAnimation { + to: 20; duration: 500 + easing: "easeInOutQuad" + } + NumericAnimation { to: 200; duration: 2000 - easing: "easeOutBounce(amplitude:180)" + easing: "easeOutBounce" } PauseAnimation { duration: 1000 } } -- cgit v0.12 From a3f784dd8c49a4edf1a22d68d435e29ceaf71c2d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 21 May 2009 15:32:35 +1000 Subject: Use QWidget as the TLW. It is basically impossible to make QMainWindow size the contents to the exact size wanted. Correct sizing is particularly important for visual test recording. --- tools/qmlviewer/qmlviewer.cpp | 35 +++++++++++++++++++++++++++-------- tools/qmlviewer/qmlviewer.h | 6 ++++-- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 4b0a83a..0417539 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -124,7 +124,7 @@ void PreviewDeviceSkin::slotPopupMenu() QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, QWidget *parent, Qt::WindowFlags flags) - : QMainWindow(parent, flags), frame_stream(0), scaleSkin(true) + : QWidget(parent, flags), frame_stream(0), scaleSkin(true), mb(0) { testEngine = 0; devicemode = false; @@ -133,12 +133,12 @@ QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, Q record_autotime = 0; record_period = 20; - setAttribute(Qt::WA_OpaquePaintEvent); - setAttribute(Qt::WA_NoSystemBackground); if (!(flags & Qt::FramelessWindowHint)) createMenu(menuBar(),0); canvas = new QFxView(this); + canvas->setAttribute(Qt::WA_OpaquePaintEvent); + canvas->setAttribute(Qt::WA_NoSystemBackground); canvas->setContentResizable(!skin || !scaleSkin); if(testMode != QFxTestEngine::NoTest) @@ -146,17 +146,31 @@ QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, Q QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); - setCentralWidget(canvas); + QVBoxLayout *layout = new QVBoxLayout; + layout->setMargin(0); + layout->setSpacing(0); + setLayout(layout); + if (mb) + layout->addWidget(mb); + layout->addWidget(canvas); +} + +QMenuBar *QmlViewer::menuBar() const +{ + if (!mb) + mb = new QMenuBar((QWidget*)this); + + return mb; } QSize QmlViewer::sizeHint() const { if (skin) - return QMainWindow::sizeHint(); + return QWidget::sizeHint(); else { // Kludge to force QMainWindow to be EXACTLY the right size for the canvas. QSize sh = canvas->sizeHint(); - sh.setHeight(sh.height()+menuBar()->sizeHint().height()+1); + sh.setHeight(sh.height()+menuBar()->sizeHint().height()); return sh; } } @@ -252,6 +266,8 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); fileMenu->addSeparator(); fileMenu->addAction(quitAction); + if (menu) + menu->setFixedHeight(menu->sizeHint().height()); } void QmlViewer::setScaleSkin() @@ -419,7 +435,9 @@ void QmlViewer::setSkin(const QString& skinDirectory) DeviceSkinParameters parameters; if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { layout()->setEnabled(false); - setMenuBar(0); + //setMenuBar(0); + if (mb) + mb->hide(); if (!err.isEmpty()) qWarning() << err; skin = new PreviewDeviceSkin(parameters,this); @@ -436,6 +454,7 @@ void QmlViewer::setSkin(const QString& skinDirectory) menuBar()->clear(); canvas->setParent(this, Qt::SubWindow); createMenu(menuBar(),0); + mb->show(); setMinimumSize(QSize(0,0)); setMaximumSize(QSize(16777215,16777215)); canvas->setMinimumSize(QSize(0,0)); @@ -443,7 +462,7 @@ void QmlViewer::setSkin(const QString& skinDirectory) QRect g = geometry(); g.setSize(sizeHint()); setParent(0,windowFlags()); // recreate - canvas->move(0,menuBar()->sizeHint().height()+1); + canvas->move(0,menuBar()->sizeHint().height()); setGeometry(g); layout()->setEnabled(true); show(); diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index 967af49..04d94cc 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -14,7 +14,7 @@ #ifndef QMLVIEWER_H #define QMLVIEWER_H -#include +#include #include #include #include @@ -26,7 +26,7 @@ class PreviewDeviceSkin; class QFxTestEngine; class QProcess; -class QmlViewer : public QMainWindow +class QmlViewer : public QWidget { Q_OBJECT public: @@ -45,6 +45,7 @@ public: void addLibraryPath(const QString& lib); QSize sizeHint() const; + QMenuBar *menuBar() const; public slots: void sceneResized(QSize size); @@ -87,6 +88,7 @@ private: QAction *recordAction; QString currentSkin; bool scaleSkin; + mutable QMenuBar *mb; QFxTestEngine *testEngine; }; -- cgit v0.12 From 479ea0cf60fe8a0e5fd0ac37b4602a495faa22fd Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 21 May 2009 16:59:17 +1000 Subject: Get visual auto testing working again. --- src/declarative/test/qfxtestengine.cpp | 54 ++- src/declarative/test/qfxtestobjects.cpp | 84 ++-- src/declarative/test/qfxtestobjects.h | 12 +- src/declarative/test/qfxtestview.cpp | 3 + tests/auto/declarative/listview/tst_listview.cpp | 14 +- .../visual/bindinganimation/bindinganimation.qml | 2 +- .../visual/bindinganimation/data/opengl/image0.png | Bin 817 -> 0 bytes .../bindinganimation/data/opengl/manifest-play.xml | 104 ---- .../bindinganimation/data/opengl/manifest.xml | 104 ---- .../visual/bindinganimation/data/raster/image0.png | Bin 0 -> 817 bytes .../bindinganimation/data/raster/manifest.qml | 86 ++++ .../visual/colorAnimation/colorAnimation.qml | 1 + .../visual/colorAnimation/data/raster/image0.png | Bin 0 -> 607 bytes .../visual/colorAnimation/data/raster/manifest.qml | 522 +++++++++++++++++++++ .../visual/colorAnimation/data/raster/manifest.xml | 522 +++++++++++++++++++++ .../declarative/visual/colorAnimation/image0.png | Bin 947 -> 0 bytes .../declarative/visual/colorAnimation/manifest.xml | 73 --- tests/auto/declarative/visual/tst_visual.cpp | 4 +- 18 files changed, 1227 insertions(+), 358 deletions(-) delete mode 100644 tests/auto/declarative/visual/bindinganimation/data/opengl/image0.png delete mode 100644 tests/auto/declarative/visual/bindinganimation/data/opengl/manifest-play.xml delete mode 100644 tests/auto/declarative/visual/bindinganimation/data/opengl/manifest.xml create mode 100644 tests/auto/declarative/visual/bindinganimation/data/raster/image0.png create mode 100644 tests/auto/declarative/visual/bindinganimation/data/raster/manifest.qml create mode 100644 tests/auto/declarative/visual/colorAnimation/data/raster/image0.png create mode 100644 tests/auto/declarative/visual/colorAnimation/data/raster/manifest.qml create mode 100644 tests/auto/declarative/visual/colorAnimation/data/raster/manifest.xml delete mode 100644 tests/auto/declarative/visual/colorAnimation/image0.png delete mode 100644 tests/auto/declarative/visual/colorAnimation/manifest.xml diff --git a/src/declarative/test/qfxtestengine.cpp b/src/declarative/test/qfxtestengine.cpp index 70e600d..0d7e5df 100644 --- a/src/declarative/test/qfxtestengine.cpp +++ b/src/declarative/test/qfxtestengine.cpp @@ -62,7 +62,7 @@ class QFxTestEnginePrivate : public QAbstractAnimation { public: QFxTestEnginePrivate(QFxTestEngine *p) - : q(p), canvas(0), testMode(QFxTestEngine::NoTest), fullFrame(true), + : q(p), canvas(0), testMode(QFxTestEngine::NoTest), fullFrame(true), status(Working), exitOnFail(true), mismatchedFrames(0), lastFrameMismatch(false) {} @@ -106,20 +106,25 @@ public: bool compare(const QImage &img1, const QImage &img2); virtual int duration() const { return -1; } + + int elapsed() { return currentTime(); } }; bool QFxTestEnginePrivate::compare(const QImage &img1, const QImage &img2) { - if (img1.size() != img2.size()) + if (img1.size() != img2.size()) { + qWarning() << "Image size mismatch" << img1.size() << img2.size(); return false; + } int errorCount = 0; for (int yy = 0; yy < img1.height(); ++yy) { for (int xx = 0; xx < img1.width(); ++xx) { if (img1.pixel(xx, yy) != img2.pixel(xx, yy)) { errorCount++; - if (errorCount > MAX_MISMATCHED_PIXELS) + if (errorCount > MAX_MISMATCHED_PIXELS) { return false; + } } } } @@ -142,7 +147,7 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir, qWarning("QFxTestEngine: Record ON"); } else if (d->testMode == PlaybackTest) { - QString fileName(d->testDirectory + QLatin1String("/manifest.xml")); + QString fileName(d->testDirectory + QLatin1String("/manifest.qml")); QFile f(fileName); if (!f.open(QIODevice::ReadOnly)) { qWarning() << "QFxTestEngine: Unable to open file" << fileName; @@ -150,13 +155,13 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir, } QByteArray data = f.readAll(); - QmlComponent c(&d->engine, data, QUrl(d->testDirectory + QLatin1String("/manifest.xml"))); + QmlComponent c(&d->engine, data, QUrl(d->testDirectory + QLatin1String("/manifest.qml"))); QObject *o = c.create(); TestLog *log = qobject_cast(o); if (log) { log->setParent(this); d->playbackTestData.actions() = log->actions(); - qWarning("QFxTestEngine: Playback ON"); + qWarning() << "QFxTestEngine: Playback ON," << d->playbackTestData.actions().count() << "actions"; } else { delete o; qWarning() << "QFxTestEngine: File" << fileName << "is corrupt."; @@ -165,7 +170,6 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir, } if (d->testMode != NoTest) { - QUnifiedTimer::instance()->setConsistentTiming(true); QObject::connect(canvas, SIGNAL(framePainted()), this, SLOT(framePainted())); @@ -173,7 +177,7 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir, canvas->installEventFilter(this); for (int ii = 0; ii < d->playbackTestData.actions().count(); ++ii) { TestObject *o = d->playbackTestData.actions().at(ii); - if (TestMouse *m = qobject_cast(o)) + if (TestMouse *m = qobject_cast(o)) d->toPost << m; else if (TestKey *k = qobject_cast(o)) d->toPost << k; @@ -201,7 +205,7 @@ void QFxTestEngine::framePainted() void QFxTestEnginePrivate::recordFullFrameEvent(const QImage &img) { TestFullFrame *ff = new TestFullFrame(q); - ff->setTime(QUnifiedTimer::instance()->elapsedTime()); + ff->setTime(elapsed()); ff->setFrameId(fullFrames.count()); fullFrames << img; @@ -211,7 +215,8 @@ void QFxTestEnginePrivate::recordFullFrameEvent(const QImage &img) TestFullFrame *pf = qobject_cast(playbackTestData.next()); QString filename = testDirectory + QLatin1String("/image") + QString::number(pf->frameId()) + QLatin1String(".png"); QImage recImg(filename); - if (!pf || !compare(recImg, img) || pf->time() != QUnifiedTimer::instance()->elapsedTime()) { + if (!pf || !compare(recImg, img) || pf->time() != elapsed()) { + qDebug() << pf << pf->time() << elapsed(); message(Fail, "FFrame mismatch"); } else { message(Success, "FFrame OK"); @@ -249,14 +254,14 @@ void QFxTestEnginePrivate::recordFrameEvent(const QImage &img) hexResult.append(toHex(result.at(ii))); TestFrame *f = new TestFrame(q); - f->setTime(QUnifiedTimer::instance()->elapsedTime()); + f->setTime(elapsed()); f->setHash(QLatin1String(hexResult)); testData.actions() << f; if (testMode == QFxTestEngine::PlaybackTest) { TestObject *o = playbackTestData.next(); TestFrame *f = qobject_cast(o); - if (!f || f->time() != QUnifiedTimer::instance()->elapsedTime() || + if (!f || f->time() != elapsed() || f->hash() != QLatin1String(hexResult)) { mismatchedFrames++; if (mismatchedFrames > MAX_MISMATCHED_FRAMES || @@ -280,14 +285,13 @@ void QFxTestEnginePrivate::updateCurrentTime(int) return; while(!toPost.isEmpty()) { - int t = QUnifiedTimer::instance()->elapsedTime(); + int t = elapsed(); TestObject *o = toPost.first(); if (testMode == QFxTestEngine::RecordTest) o->setTime(t); else if (o->time() != t) return; toPost.takeFirst(); - if (TestMouse *m = qobject_cast(o)) { QMouseEvent e((QEvent::Type)m->type(), m->pos(), m->globalPos(), (Qt::MouseButton)m->button(), (Qt::MouseButtons)m->buttons(), (Qt::KeyboardModifiers)0); postedEvents.insert(&e); @@ -336,7 +340,7 @@ bool QFxTestEngine::eventFilter(QObject *, QEvent *event) void QFxTestEnginePrivate::recordMouseEvent(QMouseEvent *e) { TestMouse *m = new TestMouse(q); - m->setTime(QUnifiedTimer::instance()->elapsedTime()); + m->setTime(elapsed()); m->setType(e->type()); m->setButton(e->button()); m->setButtons(e->buttons()); @@ -346,14 +350,16 @@ void QFxTestEnginePrivate::recordMouseEvent(QMouseEvent *e) if (testMode == QFxTestEngine::PlaybackTest) { TestMouse *m = qobject_cast(playbackTestData.next()); - if (!m || m->time() != QUnifiedTimer::instance()->elapsedTime() || + if (!m || m->time() != elapsed() || m->type() != e->type() || m->button() != e->button() || m->buttons() != e->buttons() || - m->globalPos() != e->globalPos() || - m->pos() != e->pos()) +// m->globalPos() != e->globalPos() || + m->pos() != e->pos()) { + if (m) + qWarning() << m->time() << elapsed(); message(Fail, "Mouse mismatch"); - else + } else message(Success, "Mouse OK"); testPass(); @@ -366,7 +372,7 @@ void QFxTestEnginePrivate::recordMouseEvent(QMouseEvent *e) void QFxTestEnginePrivate::recordKeyEvent(QKeyEvent *e) { TestKey *k = new TestKey(q); - k->setTime(QUnifiedTimer::instance()->elapsedTime()); + k->setTime(elapsed()); k->setType(e->type()); k->setModifiers(e->QInputEvent::modifiers()); k->setText(e->text()); @@ -374,7 +380,7 @@ void QFxTestEnginePrivate::recordKeyEvent(QKeyEvent *e) testData.actions() << k; if (testMode == QFxTestEngine::PlaybackTest) { TestKey *f = qobject_cast(playbackTestData.next()); - if (!f || f->time() != QUnifiedTimer::instance()->elapsedTime() || + if (!f || f->time() != elapsed() || f->type() != e->type() || f->modifiers() != e->QInputEvent::modifiers() || f->text() != e->text() || @@ -400,7 +406,7 @@ void QFxTestEnginePrivate::message(MessageType t, const char *message) qWarning("%s", message); if (t == Fail) { if (exitOnFail) { - save(QLatin1String("manifest-fail.xml"), false); + save(QLatin1String("manifest-fail.qml"), false); qFatal("Failed"); } else { status = Failed; @@ -428,7 +434,7 @@ void QFxTestEngine::save() if (d->testMode != RecordTest) return; - d->save(QLatin1String("manifest.xml")); + d->save(QLatin1String("manifest.qml")); } void QFxTestEnginePrivate::testPass() @@ -436,7 +442,7 @@ void QFxTestEnginePrivate::testPass() if (playbackTestData.atEnd()) { qWarning("Test PASSED"); if (exitOnFail) { - save(QLatin1String("manifest-play.xml")); + save(QLatin1String("manifest-play.qml")); exit(0); } else { status = Passed; diff --git a/src/declarative/test/qfxtestobjects.cpp b/src/declarative/test/qfxtestobjects.cpp index be1ab07..905e83e 100644 --- a/src/declarative/test/qfxtestobjects.cpp +++ b/src/declarative/test/qfxtestobjects.cpp @@ -42,7 +42,8 @@ #include "qfxtestobjects.h" #include -#include +#include +#include QT_BEGIN_NAMESPACE @@ -59,6 +60,14 @@ QML_DEFINE_TYPE(TestKey,TestKey); QML_DECLARE_TYPE(TestLog); QML_DEFINE_TYPE(TestLog,TestLog); +static QString padding(int pad) +{ + QString p; + while (pad--) + p += QLatin1Char(' '); + return p; +} + TestObject::TestObject(QObject *parent) : QObject(parent), _time(-1) { @@ -77,11 +86,11 @@ void TestObject::setTime(int t) emit dataChanged(); } -void TestObject::save(QXmlStreamWriter *device) +void TestObject::save(QTextStream &device, int pad) { - device->writeStartElement(QLatin1String("TestObject")); - device->writeAttribute(QLatin1String("time"), QString::number(time())); - device->writeEndElement(); + device << padding(pad) << QLatin1String("TestObject {") << endl; + device << padding(pad) << QLatin1String("time: ") << QString::number(time()) << endl; + device << padding(pad) << QLatin1String("}") << endl; } @@ -103,12 +112,12 @@ void TestFrame::setHash(const QString &h) emit frameChanged(); } -void TestFrame::save(QXmlStreamWriter *device) +void TestFrame::save(QTextStream &device, int pad) { - device->writeStartElement(QLatin1String("TestFrame")); - device->writeAttribute(QLatin1String("time"), QLatin1String(QByteArray::number(time()))); - device->writeAttribute(QLatin1String("hash"), hash()); - device->writeEndElement(); + device << padding(pad) << QLatin1String("TestFrame {") << endl; + device << padding(pad+4) << QLatin1String("time: ") << QLatin1String(QByteArray::number(time())) << endl; + device << padding(pad+4)<< QLatin1String("hash: '") << hash() << QLatin1String("'") << endl; + device << padding(pad) << QLatin1Char('}') << endl; } TestFullFrame::TestFullFrame(QObject *parent) @@ -129,12 +138,12 @@ void TestFullFrame::setFrameId(int id) emit frameChanged(); } -void TestFullFrame::save(QXmlStreamWriter *device) +void TestFullFrame::save(QTextStream &device, int pad) { - device->writeStartElement(QLatin1String("TestFullFrame")); - device->writeAttribute(QLatin1String("time"), QLatin1String(QByteArray::number(time()))); - device->writeAttribute(QLatin1String("frameId"), QLatin1String(QByteArray::number(frameId()))); - device->writeEndElement(); + device << padding(pad) << QLatin1String("TestFullFrame {") << endl; + device << padding(pad+4) << QLatin1String("time: ") << QLatin1String(QByteArray::number(time())) << endl; + device << padding(pad+4) << QLatin1String("frameId: ") << QLatin1String(QByteArray::number(frameId())) << endl; + device << padding(pad) << padding(pad) << QLatin1String("}") << endl; } TestMouse::TestMouse(QObject *parent) @@ -207,16 +216,16 @@ void TestMouse::setPos(const QPoint &p) emit mouseChanged(); } -void TestMouse::save(QXmlStreamWriter *device) +void TestMouse::save(QTextStream &device, int pad) { - device->writeStartElement(QLatin1String("TestMouse")); - device->writeAttribute(QLatin1String("time"), QString::number(time())); - device->writeAttribute(QLatin1String("type"), QString::number(type())); - device->writeAttribute(QLatin1String("button"), QString::number(button())); - device->writeAttribute(QLatin1String("buttons"), QString::number(buttons())); - device->writeAttribute(QLatin1String("globalPos"), QString::number(globalPos().x()) + QLatin1String(",") + QString::number(globalPos().y())); - device->writeAttribute(QLatin1String("pos"), QString::number(pos().x()) + QLatin1String(",") + QString::number(pos().y())); - device->writeEndElement(); + device << padding(pad) << QLatin1String("TestMouse {") << endl; + device << padding(pad+4) << QLatin1String("time: ") << QString::number(time()) << endl; + device << padding(pad+4) << QLatin1String("type: ") << QString::number(type()) << endl; + device << padding(pad+4) << QLatin1String("button: ") << QString::number(button()) << endl; + device << padding(pad+4) << QLatin1String("buttons: ") << QString::number(buttons()) << endl; + device << padding(pad+4) << QLatin1String("globalPos: '") << QString::number(globalPos().x()) + QLatin1String(",") + QString::number(globalPos().y()) << QLatin1String("'") << endl; + device << padding(pad+4) << QLatin1String("pos: '") << QString::number(pos().x()) + QLatin1String(",") + QString::number(pos().y()) << QLatin1String("'") << endl; + device << padding(pad) << QLatin1String("}") << endl; } TestKey::TestKey(QObject *parent) @@ -276,16 +285,16 @@ void TestKey::setKey(int k) emit keyChanged(); } -void TestKey::save(QXmlStreamWriter *device) +void TestKey::save(QTextStream &device, int pad) { - device->writeStartElement(QLatin1String("TestKey")); - device->writeAttribute(QLatin1String("time"), QString::number(time())); - device->writeAttribute(QLatin1String("type"), QString::number(type())); - device->writeAttribute(QLatin1String("modifiers"), QString::number(modifiers())); - device->writeAttribute(QLatin1String("key"), QString::number(key())); + device << padding(pad) << QLatin1String("TestKey {") << endl; + device << padding(pad+4) << QLatin1String("time: ") << QString::number(time()) << endl; + device << padding(pad+4) << QLatin1String("type: ") << QString::number(type()) << endl; + device << padding(pad+4) << QLatin1String("modifiers: ") << QString::number(modifiers()) << endl; + device << padding(pad+4) << QLatin1String("key: ") << QString::number(key()) << endl; if (key() != Qt::Key_Escape) - device->writeAttribute(QLatin1String("text"), text()); - device->writeEndElement(); + device << padding(pad+4) << QLatin1String("text: '") << text() << QLatin1String("'")<< endl; + device << padding(pad) << QLatin1String("}") << endl; } TestLog::TestLog(QObject *parent) @@ -313,14 +322,11 @@ void TestLog::save(QIODevice *device) // Order correctly qStableSort(_actions.begin(), _actions.end(), lessThan); - QXmlStreamWriter writer(device); - writer.setAutoFormatting(true); - writer.writeStartDocument(QLatin1String("1.0")); - writer.writeStartElement(QLatin1String("TestLog")); + QTextStream writer(device); + writer << QLatin1String("TestLog {") << endl; for (int ii = 0; ii < _actions.count(); ++ii) - _actions.at(ii)->save(&writer); - writer.writeEndElement(); - writer.writeEndDocument(); + _actions.at(ii)->save(writer, 4); + writer << QLatin1String("}") << endl; } TestObject *TestLog::next() diff --git a/src/declarative/test/qfxtestobjects.h b/src/declarative/test/qfxtestobjects.h index 653656e..de4d94b 100644 --- a/src/declarative/test/qfxtestobjects.h +++ b/src/declarative/test/qfxtestobjects.h @@ -45,7 +45,7 @@ #include #include #include -#include +#include QT_BEGIN_HEADER @@ -64,7 +64,7 @@ public: int time() const; void setTime(int); - virtual void save(QXmlStreamWriter *); + virtual void save(QTextStream &, int pad); Q_SIGNALS: void dataChanged(); @@ -82,7 +82,7 @@ public: QString hash() const; void setHash(const QString &); - virtual void save(QXmlStreamWriter *); + virtual void save(QTextStream &, int pad); Q_SIGNALS: void frameChanged(); @@ -100,7 +100,7 @@ public: int frameId() const; void setFrameId(int); - virtual void save(QXmlStreamWriter *); + virtual void save(QTextStream &, int pad); Q_SIGNALS: void frameChanged(); @@ -134,7 +134,7 @@ public: QPoint pos() const; void setPos(const QPoint &); - virtual void save(QXmlStreamWriter *); + virtual void save(QTextStream &, int pad); Q_SIGNALS: void mouseChanged(); @@ -169,7 +169,7 @@ public: int key() const; void setKey(int); - virtual void save(QXmlStreamWriter *); + virtual void save(QTextStream &, int pad); Q_SIGNALS: void keyChanged(); diff --git a/src/declarative/test/qfxtestview.cpp b/src/declarative/test/qfxtestview.cpp index 94bcb30..0bd5a6b 100644 --- a/src/declarative/test/qfxtestview.cpp +++ b/src/declarative/test/qfxtestview.cpp @@ -57,6 +57,7 @@ QFxTestView::QFxTestView(const QString &filename, const QString &testdir) testEngine = new QFxTestEngine(QFxTestEngine::PlaybackTest, testdir, this, this); + qWarning() << "Testing:" << filename; QFile file(filename); file.open(QFile::ReadOnly); QString qml = QString::fromUtf8(file.readAll()); @@ -67,6 +68,8 @@ QFxTestView::QFxTestView(const QString &filename, const QString &testdir) void QFxTestView::setSceneSize(QSize s) { + if (s.isNull()) + qWarning() << "Scene size is invalid"; setFixedSize(s); } diff --git a/tests/auto/declarative/listview/tst_listview.cpp b/tests/auto/declarative/listview/tst_listview.cpp index 25f546a..8cf0a85 100644 --- a/tests/auto/declarative/listview/tst_listview.cpp +++ b/tests/auto/declarative/listview/tst_listview.cpp @@ -169,7 +169,7 @@ tst_QFxListView::tst_QFxListView() template void tst_QFxListView::items() { - QFxView *canvas = createView(SRCDIR "/data/listview.xml"); + QFxView *canvas = createView(SRCDIR "/data/listview.qml"); T model; model.addItem("Fred", "12345"); @@ -205,7 +205,7 @@ void tst_QFxListView::items() template void tst_QFxListView::changed() { - QFxView *canvas = createView(SRCDIR "/data/listview.xml"); + QFxView *canvas = createView(SRCDIR "/data/listview.qml"); T model; model.addItem("Fred", "12345"); @@ -238,7 +238,7 @@ void tst_QFxListView::changed() template void tst_QFxListView::inserted() { - QFxView *canvas = createView(SRCDIR "/data/listview.xml"); + QFxView *canvas = createView(SRCDIR "/data/listview.qml"); T model; model.addItem("Fred", "12345"); @@ -305,7 +305,7 @@ void tst_QFxListView::inserted() template void tst_QFxListView::removed() { - QFxView *canvas = createView(SRCDIR "/data/listview.xml"); + QFxView *canvas = createView(SRCDIR "/data/listview.qml"); T model; for (int i = 0; i < 30; i++) @@ -445,8 +445,8 @@ QFxView *tst_QFxListView::createView(const QString &filename) QFile file(filename); file.open(QFile::ReadOnly); - QString xml = file.readAll(); - canvas->setQml(xml, filename); + QString qml = file.readAll(); + canvas->setQml(qml, filename); return canvas; } @@ -459,8 +459,10 @@ template T *tst_QFxListView::findItem(QFxItem *parent, const QString &id, int index) { const QMetaObject &mo = T::staticMetaObject; + qDebug() << parent->children()->count() << "children"; for (int i = 0; i < parent->children()->count(); ++i) { QFxItem *item = parent->children()->at(i); + qDebug() << "try" << item; if (mo.cast(item) && (id.isEmpty() || item->id() == id)) { if (index != -1) { QmlExpression e(qmlContext(item), "index", item); diff --git a/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml index 56878dc..61cedc2 100644 --- a/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml +++ b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml @@ -35,6 +35,6 @@ Rect { MouseRegion { id: MyMouseRegion anchors.fill: parent - onClicked: { Page.currentState= 'hello' } + onClicked: { Page.state= 'hello' } } } diff --git a/tests/auto/declarative/visual/bindinganimation/data/opengl/image0.png b/tests/auto/declarative/visual/bindinganimation/data/opengl/image0.png deleted file mode 100644 index 2cda3fa..0000000 Binary files a/tests/auto/declarative/visual/bindinganimation/data/opengl/image0.png and /dev/null differ diff --git a/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest-play.xml b/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest-play.xml deleted file mode 100644 index 6c5856f..0000000 --- a/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest-play.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest.xml b/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest.xml deleted file mode 100644 index 6c5856f..0000000 --- a/tests/auto/declarative/visual/bindinganimation/data/opengl/manifest.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/auto/declarative/visual/bindinganimation/data/raster/image0.png b/tests/auto/declarative/visual/bindinganimation/data/raster/image0.png new file mode 100644 index 0000000..92f8cdd Binary files /dev/null and b/tests/auto/declarative/visual/bindinganimation/data/raster/image0.png differ diff --git a/tests/auto/declarative/visual/bindinganimation/data/raster/manifest.qml b/tests/auto/declarative/visual/bindinganimation/data/raster/manifest.qml new file mode 100644 index 0000000..1454949 --- /dev/null +++ b/tests/auto/declarative/visual/bindinganimation/data/raster/manifest.qml @@ -0,0 +1,86 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } + TestMouse { + time: 1296 + type: 2 + button: 1 + buttons: 1 + globalPos: '87,985' + pos: '83,29' + } + TestMouse { + time: 1360 + type: 3 + button: 1 + buttons: 0 + globalPos: '87,985' + pos: '83,29' + } + TestFrame { + time: 1376 + hash: '7CB5FC371040E587DE9F06CE14A4B29A' + } + TestFrame { + time: 1392 + hash: 'A5E5DBD179C7E48D34B8107F8CC6B5BE' + } + TestFrame { + time: 1408 + hash: 'A5E5DBD179C7E48D34B8107F8CC6B5BE' + } + TestFrame { + time: 1424 + hash: '69FB651AA84E07E4A6DEAA31CB10641B' + } + TestFrame { + time: 1440 + hash: '3FFC4C4BD282010A359DCEAF2D8496AC' + } + TestFrame { + time: 1456 + hash: '3FFC4C4BD282010A359DCEAF2D8496AC' + } + TestFrame { + time: 1472 + hash: 'ADA58B13247A654BBCECF3F254AB797F' + } + TestFrame { + time: 1488 + hash: 'B314799BC732B6BD8C42A622B720E3D5' + } + TestFrame { + time: 1504 + hash: 'B314799BC732B6BD8C42A622B720E3D5' + } + TestFrame { + time: 1520 + hash: '7377569C13CF5DE368B22209AB8AE395' + } + TestFrame { + time: 1536 + hash: '7C1E4A1F80C68EE57D052A9D7851F937' + } + TestFrame { + time: 1552 + hash: '7C1E4A1F80C68EE57D052A9D7851F937' + } + TestFrame { + time: 1568 + hash: '24D6DB9544205075836A86A54B55A820' + } + TestFrame { + time: 1584 + hash: '24D6DB9544205075836A86A54B55A820' + } + TestFrame { + time: 1600 + hash: '8A84E4C3E8AD4C6A9A7BD3E1620718C1' + } + TestFrame { + time: 1616 + hash: 'B8EA544A4EF3B7E0A9E0A7777B55EDC7' + } +} diff --git a/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml b/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml index 69460c5..d351b8c 100644 --- a/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml +++ b/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml @@ -1,5 +1,6 @@ Rect { id: mainrect + width: 200; height: 200 state: "first" states: [ State { diff --git a/tests/auto/declarative/visual/colorAnimation/data/raster/image0.png b/tests/auto/declarative/visual/colorAnimation/data/raster/image0.png new file mode 100644 index 0000000..f00a2e2 Binary files /dev/null and b/tests/auto/declarative/visual/colorAnimation/data/raster/image0.png differ diff --git a/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.qml b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.qml new file mode 100644 index 0000000..0eb8b12 --- /dev/null +++ b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.qml @@ -0,0 +1,522 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } + TestMouse { + time: 944 + type: 2 + button: 1 + buttons: 1 + globalPos: '1789,188' + pos: '73,76' + } + TestMouse { + time: 992 + type: 3 + button: 1 + buttons: 0 + globalPos: '1789,188' + pos: '73,76' + } + TestFrame { + time: 1008 + hash: 'E5BDA0DAF98288CE18DB6CE06EDA3BA0' + } + TestFrame { + time: 1024 + hash: 'D35008F75B8C992F80FB16BA7203649D' + } + TestFrame { + time: 1040 + hash: '14F43E0784DDF42EA8550DB88C501BF1' + } + TestFrame { + time: 1056 + hash: '02276E158B5391480B1BDEAADF1FB903' + } + TestFrame { + time: 1072 + hash: '35D9513EB97A2C482B7CD197DE910934' + } + TestFrame { + time: 1088 + hash: 'FAF0FD681E60BB2489099F5DF772B6CD' + } + TestFrame { + time: 1104 + hash: 'A863D3E346F94785A3A392FDC91526EB' + } + TestFrame { + time: 1120 + hash: 'FDF328D3F6EB8410DA59A91345E41A44' + } + TestFrame { + time: 1136 + hash: '83514A3B10D5BE8F6C3B128D0F3E0B1C' + } + TestFrame { + time: 1152 + hash: 'EAD0EAE76CD00189075964671EFFBAEA' + } + TestFrame { + time: 1168 + hash: '24D2457FCD51490FDA23071BF9929D12' + } + TestFrame { + time: 1184 + hash: '1478683446CF543DACBE31D0B76A98A6' + } + TestFrame { + time: 1200 + hash: '99F7DA1F31FE920F6C02ADD4042AE925' + } + TestFrame { + time: 1216 + hash: '22DEF892006CF66667770B0F17BAF6C0' + } + TestFrame { + time: 1232 + hash: '6A36D5A77099BFD58BAF285478FF04E4' + } + TestFrame { + time: 1248 + hash: '6258150666B59B20AB476724C07FC20C' + } + TestFrame { + time: 1264 + hash: 'F1636315BC950A6DD400D9C7ED263B88' + } + TestFrame { + time: 1280 + hash: '18447EA8DC2E8DA956788E5B3CF3790A' + } + TestFrame { + time: 1296 + hash: '1D2A6E65997A73E9E670356C8E8B63B2' + } + TestFrame { + time: 1312 + hash: 'BED0242C0F9EF229D1392835286D5782' + } + TestFrame { + time: 1328 + hash: '88923C190E9E5BEADEF8A409C06DF9D6' + } + TestFrame { + time: 1344 + hash: '2D133E7EE60C97386F57838B3F0976C7' + } + TestFrame { + time: 1360 + hash: '85B1821CC50F2A9F3ED6944F792B7A2F' + } + TestFrame { + time: 1376 + hash: '395195716D76BC0BE7B2033ED37A7A1C' + } + TestFrame { + time: 1392 + hash: '243DBFFCF416926242BBCB7348974C4C' + } + TestFrame { + time: 1408 + hash: 'A755068679616D8AC65C2AA7431F2A19' + } + TestFrame { + time: 1424 + hash: 'E8249B35A47EB492CBDF2D91CC8426F0' + } + TestFrame { + time: 1440 + hash: '15F3DA1C0E6F0779B96859D51171DD27' + } + TestFrame { + time: 1456 + hash: '258C0C756AAC3DE743B43051F2AACE6B' + } + TestFrame { + time: 1472 + hash: 'A58B9FDF301D72B2CC5C93934CC8927B' + } + TestFrame { + time: 1488 + hash: 'A9181D30870D472521F8904818CE520F' + } + TestFrame { + time: 1504 + hash: '7F9E94069CCF3897C26A71BD7BECD903' + } + TestFrame { + time: 1520 + hash: 'BDF305C2F46CDB86DBF57B1E0CC5A65B' + } + TestFrame { + time: 1536 + hash: 'FE5B6865D7E4FC7D1D42C1E74F8666F7' + } + TestFrame { + time: 1552 + hash: '734F0DE45A6E34C9EAB7EF606196F96A' + } + TestFrame { + time: 1568 + hash: '02A361C4534FDF7F286DC3E6DC23275C' + } + TestFrame { + time: 1584 + hash: 'E649155AD69999C14B92F6561E4D1185' + } + TestFrame { + time: 1600 + hash: '01AF177084FAB755D622973F64B92018' + } + TestFrame { + time: 1616 + hash: '097CC4A082DFAB995D213A3A73883C97' + } + TestFrame { + time: 1632 + hash: 'D7B4239A3280B1EB8E885E3F422DF8E9' + } + TestFrame { + time: 1648 + hash: '59893977994E34E83F91E7CE3AD65D6D' + } + TestFrame { + time: 1664 + hash: 'B68E3FBB5CDCD6BD96DF7DEC558DB42B' + } + TestFrame { + time: 1680 + hash: '94AD0580648F36A1E18A9EA7E249B04D' + } + TestFrame { + time: 1696 + hash: '750A4C01D2F5806A89A1C6CC6A9B9A68' + } + TestFrame { + time: 1712 + hash: '4F109F50F388F1BFA4BC6B03B3E6E514' + } + TestFrame { + time: 1728 + hash: 'C6168D5CF27A533E8EE636637667BE47' + } + TestFrame { + time: 1744 + hash: 'F8120547BED987AA34C00DA5A01A4D1E' + } + TestFrame { + time: 1760 + hash: 'CBFF526136FA2C128C8B898FBBEF9E5C' + } + TestFrame { + time: 1776 + hash: 'F29E52398FAB1A239A63DF4C32F2FC69' + } + TestFrame { + time: 1792 + hash: '7178BFE86FD2FD513218B33760460F8D' + } + TestFrame { + time: 1808 + hash: 'CA83285BC8AC633403896FE976896EB0' + } + TestFrame { + time: 1824 + hash: '96BA486C09CC69D5AA38C46C00DF1181' + } + TestFrame { + time: 1840 + hash: 'B88EAB335842787869F4A14824C19DD8' + } + TestFrame { + time: 1856 + hash: '065AA59012729E1E1A246A2083142690' + } + TestFrame { + time: 1872 + hash: 'DD0E98C8398861002C5F178C5F9F612D' + } + TestFrame { + time: 1888 + hash: '04192C2B545948048ECCF4D81BBDE198' + } + TestFrame { + time: 1904 + hash: 'BB7502C7208281EF9FD41714AB88A1A8' + } + TestFrame { + time: 1920 + hash: '5397195471890D08B703DCA101E5BC7C' + } + TestFrame { + time: 1936 + hash: '4C678CDBEBB2FFD2CBF012CA77800CDE' + } + TestFrame { + time: 1952 + hash: '0D7A34ECD0C7F52B2C015037BF1902C6' + } + TestFrame { + time: 1968 + hash: 'FD9D5048BE749AC4369FDA2D018B43AE' + } + TestFrame { + time: 1984 + hash: '93EE03795CD57AE6F7FE3A020B039AD4' + } + TestFrame { + time: 2000 + hash: '5E1118963F219C39761CA7FBF564A9CA' + } + TestFrame { + time: 2016 + hash: '8F40038741903150136170503649D941' + } + TestFrame { + time: 2032 + hash: 'B087B7D0AA6224821F8E18718FF5E77D' + } + TestFrame { + time: 2048 + hash: 'AA46B04A3C67DC772265ED2901955565' + } + TestFrame { + time: 2064 + hash: 'AC024BF2AEB4BECDF31A09FE0A6DB8F3' + } + TestFrame { + time: 2080 + hash: '13745A174E4D06E2108A5BF125BA50CC' + } + TestFrame { + time: 2096 + hash: 'BD972F0D8E230ECA0B3FEA1B8C960C08' + } + TestFrame { + time: 2112 + hash: 'CBDBEC802A58E7CED0CF45B3AB0BC0BA' + } + TestFrame { + time: 2128 + hash: '5128584C50305C7D218B81B8367FA3D5' + } + TestFrame { + time: 2144 + hash: 'A71461D3593F3685620668916DE870BD' + } + TestFrame { + time: 2160 + hash: '74EBAC8F32CF044B58D9883DBCD9A722' + } + TestFrame { + time: 2176 + hash: 'FEDC5B638F339B90FE59B478721E65B7' + } + TestFrame { + time: 2192 + hash: 'BCB8C7159F54C353551DD3BFF3203966' + } + TestFrame { + time: 2208 + hash: '4E9B083075BC5E9287A8ABC982778B56' + } + TestFrame { + time: 2224 + hash: '1D6F02AA99AFA47D77FC49AB894B365A' + } + TestFrame { + time: 2240 + hash: 'A204FEEC783B3B05DE4C209C21745826' + } + TestFrame { + time: 2256 + hash: '665A2A8FF00B9663157802767F504754' + } + TestFrame { + time: 2272 + hash: '624FB09EBE60CB87D767FAF8D2420B1E' + } + TestFrame { + time: 2288 + hash: 'E5AF0CDC33F3275A25ABB09E9165F310' + } + TestFrame { + time: 2304 + hash: '02BAFB5A81CA66F7670AC93DE5123860' + } + TestFrame { + time: 2320 + hash: 'E7AA6374C73832E57CEB2427A1E258AA' + } + TestFrame { + time: 2336 + hash: 'B5ABD0DFF1AB076FAAC7CC226E83F5D0' + } + TestFrame { + time: 2352 + hash: 'B759ACC35BCCFF8EFC2E6FE276DDC0F7' + } + TestFrame { + time: 2368 + hash: 'CE52E18C1F7732768779863B45314FF5' + } + TestFrame { + time: 2384 + hash: '99D30652559DD6931E0C95543EEAA149' + } + TestFrame { + time: 2400 + hash: 'FFBD9A00E05E085B89296D19D5CAEC57' + } + TestFrame { + time: 2416 + hash: '9C9D658B9C25602816B8066BF19105DB' + } + TestFrame { + time: 2432 + hash: '2B7FD058E6601E22A30BB7106B1C683B' + } + TestFrame { + time: 2448 + hash: 'F4C7E26B19EE0A3E7C9688685EB7BD05' + } + TestFrame { + time: 2464 + hash: '0DC6D593BCEFF56B7F81F2A49D37FEFB' + } + TestFrame { + time: 2480 + hash: '9BFD7AD5091CCBDDE43C593E133A7B10' + } + TestFrame { + time: 2496 + hash: '2703B617937914A90EA42EBF249D79EE' + } + TestFrame { + time: 2512 + hash: 'B77E2983138254016C4CCA53100F46FA' + } + TestFrame { + time: 2528 + hash: '60C4DD24187D1281081479E586F02B37' + } + TestFrame { + time: 2544 + hash: '62F2511ABD99EF1231C9FA4B91D4ABFE' + } + TestFrame { + time: 2560 + hash: 'E309B3353FD174E883D309571CADDC98' + } + TestFrame { + time: 2576 + hash: '1E2D6A134C7B12DDE551B148EF4F088C' + } + TestFrame { + time: 2592 + hash: 'E5DC5450604A491CC24A0DCF5C278B58' + } + TestFrame { + time: 2608 + hash: 'C8DAE97C10E1962C1E6A51AB3AB8579E' + } + TestFrame { + time: 2624 + hash: '4E1B7E06F55FB084080689B474F1FE1D' + } + TestFrame { + time: 2640 + hash: 'B4639C907FA937BF15FAC62421170CD8' + } + TestFrame { + time: 2656 + hash: 'C250208A0CAEB5F6CB4D3AAC3D7D350B' + } + TestFrame { + time: 2672 + hash: 'A73351EABECF0D71149EFE31F197413E' + } + TestFrame { + time: 2688 + hash: '479425F1B7AFF79E4DFB7FCA534AF018' + } + TestFrame { + time: 2704 + hash: '046D0F0040A52D1F26BA9F7C5DE06EF4' + } + TestFrame { + time: 2720 + hash: '655778BF13C6080903150B0EB43A7EDC' + } + TestFrame { + time: 2736 + hash: '72DA0BBE81514870655FDD3354ADAC60' + } + TestFrame { + time: 2752 + hash: 'DEFE0BDF675C65FFF55AAACED1E4DAE7' + } + TestFrame { + time: 2768 + hash: 'C988628B6C3D3780E9A865C7694926CD' + } + TestFrame { + time: 2784 + hash: '5AB17563655231089EDD986FF13D6012' + } + TestFrame { + time: 2800 + hash: 'C1ADFF1D2E5800ED466D1691D3B17382' + } + TestFrame { + time: 2816 + hash: '70129BA01FBB19592B9DC0D0A3B3E7DF' + } + TestFrame { + time: 2832 + hash: '0000829EF7ED908BF430D42904D59CC2' + } + TestFrame { + time: 2848 + hash: '843D2927F50AB87B4A86B7A6AAEED91F' + } + TestFrame { + time: 2864 + hash: 'DA86D21756025E7DE8050586D5E2A1F8' + } + TestFrame { + time: 2880 + hash: '48DD1BD6580133B0793FEE327EA4F1E6' + } + TestFrame { + time: 2896 + hash: 'F0618193DCD0BA2837249515A1898B1C' + } + TestFrame { + time: 2912 + hash: 'A530184E57251065286C0CBBA7301E9C' + } + TestFrame { + time: 2928 + hash: '64A1D7203973D65DD342793007A61C58' + } + TestFrame { + time: 2944 + hash: '5B830DFC6BA442772DE87D75D5A578DE' + } + TestFrame { + time: 2960 + hash: '5563B056B0409B65F60DD16DD0DD890E' + } + TestFrame { + time: 2976 + hash: 'B8BCF9AD2CA8720C11563A23D8280804' + } + TestFrame { + time: 2992 + hash: '8C0FCDA4F8956394C53FC4BA18CAA850' + } +} diff --git a/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.xml b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.xml new file mode 100644 index 0000000..1fe2f15 --- /dev/null +++ b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.xml @@ -0,0 +1,522 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } + TestFrame { + time: 16 + hash: 'E5BDA0DAF98288CE18DB6CE06EDA3BA0' + } + TestFrame { + time: 32 + hash: 'D35008F75B8C992F80FB16BA7203649D' + } + TestFrame { + time: 48 + hash: '14F43E0784DDF42EA8550DB88C501BF1' + } + TestFrame { + time: 64 + hash: '02276E158B5391480B1BDEAADF1FB903' + } + TestFrame { + time: 80 + hash: '35D9513EB97A2C482B7CD197DE910934' + } + TestFrame { + time: 96 + hash: 'FAF0FD681E60BB2489099F5DF772B6CD' + } + TestFrame { + time: 112 + hash: 'A863D3E346F94785A3A392FDC91526EB' + } + TestFrame { + time: 128 + hash: 'FDF328D3F6EB8410DA59A91345E41A44' + } + TestFrame { + time: 144 + hash: '83514A3B10D5BE8F6C3B128D0F3E0B1C' + } + TestFrame { + time: 160 + hash: 'EAD0EAE76CD00189075964671EFFBAEA' + } + TestFrame { + time: 176 + hash: '24D2457FCD51490FDA23071BF9929D12' + } + TestFrame { + time: 192 + hash: '1478683446CF543DACBE31D0B76A98A6' + } + TestFrame { + time: 208 + hash: '99F7DA1F31FE920F6C02ADD4042AE925' + } + TestFrame { + time: 224 + hash: '22DEF892006CF66667770B0F17BAF6C0' + } + TestFrame { + time: 240 + hash: '6A36D5A77099BFD58BAF285478FF04E4' + } + TestFrame { + time: 256 + hash: '6258150666B59B20AB476724C07FC20C' + } + TestFrame { + time: 272 + hash: 'F1636315BC950A6DD400D9C7ED263B88' + } + TestFrame { + time: 288 + hash: '18447EA8DC2E8DA956788E5B3CF3790A' + } + TestFrame { + time: 304 + hash: '1D2A6E65997A73E9E670356C8E8B63B2' + } + TestFrame { + time: 320 + hash: 'BED0242C0F9EF229D1392835286D5782' + } + TestFrame { + time: 336 + hash: '88923C190E9E5BEADEF8A409C06DF9D6' + } + TestFrame { + time: 352 + hash: '2D133E7EE60C97386F57838B3F0976C7' + } + TestFrame { + time: 368 + hash: '85B1821CC50F2A9F3ED6944F792B7A2F' + } + TestFrame { + time: 384 + hash: '395195716D76BC0BE7B2033ED37A7A1C' + } + TestFrame { + time: 400 + hash: '243DBFFCF416926242BBCB7348974C4C' + } + TestFrame { + time: 416 + hash: 'A755068679616D8AC65C2AA7431F2A19' + } + TestFrame { + time: 432 + hash: 'E8249B35A47EB492CBDF2D91CC8426F0' + } + TestFrame { + time: 448 + hash: '15F3DA1C0E6F0779B96859D51171DD27' + } + TestFrame { + time: 464 + hash: '258C0C756AAC3DE743B43051F2AACE6B' + } + TestFrame { + time: 480 + hash: 'A58B9FDF301D72B2CC5C93934CC8927B' + } + TestFrame { + time: 496 + hash: 'A9181D30870D472521F8904818CE520F' + } + TestFrame { + time: 512 + hash: '7F9E94069CCF3897C26A71BD7BECD903' + } + TestFrame { + time: 528 + hash: 'BDF305C2F46CDB86DBF57B1E0CC5A65B' + } + TestFrame { + time: 544 + hash: 'FE5B6865D7E4FC7D1D42C1E74F8666F7' + } + TestFrame { + time: 560 + hash: '734F0DE45A6E34C9EAB7EF606196F96A' + } + TestFrame { + time: 576 + hash: '02A361C4534FDF7F286DC3E6DC23275C' + } + TestFrame { + time: 592 + hash: 'E649155AD69999C14B92F6561E4D1185' + } + TestFrame { + time: 608 + hash: '01AF177084FAB755D622973F64B92018' + } + TestFrame { + time: 624 + hash: '097CC4A082DFAB995D213A3A73883C97' + } + TestFrame { + time: 640 + hash: 'D7B4239A3280B1EB8E885E3F422DF8E9' + } + TestFrame { + time: 656 + hash: '59893977994E34E83F91E7CE3AD65D6D' + } + TestFrame { + time: 672 + hash: 'B68E3FBB5CDCD6BD96DF7DEC558DB42B' + } + TestFrame { + time: 688 + hash: '94AD0580648F36A1E18A9EA7E249B04D' + } + TestFrame { + time: 704 + hash: '750A4C01D2F5806A89A1C6CC6A9B9A68' + } + TestFrame { + time: 720 + hash: '4F109F50F388F1BFA4BC6B03B3E6E514' + } + TestFrame { + time: 736 + hash: 'C6168D5CF27A533E8EE636637667BE47' + } + TestFrame { + time: 752 + hash: 'F8120547BED987AA34C00DA5A01A4D1E' + } + TestFrame { + time: 768 + hash: 'CBFF526136FA2C128C8B898FBBEF9E5C' + } + TestFrame { + time: 784 + hash: 'F29E52398FAB1A239A63DF4C32F2FC69' + } + TestFrame { + time: 800 + hash: '7178BFE86FD2FD513218B33760460F8D' + } + TestFrame { + time: 816 + hash: 'CA83285BC8AC633403896FE976896EB0' + } + TestFrame { + time: 832 + hash: '96BA486C09CC69D5AA38C46C00DF1181' + } + TestFrame { + time: 848 + hash: 'B88EAB335842787869F4A14824C19DD8' + } + TestFrame { + time: 864 + hash: '065AA59012729E1E1A246A2083142690' + } + TestFrame { + time: 880 + hash: 'DD0E98C8398861002C5F178C5F9F612D' + } + TestFrame { + time: 896 + hash: '04192C2B545948048ECCF4D81BBDE198' + } + TestMouse { + time: 912 + type: 2 + button: 1 + buttons: 1 + globalPos: '1739,207' + pos: '75,95' + } + TestFrame { + time: 912 + hash: 'BB7502C7208281EF9FD41714AB88A1A8' + } + TestFrame { + time: 928 + hash: '5397195471890D08B703DCA101E5BC7C' + } + TestFrame { + time: 944 + hash: '4C678CDBEBB2FFD2CBF012CA77800CDE' + } + TestFrame { + time: 960 + hash: '0D7A34ECD0C7F52B2C015037BF1902C6' + } + TestMouse { + time: 976 + type: 3 + button: 1 + buttons: 0 + globalPos: '1739,207' + pos: '75,95' + } + TestFrame { + time: 976 + hash: 'FD9D5048BE749AC4369FDA2D018B43AE' + } + TestFrame { + time: 992 + hash: '93EE03795CD57AE6F7FE3A020B039AD4' + } + TestFrame { + time: 1008 + hash: '5E1118963F219C39761CA7FBF564A9CA' + } + TestFrame { + time: 1024 + hash: '8F40038741903150136170503649D941' + } + TestFrame { + time: 1040 + hash: 'B087B7D0AA6224821F8E18718FF5E77D' + } + TestFrame { + time: 1056 + hash: 'AA46B04A3C67DC772265ED2901955565' + } + TestFrame { + time: 1072 + hash: 'AC024BF2AEB4BECDF31A09FE0A6DB8F3' + } + TestFrame { + time: 1088 + hash: '13745A174E4D06E2108A5BF125BA50CC' + } + TestFrame { + time: 1104 + hash: 'BD972F0D8E230ECA0B3FEA1B8C960C08' + } + TestFrame { + time: 1120 + hash: 'CBDBEC802A58E7CED0CF45B3AB0BC0BA' + } + TestFrame { + time: 1136 + hash: '5128584C50305C7D218B81B8367FA3D5' + } + TestFrame { + time: 1152 + hash: 'A71461D3593F3685620668916DE870BD' + } + TestFrame { + time: 1168 + hash: '74EBAC8F32CF044B58D9883DBCD9A722' + } + TestFrame { + time: 1184 + hash: 'FEDC5B638F339B90FE59B478721E65B7' + } + TestFrame { + time: 1200 + hash: 'BCB8C7159F54C353551DD3BFF3203966' + } + TestFrame { + time: 1216 + hash: '4E9B083075BC5E9287A8ABC982778B56' + } + TestFrame { + time: 1232 + hash: '1D6F02AA99AFA47D77FC49AB894B365A' + } + TestFrame { + time: 1248 + hash: 'A204FEEC783B3B05DE4C209C21745826' + } + TestFrame { + time: 1264 + hash: '665A2A8FF00B9663157802767F504754' + } + TestFrame { + time: 1280 + hash: '624FB09EBE60CB87D767FAF8D2420B1E' + } + TestFrame { + time: 1296 + hash: 'E5AF0CDC33F3275A25ABB09E9165F310' + } + TestFrame { + time: 1312 + hash: '02BAFB5A81CA66F7670AC93DE5123860' + } + TestFrame { + time: 1328 + hash: 'E7AA6374C73832E57CEB2427A1E258AA' + } + TestFrame { + time: 1344 + hash: 'B5ABD0DFF1AB076FAAC7CC226E83F5D0' + } + TestFrame { + time: 1360 + hash: 'B759ACC35BCCFF8EFC2E6FE276DDC0F7' + } + TestFrame { + time: 1376 + hash: 'CE52E18C1F7732768779863B45314FF5' + } + TestFrame { + time: 1392 + hash: '99D30652559DD6931E0C95543EEAA149' + } + TestFrame { + time: 1408 + hash: 'FFBD9A00E05E085B89296D19D5CAEC57' + } + TestFrame { + time: 1424 + hash: '9C9D658B9C25602816B8066BF19105DB' + } + TestFrame { + time: 1440 + hash: '2B7FD058E6601E22A30BB7106B1C683B' + } + TestFrame { + time: 1456 + hash: 'F4C7E26B19EE0A3E7C9688685EB7BD05' + } + TestFrame { + time: 1472 + hash: '0DC6D593BCEFF56B7F81F2A49D37FEFB' + } + TestFrame { + time: 1488 + hash: '9BFD7AD5091CCBDDE43C593E133A7B10' + } + TestFrame { + time: 1504 + hash: '2703B617937914A90EA42EBF249D79EE' + } + TestFrame { + time: 1520 + hash: 'B77E2983138254016C4CCA53100F46FA' + } + TestFrame { + time: 1536 + hash: '60C4DD24187D1281081479E586F02B37' + } + TestFrame { + time: 1552 + hash: '62F2511ABD99EF1231C9FA4B91D4ABFE' + } + TestFrame { + time: 1568 + hash: 'E309B3353FD174E883D309571CADDC98' + } + TestFrame { + time: 1584 + hash: '1E2D6A134C7B12DDE551B148EF4F088C' + } + TestFrame { + time: 1600 + hash: 'E5DC5450604A491CC24A0DCF5C278B58' + } + TestFrame { + time: 1616 + hash: 'C8DAE97C10E1962C1E6A51AB3AB8579E' + } + TestFrame { + time: 1632 + hash: '4E1B7E06F55FB084080689B474F1FE1D' + } + TestFrame { + time: 1648 + hash: 'B4639C907FA937BF15FAC62421170CD8' + } + TestFrame { + time: 1664 + hash: 'C250208A0CAEB5F6CB4D3AAC3D7D350B' + } + TestFrame { + time: 1680 + hash: 'A73351EABECF0D71149EFE31F197413E' + } + TestFrame { + time: 1696 + hash: '479425F1B7AFF79E4DFB7FCA534AF018' + } + TestFrame { + time: 1712 + hash: '046D0F0040A52D1F26BA9F7C5DE06EF4' + } + TestFrame { + time: 1728 + hash: '655778BF13C6080903150B0EB43A7EDC' + } + TestFrame { + time: 1744 + hash: '72DA0BBE81514870655FDD3354ADAC60' + } + TestFrame { + time: 1760 + hash: 'DEFE0BDF675C65FFF55AAACED1E4DAE7' + } + TestFrame { + time: 1776 + hash: 'C988628B6C3D3780E9A865C7694926CD' + } + TestFrame { + time: 1792 + hash: '5AB17563655231089EDD986FF13D6012' + } + TestFrame { + time: 1808 + hash: 'C1ADFF1D2E5800ED466D1691D3B17382' + } + TestFrame { + time: 1824 + hash: '70129BA01FBB19592B9DC0D0A3B3E7DF' + } + TestFrame { + time: 1840 + hash: '0000829EF7ED908BF430D42904D59CC2' + } + TestFrame { + time: 1856 + hash: '843D2927F50AB87B4A86B7A6AAEED91F' + } + TestFrame { + time: 1872 + hash: 'DA86D21756025E7DE8050586D5E2A1F8' + } + TestFrame { + time: 1888 + hash: '48DD1BD6580133B0793FEE327EA4F1E6' + } + TestFrame { + time: 1904 + hash: 'F0618193DCD0BA2837249515A1898B1C' + } + TestFrame { + time: 1920 + hash: 'A530184E57251065286C0CBBA7301E9C' + } + TestFrame { + time: 1936 + hash: '64A1D7203973D65DD342793007A61C58' + } + TestFrame { + time: 1952 + hash: '5B830DFC6BA442772DE87D75D5A578DE' + } + TestFrame { + time: 1968 + hash: '5563B056B0409B65F60DD16DD0DD890E' + } + TestFrame { + time: 1984 + hash: 'B8BCF9AD2CA8720C11563A23D8280804' + } + TestFrame { + time: 2000 + hash: '8C0FCDA4F8956394C53FC4BA18CAA850' + } +} diff --git a/tests/auto/declarative/visual/colorAnimation/image0.png b/tests/auto/declarative/visual/colorAnimation/image0.png deleted file mode 100644 index 9e1caf7..0000000 Binary files a/tests/auto/declarative/visual/colorAnimation/image0.png and /dev/null differ diff --git a/tests/auto/declarative/visual/colorAnimation/manifest.xml b/tests/auto/declarative/visual/colorAnimation/manifest.xml deleted file mode 100644 index 8e3de2e..0000000 --- a/tests/auto/declarative/visual/colorAnimation/manifest.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/auto/declarative/visual/tst_visual.cpp b/tests/auto/declarative/visual/tst_visual.cpp index f077994..f540e62 100644 --- a/tests/auto/declarative/visual/tst_visual.cpp +++ b/tests/auto/declarative/visual/tst_visual.cpp @@ -25,7 +25,9 @@ void tst_visual::visual() { QVERIFY(!testdir.isEmpty()); - QFile configFile(QLatin1String(QT_TEST_SOURCE_DIR) + "/" + testdir + "/test"); + QString filename = QLatin1String(QT_TEST_SOURCE_DIR) + "/" + testdir + "/test"; + qWarning() << "Using config:" << filename; + QFile configFile(filename); QVERIFY(configFile.open(QIODevice::ReadOnly)); QString testfile = configFile.readLine().trimmed(); -- cgit v0.12 From 91a26a2ca6f592f88135fff672526ed9af628598 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 22 May 2009 08:23:46 +1000 Subject: Listview tests run. --- src/declarative/test/qfxtestobjects.cpp | 2 +- tests/auto/declarative/visual/ListView/basic1/basic1.qml | 4 ++-- .../visual/ListView/basic1/data/opengl/image0.png | Bin 3759 -> 0 bytes .../visual/ListView/basic1/data/opengl/manifest.xml | 4 ---- .../visual/ListView/basic1/data/raster/image0.png | Bin 0 -> 1737 bytes .../visual/ListView/basic1/data/raster/manifest.qml | 6 ++++++ tests/auto/declarative/visual/ListView/basic1/test | 2 +- .../visual/ListView/basic2/data/opengl/image0.png | Bin 3759 -> 0 bytes .../visual/ListView/basic2/data/opengl/manifest.xml | 4 ---- .../visual/ListView/basic2/data/raster/image0.png | Bin 0 -> 1737 bytes .../visual/ListView/basic2/data/raster/manifest.qml | 6 ++++++ tests/auto/declarative/visual/ListView/basic2/test | 2 +- .../visual/ListView/basic3/data/opengl/image0.png | Bin 3759 -> 0 bytes .../visual/ListView/basic3/data/opengl/manifest.xml | 4 ---- .../visual/ListView/basic3/data/raster/image0.png | Bin 0 -> 1737 bytes .../visual/ListView/basic3/data/raster/manifest.qml | 6 ++++++ tests/auto/declarative/visual/ListView/basic3/test | 2 +- .../visual/ListView/basic4/data/opengl/image0.png | Bin 3759 -> 0 bytes .../visual/ListView/basic4/data/opengl/manifest.xml | 4 ---- .../visual/ListView/basic4/data/raster/image0.png | Bin 0 -> 1737 bytes .../visual/ListView/basic4/data/raster/manifest.qml | 6 ++++++ tests/auto/declarative/visual/ListView/basic4/test | 2 +- 22 files changed, 31 insertions(+), 23 deletions(-) delete mode 100644 tests/auto/declarative/visual/ListView/basic1/data/opengl/image0.png delete mode 100644 tests/auto/declarative/visual/ListView/basic1/data/opengl/manifest.xml create mode 100644 tests/auto/declarative/visual/ListView/basic1/data/raster/image0.png create mode 100644 tests/auto/declarative/visual/ListView/basic1/data/raster/manifest.qml delete mode 100644 tests/auto/declarative/visual/ListView/basic2/data/opengl/image0.png delete mode 100644 tests/auto/declarative/visual/ListView/basic2/data/opengl/manifest.xml create mode 100644 tests/auto/declarative/visual/ListView/basic2/data/raster/image0.png create mode 100644 tests/auto/declarative/visual/ListView/basic2/data/raster/manifest.qml delete mode 100644 tests/auto/declarative/visual/ListView/basic3/data/opengl/image0.png delete mode 100644 tests/auto/declarative/visual/ListView/basic3/data/opengl/manifest.xml create mode 100644 tests/auto/declarative/visual/ListView/basic3/data/raster/image0.png create mode 100644 tests/auto/declarative/visual/ListView/basic3/data/raster/manifest.qml delete mode 100644 tests/auto/declarative/visual/ListView/basic4/data/opengl/image0.png delete mode 100644 tests/auto/declarative/visual/ListView/basic4/data/opengl/manifest.xml create mode 100644 tests/auto/declarative/visual/ListView/basic4/data/raster/image0.png create mode 100644 tests/auto/declarative/visual/ListView/basic4/data/raster/manifest.qml diff --git a/src/declarative/test/qfxtestobjects.cpp b/src/declarative/test/qfxtestobjects.cpp index 905e83e..5beefd9 100644 --- a/src/declarative/test/qfxtestobjects.cpp +++ b/src/declarative/test/qfxtestobjects.cpp @@ -143,7 +143,7 @@ void TestFullFrame::save(QTextStream &device, int pad) device << padding(pad) << QLatin1String("TestFullFrame {") << endl; device << padding(pad+4) << QLatin1String("time: ") << QLatin1String(QByteArray::number(time())) << endl; device << padding(pad+4) << QLatin1String("frameId: ") << QLatin1String(QByteArray::number(frameId())) << endl; - device << padding(pad) << padding(pad) << QLatin1String("}") << endl; + device << padding(pad) << QLatin1String("}") << endl; } TestMouse::TestMouse(QObject *parent) diff --git a/tests/auto/declarative/visual/ListView/basic1/basic1.qml b/tests/auto/declarative/visual/ListView/basic1/basic1.qml index 605457b..d9cd030 100644 --- a/tests/auto/declarative/visual/ListView/basic1/basic1.qml +++ b/tests/auto/declarative/visual/ListView/basic1/basic1.qml @@ -1,7 +1,7 @@ Rect { color: "blue" - width: 300 - height: 200 + width: 200 + height: 300 id: Page ListView { anchors.fill: parent diff --git a/tests/auto/declarative/visual/ListView/basic1/data/opengl/image0.png b/tests/auto/declarative/visual/ListView/basic1/data/opengl/image0.png deleted file mode 100644 index 403b407..0000000 Binary files a/tests/auto/declarative/visual/ListView/basic1/data/opengl/image0.png and /dev/null differ diff --git a/tests/auto/declarative/visual/ListView/basic1/data/opengl/manifest.xml b/tests/auto/declarative/visual/ListView/basic1/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/ListView/basic1/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/auto/declarative/visual/ListView/basic1/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic1/data/raster/image0.png new file mode 100644 index 0000000..f8a4830 Binary files /dev/null and b/tests/auto/declarative/visual/ListView/basic1/data/raster/image0.png differ diff --git a/tests/auto/declarative/visual/ListView/basic1/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic1/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic1/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/ListView/basic1/test b/tests/auto/declarative/visual/ListView/basic1/test index 62f0665..49fcf5a 100644 --- a/tests/auto/declarative/visual/ListView/basic1/test +++ b/tests/auto/declarative/visual/ListView/basic1/test @@ -1 +1 @@ -basic1.xml +basic1.qml diff --git a/tests/auto/declarative/visual/ListView/basic2/data/opengl/image0.png b/tests/auto/declarative/visual/ListView/basic2/data/opengl/image0.png deleted file mode 100644 index 403b407..0000000 Binary files a/tests/auto/declarative/visual/ListView/basic2/data/opengl/image0.png and /dev/null differ diff --git a/tests/auto/declarative/visual/ListView/basic2/data/opengl/manifest.xml b/tests/auto/declarative/visual/ListView/basic2/data/opengl/manifest.xml deleted file mode 100644 index f3fa6c9..0000000 --- a/tests/auto/declarative/visual/ListView/basic2/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/auto/declarative/visual/ListView/basic2/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic2/data/raster/image0.png new file mode 100644 index 0000000..f8a4830 Binary files /dev/null and b/tests/auto/declarative/visual/ListView/basic2/data/raster/image0.png differ diff --git a/tests/auto/declarative/visual/ListView/basic2/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic2/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic2/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/ListView/basic2/test b/tests/auto/declarative/visual/ListView/basic2/test index ae974fe..eb79495 100644 --- a/tests/auto/declarative/visual/ListView/basic2/test +++ b/tests/auto/declarative/visual/ListView/basic2/test @@ -1 +1 @@ -basic2.xml +basic2.qml diff --git a/tests/auto/declarative/visual/ListView/basic3/data/opengl/image0.png b/tests/auto/declarative/visual/ListView/basic3/data/opengl/image0.png deleted file mode 100644 index 403b407..0000000 Binary files a/tests/auto/declarative/visual/ListView/basic3/data/opengl/image0.png and /dev/null differ diff --git a/tests/auto/declarative/visual/ListView/basic3/data/opengl/manifest.xml b/tests/auto/declarative/visual/ListView/basic3/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/ListView/basic3/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/auto/declarative/visual/ListView/basic3/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic3/data/raster/image0.png new file mode 100644 index 0000000..f8a4830 Binary files /dev/null and b/tests/auto/declarative/visual/ListView/basic3/data/raster/image0.png differ diff --git a/tests/auto/declarative/visual/ListView/basic3/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic3/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic3/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/ListView/basic3/test b/tests/auto/declarative/visual/ListView/basic3/test index ea3154e..9ec306b 100644 --- a/tests/auto/declarative/visual/ListView/basic3/test +++ b/tests/auto/declarative/visual/ListView/basic3/test @@ -1 +1 @@ -basic3.xml +basic3.qml diff --git a/tests/auto/declarative/visual/ListView/basic4/data/opengl/image0.png b/tests/auto/declarative/visual/ListView/basic4/data/opengl/image0.png deleted file mode 100644 index 403b407..0000000 Binary files a/tests/auto/declarative/visual/ListView/basic4/data/opengl/image0.png and /dev/null differ diff --git a/tests/auto/declarative/visual/ListView/basic4/data/opengl/manifest.xml b/tests/auto/declarative/visual/ListView/basic4/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/ListView/basic4/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/auto/declarative/visual/ListView/basic4/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic4/data/raster/image0.png new file mode 100644 index 0000000..f8a4830 Binary files /dev/null and b/tests/auto/declarative/visual/ListView/basic4/data/raster/image0.png differ diff --git a/tests/auto/declarative/visual/ListView/basic4/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic4/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/ListView/basic4/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/ListView/basic4/test b/tests/auto/declarative/visual/ListView/basic4/test index 891e0be..2a7f227 100644 --- a/tests/auto/declarative/visual/ListView/basic4/test +++ b/tests/auto/declarative/visual/ListView/basic4/test @@ -1 +1 @@ -basic4.xml +basic4.qml -- cgit v0.12 From 494a53aec0ce4955027ff7c074039364285840a5 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 22 May 2009 08:40:55 +1000 Subject: Repeater tests run. --- tests/auto/declarative/visual/repeater/basic1/basic1.qml | 4 ++-- .../visual/repeater/basic1/data/opengl/image0.png | Bin 3493 -> 0 bytes .../visual/repeater/basic1/data/opengl/manifest.xml | 4 ---- .../visual/repeater/basic1/data/raster/image0.png | Bin 0 -> 1287 bytes .../visual/repeater/basic1/data/raster/manifest.qml | 6 ++++++ tests/auto/declarative/visual/repeater/basic1/test | 2 +- tests/auto/declarative/visual/repeater/basic2/basic2.qml | 4 ++-- .../visual/repeater/basic2/data/opengl/image0.png | Bin 3493 -> 0 bytes .../visual/repeater/basic2/data/opengl/manifest.xml | 4 ---- .../visual/repeater/basic2/data/raster/image0.png | Bin 0 -> 1287 bytes .../visual/repeater/basic2/data/raster/manifest.qml | 6 ++++++ tests/auto/declarative/visual/repeater/basic2/test | 2 +- tests/auto/declarative/visual/repeater/basic3/basic3.qml | 4 ++-- .../visual/repeater/basic3/data/opengl/image0.png | Bin 3493 -> 0 bytes .../visual/repeater/basic3/data/opengl/manifest.xml | 4 ---- .../visual/repeater/basic3/data/raster/image0.png | Bin 0 -> 1287 bytes .../visual/repeater/basic3/data/raster/manifest.qml | 13 +++++++++++++ tests/auto/declarative/visual/repeater/basic3/test | 2 +- tests/auto/declarative/visual/repeater/basic4/basic4.qml | 4 ++-- .../visual/repeater/basic4/data/opengl/image0.png | Bin 3493 -> 0 bytes .../visual/repeater/basic4/data/opengl/manifest.xml | 4 ---- .../visual/repeater/basic4/data/raster/image0.png | Bin 0 -> 1287 bytes .../visual/repeater/basic4/data/raster/manifest.qml | 6 ++++++ tests/auto/declarative/visual/repeater/basic4/test | 2 +- 24 files changed, 43 insertions(+), 28 deletions(-) delete mode 100644 tests/auto/declarative/visual/repeater/basic1/data/opengl/image0.png delete mode 100644 tests/auto/declarative/visual/repeater/basic1/data/opengl/manifest.xml create mode 100644 tests/auto/declarative/visual/repeater/basic1/data/raster/image0.png create mode 100644 tests/auto/declarative/visual/repeater/basic1/data/raster/manifest.qml delete mode 100644 tests/auto/declarative/visual/repeater/basic2/data/opengl/image0.png delete mode 100644 tests/auto/declarative/visual/repeater/basic2/data/opengl/manifest.xml create mode 100644 tests/auto/declarative/visual/repeater/basic2/data/raster/image0.png create mode 100644 tests/auto/declarative/visual/repeater/basic2/data/raster/manifest.qml delete mode 100644 tests/auto/declarative/visual/repeater/basic3/data/opengl/image0.png delete mode 100644 tests/auto/declarative/visual/repeater/basic3/data/opengl/manifest.xml create mode 100644 tests/auto/declarative/visual/repeater/basic3/data/raster/image0.png create mode 100644 tests/auto/declarative/visual/repeater/basic3/data/raster/manifest.qml delete mode 100644 tests/auto/declarative/visual/repeater/basic4/data/opengl/image0.png delete mode 100644 tests/auto/declarative/visual/repeater/basic4/data/opengl/manifest.xml create mode 100644 tests/auto/declarative/visual/repeater/basic4/data/raster/image0.png create mode 100644 tests/auto/declarative/visual/repeater/basic4/data/raster/manifest.qml diff --git a/tests/auto/declarative/visual/repeater/basic1/basic1.qml b/tests/auto/declarative/visual/repeater/basic1/basic1.qml index 3c66508..ba8f44d 100644 --- a/tests/auto/declarative/visual/repeater/basic1/basic1.qml +++ b/tests/auto/declarative/visual/repeater/basic1/basic1.qml @@ -1,7 +1,7 @@ Rect { color: "blue" - width: 800 - height: 600 + width: 300 + height: 200 id: Page HorizontalLayout { Repeater { diff --git a/tests/auto/declarative/visual/repeater/basic1/data/opengl/image0.png b/tests/auto/declarative/visual/repeater/basic1/data/opengl/image0.png deleted file mode 100644 index f0be97f..0000000 Binary files a/tests/auto/declarative/visual/repeater/basic1/data/opengl/image0.png and /dev/null differ diff --git a/tests/auto/declarative/visual/repeater/basic1/data/opengl/manifest.xml b/tests/auto/declarative/visual/repeater/basic1/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/repeater/basic1/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/auto/declarative/visual/repeater/basic1/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic1/data/raster/image0.png new file mode 100644 index 0000000..868eaa3 Binary files /dev/null and b/tests/auto/declarative/visual/repeater/basic1/data/raster/image0.png differ diff --git a/tests/auto/declarative/visual/repeater/basic1/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic1/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic1/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/repeater/basic1/test b/tests/auto/declarative/visual/repeater/basic1/test index 62f0665..49fcf5a 100644 --- a/tests/auto/declarative/visual/repeater/basic1/test +++ b/tests/auto/declarative/visual/repeater/basic1/test @@ -1 +1 @@ -basic1.xml +basic1.qml diff --git a/tests/auto/declarative/visual/repeater/basic2/basic2.qml b/tests/auto/declarative/visual/repeater/basic2/basic2.qml index 1228be8..d975ea4 100644 --- a/tests/auto/declarative/visual/repeater/basic2/basic2.qml +++ b/tests/auto/declarative/visual/repeater/basic2/basic2.qml @@ -1,7 +1,7 @@ Rect { color: "blue" - width: 800 - height: 600 + width: 300 + height: 200 id: Page Component { id: Delegate diff --git a/tests/auto/declarative/visual/repeater/basic2/data/opengl/image0.png b/tests/auto/declarative/visual/repeater/basic2/data/opengl/image0.png deleted file mode 100644 index f0be97f..0000000 Binary files a/tests/auto/declarative/visual/repeater/basic2/data/opengl/image0.png and /dev/null differ diff --git a/tests/auto/declarative/visual/repeater/basic2/data/opengl/manifest.xml b/tests/auto/declarative/visual/repeater/basic2/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/repeater/basic2/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/auto/declarative/visual/repeater/basic2/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic2/data/raster/image0.png new file mode 100644 index 0000000..868eaa3 Binary files /dev/null and b/tests/auto/declarative/visual/repeater/basic2/data/raster/image0.png differ diff --git a/tests/auto/declarative/visual/repeater/basic2/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic2/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic2/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/repeater/basic2/test b/tests/auto/declarative/visual/repeater/basic2/test index ae974fe..eb79495 100644 --- a/tests/auto/declarative/visual/repeater/basic2/test +++ b/tests/auto/declarative/visual/repeater/basic2/test @@ -1 +1 @@ -basic2.xml +basic2.qml diff --git a/tests/auto/declarative/visual/repeater/basic3/basic3.qml b/tests/auto/declarative/visual/repeater/basic3/basic3.qml index 7b8b9ef..cecba33 100644 --- a/tests/auto/declarative/visual/repeater/basic3/basic3.qml +++ b/tests/auto/declarative/visual/repeater/basic3/basic3.qml @@ -1,7 +1,7 @@ Rect { color: "blue" - width: 800 - height: 600 + width: 300 + height: 200 id: Page ListModel { id: DataSource diff --git a/tests/auto/declarative/visual/repeater/basic3/data/opengl/image0.png b/tests/auto/declarative/visual/repeater/basic3/data/opengl/image0.png deleted file mode 100644 index f0be97f..0000000 Binary files a/tests/auto/declarative/visual/repeater/basic3/data/opengl/image0.png and /dev/null differ diff --git a/tests/auto/declarative/visual/repeater/basic3/data/opengl/manifest.xml b/tests/auto/declarative/visual/repeater/basic3/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/repeater/basic3/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/auto/declarative/visual/repeater/basic3/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic3/data/raster/image0.png new file mode 100644 index 0000000..868eaa3 Binary files /dev/null and b/tests/auto/declarative/visual/repeater/basic3/data/raster/image0.png differ diff --git a/tests/auto/declarative/visual/repeater/basic3/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic3/data/raster/manifest.qml new file mode 100644 index 0000000..47d36c3 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic3/data/raster/manifest.qml @@ -0,0 +1,13 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } + TestKey { + time: 1296 + type: 6 + modifiers: 0 + key: 16777251 + text: '' + } +} diff --git a/tests/auto/declarative/visual/repeater/basic3/test b/tests/auto/declarative/visual/repeater/basic3/test index ea3154e..9ec306b 100644 --- a/tests/auto/declarative/visual/repeater/basic3/test +++ b/tests/auto/declarative/visual/repeater/basic3/test @@ -1 +1 @@ -basic3.xml +basic3.qml diff --git a/tests/auto/declarative/visual/repeater/basic4/basic4.qml b/tests/auto/declarative/visual/repeater/basic4/basic4.qml index 2111c24..050a2c5 100644 --- a/tests/auto/declarative/visual/repeater/basic4/basic4.qml +++ b/tests/auto/declarative/visual/repeater/basic4/basic4.qml @@ -1,7 +1,7 @@ Rect { color: "blue" - width: 800 - height: 600 + width: 300 + height: 200 id: Page ListModel { id: DataSource diff --git a/tests/auto/declarative/visual/repeater/basic4/data/opengl/image0.png b/tests/auto/declarative/visual/repeater/basic4/data/opengl/image0.png deleted file mode 100644 index f0be97f..0000000 Binary files a/tests/auto/declarative/visual/repeater/basic4/data/opengl/image0.png and /dev/null differ diff --git a/tests/auto/declarative/visual/repeater/basic4/data/opengl/manifest.xml b/tests/auto/declarative/visual/repeater/basic4/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/repeater/basic4/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/auto/declarative/visual/repeater/basic4/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic4/data/raster/image0.png new file mode 100644 index 0000000..868eaa3 Binary files /dev/null and b/tests/auto/declarative/visual/repeater/basic4/data/raster/image0.png differ diff --git a/tests/auto/declarative/visual/repeater/basic4/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic4/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/repeater/basic4/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/repeater/basic4/test b/tests/auto/declarative/visual/repeater/basic4/test index 891e0be..2a7f227 100644 --- a/tests/auto/declarative/visual/repeater/basic4/test +++ b/tests/auto/declarative/visual/repeater/basic4/test @@ -1 +1 @@ -basic4.xml +basic4.qml -- cgit v0.12 From cdd12bf1d4475ad23b49b5e27328bf6c738a0ab3 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 22 May 2009 08:48:11 +1000 Subject: qfxtext test runs. --- .../visual/qfxtext/elide/data/opengl/image0.png | Bin 980 -> 0 bytes .../visual/qfxtext/elide/data/opengl/manifest.xml | 4 ---- .../visual/qfxtext/elide/data/raster/image0.png | Bin 0 -> 909 bytes .../visual/qfxtext/elide/data/raster/manifest.qml | 6 ++++++ tests/auto/declarative/visual/qfxtext/elide/test | 2 +- tools/qmlviewer/qmlviewer.cpp | 4 +++- 6 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 tests/auto/declarative/visual/qfxtext/elide/data/opengl/image0.png delete mode 100644 tests/auto/declarative/visual/qfxtext/elide/data/opengl/manifest.xml create mode 100644 tests/auto/declarative/visual/qfxtext/elide/data/raster/image0.png create mode 100644 tests/auto/declarative/visual/qfxtext/elide/data/raster/manifest.qml diff --git a/tests/auto/declarative/visual/qfxtext/elide/data/opengl/image0.png b/tests/auto/declarative/visual/qfxtext/elide/data/opengl/image0.png deleted file mode 100644 index 7d45407..0000000 Binary files a/tests/auto/declarative/visual/qfxtext/elide/data/opengl/image0.png and /dev/null differ diff --git a/tests/auto/declarative/visual/qfxtext/elide/data/opengl/manifest.xml b/tests/auto/declarative/visual/qfxtext/elide/data/opengl/manifest.xml deleted file mode 100644 index b784f42..0000000 --- a/tests/auto/declarative/visual/qfxtext/elide/data/opengl/manifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/auto/declarative/visual/qfxtext/elide/data/raster/image0.png b/tests/auto/declarative/visual/qfxtext/elide/data/raster/image0.png new file mode 100644 index 0000000..05dc9ab Binary files /dev/null and b/tests/auto/declarative/visual/qfxtext/elide/data/raster/image0.png differ diff --git a/tests/auto/declarative/visual/qfxtext/elide/data/raster/manifest.qml b/tests/auto/declarative/visual/qfxtext/elide/data/raster/manifest.qml new file mode 100644 index 0000000..6d900f5 --- /dev/null +++ b/tests/auto/declarative/visual/qfxtext/elide/data/raster/manifest.qml @@ -0,0 +1,6 @@ +TestLog { + TestFullFrame { + time: 0 + frameId: 0 + } +} diff --git a/tests/auto/declarative/visual/qfxtext/elide/test b/tests/auto/declarative/visual/qfxtext/elide/test index d35cbc9..bde7c7c 100644 --- a/tests/auto/declarative/visual/qfxtext/elide/test +++ b/tests/auto/declarative/visual/qfxtext/elide/test @@ -1 +1 @@ -elide.xml +elide.qml diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 0417539..2ef5616 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -266,8 +266,10 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); fileMenu->addSeparator(); fileMenu->addAction(quitAction); - if (menu) + if (menu) { menu->setFixedHeight(menu->sizeHint().height()); + menu->setMinimumWidth(10); + } } void QmlViewer::setScaleSkin() -- cgit v0.12 From 5a506eefe1ca8f654dcfc354f8ac39547510becf Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 22 May 2009 09:26:40 +1000 Subject: fix warnings --- src/declarative/debugger/qmlcanvasdebugger.cpp | 4 ++-- src/declarative/debugger/qmldebugger.cpp | 20 ++++++++++---------- src/declarative/debugger/qmlobjecttree.cpp | 4 ++-- src/declarative/debugger/qmlpropertyview.cpp | 2 +- src/declarative/fx/qfxitem.cpp | 2 ++ src/declarative/fx/qfxpathview.cpp | 1 + src/declarative/fx/qfxtext.cpp | 1 - src/declarative/fx/qfxvisualitemmodel.cpp | 2 +- src/declarative/qml/qmlcompositetypemanager.cpp | 4 ++-- src/declarative/qml/qmlcontext.cpp | 2 -- src/declarative/qml/qmlcustomparser.cpp | 1 + src/declarative/qml/qmlscriptparser.cpp | 13 +++++++------ 12 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/declarative/debugger/qmlcanvasdebugger.cpp b/src/declarative/debugger/qmlcanvasdebugger.cpp index fe57bf4..21abd2d 100644 --- a/src/declarative/debugger/qmlcanvasdebugger.cpp +++ b/src/declarative/debugger/qmlcanvasdebugger.cpp @@ -76,7 +76,7 @@ QmlCanvasDebugger::QmlCanvasDebugger(QmlWatches *w, QWidget *parent) QObject::connect(y, SIGNAL(valueChanged(int)), this, SLOT(setY(int))); hlayout->addWidget(x); hlayout->addWidget(y); - QPushButton *pb = new QPushButton("Refresh", this); + QPushButton *pb = new QPushButton(tr("Refresh"), this); QObject::connect(pb, SIGNAL(clicked()), this, SLOT(refresh())); hlayout->addWidget(pb); @@ -233,7 +233,7 @@ void QmlCanvasDebugger::setCanvas(QSimpleCanvas *canvas) return; QTreeWidgetItem *root = new QmlCanvasDebuggerItem(m_tree); - root->setText(0, "Root"); + root->setText(0, tr("Root")); root->setExpanded(true); clone(root, m_canvasRoot, m_debugCanvas->root()); } diff --git a/src/declarative/debugger/qmldebugger.cpp b/src/declarative/debugger/qmldebugger.cpp index 49ad8d9..0bbcb2c 100644 --- a/src/declarative/debugger/qmldebugger.cpp +++ b/src/declarative/debugger/qmldebugger.cpp @@ -85,7 +85,7 @@ QmlDebugger::QmlDebugger(QWidget *parent) QObject::connect(m_tree, SIGNAL(addWatch(QObject*,QString)), this, SLOT(addWatch(QObject*,QString))); vlayout->addWidget(m_tree); - QPushButton *pb = new QPushButton("Refresh", treeWid); + QPushButton *pb = new QPushButton(tr("Refresh"), treeWid); QObject::connect(pb, SIGNAL(clicked()), this, SLOT(refresh())); vlayout->addWidget(pb); @@ -93,28 +93,28 @@ QmlDebugger::QmlDebugger(QWidget *parent) m_text = new QPlainTextEdit(this); m_text->setReadOnly(true); - tabs->addTab(m_text, "File"); + tabs->addTab(m_text, tr("File")); m_warnings = new QTreeWidget(this); m_warnings->setHeaderHidden(true); - tabs->addTab(m_warnings, "Warnings"); + tabs->addTab(m_warnings, tr("Warnings")); m_watches = new QmlWatches(this); m_watchTable = new QTableView(this); m_watchTable->setSelectionMode(QTableWidget::NoSelection); m_watchTable->setModel(m_watches); - tabs->addTab(m_watchTable, "Watches"); + tabs->addTab(m_watchTable, tr("Watches")); m_properties = new QmlPropertyView(m_watches, this); QObject::connect(m_properties, SIGNAL(objectClicked(quint32)), this, SLOT(highlightObject(quint32))); - tabs->addTab(m_properties, "Properties"); + tabs->addTab(m_properties, tr("Properties")); tabs->setCurrentWidget(m_properties); m_canvas = new QmlCanvasDebugger(m_watches, this); QObject::connect(m_canvas, SIGNAL(objectClicked(quint32)), this, SLOT(highlightObject(quint32))); - tabs->addTab(m_canvas, "Canvas"); + tabs->addTab(m_canvas, tr("Canvas")); splitter->addWidget(tabs); splitter->setStretchFactor(1, 2); @@ -229,7 +229,7 @@ bool QmlDebugger::makeItem(QObject *obj, QmlDebuggerItem *item) if(QmlBindableValue *bv = qobject_cast(obj)) { QmlExpressionPrivate *p = bv->d; - text = bv->property().name() + ": " + bv->expression(); + text = bv->property().name() + QLatin1String(": ") + bv->expression(); item->setForeground(0, Qt::green); item->bindableValue = bv; @@ -281,13 +281,13 @@ bool QmlDebugger::makeItem(QObject *obj, QmlDebuggerItem *item) QString toolTipString; if(!p->url.toString().isEmpty()) { item->url = p->url; - toolTipString = "URL: " + p->url.toString(); + toolTipString = QLatin1String("URL: ") + p->url.toString(); } if(!p->typeName.isEmpty()) { if(!toolTipString.isEmpty()) - toolTipString.prepend("\n"); - toolTipString.prepend("Root type: " + text); + toolTipString.prepend(QLatin1Char('\n')); + toolTipString.prepend(tr("Root type: ") + text); text = p->typeName; } diff --git a/src/declarative/debugger/qmlobjecttree.cpp b/src/declarative/debugger/qmlobjecttree.cpp index fb6825a..27dc000 100644 --- a/src/declarative/debugger/qmlobjecttree.cpp +++ b/src/declarative/debugger/qmlobjecttree.cpp @@ -57,7 +57,7 @@ void QmlObjectTree::mousePressEvent(QMouseEvent *me) { QTreeWidget::mousePressEvent(me); if(me->button() == Qt::RightButton && me->type() == QEvent::MouseButtonPress) { - QAction action("Add watch...", 0); + QAction action(tr("Add watch..."), 0); QList actions; actions << &action; QmlDebuggerItem *item = static_cast(currentItem()); @@ -65,7 +65,7 @@ void QmlObjectTree::mousePressEvent(QMouseEvent *me) QMenu::exec(actions, me->globalPos())) { bool ok = false; - QString watch = QInputDialog::getText(this, "Watch expression", "Expression:", QLineEdit::Normal, QString(), &ok); + QString watch = QInputDialog::getText(this, tr("Watch expression"), tr("Expression:"), QLineEdit::Normal, QString(), &ok); if(ok && !watch.isEmpty()) emit addWatch(item->object, watch); diff --git a/src/declarative/debugger/qmlpropertyview.cpp b/src/declarative/debugger/qmlpropertyview.cpp index e32393c..0d34fd9 100644 --- a/src/declarative/debugger/qmlpropertyview.cpp +++ b/src/declarative/debugger/qmlpropertyview.cpp @@ -56,7 +56,7 @@ QmlPropertyView::QmlPropertyView(QmlWatches *watches, QWidget *parent) setLayout(layout); m_tree = new QTreeWidget(this); - m_tree->setHeaderLabels(QStringList() << "Property" << "Value"); + m_tree->setHeaderLabels(QStringList() << tr("Property") << tr("Value")); QObject::connect(m_tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem *))); QObject::connect(m_tree, SIGNAL(itemClicked(QTreeWidgetItem *, int)), diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 17fe36a..e5ede53 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -1674,6 +1674,7 @@ void QFxItem::setKeepMouseGrab(bool keep) */ void QFxItem::activeFocusChanged(bool flag) { + Q_UNUSED(flag); emit activeFocusChanged(); } @@ -1683,6 +1684,7 @@ void QFxItem::activeFocusChanged(bool flag) */ void QFxItem::focusChanged(bool flag) { + Q_UNUSED(flag); emit focusChanged(); } diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index e315547..3f2e77a 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -744,6 +744,7 @@ void QFxPathView::createdItem(int index, QFxItem *item) void QFxPathView::destroyingItem(QFxItem *item) { + Q_UNUSED(item); } void QFxPathView::ticked() diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index e84255d..be90723 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -607,7 +607,6 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout) QImage QFxTextPrivate::wrappedTextImage(bool drawStyle) { //do layout - Q_Q(const QFxText); QFont f; if (_font) f = _font->font(); QSize size = cachedLayoutSize; diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index b9ddcb9..039998a 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -621,7 +621,7 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj int QFxVisualItemModel::indexOf(QFxItem *item, QObject *objectContext) const { - QmlExpression e(qmlContext(item), "index", objectContext); + QmlExpression e(qmlContext(item), QLatin1String("index"), objectContext); e.setTrackChange(false); QVariant value = e.value(); if (value.isValid()) diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp index e1124a6..0da1a92 100644 --- a/src/declarative/qml/qmlcompositetypemanager.cpp +++ b/src/declarative/qml/qmlcompositetypemanager.cpp @@ -315,7 +315,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) continue; } - QUrl url = engine->componentUrl(QUrl(type + ".qml"), QUrl(unit->url)); + QUrl url = engine->componentUrl(QUrl(QLatin1String(type + ".qml")), QUrl(unit->url)); QmlCompositeTypeData *urlUnit = components.value(url.toString()); if (!urlUnit) { @@ -335,7 +335,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) { QmlError error; error.setUrl(unit->url); - error.setDescription("Type " + type + " unavailable"); + error.setDescription(tr("Type %1 unavailable").arg(QLatin1String(type))); unit->errors << error; } if (urlUnit->errorType != QmlCompositeTypeData::AccessError) diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index ea72ebf..e5016f2 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -73,8 +73,6 @@ void QmlContextPrivate::dump(int depth) void QmlContextPrivate::destroyed(QObject *obj) { - Q_Q(QmlContext); - defaultObjects.removeAll(obj); QVariant variantObject = QVariant::fromValue(obj); diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qmlcustomparser.cpp index a60f783..2e8c8f6 100644 --- a/src/declarative/qml/qmlcustomparser.cpp +++ b/src/declarative/qml/qmlcustomparser.cpp @@ -224,6 +224,7 @@ QList QmlCustomParserProperty::assignedValues() const QByteArray QmlCustomParser::compile(const QList &, bool *ok) { + Q_UNUSED(ok); return QByteArray(); } diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index 01600b9..5b3564f 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -10,6 +10,7 @@ #include "parser/javascriptast_p.h" #include +#include #include #include @@ -207,8 +208,8 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, { int lastTypeDot = objectType.lastIndexOf(QLatin1Char('.')); bool isType = !objectType.isEmpty() && - (objectType.at(0).isUpper() | - lastTypeDot >= 0 && objectType.at(lastTypeDot+1).isUpper()); + (objectType.at(0).isUpper() || + (lastTypeDot >= 0 && objectType.at(lastTypeDot+1).isUpper())); int propertyCount = 0; for (; propertyName; propertyName = propertyName->next){ @@ -221,7 +222,7 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, if(propertyCount || !currentObject()) { QmlError error; - error.setDescription("Expected type name"); + error.setDescription(QCoreApplication::translate("QmlParser","Expected type name")); error.setLine(typeLocation.startLine); error.setColumn(typeLocation.startColumn); _parser->_errors << error; @@ -427,7 +428,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node) if(!typeFound) { QmlError error; - error.setDescription("Expected property type"); + error.setDescription(QCoreApplication::translate("QmlParser","Expected property type")); error.setLine(node->typeToken.startLine); error.setColumn(node->typeToken.startColumn); _parser->_errors << error; @@ -573,7 +574,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node) if(funDecl->formals) { QmlError error; - error.setDescription("Slot declarations must be parameterless"); + error.setDescription(QCoreApplication::translate("QmlParser","Slot declarations must be parameterless")); error.setLine(funDecl->lparenToken.startLine); error.setColumn(funDecl->lparenToken.startColumn); _parser->_errors << error; @@ -587,7 +588,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node) obj->dynamicSlots << slot; } else { QmlError error; - error.setDescription("JavaScript declaration outside Script element"); + error.setDescription(QCoreApplication::translate("QmlParser","JavaScript declaration outside Script element")); error.setLine(node->firstSourceLocation().startLine); error.setColumn(node->firstSourceLocation().startColumn); _parser->_errors << error; -- cgit v0.12 From 61943383ccff409d60d9837d58e4372dc6f22f23 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 22 May 2009 10:32:16 +1000 Subject: Add support for baseline anchoring. --- src/declarative/fx/qfxanchors.cpp | 52 ++++++++++++++++++++-- src/declarative/fx/qfxanchors.h | 5 +++ src/declarative/fx/qfxanchors_p.h | 1 + src/declarative/fx/qfxitem.cpp | 55 ++++++++++-------------- src/declarative/fx/qfxitem.h | 2 + src/declarative/fx/qfxitem_p.h | 1 + src/declarative/fx/qfxtext.cpp | 4 -- tests/auto/declarative/anchors/data/illegal1.qml | 10 +++++ tests/auto/declarative/anchors/data/illegal2.qml | 11 +++++ tests/auto/declarative/anchors/data/illegal3.qml | 10 +++++ tests/auto/declarative/anchors/tst_anchors.cpp | 43 ++++++++++++++++++ 11 files changed, 154 insertions(+), 40 deletions(-) create mode 100644 tests/auto/declarative/anchors/data/illegal1.qml create mode 100644 tests/auto/declarative/anchors/data/illegal2.qml create mode 100644 tests/auto/declarative/anchors/data/illegal3.qml diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index 235511f..681a9fa 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -146,6 +146,7 @@ QFxAnchors::~QFxAnchors() d->remDepend(d->bottom.item); d->remDepend(d->vCenter.item); d->remDepend(d->hCenter.item); + d->remDepend(d->baseline.item); } void QFxAnchorsPrivate::fillChanged() @@ -210,6 +211,10 @@ void QFxAnchorsPrivate::clearItem(QFxItem *item) hCenter.item = 0; usedAnchors &= ~QFxAnchors::HasHCenterAnchor; } + if (baseline.item == item) { + baseline.item = 0; + usedAnchors &= ~QFxAnchors::HasBaselineAnchor; + } } void QFxAnchorsPrivate::addDepend(QFxItem *item) @@ -430,8 +435,6 @@ void QFxAnchorsPrivate::updateVerticalAnchors() } else if (bottom.item->itemParent() == item->itemParent()) { setItemY(position(bottom.item, bottom.anchorLine) - item->height() - bottomMargin); } - - } else if (usedAnchors & QFxAnchors::HasVCenterAnchor) { //(stetching handled above) @@ -442,6 +445,11 @@ void QFxAnchorsPrivate::updateVerticalAnchors() } else if (vCenter.item->itemParent() == item->itemParent()) { setItemY(position(vCenter.item, vCenter.anchorLine) - item->height()/2 + vCenterOffset); } + } else if (usedAnchors & QFxAnchors::HasBaselineAnchor) { + //Handle baseline + if (baseline.item->itemParent() == item->itemParent()) { + setItemY(position(baseline.item, baseline.anchorLine) - item->baselineOffset()); + } } updatingVerticalAnchor = false; } else { @@ -599,6 +607,36 @@ void QFxAnchors::resetVerticalCenter() setVerticalCenter(QFxAnchorLine()); } +QFxAnchorLine QFxAnchors::baseline() const +{ + Q_D(const QFxAnchors); + return d->baseline; +} + +void QFxAnchors::setBaseline(const QFxAnchorLine &edge) +{ + Q_D(QFxAnchors); + if (!d->checkVAnchorValid(edge)) + return; + + if (edge.item) + d->usedAnchors |= HasBaselineAnchor; + else + d->usedAnchors &= ~HasBaselineAnchor; + + d->checkVValid(); + + d->remDepend(d->baseline.item); + d->baseline = edge; + d->addDepend(d->baseline.item); + d->updateVerticalAnchors(); +} + +void QFxAnchors::resetBaseline() +{ + setBaseline(QFxAnchorLine()); +} + QFxAnchorLine QFxAnchors::left() const { Q_D(const QFxAnchors); @@ -797,7 +835,7 @@ bool QFxAnchorsPrivate::checkHValid() const if (usedAnchors & QFxAnchors::HasLeftAnchor && usedAnchors & QFxAnchors::HasRightAnchor && usedAnchors & QFxAnchors::HasHCenterAnchor) { - qmlInfo(item) << "Can't specify left, right, and hcenter anchors"; + qmlInfo(item) << "Can't specify left, right, and hcenter anchors."; return false; } @@ -822,7 +860,13 @@ bool QFxAnchorsPrivate::checkVValid() const if (usedAnchors & QFxAnchors::HasTopAnchor && usedAnchors & QFxAnchors::HasBottomAnchor && usedAnchors & QFxAnchors::HasVCenterAnchor) { - qmlInfo(item) << "Can't specify top, bottom, and vcenter anchors"; + qmlInfo(item) << "Can't specify top, bottom, and vcenter anchors."; + return false; + } else if (usedAnchors & QFxAnchors::HasBaselineAnchor && + (usedAnchors & QFxAnchors::HasTopAnchor || + usedAnchors & QFxAnchors::HasBottomAnchor || + usedAnchors & QFxAnchors::HasVCenterAnchor)) { + qmlInfo(item) << "Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."; return false; } diff --git a/src/declarative/fx/qfxanchors.h b/src/declarative/fx/qfxanchors.h index 9d776ab..3f142c4 100644 --- a/src/declarative/fx/qfxanchors.h +++ b/src/declarative/fx/qfxanchors.h @@ -91,6 +91,7 @@ class Q_DECLARATIVE_EXPORT QFxAnchors : public QObject Q_PROPERTY(QFxAnchorLine top READ top WRITE setTop RESET resetTop); Q_PROPERTY(QFxAnchorLine bottom READ bottom WRITE setBottom RESET resetBottom); Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter); + Q_PROPERTY(QFxAnchorLine baseline READ baseline WRITE setBaseline RESET resetBaseline); Q_PROPERTY(int leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged); Q_PROPERTY(int rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged); Q_PROPERTY(int horizontalCenterOffset READ horizontalCenterOffset WRITE setHorizontalCenterOffset NOTIFY horizontalCenterOffsetChanged()); @@ -141,6 +142,10 @@ public: void setVerticalCenter(const QFxAnchorLine &edge); void resetVerticalCenter(); + QFxAnchorLine baseline() const; + void setBaseline(const QFxAnchorLine &edge); + void resetBaseline(); + int leftMargin() const; void setLeftMargin(int); diff --git a/src/declarative/fx/qfxanchors_p.h b/src/declarative/fx/qfxanchors_p.h index b90380a..32d8b75 100644 --- a/src/declarative/fx/qfxanchors_p.h +++ b/src/declarative/fx/qfxanchors_p.h @@ -117,6 +117,7 @@ public: QFxAnchorLine bottom; QFxAnchorLine vCenter; QFxAnchorLine hCenter; + QFxAnchorLine baseline; int leftMargin; int rightMargin; diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 3cbcd6a..561a124 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -259,24 +259,10 @@ void QFxContents::setItem(QFxItem *item) */ /*! - \fn void QFxItem::baselineChanged() - - This signal is emitted when the baseline of the item changes. - - The baseline may change in response to a change to the baselineOffset - property or due to the geometry of the item changing. -*/ - -/*! \fn void QFxItem::baselineOffsetChanged() - This signal is emitted when the baseline of the item is changed - via the baselineOffset property. - - The baseline corresponds to the baseline of the text contained in - the item. It is useful for aligning the text in items placed - beside each other. The default baseline is positioned at - 2/3 of the height of the item. + This signal is emitted when the baseline offset of the item + is changed. */ /*! @@ -286,24 +272,12 @@ void QFxContents::setItem(QFxItem *item) */ /*! - \fn void QFxItem::rightChanged() - - This signal is emitted when the right coordinate of the item changes. -*/ - -/*! \fn void QFxItem::topChanged() This signal is emitted when the top coordinate of the item changes. */ /*! - \fn void QFxItem::bottomChanged() - - This signal is emitted when the bottom coordinate of the item changes. -*/ - -/*! \fn void QFxItem::widthChanged() This signal is emitted when the width of the item changes. @@ -1282,6 +1256,15 @@ QFxAnchorLine QFxItem::verticalCenter() const } /*! + \internal +*/ +QFxAnchorLine QFxItem::baseline() const +{ + Q_D(const QFxItem); + return d->anchorLines()->baseline; +} + +/*! \property QFxItem::top One of the anchor lines of the item. @@ -1336,6 +1319,7 @@ QFxAnchorLine QFxItem::verticalCenter() const \qmlproperty AnchorLine Item::right \qmlproperty AnchorLine Item::horizontalCenter \qmlproperty AnchorLine Item::verticalCenter + \qmlproperty AnchorLine Item::baseline The anchor lines of the item. @@ -1349,6 +1333,7 @@ QFxAnchorLine QFxItem::verticalCenter() const \qmlproperty AnchorLine Item::anchors.right \qmlproperty AnchorLine Item::anchors.horizontalCenter \qmlproperty AnchorLine Item::anchors.verticalCenter + \qmlproperty AnchorLine Item::anchors.baseline \qmlproperty Item Item::anchors.fill @@ -1408,20 +1393,19 @@ QFxAnchorLine QFxItem::verticalCenter() const /*! \property QFxItem::baselineOffset - \brief The position of the item's baseline in global (scene) coordinates. + \brief The position of the item's baseline in local coordinates. The baseline of a Text item is the imaginary line on which the text sits. Controls containing text usually set their baseline to the baseline of their text. - For non-text items, a default baseline offset of two-thirds of the - item's height is used to determine the baseline. + For non-text items, a default baseline offset of 0 is used. */ int QFxItem::baselineOffset() const { Q_D(const QFxItem); if (!d->_baselineOffset.isValid()) { - return height()*2/3; //### default baseline is 2/3 of the way to the bottom of the item + return 0; } else return d->_baselineOffset; } @@ -1437,6 +1421,11 @@ void QFxItem::setBaselineOffset(int offset) d->_baselineOffset = offset; emit baselineOffsetChanged(); + + for(int ii = 0; ii < d->dependantAnchors.count(); ++ii) { + QFxAnchors *anchor = d->dependantAnchors.at(ii); + anchor->d_func()->updateVerticalAnchors(); + } } /*! @@ -2100,6 +2089,8 @@ QFxItemPrivate::AnchorLines::AnchorLines(QFxItem *q) bottom.anchorLine = QFxAnchorLine::Bottom; vCenter.item = q; vCenter.anchorLine = QFxAnchorLine::VCenter; + baseline.item = q; + baseline.anchorLine = QFxAnchorLine::Baseline; } QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index d34a9fb..0b4f897 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -127,6 +127,7 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QSimpleCanvasItem, public QmlParserS Q_PROPERTY(QFxAnchorLine top READ top) Q_PROPERTY(QFxAnchorLine bottom READ bottom) Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter) + Q_PROPERTY(QFxAnchorLine baseline READ baseline) Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) @@ -258,6 +259,7 @@ private: QFxAnchorLine top() const; QFxAnchorLine bottom() const; QFxAnchorLine verticalCenter() const; + QFxAnchorLine baseline() const; void init(QFxItem *parent); friend class QmlStatePrivate; diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index 85ce171..b5f9554 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -157,6 +157,7 @@ public: QFxAnchorLine top; QFxAnchorLine bottom; QFxAnchorLine vCenter; + QFxAnchorLine baseline; }; mutable AnchorLines *_anchorLines; AnchorLines *anchorLines() const { diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index e84255d..2542413 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -571,7 +571,6 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout) QFont f; if (_font) f = _font->font(); QFontMetrics fm = QFontMetrics(f); - int leading = fm.leading(); int height = 0; qreal widthUsed = 0; qreal lineWidth = 0; @@ -592,9 +591,6 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout) } layout->endLayout(); - if (layout->lineCount() == 1) - height -= leading; - for (int i = 0; i < layout->lineCount(); ++i) { QTextLine line = layout->lineAt(i); widthUsed = qMax(widthUsed, line.naturalTextWidth()); diff --git a/tests/auto/declarative/anchors/data/illegal1.qml b/tests/auto/declarative/anchors/data/illegal1.qml new file mode 100644 index 0000000..635bf95 --- /dev/null +++ b/tests/auto/declarative/anchors/data/illegal1.qml @@ -0,0 +1,10 @@ +Rect { + id: rect + width: 120; height: 200; color: "white" + Rect { id: TheRect; width: 100; height: 100 } + Rect { + anchors.left: TheRect.left + anchors.right: TheRect.right + anchors.horizontalCenter: TheRect.horizontalCenter + } +} diff --git a/tests/auto/declarative/anchors/data/illegal2.qml b/tests/auto/declarative/anchors/data/illegal2.qml new file mode 100644 index 0000000..425d0e4 --- /dev/null +++ b/tests/auto/declarative/anchors/data/illegal2.qml @@ -0,0 +1,11 @@ +Rect { + id: rect + width: 120; height: 200; color: "white" + Text { id: Text1; text: "Hello" } + Text { + id: Text2; + anchors.baseline: Text1.baseline; + anchors.top: Text1.top; + text: "World" + } +} diff --git a/tests/auto/declarative/anchors/data/illegal3.qml b/tests/auto/declarative/anchors/data/illegal3.qml new file mode 100644 index 0000000..fa48b78 --- /dev/null +++ b/tests/auto/declarative/anchors/data/illegal3.qml @@ -0,0 +1,10 @@ +Rect { + id: rect + width: 120; height: 200; color: "white" + Item { + Rect { id: TheRect; width: 100; height: 100 } + } + Rect { + anchors.left: TheRect.left + } +} diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp index 8087d6e..587b4ab 100644 --- a/tests/auto/declarative/anchors/tst_anchors.cpp +++ b/tests/auto/declarative/anchors/tst_anchors.cpp @@ -16,6 +16,7 @@ public: private slots: void basicAnchors(); void loops(); + void illegalSets(); }; /* @@ -118,6 +119,48 @@ void tst_anchors::loops() } } +void tst_anchors::illegalSets() +{ + { + QFxView *view = new QFxView; + + view->setUrl(QUrl("file://" SRCDIR "/data/illegal1.qml")); + + //### ignoreMessage doesn't seem to work + //QTest::ignoreMessage(QtWarningMsg, "QML QFxRect (unknown location): Can't specify left, right, and hcenter anchors."); + view->execute(); + qApp->processEvents(); + + delete view; + } + + { + QFxView *view = new QFxView; + + view->setUrl(QUrl("file://" SRCDIR "/data/illegal2.qml")); + + //### ignoreMessage doesn't seem to work here + //QTest::ignoreMessage(QtWarningMsg, "QML QFxText (unknown location): Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."); + view->execute(); + //qApp->processEvents(); + + delete view; + } + + { + QFxView *view = new QFxView; + + view->setUrl(QUrl("file://" SRCDIR "/data/illegal3.qml")); + + //### ignoreMessage doesn't seem to work here + //QTest::ignoreMessage(QtWarningMsg, "Can't anchor to an item that isn't a parent or sibling."); + view->execute(); + qApp->processEvents(); + + delete view; + } +} + QTEST_MAIN(tst_anchors) #include "tst_anchors.moc" -- cgit v0.12 From d62ebb5cc452c894afde0da4ba4dd3bc2456ceb9 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 22 May 2009 13:03:12 +1000 Subject: Don't rely on qreal being a double. --- src/declarative/qml/qmlmetaproperty.cpp | 16 ++++++++-------- src/declarative/qml/script/qmlbasicscript.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index e3e9ff5..3aa4f1d 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -730,19 +730,19 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value) switch(t) { case QVariant::Double: { - qreal r; + double d; bool found = true; if (vt == QVariant::Int) { - r = value.toInt(); + d = value.toInt(); } else if (vt == QVariant::UInt) { - r = value.toUInt(); + d = value.toUInt(); } else { found = false; } if (found) { void *a[1]; - a[0] = &r; + a[0] = &d; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); @@ -906,19 +906,19 @@ void QmlMetaProperty::write(const QVariant &value) const switch(t) { case QVariant::Double: { - qreal r; + double dd; bool found = true; if (vt == QVariant::Int) { - r = value.toInt(); + dd = value.toInt(); } else if (vt == QVariant::UInt) { - r = value.toUInt(); + dd = value.toUInt(); } else { found = false; } if (found) { void *a[1]; - a[0] = &r; + a[0] = ⅆ QMetaObject::metacall(object(), QMetaObject::WriteProperty, d->coreIdx, a); diff --git a/src/declarative/qml/script/qmlbasicscript.cpp b/src/declarative/qml/script/qmlbasicscript.cpp index e0a668a..37a6678 100644 --- a/src/declarative/qml/script/qmlbasicscript.cpp +++ b/src/declarative/qml/script/qmlbasicscript.cpp @@ -139,9 +139,16 @@ static QVariant fetch_value(QObject *o, int idx, int type) } break; case 135: + { + float val; + void *args[] = { &val, 0 }; + QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); + return QVariant(val); + } + break; case QVariant::Double: { - qreal val; + double val; void *args[] = { &val, 0 }; QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); return QVariant(val); -- cgit v0.12 From 2575eac4c26ad92dde95959a82f576edc3e76e1d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 22 May 2009 13:05:11 +1000 Subject: Naively fix handling of qreal properties for ARM. This gets things working, but isn't ideal as it treats qreal properties as type double on ARM (where they should be of type float). --- src/declarative/qml/qmlvme.cpp | 3 ++- src/tools/moc/generator.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 1552cb5..a5cc649 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -1017,7 +1017,8 @@ void QmlVME::runStoreInstruction(QStack &stack, QFxCompilerTimer cc; #endif QObject *target = stack.top(); - qreal r = instr.storeReal.value; + //### moc treats qreal properties as having type double + double r = static_cast(instr.storeReal.value); void *a[1]; a[0] = &r; QMetaObject::metacall(target, QMetaObject::WriteProperty, diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 7d617a3..dbad4dc 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -758,6 +758,9 @@ void Generator::generateMetacall() else if (cdef->enumDeclarations.value(p.type, false)) fprintf(out, " case %d: *reinterpret_cast(_v) = QFlag(%s()); break;\n", propindex, p.read.constData()); + else if (p.type == "qreal") + fprintf(out, " case %d: *reinterpret_cast< double*>(_v) = %s(); break;\n", + propindex, p.read.constData()); else fprintf(out, " case %d: *reinterpret_cast< %s*>(_v) = %s(); break;\n", propindex, p.type.constData(), p.read.constData()); @@ -782,6 +785,9 @@ void Generator::generateMetacall() if (cdef->enumDeclarations.value(p.type, false)) { fprintf(out, " case %d: %s(QFlag(*reinterpret_cast(_v))); break;\n", propindex, p.write.constData()); + } else if(p.type == "qreal") { + fprintf(out, " case %d: %s(*reinterpret_cast< double*>(_v)); break;\n", + propindex, p.write.constData()); } else { fprintf(out, " case %d: %s(*reinterpret_cast< %s*>(_v)); break;\n", propindex, p.write.constData(), p.type.constData()); -- cgit v0.12 From 6ddbc147cadc4d450bb8e20cedf1b99e0fcbf894 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 22 May 2009 13:47:04 +1000 Subject: Store the type of the attached properties object --- src/declarative/qml/qmlmetatype.cpp | 14 +++- src/declarative/qml/qmlmetatype.h | 24 +++++-- src/declarative/qml/qmlprivate.h | 96 +++++++++++++++++----------- tests/auto/declarative/qmlparser/testtypes.h | 2 +- 4 files changed, 90 insertions(+), 46 deletions(-) diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp index 2e490a4..6d44f7a 100644 --- a/src/declarative/qml/qmlmetatype.cpp +++ b/src/declarative/qml/qmlmetatype.cpp @@ -112,6 +112,7 @@ public: QmlPrivate::Func m_opFunc; const QMetaObject *m_baseMetaObject; QmlAttachedPropertiesFunc m_attachedPropertiesFunc; + const QMetaObject *m_attachedPropertiesType; int m_parserStatusCast; QmlPrivate::CreateFunc m_extFunc; const QMetaObject *m_extMetaObject; @@ -124,7 +125,7 @@ public: QmlTypePrivate::QmlTypePrivate() : m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0), m_qmlListId(0), - m_opFunc(0), m_baseMetaObject(0), m_attachedPropertiesFunc(0), + m_opFunc(0), m_baseMetaObject(0), m_attachedPropertiesFunc(0), m_attachedPropertiesType(0), m_parserStatusCast(-1), m_extFunc(0), m_extMetaObject(0), m_index(-1), m_customParser(0), m_isSetup(false) { @@ -149,6 +150,7 @@ QmlType::QmlType(int type, int listType, int qmlListType, QmlPrivate::Func opFunc, const char *qmlName, const QMetaObject *metaObject, QmlAttachedPropertiesFunc attachedPropertiesFunc, + const QMetaObject *attachedType, int parserStatusCast, QmlPrivate::CreateFunc extFunc, const QMetaObject *extMetaObject, int index, QmlCustomParser *customParser) @@ -161,6 +163,7 @@ QmlType::QmlType(int type, int listType, int qmlListType, d->m_opFunc = opFunc; d->m_baseMetaObject = metaObject; d->m_attachedPropertiesFunc = attachedPropertiesFunc; + d->m_attachedPropertiesType = attachedType; d->m_parserStatusCast = parserStatusCast; d->m_extFunc = extFunc; d->m_index = index; @@ -348,6 +351,11 @@ QmlAttachedPropertiesFunc QmlType::attachedPropertiesFunction() const return d->m_attachedPropertiesFunc; } +const QMetaObject *QmlType::attachedPropertiesType() const +{ + return d->m_attachedPropertiesType; +} + int QmlType::parserStatusCast() const { return d->m_parserStatusCast; @@ -404,7 +412,7 @@ int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id, return index; } -int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Func func, const char *cname, const QMetaObject *mo, QmlAttachedPropertiesFunc attach, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *parser) +int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Func func, const char *cname, const QMetaObject *mo, QmlAttachedPropertiesFunc attach, const QMetaObject *attachMo, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *parser) { Q_UNUSED(object); QWriteLocker lock(metaTypeDataLock()); @@ -421,7 +429,7 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun int index = data->types.count(); QmlType *type = new QmlType(id.typeId, id.listId, id.qmlListId, - func, cname, mo, attach, pStatus, extFunc, + func, cname, mo, attach, attachMo, pStatus, extFunc, extmo, index, parser); data->types.append(type); diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h index cc3887c..d10a0f0 100644 --- a/src/declarative/qml/qmlmetatype.h +++ b/src/declarative/qml/qmlmetatype.h @@ -59,7 +59,7 @@ class QmlCustomParser; class Q_DECLARATIVE_EXPORT QmlMetaType { public: - static int registerType(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *); + static int registerType(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *); static int registerInterface(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *); static bool copy(int type, void *data, const void *copy = 0); @@ -136,6 +136,7 @@ public: const QMetaObject *baseMetaObject() const; QmlAttachedPropertiesFunc attachedPropertiesFunction() const; + const QMetaObject *attachedPropertiesType() const; int parserStatusCast() const; QVariant fromObject(QObject *) const; @@ -146,7 +147,7 @@ private: friend class QmlMetaType; friend class QmlTypePrivate; QmlType(int, int, int, QmlPrivate::Func, const char *, int); - QmlType(int, int, int, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, int, QmlPrivate::CreateFunc, const QMetaObject *, int, QmlCustomParser *); + QmlType(int, int, int, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int, QmlPrivate::CreateFunc, const QMetaObject *, int, QmlCustomParser *); ~QmlType(); QmlTypePrivate *d; @@ -165,6 +166,7 @@ int qmlRegisterType(const char *typeName) return QmlMetaType::registerType(ids, QmlPrivate::list_nocreate_op, 0, &T::staticMetaObject, QmlPrivate::attachedPropertiesFunc(), + QmlPrivate::attachedPropertiesMetaObject(), QmlPrivate::StaticCastSelector::cast(), QmlPrivate::StaticCastSelector::cast(), 0, 0, 0); @@ -183,6 +185,7 @@ int qmlRegisterType(const char *qmlName, const char *typeName) return QmlMetaType::registerType(ids, QmlPrivate::list_op, qmlName, &T::staticMetaObject, QmlPrivate::attachedPropertiesFunc(), + QmlPrivate::attachedPropertiesMetaObject(), QmlPrivate::StaticCastSelector::cast(), QmlPrivate::StaticCastSelector::cast(), 0, 0, 0); @@ -200,11 +203,15 @@ int qmlRegisterExtendedType(const char *typeName) QmlAttachedPropertiesFunc attached = QmlPrivate::attachedPropertiesFunc(); - if (!attached) + const QMetaObject * attachedMo = + QmlPrivate::attachedPropertiesMetaObject(); + if (!attached) { attached = QmlPrivate::attachedPropertiesFunc(); + attachedMo = QmlPrivate::attachedPropertiesMetaObject(); + } return QmlMetaType::registerType(ids, QmlPrivate::list_nocreate_op, 0, - &T::staticMetaObject, attached, + &T::staticMetaObject, attached, attachedMo, QmlPrivate::StaticCastSelector::cast(), QmlPrivate::StaticCastSelector::cast(), &QmlPrivate::CreateParent::create, &E::staticMetaObject, 0); @@ -222,13 +229,17 @@ int qmlRegisterExtendedType(const char *qmlName, const char *typeName) QmlAttachedPropertiesFunc attached = QmlPrivate::attachedPropertiesFunc(); - if (!attached) + const QMetaObject * attachedMo = + QmlPrivate::attachedPropertiesMetaObject(); + if (!attached) { attached = QmlPrivate::attachedPropertiesFunc(); + attachedMo = QmlPrivate::attachedPropertiesMetaObject(); + } return QmlMetaType::registerType(ids, QmlPrivate::list_op, qmlName, &T::staticMetaObject, - attached, + attached, attachedMo, QmlPrivate::StaticCastSelector::cast(), QmlPrivate::StaticCastSelector::cast(), &QmlPrivate::CreateParent::create, @@ -263,6 +274,7 @@ int qmlRegisterCustomType(const char *qmlName, const char *typeName, QmlCustomPa return QmlMetaType::registerType(ids, QmlPrivate::list_op, qmlName, &T::staticMetaObject, QmlPrivate::attachedPropertiesFunc(), + QmlPrivate::attachedPropertiesMetaObject(), QmlPrivate::StaticCastSelector::cast(), QmlPrivate::StaticCastSelector::cast(), 0, 0, parser); diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h index 590e0c0..2a9c503 100644 --- a/src/declarative/qml/qmlprivate.h +++ b/src/declarative/qml/qmlprivate.h @@ -123,57 +123,81 @@ namespace QmlPrivate } }; - template - struct AttachedPropertySelector - { - static inline QmlAttachedPropertiesFunc func() - { - return 0; - } - }; - template - struct AttachedPropertySelector - { - static inline QmlAttachedPropertiesFunc func() - { - return &T::qmlAttachedProperties; - } - }; - - template < typename T > - class has_attachedProperties { + template + class has_attachedPropertiesMember + { typedef int yes_type; typedef char no_type; + template + struct Selector {}; - template - struct dummy {}; - - template - struct dummy_const {}; - - template - struct dummy_static {}; + template + static yes_type test(Selector*); - template - static no_type check(dummy *); + template + static no_type test(...); - template - static no_type check(dummy_const *); + public: + static bool const value = sizeof(test(0)) == sizeof(yes_type); + }; - template - static yes_type check(dummy_static *); + template + class has_attachedPropertiesMethod + { + typedef int yes_type; + typedef char no_type; - template + template + static yes_type check(ReturnType *(*)(QObject *)); static no_type check(...); public: - static bool const value = sizeof(check(0)) == sizeof(yes_type); + static bool const value = sizeof(check(&T::qmlAttachedProperties)) == sizeof(yes_type); }; + template + class has_attachedPropertiesMethod + { + public: + static bool const value = false; + }; + + template + class AttachedPropertySelector + { + public: + static inline QmlAttachedPropertiesFunc func() { return 0; } + static inline const QMetaObject *metaObject() { return 0; } + }; + template + class AttachedPropertySelector + { + static inline QObject *attachedProperties(QObject *obj) { + return T::qmlAttachedProperties(obj); + } + template + static inline const QMetaObject *attachedPropertiesMetaObject(ReturnType *(*)(QObject *)) { + return &ReturnType::staticMetaObject; + } + public: + static inline QmlAttachedPropertiesFunc func() { + return &attachedProperties; + } + static inline const QMetaObject *metaObject() { + return attachedPropertiesMetaObject(&T::qmlAttachedProperties); + } + }; + template inline QmlAttachedPropertiesFunc attachedPropertiesFunc() { - return AttachedPropertySelector::value>::func(); + return AttachedPropertySelector::value>::value>::func(); + } + + template + inline const QMetaObject *attachedPropertiesMetaObject() + { + return AttachedPropertySelector::value>::value>::metaObject(); } struct MetaTypeIds { diff --git a/tests/auto/declarative/qmlparser/testtypes.h b/tests/auto/declarative/qmlparser/testtypes.h index c1f85b9..e124631 100644 --- a/tests/auto/declarative/qmlparser/testtypes.h +++ b/tests/auto/declarative/qmlparser/testtypes.h @@ -66,7 +66,7 @@ public: MyInterface *interface() const { return m_interface; } void setInterface(MyInterface *iface) { m_interface = iface; } - static QObject *qmlAttachedProperties(QObject *other) { + static MyQmlObject *qmlAttachedProperties(QObject *other) { MyQmlObject *rv = new MyQmlObject; rv->setParent(other); return rv; -- cgit v0.12 From ce49990c3764304e76b4d2c1705fcad677ec9f73 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 22 May 2009 15:38:57 +1000 Subject: Add canvas framerate monitor application --- src/declarative/canvas/monitor/main.cpp | 287 +++++++++++++++++++++++++ src/declarative/canvas/monitor/monitor.pro | 8 + src/declarative/canvas/qsimplecanvasserver.cpp | 31 ++- src/declarative/canvas/qsimplecanvasserver_p.h | 4 + 4 files changed, 328 insertions(+), 2 deletions(-) create mode 100644 src/declarative/canvas/monitor/main.cpp create mode 100644 src/declarative/canvas/monitor/monitor.pro diff --git a/src/declarative/canvas/monitor/main.cpp b/src/declarative/canvas/monitor/main.cpp new file mode 100644 index 0000000..f5f40bd --- /dev/null +++ b/src/declarative/canvas/monitor/main.cpp @@ -0,0 +1,287 @@ +#include +#include +#include +#include +#include + +class QLineGraph : public QWidget +{ +Q_OBJECT +public: + QLineGraph(QWidget * = 0); + + void setPosition(int); + +public slots: + void addSample(int, int, int, int, bool); + +protected: + virtual void paintEvent(QPaintEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void showEvent(QShowEvent *); + +private slots: + void scrollbarChanged(int); + +private: + void positionScrollbar(); + void updateScrollbar(); + void drawSample(QPainter *, int, const QRect &); + void drawTime(QPainter *, const QRect &); + struct Sample { + int sample[4]; + bool isBreak; + }; + QList _samples; + + QScrollBar sb; + int position; + int samplesPerWidth; + int resolutionForHeight; + bool ignoreScroll; +}; + +QLineGraph::QLineGraph(QWidget *parent) +: QWidget(parent), sb(Qt::Horizontal, this), position(-1), samplesPerWidth(99), resolutionForHeight(50), ignoreScroll(false) +{ + sb.setMaximum(0); + sb.setMinimum(0); + sb.setSingleStep(1); + + QObject::connect(&sb, SIGNAL(valueChanged(int)), this, SLOT(scrollbarChanged(int))); +} + +void QLineGraph::scrollbarChanged(int v) +{ + if(ignoreScroll) + return; + + position = v; + update(); +} + +void QLineGraph::positionScrollbar() +{ + sb.setFixedWidth(width()); + sb.move(0, height() - sb.height()); +} + +void QLineGraph::resizeEvent(QResizeEvent *e) +{ + QWidget::resizeEvent(e); + positionScrollbar(); +} + +void QLineGraph::showEvent(QShowEvent *e) +{ + QWidget::showEvent(e); + positionScrollbar(); +} + +void QLineGraph::mousePressEvent(QMouseEvent *) +{ + if(position == -1) { + position = qMax(0, _samples.count() - samplesPerWidth - 1); + } else { + position = -1; + } + update(); +} + +void QLineGraph::updateScrollbar() +{ + ignoreScroll = true; + sb.setMaximum(qMax(0, _samples.count() - samplesPerWidth - 1)); + + if(position == -1) { + sb.setValue(sb.maximum()); + } else { + sb.setValue(position); + } + ignoreScroll = false; +} + +void QLineGraph::addSample(int a, int b, int c, int d, bool isBreak) +{ + Sample s; + s.isBreak = isBreak; + s.sample[0] = a; + s.sample[1] = b; + s.sample[2] = c; + s.sample[3] = d; + _samples << s; + updateScrollbar(); + update(); +} + +void QLineGraph::drawTime(QPainter *p, const QRect &rect) +{ + if(_samples.isEmpty()) + return; + + int first = position; + if(first == -1) + first = qMax(0, _samples.count() - samplesPerWidth - 1); + int last = qMin(_samples.count() - 1, first + samplesPerWidth); + + qreal scaleX = qreal(rect.width()) / qreal(samplesPerWidth); + + int t = 0; + + for(int ii = first; ii <= last; ++ii) { + int sampleTime = _samples.at(ii).sample[3] / 1000; + if(sampleTime != t) { + + int xEnd = rect.left() + scaleX * (ii - first); + p->drawLine(xEnd, rect.bottom(), xEnd, rect.bottom() + 7); + + QRect text(xEnd - 30, rect.bottom() + 10, 60, 30); + + p->drawText(text, Qt::AlignHCenter | Qt::AlignTop, QString::number(_samples.at(ii).sample[3])); + + t = sampleTime; + } + } + +} + +void QLineGraph::drawSample(QPainter *p, int s, const QRect &rect) +{ + if(_samples.isEmpty()) + return; + + int first = position; + if(first == -1) + first = qMax(0, _samples.count() - samplesPerWidth - 1); + int last = qMin(_samples.count() - 1, first + samplesPerWidth); + + qreal scaleY = rect.height() / resolutionForHeight; + qreal scaleX = qreal(rect.width()) / qreal(samplesPerWidth); + + int xEnd; + int lastXEnd = rect.left(); + + p->save(); + p->setPen(Qt::NoPen); + for(int ii = first + 1; ii <= last; ++ii) { + + xEnd = rect.left() + scaleX * (ii - first); + int yEnd = rect.bottom() - _samples.at(ii).sample[s] * scaleY; + + if (!(s == 0 && _samples.at(ii).isBreak)) + p->drawRect(QRect(lastXEnd, yEnd, scaleX, _samples.at(ii).sample[s] * scaleY)); + + lastXEnd = xEnd; + } + p->restore(); +} + +void QLineGraph::paintEvent(QPaintEvent *) +{ + QPainter p(this); + p.setRenderHint(QPainter::Antialiasing); + + + QRect r(50, 10, width() - 60, height() - 60); + p.setBrush(QColor("lightsteelblue")); + drawSample(&p, 0, r); + + p.setBrush(QColor("pink")); + drawSample(&p, 1, r); + + p.setBrush(QColor("green")); + drawSample(&p, 2, r); + + p.setBrush(Qt::NoBrush); + p.drawRect(r); + + for(int ii = 0; ii <= resolutionForHeight; ++ii) { + int y = 1 + r.bottom() - ii * r.height() / resolutionForHeight; + + if((ii % 10) == 0) { + p.drawLine(r.left() - 20, y, r.left(), y); + QRect text(r.left() - 20 - 53, y - 10, 50, 20); + p.drawText(text, Qt::AlignRight | Qt::AlignVCenter, QString::number(ii)); + } else { + p.drawLine(r.left() - 7, y, r.left(), y); + } + } + + drawTime(&p, r); +} + +class MyReader : public QObject +{ +Q_OBJECT +public: + MyReader(const QString &host, int port); + +signals: + void sample(int, int, int, int, bool); + +private slots: + void readyRead(); + +private: + QTcpSocket *socket; + + int la; + int lb; + int ld; +}; + +MyReader::MyReader(const QString &host, int port) +: socket(0), la(-1) +{ + socket = new QTcpSocket(this); + QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead())); + socket->connectToHost(host, port); + socket->waitForConnected(); +} + +void MyReader::readyRead() +{ + static int la = -1; + static int lb; + static int ld; + + if(socket->canReadLine()) { + QString line = socket->readLine(); + + int a; + int b; + int c; + int d; + int isBreak; + sscanf(line.toLatin1().constData(), "%d %d %d %d %d", &a, &b, &c, &d, &isBreak); + + if (la != -1) + emit sample(c, lb, la, ld, isBreak); + + la = a; + lb = b; + ld = d; + } +} + +int main(int argc, char ** argv) +{ + if(argc != 3) { + qWarning() << "Usage:" << argv[0] << "host port"; + return -1; + } + + QApplication app(argc, argv); + + MyReader reader(argv[1], atoi(argv[2])); + + QLineGraph graph; + QObject::connect(&reader, SIGNAL(sample(int,int,int,int,bool)), &graph, SLOT(addSample(int,int,int,int,bool))); + graph.setFixedSize(800, 600); + graph.show(); + + return app.exec(); +} + +#include "main.moc" diff --git a/src/declarative/canvas/monitor/monitor.pro b/src/declarative/canvas/monitor/monitor.pro new file mode 100644 index 0000000..e3b0a29 --- /dev/null +++ b/src/declarative/canvas/monitor/monitor.pro @@ -0,0 +1,8 @@ +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . +QT += network + +# Input +SOURCES += main.cpp diff --git a/src/declarative/canvas/qsimplecanvasserver.cpp b/src/declarative/canvas/qsimplecanvasserver.cpp index 4d4adda..ed781b8 100644 --- a/src/declarative/canvas/qsimplecanvasserver.cpp +++ b/src/declarative/canvas/qsimplecanvasserver.cpp @@ -44,17 +44,37 @@ #ifndef Q_OS_WIN32 #include #endif +#include QT_BEGIN_NAMESPACE +class FrameBreakAnimation : public QAbstractAnimation +{ +public: + FrameBreakAnimation(QSimpleCanvasServer *s) + : QAbstractAnimation(s), server(s) + { + start(); + } + + virtual int duration() const { return -1; } + virtual void updateCurrentTime(int msecs) { + server->frameBreak(); + } + +private: + QSimpleCanvasServer *server; +}; + QSimpleCanvasServer::QSimpleCanvasServer(int port, QObject *parent) -: QObject(parent), _tcpServer(new QTcpServer(this)) +: QObject(parent), _breaks(0), _tcpServer(new QTcpServer(this)) { QObject::connect(_tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); _time.start(); + new FrameBreakAnimation(this); if (!_tcpServer->listen(QHostAddress::Any, port)) { qWarning() << "QSimpleCanvasServer: Cannot listen on port" << port; return; @@ -80,8 +100,10 @@ void QSimpleCanvasServer::addTiming(quint32 paint, data[2] = ::htonl(timeBetweenFrames); */ + bool isFrameBreak = _breaks > 1; + _breaks = 0; int e = _time.elapsed(); - QString d = QString::number(paint) + QLatin1String(" ") + QString::number(repaint) + QLatin1String(" ") + QString::number(timeBetweenFrames) + QLatin1String(" ") + QString::number(e) + QLatin1String("\n"); + QString d = QString::number(paint) + QLatin1String(" ") + QString::number(repaint) + QLatin1String(" ") + QString::number(timeBetweenFrames) + QLatin1String(" ") + QString::number(e) + QLatin1String(" ") + QString::number(isFrameBreak) + QLatin1String("\n"); QByteArray ba = d.toLatin1(); // XXX @@ -90,6 +112,11 @@ void QSimpleCanvasServer::addTiming(quint32 paint, _tcpClients.at(ii)->write(ba.constData(), ba.length()); } +void QSimpleCanvasServer::frameBreak() +{ + _breaks++; +} + void QSimpleCanvasServer::disconnected() { QTcpSocket *socket = static_cast(sender()); diff --git a/src/declarative/canvas/qsimplecanvasserver_p.h b/src/declarative/canvas/qsimplecanvasserver_p.h index 7d53357..ce04e8d 100644 --- a/src/declarative/canvas/qsimplecanvasserver_p.h +++ b/src/declarative/canvas/qsimplecanvasserver_p.h @@ -62,6 +62,10 @@ private Q_SLOTS: void disconnected(); private: + friend class FrameBreakAnimation; + void frameBreak(); + int _breaks; + QTcpServer *_tcpServer; QList _tcpClients; QTime _time; -- cgit v0.12 From 98c4fb27bb930f19365395a3fd75e4c3012640cb Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 22 May 2009 16:50:10 +1000 Subject: Use the true metatype of attached properties in the compiler --- src/declarative/qml/qmlcompiler.cpp | 4 ++++ src/declarative/util/qmlpackage.cpp | 2 +- src/declarative/util/qmlpackage.h | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 8990732..5f92721 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -862,6 +862,10 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt) prop->type = t; } } + } else if(isAttachedProperty(prop->name) && prop->value) { + QmlType *type = QmlMetaType::qmlType(prop->name); + if (type && type->attachedPropertiesType()) + prop->value->metatype = type->attachedPropertiesType(); } if (prop->name == "id") { diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp index bfad44c..107bcdb 100644 --- a/src/declarative/util/qmlpackage.cpp +++ b/src/declarative/util/qmlpackage.cpp @@ -142,7 +142,7 @@ QObject *QmlPackage::part(const QString &name) return 0; } -QObject *QmlPackage::qmlAttachedProperties(QObject *o) +QmlPackageAttached *QmlPackage::qmlAttachedProperties(QObject *o) { return new QmlPackageAttached(o); } diff --git a/src/declarative/util/qmlpackage.h b/src/declarative/util/qmlpackage.h index 3861890..f4167fd 100644 --- a/src/declarative/util/qmlpackage.h +++ b/src/declarative/util/qmlpackage.h @@ -57,6 +57,7 @@ QT_MODULE(Declarative) *****************************************************************************/ class QmlPackagePrivate; +class QmlPackageAttached; class QmlPackage : public QObject { Q_OBJECT @@ -74,7 +75,7 @@ public: QObject *part(const QString & = QString()); bool hasPart(const QString &); - static QObject *qmlAttachedProperties(QObject *); + static QmlPackageAttached *qmlAttachedProperties(QObject *); }; QML_DECLARE_TYPE(QmlPackage); -- cgit v0.12 From 2a6ecd73faee2d6d9db2b5f8b895d52cd31b0e27 Mon Sep 17 00:00:00 2001 From: Julian de Bhal Date: Mon, 25 May 2009 13:53:35 +1000 Subject: Update mkspecs for linux-g++-x11 Change QMAKE_INCDIR_OPENGL and QMAKE_LIBDIR_OPENGL to QMAKE_INCDIR_OPENGL_QT and QMAKE_LIBDIR_OPENGL_QT so qmake will pick them up. --- mkspecs/linux-g++-x11egl/qmake.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mkspecs/linux-g++-x11egl/qmake.conf b/mkspecs/linux-g++-x11egl/qmake.conf index 3442d70..e9e5abc 100644 --- a/mkspecs/linux-g++-x11egl/qmake.conf +++ b/mkspecs/linux-g++-x11egl/qmake.conf @@ -13,7 +13,10 @@ include(../common/linux.conf) load(qt_config) QMAKE_INCDIR_OPENGL = $(HOME)/opengles2/SDKPackage/Builds/OGLES2/Include +QMAKE_INCDIR_OPENGL_QT = $(HOME)/opengles2/SDKPackage/Builds/OGLES2/Include + QMAKE_LIBDIR_OPENGL = $(HOME)/opengles2/SDKPackage/Builds/OGLES2/LinuxPC/Lib +QMAKE_LIBDIR_OPENGL_QT = $(HOME)/opengles2/SDKPackage/Builds/OGLES2/LinuxPC/Lib QMAKE_LIBS_OPENGL = -lGLESv2 -lEGL QMAKE_LIBS += -Wl,-rpath=$(HOME)/opengles2/SDKPackage/Builds/OGLES2/LinuxPC/Lib -- cgit v0.12 From 2024a49b576bd39e17f995b980c1f66c5cb08175 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 25 May 2009 15:43:44 +0200 Subject: Disable QmlDom debug output by default Only print AST if QML_COMPILER_DUMP is set --- src/declarative/qml/qmldom.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index 9871fcb..b689ec5 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -44,13 +44,15 @@ #include "private/qmlcompiler_p.h" #include "private/qmlengine_p.h" #include "qmlcompiledcomponent_p.h" -#include -#include - +#include +#include +#include #include "qmlscriptparser_p.h" QT_BEGIN_NAMESPACE +DEFINE_BOOL_CONFIG_OPTION(compilerDump, QML_COMPILER_DUMP) + QmlDomDocumentPrivate::QmlDomDocumentPrivate() : root(0) { @@ -193,7 +195,11 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data, const QUrl } if (td->data.tree()) { - td->data.tree()->dump(); + if (compilerDump()) { + qWarning() << "-AST------------------------------------------------------------------------------"; + td->data.tree()->dump(); + qWarning() << "----------------------------------------------------------------------------------"; + } d->root = td->data.tree(); d->root->addref(); } -- cgit v0.12 From 301fb6805644f1af28687794f7d888c04a1da12f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 26 May 2009 08:56:54 +1000 Subject: Fix compile when paint engine debugging is on. --- src/gui/painting/qpaintengine_raster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index c986e99..5b7ae48 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -6147,7 +6147,7 @@ void dumpClip(int width, int height, QClipData *clip) int y1 = 0; for (int i = 0; i < clip->count; ++i) { - QSpan *span = clip->spans + i; + QSpan *span = clip->spans() + i; for (int j = 0; j < span->len; ++j) clipImg.setPixel(span->x + j, span->y, 0xffffff00); x0 = qMin(x0, int(span->x)); -- cgit v0.12 From 93f0f38085e8fe2657ef3d7c5e24576d4475e85d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 26 May 2009 09:01:37 +1000 Subject: Test cleanup. --- tests/benchmarks/qfxview/main.cpp | 182 ------ tests/benchmarks/qfxview/qfxview.pro | 16 - .../qfxview/testdata/tatwheel/editor/data.xml | 44 -- .../qfxview/testdata/tatwheel/pics/background.png | Bin 26508 -> 0 bytes .../qfxview/testdata/tatwheel/pics/background3.png | Bin 37671 -> 0 bytes .../qfxview/testdata/tatwheel/pics/battery.png | Bin 770 -> 0 bytes .../testdata/tatwheel/pics/calendar-blur.png | Bin 51439 -> 0 bytes .../qfxview/testdata/tatwheel/pics/calendar.png | Bin 10153 -> 0 bytes .../testdata/tatwheel/pics/callhistory-blur.png | Bin 57023 -> 0 bytes .../qfxview/testdata/tatwheel/pics/callhistory.png | Bin 13227 -> 0 bytes .../qfxview/testdata/tatwheel/pics/camera-blur.png | Bin 50955 -> 0 bytes .../qfxview/testdata/tatwheel/pics/camera.png | Bin 16126 -> 0 bytes .../testdata/tatwheel/pics/contacts-blur.png | Bin 51041 -> 0 bytes .../qfxview/testdata/tatwheel/pics/contacts.png | Bin 12177 -> 0 bytes .../testdata/tatwheel/pics/file-manager-blur.png | Bin 45164 -> 0 bytes .../testdata/tatwheel/pics/file-manager.png | Bin 8858 -> 0 bytes .../qfxview/testdata/tatwheel/pics/fire.png | Bin 1124 -> 0 bytes .../qfxview/testdata/tatwheel/pics/flask-blue.png | Bin 764 -> 0 bytes .../testdata/tatwheel/pics/flask-container.png | Bin 536 -> 0 bytes .../qfxview/testdata/tatwheel/pics/flask-front.png | Bin 962 -> 0 bytes .../qfxview/testdata/tatwheel/pics/flask-pink.png | Bin 747 -> 0 bytes .../testdata/tatwheel/pics/flask-yellow.png | Bin 775 -> 0 bytes .../qfxview/testdata/tatwheel/pics/ice.png | Bin 1112 -> 0 bytes .../testdata/tatwheel/pics/icon-reflection.png | Bin 7123 -> 0 bytes .../testdata/tatwheel/pics/internet-blur.png | Bin 57126 -> 0 bytes .../qfxview/testdata/tatwheel/pics/internet.png | Bin 24320 -> 0 bytes .../testdata/tatwheel/pics/menu-background1.png | Bin 2831 -> 0 bytes .../testdata/tatwheel/pics/menu-border1.png | Bin 926 -> 0 bytes .../testdata/tatwheel/pics/menu-border3.png | Bin 10153 -> 0 bytes .../testdata/tatwheel/pics/menu-highlight.png | Bin 3421 -> 0 bytes .../qfxview/testdata/tatwheel/pics/menubar.png | Bin 741 -> 0 bytes .../testdata/tatwheel/pics/messages-blur.png | Bin 44556 -> 0 bytes .../qfxview/testdata/tatwheel/pics/messages.png | Bin 11426 -> 0 bytes .../qfxview/testdata/tatwheel/pics/moon.png | Bin 1027 -> 0 bytes .../qfxview/testdata/tatwheel/pics/sad.png | Bin 1053 -> 0 bytes .../testdata/tatwheel/pics/settings-blur.png | Bin 50199 -> 0 bytes .../qfxview/testdata/tatwheel/pics/settings.png | Bin 8697 -> 0 bytes .../qfxview/testdata/tatwheel/pics/signal.png | Bin 739 -> 0 bytes .../qfxview/testdata/tatwheel/pics/smile.png | Bin 1051 -> 0 bytes .../qfxview/testdata/tatwheel/pics/star.png | Bin 262 -> 0 bytes .../qfxview/testdata/tatwheel/pics/sun.png | Bin 1021 -> 0 bytes .../qfxview/testdata/tatwheel/pics/titlebar.png | Bin 1041 -> 0 bytes .../qfxview/testdata/tatwheel/pics/wifi.png | Bin 782 -> 0 bytes .../qfxview/testdata/tatwheel/tat-wheel.xml | 68 -- tests/benchmarks/qmlpainting/qmlpainting.pro | 5 + tests/benchmarks/qmlpainting/tst_qmlpainting.cpp | 696 +++++++++++++++++++++ tests/benchmarks/qmlxmlparser/main.cpp | 96 --- tests/benchmarks/qmlxmlparser/qmlxmlparser.pro | 14 - .../benchmarks/qmlxmlparser/testdata/concept2.xml | 421 ------------- 49 files changed, 701 insertions(+), 841 deletions(-) delete mode 100644 tests/benchmarks/qfxview/main.cpp delete mode 100644 tests/benchmarks/qfxview/qfxview.pro delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/editor/data.xml delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/background.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/background3.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/battery.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/calendar-blur.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/calendar.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/callhistory-blur.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/callhistory.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/camera-blur.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/camera.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/contacts-blur.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/contacts.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/file-manager-blur.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/file-manager.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/fire.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-blue.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-container.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-front.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-pink.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-yellow.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/ice.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/icon-reflection.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/internet-blur.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/internet.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-background1.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-border1.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-border3.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-highlight.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/menubar.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/messages-blur.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/messages.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/moon.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/sad.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/settings-blur.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/settings.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/signal.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/smile.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/star.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/sun.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/titlebar.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/pics/wifi.png delete mode 100644 tests/benchmarks/qfxview/testdata/tatwheel/tat-wheel.xml create mode 100644 tests/benchmarks/qmlpainting/qmlpainting.pro create mode 100644 tests/benchmarks/qmlpainting/tst_qmlpainting.cpp delete mode 100644 tests/benchmarks/qmlxmlparser/main.cpp delete mode 100644 tests/benchmarks/qmlxmlparser/qmlxmlparser.pro delete mode 100644 tests/benchmarks/qmlxmlparser/testdata/concept2.xml diff --git a/tests/benchmarks/qfxview/main.cpp b/tests/benchmarks/qfxview/main.cpp deleted file mode 100644 index 787b113..0000000 --- a/tests/benchmarks/qfxview/main.cpp +++ /dev/null @@ -1,182 +0,0 @@ -#include -#include -#include -#include -#include - -class tst_qfxview : public QObject -{ - Q_OBJECT - -private slots: - void render(); - void render_data(); - -private: - void waitForUpdates(QObject* obj, int howmany, int timeout = 10000); - bool eventFilter(QObject*, QEvent*); - - QString testdata(QString const&); - QString readFile(QString const&); - - int m_updateCount; - QEventLoop* m_eventLoop; - int m_updateLimit; -}; - -bool tst_qfxview::eventFilter(QObject*, QEvent* e) -{ - if (!m_eventLoop) { - return false; - } - - if (e->type() == QEvent::UpdateRequest) { - m_updateCount++; - if (m_updateCount >= m_updateLimit) { - m_eventLoop->quit(); - } - } - - return false; -} - -void tst_qfxview::waitForUpdates(QObject* obj, int howmany, int timeout) -{ - m_updateLimit = howmany; - m_updateCount = 0; - - QEventLoop loop; - m_eventLoop = &loop; - if (timeout > 0) - QTimer::singleShot(timeout, &loop, SLOT(quit())); - - obj->installEventFilter(this); - loop.exec(); - obj->removeEventFilter(this); - - m_eventLoop = 0; - - if (m_updateCount < howmany) { - QFAIL(qPrintable( - QString("Didn't receive %1 updates within %2 milliseconds (only got %3)") - .arg(howmany).arg(timeout).arg(m_updateCount) - )); - } -} - -void tst_qfxview::render() -{ - QFETCH(QString, xml); - QFETCH(QString, filename); - QFETCH(int, mode); - - static const int FRAMES = 100; - - QPixmap pm(800, 600); - - QFxView view((QSimpleCanvas::CanvasMode)mode); - view.setFixedSize(pm.size()); - if (!filename.isEmpty()) { - filename = testdata(filename); - xml = readFile(filename); - } - view.setXml(xml, filename); - QFileInfo fi(filename); - view.setPath(fi.path()); - - /* So we can reuse duiviewer examples... */ - QObject *dummyData = QML::newInstance(fi.path() + "/editor/data.xml"); - if (dummyData) { - QmlBindContext *ctxt = view.bindContext(); - ctxt->setProperty("obj", dummyData); - ctxt->addDefaultObject(dummyData); - dummyData->setParent(&view); - } - - view.show(); - view.raise(); - QTest::qWait(100); - view.activateWindow(); - QTest::qWait(100); - QVERIFY(view.isActiveWindow()); - - view.execute(); - - /* Set internal GfxAppClock to consistent timing (every tick is 5 ms) */ - { - GfxTimeLine tl; - tl.setMode(GfxTimeLine::Consistent); - } - - /* Render FRAMES amount of updates */ - QBENCHMARK { - waitForUpdates(&view, FRAMES); - if (QTest::currentTestFailed()) return; - } - - //view.dumpTiming(); -} - -void tst_qfxview::render_data() -{ - QTest::addColumn ("xml"); - QTest::addColumn ("filename"); - QTest::addColumn ("mode"); - - QTest::newRow("tatwheel-simplecanvas") - << QString() - << QString("tatwheel/tat-wheel.xml") - << int(QSimpleCanvas::SimpleCanvas) - ; - - QTest::newRow("tatwheel-graphicsview") - << QString() - << QString("tatwheel/tat-wheel.xml") - << int(QSimpleCanvas::GraphicsView) - ; - -} - -QString tst_qfxview::readFile(QString const& filename) -{ - QFile file(filename); - if (!file.open(QIODevice::ReadOnly)) { - qFatal("Could not open %s: %s", qPrintable(filename), qPrintable(file.errorString())); - } - QByteArray ba = file.readAll(); - return QString::fromLatin1(ba); -} - -QString tst_qfxview::testdata(QString const& name) -{ -#define _STR(X) #X -#define STR(X) _STR(X) - return QString("%1/testdata/%2").arg(STR(SRCDIR)).arg(name); -} - -int main(int argc, char** argv) -{ - /* Remove this when -graphicssystem raster is the default. */ - bool explicit_graphicssystem = false; - - QVector args; - for (int i = 0; i < argc; ++i) { - if (!strcmp(argv[i], "-graphicssystem")) - explicit_graphicssystem = true; - args << argv[i]; - } - - if (!explicit_graphicssystem) { - args << "-graphicssystem" << "raster"; - } - - argc = args.count(); - argv = const_cast(args.data()); - - QApplication app(argc, argv); - - tst_qfxview test; - return QTest::qExec(&test, argc, argv); -} - -#include "main.moc" diff --git a/tests/benchmarks/qfxview/qfxview.pro b/tests/benchmarks/qfxview/qfxview.pro deleted file mode 100644 index e7dd168..0000000 --- a/tests/benchmarks/qfxview/qfxview.pro +++ /dev/null @@ -1,16 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qfxview -DEPENDPATH += . -INCLUDEPATH += . - -CONFIG += release - -QT += declarative script - -DEFINES+=SRCDIR=\"$$PWD\" - -# Input -SOURCES += \ - main.cpp - diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/editor/data.xml b/tests/benchmarks/qfxview/testdata/tatwheel/editor/data.xml deleted file mode 100644 index 0a28d4f..0000000 --- a/tests/benchmarks/qfxview/testdata/tatwheel/editor/data.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - Internet - pics/internet - - - Calendar - pics/calendar - - - Contacts - pics/contacts - - - Camera - pics/camera - - - Messages - pics/messages - - - Call history - pics/callhistory - - - File manager - pics/file-manager - - - Settings - pics/settings - - - Call history - pics/callhistory - - - - - diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/background.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/background.png deleted file mode 100644 index 4b6f56e..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/background.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/background3.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/background3.png deleted file mode 100644 index 66cb522..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/background3.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/battery.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/battery.png deleted file mode 100644 index 4bd03d4..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/battery.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/calendar-blur.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/calendar-blur.png deleted file mode 100644 index 136ae80..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/calendar-blur.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/calendar.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/calendar.png deleted file mode 100644 index 0e63f1c..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/calendar.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/callhistory-blur.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/callhistory-blur.png deleted file mode 100644 index 5ed1c99..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/callhistory-blur.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/callhistory.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/callhistory.png deleted file mode 100644 index 6c26405..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/callhistory.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/camera-blur.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/camera-blur.png deleted file mode 100644 index 7285278..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/camera-blur.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/camera.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/camera.png deleted file mode 100644 index 710907f..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/camera.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/contacts-blur.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/contacts-blur.png deleted file mode 100644 index 5ba94c7..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/contacts-blur.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/contacts.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/contacts.png deleted file mode 100644 index 78bb885..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/contacts.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/file-manager-blur.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/file-manager-blur.png deleted file mode 100644 index 6ec1d55..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/file-manager-blur.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/file-manager.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/file-manager.png deleted file mode 100644 index e58a39b..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/file-manager.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/fire.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/fire.png deleted file mode 100644 index e1b40cf..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/fire.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-blue.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-blue.png deleted file mode 100644 index 3cb05ef..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-blue.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-container.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-container.png deleted file mode 100644 index dd34cbd..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-container.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-front.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-front.png deleted file mode 100644 index bed9e60..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-front.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-pink.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-pink.png deleted file mode 100644 index b84ee88..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-pink.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-yellow.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-yellow.png deleted file mode 100644 index 4108ea3..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-yellow.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/ice.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/ice.png deleted file mode 100644 index 8191fbc..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/ice.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/icon-reflection.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/icon-reflection.png deleted file mode 100644 index 6c19e71..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/icon-reflection.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/internet-blur.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/internet-blur.png deleted file mode 100644 index 32dc564..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/internet-blur.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/internet.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/internet.png deleted file mode 100644 index 820ce34..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/internet.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-background1.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-background1.png deleted file mode 100644 index e84dc11..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-background1.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-border1.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-border1.png deleted file mode 100644 index e6dea40..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-border1.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-border3.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-border3.png deleted file mode 100644 index 1d8a571..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-border3.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-highlight.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-highlight.png deleted file mode 100644 index 3817b08..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-highlight.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/menubar.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/menubar.png deleted file mode 100644 index 1b0380a..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/menubar.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/messages-blur.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/messages-blur.png deleted file mode 100644 index 3c62d53..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/messages-blur.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/messages.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/messages.png deleted file mode 100644 index a452d58..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/messages.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/moon.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/moon.png deleted file mode 100644 index cc3a3bc..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/moon.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/sad.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/sad.png deleted file mode 100644 index de90bc4..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/sad.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/settings-blur.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/settings-blur.png deleted file mode 100644 index f175161..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/settings-blur.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/settings.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/settings.png deleted file mode 100644 index 6e72796..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/settings.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/signal.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/signal.png deleted file mode 100644 index 7af4c24..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/signal.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/smile.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/smile.png deleted file mode 100644 index f6bf09f..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/smile.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/star.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/star.png deleted file mode 100644 index defbde5..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/star.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/sun.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/sun.png deleted file mode 100644 index b2092f1..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/sun.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/titlebar.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/titlebar.png deleted file mode 100644 index 40484d0..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/titlebar.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/pics/wifi.png b/tests/benchmarks/qfxview/testdata/tatwheel/pics/wifi.png deleted file mode 100644 index ada1d3b..0000000 Binary files a/tests/benchmarks/qfxview/testdata/tatwheel/pics/wifi.png and /dev/null differ diff --git a/tests/benchmarks/qfxview/testdata/tatwheel/tat-wheel.xml b/tests/benchmarks/qfxview/testdata/tatwheel/tat-wheel.xml deleted file mode 100644 index 6da6608..0000000 --- a/tests/benchmarks/qfxview/testdata/tatwheel/tat-wheel.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/benchmarks/qmlpainting/qmlpainting.pro b/tests/benchmarks/qmlpainting/qmlpainting.pro new file mode 100644 index 0000000..58e9775 --- /dev/null +++ b/tests/benchmarks/qmlpainting/qmlpainting.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qmlpainting + +SOURCES += tst_qmlpainting.cpp diff --git a/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp b/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp new file mode 100644 index 0000000..ae6f9a3 --- /dev/null +++ b/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp @@ -0,0 +1,696 @@ +/**************************************************************************** +** +** 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 +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +class tst_QmlPainting : public QObject +{ + Q_OBJECT + + public: + tst_QmlPainting() {} + +private slots: + void drawRoundedRect(); + void drawScaledRoundedRect(); + void drawTransformedRoundedRect(); + void drawAntialiasedRoundedRect(); + void drawScaledAntialiasedRoundedRect_data(); + void drawScaledAntialiasedRoundedRect(); + void drawTransformedAntialiasedRoundedRect_data(); + void drawTransformedAntialiasedRoundedRect(); + void drawImageRoundedRect(); + void drawScaledImageRoundedRect_data(); + void drawScaledImageRoundedRect(); + void drawTransformedImageRoundedRect_data(); + void drawTransformedImageRoundedRect(); + void drawScaleGridRoundedRect(); + void drawScaledScaleGridRoundedRect_data(); + void drawScaledScaleGridRoundedRect(); + void drawTransformedScaleGridRoundedRect_data(); + void drawTransformedScaleGridRoundedRect(); + void drawTransformedTransparentImage_data(); + void drawTransformedTransparentImage(); + void drawTransformedSemiTransparentImage_data(); + void drawTransformedSemiTransparentImage(); + void drawTransformedFilledImage_data(); + void drawTransformedFilledImage(); +}; + +const qreal inv_dist_to_plane = 1. / 1024.; +QTransform transformForAngle(qreal angle) +{ + QTransform transform; + + QTransform rotTrans; + rotTrans.translate(-40, 0); + QTransform rotTrans2; + rotTrans2.translate(40, 0); + + qreal rad = angle * 2. * M_PI / 360.; + qreal c = ::cos(rad); + qreal s = ::sin(rad); + + qreal x = 0; + qreal y = 80; + qreal z = 0; + + qreal len = x * x + y * y + z * z; + if (len != 1.) { + len = ::sqrt(len); + x /= len; + y /= len; + z /= len; + } + + QTransform rot(x*x*(1-c)+c, x*y*(1-c)-z*s, x*z*(1-c)+y*s*inv_dist_to_plane, + y*x*(1-c)+z*s, y*y*(1-c)+c, y*z*(1-c)-x*s*inv_dist_to_plane, + 0, 0, 1); + + transform *= rotTrans; + transform *= rot; + transform *= rotTrans2; + + return transform; +} + +void tst_QmlPainting::drawRoundedRect() +{ + QImage surface(100, 100, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + + QBENCHMARK { + p.drawRoundedRect(QRectF(.5, .5, 80, 80), 10, 10); + } + surface.save("regular.png"); +} + +void tst_QmlPainting::drawScaledRoundedRect() +{ + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + p.scale(3, 3); + + QBENCHMARK { + p.drawRoundedRect(10, 10, 80, 80, 10, 10); + } + surface.save("scaled.png"); +} + +void tst_QmlPainting::drawTransformedRoundedRect() +{ + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + + QBENCHMARK { + p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); + p.drawRoundedRect(100, 100, 80, 80, 10, 10); + } + surface.save("transformed.png"); +} + +void tst_QmlPainting::drawAntialiasedRoundedRect() +{ + QImage surface(100, 100, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setRenderHint(QPainter::Antialiasing, true); + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + + QBENCHMARK { + p.drawRoundedRect(QRectF(.5, .5, 80, 80), 10, 10); + } + surface.save("aar.png"); +} + +void tst_QmlPainting::drawScaledAntialiasedRoundedRect_data() +{ + QTest::addColumn("scale"); + + for (float i = 0; i < 3; i += .1) + QTest::newRow(QString(QLatin1String("scale=%1")).arg(i).toLatin1()) << i; +} + +void tst_QmlPainting::drawScaledAntialiasedRoundedRect() +{ + QFETCH(float, scale); + + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setRenderHint(QPainter::Antialiasing, true); + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + p.scale(scale, scale); + + QBENCHMARK { + p.drawRoundedRect(10, 10, 80, 80, 10, 10); + } + surface.save("aas.png"); +} + +void tst_QmlPainting::drawTransformedAntialiasedRoundedRect_data() +{ + QTest::addColumn("transform"); + + for (float angle = 0; angle < 360; angle += 10) + QTest::newRow(QString(QLatin1String("angle=%1")).arg(angle).toLatin1()) << transformForAngle(angle); +} + +void tst_QmlPainting::drawTransformedAntialiasedRoundedRect() +{ + QFETCH(QTransform, transform); + + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setRenderHint(QPainter::Antialiasing, true); + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + + QBENCHMARK { + p.setWorldTransform(transform); + p.drawRoundedRect(100, 100, 80, 80, 10, 10); + } + surface.save("aat.png"); +} + +void tst_QmlPainting::drawImageRoundedRect() +{ + //setup image + const int radius = 10; + QImage rectImage(81, 81, QImage::Format_ARGB32_Premultiplied); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius); + + //setup surface + QImage surface(100, 100, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.drawImage(0,0, rectImage); + } + surface.save("ri.png"); +} + +void tst_QmlPainting::drawScaledImageRoundedRect_data() +{ + QTest::addColumn("imageType"); + + QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; + QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; +} + +void tst_QmlPainting::drawScaledImageRoundedRect() +{ + QFETCH(int, imageType); + + //setup image + const int radius = 10; + QImage rectImage(81, 81, (QImage::Format)imageType); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius); + + //setup surface + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + p.scale(3, 3); + + QBENCHMARK { + p.drawImage(0,0, rectImage); + } + surface.save("si.png"); +} + +void tst_QmlPainting::drawTransformedImageRoundedRect_data() +{ + QTest::addColumn("imageType"); + + QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; + QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; +} + +void tst_QmlPainting::drawTransformedImageRoundedRect() +{ + QFETCH(int, imageType); + + //setup image + const int radius = 10; + QImage rectImage(81, 81, (QImage::Format)imageType); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius); + + //setup surface + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); + p.drawImage(100,100, rectImage); + } + surface.save("ti.png"); +} + +//code from QFxRect for drawing rounded rects +void tst_QmlPainting::drawScaleGridRoundedRect() +{ + //setup image + const int pw = 1; + const int radius = 10; + QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + if (pw%2) + rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius); + else + rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius); + + //setup surface + QImage surface(100, 100, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + const int pw = 2; + int offset = int(radius+1.5+pw); + int width = 80; + int height = 80; + + int w = width+pw; + int h = height+pw; + int xOffset = offset; + int xSide = xOffset * 2; + bool xMiddles=true; + if (xSide > w) { + xMiddles=false; + xOffset = w/2 + 1; + xSide = xOffset * 2; + } + int yOffset = offset; + int ySide = yOffset * 2; + bool yMiddles=true; + if (ySide > h) { + yMiddles = false; + yOffset = h/2 + 1; + ySide = yOffset * 2; + } + + // Upper left + p.drawImage(QRect(-pw/2, -pw/2, xOffset, yOffset), rectImage, QRect(0, 0, xOffset, yOffset)); + + // Upper middle + if (xMiddles) + p.drawImage(QRect(xOffset-pw/2, -pw/2, width - xSide + pw, yOffset), rectImage, + QRect(rectImage.width()/2, 0, 1, yOffset)); + // Upper right + p.drawImage(QPoint(width-xOffset+pw/2, -pw/2), rectImage, + QRect(rectImage.width()-xOffset, 0, xOffset, yOffset)); + // Middle left + if (yMiddles) + p.drawImage(QRect(-pw/2, yOffset-pw/2, xOffset, height - ySide + pw), rectImage, + QRect(0, rectImage.height()/2, xOffset, 1)); + + // Middle + if (xMiddles && yMiddles) + p.drawImage(QRect(xOffset-pw/2, yOffset-pw/2, width - xSide + pw, height - ySide + pw), rectImage, + QRect(rectImage.width()/2, rectImage.height()/2, 1, 1)); + // Middle right + if (yMiddles) + p.drawImage(QRect(width-xOffset+pw/2, yOffset-pw/2, xOffset, height - ySide + pw), rectImage, + QRect(rectImage.width()-xOffset, rectImage.height()/2, xOffset, 1)); + // Lower left + p.drawImage(QPoint(-pw/2, height - yOffset + pw/2), rectImage, QRect(0, rectImage.height() - yOffset, xOffset, yOffset)); + + // Lower Middle + if (xMiddles) + p.drawImage(QRect(xOffset-pw/2, height - yOffset +pw/2, width - xSide + pw, yOffset), rectImage, + QRect(rectImage.width()/2, rectImage.height() - yOffset, 1, yOffset)); + // Lower Right + p.drawImage(QPoint(width-xOffset+pw/2, height - yOffset+pw/2), rectImage, + QRect(rectImage.width()-xOffset, rectImage.height() - yOffset, xOffset, yOffset)); + } + surface.save("rsg.png"); +} + +void tst_QmlPainting::drawScaledScaleGridRoundedRect_data() +{ + QTest::addColumn("scale"); + QTest::addColumn("imageType"); + + for (float i = 0; i < 3; i += .1) + QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB32_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB32_Premultiplied; + //for (float i = 0; i < 3; i += .1) + // QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB8565_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB8565_Premultiplied; +} + +//code from QFxRect for drawing rounded rects +void tst_QmlPainting::drawScaledScaleGridRoundedRect() +{ + QFETCH(float, scale); + QFETCH(int, imageType); + + //setup image + const int pw = 1; + const int radius = 10; + QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, (QImage::Format)imageType); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + if (pw%2) + rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius); + else + rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius); + + //setup surface + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + p.scale(scale, scale); + + QBENCHMARK { + const int pw = 2; + int offset = int(radius+1.5+pw); + int width = 80; + int height = 80; + + int w = width+pw; + int h = height+pw; + int xOffset = offset; + int xSide = xOffset * 2; + bool xMiddles=true; + if (xSide > w) { + xMiddles=false; + xOffset = w/2 + 1; + xSide = xOffset * 2; + } + int yOffset = offset; + int ySide = yOffset * 2; + bool yMiddles=true; + if (ySide > h) { + yMiddles = false; + yOffset = h/2 + 1; + ySide = yOffset * 2; + } + + // Upper left + p.drawImage(QRect(10-pw/2, 10-pw/2, xOffset, yOffset), rectImage, QRect(0, 0, xOffset, yOffset)); + + // Upper middle + if (xMiddles) + p.drawImage(QRect(10+xOffset-pw/2, 10+-pw/2, width - xSide + pw, yOffset), rectImage, + QRect(rectImage.width()/2, 0, 1, yOffset)); + // Upper right + p.drawImage(QPoint(10+width-xOffset+pw/2, 10+-pw/2), rectImage, + QRect(rectImage.width()-xOffset, 0, xOffset, yOffset)); + // Middle left + if (yMiddles) + p.drawImage(QRect(10+-pw/2, 10+yOffset-pw/2, xOffset, height - ySide + pw), rectImage, + QRect(0, rectImage.height()/2, xOffset, 1)); + + // Middle + if (xMiddles && yMiddles) + p.drawImage(QRect(10+xOffset-pw/2, 10+yOffset-pw/2, width - xSide + pw, height - ySide + pw), rectImage, + QRect(rectImage.width()/2, rectImage.height()/2, 1, 1)); + // Middle right + if (yMiddles) + p.drawImage(QRect(10+width-xOffset+pw/2, 10+yOffset-pw/2, xOffset, height - ySide + pw), rectImage, + QRect(rectImage.width()-xOffset, rectImage.height()/2, xOffset, 1)); + // Lower left + p.drawImage(QPoint(10+-pw/2, 10+height - yOffset + pw/2), rectImage, QRect(0, rectImage.height() - yOffset, xOffset, yOffset)); + + // Lower Middle + if (xMiddles) + p.drawImage(QRect(10+xOffset-pw/2, 10+height - yOffset +pw/2, width - xSide + pw, yOffset), rectImage, + QRect(rectImage.width()/2, rectImage.height() - yOffset, 1, yOffset)); + // Lower Right + p.drawImage(QPoint(10+width-xOffset+pw/2, 10+height - yOffset+pw/2), rectImage, + QRect(rectImage.width()-xOffset, rectImage.height() - yOffset, xOffset, yOffset)); + } + surface.save("ssg.png"); +} + +void tst_QmlPainting::drawTransformedScaleGridRoundedRect_data() +{ + QTest::addColumn("transform"); + QTest::addColumn("imageType"); + + for (float angle = 0; angle < 360; angle += 10) + QTest::newRow(QString(QLatin1String("angle=%1; imagetype=ARGB32_Pre")).arg(angle).toLatin1()) << transformForAngle(angle) << (int)QImage::Format_ARGB32_Premultiplied; + //for (float angle = 0; angle < 360; angle += 10) + // QTest::newRow(QString(QLatin1String("angle=%1; imagetype=ARGB8565_Pre")).arg(angle).toLatin1()) << transformForAngle(angle) << (int)QImage::Format_ARGB8565_Premultiplied; + +} + +//code from QFxRect for drawing rounded rects +void tst_QmlPainting::drawTransformedScaleGridRoundedRect() +{ + QFETCH(QTransform, transform); + QFETCH(int, imageType); + + //setup image + const int pw = 1; + const int radius = 10; + QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, (QImage::Format)imageType); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + if (pw%2) + rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius); + else + rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius); + + //setup surface + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.setWorldTransform(transform); + const int pw = 2; + int offset = int(radius+1.5+pw); + int width = 80; + int height = 80; + + int w = width+pw; + int h = height+pw; + int xOffset = offset; + int xSide = xOffset * 2; + bool xMiddles=true; + if (xSide > w) { + xMiddles=false; + xOffset = w/2 + 1; + xSide = xOffset * 2; + } + int yOffset = offset; + int ySide = yOffset * 2; + bool yMiddles=true; + if (ySide > h) { + yMiddles = false; + yOffset = h/2 + 1; + ySide = yOffset * 2; + } + + // Upper left + p.drawImage(QRect(100-pw/2, 100-pw/2, xOffset, yOffset), rectImage, QRect(0, 0, xOffset, yOffset)); + + // Upper middle + if (xMiddles) + p.drawImage(QRect(100+xOffset-pw/2, 100+-pw/2, width - xSide + pw, yOffset), rectImage, + QRect(rectImage.width()/2, 0, 1, yOffset)); + // Upper right + p.drawImage(QPoint(100+width-xOffset+pw/2, 100+-pw/2), rectImage, + QRect(rectImage.width()-xOffset, 0, xOffset, yOffset)); + // Middle left + if (yMiddles) + p.drawImage(QRect(100+-pw/2, 100+yOffset-pw/2, xOffset, height - ySide + pw), rectImage, + QRect(0, rectImage.height()/2, xOffset, 1)); + + // Middle + if (xMiddles && yMiddles) + p.drawImage(QRect(100+xOffset-pw/2, 100+yOffset-pw/2, width - xSide + pw, height - ySide + pw), rectImage, + QRect(rectImage.width()/2, rectImage.height()/2, 1, 1)); + // Middle right + if (yMiddles) + p.drawImage(QRect(100+width-xOffset+pw/2, 100+yOffset-pw/2, xOffset, height - ySide + pw), rectImage, + QRect(rectImage.width()-xOffset, rectImage.height()/2, xOffset, 1)); + // Lower left + p.drawImage(QPoint(100+-pw/2, 100+height - yOffset + pw/2), rectImage, QRect(0, rectImage.height() - yOffset, xOffset, yOffset)); + + // Lower Middle + if (xMiddles) + p.drawImage(QRect(100+xOffset-pw/2, 100+height - yOffset +pw/2, width - xSide + pw, yOffset), rectImage, + QRect(rectImage.width()/2, rectImage.height() - yOffset, 1, yOffset)); + // Lower Right + p.drawImage(QPoint(100+width-xOffset+pw/2, 100+height - yOffset+pw/2), rectImage, + QRect(rectImage.width()-xOffset, rectImage.height() - yOffset, xOffset, yOffset)); + } + surface.save("tsg.png"); +} + +void tst_QmlPainting::drawTransformedTransparentImage_data() +{ + QTest::addColumn("imageType"); + + QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; + QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; +} + +void tst_QmlPainting::drawTransformedTransparentImage() +{ + QFETCH(int, imageType); + + //setup image + QImage transImage(200, 200, (QImage::Format)imageType); + transImage.fill(0); + + //setup surface + QImage surface(200, 200, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); + p.drawImage(0,0, transImage); + } +} + +void tst_QmlPainting::drawTransformedSemiTransparentImage_data() +{ + QTest::addColumn("imageType"); + + QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; + QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; +} + +void tst_QmlPainting::drawTransformedSemiTransparentImage() +{ + QFETCH(int, imageType); + + //setup image + QImage transImage(200, 200, (QImage::Format)imageType); + transImage.fill(QColor(0,0,0, 128).rgba()); + + //setup surface + QImage surface(200, 200, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); + p.drawImage(0,0, transImage); + } +} + +void tst_QmlPainting::drawTransformedFilledImage_data() +{ + QTest::addColumn("imageType"); + + QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; + QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; +} + +void tst_QmlPainting::drawTransformedFilledImage() +{ + QFETCH(int, imageType); + + //setup image + QImage filledImage(200, 200, (QImage::Format)imageType); + filledImage.fill(QColor(0,0,0).rgb()); + + //setup surface + QImage surface(200, 200, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); + p.drawImage(0,0, filledImage); + } +} + +QTEST_MAIN(tst_QmlPainting) + +#include "tst_qmlpainting.moc" diff --git a/tests/benchmarks/qmlxmlparser/main.cpp b/tests/benchmarks/qmlxmlparser/main.cpp deleted file mode 100644 index 17dc7f3..0000000 --- a/tests/benchmarks/qmlxmlparser/main.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include -#include -#include - -class tst_qmlxmlparser : public QObject -{ - Q_OBJECT - -public: - enum XmlParser { ParserQXmlStreamReader = 0, ParserQmlComponent }; - -private slots: - void parse(); - void parse_data(); - -private: - QString readFile(QString const&); -}; - -/* - Benchmark the parsing of Qml, using QXmlStreamReader as a baseline. - This gives an idea of the overhead Qml imposes over the top of plain XML parsing. -*/ -void tst_qmlxmlparser::parse() -{ - QFETCH(QString, xml); - QFETCH(int, parser); - - if (parser == ParserQXmlStreamReader) { - QBENCHMARK { - QXmlStreamReader parser(xml); - while (!parser.atEnd()) parser.readNext(); - } - } - else if (parser == ParserQmlComponent) { - QByteArray ba = xml.toLatin1(); - QBENCHMARK { - QmlComponent qmlc(ba); - } - } -} - -void tst_qmlxmlparser::parse_data() -{ - QTest::addColumn("xml"); - QTest::addColumn ("parser"); - - QTest::newRow("empty-qxml") - << QString() - << (int)ParserQXmlStreamReader; - - QTest::newRow("empty-qml") - << QString() - << (int)ParserQmlComponent; - - { - QString xml = QString::fromLatin1(""); - - QTest::newRow("simple-qxml") - << xml - << (int)ParserQXmlStreamReader; - - QTest::newRow("simple-qml") - << xml - << (int)ParserQmlComponent; - } - - { - QString xml = readFile("concept2.xml"); - - QTest::newRow("concept2-qxml") - << xml - << (int)ParserQXmlStreamReader; - - QTest::newRow("concept2-qml") - << xml - << (int)ParserQmlComponent; - } -} - -QString tst_qmlxmlparser::readFile(QString const& filename) -{ -#define _STR(X) #X -#define STR(X) _STR(X) - QFile file(QString("%1/testdata/%2").arg(STR(SRCDIR)).arg(filename)); - if (!file.open(QIODevice::ReadOnly)) { - qFatal("Could not open %s: %s", qPrintable(filename), qPrintable(file.errorString())); - } - QByteArray ba = file.readAll(); - return QString::fromLatin1(ba); -} - - -QTEST_MAIN(tst_qmlxmlparser) - -#include "main.moc" diff --git a/tests/benchmarks/qmlxmlparser/qmlxmlparser.pro b/tests/benchmarks/qmlxmlparser/qmlxmlparser.pro deleted file mode 100644 index e31c692..0000000 --- a/tests/benchmarks/qmlxmlparser/qmlxmlparser.pro +++ /dev/null @@ -1,14 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qmlxmlparser -DEPENDPATH += . -INCLUDEPATH += . - -CONFIG += release - -QT += declarative xml - -DEFINES+=SRCDIR=\"$$PWD\" - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qmlxmlparser/testdata/concept2.xml b/tests/benchmarks/qmlxmlparser/testdata/concept2.xml deleted file mode 100644 index 67c625d..0000000 --- a/tests/benchmarks/qmlxmlparser/testdata/concept2.xml +++ /dev/null @@ -1,421 +0,0 @@ - - - -
    \endraw - \snippet snippets/widgets-tutorial/windowlayout/main.cpp create, lay out widgets and show + \snippet tutorials/widgets/windowlayout/main.cpp main program \raw HTML \endraw @@ -149,17 +225,31 @@ manage the label and line edit and set the layout on the window, both the widgets and the layout itself are ''reparented'' to become children of the window. +*/ + +/*! + \page widgets-tutorial-nestedlayouts.html + \contentspage {Widgets Tutorial}{Contents} + \previouspage {Widgets Tutorial - Using Layouts} + \example tutorials/widgets/nestedlayouts + \title Widgets Tutorial - Nested Layouts Just as widgets can contain other widgets, layouts can be used to provide different levels of grouping for widgets. Here, we want to display a label alongside a line edit at the top of a window, above a table view showing the results of a query. + We achieve this by creating two layouts: \c{queryLayout} is a QHBoxLayout + that contains QLabel and QLineEdit widgets placed side-by-side; + \c{mainLayout} is a QVBoxLayout that contains \c{queryLayout} and a + QTableView arranged vertically. + \raw HTML
    \endraw - \snippet snippets/widgets-tutorial/nestedlayouts/main.cpp create, lay out widgets and show + \snippet tutorials/widgets/nestedlayouts/main.cpp first part + \snippet tutorials/widgets/nestedlayouts/main.cpp last part \raw HTML \endraw @@ -169,6 +259,26 @@
    \endraw + Note that we call the \c{mainLayout}'s \l{QBoxLayout::}{addLayout()} + function to insert the \c{queryLayout} above the \c{resultView} table. + + We have omitted the code that sets up the model containing the data shown + by the QTableView widget, \c resultView. For completeness, we show this below. + As well as QHBoxLayout and QVBoxLayout, Qt also provides QGridLayout and QFormLayout classes to help with more complex user interfaces. + These can be seen if you run \l{Qt Designer}. + + \section1 Setting up the Model + + In the code above, we did not show where the table's data came from + because we wanted to concentrate on the use of layouts. Here, we see + that the model holds a number of items corresponding to rows, each of + which is set up to contain data for two columns. + + \snippet tutorials/widgets/nestedlayouts/main.cpp set up the model + + The use of models and views is covered in the + \l{Qt Examples#Item Views}{item view examples} and in the + \l{Model/View Programming} overview. */ diff --git a/examples/tutorials/widgets/childwidget/childwidget.pro b/examples/tutorials/widgets/childwidget/childwidget.pro new file mode 100644 index 0000000..37ae98e --- /dev/null +++ b/examples/tutorials/widgets/childwidget/childwidget.pro @@ -0,0 +1,7 @@ +SOURCES = main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/widgets/childwidget +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS childwidget.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/widgets/childwidget +INSTALLS += target sources diff --git a/examples/tutorials/widgets/childwidget/main.cpp b/examples/tutorials/widgets/childwidget/main.cpp new file mode 100644 index 0000000..99235bd --- /dev/null +++ b/examples/tutorials/widgets/childwidget/main.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [main program] +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + QWidget *window = new QWidget(); + window->resize(320, 240); + window->setWindowTitle(tr("Child widget")); + window->show(); + +//! [create, position and show] + QPushButton *button = new QPushButton(tr("Press me"), window); + button->move(100, 100); + button->show(); +//! [create, position and show] + return app.exec(); +} +//! [main program] diff --git a/examples/tutorials/widgets/nestedlayouts/main.cpp b/examples/tutorials/widgets/nestedlayouts/main.cpp new file mode 100644 index 0000000..29996c6 --- /dev/null +++ b/examples/tutorials/widgets/nestedlayouts/main.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [main program] +//! [first part] +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + QWidget *window = new QWidget(); + + QLabel *queryLabel = new QLabel(tr("Query:")); + QLineEdit *queryEdit = new QLineEdit(); + QTableView *resultView = new QTableView(); + + QHBoxLayout *queryLayout = new QHBoxLayout(); + queryLayout->addWidget(queryLabel); + queryLayout->addWidget(queryEdit); + + QVBoxLayout *mainLayout = new QVBoxLayout(); + mainLayout->addLayout(queryLayout); + mainLayout->addWidget(resultView); + window->setLayout(mainLayout); + + // Set up the model and configure the view... +//! [first part] + +//! [set up the model] + QStandardItemModel model; + model.setHorizontalHeaderLabels(QStringList() << tr("Name") << tr("Office")); + + QList rows = QList() + << (QStringList() << "Verne Nilsen" << "123") + << (QStringList() << "Carlos Tang" << "77") + << (QStringList() << "Bronwyn Hawcroft" << "119") + << (QStringList() << "Alessandro Hanssen" << "32") + << (QStringList() << "Andrew John Bakken" << "54") + << (QStringList() << "Vanessa Weatherley" << "85") + << (QStringList() << "Rebecca Dickens" << "17") + << (QStringList() << "David Bradley" << "42") + << (QStringList() << "Knut Walters" << "25") + << (QStringList() << "Andrea Jones" << "34"); + + foreach (QStringList row, rows) { + QList items; + foreach (QString text, row) + items.append(new QStandardItem(text)); + model.appendRow(items); + } + + resultView->setModel(&model); + resultView->verticalHeader()->hide(); + resultView->horizontalHeader()->setStretchLastSection(true); +//! [set up the model] +//! [last part] + window->setWindowTitle(tr("Nested layouts")); + window->show(); + return app.exec(); +} +//! [last part] +//! [main program] diff --git a/examples/tutorials/widgets/nestedlayouts/nestedlayouts.pro b/examples/tutorials/widgets/nestedlayouts/nestedlayouts.pro new file mode 100644 index 0000000..a7f141c --- /dev/null +++ b/examples/tutorials/widgets/nestedlayouts/nestedlayouts.pro @@ -0,0 +1,7 @@ +SOURCES = main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/widgets/nestedlayouts +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS nestedlayouts.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/widgets/nestedlayouts +INSTALLS += target sources diff --git a/examples/tutorials/widgets/toplevel/main.cpp b/examples/tutorials/widgets/toplevel/main.cpp new file mode 100644 index 0000000..c966037 --- /dev/null +++ b/examples/tutorials/widgets/toplevel/main.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [main program] +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); +//! [create, resize and show] + QWidget *window = new QWidget(); + window->resize(320, 240); + window->show(); +//! [create, resize and show] + window->setWindowTitle(tr("Top-level widget")); + return app.exec(); +} +//! [main program] diff --git a/examples/tutorials/widgets/toplevel/toplevel.pro b/examples/tutorials/widgets/toplevel/toplevel.pro new file mode 100644 index 0000000..58d59c5 --- /dev/null +++ b/examples/tutorials/widgets/toplevel/toplevel.pro @@ -0,0 +1,7 @@ +SOURCES = main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/widgets/toplevel +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS toplevel.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/widgets/toplevel +INSTALLS += target sources diff --git a/examples/tutorials/widgets/widgets.pro b/examples/tutorials/widgets/widgets.pro new file mode 100644 index 0000000..7a870e7 --- /dev/null +++ b/examples/tutorials/widgets/widgets.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs +SUBDIRS = toplevel childwidget windowlayout nestedlayouts + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/widgets +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS widgets.pro README +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/widgets +INSTALLS += target sources diff --git a/examples/tutorials/widgets/windowlayout/main.cpp b/examples/tutorials/widgets/windowlayout/main.cpp new file mode 100644 index 0000000..d7c75a3 --- /dev/null +++ b/examples/tutorials/widgets/windowlayout/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [main program] +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + QWidget *window = new QWidget(); +//! [create, lay out widgets and show] + QLabel *label = new QLabel(tr("Name:")); + QLineEdit *lineEdit = new QLineEdit(); + + QHBoxLayout *layout = new QHBoxLayout(); + layout->addWidget(label); + layout->addWidget(lineEdit); + window->setLayout(layout); +//! [create, lay out widgets and show] + window->setWindowTitle(tr("Window layout")); + window->show(); + return app.exec(); +} +//! [main program] diff --git a/examples/tutorials/widgets/windowlayout/windowlayout.pro b/examples/tutorials/widgets/windowlayout/windowlayout.pro new file mode 100644 index 0000000..408f6ef --- /dev/null +++ b/examples/tutorials/widgets/windowlayout/windowlayout.pro @@ -0,0 +1,7 @@ +SOURCES = main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/widgets/windowlayout +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS windowlayout.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/widgets/windowlayout +INSTALLS += target sources -- cgit v0.12 From 27df3cb8c0e547d9174fd0571b16ed554eb2432d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 May 2009 14:25:38 +0200 Subject: qdoc: Moved a qdoc comment to a file that is in all packages. Task-number: 252565 --- src/gui/dialogs/qpagesetupdialog.cpp | 6 ++++++ src/gui/dialogs/qpagesetupdialog_mac.mm | 3 --- src/gui/styles/qmacstyle_mac.mm | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui/dialogs/qpagesetupdialog.cpp b/src/gui/dialogs/qpagesetupdialog.cpp index 63775d2..682071a 100644 --- a/src/gui/dialogs/qpagesetupdialog.cpp +++ b/src/gui/dialogs/qpagesetupdialog.cpp @@ -180,6 +180,12 @@ void QPageSetupDialog::open(QObject *receiver, const char *member) QDialog::open(); } +#if defined(Q_WS_MAC) || defined(Q_OS_WIN) +/*! \fn void QPageSetupDialog::setVisible(bool visible) + \reimp +*/ +#endif + QT_END_NAMESPACE #endif diff --git a/src/gui/dialogs/qpagesetupdialog_mac.mm b/src/gui/dialogs/qpagesetupdialog_mac.mm index 401d95f..24aef34 100644 --- a/src/gui/dialogs/qpagesetupdialog_mac.mm +++ b/src/gui/dialogs/qpagesetupdialog_mac.mm @@ -251,9 +251,6 @@ QPageSetupDialog::QPageSetupDialog(QWidget *parent) d->ep = static_cast(d->printer->paintEngine())->d_func(); } -/*! - \reimp -*/ void QPageSetupDialog::setVisible(bool visible) { Q_D(QPageSetupDialog); diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 2e47526..e4829dc 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -39,7 +39,7 @@ ** ****************************************************************************/ -/*! +/* Note: The qdoc comments for QMacStyle are contained in .../doc/src/qstyles.qdoc. */ -- cgit v0.12 From 6e03459f72b090695767f263e1d51e5182f5f317 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Wed, 20 May 2009 14:52:23 +0200 Subject: Don't draw an arrow for toolbuttons that are text only and have a menu. I made this change to make things look a bit better on the mac. However, a toolbutton with text only looks strange and as a bonus the arrow covers some of the text, which no one wants. It seems that similar consructions in Cocoa don't show the arrow for text button, so we shouldn't either. Task-number: 253339 Reviewed-by: Jens Bache-Wiig --- src/gui/styles/qmacstyle_mac.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index e4829dc..1be3d6e 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -5104,7 +5104,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex arrowOpt.state = tb->state; arrowOpt.palette = tb->palette; drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget); - } else if (tb->features & QStyleOptionToolButton::HasMenu) { + } else if ((tb->features & QStyleOptionToolButton::HasMenu) + && (tb->toolButtonStyle != Qt::ToolButtonTextOnly && !tb->icon.isNull())) { drawToolbarButtonArrow(tb->rect, tds, cg); } if (tb->state & State_On) { -- cgit v0.12 From f0d465e39eee9f819d0453b1bf66b3b0462383e2 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Wed, 20 May 2009 15:01:04 +0200 Subject: I made test more stable. There was no sens to check hardcoded size of header + file. Now test check only size of the real file content, assuming that it is rather boring (9,5MB of '\0'). It simply skip header. Reviewed by Peter Hartmann --- tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp index f501e78..5ab5064 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -795,14 +795,14 @@ void tst_QSocks5SocketEngine::downloadBigFile() if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); - QCOMPARE(bytesAvailable, qint64(10000309)); + QCOMPARE(bytesAvailable, qint64(10000000)); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - qDebug("\t\t%.1fMB/%.1fs: %.1fMB/s", + /*qDebug("\t\t%.1fMB/%.1fs: %.1fMB/s", bytesAvailable / (1024.0 * 1024.0), stopWatch.elapsed() / 1024.0, - (bytesAvailable / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); + (bytesAvailable / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));*/ delete tmpSocket; tmpSocket = 0; @@ -816,7 +816,10 @@ void tst_QSocks5SocketEngine::exitLoopSlot() void tst_QSocks5SocketEngine::downloadBigFileSlot() { - bytesAvailable += tmpSocket->readAll().size(); + QByteArray tmp=tmpSocket->readAll(); + int correction=tmp.indexOf((char)0,0); //skip header + if (correction==-1) correction=0; + bytesAvailable += (tmp.size()-correction); if (bytesAvailable >= 10000000) QTestEventLoop::instance().exitLoop(); } -- cgit v0.12 From efb14d56ef9cd327f6358f626f79e3ee88078600 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 20 May 2009 15:37:12 +0200 Subject: Doc: Compile fixes for tutorial examples. Reviewed-by: Trust Me --- examples/tutorials/widgets/childwidget/main.cpp | 10 +++++----- examples/tutorials/widgets/nestedlayouts/main.cpp | 13 +++++++------ examples/tutorials/widgets/toplevel/main.cpp | 8 ++++---- examples/tutorials/widgets/windowlayout/main.cpp | 10 +++++----- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/examples/tutorials/widgets/childwidget/main.cpp b/examples/tutorials/widgets/childwidget/main.cpp index 99235bd..8674b6e 100644 --- a/examples/tutorials/widgets/childwidget/main.cpp +++ b/examples/tutorials/widgets/childwidget/main.cpp @@ -45,13 +45,13 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - QWidget *window = new QWidget(); - window->resize(320, 240); - window->setWindowTitle(tr("Child widget")); - window->show(); + QWidget window; + window.resize(320, 240); + window.setWindowTitle(QObject::tr("Child widget")); + window.show(); //! [create, position and show] - QPushButton *button = new QPushButton(tr("Press me"), window); + QPushButton *button = new QPushButton(QObject::tr("Press me"), &window); button->move(100, 100); button->show(); //! [create, position and show] diff --git a/examples/tutorials/widgets/nestedlayouts/main.cpp b/examples/tutorials/widgets/nestedlayouts/main.cpp index 29996c6..33f9ad2 100644 --- a/examples/tutorials/widgets/nestedlayouts/main.cpp +++ b/examples/tutorials/widgets/nestedlayouts/main.cpp @@ -46,9 +46,9 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - QWidget *window = new QWidget(); + QWidget window; - QLabel *queryLabel = new QLabel(tr("Query:")); + QLabel *queryLabel = new QLabel(QObject::tr("Query:")); QLineEdit *queryEdit = new QLineEdit(); QTableView *resultView = new QTableView(); @@ -59,14 +59,15 @@ int main(int argc, char *argv[]) QVBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->addLayout(queryLayout); mainLayout->addWidget(resultView); - window->setLayout(mainLayout); + window.setLayout(mainLayout); // Set up the model and configure the view... //! [first part] //! [set up the model] QStandardItemModel model; - model.setHorizontalHeaderLabels(QStringList() << tr("Name") << tr("Office")); + model.setHorizontalHeaderLabels( + QStringList() << QObject::tr("Name") << QObject::tr("Office")); QList rows = QList() << (QStringList() << "Verne Nilsen" << "123") @@ -92,8 +93,8 @@ int main(int argc, char *argv[]) resultView->horizontalHeader()->setStretchLastSection(true); //! [set up the model] //! [last part] - window->setWindowTitle(tr("Nested layouts")); - window->show(); + window.setWindowTitle(QObject::tr("Nested layouts")); + window.show(); return app.exec(); } //! [last part] diff --git a/examples/tutorials/widgets/toplevel/main.cpp b/examples/tutorials/widgets/toplevel/main.cpp index c966037..25ebd3f 100644 --- a/examples/tutorials/widgets/toplevel/main.cpp +++ b/examples/tutorials/widgets/toplevel/main.cpp @@ -46,11 +46,11 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); //! [create, resize and show] - QWidget *window = new QWidget(); - window->resize(320, 240); - window->show(); + QWidget window; + window.resize(320, 240); + window.show(); //! [create, resize and show] - window->setWindowTitle(tr("Top-level widget")); + window.setWindowTitle(QObject::tr("Top-level widget")); return app.exec(); } //! [main program] diff --git a/examples/tutorials/widgets/windowlayout/main.cpp b/examples/tutorials/widgets/windowlayout/main.cpp index d7c75a3..15a11e1 100644 --- a/examples/tutorials/widgets/windowlayout/main.cpp +++ b/examples/tutorials/widgets/windowlayout/main.cpp @@ -45,18 +45,18 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - QWidget *window = new QWidget(); + QWidget window; //! [create, lay out widgets and show] - QLabel *label = new QLabel(tr("Name:")); + QLabel *label = new QLabel(QObject::tr("Name:")); QLineEdit *lineEdit = new QLineEdit(); QHBoxLayout *layout = new QHBoxLayout(); layout->addWidget(label); layout->addWidget(lineEdit); - window->setLayout(layout); + window.setLayout(layout); //! [create, lay out widgets and show] - window->setWindowTitle(tr("Window layout")); - window->show(); + window.setWindowTitle(QObject::tr("Window layout")); + window.show(); return app.exec(); } //! [main program] -- cgit v0.12 From f6b9e75f3f7fd7bdef3855dd07ffdc9fa10b2dae Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 20 May 2009 15:47:58 +0200 Subject: Pass ShortcutOverride event through SimpleCanvas to QFxTextEdit In Bauhaus we have a global shortcut associated with the Del key. This prevents the global shortcut from capturing the Del key while editing in a text edit field. --- src/declarative/canvas/qsimplecanvas.cpp | 9 +++++++-- src/declarative/fx/qfxtextedit.cpp | 14 ++++++++++++++ src/declarative/fx/qfxtextedit.h | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/declarative/canvas/qsimplecanvas.cpp b/src/declarative/canvas/qsimplecanvas.cpp index cd50945..fbd5014 100644 --- a/src/declarative/canvas/qsimplecanvas.cpp +++ b/src/declarative/canvas/qsimplecanvas.cpp @@ -957,9 +957,14 @@ bool QSimpleCanvas::event(QEvent *e) queueUpdate(); return true; - } else { - return QWidget::event(e); } + + if (e->type() == QEvent::ShortcutOverride) { + if (QSimpleCanvasItem *focus = focusItem()) + return focus->event(e); + } + + return QWidget::event(e); } void QSimpleCanvas::paintEvent(QPaintEvent *) diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 8667c9e..b2da051 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -616,6 +616,20 @@ void QFxTextEdit::moveCursor(QTextCursor::MoveOperation operation, QTextCursor:: /*! \overload +Handles the given \a event. +*/ +bool QFxTextEdit::event(QEvent *event) +{ + Q_D(QFxTextEdit); + if (event->type() == QEvent::ShortcutOverride) { + d->control->processEvent(event, QPointF(0, 0)); + return true; + } + return QFxPaintedItem::event(event); +} + +/*! +\overload Handles the given key \a event. */ void QFxTextEdit::keyPressEvent(QKeyEvent *event) diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index f702101..d195a80 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -174,6 +174,7 @@ protected: virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); + bool event(QEvent *); void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); -- cgit v0.12 From 4a756726ee874ff2ce496e1b113707c65c39a76b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 18 May 2009 22:35:42 +0200 Subject: Use a per object lock for signal/slots That way we prevent the current possible race condition that may appears while touching signals slot while object are moved to different threads. For exemple, when we do sender->threadData->mutex->lock(); the sender can possibly be moved to another thread between the moment we get the pointer to the threadData and the moment we aquire the lock. We could check if we locked the right mutex and retry otherwise, but that would break if the threadData (and hence the mutex) get destroyed in between. The per object mutex is implemented with a thread pool. I'm not using the global QThreadPool because we might ends up locking two of their mutex, and that would be dangerous if something else holds a lock on the same mutex (possible deadlock) Putting the mutex pool in a Q_GLOBAL_STATIC doesn't work as it might result of the ppol being deleted before some other object in others Q_GLOBAL_STATIC structures There is no need to lock this mutex in moveToThread as this is safe. When emiting a signal, we do not need to lock the thread data, as the user must ensure that the object is not moved to a thread while emiting a AutoConnection signal. Reviewed-by: Brad --- src/corelib/kernel/qobject.cpp | 66 ++++++++++++++++++++---------- tests/auto/qobjectrace/tst_qobjectrace.cpp | 24 +++++++++-- 2 files changed, 65 insertions(+), 25 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 9f803fa..cfd8493 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -58,6 +58,7 @@ #include #include +#include #include @@ -91,12 +92,35 @@ static int *queuedConnectionTypes(const QList &typeNames) return types; } +QBasicAtomicPointer signalSlotMutexes = Q_BASIC_ATOMIC_INITIALIZER(0); +QBasicAtomicInt objectCount = Q_BASIC_ATOMIC_INITIALIZER(0); + +/** \internal + * mutex to be locked when accessing the connectionlists or the senders list + */ +static QMutex *signalSlotLock(const QObject *o) +{ + if (!signalSlotMutexes) { + QMutexPool *mp = new QMutexPool; + if (!signalSlotMutexes.testAndSetOrdered(0, mp)) { + delete mp; + } + } + return signalSlotMutexes->get(o); +} + extern "C" Q_CORE_EXPORT void qt_addObject(QObject *) { + objectCount.ref(); } extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *) { + if(!objectCount.deref()) { + QMutexPool *old = signalSlotMutexes; + signalSlotMutexes.testAndSetAcquire(old, 0); + delete old; + } } QObjectPrivate::QObjectPrivate(int version) @@ -223,7 +247,7 @@ bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const int signal_index = q->metaObject()->indexOfSignal(signal); if (signal_index < 0) return false; - QMutexLocker locker(&threadData->mutex); + QMutexLocker locker(signalSlotLock(q)); if (connectionLists) { if (signal_index < connectionLists->count()) { const ConnectionList &connectionList = connectionLists->at(signal_index); @@ -245,7 +269,7 @@ QObjectList QObjectPrivate::receiverList(const char *signal) const int signal_index = q->metaObject()->indexOfSignal(signal); if (signal_index < 0) return returnValue; - QMutexLocker locker(&threadData->mutex); + QMutexLocker locker(signalSlotLock(q)); if (connectionLists) { if (signal_index < connectionLists->count()) { const ConnectionList &connectionList = connectionLists->at(signal_index); @@ -263,7 +287,7 @@ QObjectList QObjectPrivate::receiverList(const char *signal) const QObjectList QObjectPrivate::senderList() const { QObjectList returnValue; - QMutexLocker locker(&threadData->mutex); + QMutexLocker locker(signalSlotLock(q_func())); for (int i = 0; i < senders.count(); ++i) returnValue << senders.at(i)->sender; return returnValue; @@ -712,7 +736,7 @@ QObject::~QObject() emit destroyed(this); { - QMutexLocker locker(&d->threadData->mutex); + QMutexLocker locker(signalSlotLock(this)); // set ref to zero to indicate that this object has been deleted if (d->currentSender != 0) @@ -731,7 +755,7 @@ QObject::~QObject() continue; } - QMutex *m = &c->receiver->d_func()->threadData->mutex; + QMutex *m = signalSlotLock(c->receiver); bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m); c = connectionList[i]; if (c->receiver) @@ -755,7 +779,7 @@ QObject::~QObject() for (int i = 0; i < d->senders.count(); ) { QObjectPrivate::Connection *s = d->senders[i]; - QMutex *m = &s->sender->d_func()->threadData->mutex; + QMutex *m = signalSlotLock(s->sender); bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m); if (m < locker.mutex()) { if (i >= d->senders.count() || s != d->senders[i]) { @@ -765,11 +789,9 @@ QObject::~QObject() } } s->receiver = 0; - if (s->sender) { - QObjectConnectionListVector *senderLists = s->sender->d_func()->connectionLists; - if (senderLists) - senderLists->dirty = true; - } + QObjectConnectionListVector *senderLists = s->sender->d_func()->connectionLists; + if (senderLists) + senderLists->dirty = true; if (needToUnlock) m->unlock(); @@ -2254,7 +2276,7 @@ QObject *QObject::sender() const { Q_D(const QObject); - QMutexLocker(&d->threadData->mutex); + QMutexLocker(signalSlotLock(this)); if (!d->currentSender) return 0; @@ -2310,7 +2332,7 @@ int QObject::receivers(const char *signal) const } Q_D(const QObject); - QMutexLocker locker(&d->threadData->mutex); + QMutexLocker locker(signalSlotLock(this)); if (d->connectionLists) { if (signal_index < d->connectionLists->count()) { const QObjectPrivate::ConnectionList &connectionList = @@ -2757,8 +2779,8 @@ bool QMetaObject::connect(const QObject *sender, int signal_index, c->connectionType = type; c->argumentTypes = types; - QOrderedMutexLocker locker(&s->d_func()->threadData->mutex, - &r->d_func()->threadData->mutex); + QOrderedMutexLocker locker(signalSlotLock(sender), + signalSlotLock(receiver)); s->d_func()->addConnection(signal_index, c); r->d_func()->senders.append(c); @@ -2783,8 +2805,8 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index, QObject *s = const_cast(sender); QObject *r = const_cast(receiver); - QMutex *senderMutex = &s->d_func()->threadData->mutex; - QMutex *receiverMutex = r ? &r->d_func()->threadData->mutex : 0; + QMutex *senderMutex = signalSlotLock(sender); + QMutex *receiverMutex = receiver ? signalSlotLock(receiver) : 0; QOrderedMutexLocker locker(senderMutex, receiverMutex); QObjectConnectionListVector *connectionLists = s->d_func()->connectionLists; @@ -2804,7 +2826,7 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index, if (c->receiver && (r == 0 || (c->receiver == r && (method_index < 0 || c->method == method_index)))) { - QMutex *m = &c->receiver->d_func()->threadData->mutex; + QMutex *m = signalSlotLock(c->receiver); bool needToUnlock = false; if (!receiverMutex && senderMutex != m) { // need to relock this receiver and sender in the correct order @@ -2831,7 +2853,7 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index, if (c->receiver && (r == 0 || (c->receiver == r && (method_index < 0 || c->method == method_index)))) { - QMutex *m = &c->receiver->d_func()->threadData->mutex; + QMutex *m = signalSlotLock(c->receiver); bool needToUnlock = false; if (!receiverMutex && senderMutex != m) { // need to relock this receiver and sender in the correct order @@ -2972,7 +2994,7 @@ static void blocking_activate(QObject *sender, int signal, QObjectPrivate::Conne #else QSemaphore semaphore; queued_activate(sender, signal, c, argv, &semaphore); - QMutex *mutex = &QThreadData::get2(sender->thread())->mutex; + QMutex *mutex = signalSlotLock(sender); mutex->unlock(); semaphore.acquire(); mutex->lock(); @@ -2992,7 +3014,7 @@ void QMetaObject::activate(QObject *sender, int from_signal_index, int to_signal argv ? argv : empty_argv); } - QMutexLocker locker(&sender->d_func()->threadData->mutex); + QMutexLocker locker(signalSlotLock(sender)); QThreadData *currentThreadData = QThreadData::current(); QObjectConnectionListVector *connectionLists = sender->d_func()->connectionLists; @@ -3344,7 +3366,7 @@ void QObject::dumpObjectInfo() objectName().isEmpty() ? "unnamed" : objectName().toLocal8Bit().data()); Q_D(QObject); - QMutexLocker locker(&d->threadData->mutex); + QMutexLocker locker(signalSlotLock(this)); // first, look for connections where this object is the sender qDebug(" SIGNALS OUT"); diff --git a/tests/auto/qobjectrace/tst_qobjectrace.cpp b/tests/auto/qobjectrace/tst_qobjectrace.cpp index fcfd528..aa80534 100644 --- a/tests/auto/qobjectrace/tst_qobjectrace.cpp +++ b/tests/auto/qobjectrace/tst_qobjectrace.cpp @@ -43,6 +43,7 @@ #include #include + enum { OneMinute = 60 * 1000, TwoMinutes = OneMinute * 2 }; class tst_QObjectRace: public QObject @@ -70,12 +71,18 @@ public: public slots: void theSlot() { - enum { step = 1000 }; + enum { step = 35 }; if ((++count % step) == 0) { QThread *nextThread = threads.at((count / step) % threads.size()); moveToThread(nextThread); } } + + void destroSlot() { + emit theSignal(); + } +signals: + void theSignal(); }; class RaceThread : public QThread @@ -120,6 +127,10 @@ private slots: if (stopWatch.elapsed() >= OneMinute / 2) #endif quit(); + + QObject o; + connect(&o, SIGNAL(destroyed()) , object, SLOT(destroSlot())); + connect(object, SIGNAL(destroyed()) , &o, SLOT(deleteLater())); } }; @@ -138,10 +149,17 @@ void tst_QObjectRace::moveToThreadRace() for (int i = 0; i < ThreadCount; ++i) threads[i]->start(); - QVERIFY(threads[0]->wait(TwoMinutes)); + + while(!threads[0]->isFinished()) { + QPointer foo (object); + QObject o; + connect(&o, SIGNAL(destroyed()) , object, SLOT(destroSlot())); + connect(object, SIGNAL(destroyed()) , &o, SLOT(deleteLater())); + QTest::qWait(10); + } // the other threads should finish pretty quickly now for (int i = 1; i < ThreadCount; ++i) - QVERIFY(threads[i]->wait(30000)); + QVERIFY(threads[i]->wait(300)); for (int i = 0; i < ThreadCount; ++i) delete threads[i]; -- cgit v0.12 From afa4bcc90f79f3a68bed3f3429f2515fc8c7d23d Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 20 May 2009 15:53:07 +0200 Subject: Changing the addressbook tutorial so it doesn't leak. Reviewed-By: Kavindra Palaraja --- doc/src/tutorials/addressbook.qdoc | 9 ++++++--- examples/tutorials/addressbook-fr/part1/main.cpp | 4 ++-- examples/tutorials/addressbook-fr/part2/main.cpp | 4 ++-- examples/tutorials/addressbook-fr/part3/main.cpp | 4 ++-- examples/tutorials/addressbook-fr/part4/main.cpp | 4 ++-- examples/tutorials/addressbook-fr/part5/main.cpp | 4 ++-- examples/tutorials/addressbook-fr/part6/main.cpp | 4 ++-- examples/tutorials/addressbook-fr/part7/main.cpp | 4 ++-- examples/tutorials/addressbook/part1/main.cpp | 4 ++-- examples/tutorials/addressbook/part2/main.cpp | 4 ++-- examples/tutorials/addressbook/part3/main.cpp | 4 ++-- examples/tutorials/addressbook/part4/main.cpp | 4 ++-- examples/tutorials/addressbook/part5/main.cpp | 4 ++-- examples/tutorials/addressbook/part6/main.cpp | 4 ++-- examples/tutorials/addressbook/part7/main.cpp | 4 ++-- 15 files changed, 34 insertions(+), 31 deletions(-) diff --git a/doc/src/tutorials/addressbook.qdoc b/doc/src/tutorials/addressbook.qdoc index 3b0d2bc..38200b0 100644 --- a/doc/src/tutorials/addressbook.qdoc +++ b/doc/src/tutorials/addressbook.qdoc @@ -242,12 +242,15 @@ \snippet tutorials/addressbook/part1/main.cpp main function - We construct a new \c AddressBook widget on the heap using the \c new - keyword and invoke its \l{QWidget::show()}{show()} function to display it. + We construct a new \c AddressBook widget on the stack and invoke + its \l{QWidget::show()}{show()} function to display it. However, the widget will not be shown until the application's event loop is started. We start the event loop by calling the application's \l{QApplication::}{exec()} function; the result returned by this function - is used as the return value from the \c main() function. + is used as the return value from the \c main() function. At this point, + it becomes apparent why we instanciated \c AddressBook on the stack: It + will now go out of scope. Therefore, \c AddressBook and all its child widgets + will be deleted, thus preventing memory leaks. */ /*! diff --git a/examples/tutorials/addressbook-fr/part1/main.cpp b/examples/tutorials/addressbook-fr/part1/main.cpp index 22bfd3e..9c96882 100644 --- a/examples/tutorials/addressbook-fr/part1/main.cpp +++ b/examples/tutorials/addressbook-fr/part1/main.cpp @@ -47,8 +47,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook-fr/part2/main.cpp b/examples/tutorials/addressbook-fr/part2/main.cpp index 22bfd3e..9c96882 100644 --- a/examples/tutorials/addressbook-fr/part2/main.cpp +++ b/examples/tutorials/addressbook-fr/part2/main.cpp @@ -47,8 +47,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook-fr/part3/main.cpp b/examples/tutorials/addressbook-fr/part3/main.cpp index b25d656..46f6f03 100644 --- a/examples/tutorials/addressbook-fr/part3/main.cpp +++ b/examples/tutorials/addressbook-fr/part3/main.cpp @@ -46,8 +46,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook-fr/part4/main.cpp b/examples/tutorials/addressbook-fr/part4/main.cpp index b25d656..46f6f03 100644 --- a/examples/tutorials/addressbook-fr/part4/main.cpp +++ b/examples/tutorials/addressbook-fr/part4/main.cpp @@ -46,8 +46,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook-fr/part5/main.cpp b/examples/tutorials/addressbook-fr/part5/main.cpp index b25d656..46f6f03 100644 --- a/examples/tutorials/addressbook-fr/part5/main.cpp +++ b/examples/tutorials/addressbook-fr/part5/main.cpp @@ -46,8 +46,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook-fr/part6/main.cpp b/examples/tutorials/addressbook-fr/part6/main.cpp index b25d656..46f6f03 100644 --- a/examples/tutorials/addressbook-fr/part6/main.cpp +++ b/examples/tutorials/addressbook-fr/part6/main.cpp @@ -46,8 +46,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook-fr/part7/main.cpp b/examples/tutorials/addressbook-fr/part7/main.cpp index b25d656..46f6f03 100644 --- a/examples/tutorials/addressbook-fr/part7/main.cpp +++ b/examples/tutorials/addressbook-fr/part7/main.cpp @@ -46,8 +46,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook/part1/main.cpp b/examples/tutorials/addressbook/part1/main.cpp index 22bfd3e..9c96882 100644 --- a/examples/tutorials/addressbook/part1/main.cpp +++ b/examples/tutorials/addressbook/part1/main.cpp @@ -47,8 +47,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook/part2/main.cpp b/examples/tutorials/addressbook/part2/main.cpp index 22bfd3e..9c96882 100644 --- a/examples/tutorials/addressbook/part2/main.cpp +++ b/examples/tutorials/addressbook/part2/main.cpp @@ -47,8 +47,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook/part3/main.cpp b/examples/tutorials/addressbook/part3/main.cpp index b25d656..46f6f03 100644 --- a/examples/tutorials/addressbook/part3/main.cpp +++ b/examples/tutorials/addressbook/part3/main.cpp @@ -46,8 +46,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook/part4/main.cpp b/examples/tutorials/addressbook/part4/main.cpp index b25d656..46f6f03 100644 --- a/examples/tutorials/addressbook/part4/main.cpp +++ b/examples/tutorials/addressbook/part4/main.cpp @@ -46,8 +46,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook/part5/main.cpp b/examples/tutorials/addressbook/part5/main.cpp index b25d656..46f6f03 100644 --- a/examples/tutorials/addressbook/part5/main.cpp +++ b/examples/tutorials/addressbook/part5/main.cpp @@ -46,8 +46,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook/part6/main.cpp b/examples/tutorials/addressbook/part6/main.cpp index b25d656..46f6f03 100644 --- a/examples/tutorials/addressbook/part6/main.cpp +++ b/examples/tutorials/addressbook/part6/main.cpp @@ -46,8 +46,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } diff --git a/examples/tutorials/addressbook/part7/main.cpp b/examples/tutorials/addressbook/part7/main.cpp index b25d656..46f6f03 100644 --- a/examples/tutorials/addressbook/part7/main.cpp +++ b/examples/tutorials/addressbook/part7/main.cpp @@ -46,8 +46,8 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - AddressBook *addressBook = new AddressBook; - addressBook->show(); + AddressBook addressBook; + addressBook.show(); return app.exec(); } -- cgit v0.12 From d2e3f2a79a2f8cae66a94bbd2d16f92171455a8d Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 20 May 2009 12:46:18 +0200 Subject: allow to debug QVariant of float type Reviewed-by: ogoffart --- src/corelib/kernel/qvariant.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index b504604..2ff9818 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1021,7 +1021,7 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result, #if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM) static void streamDebug(QDebug dbg, const QVariant &v) { - switch (v.type()) { + switch (v.userType()) { case QVariant::Int: dbg.nospace() << v.toInt(); break; @@ -1034,6 +1034,9 @@ static void streamDebug(QDebug dbg, const QVariant &v) case QVariant::ULongLong: dbg.nospace() << v.toULongLong(); break; + case QMetaType::Float: + dbg.nospace() << qVariantValue(v); + break; case QVariant::Double: dbg.nospace() << v.toDouble(); break; -- cgit v0.12 From 3830edd3c62ce1e66fe6b7edaad6834230d7e8c3 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 20 May 2009 16:21:44 +0200 Subject: Remove QDumper. It was used in a previous version of creator but is now useless. --- src/corelib/tools/qdumper.cpp | 1157 ----------------------------------------- src/corelib/tools/tools.pri | 1 - 2 files changed, 1158 deletions(-) delete mode 100644 src/corelib/tools/qdumper.cpp diff --git a/src/corelib/tools/qdumper.cpp b/src/corelib/tools/qdumper.cpp deleted file mode 100644 index c3b8524..0000000 --- a/src/corelib/tools/qdumper.cpp +++ /dev/null @@ -1,1157 +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 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined(Q_OS_WINCE) && !defined(QT_NO_DUMPER) - -#include -#include - -#ifdef Q_OS_WIN -# include -#endif - -QT_BEGIN_NAMESPACE - -namespace { - -// This is used to abort evaluation of custom data dumpers in a "coordinated" -// way. Abortion will happen anyway when we try to access a non-initialized -// non-trivial object, so there is no way to prevent this from occuring at all -// conceptionally. Gdb will catch SIGSEGV and return to the calling frame. -// This is just fine provided we only _read_ memory in the custom handlers -// below. - -volatile int qProvokeSegFaultHelper; - -static void qCheckAccess(const void *d) -{ - // provoke segfault when address is not readable - qProvokeSegFaultHelper = *(char*)d; -} - -static void qCheckPointer(const void *d) -{ - if (!d) - return; - qProvokeSegFaultHelper = *(char*)d; -} - -static void qProvokeSegFault() -{ - // provoke segfault unconditionally - qCheckAccess(0); -} - -static char qDumpInBuffer[100]; -static char qDumpBuffer[1000]; -#ifdef Q_OS_WIN -static char qDumpBuffer2[sizeof(qDumpBuffer) + 100]; -#endif - -static char toHex(int n) -{ - return n < 10 ? '0' + n : 'a' - 10 + n; -} - - -struct QDumper -{ - explicit QDumper(); - ~QDumper(); - void flush(); - QDumper &operator<<(long c); - QDumper &operator<<(int i); - QDumper &operator<<(unsigned long c); - QDumper &operator<<(unsigned int i); - QDumper &operator<<(const void *p); - void put(char c); - void addCommaIfNeeded(); - void putEncoded(unsigned c); - QDumper &operator<<(const char *str); - QDumper &operator<<(const QString &str); - void disarm(); - - void beginHash(); // start of data hash output - void endHash(); // start of data hash output - - // the dumper arguments - int protocolVersion; // dumper protocol version - int token; // some token to show on success - const char *outertype; // object type - const char *iname; // object name used for display - const char *exp; // object expression - const char *innertype; // 'inner type' for class templates - const void *data; // pointer to raw data - bool dumpChildren; // do we want to see children? - - // handling of nested templates - void setupTemplateParameters(); - enum { maxTemplateParameters = 10 }; - const char *templateParameters[maxTemplateParameters + 1]; - int templateParametersCount; - - // internal state - bool success; // are we finished? - size_t pos; -}; - - -QDumper::QDumper() -{ - success = false; - pos = 0; -} - -QDumper::~QDumper() -{ - flush(); - put(0); // our end marker -#ifdef Q_OS_WIN - sprintf(qDumpBuffer2, "@@CDD/%d/done\n", token); - OutputDebugStringA(qDumpBuffer2); -#else - fprintf(stderr, "%d/done\n", token); -#endif - qDumpInBuffer[0] = 0; -} - -void QDumper::flush() -{ - qDumpBuffer[pos++] = 0; -#ifdef Q_OS_WIN - sprintf(qDumpBuffer2, "@@CDD#%d#%d,%s\n", token, int(pos - 1), qDumpBuffer); - OutputDebugStringA(qDumpBuffer2); -#else - fprintf(stderr, "%d#%d,%s\n", token, int(pos - 1), qDumpBuffer); -#endif - pos = 0; -} - -void QDumper::setupTemplateParameters() -{ - char *s = const_cast(innertype); - - templateParametersCount = 1; - templateParameters[0] = s; - for (int i = 1; i != maxTemplateParameters + 1; ++i) - templateParameters[i] = 0; - - while (*s) { - while (*s && *s != '@') - ++s; - if (*s) { - *s = '\0'; - ++s; - templateParameters[templateParametersCount++] = s; - } - } -} - -QDumper &QDumper::operator<<(unsigned long c) -{ - static char buf[100]; - sprintf(buf, "%lu", c); - return (*this) << buf; -} - -QDumper &QDumper::operator<<(unsigned int i) -{ - static char buf[100]; - sprintf(buf, "%u", i); - return (*this) << buf; -} - -QDumper &QDumper::operator<<(long c) -{ - static char buf[100]; - sprintf(buf, "%ld", c); - return (*this) << buf; -} - -QDumper &QDumper::operator<<(int i) -{ - static char buf[100]; - sprintf(buf, "%d", i); - return (*this) << buf; -} - -QDumper &QDumper::operator<<(const void *p) -{ - static char buf[100]; - sprintf(buf, "%p", p); - // we get a '0x' prefix only on some implementations. - // if it isn't there, write it out manually. - if (buf[1] != 'x') { - put('0'); - put('x'); - } - return (*this) << buf; -} - -void QDumper::put(char c) -{ - if (pos >= sizeof(qDumpBuffer) - 100) - flush(); - qDumpBuffer[pos++] = c; -} - -void QDumper::addCommaIfNeeded() -{ - if (pos == 0) - return; - if (qDumpBuffer[pos - 1] == '}' || qDumpBuffer[pos - 1] == '"') - put(','); -} - -void QDumper::putEncoded(unsigned c) -{ - if (c >= 32 && c <= 126 && c != '"' && c != '\\') { - put(c); - } else { - put('\\'); - put('u'); - put(toHex((c >> 12) & 0xf)); - put(toHex((c >> 8) & 0xf)); - put(toHex((c >> 4) & 0xf)); - put(toHex( c & 0xf)); - } -} - -QDumper &QDumper::operator<<(const char *str) -{ - while (*str) - put(*(str++)); - return *this; -} - -QDumper &QDumper::operator<<(const QString &str) -{ - int n = str.size(); - if (n < 0) { - qProvokeSegFault(); - } else { - //(*this) << "[" << n << "]"; - if (n > 1000000) - n = 1000000; - //put(' '); - put('\\'); - put('"'); - for (int i = 0; i != n; ++i) - putEncoded(str[i].unicode()); - put('\\'); - put('"'); - if (n < str.size()) - (*this) << ""; - } - return *this; -} - -void QDumper::disarm() -{ - flush(); - success = true; -} - -void QDumper::beginHash() -{ - addCommaIfNeeded(); - put('{'); -} - -void QDumper::endHash() -{ - put('}'); -} - - -// -// Some helpers to keep the dumper code short -// - -// dump property=value pair -#undef P -#define P(dumper,name,value) \ - do { \ - dumper.addCommaIfNeeded(); \ - dumper << (name) << "=\"" << value << "\""; \ - } while (0) - -// simple string property -#undef S -#define S(dumper, name, value) \ - dumper.beginHash(); \ - P(dumper, "name", name); \ - P(dumper, "value", value); \ - P(dumper, "type", "QString"); \ - P(dumper, "numchild", "0"); \ - dumper.endHash(); - -// simple integer property -#undef I -#define I(dumper, name, value) \ - dumper.beginHash(); \ - P(dumper, "name", name); \ - P(dumper, "value", value); \ - P(dumper, "type", "int"); \ - P(dumper, "numchild", "0"); \ - dumper.endHash(); - -// simple boolean property -#undef BL -#define BL(dumper, name, value) \ - dumper.beginHash(); \ - P(dumper, "name", name); \ - P(dumper, "value", (value ? "true" : "false")); \ - P(dumper, "type", "bool"); \ - P(dumper, "numchild", "0"); \ - dumper.endHash(); - -#undef TT -#define TT(type, value) \ - "
    " << type << " : " << value << "