diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-16 00:12:46 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-16 00:12:46 (GMT) |
commit | 0a9af9856022393ce7c1c14b953106ab54f0cfed (patch) | |
tree | a7bd3d0e6daf683ba8c93e7b4ec9ad2f28c46d52 /src | |
parent | 6e2c3e7306883cd4618742e37861e326e9c91895 (diff) | |
parent | 8cda4ebd5611a6680cd311ff7cadfcc43c6f1686 (diff) | |
download | Qt-0a9af9856022393ce7c1c14b953106ab54f0cfed.zip Qt-0a9af9856022393ce7c1c14b953106ab54f0cfed.tar.gz Qt-0a9af9856022393ce7c1c14b953106ab54f0cfed.tar.bz2 |
Merge branch 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into 4.7-integration
* 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: (48 commits)
Remove test cases which cause stack overflow
Avoid a crash in the OpenVG paint engine when clipping to an empty path
Fix last character being overwritten in password field
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 038b62085831eef4dee423361c65ecd55b7b9b1d )
QSslSocket: Improve error handling
Compile when bootstrapping qmake
Fix regression in tst_qrand::testqrand()
syncqt: don't try to split %module's values
syncqt: fix wrong paths in include/ActiveQt/headers.pri
Fix a crash when recursing into QSharedPointer from QSharedPointer::clear()
Fix a couple of memory leaks due to not releasing CFTypes on Mac
Initalize the nativeDialogInUse variable
The Q_WGL define was removed years ago.
Compile
QUUid::createUuid() should not generate identical sequences on UNIX
typos fixed
Use lower case for including system header files
Added trace statements to Phonon MMF backend
Fix crash when removing columns in merged row
MMF Phonon backend: call winId() from VideoWidget constructor
...
Diffstat (limited to 'src')
24 files changed, 316 insertions, 129 deletions
diff --git a/src/corelib/concurrent/qtconcurrentmap.cpp b/src/corelib/concurrent/qtconcurrentmap.cpp index 39a13fb..e74d69c 100644 --- a/src/corelib/concurrent/qtconcurrentmap.cpp +++ b/src/corelib/concurrent/qtconcurrentmap.cpp @@ -70,7 +70,7 @@ \value UnorderedReduce Reduction is done in an arbitrary order. \value OrderedReduce Reduction is done in the order of the original sequence. - \value SequentialReduce Reduction is done sequentally: only one + \value SequentialReduce Reduction is done sequentially: only one thread will enter the reduce function at a time. (Parallel reduction might be supported in a future version of Qt Concurrent.) */ diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 75a51ec..c956b85 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2606,55 +2606,6 @@ void qsrand(uint seed) #endif } -/*! \internal - \relates <QtGlobal> - \since 4.6 - - Seed the PRNG, but only if it has not already been seeded. - - The default seed is a combination of current time, a stack address and a - serial counter (since thread stack addresses are re-used). -*/ -void qsrand() -{ -#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) - SeedStorage *seedStorage = randTLS(); - if (seedStorage) { - SeedStorageType *pseed = seedStorage->localData(); - if (pseed) { - // already seeded - return; - } - seedStorage->setLocalData(pseed = new SeedStorageType); - // start beyond 1 to avoid the sequence reset - static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); - *pseed = QDateTime::currentDateTime().toTime_t() - + quintptr(&pseed) - + serial.fetchAndAddRelaxed(1); -#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) - // for Windows and Symbian the srand function must still be called. - srand(*pseed); -#endif - } - -//QT_NO_THREAD implementations -#else - static unsigned int seed = 0; - - if (seed) - return; - -#if defined(Q_OS_SYMBIAN) - seed = Math::Random(); -#elif defined(Q_OS_WIN) - seed = GetTickCount(); -#else - seed = quintptr(&seed) + QDateTime::currentDateTime().toTime_t(); -#endif - srand(seed); -#endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) -} - /*! \relates <QtGlobal> \since 4.2 diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 9464a97..d83f7ee 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1023,7 +1023,7 @@ QString QFSFileEngine::fileName(FileName file) const #if !defined(QWS) && defined(Q_OS_MAC) QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, QCFString(d->filePath), kCFURLPOSIXPathStyle, true); - if (CFDictionaryRef dict = CFBundleCopyInfoDictionaryForURL(url)) { + if (QCFType<CFDictionaryRef> dict = CFBundleCopyInfoDictionaryForURL(url)) { if (CFTypeRef name = (CFTypeRef)CFDictionaryGetValue(dict, kCFBundleNameKey)) { if (CFGetTypeID(name) == CFStringGetTypeID()) return QCFString::toQString((CFStringRef)name); @@ -1141,7 +1141,7 @@ QString QFSFileEngine::fileName(FileName file) const if (FSResolveAliasFile(&fref, true, &isFolder, &isAlias) == noErr && isAlias) { AliasHandle alias; if (FSNewAlias(0, &fref, &alias) == noErr && alias) { - CFStringRef cfstr; + QCFString cfstr; if (FSCopyAliasInfo(alias, 0, 0, &cfstr, 0, 0) == noErr) return QCFString::toQString(cfstr); } diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 9332bbc..6c1b6e7 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -578,11 +578,10 @@ QUuid QUuid::createUuid() QT_BEGIN_INCLUDE_NAMESPACE #include "qdatetime.h" #include "qfile.h" -#include "stdlib.h" // For srand/rand +#include "qthreadstorage.h" +#include <stdlib.h> // for RAND_MAX QT_END_INCLUDE_NAMESPACE -extern void qsrand(); // in qglobal.cpp - QUuid QUuid::createUuid() { QUuid result; @@ -600,12 +599,32 @@ QUuid QUuid::createUuid() static const int intbits = sizeof(int)*8; static int randbits = 0; if (!randbits) { + int r = 0; int max = RAND_MAX; - do { ++randbits; } while ((max=max>>1)); + do { ++r; } while ((max=max>>1)); + randbits = r; } - // reseed, but only if not already seeded - qsrand(); + // Seed the PRNG once per thread with a combination of current time, a + // stack address and a serial counter (since thread stack addresses are + // re-used). +#ifndef QT_BOOTSTRAPPED + static QThreadStorage<int *> uuidseed; + if (!uuidseed.hasLocalData()) + { + int *pseed = new int; + static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); + qsrand(*pseed = QDateTime::currentDateTime().toTime_t() + + quintptr(&pseed) + + serial.fetchAndAddRelaxed(1)); + uuidseed.setLocalData(pseed); + } +#else + static bool seeded = false; + if (!seeded) + qsrand(QDateTime::currentDateTime().toTime_t() + + quintptr(&seeded)); +#endif int chunks = 16 / sizeof(uint); while (chunks--) { diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 550ff58..4cce339 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -324,12 +324,17 @@ namespace QtSharedPointer { typedef ExternalRefCountData Data; inline void ref() const { d->weakref.ref(); d->strongref.ref(); } - inline bool deref() + inline void deref() + { deref(d, this->value); } + static inline void deref(Data *d, T *value) { + if (!d) return; if (!d->strongref.deref()) { - internalDestroy(); + if (!d->destroy()) + delete value; } - return d->weakref.deref(); + if (!d->weakref.deref()) + delete d; } inline void internalConstruct(T *ptr) @@ -378,7 +383,7 @@ namespace QtSharedPointer { template <class X> inline ExternalRefCount(const ExternalRefCount<X> &other) : Basic<T>(other.value), d(other.d) { if (d) ref(); } - inline ~ExternalRefCount() { if (d && !deref()) delete d; } + inline ~ExternalRefCount() { deref(); } template <class X> inline void internalCopy(const ExternalRefCount<X> &other) @@ -386,12 +391,6 @@ namespace QtSharedPointer { internalSet(other.d, other.data()); } - inline void internalDestroy() - { - if (!d->destroy()) - delete this->value; - } - inline void internalSwap(ExternalRefCount &other) { qSwap(d, other.d); @@ -424,10 +423,14 @@ namespace QtSharedPointer { else o = 0; } - if (d && !deref()) - delete d; - d = o; - this->value = d && d->strongref ? actual : 0; + + qSwap(d, o); + qSwap(this->value, actual); + if (!d || d->strongref == 0) + this->value = 0; + + // dereference saved data + deref(o, actual); } Data *d; diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index b159fa7..5859e63 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -334,6 +334,7 @@ void QFontDialogPrivate::init() familyList->setFocus(); retranslateStrings(); + nativeDialogInUse = false; } /*! diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index fe2a84e..abe4e25 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1269,8 +1269,14 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q Returns the bounding rect of this item's children (excluding itself). */ -void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rect) +void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rect, bool doClip) { + Q_Q(QGraphicsItem); + + QRectF childrenRect; + QRectF *result = rect; + rect = &childrenRect; + for (int i = 0; i < children.size(); ++i) { QGraphicsItem *child = children.at(i); QGraphicsItemPrivate *childd = child->d_ptr.data(); @@ -1292,6 +1298,15 @@ void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rec childd->childrenBoundingRectHelper(x, rect); } } + + if (doClip && (flags & QGraphicsItem::ItemClipsChildrenToShape)){ + if (x) + *rect &= x->mapRect(q->boundingRect()); + else + *rect &= q->boundingRect(); + } + + *result |= *rect; } void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, @@ -11110,8 +11125,14 @@ QRectF QGraphicsItemEffectSourcePrivate::boundingRect(Qt::CoordinateSystem syste } QRectF rect = item->boundingRect(); - if (!item->d_ptr->children.isEmpty()) - rect |= item->childrenBoundingRect(); + if (!item->d_ptr->children.isEmpty()) { + if (dirtyChildrenBoundingRect) { + childrenBoundingRect = QRectF(); + item->d_ptr->childrenBoundingRectHelper(0, &childrenBoundingRect, true); + dirtyChildrenBoundingRect = false; + } + rect |= childrenBoundingRect; + } if (deviceCoordinates) { Q_ASSERT(info->painter); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index f9f5d3d..5b9a710 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -300,7 +300,7 @@ public: QDeclarativeListProperty<QGraphicsObject> childrenList(); void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant, const QVariant *thisPointerVariant); - void childrenBoundingRectHelper(QTransform *x, QRectF *rect); + void childrenBoundingRectHelper(QTransform *x, QRectF *rect, bool doClip = true); void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, const QRegion &exposedRegion, bool allItems = false) const; QRectF effectiveBoundingRect() const; @@ -659,7 +659,7 @@ class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate { public: QGraphicsItemEffectSourcePrivate(QGraphicsItem *i) - : QGraphicsEffectSourcePrivate(), item(i), info(0) + : QGraphicsEffectSourcePrivate(), dirtyChildrenBoundingRect(true), item(i), info(0) {} inline void detach() @@ -710,6 +710,9 @@ public: QGraphicsEffect::PixmapPadMode mode) const; QRect paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded = 0) const; + mutable bool dirtyChildrenBoundingRect; + mutable QRectF childrenBoundingRect; + QGraphicsItem *item; QGraphicsItemPaintInfo *info; QTransform lastEffectTransform; @@ -867,9 +870,12 @@ inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect) #ifndef QT_NO_GRAPHICSEFFECT if (parentp->graphicsEffect) { if (updateBoundingRect) { + QGraphicsItemEffectSourcePrivate *sourcep = + static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func() + ->source->d_func()); + parentp->dirtyChildrenBoundingRect = 1; parentp->notifyInvalidated = 1; - static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func() - ->source->d_func())->invalidateCache(); + sourcep->invalidateCache(); } if (parentp->scene && parentp->graphicsEffect->isEnabled()) { parentp->dirty = 1; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 4cdc4ad..394d374 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -297,6 +297,10 @@ void QCoeFepInputContext::commitTemporaryPreeditString() return; commitCurrentString(false); + + //update cursor position, now this pre-edit text has been committed. + //this prevents next keypress overwriting it (QTBUG-11673) + m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); } void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event) diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index 5100176..ada18c8 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -915,12 +915,13 @@ void QTextTable::removeColumns(int pos, int num) for (int r = 0; r < d->nRows; ++r) { for (int c = pos; c < pos + num; ++c) { int cell = d->grid[r*d->nCols + c]; - if (touchedCells.contains(cell)) - continue; - touchedCells << cell; QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); QTextCharFormat fmt = collection->charFormat(it->format); int span = fmt.tableCellColumnSpan(); + if (touchedCells.contains(cell) && span <= 1) + continue; + touchedCells << cell; + if (span > 1) { fmt.setTableCellColumnSpan(span - 1); p->setCharFormat(it.position(), 1, fmt); diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 1bffde1..d7311ef 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1663,8 +1663,11 @@ void QLineEdit::keyPressEvent(QKeyEvent *event) } #endif d->control->processKeyEvent(event); - if (event->isAccepted()) + if (event->isAccepted()) { + if (layoutDirection() != d->control->layoutDirection()) + setLayoutDirection(d->control->layoutDirection()); d->control->setCursorBlinkPeriod(0); + } } /*! diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp index 96545b4..736630e 100644 --- a/src/multimedia/audio/qaudiodevicefactory.cpp +++ b/src/multimedia/audio/qaudiodevicefactory.cpp @@ -67,7 +67,8 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_LIBRARY + +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QAudioEngineFactoryInterface_iid, QLatin1String("/audio"), Qt::CaseInsensitive)) #endif @@ -138,8 +139,7 @@ QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode) devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode); #endif #endif - -#ifndef QT_NO_LIBRARY +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QFactoryLoader* l = loader(); foreach (QString const& key, l->keys()) { @@ -152,13 +152,12 @@ QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode) delete plugin; } #endif - return devices; } QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() { -#ifndef QT_NO_LIBRARY +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default"))); if (plugin) { @@ -178,7 +177,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() { -#ifndef QT_NO_LIBRARY +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default"))); if (plugin) { @@ -206,15 +205,13 @@ QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &re return new QAudioDeviceInfoInternal(handle, mode); #endif #endif - -#ifndef QT_NO_LIBRARY +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(realm)); if (plugin) rc = plugin->createDeviceInfo(handle, mode); #endif - return rc == 0 ? new QNullDeviceInfo() : rc; } @@ -238,14 +235,13 @@ QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo con return new QAudioInputPrivate(deviceInfo.handle(), format); #endif #endif -#ifndef QT_NO_LIBRARY +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm())); if (plugin) return plugin->createInput(deviceInfo.handle(), format); #endif - return new QNullInputDevice(); } @@ -259,15 +255,13 @@ QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo c return new QAudioOutputPrivate(deviceInfo.handle(), format); #endif #endif - -#ifndef QT_NO_LIBRARY +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm())); if (plugin) return plugin->createOutput(deviceInfo.handle(), format); #endif - return new QNullOutputDevice(); } diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index 36270a7..f663dd2 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -62,6 +62,8 @@ QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode device = QLatin1String(dev); this->mode = mode; + + checkSurround(); } QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() @@ -389,6 +391,9 @@ void QAudioDeviceInfoInternal::updateLists() } channelz.append(1); channelz.append(2); + if (surround40) channelz.append(4); + if (surround51) channelz.append(6); + if (surround71) channelz.append(8); sizez.append(8); sizez.append(16); sizez.append(32); @@ -483,4 +488,45 @@ QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() return devices.first(); } +void QAudioDeviceInfoInternal::checkSurround() +{ + QList<QByteArray> devices; + surround40 = false; + surround51 = false; + surround71 = false; + + void **hints, **n; + char *name, *descr, *io; + + if(snd_device_name_hint(-1, "pcm", &hints) < 0) + return; + + n = hints; + + while (*n != NULL) { + name = snd_device_name_get_hint(*n, "NAME"); + descr = snd_device_name_get_hint(*n, "DESC"); + io = snd_device_name_get_hint(*n, "IOID"); + if((name != NULL) && (descr != NULL)) { + QString deviceName = QLatin1String(name); + if (mode == QAudio::AudioOutput) { + if(deviceName.contains(QLatin1String("surround40"))) + surround40 = true; + if(deviceName.contains(QLatin1String("surround51"))) + surround51 = true; + if(deviceName.contains(QLatin1String("surround71"))) + surround71 = true; + } + } + if(name != NULL) + free(name); + if(descr != NULL) + free(descr); + if(io != NULL) + free(io); + ++n; + } + snd_device_name_free_hint(hints); +} + QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h index 6f9a459..8525980 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h @@ -98,6 +98,11 @@ private: bool open(); void close(); + void checkSurround(); + bool surround40; + bool surround51; + bool surround71; + QString device; QAudio::Mode mode; QAudioFormat nearest; diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index aee0807..9e8b1bf 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -374,6 +374,11 @@ void QAudioDeviceInfoInternal::updateLists() #endif channelz.append(1); channelz.append(2); + if (mode == QAudio::AudioOutput) { + channelz.append(4); + channelz.append(6); + channelz.append(8); + } byteOrderz.append(QAudioFormat::LittleEndian); diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index c9a8b71..58669b3 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -120,7 +120,7 @@ int QAudioInputPrivate::xrun_recovery(int err) if(err < 0) reset = true; else { - bytesAvailable = bytesReady(); + bytesAvailable = checkBytesReady(); if (bytesAvailable <= 0) reset = true; } @@ -408,7 +408,7 @@ bool QAudioInputPrivate::open() snd_pcm_start(handle); // Step 5: Setup timer - bytesAvailable = bytesReady(); + bytesAvailable = checkBytesReady(); if(pullMode) connect(audioSource,SIGNAL(readyRead()),this,SLOT(userFeed())); @@ -437,19 +437,29 @@ void QAudioInputPrivate::close() } } -int QAudioInputPrivate::bytesReady() const +int QAudioInputPrivate::checkBytesReady() { if(resuming) - return period_size; - - if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) - return 0; - int frames = snd_pcm_avail_update(handle); - if (frames < 0) return frames; - if((int)frames > (int)buffer_frames) - frames = buffer_frames; + bytesAvailable = period_size; + else if(deviceState != QAudio::ActiveState + && deviceState != QAudio::IdleState) + bytesAvailable = 0; + else { + int frames = snd_pcm_avail_update(handle); + if (frames < 0) { + bytesAvailable = frames; + } else { + if((int)frames > (int)buffer_frames) + frames = buffer_frames; + bytesAvailable = snd_pcm_frames_to_bytes(handle, frames); + } + } + return bytesAvailable; +} - return snd_pcm_frames_to_bytes(handle, frames); +int QAudioInputPrivate::bytesReady() const +{ + return qMax(bytesAvailable, 0); } qint64 QAudioInputPrivate::read(char* data, qint64 len) @@ -460,12 +470,12 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) if ( !handle ) return 0; - bytesAvailable = bytesReady(); + bytesAvailable = checkBytesReady(); if (bytesAvailable < 0) { // bytesAvailable as negative is error code, try to recover from it. xrun_recovery(bytesAvailable); - bytesAvailable = bytesReady(); + bytesAvailable = checkBytesReady(); if (bytesAvailable < 0) { // recovery failed must stop and set error. close(); @@ -639,11 +649,25 @@ bool QAudioInputPrivate::deviceReady() InputPrivate* a = qobject_cast<InputPrivate*>(audioSource); a->trigger(); } - bytesAvailable = bytesReady(); + bytesAvailable = checkBytesReady(); if(deviceState != QAudio::ActiveState) return true; + if (bytesAvailable < 0) { + // bytesAvailable as negative is error code, try to recover from it. + xrun_recovery(bytesAvailable); + bytesAvailable = checkBytesReady(); + if (bytesAvailable < 0) { + // recovery failed must stop and set error. + close(); + errorState = QAudio::IOError; + deviceState = QAudio::StoppedState; + emit stateChanged(deviceState); + return 0; + } + } + if(intervalTime && (timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { emit notify(); elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h index c907019..52975a6 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/multimedia/audio/qaudioinput_alsa_p.h @@ -110,6 +110,7 @@ private slots: bool deviceReady(); private: + int checkBytesReady(); int xrun_recovery(int err); int setFormat(); bool open(); diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 14a1cf3..ece1c26 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -148,7 +148,7 @@ void QAudioInputPrivate::freeBlocks(WAVEHDR* blockArray) for(int i = 0; i < count; i++) { waveInUnprepareHeader(hWaveIn,blocks, sizeof(WAVEHDR)); - blocks+=sizeof(WAVEHDR); + blocks++; } HeapFree(GetProcessHeap(), 0, blockArray); } diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index a8aeb41..99bada2 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -52,6 +52,53 @@ #include "qaudiooutput_win32_p.h" +#ifndef SPEAKER_FRONT_LEFT + #define SPEAKER_FRONT_LEFT 0x00000001 + #define SPEAKER_FRONT_RIGHT 0x00000002 + #define SPEAKER_FRONT_CENTER 0x00000004 + #define SPEAKER_LOW_FREQUENCY 0x00000008 + #define SPEAKER_BACK_LEFT 0x00000010 + #define SPEAKER_BACK_RIGHT 0x00000020 + #define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040 + #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080 + #define SPEAKER_BACK_CENTER 0x00000100 + #define SPEAKER_SIDE_LEFT 0x00000200 + #define SPEAKER_SIDE_RIGHT 0x00000400 + #define SPEAKER_TOP_CENTER 0x00000800 + #define SPEAKER_TOP_FRONT_LEFT 0x00001000 + #define SPEAKER_TOP_FRONT_CENTER 0x00002000 + #define SPEAKER_TOP_FRONT_RIGHT 0x00004000 + #define SPEAKER_TOP_BACK_LEFT 0x00008000 + #define SPEAKER_TOP_BACK_CENTER 0x00010000 + #define SPEAKER_TOP_BACK_RIGHT 0x00020000 + #define SPEAKER_RESERVED 0x7FFC0000 + #define SPEAKER_ALL 0x80000000 +#endif + +#ifndef _WAVEFORMATEXTENSIBLE_ + + #define _WAVEFORMATEXTENSIBLE_ + typedef struct + { + WAVEFORMATEX Format; // Base WAVEFORMATEX data + union + { + WORD wValidBitsPerSample; // Valid bits in each sample container + WORD wSamplesPerBlock; // Samples per block of audio data; valid + // if wBitsPerSample=0 (but rarely used). + WORD wReserved; // Zero if neither case above applies. + } Samples; + DWORD dwChannelMask; // Positions of the audio channels + GUID SubFormat; // Format identifier GUID + } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE, *LPPWAVEFORMATEXTENSIBLE; + typedef const WAVEFORMATEXTENSIBLE* LPCWAVEFORMATEXTENSIBLE; + +#endif + +#if !defined(WAVE_FORMAT_EXTENSIBLE) +#define WAVE_FORMAT_EXTENSIBLE 0xFFFE +#endif + //#define DEBUG_AUDIO 1 QT_BEGIN_NAMESPACE @@ -146,7 +193,7 @@ void QAudioOutputPrivate::freeBlocks(WAVEHDR* blockArray) for(int i = 0; i < count; i++) { waveOutUnprepareHeader(hWaveOut,blocks, sizeof(WAVEHDR)); - blocks+=sizeof(WAVEHDR); + blocks++; } HeapFree(GetProcessHeap(), 0, blockArray); } @@ -258,15 +305,49 @@ bool QAudioOutputPrivate::open() } } - if(waveOutOpen(&hWaveOut, devId, &wfx, - (DWORD_PTR)&waveOutProc, - (DWORD_PTR) this, - CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { - errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; - emit stateChanged(deviceState); - qWarning("QAudioOutput: open error"); - return false; + if ( settings.channels() <= 2) { + if(waveOutOpen(&hWaveOut, devId, &wfx, + (DWORD_PTR)&waveOutProc, + (DWORD_PTR) this, + CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { + errorState = QAudio::OpenError; + deviceState = QAudio::StoppedState; + emit stateChanged(deviceState); + qWarning("QAudioOutput: open error"); + return false; + } + } else { + WAVEFORMATEXTENSIBLE wfex; + wfex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + wfex.Format.nChannels = settings.channels(); + wfex.Format.wBitsPerSample = settings.sampleSize(); + wfex.Format.nSamplesPerSec = settings.frequency(); + wfex.Format.nBlockAlign = wfex.Format.nChannels*wfex.Format.wBitsPerSample/8; + wfex.Format.nAvgBytesPerSec=wfex.Format.nSamplesPerSec*wfex.Format.nBlockAlign; + wfex.Samples.wValidBitsPerSample=wfex.Format.wBitsPerSample; + static const GUID _KSDATAFORMAT_SUBTYPE_PCM = { + 0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; + wfex.SubFormat=_KSDATAFORMAT_SUBTYPE_PCM; + wfex.Format.cbSize=22; + + wfex.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; + if (settings.channels() >= 4) + wfex.dwChannelMask |= SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT; + if (settings.channels() >= 6) + wfex.dwChannelMask |= SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY; + if (settings.channels() == 8) + wfex.dwChannelMask |= SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT; + + if(waveOutOpen(&hWaveOut, devId, &wfex.Format, + (DWORD_PTR)&waveOutProc, + (DWORD_PTR) this, + CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { + errorState = QAudio::OpenError; + deviceState = QAudio::StoppedState; + emit stateChanged(deviceState); + qWarning("QAudioOutput: open error"); + return false; + } } totalTimeValue = 0; diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 1d794ae..770c168 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -970,8 +970,20 @@ void QSslSocketBackendPrivate::transmit() #endif plainSocket->disconnectFromHost(); break; + case SSL_ERROR_SYSCALL: // some IO error + case SSL_ERROR_SSL: // error in the SSL library + // we do not know exactly what the error is, nor whether we can recover from it, + // so just return to prevent an endless loop in the outer "while" statement + q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR())); + q->setSocketError(QAbstractSocket::UnknownSocketError); + emit q->error(QAbstractSocket::UnknownSocketError); + return; default: - // ### Handle errors better. + // SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT: can only happen with a + // BIO_s_connect() or BIO_s_accept(), which we do not call. + // SSL_ERROR_WANT_X509_LOOKUP: can only happen with a + // SSL_CTX_set_client_cert_cb(), which we do not call. + // So this default case should never be triggered. q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR())); q->setSocketError(QAbstractSocket::UnknownSocketError); emit q->error(QAbstractSocket::UnknownSocketError); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index fc28a73..af016cf 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -3718,7 +3718,7 @@ QGLWidget::~QGLWidget() #endif delete d->glcx; d->glcx = 0; -#if defined(Q_WGL) +#if defined(Q_WS_WIN) delete d->olcx; d->olcx = 0; #endif diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 4992ef5..1d633ed 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -55,6 +55,7 @@ #include <QtGui/private/qfontengine_p.h> #include <QtGui/private/qpainterpath_p.h> #include <QtGui/private/qstatictext_p.h> +#include <QtCore/qmath.h> #include <QDebug> #include <QSet> @@ -1610,7 +1611,10 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) // Try converting the path into a QRegion that tightly follows // the outline of the path we want to clip with. - QRegion region(path.convertToPainterPath().toFillPolygon(QTransform()).toPolygon()); + QRegion region; + if (!path.isEmpty()) + region = QRegion(path.convertToPainterPath().toFillPolygon(QTransform()).toPolygon()); + switch (op) { case Qt::NoClip: { @@ -3427,7 +3431,13 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) // Set the transformation to use for drawing the current glyphs. QTransform glyphTransform(d->pathTransform); - glyphTransform.translate(p.x(), p.y()); + if (d->transform.type() <= QTransform::TxTranslate) { + // Prevent blurriness of unscaled, unrotated text by using integer coordinates. + // Using ceil(x-0.5) instead of qRound() or int-cast, behave like other paint engines. + glyphTransform.translate(ceil(p.x() - 0.5), ceil(p.y() - 0.5)); + } else { + glyphTransform.translate(p.x(), p.y()); + } #if defined(QVG_NO_IMAGE_GLYPHS) glyphTransform.scale(glyphCache->scaleX, glyphCache->scaleY); #endif diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 296901d..1df9b84 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -2645,7 +2645,7 @@ EXPORTS ?childItems@QGraphicsItem@@QBE?AV?$QList@PAVQGraphicsItem@@@@XZ @ 2644 NONAME ; class QList<class QGraphicsItem *> QGraphicsItem::childItems(void) const ?children@QGraphicsItem@@QBE?AV?$QList@PAVQGraphicsItem@@@@XZ @ 2645 NONAME ; class QList<class QGraphicsItem *> QGraphicsItem::children(void) const ?childrenBoundingRect@QGraphicsItem@@QBE?AVQRectF@@XZ @ 2646 NONAME ; class QRectF QGraphicsItem::childrenBoundingRect(void) const - ?childrenBoundingRectHelper@QGraphicsItemPrivate@@QAEXPAVQTransform@@PAVQRectF@@@Z @ 2647 NONAME ; void QGraphicsItemPrivate::childrenBoundingRectHelper(class QTransform *, class QRectF *) + ?childrenBoundingRectHelper@QGraphicsItemPrivate@@QAEXPAVQTransform@@PAVQRectF@@@Z @ 2647 NONAME ABSENT ; void QGraphicsItemPrivate::childrenBoundingRectHelper(class QTransform *, class QRectF *) ?childrenCheckState@QTreeWidgetItem@@ABE?AVQVariant@@H@Z @ 2648 NONAME ; class QVariant QTreeWidgetItem::childrenCheckState(int) const ?childrenClippedToShape@QGraphicsItemPrivate@@QBE_NXZ @ 2649 NONAME ; bool QGraphicsItemPrivate::childrenClippedToShape(void) const ?childrenCollapsible@QSplitter@@QBE_NXZ @ 2650 NONAME ; bool QSplitter::childrenCollapsible(void) const diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 018cba2..580e173 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -4675,7 +4675,7 @@ EXPORTS _ZN20QGraphicsItemPrivate20removeExtraItemCacheEv @ 4674 NONAME _ZN20QGraphicsItemPrivate23appendGraphicsTransformEP18QGraphicsTransform @ 4675 NONAME _ZN20QGraphicsItemPrivate25movableAncestorIsSelectedEPK13QGraphicsItem @ 4676 NONAME - _ZN20QGraphicsItemPrivate26childrenBoundingRectHelperEP10QTransformP6QRectF @ 4677 NONAME + _ZN20QGraphicsItemPrivate26childrenBoundingRectHelperEP10QTransformP6QRectF @ 4677 NONAME ABSENT _ZN20QGraphicsItemPrivate26invalidateDepthRecursivelyEv @ 4678 NONAME _ZN20QGraphicsItemPrivate28ensureSequentialSiblingIndexEv @ 4679 NONAME _ZN20QGraphicsItemPrivate29ensureSceneTransformRecursiveEPP13QGraphicsItem @ 4680 NONAME |