diff options
Diffstat (limited to 'src')
153 files changed, 1689 insertions, 890 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h b/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h index 0d7c2c2..0d631b2 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h @@ -32,10 +32,6 @@ HB_BEGIN_HEADER -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(push, 1) -#endif - typedef struct HB_GlyphItemRec_ { HB_UInt gindex; HB_UInt properties; @@ -93,10 +89,6 @@ hb_buffer_add_glyph( HB_Buffer buffer, HB_UInt properties, HB_UInt cluster ); -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(pop) -#endif - HB_END_HEADER #endif /* HARFBUZZ_BUFFER_H */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h index 2a6d958..94e9b43 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h @@ -33,11 +33,6 @@ HB_BEGIN_HEADER - -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(push, 1) -#endif - /* Attachment related structures */ struct HB_AttachPoint_ @@ -126,10 +121,6 @@ _HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( HB_GDEFHeader* gdef, HB_Lookup* lo, HB_UShort num_lookups ); -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(pop) -#endif - HB_END_HEADER #endif /* HARFBUZZ_GDEF_PRIVATE_H */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h index f9a03dd..ccb6bf9 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h @@ -31,10 +31,6 @@ HB_BEGIN_HEADER -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(push, 1) -#endif - /* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding * flag in the LookupFlag field. */ #define HB_GDEF_BASE_GLYPH 0x0002 @@ -131,10 +127,6 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, HB_UShort* glyph_array, HB_UShort* class_array ); -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(pop) -#endif - HB_END_HEADER #endif /* HARFBUZZ_GDEF_H */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-global.h b/src/3rdparty/harfbuzz/src/harfbuzz-global.h index bccd6a2..d4e6b46 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-global.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-global.h @@ -39,10 +39,6 @@ #define HB_END_HEADER /* nothing */ #endif -#if defined(__GNUC__) || defined(_MSC_VER) -#define HB_USE_PACKED_STRUCTS -#endif - HB_BEGIN_HEADER #ifndef FALSE diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h index 39f3159..63ba907 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h @@ -32,10 +32,6 @@ HB_BEGIN_HEADER -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(push, 1) -#endif - /* shared tables */ #define VR_X_PLACEMENT_DEVICE 0 @@ -720,10 +716,6 @@ HB_INTERNAL void _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st, HB_UShort lookup_type ); -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(pop) -#endif - HB_END_HEADER #endif /* HARFBUZZ_GPOS_PRIVATE_H */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h index 7eb329e..df0c3f6 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h @@ -32,10 +32,6 @@ HB_BEGIN_HEADER -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(push, 1) -#endif - typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable; /* LookupType 1 */ @@ -474,10 +470,6 @@ HB_INTERNAL void _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st, HB_UShort lookup_type ); -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(pop) -#endif - HB_END_HEADER #endif /* HARFBUZZ_GSUB_PRIVATE_H */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h b/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h index b00df44..6e452bd 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h @@ -31,11 +31,6 @@ HB_BEGIN_HEADER - -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(push, 1) -#endif - /* Lookup types for glyph substitution */ #define HB_GSUB_LOOKUP_SINGLE 1 @@ -139,10 +134,6 @@ HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub, HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub, HB_Buffer buffer ); -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(pop) -#endif - HB_END_HEADER #endif /* HARFBUZZ_GSUB_H */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.h b/src/3rdparty/harfbuzz/src/harfbuzz-open.h index 4ba6cf5..9ad7c98 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.h @@ -30,10 +30,6 @@ HB_BEGIN_HEADER -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(push, 1) -#endif - /* Use this if a feature applies to all glyphs */ #define HB_ALL_GLYPHS 0xFFFF @@ -279,10 +275,6 @@ enum HB_Type_ typedef enum HB_Type_ HB_Type; -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(pop) -#endif - HB_END_HEADER #endif /* HARFBUZZ_OPEN_H */ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h index ab5c07a..470e27b 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h @@ -34,10 +34,6 @@ HB_BEGIN_HEADER -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(push, 1) -#endif - /* using anything else than signed or unsigned for bitfields in C is non standard, but accepted by almost all compilers. And it gives a significant reduction in @@ -258,10 +254,6 @@ typedef struct HB_Font_ { void *userData; } HB_FontRec; -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(pop) -#endif - typedef struct HB_ShaperItem_ HB_ShaperItem; struct HB_ShaperItem_ { diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-stream.h b/src/3rdparty/harfbuzz/src/harfbuzz-stream.h index a155cc2..cfbfb1c 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-stream.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-stream.h @@ -30,10 +30,6 @@ HB_BEGIN_HEADER -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(push, 1) -#endif - typedef struct HB_StreamRec_ { HB_Byte* base; @@ -42,10 +38,6 @@ typedef struct HB_StreamRec_ HB_UInt pos; } HB_StreamRec; -#ifdef HB_USE_PACKED_STRUCTS -#pragma pack(pop) -#endif - HB_END_HEADER #endif diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 9b97c8b..5bb3c57 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -1351,26 +1351,30 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) } } - if (!ev->commitString().isEmpty()) + if (renderTextControl && ev->replacementLength() > 0) { + renderTextControl->setSelectionStart(qMax(renderTextControl->selectionStart() + ev->replacementStart(), 0)); + renderTextControl->setSelectionEnd(qMin(renderTextControl->selectionStart() + ev->replacementLength(), static_cast<int>(renderTextControl->text().length()))); + // Commit regardless of whether commitString is empty, to get rid of selection. editor->confirmComposition(ev->commitString()); - else { - // 1. empty preedit with a selection attribute, and start/end of 0 cancels composition - // 2. empty preedit with a selection attribute, and start/end of non-0 updates selection of current preedit text - // 3. populated preedit with a selection attribute, and start/end of 0 or non-0 updates selection of supplied preedit text - // 4. otherwise event is updating supplied pre-edit text - QString preedit = ev->preeditString(); + } else if (!ev->commitString().isEmpty()) { + editor->confirmComposition(ev->commitString()); + } + // 1. empty preedit with a selection attribute, and start/end of 0 cancels composition + // 2. empty preedit with a selection attribute, and start/end of non-0 updates selection of current preedit text + // 3. populated preedit with a selection attribute, and start/end of 0 or non-0 updates selection of supplied preedit text + // 4. otherwise event is updating supplied pre-edit text + QString preedit = ev->preeditString(); #if QT_VERSION >= 0x040600 - if (hasSelection) { - QString text = (renderTextControl) ? QString(renderTextControl->text()) : QString(); - if (preedit.isEmpty() && selection.start + selection.length > 0) - preedit = text; - editor->setComposition(preedit, underlines, - (selection.length < 0) ? selection.start + selection.length : selection.start, - (selection.length < 0) ? selection.start : selection.start + selection.length); - } else + if (hasSelection) { + QString text = (renderTextControl) ? QString(renderTextControl->text()) : QString(); + if (preedit.isEmpty() && selection.start + selection.length > 0) + preedit = text; + editor->setComposition(preedit, underlines, + (selection.length < 0) ? selection.start + selection.length : selection.start, + (selection.length < 0) ? selection.start : selection.start + selection.length); + } else #endif - editor->setComposition(preedit, underlines, preedit.length(), 0); - } + editor->setComposition(preedit, underlines, preedit.length(), 0); ev->accept(); } diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp index e4f70de..7a8aae7 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -141,6 +141,16 @@ void GraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* event) QGraphicsWebView::mouseMoveEvent(event); } +bool GraphicsWebView::sceneEvent(QEvent *event) +{ + bool rv = QGraphicsWebView::sceneEvent(event); + if (event->type() == QEvent::UngrabMouse) { + pressTimer.stop(); + parent->setKeepMouseGrab(false); + } + return rv; +} + /*! \qmlclass WebView QDeclarativeWebView \ingroup qml-view-elements diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h index b2055bf..ca15a1e 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h @@ -70,6 +70,8 @@ protected: void mouseMoveEvent(QGraphicsSceneMouseEvent* event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void timerEvent(QTimerEvent* event); + bool sceneEvent(QEvent *event); + Q_SIGNALS: void doubleClick(int clickX, int clickY); private: diff --git a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri index f2282f8..b98617f 100644 --- a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri +++ b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri @@ -1,5 +1,5 @@ -QT_WEBKIT_VERSION = 4.7.1 +QT_WEBKIT_VERSION = 4.7.2 QT_WEBKIT_MAJOR_VERSION = 4 QT_WEBKIT_MINOR_VERSION = 7 -QT_WEBKIT_PATCH_VERSION = 1 +QT_WEBKIT_PATCH_VERSION = 2 QT_CONFIG += webkit 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 b7ffb8a..31cf277 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1502,6 +1502,20 @@ void tst_QWebPage::inputMethods() QCOMPARE(value, QString("QtWebKit")); #endif + { + QList<QInputMethodEvent::Attribute> attributes; + QInputMethodEvent event(QString(), attributes); + event.setCommitString("XXX", 0, 0); + page->event(&event); + event.setCommitString(QString(), -2, 2); // Erase two characters. + page->event(&event); + event.setCommitString(QString(), -1, 1); // Erase one character. + page->event(&event); + variant = page->inputMethodQuery(Qt::ImSurroundingText); + value = variant.value<QString>(); + QCOMPARE(value, QString("QtWebKit")); + } + // Cancel current composition first inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant()); QInputMethodEvent eventSelection4("", inputAttributes); diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 349b3d4..e946d5d 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -44,10 +44,3 @@ symbian: { MMP_RULES -= PAGED MMP_RULES *= UNPAGED } - -neon { - DEFINES += QT_HAVE_NEON - QMAKE_CXXFLAGS *= -mfpu=neon -} - - diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 47b82ef..8eae391 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -31,3 +31,5 @@ linux*:!static:!symbian-armcc:!symbian-gcce { # Compensate for lack of platform defines in Symbian3 and Symbian4 symbian: DEFINES += SYMBIAN_VERSION_$$upper($$replace(SYMBIAN_VERSION,\\.,_)) + +include(../../../tools/shared/symbian/epocroot.pri) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index d493390..8b2ab5a 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -62,6 +62,10 @@ QT_END_NAMESPACE # include "private/qcore_mac_p.h" #endif +#ifdef QLIBRARYINFO_EPOCROOT +# include "symbian/epocroot_p.h" +#endif + #include "qconfig.cpp" QT_BEGIN_NAMESPACE @@ -433,6 +437,14 @@ QLibraryInfo::location(LibraryLocation loc) QString::fromLocal8Bit(qgetenv(ret.mid(rep + 2, reg_var.matchedLength() - 3).toLatin1().constData()).constData())); } + +#ifdef QLIBRARYINFO_EPOCROOT + // $${EPOCROOT} is a special case, resolve it similarly to qmake. + QRegExp epocrootMatcher(QLatin1String("\\$\\$\\{EPOCROOT\\}")); + if ((rep = epocrootMatcher.indexIn(ret)) != -1) + ret.replace(rep, epocrootMatcher.matchedLength(), qt_epocRoot()); +#endif + config->endGroup(); } } diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 3ed6291..6afc9a2 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -519,6 +519,8 @@ public: WA_X11DoNotAcceptFocus = 132, + WA_MacNoShadow = 133, + // Add new attributes before this line WA_AttributeCount }; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index f097f2a..b9939b6 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1257,6 +1257,9 @@ to this top level window. This attribute has no effect on non-X11 platforms. + \value WA_MacNoShadow Since Qt 4.8, this attribute disables drop shadows + for this top level window. Only affects Cocoa builds of Qt for Mac OS X. + \omitvalue WA_SetLayoutDirection \omitvalue WA_InputMethodTransparent \omitvalue WA_WState_CompressKeys diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 18c3c9f..4d0d495 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -198,7 +198,7 @@ QStringList QPollingFileSystemWatcherEngine::removePaths(const QStringList &path void QPollingFileSystemWatcherEngine::stop() { - QMetaObject::invokeMethod(this, "quit"); + quit(); } void QPollingFileSystemWatcherEngine::timeout() @@ -228,8 +228,14 @@ void QPollingFileSystemWatcherEngine::timeout() dit.remove(); emit directoryChanged(path, true); } else if (x.value() != fi) { - x.value() = fi; - emit directoryChanged(path, false); + fi.refresh(); + if (!fi.exists()) { + dit.remove(); + emit directoryChanged(path, true); + } else { + x.value() = fi; + emit directoryChanged(path, false); + } } } @@ -426,11 +432,6 @@ QFileSystemWatcher::QFileSystemWatcher(const QStringList &paths, QObject *parent /*! Destroys the file system watcher. - - \note To avoid deadlocks on shutdown, all instances of QFileSystemWatcher - need to be destroyed before QCoreApplication. Note that passing - QCoreApplication::instance() as the parent object when creating - QFileSystemWatcher is not sufficient. */ QFileSystemWatcher::~QFileSystemWatcher() { diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index dc18ae7..ab53431 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -340,7 +340,7 @@ QStringList QInotifyFileSystemWatcherEngine::removePaths(const QStringList &path void QInotifyFileSystemWatcherEngine::stop() { - QMetaObject::invokeMethod(this, "quit"); + quit(); } void QInotifyFileSystemWatcherEngine::readFromInotify() @@ -356,7 +356,7 @@ void QInotifyFileSystemWatcherEngine::readFromInotify() char *at = buffer.data(); char * const end = at + buffSize; - QMap<int, inotify_event *> eventForId; + QHash<int, inotify_event *> eventForId; while (at < end) { inotify_event *event = reinterpret_cast<inotify_event *>(at); @@ -368,7 +368,7 @@ void QInotifyFileSystemWatcherEngine::readFromInotify() at += sizeof(inotify_event) + event->len; } - QMap<int, inotify_event *>::const_iterator it = eventForId.constBegin(); + QHash<int, inotify_event *>::const_iterator it = eventForId.constBegin(); while (it != eventForId.constEnd()) { const inotify_event &event = **it; ++it; diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 7960792..68994d2 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -119,67 +119,77 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths, QStringList *files, QStringList *directories) { - QMutexLocker locker(&mutex); - QStringList p = paths; - QMutableListIterator<QString> it(p); - while (it.hasNext()) { - QString path = it.next(); - int fd; + { + QMutexLocker locker(&mutex); + + QMutableListIterator<QString> it(p); + while (it.hasNext()) { + QString path = it.next(); + int fd; #if defined(O_EVTONLY) - fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY); + fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY); #else - fd = qt_safe_open(QFile::encodeName(path), O_RDONLY); + fd = qt_safe_open(QFile::encodeName(path), O_RDONLY); #endif - if (fd == -1) { - perror("QKqueueFileSystemWatcherEngine::addPaths: open"); - continue; - } + if (fd == -1) { + perror("QKqueueFileSystemWatcherEngine::addPaths: open"); + continue; + } + if (fd >= (int)FD_SETSIZE / 2 && fd < (int)FD_SETSIZE) { + int fddup = fcntl(fd, F_DUPFD, FD_SETSIZE); + if (fddup != -1) { + ::close(fd); + fd = fddup; + } + } + fcntl(fd, F_SETFD, FD_CLOEXEC); - QT_STATBUF st; - if (QT_FSTAT(fd, &st) == -1) { - perror("QKqueueFileSystemWatcherEngine::addPaths: fstat"); - ::close(fd); - continue; - } - int id = (S_ISDIR(st.st_mode)) ? -fd : fd; - if (id < 0) { - if (directories->contains(path)) { + QT_STATBUF st; + if (QT_FSTAT(fd, &st) == -1) { + perror("QKqueueFileSystemWatcherEngine::addPaths: fstat"); ::close(fd); continue; } - } else { - if (files->contains(path)) { + int id = (S_ISDIR(st.st_mode)) ? -fd : fd; + if (id < 0) { + if (directories->contains(path)) { + ::close(fd); + continue; + } + } else { + if (files->contains(path)) { + ::close(fd); + continue; + } + } + + struct kevent kev; + EV_SET(&kev, + fd, + EVFILT_VNODE, + EV_ADD | EV_ENABLE | EV_CLEAR, + NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, + 0, + 0); + if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { + perror("QKqueueFileSystemWatcherEngine::addPaths: kevent"); ::close(fd); continue; } - } - struct kevent kev; - EV_SET(&kev, - fd, - EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_ONESHOT, - NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, - 0, - 0); - if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { - perror("QKqueueFileSystemWatcherEngine::addPaths: kevent"); - ::close(fd); - continue; - } + it.remove(); + if (id < 0) { + DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path; + directories->append(path); + } else { + DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path; + files->append(path); + } - it.remove(); - if (id < 0) { - DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path; - directories->append(path); - } else { - DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path; - files->append(path); + pathToID.insert(path, id); + idToPath.insert(id, path); } - - pathToID.insert(path, id); - idToPath.insert(id, path); } if (!isRunning()) @@ -194,43 +204,35 @@ QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths QStringList *files, QStringList *directories) { - QMutexLocker locker(&mutex); - + bool isEmpty; QStringList p = paths; - QMutableListIterator<QString> it(p); - while (it.hasNext()) { - QString path = it.next(); - int id = pathToID.take(path); - QString x = idToPath.take(id); - if (x.isEmpty() || x != path) - continue; - - int fd = id < 0 ? -id : id; - struct kevent kev; - EV_SET(&kev, - fd, - EVFILT_VNODE, - EV_DELETE, - NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, - 0, - 0); - if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { - perror("QKqueueFileSystemWatcherEngine::removeWatch: kevent"); - } - ::close(fd); + { + QMutexLocker locker(&mutex); + if (pathToID.isEmpty()) + return p; + + QMutableListIterator<QString> it(p); + while (it.hasNext()) { + QString path = it.next(); + int id = pathToID.take(path); + QString x = idToPath.take(id); + if (x.isEmpty() || x != path) + continue; - it.remove(); - if (id < 0) - directories->removeAll(path); - else - files->removeAll(path); + ::close(id < 0 ? -id : id); + + it.remove(); + if (id < 0) + directories->removeAll(path); + else + files->removeAll(path); + } + isEmpty = pathToID.isEmpty(); } - if (pathToID.isEmpty()) { + if (isEmpty) { stop(); - locker.unlock(); wait(); - locker.relock(); } else { write(kqpipe[1], "@", 1); } @@ -245,19 +247,15 @@ void QKqueueFileSystemWatcherEngine::stop() void QKqueueFileSystemWatcherEngine::run() { - static const struct timespec ZeroTimeout = { 0, 0 }; - forever { + int r; struct kevent kev; DEBUG() << "QKqueueFileSystemWatcherEngine: waiting for kevents..."; - int r = kevent(kqfd, 0, 0, &kev, 1, 0); + EINTR_LOOP(r, kevent(kqfd, 0, 0, &kev, 1, 0)); if (r < 0) { perror("QKqueueFileSystemWatcherEngine: error during kevent wait"); return; - } - - QMutexLocker locker(&mutex); - do { + } else { int fd = kev.ident; DEBUG() << "QKqueueFileSystemWatcherEngine: processing kevent" << kev.ident << kev.filter; @@ -289,6 +287,8 @@ void QKqueueFileSystemWatcherEngine::run() break; } } else { + QMutexLocker locker(&mutex); + int id = fd; QString path = idToPath.value(id); if (path.isEmpty()) { @@ -297,12 +297,12 @@ void QKqueueFileSystemWatcherEngine::run() path = idToPath.value(id); if (path.isEmpty()) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent for a file we're not watching"; - goto process_next_event; + continue; } } if (kev.filter != EVFILT_VNODE) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent with the wrong filter"; - goto process_next_event; + continue; } if ((kev.fflags & (NOTE_DELETE | NOTE_REVOKE | NOTE_RENAME)) != 0) { @@ -317,31 +317,15 @@ void QKqueueFileSystemWatcherEngine::run() else emit fileChanged(path, true); } else { - DEBUG() << path << "changed, re-enabling watch"; + DEBUG() << path << "changed"; if (id < 0) emit directoryChanged(path, false); else emit fileChanged(path, false); - - // renable the watch - EV_SET(&kev, - fd, - EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_ONESHOT, - NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, - 0, - 0); - if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { - perror("QKqueueFileSystemWatcherEngine::processKqueueEvents: kevent EV_ADD"); - } } } - - // are there any more? -process_next_event: - r = kevent(kqfd, 0, 0, &kev, 1, &ZeroTimeout); - } while (r > 0); + } } } diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp index 6136742..ee66c36 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian.cpp +++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp @@ -215,7 +215,7 @@ void QSymbianFileSystemWatcherEngine::emitPathChanged(QNotifyChangeEvent *e) void QSymbianFileSystemWatcherEngine::stop() { - QMetaObject::invokeMethod(this, "quit"); + quit(); wait(); } diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 8544fba..f8eb886 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -395,7 +395,10 @@ QIODevice::QIODevice(QIODevicePrivate &dd, QObject *parent) /*! - Destructs the QIODevice object. + The destructor is virtual, and QIODevice is an abstract base + class. This destructor does not call close(), but the subclass + destructor might. If you are in doubt, call close() before + destroying the QIODevice. */ QIODevice::~QIODevice() { diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index aa7e32f..91c20b5 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -86,7 +86,8 @@ extern uint qGlobalPostedEventsCount(); enum { WM_QT_SOCKETNOTIFIER = WM_USER, - WM_QT_SENDPOSTEDEVENTS = WM_USER + 1 + WM_QT_SENDPOSTEDEVENTS = WM_USER + 1, + SendPostedEventsWindowsTimerId = ~1u }; #if defined(Q_OS_WINCE) @@ -355,7 +356,7 @@ public: // for controlling when to send posted events QAtomicInt serialNumber; - int lastSerialNumber; + int lastSerialNumber, sendPostedEventsWindowsTimerId; QAtomicInt wakeUps; // timers @@ -380,7 +381,7 @@ public: QEventDispatcherWin32Private::QEventDispatcherWin32Private() : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), - serialNumber(0), lastSerialNumber(0), wakeUps(0) + serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0), wakeUps(0) { resolveTimerAPI(); } @@ -487,17 +488,21 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA } } return 0; - } else if (message == WM_TIMER) { - Q_ASSERT(d != 0); - d->sendTimerEvent(wp); - return 0; - } else if (message == WM_QT_SENDPOSTEDEVENTS) { + } else if (message == WM_QT_SENDPOSTEDEVENTS + // we also use a Windows timer to send posted events when the message queue is full + || (message == WM_TIMER + && d->sendPostedEventsWindowsTimerId != 0 + && wp == d->sendPostedEventsWindowsTimerId)) { int localSerialNumber = d->serialNumber; if (localSerialNumber != d->lastSerialNumber) { d->lastSerialNumber = localSerialNumber; QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); } return 0; + } else if (message == WM_TIMER) { + Q_ASSERT(d != 0); + d->sendTimerEvent(wp); + return 0; } return DefWindowProc(hwnd, message, wp, lp); @@ -509,21 +514,36 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) QEventDispatcherWin32 *q = qobject_cast<QEventDispatcherWin32 *>(QAbstractEventDispatcher::instance()); Q_ASSERT(q != 0); if (q) { + MSG *msg = (MSG *) lp; QEventDispatcherWin32Private *d = q->d_func(); int localSerialNumber = d->serialNumber; - MSG unused; - if ((HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT)) == 0 - && PeekMessage(&unused, 0, WM_TIMER, WM_TIMER, PM_NOREMOVE) == 0)) { - // no more input or timer events in the message queue or more than 10ms has elapsed since - // we send posted events, we can allow posted events to be sent now + if (HIWORD(GetQueueStatus(QS_TIMER | QS_INPUT | QS_RAWINPUT)) == 0) { + // no more input or timer events in the message queue, we can allow posted events to be sent normally now + if (d->sendPostedEventsWindowsTimerId != 0) { + // stop the timer to send posted events, since we now allow the WM_QT_SENDPOSTEDEVENTS message + KillTimer(d->internalHwnd, d->sendPostedEventsWindowsTimerId); + d->sendPostedEventsWindowsTimerId = 0; + } (void) d->wakeUps.fetchAndStoreRelease(0); - MSG *msg = (MSG *) lp; if (localSerialNumber != d->lastSerialNumber // if this message IS the one that triggers sendPostedEvents(), no need to post it again && (msg->hwnd != d->internalHwnd || msg->message != WM_QT_SENDPOSTEDEVENTS)) { PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); } + } else if (d->sendPostedEventsWindowsTimerId == 0 + && localSerialNumber != d->lastSerialNumber + // if this message IS the one that triggers sendPostedEvents(), no need to post it again + && (msg->hwnd != d->internalHwnd + || msg->message != WM_QT_SENDPOSTEDEVENTS)) { + // start a special timer to continue delivering posted events while + // there are still input and timer messages in the message queue + d->sendPostedEventsWindowsTimerId = SetTimer(d->internalHwnd, + SendPostedEventsWindowsTimerId, + 0, // we specify zero, but Windows uses USER_TIMER_MINIMUM + NULL); + // we don't check the return value of SetTimer()... if creating the timer failed, there's little + // we can do. we just have to accept that posted events will be starved } } } diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index db46ba5..b4e4aa5 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -215,11 +215,15 @@ Q_CORE_EXPORT const char *qFlagLocation(const char *method); #define QTOSTRING(s) QTOSTRING_HELPER(s) #ifndef QT_NO_DEBUG # define QLOCATION "\0"__FILE__":"QTOSTRING(__LINE__) -# define METHOD(a) qFlagLocation("0"#a QLOCATION) +# ifndef QT_NO_KEYWORDS +# define METHOD(a) qFlagLocation("0"#a QLOCATION) +# endif # define SLOT(a) qFlagLocation("1"#a QLOCATION) # define SIGNAL(a) qFlagLocation("2"#a QLOCATION) #else -# define METHOD(a) "0"#a +# ifndef QT_NO_KEYWORDS +# define METHOD(a) "0"#a +# endif # define SLOT(a) "1"#a # define SIGNAL(a) "2"#a #endif diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp index 78556c3..da76b74 100644 --- a/src/corelib/kernel/qtcore_eval.cpp +++ b/src/corelib/kernel/qtcore_eval.cpp @@ -90,14 +90,14 @@ static const char will_shutdown_now[] = static int qt_eval_is_supported() { - const char *const license_key = qt_eval_key_data + 12; + const volatile char *const license_key = qt_eval_key_data + 12; // fast fail if (!qt_eval_key_data[0] || !*license_key) return -1; // is this an unsupported evaluation? - const char* typecode = license_key; + const volatile char *typecode = license_key; int field = 2; for ( ; field && *typecode; ++typecode) if (*typecode == '-') diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 69b70cb..c9ff8d3 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -173,7 +173,8 @@ void QAdoptedThread::run() */ QThreadPrivate::QThreadPrivate(QThreadData *d) - : QObjectPrivate(), running(false), finished(false), terminated(false), exited(false), returnCode(-1), + : QObjectPrivate(), running(false), finished(false), terminated(false), + isInFinish(false), exited(false), returnCode(-1), stackSize(0), priority(QThread::InheritPriority), data(d) { #if defined (Q_OS_UNIX) @@ -403,6 +404,11 @@ QThread::~QThread() Q_D(QThread); { QMutexLocker locker(&d->mutex); + if (d->isInFinish) { + locker.unlock(); + wait(); + locker.relock(); + } if (d->running && !d->finished) qWarning("QThread: Destroyed while thread is still running"); @@ -482,8 +488,10 @@ int QThread::exec() Q_D(QThread); QMutexLocker locker(&d->mutex); d->data->quitNow = false; - if (d->exited) + if (d->exited) { + d->exited = false; return d->returnCode; + } locker.unlock(); QEventLoop eventLoop; diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index d816aef..51c6991 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -126,6 +126,7 @@ public: bool running; bool finished; bool terminated; + bool isInFinish; //when in QThreadPrivate::finish bool exited; int returnCode; diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index f508c0a..0892d8e 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -99,6 +99,11 @@ # define SCHED_IDLE 5 #endif +#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) +#define QT_HAS_THREAD_PRIORITY_SCHEDULING +#endif + + QT_BEGIN_NAMESPACE #ifndef QT_NO_THREAD @@ -140,6 +145,7 @@ static void create_current_thread_data_key() static void destroy_current_thread_data_key() { + pthread_once(¤t_thread_data_once, create_current_thread_data_key); pthread_key_delete(current_thread_data_key); } Q_DESTRUCTOR_FUNCTION(destroy_current_thread_data_key) @@ -333,40 +339,45 @@ void QThreadPrivate::finish(void *arg) { QThread *thr = reinterpret_cast<QThread *>(arg); QThreadPrivate *d = thr->d_func(); + #ifdef Q_OS_SYMBIAN - if (lockAnyway) + QMutexLocker locker(lockAnyway ? &d->mutex : 0); +#else + QMutexLocker locker(&d->mutex); #endif - d->mutex.lock(); + d->isInFinish = true; d->priority = QThread::InheritPriority; - d->running = false; - d->finished = true; - if (d->terminated) + bool terminated = d->terminated; + void *data = &d->data->tls; + locker.unlock(); + if (terminated) emit thr->terminated(); - d->terminated = false; emit thr->finished(); QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QThreadStorageData::finish((void **)data); + locker.relock(); + d->terminated = false; - if (d->data->eventDispatcher) { - d->data->eventDispatcher->closingDown(); - QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher; + QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher; + if (eventDispatcher) { d->data->eventDispatcher = 0; + locker.unlock(); + eventDispatcher->closingDown(); delete eventDispatcher; + locker.relock(); } - void *data = &d->data->tls; - QThreadStorageData::finish((void **)data); - d->thread_id = 0; #ifdef Q_OS_SYMBIAN if (closeNativeHandle) d->data->symbian_thread_handle.Close(); #endif + d->running = false; + d->finished = true; + + d->isInFinish = false; d->thread_done.wakeAll(); -#ifdef Q_OS_SYMBIAN - if (lockAnyway) -#endif - d->mutex.unlock(); } @@ -506,10 +517,10 @@ void QThread::usleep(unsigned long usecs) thread_sleep(&ti); } +#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING // Does some magic and calculate the Unix scheduler priorities // sched_policy is IN/OUT: it must be set to a valid policy before calling this function // sched_priority is OUT only -#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_priority) { #ifdef SCHED_IDLE @@ -543,6 +554,10 @@ void QThread::start(Priority priority) { Q_D(QThread); QMutexLocker locker(&d->mutex); + + if (d->isInFinish) + d->thread_done.wait(locker.mutex()); + if (d->running) return; @@ -558,7 +573,7 @@ void QThread::start(Priority priority) d->priority = priority; -#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && !defined(Q_OS_SYMBIAN) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) +#if defined(QT_HAS_THREAD_PRIORITY_SCHEDULING) && !defined(Q_OS_SYMBIAN) // ### Need to implement thread sheduling and priorities for symbian os. Implementation removed for now switch (priority) { case InheritPriority: @@ -599,7 +614,7 @@ void QThread::start(Priority priority) break; } } -#endif // _POSIX_THREAD_PRIORITY_SCHEDULING +#endif // QT_HAS_THREAD_PRIORITY_SCHEDULING #ifdef Q_OS_SYMBIAN if (d->stackSize == 0) @@ -762,7 +777,7 @@ void QThread::setPriority(Priority priority) // copied from start() with a few modifications: -#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) +#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING int sched_policy; sched_param param; diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 4a967ed..74fedd3 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -323,25 +323,33 @@ void QThreadPrivate::finish(void *arg, bool lockAnyway) QThread *thr = reinterpret_cast<QThread *>(arg); QThreadPrivate *d = thr->d_func(); - if (lockAnyway) - d->mutex.lock(); + QMutexLocker locker(lockAnyway ? &d->mutex : 0); + d->isInFinish = true; d->priority = QThread::InheritPriority; - d->running = false; - d->finished = true; - if (d->terminated) + bool terminated = d->terminated; + void **tls_data = reinterpret_cast<void **>(&d->data->tls); + locker.unlock(); + if (terminated) emit thr->terminated(); - d->terminated = false; emit thr->finished(); QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QThreadStorageData::finish(tls_data); + locker.relock(); + + d->terminated = false; - if (d->data->eventDispatcher) { - d->data->eventDispatcher->closingDown(); - QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher; + QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher; + if (eventDispatcher) { d->data->eventDispatcher = 0; + locker.unlock(); + eventDispatcher->closingDown(); delete eventDispatcher; + locker.relock(); } - QThreadStorageData::finish(reinterpret_cast<void **>(&d->data->tls)); + d->running = false; + d->finished = true; + d->isInFinish = false; if (!d->waiters) { CloseHandle(d->handle); @@ -350,8 +358,6 @@ void QThreadPrivate::finish(void *arg, bool lockAnyway) d->id = 0; - if (lockAnyway) - d->mutex.unlock(); } /************************************************************************** @@ -400,6 +406,12 @@ void QThread::start(Priority priority) Q_D(QThread); QMutexLocker locker(&d->mutex); + if (d->isInFinish) { + locker.unlock(); + wait(); + locker.relock(); + } + if (d->running) return; diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp index 2fc04f5..416fcfb 100644 --- a/src/corelib/thread/qthreadstorage.cpp +++ b/src/corelib/thread/qthreadstorage.cpp @@ -178,11 +178,12 @@ void QThreadStorageData::finish(void **p) return; // nothing to do DEBUG_MSG("QThreadStorageData: Destroying storage for thread %p", QThread::currentThread()); - - for(int i = tls->size() - 1; i >= 0; i--) { - void *&value = (*tls)[i]; + while (!tls->isEmpty()) { + void *&value = tls->last(); void *q = value; value = 0; + int i = tls->size() - 1; + tls->resize(i); if (!q) { // data already deleted @@ -200,6 +201,11 @@ void QThreadStorageData::finish(void **p) continue; } destructor(q); //crash here might mean the thread exited after qthreadstorage was destroyed + + if (tls->size() > i) { + //re reset the tls in case it has been recreated by its own destructor. + (*tls)[i] = 0; + } } tls->clear(); } @@ -215,19 +221,18 @@ void QThreadStorageData::finish(void **p) QThreadStorage is a template class that provides per-thread data storage. - \e{Note that due to compiler limitations, QThreadStorage can only - store pointers.} - The setLocalData() function stores a single thread-specific value for the calling thread. The data can be accessed later using - localData(). QThreadStorage takes ownership of the data (which - must be created on the heap with \c new) and deletes it when the - thread exits, either normally or via termination. + localData(). The hasLocalData() function allows the programmer to determine if data has previously been set using the setLocalData() function. This is also useful for lazy initializiation. + If T is a pointer type, QThreadStorage takes ownership of the data + (which must be created on the heap with \c new) and deletes it when + the thread exits, either normally or via termination. + For example, the following code uses QThreadStorage to store a single cache for each thread that calls the cacheObject() and removeFromCache() functions. The cache is automatically @@ -241,9 +246,6 @@ void QThreadStorageData::finish(void **p) \list - \o As noted above, QThreadStorage can only store pointers due to - compiler limitations. - \o The QThreadStorage destructor does not delete per-thread data. QThreadStorage only deletes per-thread data when the thread exits or when setLocalData() is called multiple times. @@ -279,8 +281,11 @@ void QThreadStorageData::finish(void **p) /*! \fn bool QThreadStorage::hasLocalData() const - Returns true if the calling thread has non-zero data available; - otherwise returns false. + If T is a pointer type, returns true if the calling thread has + non-zero data available. + + If T is a value type, returns whether the data has already been + constructed by calling setLocalData or localData. \sa localData() */ @@ -291,10 +296,8 @@ void QThreadStorageData::finish(void **p) Returns a reference to the data that was set by the calling thread. - Note: QThreadStorage can only store pointers. This function - returns a reference to the pointer that was set by the calling - thread. The value of this reference is 0 if no data was set by - the calling thread, + If no data has been set, this will create a default constructed + instance of type T. \sa hasLocalData() */ @@ -305,10 +308,6 @@ void QThreadStorageData::finish(void **p) Returns a copy of the data that was set by the calling thread. - Note: QThreadStorage can only store pointers. This function - returns a pointer to the data that was set by the calling thread. - If no data was set by the calling thread, this function returns 0. - \sa hasLocalData() */ @@ -318,19 +317,9 @@ void QThreadStorageData::finish(void **p) Sets the local data for the calling thread to \a data. It can be accessed later using the localData() functions. - If \a data is 0, this function deletes the previous data (if - any) and returns immediately. - - If \a data is non-zero, QThreadStorage takes ownership of the \a - data and deletes it automatically either when the thread exits - (either normally or via termination) or when setLocalData() is - called again. - - Note: QThreadStorage can only store pointers. The \a data - argument must be either a pointer to an object created on the heap - (i.e. using \c new) or 0. You should not delete \a data - yourself; QThreadStorage takes ownership and will delete the \a - data itself. + If T is a pointer type, QThreadStorage takes ownership of the data + and deletes it automatically either when the thread exits (either + normally or via termination) or when setLocalData() is called again. \sa localData(), hasLocalData() */ diff --git a/src/corelib/thread/qthreadstorage.h b/src/corelib/thread/qthreadstorage.h index 6264674..475d20d 100644 --- a/src/corelib/thread/qthreadstorage.h +++ b/src/corelib/thread/qthreadstorage.h @@ -91,6 +91,11 @@ inline void qThreadStorage_setLocalData(QThreadStorageData &d, T **t) { (void) d.set(*t); } +template <typename T> +inline +void qThreadStorage_deleteData(void *d, T **) +{ delete static_cast<T *>(d); } + // value-based specialization template <typename T> inline @@ -114,6 +119,12 @@ inline void qThreadStorage_setLocalData(QThreadStorageData &d, T *t) { (void) d.set(new T(*t)); } +template <typename T> +inline +void qThreadStorage_deleteData(void *d, T *) +{ delete static_cast<T *>(d); } + + // MOC_SKIP_END #endif @@ -126,7 +137,7 @@ private: Q_DISABLE_COPY(QThreadStorage) static inline void deleteData(void *x) - { delete static_cast<T>(x); } + { qThreadStorage_deleteData(x, reinterpret_cast<T*>(0)); } public: inline QThreadStorage() : d(deleteData) { } diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index bb777cd..fba0bd2 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -48,11 +48,11 @@ # undef QT_NO_CAST_TO_ASCII #endif #include "qchar.h" + #include "qdatastream.h" #include "qtextcodec.h" #include "qunicodetables_p.h" - #include "qunicodetables.cpp" QT_BEGIN_NAMESPACE @@ -1489,6 +1489,16 @@ static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion } +struct UCS2Pair { + ushort u1; + ushort u2; +}; + +inline bool operator<(ushort u1, const UCS2Pair &ligature) +{ return u1 < ligature.u1; } +inline bool operator<(const UCS2Pair &ligature, ushort u1) +{ return ligature.u1 < u1; } + static ushort ligatureHelper(ushort u1, ushort u2) { // hangul L-V pair @@ -1511,12 +1521,14 @@ static ushort ligatureHelper(ushort u1, ushort u2) if (index == 0xffff) return 0; const unsigned short *ligatures = uc_ligature_map+index; - ushort length = *ligatures; - ++ligatures; - // ### use bsearch - for (uint i = 0; i < length; ++i) - if (ligatures[2*i] == u1) - return ligatures[2*i+1]; + ushort length = *ligatures++; + { + const UCS2Pair *data = reinterpret_cast<const UCS2Pair *>(ligatures); + const UCS2Pair *r = qBinaryFind(data, data + length, u1); + if (r != data + length) + return r->u2; + } + return 0; } diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 2fb3616..83d6dcd 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -77,7 +77,7 @@ QT_END_NAMESPACE #include <qdebug.h> #include <time.h> -#if defined(Q_OS_LINUX) && !defined(__UCLIBC__) +#if defined(__GLIBC__) && !defined(__UCLIBC__) # include <fenv.h> #endif @@ -6637,7 +6637,7 @@ Q_CORE_EXPORT char *qdtoa ( double d, int mode, int ndigits, int *decpt, int *si _control87(MCW_EM, MCW_EM); #endif -#if defined(Q_OS_LINUX) && !defined(__UCLIBC__) +#if defined(__GLIBC__) && !defined(__UCLIBC__) fenv_t envp; feholdexcept(&envp); #endif @@ -6653,7 +6653,7 @@ Q_CORE_EXPORT char *qdtoa ( double d, int mode, int ndigits, int *decpt, int *si #endif //_M_X64 #endif //Q_OS_WIN -#if defined(Q_OS_LINUX) && !defined(__UCLIBC__) +#if defined(__GLIBC__) && !defined(__UCLIBC__) fesetenv(&envp); #endif diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index ac8ccba..d44a9d0 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -140,7 +140,7 @@ static inline uint detectProcessorFeatures() #if defined(QT_HAVE_IWMMXT) // runtime detection only available when running as a previlegied process features = IWMMXT; -#elif defined(QT_HAVE_NEON) +#elif defined(QT_ALWAYS_HAVE_NEON) features = NEON; #endif diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 664543b..2dbed76 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -87,9 +87,13 @@ QT_BEGIN_HEADER #include <tmmintrin.h> #endif -// SSE4.1 and SSE4.2 intrinsics -#if (defined(QT_HAVE_SSE4_1) || defined(QT_HAVE_SSE4_2)) && (defined(__SSE4_1__) || defined(Q_CC_MSVC)) +// SSE4.1 intrinsics +#if defined(QT_HAVE_SSE4_1) && (defined(__SSE4_1__) || defined(Q_CC_MSVC)) #include <smmintrin.h> +#endif + +// SSE4.2 intrinsics +#if defined(QT_HAVE_SSE4_2) && (defined(__SSE4_2__) || defined(Q_CC_MSVC)) #include <nmmintrin.h> #endif @@ -105,7 +109,8 @@ QT_BEGIN_HEADER #endif // defined(QT_HAVE_SSE2) && (defined(__SSE2__) || defined(Q_CC_MSVC)) // NEON intrinsics -#if defined(QT_HAVE_NEON) +#if defined __ARM_NEON__ +#define QT_ALWAYS_HAVE_NEON #include <arm_neon.h> #endif diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index a3d89f2..c30af64 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -714,7 +714,7 @@ const QString::Null QString::null = { }; formats, the \e precision represents the maximum number of significant digits (trailing zeroes are omitted). - \section1 More Efficient String Construction + \section1 More Efficient String Construction Using the QString \c{'+'} operator, it is easy to construct a complex string from multiple substrings. You will often write code @@ -924,7 +924,7 @@ int QString::grow(int size) /*! \since 4.2 - Returns a copy of the \a string, where the encoding of \a string depends on + 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. @@ -3606,7 +3606,7 @@ static QByteArray toLatin1_helper(const QChar *data, int length) } length = length % 16; } -#elif QT_HAVE_NEON +#elif defined(QT_ALWAYS_HAVE_NEON) // Refer to the documentation of the SSE2 implementation // this use eactly the same method as for SSE except: // 1) neon has unsigned comparison diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 0f786e3..98c213c 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -281,7 +281,6 @@ void QDeclarativeFlickablePrivate::fixupY() void QDeclarativeFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent) { - Q_Q(QDeclarativeFlickable); if (data.move.value() > minExtent || maxExtent > minExtent) { timeline.reset(data.move); if (data.move.value() != minExtent) { @@ -290,8 +289,7 @@ void QDeclarativeFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal timeline.move(data.move, minExtent - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4); timeline.move(data.move, minExtent, QEasingCurve(QEasingCurve::OutExpo), 3*fixupDuration/4); } else { - data.move.setValue(minExtent); - q->viewportMoved(); + timeline.set(data.move, minExtent); } } } else if (data.move.value() < maxExtent) { @@ -301,8 +299,7 @@ void QDeclarativeFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal timeline.move(data.move, maxExtent - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4); timeline.move(data.move, maxExtent, QEasingCurve(QEasingCurve::OutExpo), 3*fixupDuration/4); } else { - data.move.setValue(maxExtent); - q->viewportMoved(); + timeline.set(data.move, minExtent); } } vTime = timeline.time(); @@ -386,6 +383,13 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() \snippet doc/src/snippets/declarative/flickable.qml document \clearfloat + + Items declared as children of a Flickable are automatically parented to the + Flickable's \l contentItem. This should be taken into account when + operating on the children of the Flickable; it is usually the children of + \c contentItem that are relevant. For example, the bound of Items added + to the Flickable will be available by \c contentItem.childrenRect + \section1 Limitations \note Due to an implementation detail, items placed inside a Flickable cannot anchor to it by @@ -696,6 +700,9 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent bool rejectY = false; bool rejectX = false; + bool stealY = false; + bool stealX = false; + if (q->yflick()) { int dy = int(event->pos().y() - pressPos.y()); if (qAbs(dy) > QApplication::startDragDistance() || QDeclarativeItemPrivate::elapsed(pressTime) > 200) { @@ -724,7 +731,7 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent vMoved = true; } if (qAbs(dy) > QApplication::startDragDistance()) - stealMouse = true; + stealY = true; } } @@ -757,10 +764,12 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent } if (qAbs(dx) > QApplication::startDragDistance()) - stealMouse = true; + stealX = true; } } + stealMouse = stealX || stealY; + if (!lastPos.isNull()) { qreal elapsed = qreal(QDeclarativeItemPrivate::restart(lastPosTime)) / 1000.; if (elapsed <= 0) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 94b1cb3..450b6af 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -124,8 +124,8 @@ public: } qreal endPosition() const { return (view->orientation() == QDeclarativeListView::Vertical - ? item->y() + (item->height() > 0 ? item->height() : 1) - : item->x() + (item->width() > 0 ? item->width() : 1)) - 1; + ? item->y() + (item->height() >= 1.0 ? item->height() : 1) + : item->x() + (item->width() >= 1.0 ? item->width() : 1)) - 1; } void setPosition(qreal pos) { if (view->orientation() == QDeclarativeListView::Vertical) { @@ -183,6 +183,7 @@ public: , ownModel(false), wrap(false), autoHighlight(true), haveHighlightRange(false) , correctFlick(false), inFlickCorrection(false), lazyRelease(false) , deferredRelease(false), layoutScheduled(false), currentIndexCleared(false) + , inViewportMoved(false) , minExtentDirty(true), maxExtentDirty(true) {} @@ -503,6 +504,7 @@ public: bool deferredRelease : 1; bool layoutScheduled : 1; bool currentIndexCleared : 1; + bool inViewportMoved : 1; mutable bool minExtentDirty : 1; mutable bool maxExtentDirty : 1; }; @@ -736,7 +738,7 @@ void QDeclarativeListViewPrivate::layout() } if (!visibleItems.isEmpty()) { qreal oldEnd = visibleItems.last()->endPosition(); - qreal pos = visibleItems.first()->endPosition() + spacing + 1; + qreal pos = visibleItems.first()->position() + visibleItems.first()->size() + spacing; for (int i=1; i < visibleItems.count(); ++i) { FxListItem *item = visibleItems.at(i); item->setPosition(pos); @@ -1161,30 +1163,35 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m int oldDuration = fixupDuration; fixupDuration = moveReason == Mouse ? fixupDuration : 0; - if (snapMode != QDeclarativeListView::NoSnap) { + if (currentItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange) { + updateHighlight(); + qreal pos = currentItem->itemPosition(); + qreal viewPos = position(); + if (viewPos < pos + currentItem->itemSize() - highlightRangeEnd) + viewPos = pos + currentItem->itemSize() - highlightRangeEnd; + if (viewPos > pos - highlightRangeStart) + viewPos = pos - highlightRangeStart; + + timeline.reset(data.move); + if (viewPos != position()) { + if (fixupDuration) + timeline.move(data.move, -viewPos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2); + else + timeline.set(data.move, -viewPos); + } + vTime = timeline.time(); + } else if (snapMode != QDeclarativeListView::NoSnap) { FxListItem *topItem = snapItemAt(position()+highlightRangeStart); FxListItem *bottomItem = snapItemAt(position()+highlightRangeEnd); qreal pos; - if (topItem && bottomItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange) { - qreal topPos = qMin(topItem->position() - highlightRangeStart, -maxExtent); - qreal bottomPos = qMax(bottomItem->position() - highlightRangeEnd, -minExtent); - pos = qAbs(data.move + topPos) < qAbs(data.move + bottomPos) ? topPos : bottomPos; - } else if (topItem) { + if (topItem) { pos = qMax(qMin(topItem->position() - highlightRangeStart, -maxExtent), -minExtent); } else if (bottomItem) { - pos = qMax(qMin(bottomItem->position() - highlightRangeStart, -maxExtent), -minExtent); + pos = qMax(qMin(bottomItem->position() - highlightRangeStart, -maxExtent), -minExtent); } else { fixupDuration = oldDuration; return; } - if (currentItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange) { - updateHighlight(); - qreal currPos = currentItem->itemPosition(); - if (pos < currPos + currentItem->itemSize() - highlightRangeEnd) - pos = currPos + currentItem->itemSize() - highlightRangeEnd; - if (pos > currPos - highlightRangeStart) - pos = currPos - highlightRangeStart; - } qreal dist = qAbs(data.move + pos); if (dist > 0) { @@ -1195,25 +1202,6 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m timeline.set(data.move, -pos); vTime = timeline.time(); } - } else if (haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange) { - if (currentItem) { - updateHighlight(); - qreal pos = currentItem->itemPosition(); - qreal viewPos = position(); - if (viewPos < pos + currentItem->itemSize() - highlightRangeEnd) - viewPos = pos + currentItem->itemSize() - highlightRangeEnd; - if (viewPos > pos - highlightRangeStart) - viewPos = pos - highlightRangeStart; - - timeline.reset(data.move); - if (viewPos != position()) { - if (fixupDuration) - timeline.move(data.move, -viewPos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2); - else - timeline.set(data.move, -viewPos); - } - vTime = timeline.time(); - } } else { QDeclarativeFlickablePrivate::fixup(data, minExtent, maxExtent); } @@ -2295,6 +2283,10 @@ void QDeclarativeListView::viewportMoved() QDeclarativeFlickable::viewportMoved(); if (!d->itemCount) return; + // Recursion can occur due to refill changing the content size. + if (d->inViewportMoved) + return; + d->inViewportMoved = true; d->lazyRelease = true; refill(); if (d->flickingHorizontally || d->flickingVertically || d->movingHorizontally || d->movingVertically) @@ -2308,6 +2300,7 @@ void QDeclarativeListView::viewportMoved() pos = viewPos + d->highlightRangeEnd - d->highlight->size(); if (pos < viewPos + d->highlightRangeStart) pos = viewPos + d->highlightRangeStart; + d->highlightPosAnimator->stop(); d->highlight->setPosition(qRound(pos)); // update current index @@ -2355,6 +2348,7 @@ void QDeclarativeListView::viewportMoved() } d->inFlickCorrection = false; } + d->inViewportMoved = false; } qreal QDeclarativeListView::minYExtent() const diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 109fbbb..1119b92 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -129,15 +129,41 @@ void QDeclarativeLoaderPrivate::initResize() The loaded item can be accessed using the \l item property. - Loader is like any other visual item and must be positioned and sized - accordingly to become visible. Once the component is loaded, the Loader - is automatically resized to the size of the component. - If the \l source or \l sourceComponent changes, any previously instantiated items are destroyed. Setting \l source to an empty string or setting \l sourceComponent to \c undefined destroys the currently loaded item, freeing resources and leaving the Loader empty. + \section2 Loader sizing behavior + + Loader is like any other visual item and must be positioned and sized + accordingly to become visible. + + \list + \o If an explicit size is not specified for the Loader, the Loader + is automatically resized to the size of the loaded item once the + component is loaded. + \o If the size of the Loader is specified explicitly by setting + the width, height or by anchoring, the loaded item will be resized + to the size of the Loader. + \endlist + + In both scenarios the size of the item and the Loader are identical. + This ensures that anchoring to the Loader is equivalent to anchoring + to the loaded item. + + \table + \row + \o sizeloader.qml + \o sizeitem.qml + \row + \o \snippet doc/src/snippets/declarative/loader/sizeloader.qml 0 + \o \snippet doc/src/snippets/declarative/loader/sizeitem.qml 0 + \row + \o The red rectangle will be sized to the size of the root item. + \o The red rectangle will be 50x50, centered in the root item. + \endtable + \section2 Receiving signals from loaded items @@ -343,12 +369,14 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() QDeclarativeContext *ctxt = new QDeclarativeContext(creationContext); ctxt->setContextObject(q); - QDeclarativeComponent *c = component; - QObject *obj = component->create(ctxt); + QDeclarativeGuard<QDeclarativeComponent> c = component; + QObject *obj = component->beginCreate(ctxt); if (component != c) { // component->create could trigger a change in source that causes // component to be set to something else. In that case we just // need to cleanup. + if (c) + c->completeCreate(); delete obj; delete ctxt; return; @@ -373,6 +401,7 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() delete ctxt; source = QUrl(); } + component->completeCreate(); emit q->sourceChanged(); emit q->statusChanged(); emit q->progressChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index d9edd11..0a043a7 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -500,17 +500,9 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) const int dragThreshold = QApplication::startDragDistance(); qreal dx = qAbs(curLocalPos.x() - startLocalPos.x()); qreal dy = qAbs(curLocalPos.y() - startLocalPos.y()); - if ((d->dragX && !(dx < dragThreshold)) || (d->dragY && !(dy < dragThreshold))) { + + if (keepMouseGrab() && d->stealMouse) d->drag->setActive(true); - d->stealMouse = true; - } - if (!keepMouseGrab()) { - if ((!d->dragY && dy < dragThreshold && d->dragX && dx > dragThreshold) - || (!d->dragX && dx < dragThreshold && d->dragY && dy > dragThreshold) - || (d->dragX && d->dragY)) { - setKeepMouseGrab(true); - } - } if (d->dragX && d->drag->active()) { qreal x = (curLocalPos.x() - startLocalPos.x()) + d->startX; @@ -528,6 +520,16 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) y = drag()->ymax(); drag()->target()->setY(y); } + + if (!keepMouseGrab()) { + if ((!d->dragY && dy < dragThreshold && d->dragX && dx > dragThreshold) + || (!d->dragX && dx < dragThreshold && d->dragY && dy > dragThreshold) + || (d->dragX && d->dragY && (dx > dragThreshold || dy > dragThreshold))) { + setKeepMouseGrab(true); + d->stealMouse = true; + } + } + d->moved = true; } QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress); @@ -618,6 +620,7 @@ bool QDeclarativeMouseArea::sceneEvent(QEvent *event) // if our mouse grab has been removed (probably by Flickable), fix our // state d->pressed = false; + d->stealMouse = false; setKeepMouseGrab(false); emit canceled(); emit pressedChanged(); @@ -672,8 +675,18 @@ bool QDeclarativeMouseArea::sendMouseEvent(QGraphicsSceneMouseEvent *event) return stealThisEvent; } if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) { - d->stealMouse = false; - ungrabMouse(); + if (d->pressed) { + d->pressed = false; + d->stealMouse = false; + if (s && s->mouseGrabberItem() == this) + ungrabMouse(); + emit canceled(); + emit pressedChanged(); + if (d->hovered) { + d->hovered = false; + emit hoveredChanged(); + } + } } return false; } diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index dc3d5ee..7c79afe 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -373,7 +373,21 @@ void QDeclarativePathViewPrivate::regenerate() opacity of the items as they rotate. This additional code can be seen in the PathAttribute documentation.) - The \c focus can be set to \c true to enable keyboard navigation. + PathView does not automatically handle keyboard navigation. This is because + the keys to use for navigation will depend upon the shape of the path. Navigation + can be added quite simply by setting \c focus to \c true and calling + \l decrementCurrentIndex() or \l incrementCurrentIndex(), for example to navigate + using the left and right arrow keys: + + \code + PathView { + ... + focus: true + Keys.onLeftPressed: decrementCurrentIndex() + Keys.onRightPressed: incrementCurrentIndex() + } + \endcode + The path view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details). Delegates are instantiated as needed and may be destroyed at any time. @@ -523,7 +537,6 @@ int QDeclarativePathView::count() const /*! \qmlproperty Path PathView::path - \default This property holds the path used to lay out the items. For more information see the \l Path documentation. */ @@ -607,6 +620,8 @@ void QDeclarativePathView::setCurrentIndex(int idx) */ void QDeclarativePathView::incrementCurrentIndex() { + Q_D(QDeclarativePathView); + d->moveDirection = QDeclarativePathViewPrivate::Positive; setCurrentIndex(currentIndex()+1); } @@ -625,6 +640,7 @@ void QDeclarativePathView::decrementCurrentIndex() int idx = currentIndex()-1; if (idx < 0) idx = d->modelCount - 1; + d->moveDirection = QDeclarativePathViewPrivate::Negative; setCurrentIndex(idx); } } @@ -995,6 +1011,7 @@ void QDeclarativePathView::setDelegate(QDeclarativeComponent *delegate) } if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model)) { dataModel->setDelegate(delegate); + d->modelCount = dataModel->count(); d->regenerate(); emit delegateChanged(); } @@ -1636,7 +1653,7 @@ void QDeclarativePathViewPrivate::snapToCurrent() if (!model || modelCount <= 0) return; - qreal targetOffset = modelCount - currentIndex; + qreal targetOffset = qmlMod(modelCount - currentIndex, modelCount); moveReason = Other; offsetAdj = 0.0; @@ -1645,19 +1662,28 @@ void QDeclarativePathViewPrivate::snapToCurrent() const int duration = highlightMoveDuration; - if (targetOffset - offset > modelCount/2) { + if (moveDirection == Positive || (moveDirection == Shortest && targetOffset - offset > modelCount/2)) { qreal distance = modelCount - targetOffset + offset; - tl.move(moveOffset, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * offset / distance)); - tl.set(moveOffset, modelCount); - tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * (modelCount-targetOffset) / distance)); - } else if (targetOffset - offset <= -modelCount/2) { + if (targetOffset > moveOffset) { + tl.move(moveOffset, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * offset / distance)); + tl.set(moveOffset, modelCount); + tl.move(moveOffset, targetOffset, QEasingCurve(offset == 0.0 ? QEasingCurve::InOutQuad : QEasingCurve::OutQuad), int(duration * (modelCount-targetOffset) / distance)); + } else { + tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration); + } + } else if (moveDirection == Negative || targetOffset - offset <= -modelCount/2) { qreal distance = modelCount - offset + targetOffset; - tl.move(moveOffset, modelCount, QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-offset) / distance)); - tl.set(moveOffset, 0.0); - tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * targetOffset / distance)); + if (targetOffset < moveOffset) { + tl.move(moveOffset, modelCount, QEasingCurve(targetOffset == 0 ? QEasingCurve::InOutQuad : QEasingCurve::InQuad), int(duration * (modelCount-offset) / distance)); + tl.set(moveOffset, 0.0); + tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * targetOffset / distance)); + } else { + tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration); + } } else { tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration); } + moveDirection = Shortest; } QDeclarativePathViewAttached *QDeclarativePathView::qmlAttachedProperties(QObject *obj) diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h index b217216..6232b83 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h @@ -82,7 +82,7 @@ public: , dragMargin(0), deceleration(100) , moveOffset(this, &QDeclarativePathViewPrivate::setAdjustedOffset) , firstIndex(-1), pathItems(-1), requestedIndex(-1) - , moveReason(Other), attType(0), highlightComponent(0), highlightItem(0) + , moveReason(Other), moveDirection(Shortest), attType(0), highlightComponent(0), highlightItem(0) , moveHighlight(this, &QDeclarativePathViewPrivate::setHighlightPosition) , highlightPosition(0) , highlightRangeStart(0), highlightRangeEnd(0) @@ -173,6 +173,8 @@ public: QVariant modelVariant; enum MovementReason { Other, SetIndex, Mouse }; MovementReason moveReason; + enum MovementDirection { Shortest, Negative, Positive }; + MovementDirection moveDirection; QDeclarativeOpenMetaObjectType *attType; QDeclarativeComponent *highlightComponent; QDeclarativeItem *highlightItem; diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index fc3954f..7686dde 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -260,6 +260,9 @@ void QDeclarativeRectangle::doUpdate() A width of 1 creates a thin line. For no line, use a width of 0 or a transparent color. + \note The width of the rectangle's border does not affect the geometry of the + rectangle itself or its position relative to other items if anchors are used. + If \c border.width is an odd number, the rectangle is painted at a half-pixel offset to retain border smoothness. Also, the border is rendered evenly on either side of the rectangle's boundaries, and the spare pixel is rendered to the right and below the diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 1f01a45..4fe6c4c 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -937,6 +937,10 @@ void QDeclarativeVisualDataModel::setPart(const QString &part) int QDeclarativeVisualDataModel::count() const { Q_D(const QDeclarativeVisualDataModel); + if (d->m_visualItemModel) + return d->m_visualItemModel->count(); + if (!d->m_delegate) + return 0; return d->modelCount(); } diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 5f0fd56..fbe5829 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -601,7 +601,7 @@ struct QDeclarativeBindingCompilerPrivate QDeclarativeImports imports; QDeclarativeEnginePrivate *engine; - QString contextName() const { return QLatin1String("$$$SCOPE_") + QString::number((intptr_t)context, 16); } + QString contextName() const { return QLatin1String("$$$SCOPE_") + QString::number((quintptr)context, 16); } bool compile(QDeclarativeJS::AST::Node *); diff --git a/src/declarative/qml/qdeclarativecompileddata.cpp b/src/declarative/qml/qdeclarativecompileddata.cpp index a4ecc77..690f499 100644 --- a/src/declarative/qml/qdeclarativecompileddata.cpp +++ b/src/declarative/qml/qdeclarativecompileddata.cpp @@ -169,8 +169,8 @@ QDeclarativeCompiledData::QDeclarativeCompiledData(QDeclarativeEngine *engine) QDeclarativeCompiledData::~QDeclarativeCompiledData() { for (int ii = 0; ii < types.count(); ++ii) { - if (types.at(ii).ref) - types.at(ii).ref->release(); + if (types.at(ii).component) + types.at(ii).component->release(); } for (int ii = 0; ii < propertyCaches.count(); ++ii) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index b2740b8..645402e 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -591,8 +591,6 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, } } else if (tref.typeData) { ref.component = tref.typeData->compiledData(); - ref.ref = tref.typeData; - ref.ref->addref(); } ref.className = parserRef->name.toUtf8(); out->types << ref; diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 43a0901..5cd1fd2 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -89,14 +89,12 @@ public: struct TypeReference { TypeReference() - : type(0), component(0), ref(0) {} + : type(0), component(0) {} QByteArray className; QDeclarativeType *type; -// QDeclarativeComponent *component; QDeclarativeCompiledData *component; - QDeclarativeRefCount *ref; QObject *createInstance(QDeclarativeContextData *, const QBitField &, QList<QDeclarativeError> *) const; const QMetaObject *metaObject() const; }; diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 1e58a71..3ee0e6f 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -474,7 +474,7 @@ int QDeclarativeContextPrivate::context_count(QDeclarativeListProperty<QObject> { QDeclarativeContext *context = static_cast<QDeclarativeContext*>(prop->object); QDeclarativeContextPrivate *d = QDeclarativeContextPrivate::get(context); - int contextProperty = (int)(intptr_t)prop->data; + int contextProperty = (int)(quintptr)prop->data; if (d->propertyValues.at(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) { return 0; @@ -487,7 +487,7 @@ QObject *QDeclarativeContextPrivate::context_at(QDeclarativeListProperty<QObject { QDeclarativeContext *context = static_cast<QDeclarativeContext*>(prop->object); QDeclarativeContextPrivate *d = QDeclarativeContextPrivate::get(context); - int contextProperty = (int)(intptr_t)prop->data; + int contextProperty = (int)(quintptr)prop->data; if (d->propertyValues.at(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) { return 0; diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index ea92111..eff59df 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -421,7 +421,7 @@ QScriptValue QDeclarativeObjectScriptClass::tostring(QScriptContext *context, QS ret += QString::fromUtf8(obj->metaObject()->className()); ret += QLatin1String("(0x"); - ret += QString::number((intptr_t)obj,16); + ret += QString::number((quintptr)obj,16); if (!objectName.isEmpty()) { ret += QLatin1String(", \""); diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index ae7a80d..75cc6f9 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -52,6 +52,7 @@ #include <QtCore/qwaitcondition.h> #include <QtScript/qscriptvalueiterator.h> #include <QtCore/qfile.h> +#include <QtCore/qdatetime.h> #include <QtNetwork/qnetworkaccessmanager.h> #include <QtDeclarative/qdeclarativeinfo.h> #include "qdeclarativenetworkaccessmanagerfactory.h" @@ -314,6 +315,12 @@ QVariant QDeclarativeWorkerScriptEnginePrivate::scriptValueToVariant(const QScri return QVariant(value.toString()); } else if (value.isNumber()) { return QVariant((qreal)value.toNumber()); + } else if (value.isDate()) { + return QVariant(value.toDateTime()); +#ifndef QT_NO_REGEXP + } else if (value.isRegExp()) { + return QVariant(value.toRegExp()); +#endif } else if (value.isArray()) { QVariantList list; @@ -364,6 +371,12 @@ QScriptValue QDeclarativeWorkerScriptEnginePrivate::variantToScriptValue(const Q return QScriptValue(value.toString()); } else if (value.userType() == QMetaType::QReal) { return QScriptValue(value.toReal()); + } else if (value.userType() == QVariant::DateTime) { + return engine->newDate(value.toDateTime()); +#ifndef QT_NO_REGEXP + } else if (value.userType() == QVariant::RegExp) { + return engine->newRegExp(value.toRegExp()); +#endif } else if (value.userType() == qMetaTypeId<QDeclarativeListModelWorkerAgent::VariantRef>()) { QDeclarativeListModelWorkerAgent::VariantRef vr = qvariant_cast<QDeclarativeListModelWorkerAgent::VariantRef>(value); if (vr.a->scriptEngine() == 0) diff --git a/src/declarative/util/qdeclarativeopenmetaobject.cpp b/src/declarative/util/qdeclarativeopenmetaobject.cpp index 40485bd..c611435 100644 --- a/src/declarative/util/qdeclarativeopenmetaobject.cpp +++ b/src/declarative/util/qdeclarativeopenmetaobject.cpp @@ -186,6 +186,7 @@ QDeclarativeOpenMetaObject::QDeclarativeOpenMetaObject(QObject *obj, bool automa d->type->d->referers.insert(this); QObjectPrivate *op = QObjectPrivate::get(obj); + d->parent = static_cast<QAbstractDynamicMetaObject *>(op->metaObject); *static_cast<QMetaObject *>(this) = *d->type->d->mem; op->metaObject = this; } @@ -201,6 +202,7 @@ QDeclarativeOpenMetaObject::QDeclarativeOpenMetaObject(QObject *obj, QDeclarativ d->type->d->referers.insert(this); QObjectPrivate *op = QObjectPrivate::get(obj); + d->parent = static_cast<QAbstractDynamicMetaObject *>(op->metaObject); *static_cast<QMetaObject *>(this) = *d->type->d->mem; op->metaObject = this; } diff --git a/src/gui/accessible/qaccessible_mac.mm b/src/gui/accessible/qaccessible_mac.mm index 57ea41b..3b1396a 100644 --- a/src/gui/accessible/qaccessible_mac.mm +++ b/src/gui/accessible/qaccessible_mac.mm @@ -774,7 +774,7 @@ QAInterface QAccessibleHierarchyManager::lookup(const AXUIElementRef &element) return factory->interface(id); #else return QAInterface(); -#endif; +#endif } QAInterface QAccessibleHierarchyManager::lookup(const QAElement &element) diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index cd8e71a..6ba707c 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -108,6 +108,15 @@ SOURCES += \ dialogs/qwizard.cpp \ dialogs/qprintpreviewdialog.cpp +symbian:contains(QT_CONFIG, s60) { + LIBS += -lCommonDialogs + SOURCES += dialogs/qfiledialog_symbian.cpp \ + dialogs/qcolordialog_symbian.cpp +} + FORMS += dialogs/qpagesetupwidget.ui RESOURCES += dialogs/qprintdialog.qrc RESOURCES += dialogs/qmessagebox.qrc + +# Compensate for lack of platform defines in Symbian3 +symbian: DEFINES += SYMBIAN_VERSION_$$upper($$replace(SYMBIAN_VERSION,\\.,_)) diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp index 25d9ebb..641419f 100644 --- a/src/gui/dialogs/qabstractprintdialog.cpp +++ b/src/gui/dialogs/qabstractprintdialog.cpp @@ -65,6 +65,9 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate customize settings shown in print dialogs, but it is not used directly. Use QPrintDialog to display a print dialog in your application. + In Symbian, there is no support for printing. Hence, this dialog should not + be used in Symbian. + \sa QPrintDialog, QPrinter, {Printing with Qt} */ diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index e9b5720..a66a979 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -1952,6 +1952,12 @@ void QColorDialog::open(QObject *receiver, const char *member) \sa QDialog::open() */ +/* + For Symbian color dialogs +*/ +#ifdef Q_WS_S60 +extern QColor qtSymbianGetColor(const QColor &initial); +#endif /*! \since 4.5 @@ -1961,10 +1967,19 @@ void QColorDialog::open(QObject *receiver, const char *member) QColor::isValid()) color if the user cancels the dialog. The \a options argument allows you to customize the dialog. + + On Symbian, this static function will use the native color dialog and not a QColorDialog. + On Symbian the parameters \a title and \a parent has no relevance and the + \a options parameter is only used to define if the native color dialog is + used or not. */ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QString &title, ColorDialogOptions options) { +#ifdef Q_WS_S60 + if (!(options & DontUseNativeDialog)) + return qtSymbianGetColor(initial); +#endif QColorDialog dlg(parent); if (!title.isEmpty()) dlg.setWindowTitle(title); @@ -1979,10 +1994,16 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr returns that color. The color is initially set to \a initial. The dialog is a child of \a parent. It returns an invalid (see QColor::isValid()) color if the user cancels the dialog. + + On Symbian, this static function will use the native + color dialog and not a QColorDialog. */ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent) { +#ifdef Q_WS_S60 + return qtSymbianGetColor(initial); +#endif return getColor(initial, parent, QString(), ColorDialogOptions(0)); } diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm index 82cfa24..655de08 100644 --- a/src/gui/dialogs/qcolordialog_mac.mm +++ b/src/gui/dialogs/qcolordialog_mac.mm @@ -185,7 +185,7 @@ QT_USE_NAMESPACE [self relayout]; } -- (void)colorChanged:(NSNotification *)notification; +- (void)colorChanged:(NSNotification *)notification { Q_UNUSED(notification); [self updateQtColor]; @@ -439,7 +439,7 @@ void QColorDialogPrivate::openCocoaColorPanel(const QColor &initial, priv:this]; [colorPanel setDelegate:static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate)]; } - [delegate setResultSet:false]; + [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) setResultSet:NO]; setCocoaPanelColor(initial); [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) showColorPanel]; } diff --git a/src/gui/dialogs/qcolordialog_symbian.cpp b/src/gui/dialogs/qcolordialog_symbian.cpp new file mode 100644 index 0000000..8f73f7c --- /dev/null +++ b/src/gui/dialogs/qcolordialog_symbian.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcolordialog_p.h" + +#ifndef QT_NO_COLORDIALOG + + +#include "qcolor.h" +#include "private/qguiplatformplugin_p.h" + +#ifdef Q_WS_S60 +#include <AknColourSelectionGrid.h> +#endif + +#include "private/qt_s60_p.h" + +QT_BEGIN_NAMESPACE + +QColor launchSymbianColorDialog(QColor initial) +{ + QColor currentColor = QColor::Invalid; +#ifdef Q_WS_S60 + QT_TRAP_THROWING( + CArrayFixFlat<TRgb>* array = new( ELeave ) CArrayFixFlat<TRgb>(17); + CleanupStack::PushL(array); + array->AppendL(KRgbBlack); + array->AppendL(KRgbDarkGray); + array->AppendL(KRgbDarkRed); + array->AppendL(KRgbDarkGreen); + array->AppendL(KRgbDarkYellow); + array->AppendL(KRgbDarkBlue); + array->AppendL(KRgbDarkMagenta); + array->AppendL(KRgbDarkCyan); + array->AppendL(KRgbRed); + array->AppendL(KRgbGreen); + array->AppendL(KRgbYellow); + array->AppendL(KRgbBlue); + array->AppendL(KRgbMagenta); + array->AppendL(KRgbCyan); + array->AppendL(KRgbGray); + array->AppendL(KRgbWhite); + + TRgb initialColour(initial.red(), initial.green(), initial.blue(), initial.alpha()); + + TBool noneChosen = EFalse; // If true shows the default colour button + CAknColourSelectionGrid* colourSelectionGrid = + CAknColourSelectionGrid::NewL(array, EFalse, noneChosen, initialColour); + CleanupStack::PushL(colourSelectionGrid); + + if (colourSelectionGrid->ExecuteLD()) { + currentColor.setRgb(initialColour.Red(), initialColour.Green(), + initialColour.Blue(), initialColour.Alpha()); + } + CleanupStack::Pop(colourSelectionGrid); + CleanupStack::PopAndDestroy(array); + ); +#endif + return currentColor; +} + +QColor qtSymbianGetColor(const QColor &initial) +{ + return launchSymbianColorDialog(initial); +} + +QT_END_NAMESPACE + +#endif // QT_NO_COLORDIALOG diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 1b9d127..9509330 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -1616,6 +1616,25 @@ extern QStringList qt_win_get_open_file_names(const QFileDialogArgs &args, extern QString qt_win_get_existing_directory(const QFileDialogArgs &args); #endif +/* + For Symbian file dialogs +*/ +#if defined(Q_WS_S60) +extern QString qtSymbianGetOpenFileName(const QString &caption, + const QString &dir, + const QString &filter); + +extern QStringList qtSymbianGetOpenFileNames(const QString &caption, + const QString &dir, + const QString &filter); + +extern QString qtSymbianGetSaveFileName(const QString &caption, + const QString &dir); + +extern QString qtSymbianGetExistingDirectory(const QString &caption, + const QString &dir); +#endif + /*! This is a convenience static function that returns an existing file selected by the user. If the user presses Cancel, it returns a null string. @@ -1644,8 +1663,8 @@ extern QString qt_win_get_existing_directory(const QFileDialogArgs &args); The dialog's caption is set to \a caption. If \a caption is not specified then a default caption will be used. - On Windows and Mac OS X, this static function will use the native file - dialog and not a QFileDialog. + On Windows, Mac OS X and Symbian^3, this static function will use the + native file dialog and not a QFileDialog. On Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if \a parent is not 0 then it will position the @@ -1657,6 +1676,10 @@ extern QString qt_win_get_existing_directory(const QFileDialogArgs &args); \a options includes DontResolveSymlinks, the file dialog will treat symlinks as regular directories. + On Symbian^3 the parameter \a selectedFilter has no meaning and the + \a options parameter is only used to define if the native file dialog is + used. + \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors. @@ -1672,6 +1695,10 @@ QString QFileDialog::getOpenFileName(QWidget *parent, { if (qt_filedialog_open_filename_hook && !(options & DontUseNativeDialog)) return qt_filedialog_open_filename_hook(parent, caption, dir, filter, selectedFilter, options); +#if defined(Q_WS_S60) + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) + return qtSymbianGetOpenFileName(caption, dir, filter); +#endif QFileDialogArgs args; args.parent = parent; args.caption = caption; @@ -1722,8 +1749,8 @@ QString QFileDialog::getOpenFileName(QWidget *parent, The dialog's caption is set to \a caption. If \a caption is not specified then a default caption will be used. - On Windows and Mac OS X, this static function will use the native file - dialog and not a QFileDialog. + On Windows, Mac OS X and Symbian^3, this static function will use the + native file dialog and not a QFileDialog. On Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if \a parent is not 0 then it will position the @@ -1741,6 +1768,10 @@ QString QFileDialog::getOpenFileName(QWidget *parent, \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 10 + On Symbian^3 the parameter \a selectedFilter has no meaning and the + \a options parameter is only used to define if the native file dialog is + used. + \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors. @@ -1756,6 +1787,10 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, { if (qt_filedialog_open_filenames_hook && !(options & DontUseNativeDialog)) return qt_filedialog_open_filenames_hook(parent, caption, dir, filter, selectedFilter, options); +#if defined(Q_WS_S60) + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) + return qtSymbianGetOpenFileNames(caption, dir, filter); +#endif QFileDialogArgs args; args.parent = parent; args.caption = caption; @@ -1813,8 +1848,8 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, The dialog's caption is set to \a caption. If \a caption is not specified, a default caption will be used. - On Windows and Mac OS X, this static function will use the native file - dialog and not a QFileDialog. + On Windows, Mac OS X and Symbian^3, this static function will use the + native file dialog and not a QFileDialog. On Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if \a parent is not 0 then it will position the @@ -1827,6 +1862,10 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, \a options includes DontResolveSymlinks the file dialog will treat symlinks as regular directories. + On Symbian^3 the parameters \a filter and \a selectedFilter have no + meaning. The \a options parameter is only used to define if the native file + dialog is used. + \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors. @@ -1842,6 +1881,10 @@ QString QFileDialog::getSaveFileName(QWidget *parent, { if (qt_filedialog_save_filename_hook && !(options & DontUseNativeDialog)) return qt_filedialog_save_filename_hook(parent, caption, dir, filter, selectedFilter, options); +#if defined(Q_WS_S60) + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) + return qtSymbianGetSaveFileName(caption, dir); +#endif QFileDialogArgs args; args.parent = parent; args.caption = caption; @@ -1890,9 +1933,9 @@ QString QFileDialog::getSaveFileName(QWidget *parent, pass. To ensure a native file dialog, \l{QFileDialog::}{ShowDirsOnly} must be set. - On Windows and Mac OS X, this static function will use the native file - dialog and not a QFileDialog. On Windows CE, if the device has no native - file dialog, a QFileDialog will be used. + On Windows, Mac OS X and Symbian^3, this static function will use the + native file dialog and not a QFileDialog. On Windows CE, if the device has + no native file dialog, a QFileDialog will be used. On Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp}, @@ -1904,6 +1947,9 @@ QString QFileDialog::getSaveFileName(QWidget *parent, dispatch any QTimers, and if \a parent is not 0 then it will position the dialog just below the parent's title bar. + On Symbian^3 the \a options parameter is only used to define if the native + file dialog is used. + \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors. @@ -1917,6 +1963,10 @@ QString QFileDialog::getExistingDirectory(QWidget *parent, { if (qt_filedialog_existing_directory_hook && !(options & DontUseNativeDialog)) return qt_filedialog_existing_directory_hook(parent, caption, dir, options); +#if defined(Q_WS_S60) + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) + return qtSymbianGetExistingDirectory(caption, dir); +#endif QFileDialogArgs args; args.parent = parent; args.caption = caption; diff --git a/src/gui/dialogs/qfiledialog_symbian.cpp b/src/gui/dialogs/qfiledialog_symbian.cpp new file mode 100644 index 0000000..1f70305 --- /dev/null +++ b/src/gui/dialogs/qfiledialog_symbian.cpp @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qfiledialog.h" + +#ifndef QT_NO_FILEDIALOG + +#include <private/qfiledialog_p.h> +#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3) +#include <driveinfo.h> +#include <AknCommonDialogsDynMem.h> +#include <CAknMemorySelectionDialogMultiDrive.h> +#include <MAknFileFilter.h> +#endif +#include "private/qcore_symbian_p.h" + +QT_BEGIN_NAMESPACE + +enum DialogMode { DialogOpen, DialogSave, DialogFolder }; +#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3) +class CExtensionFilter : public MAknFileFilter +{ +public: + void setFilter(const QString filter) + { + filterList.clear(); + if (filter.left(2) == QLatin1String("*.")) { + //Filter has only extensions + filterList << filter.split(" "); + return; + } else { + //Extensions are in parenthesis and there may be several filters + QStringList separatedFilters(filter.split(QLatin1String(";;"))); + for (int i = 0; i < separatedFilters.size(); i++) { + if (separatedFilters.at(i).contains(QLatin1String("(*)"))) { + filterList << QLatin1String("(*)"); + return; + } + } + QRegExp rx("\\(([^\\)]*)\\)"); + int pos = 0; + while ((pos = rx.indexIn(filter, pos)) != -1) { + filterList << rx.cap(1).split(QLatin1String(" ")); + pos += rx.matchedLength(); + } + } + } + + TBool Accept(const TDesC &/*aDriveAndPath*/, const TEntry &aEntry) const + { + if (aEntry.IsDir()) + return ETrue; + + //If no filter for files, all can be accepted + if (filterList.isEmpty()) + return ETrue; + + if (filterList == QStringList(QLatin1String("(*)"))) + return ETrue; + + for (int i = 0; i < filterList.size(); ++i) { + QString extension = filterList.at(i); + //remove '*' from the beginning of the extension + if (extension.at(0) == QLatin1Char('*')) + extension = extension.mid(1); + + QString fileName = qt_TDesC2QString(aEntry.iName); + if (fileName.endsWith(extension)) + return ETrue; + } + return EFalse; + } + +private: + QStringList filterList; +}; +#endif + +static QString launchSymbianDialog(const QString dialogCaption, const QString startDirectory, + const QString filter, DialogMode dialogMode) +{ + QString selection; +#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3) + QT_TRAP_THROWING( + TFileName startFolder; + if (!startDirectory.isEmpty()) { + QString dir = QDir::toNativeSeparators(startDirectory); + startFolder = qt_QString2TPtrC(dir); + } + TInt types = AknCommonDialogsDynMem::EMemoryTypeMMCExternal| + AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage| + AknCommonDialogsDynMem::EMemoryTypePhone; + + TPtrC titlePtr(qt_QString2TPtrC(dialogCaption)); + TFileName target; + bool select = false; + if (dialogMode == DialogOpen) { + CExtensionFilter* extensionFilter = new (ELeave) CExtensionFilter; + CleanupStack::PushL(extensionFilter); + extensionFilter->setFilter(filter); + select = AknCommonDialogsDynMem::RunSelectDlgLD(types, target, + startFolder, NULL, NULL, titlePtr, extensionFilter); + CleanupStack::Pop(extensionFilter); + } else if (dialogMode == DialogSave) { + select = AknCommonDialogsDynMem::RunSaveDlgLD(types, target, + startFolder, NULL, NULL, titlePtr); + } else if (dialogMode == DialogFolder) { + select = AknCommonDialogsDynMem::RunFolderSelectDlgLD(types, target, startFolder, + 0, 0, titlePtr, NULL, NULL); + } + if (select) + selection.append(qt_TDesC2QString(target)); + ); +#endif + return selection; +} + +QString qtSymbianGetOpenFileName(const QString &caption, + const QString &dir, + const QString &filter) +{ + return launchSymbianDialog(caption, dir, filter, DialogOpen); +} + +QStringList qtSymbianGetOpenFileNames(const QString &caption, + const QString &dir, + const QString &filter) +{ + QString fileName; + fileName.append(launchSymbianDialog(caption, dir, filter, DialogOpen)); + QStringList fileList; + fileList << fileName; + + return fileList; +} + +QString qtSymbianGetSaveFileName(const QString &caption, + const QString &dir) +{ + return launchSymbianDialog(caption, dir, QString(), DialogSave); +} + +QString qtSymbianGetExistingDirectory(const QString &caption, + const QString &dir) +{ + QString folderCaption; + if (!caption.isEmpty()) { + folderCaption.append(caption); + } else { + // Title for folder selection dialog is mandatory + folderCaption.append(QFileDialog::tr("Find Directory")); + } + return launchSymbianDialog(folderCaption, dir, QString(), DialogFolder); +} + +QT_END_NAMESPACE + +#endif diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index 1b9778c..9a92b27 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -340,7 +340,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) [self relayoutToContentSize:[[mStolenContentView superview] frame].size]; } -- (void)relayoutToContentSize:(NSSize)frameSize; +- (void)relayoutToContentSize:(NSSize)frameSize { Q_ASSERT(mPanelHackedWithButtons); diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index f849996..224a176 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -776,10 +776,8 @@ QMessageBox::QMessageBox(QWidget *parent) added at any time using addButton(). The \a parent and \a f arguments are 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. 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 @@ -1549,10 +1547,8 @@ static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, \key Esc was pressed instead, the \l{Default and Escape Keys} {escape button} is returned. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \sa question(), warning(), critical() */ @@ -1579,10 +1575,8 @@ QMessageBox::StandardButton QMessageBox::information(QWidget *parent, const QStr \key Esc was pressed instead, the \l{Default and Escape Keys} {escape button} is returned. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \sa information(), warning(), critical() */ @@ -1607,10 +1601,8 @@ QMessageBox::StandardButton QMessageBox::question(QWidget *parent, const QString \key Esc was pressed instead, the \l{Default and Escape Keys} {escape button} is returned. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \sa question(), information(), critical() */ @@ -1635,10 +1627,8 @@ QMessageBox::StandardButton QMessageBox::warning(QWidget *parent, const QString \key Esc was pressed instead, the \l{Default and Escape Keys} {escape button} is returned. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -1670,7 +1660,7 @@ QMessageBox::StandardButton QMessageBox::critical(QWidget *parent, const QString The about box has a single button labelled "OK". On Mac OS X, the about box is popped up as a modeless window; on other platforms, - it is currently a window modal. + it is currently application modal. \sa QWidget::windowIcon(), QApplication::activeWindow() */ @@ -1723,7 +1713,7 @@ void QMessageBox::about(QWidget *parent, const QString &title, const QString &te QApplication provides this functionality as a slot. On Mac OS X, the about box is popped up as a modeless window; on - other platforms, it is currently window modal. + other platforms, it is currently application modal. \sa QApplication::aboutQt() */ @@ -1983,10 +1973,8 @@ void QMessageBoxPrivate::retranslateStrings() \snippet doc/src/snippets/dialogs/dialogs.cpp 2 - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. The \a parent and \a f arguments are passed to the QDialog constructor. @@ -2035,10 +2023,8 @@ QMessageBox::QMessageBox(const QString &title, const QString &text, Icon icon, Returns the identity (QMessageBox::Ok, or QMessageBox::No, etc.) of the button that was clicked. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2073,10 +2059,8 @@ int QMessageBox::information(QWidget *parent, const QString &title, const QStrin supply 0, 1 or 2 to make pressing \key Esc equivalent to clicking the relevant button. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2125,10 +2109,8 @@ int QMessageBox::information(QWidget *parent, const QString &title, const QStrin Returns the identity (QMessageBox::Yes, or QMessageBox::No, etc.) of the button that was clicked. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2163,10 +2145,8 @@ int QMessageBox::question(QWidget *parent, const QString &title, const QString& supply 0, 1 or 2 to make pressing Escape equivalent to clicking the relevant button. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2215,10 +2195,8 @@ int QMessageBox::question(QWidget *parent, const QString &title, const QString& Returns the identity (QMessageBox::Ok or QMessageBox::No or ...) of the button that was clicked. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2253,10 +2231,8 @@ int QMessageBox::warning(QWidget *parent, const QString &title, const QString& t supply 0, 1, or 2 to make pressing Escape equivalent to clicking the relevant button. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2304,10 +2280,8 @@ int QMessageBox::warning(QWidget *parent, const QString &title, const QString& t Returns the identity (QMessageBox::Ok, or QMessageBox::No, etc.) of the button that was clicked. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog @@ -2343,10 +2317,8 @@ int QMessageBox::critical(QWidget *parent, const QString &title, const QString& supply 0, 1, or 2 to make pressing Escape equivalent to clicking the relevant button. - 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. + The message box is an \l{Qt::ApplicationModal} {application modal} + dialog box. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog diff --git a/src/gui/dialogs/qpagesetupdialog.cpp b/src/gui/dialogs/qpagesetupdialog.cpp index 5d77de1..b5be942 100644 --- a/src/gui/dialogs/qpagesetupdialog.cpp +++ b/src/gui/dialogs/qpagesetupdialog.cpp @@ -62,6 +62,9 @@ QT_BEGIN_NAMESPACE page margins set on a QPrinter won't show in the native Mac OS X page setup dialog. + In Symbian, there is no support for printing. Hence, this dialog should not + be used in Symbian. + \sa QPrinter, QPrintDialog */ diff --git a/src/gui/dialogs/qpagesetupdialog_mac.mm b/src/gui/dialogs/qpagesetupdialog_mac.mm index 0302be4..f7a9aab 100644 --- a/src/gui/dialogs/qpagesetupdialog_mac.mm +++ b/src/gui/dialogs/qpagesetupdialog_mac.mm @@ -61,7 +61,7 @@ QT_USE_NAMESPACE @end @implementation QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) -- (id)initWithMacPrintEngine:(QMacPrintEnginePrivate *)printEngine; +- (id)initWithMacPrintEngine:(QMacPrintEnginePrivate *)printEngine { self = [super init]; if (self) { @@ -312,4 +312,4 @@ int QPageSetupDialog::exec() QT_END_NAMESPACE -#endif QT_NO_PRINTDIALOG +#endif /* QT_NO_PRINTDIALOG */ diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/gui/dialogs/qprintpreviewdialog.cpp index f21343e..d74742a 100644 --- a/src/gui/dialogs/qprintpreviewdialog.cpp +++ b/src/gui/dialogs/qprintpreviewdialog.cpp @@ -676,6 +676,8 @@ void QPrintPreviewDialogPrivate::_q_zoomFactorChanged() Call QPrintPreviewDialog::exec() to show the preview dialog. \endlist + In Symbian, there is no support for printing. Hence, this dialog should not + be used in Symbian. \sa QPrinter, QPrintDialog, QPageSetupDialog, QPrintPreviewWidget */ diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp index 4104834..477aea3 100644 --- a/src/gui/graphicsview/qgraphicsgridlayout.cpp +++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp @@ -64,6 +64,17 @@ removeAt() will remove an item from the layout, without destroying it. + \section1 Size Hints and Size Policies in QGraphicsGridLayout + + QGraphicsGridLayout respects each item's size hints and size policies, + and when a cell in the grid has more space than the items can fill, each item + is arranged according to the layout's alignment for that item. You can set + an alignment for each item by calling setAlignment(), and check the + alignment for any item by calling alignment(). You can also set the alignment + for an entire row or column by calling setRowAlignment() and setColumnAlignment() + respectively. By default, items are aligned to the top left. + + \sa QGraphicsLinearLayout, QGraphicsWidget */ diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index fab1bbb..b650391 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -137,19 +137,28 @@ void QGraphicsLayoutItemPrivate::init() QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) const { Q_Q(const QGraphicsLayoutItem); - if (!sizeHintCacheDirty && cachedConstraint == constraint) - return cachedSizeHints; + QSizeF *sizeHintCache; + const bool hasConstraint = constraint.width() >= 0 || constraint.height() >= 0; + if (hasConstraint) { + if (!sizeHintWithConstraintCacheDirty && constraint == cachedConstraint) + return cachedSizeHintsWithConstraints; + sizeHintCache = cachedSizeHintsWithConstraints; + } else { + if (!sizeHintCacheDirty) + return cachedSizeHints; + sizeHintCache = cachedSizeHints; + } for (int i = 0; i < Qt::NSizeHints; ++i) { - cachedSizeHints[i] = constraint; + sizeHintCache[i] = constraint; if (userSizeHints) - combineSize(cachedSizeHints[i], userSizeHints[i]); + combineSize(sizeHintCache[i], userSizeHints[i]); } - QSizeF &minS = cachedSizeHints[Qt::MinimumSize]; - QSizeF &prefS = cachedSizeHints[Qt::PreferredSize]; - QSizeF &maxS = cachedSizeHints[Qt::MaximumSize]; - QSizeF &descentS = cachedSizeHints[Qt::MinimumDescent]; + QSizeF &minS = sizeHintCache[Qt::MinimumSize]; + QSizeF &prefS = sizeHintCache[Qt::PreferredSize]; + QSizeF &maxS = sizeHintCache[Qt::MaximumSize]; + QSizeF &descentS = sizeHintCache[Qt::MinimumDescent]; normalizeHints(minS.rwidth(), prefS.rwidth(), maxS.rwidth(), descentS.rwidth()); normalizeHints(minS.rheight(), prefS.rheight(), maxS.rheight(), descentS.rheight()); @@ -175,9 +184,13 @@ QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) // Not supported yet // COMBINE_SIZE(descentS, q->sizeHint(Qt::MinimumDescent, constraint)); - cachedConstraint = constraint; - sizeHintCacheDirty = false; - return cachedSizeHints; + if (hasConstraint) { + cachedConstraint = constraint; + sizeHintWithConstraintCacheDirty = false; + } else { + sizeHintCacheDirty = false; + } + return sizeHintCache; } diff --git a/src/gui/graphicsview/qgraphicslayoutitem_p.h b/src/gui/graphicsview/qgraphicslayoutitem_p.h index b752e03..d72ee9f 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem_p.h +++ b/src/gui/graphicsview/qgraphicslayoutitem_p.h @@ -85,8 +85,10 @@ public: QSizeF *userSizeHints; mutable QSizeF cachedSizeHints[Qt::NSizeHints]; mutable QSizeF cachedConstraint; + mutable QSizeF cachedSizeHintsWithConstraints[Qt::NSizeHints]; mutable quint32 sizeHintCacheDirty : 1; + mutable quint32 sizeHintWithConstraintCacheDirty : 1; quint32 isLayout : 1; quint32 ownedByLayout : 1; diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index 7e8d19f..244a728 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -75,7 +75,7 @@ is arranged according to the layout's alignment for that item. You can set an alignment for each item by calling setAlignment(), and check the alignment for any item by calling alignment(). By default, items are - centered both vertically and horizontally. + aligned to the top left. \section1 Spacing within QGraphicsLinearLayout @@ -446,7 +446,7 @@ void QGraphicsLinearLayout::setAlignment(QGraphicsLayoutItem *item, Qt::Alignmen /*! Returns the alignment for \a item. The default alignment is - Qt::AlignCenter. + Qt::AlignTop | Qt::AlignLeft. The alignment decides how the item is positioned within its assigned space in the case where there's more space available in the layout than the diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index 1f155c6..d495da2 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -54,7 +54,7 @@ instances to one QGraphicsItem. Each QGraphicsTransform is applied in order, one at a time, to the QGraphicsItem it's assigned to. - QGraphicsTransform is particularily useful for animations. Whereas + QGraphicsTransform is particularly useful for animations. Whereas QGraphicsItem::setTransform() lets you assign any transform directly to an item, there is no direct way to interpolate between two different transformations (e.g., when transitioning between two states, each for diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index 7f8d574..75f1cf5 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -166,7 +166,7 @@ void QGridLayoutRowData::reset(int count) hasIgnoreFlag = false; } -void QGridLayoutRowData::distributeMultiCells() +void QGridLayoutRowData::distributeMultiCells(const QGridLayoutRowInfo &rowInfo) { MultiCellMap::const_iterator i = multiCellMap.constBegin(); for (; i != multiCellMap.constEnd(); ++i) { @@ -185,7 +185,7 @@ void QGridLayoutRowData::distributeMultiCells() qreal extra = compare(box, totalBox, j); if (extra > 0.0) { calculateGeometries(start, end, box.q_sizes(j), dummy.data(), newSizes.data(), - 0, totalBox); + 0, totalBox, rowInfo); for (int k = 0; k < span; ++k) extras[k].q_sizes(j) = newSizes[k]; @@ -202,11 +202,12 @@ void QGridLayoutRowData::distributeMultiCells() void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSize, qreal *positions, qreal *sizes, qreal *descents, - const QGridLayoutBox &totalBox) + const QGridLayoutBox &totalBox, + const QGridLayoutRowInfo &rowInfo) { Q_ASSERT(end > start); - targetSize = qBound(totalBox.q_minimumSize, targetSize, totalBox.q_maximumSize); + targetSize = qMax(totalBox.q_minimumSize, targetSize); int n = end - start; QVarLengthArray<qreal> newSizes(n); @@ -246,16 +247,22 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz } } } else { - stealBox(start, end, PreferredSize, positions, sizes); + bool isLargerThanMaximum = (targetSize > totalBox.q_maximumSize); + if (isLargerThanMaximum) { + stealBox(start, end, MaximumSize, positions, sizes); + sumAvailable = targetSize - totalBox.q_maximumSize; + } else { + stealBox(start, end, PreferredSize, positions, sizes); + sumAvailable = targetSize - totalBox.q_preferredSize; + } - sumAvailable = targetSize - totalBox.q_preferredSize; if (sumAvailable > 0.0) { qreal sumCurrentAvailable = sumAvailable; bool somethingHasAMaximumSize = false; - qreal sumPreferredSizes = 0.0; + qreal sumSizes = 0.0; for (int i = 0; i < n; ++i) - sumPreferredSizes += sizes[i]; + sumSizes += sizes[i]; for (int i = 0; i < n; ++i) { if (ignore.testBit(start + i)) { @@ -265,7 +272,16 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz } const QGridLayoutBox &box = boxes.at(start + i); - qreal desired = box.q_maximumSize - box.q_preferredSize; + qreal boxSize; + + qreal desired; + if (isLargerThanMaximum) { + boxSize = box.q_maximumSize; + desired = rowInfo.boxes.value(start + i).q_maximumSize - boxSize; + } else { + boxSize = box.q_preferredSize; + desired = box.q_maximumSize - boxSize; + } if (desired == 0.0) { newSizes[i] = sizes[i]; factors[i] = 0.0; @@ -284,17 +300,17 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz } else if (stretch <= 0) { factors[i] = 0.0; } else { - qreal ultimatePreferredSize; - qreal ultimateSumPreferredSizes; - qreal x = ((stretch * sumPreferredSizes) - - (sumStretches * box.q_preferredSize)) + qreal ultimateSize; + qreal ultimateSumSizes; + qreal x = ((stretch * sumSizes) + - (sumStretches * boxSize)) / (sumStretches - stretch); if (x >= 0.0) { - ultimatePreferredSize = box.q_preferredSize + x; - ultimateSumPreferredSizes = sumPreferredSizes + x; + ultimateSize = boxSize + x; + ultimateSumSizes = sumSizes + x; } else { - ultimatePreferredSize = box.q_preferredSize; - ultimateSumPreferredSizes = (sumStretches * box.q_preferredSize) + ultimateSize = boxSize; + ultimateSumSizes = (sumStretches * boxSize) / stretch; } @@ -303,17 +319,17 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz (at the expense of the stretch factors, which are not fully respected during the transition). */ - ultimatePreferredSize = ultimatePreferredSize * 3 / 2; - ultimateSumPreferredSizes = ultimateSumPreferredSizes * 3 / 2; + ultimateSize = ultimateSize * 3 / 2; + ultimateSumSizes = ultimateSumSizes * 3 / 2; - qreal beta = ultimateSumPreferredSizes - sumPreferredSizes; + qreal beta = ultimateSumSizes - sumSizes; if (!beta) { factors[i] = 1; } else { qreal alpha = qMin(sumCurrentAvailable, beta); - qreal ultimateFactor = (stretch * ultimateSumPreferredSizes / sumStretches) - - (box.q_preferredSize); - qreal transitionalFactor = sumCurrentAvailable * (ultimatePreferredSize - box.q_preferredSize) / beta; + qreal ultimateFactor = (stretch * ultimateSumSizes / sumStretches) + - (boxSize); + qreal transitionalFactor = sumCurrentAvailable * (ultimateSize - boxSize) / beta; factors[i] = ((alpha * ultimateFactor) + ((beta - alpha) * transitionalFactor)) / beta; @@ -336,11 +352,16 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz if (newSizes[i] >= 0.0) continue; - const QGridLayoutBox &box = boxes.at(start + i); + qreal maxBoxSize; + if (isLargerThanMaximum) + maxBoxSize = rowInfo.boxes.value(start + i).q_maximumSize; + else + maxBoxSize = boxes.at(start + i).q_maximumSize; + qreal avail = sumCurrentAvailable * factors[i] / sumFactors; - if (sizes[i] + avail >= box.q_maximumSize) { - newSizes[i] = box.q_maximumSize; - sumCurrentAvailable -= box.q_maximumSize - sizes[i]; + if (sizes[i] + avail >= maxBoxSize) { + newSizes[i] = maxBoxSize; + sumCurrentAvailable -= maxBoxSize - sizes[i]; sumFactors -= factors[i]; keepGoing = (sumCurrentAvailable > 0.0); if (!keepGoing) @@ -637,7 +658,7 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig if (dynamicConstraintOrientation() == Qt::Vertical) { if (size.width() > cellWidth) size = effectiveMaxSize(QSizeF(cellWidth, -1)); - } else if(size.height() > cellHeight) { + } else if (size.height() > cellHeight) { size = effectiveMaxSize(QSizeF(-1, cellHeight)); } } @@ -1116,63 +1137,58 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi { QGridLayoutBox sizehint_totalBoxes[NOrientations]; - if(rowCount() < 1 || columnCount() < 1 || !hasDynamicConstraint()) { + bool sizeHintCalculated = false; + + if (hasDynamicConstraint() && rowCount() > 0 && columnCount() > 0) { + if (constraintOrientation() == Qt::Vertical) { + //We have items whose height depends on their width + if (constraint.width() >= 0) { + if (q_cachedDataForStyleInfo != styleInfo) + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + else + sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; + QVector<qreal> sizehint_xx; + QVector<qreal> sizehint_widths; + + sizehint_xx.resize(columnCount()); + sizehint_widths.resize(columnCount()); + qreal width = constraint.width(); + //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as + //constraints to find the row heights + q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(), + 0, sizehint_totalBoxes[Hor], q_infos[Hor]); + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical); + sizeHintCalculated = true; + } + } else { + if (constraint.height() >= 0) { + //We have items whose width depends on their height + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + QVector<qreal> sizehint_yy; + QVector<qreal> sizehint_heights; + + sizehint_yy.resize(rowCount()); + sizehint_heights.resize(rowCount()); + qreal height = constraint.height(); + //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as + //constraints to find the column widths + q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(), + 0, sizehint_totalBoxes[Ver], q_infos[Ver]); + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Vertical); + sizeHintCalculated = true; + } + } + } + + if (!sizeHintCalculated) { //No items with height for width, so it doesn't matter which order we do these in - if(q_cachedDataForStyleInfo != styleInfo) { + if (q_cachedDataForStyleInfo != styleInfo) { ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); } else { sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; sizehint_totalBoxes[Ver] = q_totalBoxes[Ver]; } - } else if(constraintOrientation() == Qt::Vertical) { - //We have items whose width depends on their height - if(q_cachedDataForStyleInfo != styleInfo) - ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); - else - sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; - QVector<qreal> sizehint_xx; - QVector<qreal> sizehint_widths; - - sizehint_xx.resize(columnCount()); - sizehint_widths.resize(columnCount()); - qreal width = constraint.width(); - if(width < 0) { - /* It's not obvious what the behaviour should be. */ -/* if(which == Qt::MaximumSize) - width = sizehint_totalBoxes[Hor].q_maximumSize; - else if(which == Qt::MinimumSize) - width = sizehint_totalBoxes[Hor].q_minimumSize; - else*/ - width = sizehint_totalBoxes[Hor].q_preferredSize; - } - //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as - //constraints to find the row heights - q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(), - 0, sizehint_totalBoxes[Hor]); - ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical); - } else { - //We have items whose height depends on their width - ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); - QVector<qreal> sizehint_yy; - QVector<qreal> sizehint_heights; - - sizehint_yy.resize(rowCount()); - sizehint_heights.resize(rowCount()); - qreal height = constraint.height(); - if(height < 0) { -/* if(which == Qt::MaximumSize) - height = sizehint_totalBoxes[Ver].q_maximumSize; - else if(which == Qt::MinimumSize) - height = sizehint_totalBoxes[Ver].q_minimumSize; - else*/ - height = sizehint_totalBoxes[Ver].q_preferredSize; - } - //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as - //constraints to find the column widths - q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(), - 0, sizehint_totalBoxes[Ver]); - ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Vertical); } switch (which) { @@ -1631,7 +1647,8 @@ void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGri { rowData->reset(rowCount(orientation)); fillRowData(rowData, styleInfo, colPositions, colSizes, orientation); - rowData->distributeMultiCells(); + const QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; + rowData->distributeMultiCells(rowInfo); *totalBox = rowData->totalBox(0, rowCount(orientation)); //We have items whose width depends on their height } @@ -1694,28 +1711,28 @@ void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, q_heights.resize(rowCount()); q_descents.resize(rowCount()); - if(constraintOrientation() != Qt::Horizontal) { + if (constraintOrientation() != Qt::Horizontal) { //We might have items whose width depends on their height ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as //constraints to find the row heights q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), - 0, q_totalBoxes[Hor]); + 0, q_totalBoxes[Hor], q_infos[Hor] ); ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, q_xx.data(), q_widths.data(), Qt::Vertical); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), - q_descents.data(), q_totalBoxes[Ver]); + q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]); } else { //We have items whose height depends on their width ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as //constraints to find the column widths q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), - q_descents.data(), q_totalBoxes[Ver]); + q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]); ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, q_yy.data(), q_heights.data(), Qt::Horizontal); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), - 0, q_totalBoxes[Hor]); + 0, q_totalBoxes[Hor], q_infos[Hor]); } } diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h index 7c77b2a..1016bc8 100644 --- a/src/gui/graphicsview/qgridlayoutengine_p.h +++ b/src/gui/graphicsview/qgridlayoutengine_p.h @@ -224,13 +224,16 @@ public: typedef QMap<QPair<int, int>, QGridLayoutMultiCellData> MultiCellMap; +class QGridLayoutRowInfo; + class QGridLayoutRowData { public: void reset(int count); - void distributeMultiCells(); + void distributeMultiCells(const QGridLayoutRowInfo &rowInfo); void calculateGeometries(int start, int end, qreal targetSize, qreal *positions, qreal *sizes, - qreal *descents, const QGridLayoutBox &totalBox); + qreal *descents, const QGridLayoutBox &totalBox, + const QGridLayoutRowInfo &rowInfo); QGridLayoutBox totalBox(int start, int end) const; void stealBox(int start, int end, int which, qreal *positions, qreal *sizes); diff --git a/src/gui/gui.pro b/src/gui/gui.pro index f7228dc..11a25e2 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -64,13 +64,12 @@ symbian { neon:*-g++* { DEFINES += QT_HAVE_NEON - QMAKE_CXXFLAGS *= -mfpu=neon HEADERS += $$NEON_HEADERS SOURCES += $$NEON_SOURCES DRAWHELPER_NEON_ASM_FILES = $$NEON_ASM - neon_compiler.commands = $$QMAKE_CXX -c + neon_compiler.commands = $$QMAKE_CXX -c -mfpu=neon neon_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} neon_compiler.dependency_type = TYPE_C neon_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 0f7872e..c154740 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -256,6 +256,8 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* case QImage::Format_ARGB4444_Premultiplied: cgflags = kCGImageAlphaPremultipliedFirst; break; + default: + break; } #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 1dab738..49f780c 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1053,7 +1053,12 @@ const QString qt_reg_winclass(QWidget *w) // register window class if (winclassNames()->contains(cname)) // already registered in our list return cname; +#ifndef Q_WS_WINCE + WNDCLASSEX wc; + wc.cbSize = sizeof(WNDCLASSEX); +#else WNDCLASS wc; +#endif wc.style = style; wc.lpfnWndProc = (WNDPROC)QtWndProc; wc.cbClsExtra = 0; @@ -1062,11 +1067,20 @@ const QString qt_reg_winclass(QWidget *w) // register window class if (icon) { wc.hIcon = (HICON)LoadImage(qWinAppInst(), L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); #ifndef Q_WS_WINCE - if (!wc.hIcon) + if (wc.hIcon) { + int sw = GetSystemMetrics(SM_CXSMICON); + int sh = GetSystemMetrics(SM_CYSMICON); + wc.hIconSm = (HICON)LoadImage(qWinAppInst(), L"IDI_ICON1", IMAGE_ICON, sw, sh, 0); + } else { wc.hIcon = (HICON)LoadImage(0, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED); + wc.hIconSm = 0; + } #endif } else { wc.hIcon = 0; +#ifndef Q_WS_WINCE + wc.hIconSm = 0; +#endif } wc.hCursor = 0; #ifndef Q_WS_WINCE @@ -1080,7 +1094,11 @@ const QString qt_reg_winclass(QWidget *w) // register window class wc.lpszMenuName = 0; wc.lpszClassName = (wchar_t*)cname.utf16(); +#ifndef Q_WS_WINCE + ATOM atom = RegisterClassEx(&wc); +#else ATOM atom = RegisterClass(&wc); +#endif #ifndef QT_NO_DEBUG if (!atom) @@ -3289,7 +3307,7 @@ bool QETWidget::translateMouseEvent(const MSG &msg) if (type == QEvent::MouseButtonPress && QApplication::activePopupWidget() != activePopupWidget && replayPopupMouseEvent) { - // the popup dissappeared. Replay the event + // the popup disappeared. Replay the event QWidget* w = QApplication::widgetAt(gpos.x, gpos.y); if (w && !QApplicationPrivate::isBlockedByModal(w)) { Q_ASSERT(w->testAttribute(Qt::WA_WState_Created)); @@ -3526,7 +3544,7 @@ static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab) } #endif // QT_NO_TABLETEVENT -// Update the "dynamic" informations of a cursor device (pen, airbrush, etc). +// Update the "dynamic" information of a cursor device (pen, airbrush, etc). // The dynamic information is the information of QTabletDeviceData that can change // in time (eraser or pen if a device is turned around). #ifndef QT_NO_TABLETEVENT diff --git a/src/gui/kernel/qclipboard_mac.cpp b/src/gui/kernel/qclipboard_mac.cpp index 49a6cc8..482a3a3 100644 --- a/src/gui/kernel/qclipboard_mac.cpp +++ b/src/gui/kernel/qclipboard_mac.cpp @@ -623,7 +623,7 @@ QMacPasteboard::sync() const #ifdef DEBUG_PASTEBOARD if(fromGlobal) - qDebug("Pasteboard: Syncronize!"); + qDebug("Pasteboard: Synchronize!"); #endif return fromGlobal; } diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm index 9b07d64..036cb3b 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm @@ -78,6 +78,7 @@ #import <private/qcocoaapplicationdelegate_mac_p.h> #import <private/qcocoamenuloader_mac_p.h> +#import <private/qcocoaapplication_mac_p.h> #include <private/qapplication_p.h> #include <private/qt_mac_p.h> #include <private/qt_cocoa_helpers_mac_p.h> @@ -173,7 +174,7 @@ static void cleanupCocoaApplicationDelegate() qtMenuLoader = menuLoader; } -- (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader; +- (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader { return [[qtMenuLoader retain] autorelease]; } @@ -256,7 +257,7 @@ static void cleanupCocoaApplicationDelegate() onApplicationChangedActivation(true); } -- (void)applicationDidResignActive:(NSNotification *)notification; +- (void)applicationDidResignActive:(NSNotification *)notification { if (reflectionDelegate && [reflectionDelegate respondsToSelector:@selector(applicationDidResignActive:)]) diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm index b963b3c..d351831 100644 --- a/src/gui/kernel/qcocoamenuloader_mac.mm +++ b/src/gui/kernel/qcocoamenuloader_mac.mm @@ -170,12 +170,12 @@ QT_USE_NAMESPACE return [[aboutQtItem retain] autorelease]; } -- (NSMenuItem *)hideMenuItem; +- (NSMenuItem *)hideMenuItem { return [[hideItem retain] autorelease]; } -- (NSMenuItem *)appSpecificMenuItem; +- (NSMenuItem *)appSpecificMenuItem { // Create an App-Specific menu item, insert it into the menu and return // it as an autorelease item. diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index dfcc2e6..e02cf11 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -302,7 +302,6 @@ static int qCocoaViewCount = 0; QMimeData *mimeData = dropData; if (QDragManager::self()->source()) mimeData = QDragManager::self()->dragPrivate()->data; - NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; QPoint posDrag(localPoint.x, localPoint.y); NSDragOperation nsActions = [sender draggingSourceOperationMask]; @@ -365,7 +364,6 @@ static int qCocoaViewCount = 0; return NSDragOperationNone; } // return last value, if we are still in the answerRect. - NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; NSDragOperation nsActions = [sender draggingSourceOperationMask]; QPoint posDrag(localPoint.x, localPoint.y); @@ -434,7 +432,6 @@ static int qCocoaViewCount = 0; dragEnterSequence = -1; [self addDropData:sender]; - NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; QPoint posDrop(localPoint.x, localPoint.y); @@ -470,14 +467,14 @@ static int qCocoaViewCount = 0; [super dealloc]; } -- (BOOL)isOpaque; +- (BOOL)isOpaque { if (!qwidgetprivate) return [super isOpaque]; return qwidgetprivate->isOpaque; } -- (BOOL)isFlipped; +- (BOOL)isFlipped { return YES; } @@ -557,6 +554,7 @@ static int qCocoaViewCount = 0; } CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; + CGContextRetain(cg); qwidgetprivate->hd = cg; // We steal the CGContext for flushing in the unified toolbar with the raster engine. @@ -620,8 +618,8 @@ static int qCocoaViewCount = 0; // is the case. This makes sure child widgets are drawn as well, Cocoa does not know about // those and wont send them drawRect calls. if (qwidget->testAttribute(Qt::WA_NativeWindow) && qt_widget_private(qwidget)->hasAlienChildren == false) { - if (engine && !qwidget->testAttribute(Qt::WA_NoSystemBackground) - && (qwidget->isWindow() || qwidget->autoFillBackground()) + if ((engine && !qwidget->testAttribute(Qt::WA_NoSystemBackground) + && (qwidget->isWindow() || qwidget->autoFillBackground())) || qwidget->testAttribute(Qt::WA_TintedBackground) || qwidget->testAttribute(Qt::WA_StyledBackground)) { #ifdef DEBUG_WIDGET_PAINT @@ -656,6 +654,7 @@ static int qCocoaViewCount = 0; } qwidgetprivate->hd = 0; CGContextRestoreGState(cg); + CGContextRelease(cg); } - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent @@ -978,32 +977,32 @@ static int qCocoaViewCount = 0; } #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 -- (void)touchesBeganWithEvent:(NSEvent *)event; +- (void)touchesBeganWithEvent:(NSEvent *)event { bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all)); } -- (void)touchesMovedWithEvent:(NSEvent *)event; +- (void)touchesMovedWithEvent:(NSEvent *)event { bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all)); } -- (void)touchesEndedWithEvent:(NSEvent *)event; +- (void)touchesEndedWithEvent:(NSEvent *)event { bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all)); } -- (void)touchesCancelledWithEvent:(NSEvent *)event; +- (void)touchesCancelledWithEvent:(NSEvent *)event { bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all)); } #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 -- (void)magnifyWithEvent:(NSEvent *)event; +- (void)magnifyWithEvent:(NSEvent *)event { if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) return; @@ -1018,7 +1017,7 @@ static int qCocoaViewCount = 0; #endif // QT_NO_GESTURES } -- (void)rotateWithEvent:(NSEvent *)event; +- (void)rotateWithEvent:(NSEvent *)event { if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) return; @@ -1033,7 +1032,7 @@ static int qCocoaViewCount = 0; #endif // QT_NO_GESTURES } -- (void)swipeWithEvent:(NSEvent *)event; +- (void)swipeWithEvent:(NSEvent *)event { if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) return; @@ -1055,7 +1054,7 @@ static int qCocoaViewCount = 0; #endif // QT_NO_GESTURES } -- (void)beginGestureWithEvent:(NSEvent *)event; +- (void)beginGestureWithEvent:(NSEvent *)event { if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) return; @@ -1069,7 +1068,7 @@ static int qCocoaViewCount = 0; #endif // QT_NO_GESTURES } -- (void)endGestureWithEvent:(NSEvent *)event; +- (void)endGestureWithEvent:(NSEvent *)event { if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) return; @@ -1609,7 +1608,6 @@ Qt::DropAction QDragManager::drag(QDrag *o) dndParams.localPoint.y + pix.height() - hotspot.y()}; NSSize mouseOffset = {0.0, 0.0}; NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; - NSPoint windowPoint = [dndParams.theEvent locationInWindow]; dragPrivate()->executed_action = Qt::ActionMask; // do the drag [dndParams.view retain]; diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm index f1b642b..8d44003 100644 --- a/src/gui/kernel/qcocoawindow_mac.mm +++ b/src/gui/kernel/qcocoawindow_mac.mm @@ -55,7 +55,7 @@ QT_USE_NAMESPACE @implementation NSWindow (QT_MANGLE_NAMESPACE(QWidgetIntegration)) -- (id)QT_MANGLE_NAMESPACE(qt_initWithQWidget):(QWidget*)widget contentRect:(NSRect)rect styleMask:(NSUInteger)mask; +- (id)QT_MANGLE_NAMESPACE(qt_initWithQWidget):(QWidget*)widget contentRect:(NSRect)rect styleMask:(NSUInteger)mask { self = [self initWithContentRect:rect styleMask:mask backing:NSBackingStoreBuffered defer:YES]; if (self) { diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index ffba6c2..6ce7b35 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -138,7 +138,7 @@ static void cleanupCocoaWindowDelegate() } } -- (void)dumpMaximizedStateforWidget:(QWidget*)qwidget window:(NSWindow *)window; +- (void)dumpMaximizedStateforWidget:(QWidget*)qwidget window:(NSWindow *)window { if (!window) return; // Nothing to do. diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index d2b2098..5633cb8 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1970,7 +1970,7 @@ void QInputMethodEvent::setCommitString(const QString &commitString, int replace is usually given by a wheel on 4D mouse. If the device does not support a Z-axis, pass zero here. - The \a tangentialPressure paramater contins the tangential pressure of an air + The \a tangentialPressure parameter contins the tangential pressure of an air brush. If the device does not support tangential pressure, pass 0 here. \a rotation contains the device's rotation in degrees. 4D mice support diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 5f1bb85..136fb51 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -175,9 +175,9 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ m_activeGestures.remove(g); m_gestureOwners.remove(g); m_gestureTargets.remove(g); + m_gesturesToDelete.insert(g); } - qDeleteAll(gestures); iter = m_objectGestures.erase(iter); } else { ++iter; @@ -189,7 +189,7 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recognizer, Qt::GestureType type) { // if the widget is being deleted we should be careful not to - // create a new state, as it will create QWeakPointer which doesnt work + // create a new state, as it will create QWeakPointer which doesn't work // from the destructor. if (object->isWidgetType()) { if (static_cast<QWidget *>(object)->d_func()->data.in_destructor) @@ -386,6 +386,11 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *, recycle(gesture); m_gestureTargets.remove(gesture); } + + //Clean up the Gestures + qDeleteAll(m_gesturesToDelete); + m_gesturesToDelete.clear(); + return consumeEventHint; } @@ -448,7 +453,8 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original) void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture) { QGestureRecognizer *recognizer = m_deletedRecognizers.value(gesture); - Q_ASSERT(recognizer); + if(!recognizer) //The Gesture is removed while in the even loop, so the recognizers for this gestures was removed + return; m_deletedRecognizers.remove(gesture); if (m_deletedRecognizers.keys(recognizer).isEmpty()) { // no more active gestures, cleanup! diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h index 0d84b67..92310f5 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -101,7 +101,7 @@ private: NotGesture, MaybeGesture // this means timers are up and waiting for some // more events, and input events are handled by - // gesture recognizer explicitely + // gesture recognizer explicitly } state; struct ObjectGesture @@ -130,6 +130,7 @@ private: QHash<QGestureRecognizer *, QSet<QGesture *> > m_obsoleteGestures; QHash<QGesture *, QGestureRecognizer *> m_deletedRecognizers; + QSet<QGesture *> m_gesturesToDelete; void cleanupGesturesForRemovedRecognizer(QGesture *gesture); QGesture *getState(QObject *widget, QGestureRecognizer *recognizer, diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp index 98b9c4a..5243115 100644 --- a/src/gui/kernel/qguiplatformplugin.cpp +++ b/src/gui/kernel/qguiplatformplugin.cpp @@ -187,7 +187,7 @@ QString QGuiPlatformPlugin::styleName() #endif } -/* return an aditional default palette (only work on X11) */ +/* return an additional default palette (only work on X11) */ QPalette QGuiPlatformPlugin::palette() { #ifdef Q_WS_X11 diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp index 300e5ca..b8f08bf 100644 --- a/src/gui/kernel/qkeymapper_mac.cpp +++ b/src/gui/kernel/qkeymapper_mac.cpp @@ -765,7 +765,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e &handled_event) == false) return handled_event; QString text(ourChar); - /* This is actually wrong - but unfortunatly it is the best that can be + /* This is actually wrong - but unfortunately it is the best that can be done for now because of the Control/Meta mapping problems */ if (modifiers & (Qt::ControlModifier | Qt::MetaModifier) && !qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index b4a360a..33c5f44 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1104,7 +1104,7 @@ QKeySequence QKeySequence::mnemonic(const QString &text) #else found = true; } else { - qWarning("QKeySequence::mnemonic: \"%s\" contains multiple occurences of '&'", qPrintable(text)); + qWarning("QKeySequence::mnemonic: \"%s\" contains multiple occurrences of '&'", qPrintable(text)); #endif } } diff --git a/src/gui/kernel/qsound_s60.cpp b/src/gui/kernel/qsound_s60.cpp index df2830b..accfce2 100644 --- a/src/gui/kernel/qsound_s60.cpp +++ b/src/gui/kernel/qsound_s60.cpp @@ -150,7 +150,7 @@ void QAuServerS60::playCompleted(QAuBucketS60 *bucket, int error) } else { // We don't have a way to inform about errors -> just decrement loops // in order that QSound::isFinished will return true; - while (decLoop(sound)) {} + while (decLoop(sound) > 0) {} if (staticPlayingSounds.removeAll(sound)) delete sound; } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index cd1c9f0..16f64ff 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1690,13 +1690,8 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier } if(oldWinId != id) { - // Do not emit an event when the old winId is destroyed. This only - // happens (a) during widget destruction, and (b) immediately prior - // to creation of a new winId, for example as a result of re-parenting. - if(id != 0) { - QEvent e(QEvent::WinIdChange); - QCoreApplication::sendEvent(q, &e); - } + QEvent e(QEvent::WinIdChange); + QCoreApplication::sendEvent(q, &e); } } @@ -8866,7 +8861,7 @@ void QWidget::mousePressEvent(QMouseEvent *event) QWidget* w; while ((w = QApplication::activePopupWidget()) && w != this){ w->close(); - if (QApplication::activePopupWidget() == w) // widget does not want to dissappear + if (QApplication::activePopupWidget() == w) // widget does not want to disappear w->hide(); // hide at least } if (!rect().contains(event->pos())){ @@ -9335,7 +9330,7 @@ void QWidget::setInputMethodHints(Qt::InputMethodHints hints) #ifndef QT_NO_IM Q_D(QWidget); d->imHints = hints; - // Optimisation to update input context only it has already been created. + // Optimization to update input context only it has already been created. if (d->ic || qApp->d_func()->inputContext) { QInputContext *ic = inputContext(); if (ic) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index fc94616..bcddae5 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2294,7 +2294,10 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin } else { [windowRef setHidesOnDeactivate:NO]; } - [windowRef setHasShadow:YES]; + if (q->testAttribute(Qt::WA_MacNoShadow)) + [windowRef setHasShadow:NO]; + else + [windowRef setHasShadow:YES]; Q_UNUSED(parentWidget); Q_UNUSED(dialog); @@ -2931,7 +2934,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // unless this is an alien widget. ) const bool nonWindowWithCreatedParent = !q->isWindow() && parent->testAttribute(Qt::WA_WState_Created); const bool nativeWidget = q->internalWinId() != 0; - if (wasCreated || nativeWidget && nonWindowWithCreatedParent) { + if (wasCreated || (nativeWidget && nonWindowWithCreatedParent)) { createWinId(); if (q->isWindow()) { #ifndef QT_MAC_USE_COCOA diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 4b35238..6b85391 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -229,6 +229,7 @@ struct QTLWExtra { #endif #elif defined(Q_OS_SYMBIAN) uint inExpose : 1; // Prevents drawing recursion + uint nativeWindowTransparencyEnabled : 1; // Tracks native window transparency #elif defined(Q_WS_QPA) QPlatformWindow *platformWindow; QPlatformWindowFormat platformWindowFormat; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 636b306..13b48e9 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -57,7 +57,7 @@ #include <eikbtgpc.h> #endif -// This is necessary in order to be able to perform delayed invokation on slots +// This is necessary in order to be able to perform delayed invocation on slots // which take arguments of type WId. One example is // QWidgetPrivate::_q_delayedDestroy, which is used to delay destruction of // CCoeControl objects until after the CONE event handler has finished running. @@ -771,17 +771,24 @@ void QWidgetPrivate::s60UpdateIsOpaque() if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground)) return; + createTLExtra(); + RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow()); #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE window->SetSurfaceTransparency(!isOpaque); + extra->topextra->nativeWindowTransparencyEnabled = !isOpaque; #else if (!isOpaque) { const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA)); - if (window->SetTransparencyAlphaChannel() == KErrNone) + if (window->SetTransparencyAlphaChannel() == KErrNone) { window->SetBackgroundColor(TRgb(255, 255, 255, 0)); - } else + extra->topextra->nativeWindowTransparencyEnabled = 1; + } + } else if (extra->topextra->nativeWindowTransparencyEnabled) { window->SetTransparentRegion(TRegionFix<1>()); + extra->topextra->nativeWindowTransparencyEnabled = 0; + } #endif } @@ -940,6 +947,7 @@ void QWidgetPrivate::registerDropSite(bool /* on */) void QWidgetPrivate::createTLSysExtra() { extra->topextra->inExpose = 0; + extra->topextra->nativeWindowTransparencyEnabled = 0; } void QWidgetPrivate::deleteTLSysExtra() diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 9f1b1f8..e6e3bfb 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -1136,7 +1136,7 @@ void QX11EmbedContainer::paintEvent(QPaintEvent *) /*! \internal - Returns wether or not the windows' embedded flag is set. + Returns whether or not the windows' embedded flag is set. */ bool QX11EmbedContainerPrivate::isEmbedded() const { diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp index 976a788..c14e558 100644 --- a/src/gui/painting/qpaintengine_mac.cpp +++ b/src/gui/painting/qpaintengine_mac.cpp @@ -133,8 +133,9 @@ QMacCGContext::QMacCGContext(QPainter *p) CGContextTranslateCTM(context, native.dx(), native.dy()); } + } else { + CGContextRetain(context); } - CGContextRetain(context); } diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 4a6c03f..de59524 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -117,7 +117,7 @@ QFixed QTextureGlyphCache::subPixelPositionForX(QFixed x) const return subPixelPosition; } -void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, +bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions) { #ifdef CACHE_DEBUG @@ -196,7 +196,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const rowHeight = qMax(rowHeight, glyph_height); } if (listItemCoordinates.isEmpty()) - return; + return true; rowHeight += margin * 2 + paddingDoubled; @@ -238,6 +238,8 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const m_cx += c.w + paddingDoubled; ++iter; } + return true; + } void QTextureGlyphCache::fillInPendingGlyphs() @@ -368,11 +370,14 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP } #endif - if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { - QPainter p(&m_image); + if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { + QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()), + qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(), + m_image.format()); + QPainter p(&ref); p.setCompositionMode(QPainter::CompositionMode_Source); - p.fillRect(c.x, c.y, c.w, c.h, QColor(0,0,0,0)); // TODO optimize this - p.drawImage(c.x, c.y, mask); + p.fillRect(0, 0, c.w, c.h, QColor(0,0,0,0)); // TODO optimize this + p.drawImage(0, 0, mask); p.end(); } else if (m_type == QFontEngineGlyphCache::Raster_Mono) { if (mask.depth() > 1) { diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 82aaf0d..4227e9a 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -109,7 +109,7 @@ public: int baseLineY; }; - void populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, + bool populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions); void fillInPendingGlyphs(); @@ -137,7 +137,7 @@ public: QHash<GlyphAndSubPixelPosition, Coord> coords; virtual int maxTextureWidth() const { return QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH; } - virtual int maxTextureHeight() const { return 32768; } + virtual int maxTextureHeight() const { return -1; } QImage textureMapForGlyph(glyph_t g, QFixed subPixelPosition) const; diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index b25757b..ace0a46 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -188,6 +188,8 @@ void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &rgn, const QP // Restore context. CGContextRestoreGState(context); + CGContextRelease(context); + widget->d_func()->cgContext = 0; widget->d_func()->hasOwnContext = false; } diff --git a/src/gui/painting/qwindowsurface_mac.cpp b/src/gui/painting/qwindowsurface_mac.cpp index 1c97ebb..9f24532 100644 --- a/src/gui/painting/qwindowsurface_mac.cpp +++ b/src/gui/painting/qwindowsurface_mac.cpp @@ -82,6 +82,7 @@ void QMacWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint extern CGContextRef qt_mac_graphicsContextFor(QWidget *); CGContextRef context = qt_mac_graphicsContextFor(widget); #endif + CGContextRetain(context); CGContextSaveGState(context); // Flip context. @@ -109,6 +110,7 @@ void QMacWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint #else CGContextFlush(context); #endif + CGContextRelease(context); } void QMacWindowSurface::setGeometry(const QRect &rect) diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index ae73d7d..2b4e125 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -285,6 +285,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi extern CGContextRef qt_mac_graphicsContextFor(QWidget *); CGContextRef context = qt_mac_graphicsContextFor(widget); #endif + CGContextRetain(context); CGContextSaveGState(context); // Flip context. @@ -317,6 +318,8 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi // Restore context. CGContextRestoreGState(context); + CGContextRelease(context); + #endif // Q_WS_MAC diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 3a05f40..9ef2f02 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -1566,8 +1566,7 @@ void QMacStylePrivate::timerEvent(QTimerEvent *) progressBars.removeAt(i); } else { if (QProgressBar *pb = qobject_cast<QProgressBar *>(maybeProgress)) { - if (pb->maximum() == 0 || pb->value() > 0 - && pb->value() < pb->maximum()) { + if (pb->maximum() == 0 || (pb->value() > 0 && pb->value() < pb->maximum())) { if (doAnimate(AquaProgressBar)) pb->update(); } @@ -1948,10 +1947,9 @@ void QMacStyle::unpolish(QWidget* w) rubber->setAttribute(Qt::WA_NoSystemBackground, true); } - if (QFocusFrame *frame = qobject_cast<QFocusFrame *>(w)) { + if (QFocusFrame *frame = qobject_cast<QFocusFrame *>(w)) frame->setAttribute(Qt::WA_NoSystemBackground, true); - frame->setAutoFillBackground(true); - } + QWindowsStyle::unpolish(w); } @@ -3609,7 +3607,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter break; } } - bool stretchTabs = (!verticalTabs && tabRect.height() > 22 || verticalTabs && tabRect.width() > 22); + bool stretchTabs = (!verticalTabs && tabRect.height() > 22) || (verticalTabs && tabRect.width() > 22); switch (tp) { case QStyleOptionTab::Beginning: @@ -4034,7 +4032,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter bdi.version = qt_mac_hitheme_version; bdi.state = kThemeMenuBarNormal; bdi.attributes = 0; - HIRect hirect = qt_hirectForQRect(mi->rect); HIThemeDrawMenuBarBackground(&menuRect, &bdi, cg, kHIThemeOrientationNormal); } @@ -5336,8 +5333,8 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op case SC_GroupBoxCheckBox: { // Cheat and use the smaller font if we need to bool checkable = groupBox->subControls & SC_GroupBoxCheckBox; - bool fontIsSet = (widget && widget->testAttribute(Qt::WA_SetFont) - || !QApplication::desktopSettingsAware()); + bool fontIsSet = (widget && widget->testAttribute(Qt::WA_SetFont)) + || !QApplication::desktopSettingsAware(); int tw; int h; int margin = flat || hasNoText ? 0 : 12; diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 087907f..3326c48 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1438,10 +1438,11 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &voptAdj, widget); QRect textRect = subElementRect(SE_ItemViewItemText, &voptAdj, widget); const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget); - const bool singleSelection = - (itemView->selectionMode() == QAbstractItemView::SingleSelection || - itemView->selectionMode() == QAbstractItemView::NoSelection); - const bool selectItems = (itemView->selectionBehavior() == QAbstractItemView::SelectItems); + + const bool singleSelection = itemView && + ((itemView->selectionMode() == QAbstractItemView::SingleSelection || + itemView->selectionMode() == QAbstractItemView::NoSelection)); + const bool selectItems = itemView && (itemView->selectionBehavior() == QAbstractItemView::SelectItems); // draw themed background for itemview unless background brush has been defined. if (vopt->backgroundBrush == Qt::NoBrush) { @@ -2536,6 +2537,56 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) if (toolBtn->subControls & SC_ToolButtonMenu) sz += QSize(pixelMetric(PM_MenuButtonIndicator), 0); + + //Make toolbuttons in toolbar stretch the whole screen area + if (widget && qobject_cast<const QToolBar *>(widget->parentWidget())) { + const QToolBar *tb = qobject_cast<const QToolBar *>(widget->parentWidget()); + const bool parentCanGrowHorizontally = !(tb->sizePolicy().horizontalPolicy() == QSizePolicy::Fixed || + tb->sizePolicy().horizontalPolicy() == QSizePolicy::Maximum) && tb->orientation() == Qt::Horizontal; + + if (parentCanGrowHorizontally) { + int visibleButtons = 0; + //Make the auto-stretch to happen only for horizontal orientation + if (tb && tb->orientation() == Qt::Horizontal) { + QList<QAction*> actionList = tb->actions(); + for (int i = 0; i < actionList.count(); i++) { + if (actionList.at(i)->isVisible()) + visibleButtons++; + } + } + + if (widget->parentWidget() && visibleButtons > 0) { + QWidget *w = const_cast<QWidget *>(widget); + int toolBarMaxWidth = 0; + int totalMargin = 0; + while (w) { + //honor fixed width parents + if (w->maximumWidth() == w->minimumWidth()) + toolBarMaxWidth = qMax(toolBarMaxWidth, w->maximumWidth()); + if (w->layout() && w->windowType() == Qt::Widget) { + totalMargin += w->layout()->contentsMargins().left() + + w->layout()->contentsMargins().right(); + } + w = w->parentWidget(); + } + totalMargin += 2 * pixelMetric(QStyle::PM_ToolBarFrameWidth); + + if (toolBarMaxWidth == 0) + toolBarMaxWidth = + QApplication::desktop()->availableGeometry(widget->parentWidget()).width(); + //Reduce the margins, toolbar frame, item spacing and internal margin from available area + toolBarMaxWidth -= totalMargin; + + //ensure that buttons are side-by-side and not on top of each other + const int toolButtonWidth = (toolBarMaxWidth / visibleButtons) + - pixelMetric(QStyle::PM_ToolBarItemSpacing) + - pixelMetric(QStyle::PM_ToolBarItemMargin) + //toolbar frame needs to be reduced again, since QToolBarLayout adds it for each toolbar action + - 2 * pixelMetric(QStyle::PM_ToolBarFrameWidth) - 1; + sz.setWidth(qMax(toolButtonWidth, sz.width())); + } + } + } break; case CT_PushButton: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp index 3ebfab2..be8f794 100644 --- a/src/gui/styles/qstyle.cpp +++ b/src/gui/styles/qstyle.cpp @@ -2456,6 +2456,8 @@ QDebug operator<<(QDebug debug, QStyle::State state) qSort(states); debug << states.join(QLatin1String(" | ")); debug << ')'; +#else + Q_UNUSED(state); #endif return debug; } diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp index 4780edf..05ca793 100644 --- a/src/gui/styles/qstyleoption.cpp +++ b/src/gui/styles/qstyleoption.cpp @@ -5483,6 +5483,8 @@ QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType) case QStyleOption::SO_GraphicsItem: debug << "SO_GraphicsItem"; break; } +#else + Q_UNUSED(optionType); #endif return debug; } @@ -5496,6 +5498,8 @@ QDebug operator<<(QDebug debug, const QStyleOption &option) debug << ',' << option.state; debug << ',' << option.rect; debug << ')'; +#else + Q_UNUSED(option); #endif return debug; } diff --git a/src/gui/text/qfontengine_x11.cpp b/src/gui/text/qfontengine_x11.cpp index aee21f6..af2ce98 100644 --- a/src/gui/text/qfontengine_x11.cpp +++ b/src/gui/text/qfontengine_x11.cpp @@ -429,7 +429,7 @@ void QFontEngineXLFD::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFl { int i = glyphs->numGlyphs; XCharStruct *xcs; - // inlined for better perfomance + // inlined for better performance if (!_fs->per_char) { xcs = &_fs->min_bounds; while (i != 0) { diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index cd023cb..56c2b98 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -45,32 +45,29 @@ #include <qurl.h> #include <private/qcore_symbian_p.h> -#include <txtrich.h> // CRichText #include <f32file.h> // TDriveUnit etc +#include <pathinfo.h> // PathInfo + +#ifndef USE_SCHEMEHANDLER +#ifdef Q_WS_S60 +// This flag changes the implementation to use S60 CDcoumentHandler +// instead of apparc when opening the files +#define USE_DOCUMENTHANDLER +#endif + +#include <txtrich.h> // CRichText #include <eikenv.h> // CEikonEnv #include <apgcli.h> // RApaLsSession #include <apgtask.h> // TApaTaskList, TApaTask #include <rsendas.h> // RSendAs #include <rsendasmessage.h> // RSendAsMessage -#ifdef Q_WS_S60 -// This flag changes the implementation to use S60 CDcoumentHandler -// instead of apparch when opening the files -#define USE_DOCUMENTHANDLER +#ifdef USE_DOCUMENTHANDLER +#include <DocumentHandler.h> // CDocumentHandler +#include <AknServerApp.h> #endif - -// copied from miutset.h, so we don't get a dependency into the app layer -const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 - -#ifdef Q_OS_SYMBIAN -# include <pathinfo.h> // PathInfo -# ifdef USE_DOCUMENTHANDLER -# include <DocumentHandler.h> // CDocumentHandler -# include <AknServerApp.h> -# endif -#else -# warning CDocumentHandler requires support for S60 -# undef USE_DOCUMENTHANDLER // Fallback to RApaLsSession based implementation +#else // USE_SCHEMEHANDLER +#include <schemehandler.h> #endif QT_BEGIN_NAMESPACE @@ -79,6 +76,10 @@ _LIT(KCacheSubDir, "Cache\\"); _LIT(KSysBin, "\\Sys\\Bin\\"); _LIT(KBrowserPrefix, "4 " ); _LIT(KFontsDir, "z:\\resource\\Fonts\\"); + +#ifndef USE_SCHEMEHANDLER +// copied from miutset.h, so we don't get a dependency into the app layer +const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 const TUid KUidBrowser = { 0x10008D39 }; template<class R> @@ -137,7 +138,6 @@ private: Q_GLOBAL_STATIC(QS60DocumentHandler, qt_s60_documenthandler); #endif - static void handleMailtoSchemeLX(const QUrl &url) { // this function has many intermingled leaves and throws. Qt and Symbian objects do not have @@ -155,12 +155,10 @@ static void handleMailtoSchemeLX(const QUrl &url) QStringList ccs = cc.split(QLatin1String(","), QString::SkipEmptyParts); QStringList bccs = bcc.split(QLatin1String(","), QString::SkipEmptyParts); - RSendAs sendAs; User::LeaveIfError(sendAs.Connect()); QAutoClose<RSendAs> sendAsCleanup(sendAs); - CSendAsAccounts* accounts = CSendAsAccounts::NewL(); CleanupStack::PushL(accounts); sendAs.AvailableAccountsL(KUidMsgTypeSMTP, *accounts); @@ -249,47 +247,6 @@ static bool handleOtherSchemes(const QUrl &url) return err ? false : true; } -static TDriveUnit exeDrive() -{ - RProcess me; - TFileName processFileName = me.FileName(); - TDriveUnit drive(processFileName); - return drive; -} - -static TDriveUnit writableExeDrive() -{ - TDriveUnit drive = exeDrive(); - if(drive.operator TInt() == EDriveZ) - return TDriveUnit(EDriveC); - return drive; -} - -static TPtrC writableDataRoot() -{ - TDriveUnit drive = exeDrive(); -#ifdef Q_OS_SYMBIAN - switch(drive.operator TInt()){ - case EDriveC: - return PathInfo::PhoneMemoryRootPath(); - break; - case EDriveE: - return PathInfo::MemoryCardRootPath(); - break; - case EDriveZ: - // It is not possible to write on ROM drive -> - // return phone mem root path instead - return PathInfo::PhoneMemoryRootPath(); - break; - default: - return PathInfo::PhoneMemoryRootPath(); - break; - } -#else -#warning No fallback implementation of writableDataRoot() - return 0; -#endif -} static void openDocumentL(const TDesC& aUrl) { @@ -314,13 +271,44 @@ static void openDocumentL(const TDesC& aUrl) #endif } -#ifdef USE_SCHEMEHANDLER +static bool launchWebBrowser(const QUrl &url) +{ + if (!url.isValid()) + return false; + + if (url.scheme() == QLatin1String("mailto")) { + return handleMailtoScheme(url); + } + return handleOtherSchemes( url ); +} + +static bool openDocument(const QUrl &file) +{ + if (!file.isValid()) + return false; + + QString filePath = file.toLocalFile(); + filePath = QDir::toNativeSeparators(filePath); + TPtrC filePathPtr(qt_QString2TPtrC(filePath)); + TRAPD(err, openDocumentL(filePathPtr)); + return err ? false : true; +} + +#else //USE_SCHEMEHANDLER // The schemehandler component only exist in private SDK. This implementation // exist here just for convenience in case that we need to use it later on // The schemehandle based implementation is not yet tested. // The biggest advantage of schemehandler is that it can handle // wide range of schemes and is extensible by plugins +static void handleUrlL(const TDesC& aUrl) +{ + CSchemeHandler* schemeHandler = CSchemeHandler::NewL(aUrl); + CleanupStack::PushL(schemeHandler); + schemeHandler->HandleUrlStandaloneL(); // Process the Url in standalone mode + CleanupStack::PopAndDestroy(); +} + static bool handleUrl(const QUrl &url) { if (!url.isValid()) @@ -332,13 +320,6 @@ static bool handleUrl(const QUrl &url) return err ? false : true; } -static void handleUrlL(const TDesC& aUrl) -{ - CSchemeHandler* schemeHandler = CSchemeHandler::NewL(aUrl); - CleanupStack::PushL(schemeHandler); - schemeHandler->HandleUrlStandaloneL(); // Process the Url in standalone mode - CleanupStack::PopAndDestroy(); -} static bool launchWebBrowser(const QUrl &url) { return handleUrl(url); @@ -346,31 +327,48 @@ static bool launchWebBrowser(const QUrl &url) static bool openDocument(const QUrl &file) { - return handleUrl(url); + return handleUrl(file); } -#endif -static bool launchWebBrowser(const QUrl &url) -{ - if (!url.isValid()) - return false; +#endif //USE_SCHEMEHANDLER - if (url.scheme() == QLatin1String("mailto")) { - return handleMailtoScheme(url); - } - return handleOtherSchemes( url ); +// Common functions to all implementations + +static TDriveUnit exeDrive() +{ + RProcess me; + TFileName processFileName = me.FileName(); + TDriveUnit drive(processFileName); + return drive; } -static bool openDocument(const QUrl &file) +static TDriveUnit writableExeDrive() { - if (!file.isValid()) - return false; + TDriveUnit drive = exeDrive(); + if (drive.operator TInt() == EDriveZ) + return TDriveUnit(EDriveC); + return drive; +} - QString filePath = file.toLocalFile(); - filePath = QDir::toNativeSeparators(filePath); - TPtrC filePathPtr(qt_QString2TPtrC(filePath)); - TRAPD(err, openDocumentL(filePathPtr)); - return err ? false : true; +static TPtrC writableDataRoot() +{ + TDriveUnit drive = exeDrive(); + switch (drive.operator TInt()){ + case EDriveC: + return PathInfo::PhoneMemoryRootPath(); + break; + case EDriveE: + return PathInfo::MemoryCardRootPath(); + break; + case EDriveZ: + // It is not possible to write on ROM drive -> + // return phone mem root path instead + return PathInfo::PhoneMemoryRootPath(); + break; + default: + return PathInfo::PhoneMemoryRootPath(); + break; + } } QString QDesktopServices::storageLocation(StandardLocation type) @@ -395,21 +393,15 @@ QString QDesktopServices::storageLocation(StandardLocation type) break; case MusicLocation: path.Append(writableDataRoot()); -#ifdef Q_OS_SYMBIAN path.Append(PathInfo::SoundsPath()); -#endif break; case MoviesLocation: path.Append(writableDataRoot()); -#ifdef Q_OS_SYMBIAN path.Append(PathInfo::VideosPath()); -#endif break; case PicturesLocation: path.Append(writableDataRoot()); -#ifdef Q_OS_SYMBIAN path.Append(PathInfo::ImagesPath()); -#endif break; case TempLocation: return QDir::tempPath(); diff --git a/src/gui/util/qundostack.cpp b/src/gui/util/qundostack.cpp index 919ac3c..04cfca9 100644 --- a/src/gui/util/qundostack.cpp +++ b/src/gui/util/qundostack.cpp @@ -441,7 +441,7 @@ bool QUndoStackPrivate::checkUndoLimit() /*! Constructs an empty undo stack with the parent \a parent. The - stack will initally be in the clean state. If \a parent is a + stack will initially be in the clean state. If \a parent is a QUndoGroup object, the stack is automatically added to the group. \sa push() diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index af6218a..f125f82 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -43,12 +43,17 @@ embedded|qpa { } symbian { - LIBS += -lsendas2 -letext -lapmime -lplatformenv - contains(QT_CONFIG, s60) { - contains(CONFIG, is_using_gnupoc) { - LIBS += -lcommonui - } else { - LIBS += -lCommonUI + LIBS += -letext -lplatformenv + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + LIBS += -lsendas2 -lapmime + contains(QT_CONFIG, s60) { + contains(CONFIG, is_using_gnupoc) { + LIBS += -lcommonui + } else { + LIBS += -lCommonUI + } } + } else { + DEFINES += USE_SCHEMEHANDLER } } diff --git a/src/gui/widgets/qabstractslider_p.h b/src/gui/widgets/qabstractslider_p.h index 19d1fca..d044131 100644 --- a/src/gui/widgets/qabstractslider_p.h +++ b/src/gui/widgets/qabstractslider_p.h @@ -117,7 +117,7 @@ public: ; } - inline int bound(int val) const { return qMax(minimum, qMin(maximum, val)); } + virtual int bound(int val) const { return qMax(minimum, qMin(maximum, val)); } inline int overflowSafeAdd(int add) const { int newValue = value + add; diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm index b670186..8e7223f 100644 --- a/src/gui/widgets/qcocoamenu_mac.mm +++ b/src/gui/widgets/qcocoamenu_mac.mm @@ -44,6 +44,7 @@ #ifdef QT_MAC_USE_COCOA #import <private/qcocoamenu_mac_p.h> #import <private/qcocoamenuloader_mac_p.h> +#import <private/qcocoaapplication_mac_p.h> #include <private/qt_cocoa_helpers_mac_p.h> #include <private/qapplication_p.h> #include <private/qaction_p.h> @@ -60,6 +61,7 @@ QT_FORWARD_DECLARE_CLASS(QEvent) QT_BEGIN_NAMESPACE extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); //qapplication.cpp +extern NSString *qt_mac_removePrivateUnicode(NSString* string); QT_END_NAMESPACE QT_USE_NAMESPACE @@ -78,7 +80,7 @@ QT_USE_NAMESPACE return self; } -- (void)menu:(NSMenu*)menu willHighlightItem:(NSMenuItem*)item; +- (void)menu:(NSMenu*)menu willHighlightItem:(NSMenuItem*)item { Q_UNUSED(menu); @@ -99,7 +101,7 @@ QT_USE_NAMESPACE } } -- (void)menuWillOpen:(NSMenu*)menu; +- (void)menuWillOpen:(NSMenu*)menu { while (QWidget *popup = QApplication::activePopupWidget()) @@ -109,7 +111,7 @@ QT_USE_NAMESPACE qt_mac_menu_collapseSeparators(menu, qtmenu->separatorsCollapsible()); } -- (void)menuDidClose:(NSMenu*)menu; +- (void)menuDidClose:(NSMenu*)menu { qt_mac_emit_menuSignals(((QT_MANGLE_NAMESPACE(QCocoaMenu) *)menu)->qmenu, false); if (previousAction) { @@ -157,7 +159,6 @@ QT_USE_NAMESPACE // (i.e., fire the menu action). NSMenuItem *whichItem; // Change the private unicode keys to the ones used in setting the "Key Equivalents" - extern NSString *qt_mac_removePrivateUnicode(NSString* string); NSString *characters = qt_mac_removePrivateUnicode([event characters]); if ([self hasShortcut:menu forKey:characters diff --git a/src/gui/widgets/qdial.cpp b/src/gui/widgets/qdial.cpp index a8d739f..bca5019 100644 --- a/src/gui/widgets/qdial.cpp +++ b/src/gui/widgets/qdial.cpp @@ -83,6 +83,7 @@ public: int valueFromPoint(const QPoint &) const; double angle(const QPoint &, const QPoint &) const; void init(); + virtual int bound(int val) const; }; void QDialPrivate::init() @@ -97,6 +98,20 @@ void QDialPrivate::init() #endif } +int QDialPrivate::bound(int val) const +{ + if (wrapping) { + if ((val >= minimum) && (val <= maximum)) + return val; + val = minimum + ((val - minimum) % (maximum - minimum)); + if (val < minimum) + val += maximum - minimum; + return val; + } else { + return QAbstractSliderPrivate::bound(val); + } +} + /*! Initialize \a option with the values from this QDial. This method is useful for subclasses when they need a QStyleOptionSlider, but don't want diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index 4541730..6b3f444 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -773,7 +773,7 @@ Qt::Alignment QTextEdit::alignment() const is the document's parent object. The parent object of the provided document remains the owner of the object. - If the current document is a child of the text editor, then it is deleted. + The editor does not delete the current document, even if it is a child of the editor. \sa document() */ diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index 25622a4..3617d24 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -63,7 +63,9 @@ QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode device = QLatin1String(dev); this->mode = mode; +#if (SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) checkSurround(); +#endif } QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() @@ -394,9 +396,11 @@ void QAudioDeviceInfoInternal::updateLists() } channelz.append(1); channelz.append(2); +#if (SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) if (surround40) channelz.append(4); if (surround51) channelz.append(6); if (surround71) channelz.append(8); +#endif sizez.append(8); sizez.append(16); sizez.append(32); @@ -494,6 +498,7 @@ QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() return devices.first(); } +#if (SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) void QAudioDeviceInfoInternal::checkSurround() { QList<QByteArray> devices; @@ -534,5 +539,6 @@ void QAudioDeviceInfoInternal::checkSurround() } snd_device_name_free_hint(hints); } +#endif QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h index 8525980..5f7e5e8 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h @@ -98,10 +98,12 @@ private: bool open(); void close(); +#if (SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) void checkSurround(); bool surround40; bool surround51; bool surround71; +#endif QString device; QAudio::Mode mode; diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp index 669f9cf..3eb2f3b 100644 --- a/src/network/access/qhttpnetworkheader.cpp +++ b/src/network/access/qhttpnetworkheader.cpp @@ -60,7 +60,17 @@ QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QHttpNetworkHeaderPri qint64 QHttpNetworkHeaderPrivate::contentLength() const { bool ok = false; - QByteArray value = headerField("content-length"); + // We are not using the headerField() method here because servers might send us multiple content-length + // headers which is crap (see QTBUG-15311). Therefore just take the first content-length header field. + QByteArray value; + QList<QPair<QByteArray, QByteArray> >::ConstIterator it = fields.constBegin(), + end = fields.constEnd(); + for ( ; it != end; ++it) + if (qstricmp("content-length", it->first) == 0) { + value = it->second; + break; + } + qint64 length = value.toULongLong(&ok); if (ok) return length; diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index deb678a..647eecb 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -899,10 +899,16 @@ void QNetworkHeadersPrivate::parseAndSetHeader(const QByteArray &key, const QByt // is it a known header? QNetworkRequest::KnownHeaders parsedKey = parseHeaderName(key); if (parsedKey != QNetworkRequest::KnownHeaders(-1)) { - if (value.isNull()) + if (value.isNull()) { cookedHeaders.remove(parsedKey); - else + } else if (parsedKey == QNetworkRequest::ContentLengthHeader + && cookedHeaders.contains(QNetworkRequest::ContentLengthHeader)) { + // Only set the cooked header "Content-Length" once. + // See bug QTBUG-15311 + } else { cookedHeaders.insert(parsedKey, parseHeaderValue(parsedKey, value)); + } + } } diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 426b07a..99b5a95 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -81,9 +81,6 @@ QT_BEGIN_NAMESPACE bool QSslSocketPrivate::s_libraryLoaded = false; bool QSslSocketPrivate::s_loadedCiphersAndCerts = false; -// Useful defines -#define SSL_ERRORSTR() QString::fromLocal8Bit(q_ERR_error_string(q_ERR_get_error(), NULL)) - /* \internal From OpenSSL's thread(3) manual page: @@ -273,7 +270,7 @@ init_context: } // ### Bad error code - q->setErrorString(QSslSocket::tr("Error creating SSL context (%1)").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Error creating SSL context (%1)").arg(getErrorsFromOpenSsl())); q->setSocketError(QAbstractSocket::UnknownSocketError); emit q->error(QAbstractSocket::UnknownSocketError); return false; @@ -298,7 +295,7 @@ init_context: if (!q_SSL_CTX_set_cipher_list(ctx, cipherString.data())) { // ### Bad error code - q->setErrorString(QSslSocket::tr("Invalid or empty cipher list (%1)").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Invalid or empty cipher list (%1)").arg(getErrorsFromOpenSsl())); q->setSocketError(QAbstractSocket::UnknownSocketError); emit q->error(QAbstractSocket::UnknownSocketError); return false; @@ -326,14 +323,14 @@ init_context: if (!configuration.localCertificate.isNull()) { // Require a private key as well. if (configuration.privateKey.isNull()) { - q->setErrorString(QSslSocket::tr("Cannot provide a certificate with no key, %1").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Cannot provide a certificate with no key, %1").arg(getErrorsFromOpenSsl())); emit q->error(QAbstractSocket::UnknownSocketError); return false; } // Load certificate if (!q_SSL_CTX_use_certificate(ctx, (X509 *)configuration.localCertificate.handle())) { - q->setErrorString(QSslSocket::tr("Error loading local certificate, %1").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Error loading local certificate, %1").arg(getErrorsFromOpenSsl())); emit q->error(QAbstractSocket::UnknownSocketError); return false; } @@ -348,14 +345,14 @@ init_context: else q_EVP_PKEY_set1_DSA(pkey, (DSA *)configuration.privateKey.handle()); if (!q_SSL_CTX_use_PrivateKey(ctx, pkey)) { - q->setErrorString(QSslSocket::tr("Error loading private key, %1").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Error loading private key, %1").arg(getErrorsFromOpenSsl())); emit q->error(QAbstractSocket::UnknownSocketError); return false; } // Check if the certificate matches the private key. if (!q_SSL_CTX_check_private_key(ctx)) { - q->setErrorString(QSslSocket::tr("Private key does not certify public key, %1").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Private key does not certify public key, %1").arg(getErrorsFromOpenSsl())); emit q->error(QAbstractSocket::UnknownSocketError); return false; } @@ -375,7 +372,7 @@ init_context: // Create and initialize SSL session if (!(ssl = q_SSL_new(ctx))) { // ### Bad error code - q->setErrorString(QSslSocket::tr("Error creating SSL session, %1").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Error creating SSL session, %1").arg(getErrorsFromOpenSsl())); q->setSocketError(QAbstractSocket::UnknownSocketError); emit q->error(QAbstractSocket::UnknownSocketError); return false; @@ -390,7 +387,7 @@ init_context: writeBio = q_BIO_new(q_BIO_s_mem()); if (!readBio || !writeBio) { // ### Bad error code - q->setErrorString(QSslSocket::tr("Error creating SSL session: %1").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Error creating SSL session: %1").arg(getErrorsFromOpenSsl())); q->setSocketError(QAbstractSocket::UnknownSocketError); emit q->error(QAbstractSocket::UnknownSocketError); return false; @@ -659,8 +656,16 @@ TInt CSymbianCertificateRetriever::ThreadEntryPoint(TAny* aParams) void CSymbianCertificateRetriever::ConstructL() { - User::LeaveIfError(iThread.Create(_L("CertWorkerThread"), - CSymbianCertificateRetriever::ThreadEntryPoint, 16384, NULL, this)); + TInt err; + int i=0; + QString name(QLatin1String("CertWorkerThread-%1")); + //recently closed thread names remain in use for a while until all handles have been closed + //including users of RUndertaker + do { + err = iThread.Create(qt_QString2TPtrC(name.arg(i++)), + CSymbianCertificateRetriever::ThreadEntryPoint, 16384, NULL, this); + } while (err == KErrAlreadyExists); + User::LeaveIfError(err); } void CSymbianCertificateRetriever::DoCancel() @@ -731,7 +736,7 @@ void CSymbianCertificateRetriever::RunL() if (iStatus.Int() == KErrNone) iCertificates->append(iCertificateData); else - qWarning() << "CSymbianCertificateRetriever: failed to retreive a certificate, error " << iStatus.Int(); + qWarning() << "CSymbianCertificateRetriever: failed to retrieve a certificate, error " << iStatus.Int(); GetCertificateL(); break; } @@ -835,6 +840,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() systemCerts.append(QSslCertificate::fromPath(it.next())); } systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/pki/tls/certs/ca-bundle.crt"), QSsl::Pem)); // Fedora, Mandriva + systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/share/certs/ca-root-nss.crt"), QSsl::Pem)); // FreeBSD's ca_root_nss #elif defined(Q_OS_SYMBIAN) QList<QByteArray> certs; @@ -911,7 +917,7 @@ void QSslSocketBackendPrivate::transmit() int writtenBytes = q_SSL_write(ssl, writeBuffer.readPointer(), nextDataBlockSize); if (writtenBytes <= 0) { // ### Better error handling. - q->setErrorString(QSslSocket::tr("Unable to write data: %1").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Unable to write data: %1").arg(getErrorsFromOpenSsl())); q->setSocketError(QAbstractSocket::UnknownSocketError); emit q->error(QAbstractSocket::UnknownSocketError); return; @@ -974,7 +980,7 @@ void QSslSocketBackendPrivate::transmit() plainSocket->read(data.data(), writtenToBio); } else { // ### Better error handling. - q->setErrorString(QSslSocket::tr("Unable to decrypt data: %1").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Unable to decrypt data: %1").arg(getErrorsFromOpenSsl())); q->setSocketError(QAbstractSocket::UnknownSocketError); emit q->error(QAbstractSocket::UnknownSocketError); return; @@ -1052,7 +1058,7 @@ void QSslSocketBackendPrivate::transmit() 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->setErrorString(QSslSocket::tr("Error while reading: %1").arg(getErrorsFromOpenSsl())); q->setSocketError(QAbstractSocket::UnknownSocketError); emit q->error(QAbstractSocket::UnknownSocketError); return; @@ -1062,7 +1068,7 @@ void QSslSocketBackendPrivate::transmit() // 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->setErrorString(QSslSocket::tr("Error while reading: %1").arg(getErrorsFromOpenSsl())); q->setSocketError(QAbstractSocket::UnknownSocketError); emit q->error(QAbstractSocket::UnknownSocketError); break; @@ -1157,8 +1163,7 @@ bool QSslSocketBackendPrivate::startHandshake() // The handshake is not yet complete. break; default: - // ### Handle errors better - q->setErrorString(QSslSocket::tr("Error during SSL handshake: %1").arg(SSL_ERRORSTR())); + q->setErrorString(QSslSocket::tr("Error during SSL handshake: %1").arg(getErrorsFromOpenSsl())); q->setSocketError(QAbstractSocket::SslHandshakeFailedError); #ifdef QSSLSOCKET_DEBUG qDebug() << "QSslSocketBackendPrivate::startHandshake: error!" << q->errorString(); @@ -1334,6 +1339,19 @@ QList<QSslCertificate> QSslSocketBackendPrivate::STACKOFX509_to_QSslCertificates return certificates; } +QString QSslSocketBackendPrivate::getErrorsFromOpenSsl() +{ + QString errorString; + unsigned long errNum; + while((errNum = q_ERR_get_error())) { + if (! errorString.isEmpty()) + errorString.append(QLatin1String(", ")); + const char *error = q_ERR_error_string(errNum, NULL); + errorString.append(QString::fromAscii(error)); // error is ascii according to man ERR_error_string + } + return errorString; +} + bool QSslSocketBackendPrivate::isMatchingHostname(const QString &cn, const QString &hostname) { int wildcard = cn.indexOf(QLatin1Char('*')); diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h index b59a6c9..878c654 100644 --- a/src/network/ssl/qsslsocket_openssl_p.h +++ b/src/network/ssl/qsslsocket_openssl_p.h @@ -117,6 +117,7 @@ public: static QSslCipher QSslCipher_from_SSL_CIPHER(SSL_CIPHER *cipher); static QList<QSslCertificate> STACKOFX509_to_QSslCertificates(STACK_OF(X509) *x509); Q_AUTOTEST_EXPORT static bool isMatchingHostname(const QString &cn, const QString &hostname); + static QString getErrorsFromOpenSsl(); }; #if defined(Q_OS_SYMBIAN) diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index a7ece0f..0d30f9a 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -340,12 +340,7 @@ static const char* const qglslImageSrcFragmentShader = "\n\ uniform lowp sampler2D imageTexture; \n\ lowp vec4 srcPixel() \n\ { \n" -#ifdef QT_OPENGL_ES_2 - // work-around for driver bug - "return 1.0 * texture2D(imageTexture, textureCoords); \n" -#else "return texture2D(imageTexture, textureCoords); \n" -#endif "}\n"; static const char* const qglslCustomSrcFragmentShader = "\n\ diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 85e4eab..735aab1 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1241,6 +1241,9 @@ void QGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &pen) stroker.process(dashStroke, pen, clip); } + if (!stroker.vertexCount()) + return; + if (opaque) { prepareForDraw(opaque); setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, stroker.vertices()); @@ -1510,6 +1513,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform()); staticTextItem->fontEngine()->setGlyphCache(cacheKey, cache); cache->insert(ctx, cache); + } else if (cache->context() == 0) { // Old context has been destroyed, new context has same ptr value + cache->setContext(ctx); } bool recreateVertexArrays = false; diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 7954d77..538b09e 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -55,7 +55,7 @@ extern Q_GUI_EXPORT bool qt_cleartype_enabled; QGLTextureGlyphCache::QGLTextureGlyphCache(const QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix) : QImageTextureGlyphCache(type, matrix), QGLContextGroupResourceBase() - , ctx(context) + , ctx(0) , pex(0) , m_blitProgram(0) , m_filterMode(Nearest) @@ -89,7 +89,6 @@ QGLTextureGlyphCache::~QGLTextureGlyphCache() #ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG qDebug(" -> ~QGLTextureGlyphCache() %p.", this); #endif - delete m_blitProgram; } diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp index 85f604a..75d5ce2 100644 --- a/src/opengl/gl2paintengineex/qtriangulator.cpp +++ b/src/opengl/gl2paintengineex/qtriangulator.cpp @@ -339,7 +339,7 @@ static inline qint64 qPointDistanceFromLine(const QPodPoint &p, const QPodPoint static inline bool qPointIsLeftOfLine(const QPodPoint &p, const QPodPoint &v1, const QPodPoint &v2) { - return qPointDistanceFromLine(p, v1, v2) < 0; + return QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(p, v1, v2) < 0; } // Return: @@ -1741,7 +1741,7 @@ bool QTriangulator<T>::ComplexToSimple::calculateIntersection(int left, int righ Intersection intersection; intersection.leftEdge = left; intersection.rightEdge = right; - intersection.intersectionPoint = qIntersectionPoint(u1, u2, v1, v2); + intersection.intersectionPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(u1, u2, v1, v2); if (!intersection.intersectionPoint.isValid()) return false; @@ -1767,10 +1767,10 @@ bool QTriangulator<T>::ComplexToSimple::edgeIsLeftOfEdge(int leftEdgeIndex, int return true; if (upper.x > qMax(l.x, u.x)) return false; - qint64 d = qPointDistanceFromLine(upper, l, u); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(upper, l, u); // d < 0: left, d > 0: right, d == 0: on top if (d == 0) - d = qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.lower()), l, u); + d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(leftEdge.lower()), l, u); return d < 0; } @@ -1814,7 +1814,7 @@ QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); if (d == 0) { result.first = result.second = current; break; @@ -1828,7 +1828,7 @@ QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d >= 0); if (d == 0) { result.first = current; @@ -1842,7 +1842,7 @@ QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d <= 0); if (d == 0) { result.second = current; @@ -1864,7 +1864,7 @@ QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); if (d == 0) break; if (d < 0) { @@ -1885,7 +1885,7 @@ QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d >= 0); if (d == 0) { current = current->left; @@ -1899,7 +1899,7 @@ QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d <= 0); if (d == 0) { current = current->right; @@ -1962,7 +1962,7 @@ void QTriangulator<T>::ComplexToSimple::reorderEdgeListRange(QRBTree<int>::Node template <typename T> void QTriangulator<T>::ComplexToSimple::sortEdgeList(const QPodPoint eventPoint) { - QIntersectionPoint eventPoint2 = qIntersectionPoint(eventPoint); + QIntersectionPoint eventPoint2 = QT_PREPEND_NAMESPACE(qIntersectionPoint)(eventPoint); while (!m_topIntersection.isEmpty() && m_topIntersection.top().intersectionPoint < eventPoint2) { Intersection intersection = m_topIntersection.pop(); @@ -2056,7 +2056,7 @@ void QTriangulator<T>::ComplexToSimple::calculateIntersections() QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> range = bounds(event.point); QRBTree<int>::Node *leftNode = range.first ? m_edgeList.previous(range.first) : 0; int vertex = (event.type == Event::Upper ? m_edges.at(event.edge).upper() : m_edges.at(event.edge).lower()); - QIntersectionPoint eventPoint = qIntersectionPoint(event.point); + QIntersectionPoint eventPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point); if (range.first != 0) { splitEdgeListRange(range.first, range.second, vertex, eventPoint); @@ -2213,7 +2213,7 @@ void QTriangulator<T>::ComplexToSimple::removeUnwantedEdgesAndConnect() while (current != b.second) { Q_ASSERT(current); Q_ASSERT(m_edges.at(current->data).node == current); - Q_ASSERT(qIntersectionPoint(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(m_edges.at(current->data).to))); + Q_ASSERT(QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(m_edges.at(current->data).to))); Q_ASSERT(m_parent->m_vertices.at(m_edges.at(current->data).from) == event.point || m_parent->m_vertices.at(m_edges.at(current->data).to) == event.point); insertEdgeIntoVectorIfWanted(orderedEdges, current->data); current = m_edgeList.next(current); @@ -2612,10 +2612,10 @@ bool QTriangulator<T>::SimpleToMonotone::edgeIsLeftOfEdge(int leftEdgeIndex, int const Edge &rightEdge = m_edges.at(rightEdgeIndex); const QPodPoint &u = m_parent->m_vertices.at(rightEdge.upper()); const QPodPoint &l = m_parent->m_vertices.at(rightEdge.lower()); - qint64 d = qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.upper()), l, u); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(leftEdge.upper()), l, u); // d < 0: left, d > 0: right, d == 0: on top if (d == 0) - d = qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.lower()), l, u); + d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(leftEdge.lower()), l, u); return d < 0; } @@ -2645,7 +2645,7 @@ QRBTree<int>::Node *QTriangulator<T>::SimpleToMonotone::searchEdgeLeftOfPoint(in while (current) { const QPodPoint &p1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &p2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(m_parent->m_vertices.at(pointIndex), p1, p2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(pointIndex), p1, p2); if (d <= 0) { current = current->left; } else { @@ -2668,7 +2668,7 @@ void QTriangulator<T>::SimpleToMonotone::classifyVertex(int i) const QPodPoint &p1 = m_parent->m_vertices.at(e1.from); const QPodPoint &p2 = m_parent->m_vertices.at(e2.from); const QPodPoint &p3 = m_parent->m_vertices.at(e2.to); - qint64 d = qPointDistanceFromLine(p1, p2, p3); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(p1, p2, p3); Q_ASSERT(d != 0 || (!startOrSplit && !endOrMerge)); e2.type = RegularVertex; diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 8285f06..547e457 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -519,7 +519,8 @@ private slots: // when you come to delete the context. QGLContextPrivate::unbindPixmapFromTexture(boundPixmap); glDeleteTextures(1, &id); - oldContext->makeCurrent(); + if (oldContext) + oldContext->makeCurrent(); return; } #endif diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 8915b5e..a7e81b2 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -202,6 +202,35 @@ int QGLFramebufferObjectFormat::samples() const } /*! + \since 4.8 + + Enables or disables mipmapping. Mipmapping is disabled by default. + If mipmapping is enabled, additional memory will be allocated for + the mipmap levels. The mipmap levels can be updated by binding the + texture and calling glGenerateMipmap(). Mipmapping cannot be enabled + for multisampled framebuffer objects. + + \sa mipmap(), texture() +*/ +void QGLFramebufferObjectFormat::setMipmap(bool enabled) +{ + detach(); + d->mipmap = enabled; +} + +/*! + \since 4.8 + + Returns true if mipmapping is enabled. + + \sa setMipmap() +*/ +bool QGLFramebufferObjectFormat::mipmap() const +{ + return d->mipmap; +} + +/*! Sets the attachment configuration of a framebuffer object to \a attachment. \sa attachment() @@ -398,7 +427,8 @@ bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, QGLFramebufferObject::Attachment attachment, - GLenum texture_target, GLenum internal_format, GLint samples) + GLenum texture_target, GLenum internal_format, + GLint samples, bool mipmap) { QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext()); fbo_guard.setContext(ctx); @@ -426,6 +456,8 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glBindTexture(target, texture); glTexImage2D(target, 0, internal_format, size.width(), size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + if (mipmap) + glGenerateMipmap(GL_TEXTURE_2D); #ifndef QT_OPENGL_ES glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -446,6 +478,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, color_buffer = 0; } else { + mipmap = false; GLint maxSamples; glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples); @@ -606,6 +639,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, format.setSamples(int(samples)); format.setAttachment(fbo_attachment); format.setInternalTextureFormat(internal_format); + format.setMipmap(mipmap); } /*! @@ -777,7 +811,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, const QGLFramebuff { Q_D(QGLFramebufferObject); d->init(this, size, format.attachment(), format.textureTarget(), format.internalTextureFormat(), - format.samples()); + format.samples(), format.mipmap()); } /*! \overload @@ -791,7 +825,7 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, const QGLFrame { Q_D(QGLFramebufferObject); d->init(this, QSize(width, height), format.attachment(), format.textureTarget(), - format.internalTextureFormat(), format.samples()); + format.internalTextureFormat(), format.samples(), format.mipmap()); } #ifdef Q_MAC_COMPAT_GL_FUNCTIONS diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h index 6ff6645..70d6eb2 100644 --- a/src/opengl/qglframebufferobject.h +++ b/src/opengl/qglframebufferobject.h @@ -148,6 +148,9 @@ public: void setSamples(int samples); int samples() const; + void setMipmap(bool enabled); + bool mipmap() const; + void setAttachment(QGLFramebufferObject::Attachment attachment); QGLFramebufferObject::Attachment attachment() const; diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index 58b4e9e..3738780 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -77,7 +77,8 @@ public: samples(0), attachment(QGLFramebufferObject::NoAttachment), target(GL_TEXTURE_2D), - internal_format(DEFAULT_FORMAT) + internal_format(DEFAULT_FORMAT), + mipmap(false) { } QGLFramebufferObjectFormatPrivate @@ -86,7 +87,8 @@ public: samples(other->samples), attachment(other->attachment), target(other->target), - internal_format(other->internal_format) + internal_format(other->internal_format), + mipmap(other->mipmap) { } bool equals(const QGLFramebufferObjectFormatPrivate *other) @@ -94,7 +96,8 @@ public: return samples == other->samples && attachment == other->attachment && target == other->target && - internal_format == other->internal_format; + internal_format == other->internal_format && + mipmap == other->mipmap; } QAtomicInt ref; @@ -102,6 +105,7 @@ public: QGLFramebufferObject::Attachment attachment; GLenum target; GLenum internal_format; + uint mipmap : 1; }; class QGLFBOGLPaintDevice : public QGLPaintDevice @@ -132,7 +136,8 @@ public: void init(QGLFramebufferObject *q, const QSize& sz, QGLFramebufferObject::Attachment attachment, - GLenum internal_format, GLenum texture_target, GLint samples = 0); + GLenum internal_format, GLenum texture_target, + GLint samples = 0, bool mipmap = false); bool checkFramebufferStatus() const; QGLSharedResourceGuard fbo_guard; GLuint texture; diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index aea203f..b8e8bad 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1502,7 +1502,10 @@ void QVGPaintEnginePrivate::fill(VGPath path, const QBrush& brush, VGint rule) return; ensureBrush(brush); setFillRule(rule); + QPen savedPen = currentPen; + currentPen = Qt::NoPen; ensurePathTransform(); + currentPen = savedPen; vgDrawPath(path, VG_FILL_PATH); } @@ -3543,8 +3546,8 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) // Set the glyph drawing origin. VGfloat origin[2]; - origin[0] = positions[0].x.toReal(); - origin[1] = positions[0].y.toReal(); + origin[0] = positions[0].x.round().toReal(); + origin[1] = positions[0].y.round().toReal(); vgSetfv(VG_GLYPH_ORIGIN, 2, origin); // Fast anti-aliasing for paths, better for images. diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 509882b..c3c7def 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -214,7 +214,7 @@ void QVGPixmapData::createPixmapForImage(QImage &image, Qt::ImageConversionFlags else if (!(flags & Qt::NoOpaqueDetection) && const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels()) format = sourceFormat(); else - format = QImage::Format_RGB32; + format = image.hasAlphaChannel() ? sourceFormat() : QImage::Format_RGB32; if (inPlace && image.data_ptr()->convertInPlace(format, flags)) source = image; diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index c5a39e1..53a5b4d 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -1151,10 +1151,10 @@ void QNetworkSessionPrivateImpl::RunL() serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::InvalidConfigurationError; QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError)); - Cancel(); if (ipConnectionNotifier) { ipConnectionNotifier->StopNotifications(); } + Cancel(); QT_TRYCATCH_LEAVING(syncStateWithInterface()); break; case KErrCancel: // Connection attempt cancelled @@ -1173,10 +1173,10 @@ void QNetworkSessionPrivateImpl::RunL() iError = QNetworkSession::UnknownSessionError; } QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError)); - Cancel(); if (ipConnectionNotifier) { ipConnectionNotifier->StopNotifications(); } + Cancel(); QT_TRYCATCH_LEAVING(syncStateWithInterface()); break; } @@ -1268,10 +1268,10 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::SessionAbortedError; emit QNetworkSessionPrivate::error(iError); - Cancel(); if (ipConnectionNotifier) { ipConnectionNotifier->StopNotifications(); } + Cancel(); // Start handling IAP state change signals from QNetworkConfigurationManagerPrivate iHandleStateNotificationsFromManager = true; emitSessionClosed = true; // Emit SessionClosed after state change has been reported diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index b4dfc4d..f025d86 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -135,10 +135,9 @@ void SymbianEngine::initialize() updateConfigurations(); updateStatesToSnaps(); - updateAvailableAccessPoints(); // On first time updates synchronously (without WLAN scans) + updateAvailableAccessPoints(); // On first time updates (without WLAN scans) // Start monitoring IAP and/or SNAP changes in Symbian CommsDB startCommsDatabaseNotifications(); - iFirstUpdate = false; } SymbianEngine::~SymbianEngine() @@ -790,6 +789,12 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn mutex.unlock(); emit updateCompleted(); mutex.lock(); + } else { + iFirstUpdate = false; + if (iScanInQueue) { + iScanInQueue = EFalse; + updateAvailableAccessPoints(); + } } } @@ -1356,27 +1361,39 @@ AccessPointsAvailabilityScanner::~AccessPointsAvailabilityScanner() void AccessPointsAvailabilityScanner::DoCancel() { iConnectionMonitor.CancelAsyncRequest(EConnMonGetPckgAttribute); + iScanActive = EFalse; + iOwner.iScanInQueue = EFalse; } void AccessPointsAvailabilityScanner::StartScanning() { - if (iOwner.iFirstUpdate) { - // On first update (the mgr is being instantiated) update only those bearers who - // don't need time-consuming scans (WLAN). - // Note: EBearerIdWCDMA covers also GPRS bearer - iConnectionMonitor.GetPckgAttribute(EBearerIdWCDMA, 0, KIapAvailability, iIapBuf, iStatus); + if (!iScanActive) { + iScanActive = ETrue; + if (iOwner.iFirstUpdate) { + // On first update (the mgr is being instantiated) update only those bearers who + // don't need time-consuming scans (WLAN). + // Note: EBearerIdWCDMA covers also GPRS bearer + iConnectionMonitor.GetPckgAttribute(EBearerIdWCDMA, 0, KIapAvailability, iIapBuf, iStatus); + } else { + iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus); + } + + if (!IsActive()) { + SetActive(); + } } else { - iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus); + // Queue scan for getting WLAN info after first request returns + if (iOwner.iFirstUpdate) { + iOwner.iScanInQueue = ETrue; + } } - - if (!IsActive()) - SetActive(); } void AccessPointsAvailabilityScanner::RunL() { QMutexLocker locker(&iOwner.mutex); + iScanActive = EFalse; if (iStatus.Int() != KErrNone) { iIapBuf().iCount = 0; QT_TRYCATCH_LEAVING(iOwner.accessPointScanningReady(false,iIapBuf())); diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index 7c1076e..337d4d1 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -207,6 +207,7 @@ private: // Data TBool iInitOk; TBool iUpdateGoingOn; TBool iUpdatePending; + TBool iScanInQueue; AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner; @@ -234,9 +235,10 @@ protected: // From CActive void DoCancel(); private: // Data - SymbianEngine& iOwner; + SymbianEngine& iOwner; RConnectionMonitor& iConnectionMonitor; - TConnMonIapInfoBuf iIapBuf; + TConnMonIapInfoBuf iIapBuf; + TBool iScanActive; }; QT_END_NAMESPACE diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index c16a242..ceed7ae 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -68,6 +68,15 @@ public: Matrix_BlitsUnsupported = (Matrix_NegativeScale|Matrix_RectsUnsupported) }; + inline static uint getTransformationType(const QTransform &transform) + { + int ret = transform.type(); + if (qMin(transform.m11(), transform.m22()) < 0) { + ret |= QDirectFBPaintEnginePrivate::Matrix_NegativeScale; + } + return ret; + } + enum CompositionModeStatus { PorterDuff_None = 0x0, PorterDuff_Supported = 0x1, @@ -99,7 +108,7 @@ public: inline bool isSimpleBrush(const QBrush &brush) const; - void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos); + void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos, const QTransform &pixmapTransform); void blit(const QRectF &dest, IDirectFBSurface *surface, const QRectF &src); inline bool supportsStretchBlit() const; @@ -707,7 +716,8 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap pix(data); QRasterPaintEngine::drawTiledPixmap(r, pix, offset); } else { - CLIPPED_PAINT(d->drawTiledPixmap(r, pixmap, offset)); + QTransform transform(state()->matrix); + CLIPPED_PAINT(d->drawTiledPixmap(r, pixmap, offset, transform)); } } @@ -827,9 +837,14 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) return; } case Qt::TexturePattern: { + const QPointF &brushOrigin = state()->brushOrigin; + const QTransform stateTransform = state()->matrix; + QTransform transform(stateTransform); + transform.translate(brushOrigin.x(), brushOrigin.y()); + transform = brush.transform() * transform; if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) - || (!d->supportsStretchBlit() && state()->matrix.isScaling())) { + || (QDirectFBPaintEnginePrivate::getTransformationType(transform) & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) + || (!d->supportsStretchBlit() && transform.isScaling())) { break; } @@ -837,7 +852,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass) break; - CLIPPED_PAINT(d->drawTiledPixmap(rect, texture, rect.topLeft() - state()->brushOrigin)); + CLIPPED_PAINT(d->drawTiledPixmap(stateTransform.mapRect(rect), texture, rect.topLeft() - brushOrigin, transform)); return; } default: break; @@ -948,10 +963,7 @@ void QDirectFBPaintEnginePrivate::unlock(QDirectFBPaintDevice *device) void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform) { - transformationType = transform.type(); - if (qMin(transform.m11(), transform.m22()) < 0) { - transformationType |= QDirectFBPaintEnginePrivate::Matrix_NegativeScale; - } + transformationType = getTransformationType(transform); setPen(q->state()->pen); } @@ -1153,10 +1165,12 @@ static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset) return pos; } -void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &off) +void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, + const QPointF &off, const QTransform &pixmapTransform) { - Q_ASSERT(!(transformationType & Matrix_BlitsUnsupported)); const QTransform &transform = q->state()->matrix; + Q_ASSERT(!(getTransformationType(transform) & Matrix_BlitsUnsupported) && + !(getTransformationType(pixmapTransform) & Matrix_BlitsUnsupported)); const QRect destinationRect = transform.mapRect(dest).toRect().normalized(); QRect newClip = destinationRect; if (!currentClip.isEmpty()) @@ -1173,7 +1187,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix }; surface->SetClip(surface, &clip); - QPointF offset = off; + QPointF offset = pixmapTransform.inverted().map(off); Q_ASSERT(transform.type() <= QTransform::TxScale); QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); @@ -1187,13 +1201,13 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix prepareForBlit(blitFlags); QDirectFBPaintEnginePrivate::unlock(dfbData); const QSize pixmapSize = dfbData->size(); - if (transform.isScaling()) { + if (transform.isScaling() || pixmapTransform.isScaling()) { Q_ASSERT(supportsStretchBlit()); Q_ASSERT(qMin(transform.m11(), transform.m22()) >= 0); offset.rx() *= transform.m11(); offset.ry() *= transform.m22(); - const QSizeF mappedSize(pixmapSize.width() * transform.m11(), pixmapSize.height() * transform.m22()); + const QSizeF mappedSize(pixmapSize.width() * pixmapTransform.m11(), pixmapSize.height() * pixmapTransform.m22()); qreal y = fixCoord(destinationRect.y(), mappedSize.height(), offset.y()); const qreal startX = fixCoord(destinationRect.x(), mappedSize.width(), offset.x()); while (y <= destinationRect.bottom()) { diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 2eeee24..fbc539b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -344,9 +344,11 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, if (!win) return; +#ifndef QT_NO_QWS_PROXYSCREEN QWExtra *extra = qt_widget_private(widget)->extraData(); if (extra && extra->proxyWidget) return; +#endif const quint8 windowOpacity = quint8(win->windowOpacity() * 0xff); const QRect windowGeometry = geometry(); diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index 063af13..507f70b 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -83,7 +83,7 @@ QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { // Long story short: without this it's possible to hit an - // unitialized paintDevice due to a Qt bug too complex to even + // uninitialized paintDevice due to a Qt bug too complex to even // explain here... not to mention fix without going crazy. // MDK QGLShareContextScope ctx(qt_gl_share_widget()->context()); diff --git a/src/plugins/s60/feedback/feedback.pro b/src/plugins/s60/feedback/feedback.pro index 1069220..5e577ec 100644 --- a/src/plugins/s60/feedback/feedback.pro +++ b/src/plugins/s60/feedback/feedback.pro @@ -6,7 +6,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/s60/feedback INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -contains(S60_VERSION, 5.0)|contains(S60_VERSION, symbian3) { +!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { HEADERS += qtactileFeedback.h SOURCES += qtactileFeedback_s60.cpp diff --git a/src/plugins/s60/s60.pro b/src/plugins/s60/s60.pro index ffcd170..1ddf326 100644 --- a/src/plugins/s60/s60.pro +++ b/src/plugins/s60/s60.pro @@ -6,7 +6,7 @@ symbian { SUBDIRS += 3_1 3_2 } - contains(S60_VERSION, 5.0)|contains(S60_VERSION, symbian3) { + !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { SUBDIRS += feedback } diff --git a/src/qbase.pri b/src/qbase.pri index 76079f2..d3fa426 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -35,7 +35,7 @@ CONFIG += qt warn_on depend_includepath CONFIG += qmake_cache target_qt CONFIG -= fix_output_dirs win32|mac:!macx-xcode:CONFIG += debug_and_release -linux*-g++*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF +linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index f4e3a28..6ecb403 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -2960,7 +2960,7 @@ EXPORTS ?qvsnprintf@@YAHPADIPBD0@Z @ 2959 NONAME ; int qvsnprintf(char *, unsigned int, char const *, char *) ?raiseError@QXmlStreamReader@@QAEXABVQString@@@Z @ 2960 NONAME ; void QXmlStreamReader::raiseError(class QString const &) ?rangeContains@QXmlUtils@@CA_NPBVQXmlCharRange@@0VQChar@@@Z @ 2961 NONAME ; bool QXmlUtils::rangeContains(class QXmlCharRange const *, class QXmlCharRange const *, class QChar) - ?reactivateDeferredActiveObjects@QEventDispatcherSymbian@@QAEXXZ @ 2962 NONAME ; void QEventDispatcherSymbian::reactivateDeferredActiveObjects(void) + ?reactivateDeferredActiveObjects@QEventDispatcherSymbian@@QAEXXZ @ 2962 NONAME ABSENT ; void QEventDispatcherSymbian::reactivateDeferredActiveObjects(void) ?reactivateSocketNotifier@QEventDispatcherSymbian@@QAEXPAVQSocketNotifier@@@Z @ 2963 NONAME ; void QEventDispatcherSymbian::reactivateSocketNotifier(class QSocketNotifier *) ?read@QAbstractFileEngine@@UAE_JPAD_J@Z @ 2964 NONAME ; long long QAbstractFileEngine::read(char *, long long) ?read@QFSFileEngine@@UAE_JPAD_J@Z @ 2965 NONAME ; long long QFSFileEngine::read(char *, long long) @@ -4484,4 +4484,6 @@ EXPORTS ?selectThread@QEventDispatcherSymbian@@AAEAAVQSelectThread@@XZ @ 4483 NONAME ; class QSelectThread & QEventDispatcherSymbian::selectThread(void) ?qt_symbian_SetupThreadHeap@@YAHHAAUSStdEpocThreadCreateInfo@@@Z @ 4484 NONAME ; int qt_symbian_SetupThreadHeap(int, struct SStdEpocThreadCreateInfo &) ?objectNameChanged@QAbstractDeclarativeData@@2P6AXPAV1@PAVQObject@@@ZA @ 4485 NONAME ; void (*QAbstractDeclarativeData::objectNameChanged)(class QAbstractDeclarativeData *, class QObject *) + ?queueDeferredActiveObjectsCompletion@QEventDispatcherSymbian@@QAEXXZ @ 4486 NONAME ; void QEventDispatcherSymbian::queueDeferredActiveObjectsCompletion(void) + ?reactivateDeferredActiveObjects@QEventDispatcherSymbian@@UAEXXZ @ 4487 NONAME ; void QEventDispatcherSymbian::reactivateDeferredActiveObjects(void) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index c91b22c..6a33fc3 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12852,7 +12852,7 @@ EXPORTS ?drawStaticText@QPainter@@QAEXABVQPointF@@ABVQStaticText@@@Z @ 12851 NONAME ; void QPainter::drawStaticText(class QPointF const &, class QStaticText const &) ?updateAll@QGraphicsViewPrivate@@QAEXXZ @ 12852 NONAME ; void QGraphicsViewPrivate::updateAll(void) ?updateMicroFocus@QGraphicsItem@@IAEXXZ @ 12853 NONAME ; void QGraphicsItem::updateMicroFocus(void) - ?populate@QTextureGlyphCache@@QAEXPAVQFontEngine@@HPBIPBUQFixedPoint@@@Z @ 12854 NONAME ; void QTextureGlyphCache::populate(class QFontEngine *, int, unsigned int const *, struct QFixedPoint const *) + ?populate@QTextureGlyphCache@@QAEXPAVQFontEngine@@HPBIPBUQFixedPoint@@@Z @ 12854 NONAME ABSENT ; void QTextureGlyphCache::populate(class QFontEngine *, int, unsigned int const *, struct QFixedPoint const *) ?hasPartialUpdateSupport@QWindowSurface@@QBE_NXZ @ 12855 NONAME ; bool QWindowSurface::hasPartialUpdateSupport(void) const ?scroll@QRuntimePixmapData@@UAE_NHHABVQRect@@@Z @ 12856 NONAME ; bool QRuntimePixmapData::scroll(int, int, class QRect const &) ?qt_draw_glyphs@@YAXPAVQPainter@@PBIPBVQPointF@@H@Z @ 12857 NONAME ; void qt_draw_glyphs(class QPainter *, unsigned int const *, class QPointF const *, int) @@ -12898,4 +12898,11 @@ EXPORTS ?qmljsDebugArgumentsString@QApplicationPrivate@@SA?AVQString@@XZ @ 12897 NONAME ; class QString QApplicationPrivate::qmljsDebugArgumentsString(void) ?convertToPostscriptFontFamilyName@QFontEngine@@SA?AVQByteArray@@ABV2@@Z @ 12898 NONAME ; class QByteArray QFontEngine::convertToPostscriptFontFamilyName(class QByteArray const &) ?lastResortFont@QFont@@QBE?AVQString@@XZ @ 12899 NONAME ; class QString QFont::lastResortFont(void) const + ?setFontEngine@QStaticTextItem@@QAEXPAVQFontEngine@@@Z @ 12900 NONAME ; void QStaticTextItem::setFontEngine(class QFontEngine *) + ??0QStaticTextItem@@QAE@ABV0@@Z @ 12901 NONAME ; QStaticTextItem::QStaticTextItem(class QStaticTextItem const &) + ??4QStaticTextItem@@QAEXABV0@@Z @ 12902 NONAME ; void QStaticTextItem::operator=(class QStaticTextItem const &) + ?fontEngine@QStaticTextItem@@QBEPAVQFontEngine@@XZ @ 12903 NONAME ; class QFontEngine * QStaticTextItem::fontEngine(void) const + ?reactivateDeferredActiveObjects@QEventDispatcherS60@@UAEXXZ @ 12904 NONAME ; void QEventDispatcherS60::reactivateDeferredActiveObjects(void) + ?userData@QStaticTextItem@@QBEPAVQStaticTextUserData@@XZ @ 12905 NONAME ; class QStaticTextUserData * QStaticTextItem::userData(void) const + ?populate@QTextureGlyphCache@@QAE_NPAVQFontEngine@@HPBIPBUQFixedPoint@@@Z @ 12906 NONAME ; bool QTextureGlyphCache::populate(class QFontEngine *, int, unsigned int const *, struct QFixedPoint const *) diff --git a/src/s60installs/bwins/QtOpenGLu.def b/src/s60installs/bwins/QtOpenGLu.def index fa340e4..620fcb9 100644 --- a/src/s60installs/bwins/QtOpenGLu.def +++ b/src/s60installs/bwins/QtOpenGLu.def @@ -8,7 +8,7 @@ EXPORTS ?d_func@QGLShader@@AAEPAVQGLShaderPrivate@@XZ @ 7 NONAME ; class QGLShaderPrivate * QGLShader::d_func(void) ?bindToDynamicTexture@QGLPixelBuffer@@QAE_NI@Z @ 8 NONAME ; bool QGLPixelBuffer::bindToDynamicTexture(unsigned int) ??0QGLWidget@@QAE@PAVQGLContext@@PAVQWidget@@PBV0@V?$QFlags@W4WindowType@Qt@@@@@Z @ 9 NONAME ; QGLWidget::QGLWidget(class QGLContext *, class QWidget *, class QGLWidget const *, class QFlags<enum Qt::WindowType>) - ??_EQGLFormat@@QAE@I@Z @ 10 NONAME ; QGLFormat::~QGLFormat(unsigned int) + ??_EQGLFormat@@QAE@I@Z @ 10 NONAME ABSENT ; QGLFormat::~QGLFormat(unsigned int) ?drawPixmapFragments@QGL2PaintEngineEx@@UAEXPBVPixmapFragment@QPainter@@HABVQPixmap@@V?$QFlags@W4PixmapFragmentHint@QPainter@@@@@Z @ 11 NONAME ; void QGL2PaintEngineEx::drawPixmapFragments(class QPainter::PixmapFragment const *, int, class QPixmap const &, class QFlags<enum QPainter::PixmapFragmentHint>) ?paintEngine@QGLWidget@@UBEPAVQPaintEngine@@XZ @ 12 NONAME ; class QPaintEngine * QGLWidget::paintEngine(void) const ?setPreferredPaintEngine@QGL@@YAXW4Type@QPaintEngine@@@Z @ 13 NONAME ; void QGL::setPreferredPaintEngine(enum QPaintEngine::Type) @@ -107,7 +107,7 @@ EXPORTS ??0QGLContext@@QAE@ABVQGLFormat@@@Z @ 106 NONAME ; QGLContext::QGLContext(class QGLFormat const &) ?geometryOutputVertexCount@QGLShaderProgram@@QBEHXZ @ 107 NONAME ; int QGLShaderProgram::geometryOutputVertexCount(void) const ?setAccum@QGLFormat@@QAEX_N@Z @ 108 NONAME ; void QGLFormat::setAccum(bool) - ??0QGLSignalProxy@@QAE@XZ @ 109 NONAME ; QGLSignalProxy::QGLSignalProxy(void) + ??0QGLSignalProxy@@QAE@XZ @ 109 NONAME ABSENT ; QGLSignalProxy::QGLSignalProxy(void) ?isUninitialized@QGLPixmapData@@ABE_NXZ @ 110 NONAME ; bool QGLPixmapData::isUninitialized(void) const ??0QGLFramebufferObjectFormat@@QAE@XZ @ 111 NONAME ; QGLFramebufferObjectFormat::QGLFramebufferObjectFormat(void) ??8@YA_NABVQGLFormat@@0@Z @ 112 NONAME ; bool operator==(class QGLFormat const &, class QGLFormat const &) @@ -496,7 +496,7 @@ EXPORTS ?setUniformValue@QGLShaderProgram@@QAEXPBDABVQSize@@@Z @ 495 NONAME ; void QGLShaderProgram::setUniformValue(char const *, class QSize const &) ?convertToGLFormat@QGLWidget@@SA?AVQImage@@ABV2@@Z @ 496 NONAME ; class QImage QGLWidget::convertToGLFormat(class QImage const &) ?staticMetaObject@QGLTextureGlyphCache@@2UQMetaObject@@B @ 497 NONAME ; struct QMetaObject const QGLTextureGlyphCache::staticMetaObject - ??_EQGLContextResource@@QAE@I@Z @ 498 NONAME ; QGLContextResource::~QGLContextResource(unsigned int) + ??_EQGLContextResource@@QAE@I@Z @ 498 NONAME ABSENT ; QGLContextResource::~QGLContextResource(unsigned int) ?handle@QGLColormap@@IAEKXZ @ 499 NONAME ; unsigned long QGLColormap::handle(void) ?isCreated@QGLBuffer@@QBE_NXZ @ 500 NONAME ; bool QGLBuffer::isCreated(void) const ?setColormap@QGLWidget@@QAEXABVQGLColormap@@@Z @ 501 NONAME ; void QGLWidget::setColormap(class QGLColormap const &) @@ -698,4 +698,9 @@ EXPORTS ?setProfile@QGLFormat@@QAEXW4OpenGLContextProfile@1@@Z @ 697 NONAME ; void QGLFormat::setProfile(enum QGLFormat::OpenGLContextProfile) ?updateDynamicTexture@QGLPixelBuffer@@QBEXI@Z @ 698 NONAME ; void QGLPixelBuffer::updateDynamicTexture(unsigned int) const ?setUniformValue@QGLShaderProgram@@QAEXHH@Z @ 699 NONAME ; void QGLShaderProgram::setUniformValue(int, int) + ?maxTextureHeight@QGLTextureGlyphCache@@UBEHXZ @ 700 NONAME ; int QGLTextureGlyphCache::maxTextureHeight(void) const + ?initializeOffscreenTexture@QGLWindowSurface@@AAE_NABVQSize@@@Z @ 701 NONAME ; bool QGLWindowSurface::initializeOffscreenTexture(class QSize const &) + ?maxTextureWidth@QGLTextureGlyphCache@@UBEHXZ @ 702 NONAME ; int QGLTextureGlyphCache::maxTextureWidth(void) const + ?filterMode@QGLTextureGlyphCache@@QBE?AW4FilterMode@1@XZ @ 703 NONAME ; enum QGLTextureGlyphCache::FilterMode QGLTextureGlyphCache::filterMode(void) const + ?setFilterMode@QGLTextureGlyphCache@@QAEXW4FilterMode@1@@Z @ 704 NONAME ; void QGLTextureGlyphCache::setFilterMode(enum QGLTextureGlyphCache::FilterMode) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 75bb026..54768a1 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12104,4 +12104,5 @@ EXPORTS _ZN15QStaticTextItem13setFontEngineEP11QFontEngine @ 12103 NONAME _ZN15QStaticTextItemD1Ev @ 12104 NONAME _ZN15QStaticTextItemD2Ev @ 12105 NONAME + _ZN19QEventDispatcherS6031reactivateDeferredActiveObjectsEv @ 12106 NONAME diff --git a/src/s60installs/eabi/QtOpenGLu.def b/src/s60installs/eabi/QtOpenGLu.def index 7ceade4..c92d99e 100644 --- a/src/s60installs/eabi/QtOpenGLu.def +++ b/src/s60installs/eabi/QtOpenGLu.def @@ -702,4 +702,9 @@ EXPORTS _ZeqRK9QGLFormatS1_ @ 701 NONAME _Zls6QDebugRK9QGLFormat @ 702 NONAME _ZneRK9QGLFormatS1_ @ 703 NONAME + _ZN16QGLWindowSurface26initializeOffscreenTextureERK5QSize @ 704 NONAME + _ZNK20QGLTextureGlyphCache15maxTextureWidthEv @ 705 NONAME + _ZNK20QGLTextureGlyphCache16maxTextureHeightEv @ 706 NONAME + _ZThn8_NK20QGLTextureGlyphCache15maxTextureWidthEv @ 707 NONAME + _ZThn8_NK20QGLTextureGlyphCache16maxTextureHeightEv @ 708 NONAME diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 2b3229e..fc364bc 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -87,7 +87,7 @@ symbian: { DEPLOYMENT += bearer_plugin } - contains(S60_VERSION, 5.0)|contains(S60_VERSION, symbian3) { + !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { feedback_plugin.sources = $$QT_BUILD_TREE/plugins/s60/feedback/qtactilefeedback$${QT_LIBINFIX}.dll feedback_plugin.path = c:$$QT_PLUGINS_BASE_DIR/feedback DEPLOYMENT += feedback_plugin @@ -191,11 +191,9 @@ symbian: { qtlibraries.files += $$QMAKE_LIBDIR_QT/QtOpenVG$${QT_LIBINFIX}.dll graphicssystems_plugins.files += $$QT_BUILD_TREE/plugins/graphicssystems/qvggraphicssystem$${QT_LIBINFIX}.dll # OpenVG requires Symbian^3 or later - pkg_platform_dependencies -= \ - "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ - "[0x102032BE],0,0,0,{\"S60ProductID\"}" \ - "[0x102752AE],0,0,0,{\"S60ProductID\"}" \ - "[0x1028315F],0,0,0,{\"S60ProductID\"}" + pkg_platform_dependencies = \ + "[0x20022E6D],0,0,0,{\"S60ProductID\"}" \ + "[0x20032DE7],0,0,0,{\"S60ProductID\"}" } contains(QT_CONFIG, opengl) { diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp index a90e014..8528dec 100644 --- a/src/script/api/qscriptcontextinfo.cpp +++ b/src/script/api/qscriptcontextinfo.cpp @@ -177,7 +177,7 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte fileName = source->url(); } - // Get the others informations: + // Get the others information: JSC::JSObject *callee = frame->callee(); if (callee && callee->inherits(&JSC::InternalFunction::info)) functionName = JSC::asInternalFunction(callee)->name(frame); diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 69abcad..1fcbd73 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1744,7 +1744,9 @@ QVariant QScriptEnginePrivate::toVariant(JSC::ExecState *exec, JSC::JSValue valu else if (QScriptDeclarativeClass *dc = declarativeClass(value)) return dc->toVariant(declarativeObject(value)); return variantMapFromObject(exec, JSC::asObject(value)); - } else if (value.isNumber()) { + } else if (value.isInt32()) { + return QVariant(toInt32(exec, value)); + } else if (value.isDouble()) { return QVariant(toNumber(exec, value)); } else if (value.isString()) { return QVariant(toString(exec, value)); diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 8cd4057..6ce54f5 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1716,7 +1716,14 @@ QScriptValue QScriptValue::construct(const QScriptValueList &args) QVarLengthArray<JSC::JSValue, 8> argsVector(args.size()); for (int i = 0; i < args.size(); ++i) { - if (!args.at(i).isValid()) + QScriptValue arg = args.at(i); + if (QScriptValuePrivate::getEngine(arg) != d->engine && QScriptValuePrivate::getEngine(arg)) { + qWarning("QScriptValue::construct() failed: " + "cannot construct function with argument created in " + "a different engine"); + return QScriptValue(); + } + if (!arg.isValid()) argsVector[i] = JSC::jsUndefined(); else argsVector[i] = d->engine->scriptValueToJSCValue(args.at(i)); @@ -1766,6 +1773,12 @@ QScriptValue QScriptValue::construct(const QScriptValue &arguments) JSC::ExecState *exec = d->engine->currentFrame; + if (QScriptValuePrivate::getEngine(arguments) != d->engine && QScriptValuePrivate::getEngine(arguments)) { + qWarning("QScriptValue::construct() failed: " + "cannot construct function with argument created in " + "a different engine"); + return QScriptValue(); + } JSC::JSValue array = d->engine->scriptValueToJSCValue(arguments); // copied from runtime/FunctionPrototype.cpp, functionProtoFuncApply() JSC::MarkedArgumentBuffer applyArgs; diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h index 7600e52..96760e1 100644 --- a/src/sql/models/qsqlrelationaldelegate.h +++ b/src/sql/models/qsqlrelationaldelegate.h @@ -59,23 +59,23 @@ class QSqlRelationalDelegate: public QItemDelegate { public: -explicit QSqlRelationalDelegate(QObject *parent = 0) - : QItemDelegate(parent) +explicit QSqlRelationalDelegate(QObject *aParent = 0) + : QItemDelegate(aParent) {} ~QSqlRelationalDelegate() {} -QWidget *createEditor(QWidget *parent, +QWidget *createEditor(QWidget *aParent, const QStyleOptionViewItem &option, const QModelIndex &index) const { const QSqlRelationalTableModel *sqlModel = qobject_cast<const QSqlRelationalTableModel *>(index.model()); QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : 0; if (!childModel) - return QItemDelegate::createEditor(parent, option, index); + return QItemDelegate::createEditor(aParent, option, index); - QComboBox *combo = new QComboBox(parent); + QComboBox *combo = new QComboBox(aParent); combo->setModel(childModel); combo->setModelColumn(childModel->fieldIndex(sqlModel->relation(index.column()).displayColumn())); combo->installEventFilter(const_cast<QSqlRelationalDelegate *>(this)); diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index aae2786..126c6c1 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -755,6 +755,9 @@ QT_BEGIN_NAMESPACE QTest::touchEvent to create a QTouchEventSequence instance. Add touch events to the sequence by calling press(), move(), release() and stationary(), and let the instance run out of scope to commit the sequence to the event system. + + Example: + \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 25 */ /*! diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h index 1beef85..6c58e4c 100644 --- a/src/testlib/qtesttouch.h +++ b/src/testlib/qtesttouch.h @@ -106,8 +106,8 @@ namespace QTest } private: - QTouchEventSequence(QWidget *widget, QTouchEvent::DeviceType deviceType) - : targetWidget(widget), deviceType(deviceType) + QTouchEventSequence(QWidget *widget, QTouchEvent::DeviceType aDeviceType) + : targetWidget(widget), deviceType(aDeviceType) { } QTouchEventSequence(const QTouchEventSequence &v); diff --git a/src/xmlpatterns/expr/qarithmeticexpression_p.h b/src/xmlpatterns/expr/qarithmeticexpression_p.h index 66c1f13..6ff8219 100644 --- a/src/xmlpatterns/expr/qarithmeticexpression_p.h +++ b/src/xmlpatterns/expr/qarithmeticexpression_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE namespace QPatternist { /** - * @short Implements arithmetics, such as multiplication and substraction. + * @short Implements arithmetics, such as multiplication and subtraction. * * * Optimizations: there's some operator/value combos that are no ops. For diff --git a/src/xmlpatterns/parser/createTokenLookup.sh b/src/xmlpatterns/parser/createTokenLookup.sh index e11a3ba..9339568 100755 --- a/src/xmlpatterns/parser/createTokenLookup.sh +++ b/src/xmlpatterns/parser/createTokenLookup.sh @@ -55,8 +55,8 @@ license=`cat <<EOF ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -66,13 +66,12 @@ license=`cat <<EOF ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. ** ** ** |