diff options
Diffstat (limited to 'src')
298 files changed, 6275 insertions, 3785 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp index 1e717cb..abe15c8 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp @@ -241,7 +241,7 @@ NEVER_INLINE CollectorBlock* Heap::allocateBlock() #elif PLATFORM(WINCE) void* address = VirtualAlloc(NULL, BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); #elif PLATFORM(WIN_OS) -#if COMPILER(MINGW) +#if COMPILER(MINGW) && !PLATFORM(X86_64) void* address = __mingw_aligned_malloc(BLOCK_SIZE, BLOCK_SIZE); #else void* address = _aligned_malloc(BLOCK_SIZE, BLOCK_SIZE); @@ -327,7 +327,7 @@ NEVER_INLINE void Heap::freeBlock(CollectorBlock* block) #elif PLATFORM(WINCE) VirtualFree(block, 0, MEM_RELEASE); #elif PLATFORM(WIN_OS) -#if COMPILER(MINGW) +#if COMPILER(MINGW) && !PLATFORM(X86_64) __mingw_aligned_free(block); #else _aligned_free(block); @@ -617,7 +617,7 @@ static inline void* currentThreadStackBase() MOV pTib, EAX } return static_cast<void*>(pTib->StackBase); -#elif PLATFORM(WIN_OS) && PLATFORM(X86_64) && COMPILER(MSVC) +#elif PLATFORM(WIN_OS) && PLATFORM(X86_64) && (COMPILER(MSVC) ||COMPILER(GCC)) PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb()); return reinterpret_cast<void*>(pTib->StackBase); #elif PLATFORM(WIN_OS) && PLATFORM(X86) && COMPILER(GCC) diff --git a/src/3rdparty/libpng/png.h b/src/3rdparty/libpng/png.h index 14e3416..5ea2b0d 100644 --- a/src/3rdparty/libpng/png.h +++ b/src/3rdparty/libpng/png.h @@ -386,7 +386,7 @@ #include "zlib.h" #endif -#ifdef AIX +#ifdef _AIX #define jmpbuf __jmpbuf #endif diff --git a/src/3rdparty/libpng/pngconf.h b/src/3rdparty/libpng/pngconf.h index 5d202db..1f8bef8 100644 --- a/src/3rdparty/libpng/pngconf.h +++ b/src/3rdparty/libpng/pngconf.h @@ -1379,7 +1379,7 @@ typedef char FAR * FAR * FAR * png_charppp; /* memory model/platform independent fns */ #ifndef PNG_ABORT -# ifdef _WINDOWS_ +# if defined(_WINDOWS_) || defined(_WIN32_WCE) # define PNG_ABORT() ExitProcess(0) # else # define PNG_ABORT() abort() diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h index 13c2b3f..87a4ba6 100644 --- a/src/3rdparty/libpng/pngpriv.h +++ b/src/3rdparty/libpng/pngpriv.h @@ -74,7 +74,9 @@ #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ defined(_WIN32) || defined(__WIN32__) -# include <windows.h> /* defines _WINDOWS_ macro */ +# if !defined(__SYMBIAN32__) +# include <windows.h> /* defines _WINDOWS_ macro */ +# endif /* I have no idea why is this necessary... */ # ifdef _MSC_VER # include <malloc.h> diff --git a/src/3rdparty/libtiff/libtiff/tif_wince.c b/src/3rdparty/libtiff/libtiff/tif_wince.c new file mode 100644 index 0000000..4e283da --- /dev/null +++ b/src/3rdparty/libtiff/libtiff/tif_wince.c @@ -0,0 +1,281 @@ +/* $Id: tif_wince.c,v 1.1 2007-01-15 18:40:39 mloskot Exp $ */ + +/* + * Copyright (c) 1988-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +/* + * Windows CE-specific routines for TIFF Library. + * Adapted from tif_win32.c 01/10/2006 by Mateusz Loskot (mateusz@loskot.net) + */ + +#ifndef _WIN32_WCE +# error "Only Windows CE target is supported!" +#endif + +#include "tiffiop.h" +#include <windows.h> + +/* Turn off console support on Windows CE. */ +#undef TIF_PLATFORM_CONSOLE + + +/* + * Open a TIFF file for read/writing. + */ +TIFF* +TIFFOpen(const char* name, const char* mode) +{ + static const char module[] = "TIFFOpen"; + thandle_t fd; + int m; + DWORD dwMode; + TIFF* tif; + size_t nLen; + size_t nWideLen; + wchar_t* wchName; + + m = _TIFFgetMode(mode, module); + + switch(m) + { + case O_RDONLY: + dwMode = OPEN_EXISTING; + break; + case O_RDWR: + dwMode = OPEN_ALWAYS; + break; + case O_RDWR|O_CREAT: + dwMode = OPEN_ALWAYS; + break; + case O_RDWR|O_TRUNC: + dwMode = CREATE_ALWAYS; + break; + case O_RDWR|O_CREAT|O_TRUNC: + dwMode = CREATE_ALWAYS; + break; + default: + return ((TIFF*)0); + } + + /* On Windows CE, CreateFile is mapped to CreateFileW, + * but file path is passed as char-based string, + * so the path has to be converted to wchar_t. + */ + + nWideLen = 0; + wchName = NULL; + nLen = strlen(name) + 1; + + nWideLen = MultiByteToWideChar(CP_ACP, 0, name, nLen, NULL, 0); + wchName = (wchar_t*)malloc(sizeof(wchar_t) * nWideLen); + if (NULL == wchName) + { + TIFFErrorExt(0, module, "Memory allocation error!"); + return ((TIFF *)0); + } + memset(wchName, 0, sizeof(wchar_t) * nWideLen); + MultiByteToWideChar(CP_ACP, 0, name, nLen, wchName, nWideLen); + + fd = (thandle_t)CreateFile(wchName, + (m == O_RDONLY)?GENERIC_READ:(GENERIC_READ | GENERIC_WRITE), + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, dwMode, + (m == O_RDONLY)?FILE_ATTRIBUTE_READONLY:FILE_ATTRIBUTE_NORMAL, + NULL); + + free(wchName); + + if (fd == INVALID_HANDLE_VALUE) { + TIFFErrorExt(0, module, "%s: Cannot open", name); + return ((TIFF *)0); + } + + /* TODO - mloskot: change to TIFFdOpenW and pass wchar path */ + + tif = TIFFFdOpen((int)fd, name, mode); + if(!tif) + CloseHandle(fd); + return tif; +} + +/* + * Open a TIFF file with a Unicode filename, for read/writing. + */ +TIFF* +TIFFOpenW(const wchar_t* name, const char* mode) +{ + static const char module[] = "TIFFOpenW"; + thandle_t fd; + int m; + DWORD dwMode; + int mbsize; + char *mbname; + TIFF *tif; + + m = _TIFFgetMode(mode, module); + + switch(m) { + case O_RDONLY: dwMode = OPEN_EXISTING; break; + case O_RDWR: dwMode = OPEN_ALWAYS; break; + case O_RDWR|O_CREAT: dwMode = OPEN_ALWAYS; break; + case O_RDWR|O_TRUNC: dwMode = CREATE_ALWAYS; break; + case O_RDWR|O_CREAT|O_TRUNC: dwMode = CREATE_ALWAYS; break; + default: return ((TIFF*)0); + } + + /* On Windows CE, CreateFile is mapped to CreateFileW, + * so no conversion of wchar_t to char is required. + */ + + fd = (thandle_t)CreateFile(name, + (m == O_RDONLY)?GENERIC_READ:(GENERIC_READ|GENERIC_WRITE), + FILE_SHARE_READ, NULL, dwMode, + (m == O_RDONLY)?FILE_ATTRIBUTE_READONLY:FILE_ATTRIBUTE_NORMAL, + NULL); + if (fd == INVALID_HANDLE_VALUE) { + TIFFErrorExt(0, module, "%S: Cannot open", name); + return ((TIFF *)0); + } + + mbname = NULL; + mbsize = WideCharToMultiByte(CP_ACP, 0, name, -1, NULL, 0, NULL, NULL); + if (mbsize > 0) { + mbname = (char *)_TIFFmalloc(mbsize); + if (!mbname) { + TIFFErrorExt(0, module, + "Can't allocate space for filename conversion buffer"); + return ((TIFF*)0); + } + + WideCharToMultiByte(CP_ACP, 0, name, -1, mbname, mbsize, + NULL, NULL); + } + + tif = TIFFFdOpen((int)fd, + (mbname != NULL) ? mbname : "<unknown>", mode); + if(!tif) + CloseHandle(fd); + + _TIFFfree(mbname); + + return tif; +} + +static void +Win32WarningHandler(const char* module, const char* fmt, va_list ap) +{ + /* On Windows CE, MessageBox is mapped to wide-char based MessageBoxW. */ + + size_t nWideLen = 0; + LPTSTR szWideTitle = NULL; + LPTSTR szWideMsg = NULL; + + LPSTR szTitle; + LPSTR szTmp; + LPCSTR szTitleText = "%s Warning"; + LPCSTR szDefaultModule = "LIBTIFF"; + LPCSTR szTmpModule; + + szTmpModule = (module == NULL) ? szDefaultModule : module; + if ((szTitle = (LPSTR)LocalAlloc(LMEM_FIXED, + (strlen(szTmpModule) + strlen(szTitleText) + + strlen(fmt) + 128) * sizeof(char))) == NULL) + return; + + sprintf(szTitle, szTitleText, szTmpModule); + szTmp = szTitle + (strlen(szTitle) + 2) * sizeof(char); + vsprintf(szTmp, fmt, ap); + + /* Convert error message to Unicode. */ + + nWideLen = MultiByteToWideChar(CP_ACP, 0, szTitle, -1, NULL, 0); + szWideTitle = (wchar_t*)malloc(sizeof(wchar_t) * nWideLen); + MultiByteToWideChar(CP_ACP, 0, szTitle, -1, szWideTitle, nWideLen); + + nWideLen = MultiByteToWideChar(CP_ACP, 0, szTmp, -1, NULL, 0); + szWideMsg = (wchar_t*)malloc(sizeof(wchar_t) * nWideLen); + MultiByteToWideChar(CP_ACP, 0, szTmp, -1, szWideMsg, nWideLen); + + /* Display message */ + + MessageBox(GetFocus(), szWideMsg, szWideTitle, MB_OK | MB_ICONEXCLAMATION); + + /* Free resources */ + + LocalFree(szTitle); + free(szWideMsg); + free(szWideTitle); +} + +TIFFErrorHandler _TIFFwarningHandler = Win32WarningHandler; + +static void +Win32ErrorHandler(const char* module, const char* fmt, va_list ap) +{ + /* On Windows CE, MessageBox is mapped to wide-char based MessageBoxW. */ + + size_t nWideLen = 0; + LPTSTR szWideTitle = NULL; + LPTSTR szWideMsg = NULL; + + LPSTR szTitle; + LPSTR szTmp; + LPCSTR szTitleText = "%s Error"; + LPCSTR szDefaultModule = "LIBTIFF"; + LPCSTR szTmpModule; + + szTmpModule = (module == NULL) ? szDefaultModule : module; + if ((szTitle = (LPSTR)LocalAlloc(LMEM_FIXED, + (strlen(szTmpModule) + strlen(szTitleText) + + strlen(fmt) + 128) * sizeof(char))) == NULL) + return; + + sprintf(szTitle, szTitleText, szTmpModule); + szTmp = szTitle + (strlen(szTitle) + 2) * sizeof(char); + vsprintf(szTmp, fmt, ap); + + /* Convert error message to Unicode. */ + + nWideLen = MultiByteToWideChar(CP_ACP, 0, szTitle, -1, NULL, 0); + szWideTitle = (wchar_t*)malloc(sizeof(wchar_t) * nWideLen); + MultiByteToWideChar(CP_ACP, 0, szTitle, -1, szWideTitle, nWideLen); + + nWideLen = MultiByteToWideChar(CP_ACP, 0, szTmp, -1, NULL, 0); + szWideMsg = (wchar_t*)malloc(sizeof(wchar_t) * nWideLen); + MultiByteToWideChar(CP_ACP, 0, szTmp, -1, szWideMsg, nWideLen); + + /* Display message */ + + MessageBox(GetFocus(), szWideMsg, szWideTitle, MB_OK | MB_ICONEXCLAMATION); + + /* Free resources */ + + LocalFree(szTitle); + free(szWideMsg); + free(szWideTitle); +} + +TIFFErrorHandler _TIFFerrorHandler = Win32ErrorHandler; + + +/* vim: set ts=8 sts=8 sw=8 noet: */ diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp index 79fc51e..5c87fe6 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp @@ -368,7 +368,7 @@ static inline void handleElementNamespaces(Element* newElement, const QXmlStream for (int i = 0; i < ns.count(); ++i) { const QXmlStreamNamespaceDeclaration &decl = ns[i]; String namespaceURI = decl.namespaceUri(); - String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:") + decl.prefix(); + String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:") + String(decl.prefix()); newElement->setAttributeNS("http://www.w3.org/2000/xmlns/", namespaceQName, namespaceURI, ec); if (ec) // exception setting attributes return; diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 7a1bfd5..5fbc876 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -179,7 +179,7 @@ void InspectorClientQt::populateSetting(const String& key, InspectorController:: return; } - QString settingKey(settingStoragePrefix + key); + QString settingKey(settingStoragePrefix + QString(key)); QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString(); QVariant storedValue = qsettings.value(settingKey); storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data())); @@ -196,7 +196,7 @@ void InspectorClientQt::storeSetting(const String& key, const InspectorControlle } QVariant valueToStore = settingToVariant(setting); - QString settingKey(settingStoragePrefix + key); + QString settingKey(settingStoragePrefix + QString(key)); qsettings.setValue(settingKey, valueToStore); qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type())); } diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index 02a29d9..7692749 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -1353,11 +1353,9 @@ bool QAxBase::initializeFromFile(IUnknown** ptr) // There seams to be a naming problem in mingw headers -#ifdef Q_CC_GNU -#ifndef COAUTHIDENTITY +#if defined(Q_CC_GNU) && !defined(COAUTHIDENTITY) && !defined(__MINGW64_VERSION_MAJOR) #define COAUTHIDENTITY AUTH_IDENTITY #endif -#endif /*! diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index 9149320..7d2dde7 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -77,25 +77,21 @@ // #define QAX_SUPPORT_BORDERSPACE // missing interface from win32api -#if defined(Q_CC_GNU) -# if !defined(IOleInPlaceObjectWindowless) -# undef INTERFACE -# define INTERFACE IOleInPlaceObjectWindowless - DECLARE_INTERFACE_(IOleInPlaceObjectWindowless,IOleInPlaceObject) - { - STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(GetWindow)(THIS_ HWND*) PURE; - STDMETHOD(ContextSensitiveHelp)(THIS_ BOOL) PURE; - STDMETHOD(InPlaceDeactivate)(THIS) PURE; - STDMETHOD(UIDeactivate)(THIS) PURE; - STDMETHOD(SetObjectRects)(THIS_ LPCRECT,LPCRECT) PURE; - STDMETHOD(ReactivateAndUndo)(THIS) PURE; - STDMETHOD(OnWindowMessage)(THIS_ UINT, WPARAM, LPARAM, LRESULT*) PURE; - STDMETHOD(GetDropTarget)(THIS_ IDropTarget**) PURE; - }; -# endif +#if defined(Q_CC_GNU) && !defined(__MINGW64_VERSION_MAJOR) + DECLARE_INTERFACE_(IOleInPlaceObjectWindowless,IOleInPlaceObject) + { + STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + STDMETHOD(GetWindow)(THIS_ HWND*) PURE; + STDMETHOD(ContextSensitiveHelp)(THIS_ BOOL) PURE; + STDMETHOD(InPlaceDeactivate)(THIS) PURE; + STDMETHOD(UIDeactivate)(THIS) PURE; + STDMETHOD(SetObjectRects)(THIS_ LPCRECT,LPCRECT) PURE; + STDMETHOD(ReactivateAndUndo)(THIS) PURE; + STDMETHOD(OnWindowMessage)(THIS_ UINT, WPARAM, LPARAM, LRESULT*) PURE; + STDMETHOD(GetDropTarget)(THIS_ IDropTarget**) PURE; + }; #endif #include "../shared/qaxtypes.h" diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index 5fa0aad..ce71490 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -1536,7 +1536,7 @@ HWND QAxServerBase::create(HWND hWndParent, RECT& rcPos) HINSTANCE hInst = (HINSTANCE)qAxInstance; EnterCriticalSection(&createWindowSection); QString cn(QLatin1String("QAxControl")); - cn += QString::number((int)ActiveXProc); + cn += QString::number((quintptr)ActiveXProc); if (!atom) { WNDCLASS wcTemp; wcTemp.style = CS_DBLCLKS; @@ -1599,10 +1599,10 @@ HMENU QAxServerBase::createPopup(QMenu *popup, HMENU oldMenu) ushort itemId; if (flags & MF_POPUP) { itemId = static_cast<ushort>( - reinterpret_cast<ulong>(createPopup(action->menu())) + reinterpret_cast<quintptr>(createPopup(action->menu())) ); } else { - itemId = static_cast<ushort>(reinterpret_cast<ulong>(action)); + itemId = static_cast<ushort>(reinterpret_cast<quintptr>(action)); actionMap.remove(itemId); actionMap.insert(itemId, action); } @@ -1646,10 +1646,10 @@ void QAxServerBase::createMenu(QMenuBar *menuBar) ushort itemId; if (flags & MF_POPUP) { itemId = static_cast<ushort>( - reinterpret_cast<ulong>(createPopup(action->menu())) + reinterpret_cast<quintptr>(createPopup(action->menu())) ); } else { - itemId = static_cast<ushort>(reinterpret_cast<ulong>(action)); + itemId = static_cast<ushort>(reinterpret_cast<quintptr>(action)); actionMap.insert(itemId, action); } AppendMenu(hmenuShared, flags, itemId, (const wchar_t *)action->text().utf16()); diff --git a/src/corelib/concurrent/qfuturewatcher.cpp b/src/corelib/concurrent/qfuturewatcher.cpp index 3065205..3b808b8 100644 --- a/src/corelib/concurrent/qfuturewatcher.cpp +++ b/src/corelib/concurrent/qfuturewatcher.cpp @@ -499,6 +499,13 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event) /*! \fn void QFutureWatcher::setFuture(const QFuture<T> &future) Starts watching the given \a future. + + One of the signals might be emitted for the current state of the + \a future. For example, if the future is already stopped, the + finished signal will be emitted. + + To avoid a race condition, it is important to call this function + \i after doing the connections. */ /*! \fn QFuture<T> QFutureWatcher::future() const diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index efee610..df9a463 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -52,3 +52,25 @@ symbian: { partial_upgrade.path = c:/sys/bin DEPLOYMENT = partial_upgrade $$DEPLOYMENT } + +mmx { + DEFINES += QT_HAVE_MMX +} +3dnow { + DEFINES += QT_HAVE_3DNOW +} +sse { + DEFINES += QT_HAVE_SSE + DEFINES += QT_HAVE_MMXEXT +} +sse2 { + DEFINES += QT_HAVE_SSE2 +} +iwmmxt { + DEFINES += QT_HAVE_IWMMXT +} +neon { + DEFINES += QT_HAVE_NEON + QMAKE_CXXFLAGS *= -mfpu=neon +} + diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 7e7d7d8..4d48b60 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -814,7 +814,7 @@ namespace QT_NAMESPACE {} # define Q_WS_MAC32 # endif # elif defined(Q_OS_SYMBIAN) -# if (defined(__SERIES60_31__) || defined(__S60_32__) || defined(__S60_50__)) && !defined(QT_NO_S60) +# if !defined(QT_NO_S60) # define Q_WS_S60 # endif # elif !defined(Q_WS_QWS) @@ -2414,10 +2414,11 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); #if defined(Q_OS_SYMBIAN) -#ifdef SYMBIAN_GRAPHICS_USE_GCE +#ifdef SYMBIAN_BUILD_GCE //RWsPointerCursor is fixed, so don't use low performance sprites #define Q_SYMBIAN_FIXED_POINTER_CURSORS #define Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE +#define Q_SYMBIAN_WINDOW_SIZE_CACHE //enabling new graphics resources #define QT_SYMBIAN_SUPPORTS_SGIMAGE #define QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 9690406..9490225 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -444,7 +444,7 @@ QLibraryInfo::location(LibraryLocation loc) QCFType<CFURLRef> urlRef = CFBundleCopyBundleURL(bundleRef); if (urlRef) { QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); - return QDir::cleanPath(path + QLatin1String("/Contents/") + ret); + return QDir::cleanPath(QString(path) + QLatin1String("/Contents/") + ret); } } #endif diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index fc35bfa..2731ae1 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -159,10 +159,9 @@ QT_BEGIN_NAMESPACE \section1 Reading and writing Qt collection classes - The Qt collection classes can also be serialized to a QDataStream. + The Qt container classes can also be serialized to a QDataStream. These include QList, QLinkedList, QVector, QSet, QHash, and QMap. - These classes have have stream operators declared as non-member of - the class. + The stream operators are declared as non-members of the classes. \target Serializing Qt Classes \section1 Reading and writing other Qt classes. diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 7cfdddf..505889e 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -960,13 +960,14 @@ void QDir::setNameFilters(const QStringList &nameFilters) /*! \obsolete + + Use QDir::addSearchPath() with a prefix instead. + Adds \a path to the search paths searched in to find resources that are not specified with an absolute path. The default search path is to search only in the root (\c{:/}). - Use QDir::addSearchPath() with a prefix instead. - - \sa {The Qt Resource System}, QResource::addSearchPath() + \sa {The Qt Resource System} */ void QDir::addResourceSearchPath(const QString &path) { diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.cpp b/src/corelib/io/qfilesystemwatcher_fsevents.cpp index 54ae24e..efbc290 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents.cpp +++ b/src/corelib/io/qfilesystemwatcher_fsevents.cpp @@ -445,7 +445,16 @@ void QFSEventsFileSystemWatcherEngine::updateFiles() updateHash(dirPathInfoHash); if (filePathInfoHash.isEmpty() && dirPathInfoHash.isEmpty()) { // Everything disappeared before we got to start, don't bother. - stop(); +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + // Code duplicated from stop(), with the exception that we + // don't wait on waitForStop here. Doing this will lead to + // a deadlock since this function is called from the worker + // thread. (waitForStop.wakeAll() is only called from the + // end of run()). + stopFSStream(fsStream); + if (threadsRunLoop) + CFRunLoopStop(threadsRunLoop); +#endif cleanupFSStream(fsStream); } waitCondition.wakeAll(); diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 9179485..d2fa744 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1270,7 +1270,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla int pageSize = getpagesize(); int extra = offset % pageSize; - if (size + extra > (size_t)-1) { + if (quint64(size + extra) > quint64((size_t)-1)) { q->setError(QFile::UnspecifiedError, qt_error_string(int(EINVAL))); return 0; } diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 4e14ba8..662100a 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1003,8 +1003,8 @@ QByteArray QIODevice::readAll() to a maximum of \a maxSize - 1 bytes, stores the characters in \a data, and returns the number of bytes read. If a line could not be read but no error ocurred, this function returns 0. If an error - occurs, this function returns what it could the length of what - could be read, or -1 if nothing was read. + occurs, this function returns the length of what could be read, or + -1 if nothing was read. A terminating '\0' byte is always appended to \a data, so \a maxSize must be larger than 1. diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index adfbb15..6d33c8b 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -555,16 +555,15 @@ QStringList QResource::children() const /*! \obsolete + Use QDir::addSearchPath() with a prefix instead. + Adds \a path to the search paths searched in to find resources that are not specified with an absolute path. The \a path must be an absolute path (start with \c{/}). The default search path is to search only in the root (\c{:/}). The last path added will be consulted first upon next QResource creation. - - Use QDir::addSearchPath() with a prefix instead. */ - void QResource::addSearchPath(const QString &path) { @@ -578,6 +577,10 @@ QResource::addSearchPath(const QString &path) } /*! + \obsolete + + Use QDir::searchPaths() instead. + Returns the current search path list. This list is consulted when creating a relative resource. diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 076cc33..626bd3f 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -167,6 +167,13 @@ regardless of the Qt::FormattingOptions used. */ +/*! + \fn uint qHash(const QUrl &url) + \since 4.7 + \relates QUrl + + Computes a hash key from the normalized version of \a url. + */ #include "qplatformdefs.h" #include "qurl.h" #include "private/qunicodetables_p.h" @@ -437,17 +444,19 @@ static bool QT_FASTCALL _unreserved(const char **ptr) } // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) -static void QT_FASTCALL _scheme(const char **ptr, QUrlParseData *parseData) +static bool QT_FASTCALL _scheme(const char **ptr, QUrlParseData *parseData) { bool first = true; + bool isSchemeValid = true; parseData->scheme = *ptr; for (;;) { char ch = **ptr; if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { ; - } else if (!first && ((ch >= '0' && ch <= '9') || ch == '+' || ch == '-' || ch == '.')) { - ; + } else if ((ch >= '0' && ch <= '9') || ch == '+' || ch == '-' || ch == '.') { + if (first) + isSchemeValid = false; } else { break; } @@ -457,11 +466,14 @@ static void QT_FASTCALL _scheme(const char **ptr, QUrlParseData *parseData) } if (**ptr != ':') { + isSchemeValid = true; *ptr = parseData->scheme; } else { parseData->schemeLength = *ptr - parseData->scheme; ++(*ptr); // skip ':' } + + return isSchemeValid; } // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) @@ -3743,7 +3755,19 @@ void QUrlPrivate::parse(ParseOptions parseOptions) const #endif // optional scheme - _scheme(ptr, &parseData); + bool isSchemeValid = _scheme(ptr, &parseData); + + if (isSchemeValid == false) { + that->isValid = false; + char ch = *((*ptr)++); + that->errorInfo.setParams(*ptr, QT_TRANSLATE_NOOP(QUrl, "unexpected URL scheme"), + 0, ch); + QURL_SETFLAG(that->stateFlags, Validated | Parsed); +#if defined (QURL_DEBUG) + qDebug("QUrlPrivate::parse(), unrecognized: %c%s", ch, *ptr); +#endif + return; + } // hierpart _hierPart(ptr, &parseData); @@ -6348,7 +6372,7 @@ QUrl QUrl::fromUserInput(const QString &userInput) return QUrl::fromLocalFile(trimmedString); QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode); - QUrl urlPrepended = QUrl::fromEncoded((QLatin1String("http://") + trimmedString).toUtf8(), QUrl::TolerantMode); + QUrl urlPrepended = QUrl::fromEncoded("http://" + trimmedString.toUtf8(), QUrl::TolerantMode); // Check the most common case of a valid url with scheme and host // We check if the port would be valid by adding the scheme to handle the case host:port diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 906979c..6f8331a 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -270,9 +270,9 @@ public: inline DataPtr &data_ptr() { return d; } }; -inline uint qHash(const QUrl &uri) +inline uint qHash(const QUrl &url) { - return qHash(uri.toEncoded(QUrl::FormattingOption(0x100))); + return qHash(url.toEncoded(QUrl::FormattingOption(0x100))); } Q_DECLARE_TYPEINFO(QUrl, Q_MOVABLE_TYPE); diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 5990f86..566626d 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -1021,14 +1021,14 @@ QString decodeMSG(const MSG& msg) LPWINDOWPOS winPos = (LPWINDOWPOS)lParam; if (!winPos) break; - QString hwndAfter = valueCheck((uint)winPos->hwndInsertAfter, - FLAG_STRING((uint)HWND_BOTTOM, "HWND_BOTTOM"), - FLAG_STRING((int)HWND_NOTOPMOST, "HWND_NOTOPMOST"), - FLAG_STRING((uint)HWND_TOP, "HWND_TOP"), - FLAG_STRING((int)HWND_TOPMOST, "HWND_TOPMOST"), + QString hwndAfter = valueCheck(quint64(winPos->hwndInsertAfter), + FLAG_STRING((quintptr)HWND_BOTTOM, "HWND_BOTTOM"), + FLAG_STRING((quintptr)HWND_NOTOPMOST, "HWND_NOTOPMOST"), + FLAG_STRING((quintptr)HWND_TOP, "HWND_TOP"), + FLAG_STRING((quintptr)HWND_TOPMOST, "HWND_TOPMOST"), FLAG_STRING()); if (hwndAfter.size() == 0) - hwndAfter = QString::number((uint)winPos->hwndInsertAfter, 16); + hwndAfter = QString::number((quintptr)winPos->hwndInsertAfter, 16); QString flags = flagCheck(winPos->flags, FLGSTR(SWP_DRAWFRAME), FLGSTR(SWP_FRAMECHANGED), diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 9e187d4..779b69b 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -225,101 +225,104 @@ QT_BEGIN_NAMESPACE \sa Q_DECLARE_METATYPE(), QVariant::setValue(), QVariant::value(), QVariant::fromValue() */ +#define QT_ADD_STATIC_METATYPE(STR, TP) \ + { STR, sizeof(STR) - 1, TP } + /* Note: these MUST be in the order of the enums */ -static const struct { const char * typeName; int type; } types[] = { +static const struct { const char * typeName; int typeNameLength; int type; } types[] = { /* All Core types */ - {"void", QMetaType::Void}, - {"bool", QMetaType::Bool}, - {"int", QMetaType::Int}, - {"uint", QMetaType::UInt}, - {"qlonglong", QMetaType::LongLong}, - {"qulonglong", QMetaType::ULongLong}, - {"double", QMetaType::Double}, - {"QChar", QMetaType::QChar}, - {"QVariantMap", QMetaType::QVariantMap}, - {"QVariantList", QMetaType::QVariantList}, - {"QString", QMetaType::QString}, - {"QStringList", QMetaType::QStringList}, - {"QByteArray", QMetaType::QByteArray}, - {"QBitArray", QMetaType::QBitArray}, - {"QDate", QMetaType::QDate}, - {"QTime", QMetaType::QTime}, - {"QDateTime", QMetaType::QDateTime}, - {"QUrl", QMetaType::QUrl}, - {"QLocale", QMetaType::QLocale}, - {"QRect", QMetaType::QRect}, - {"QRectF", QMetaType::QRectF}, - {"QSize", QMetaType::QSize}, - {"QSizeF", QMetaType::QSizeF}, - {"QLine", QMetaType::QLine}, - {"QLineF", QMetaType::QLineF}, - {"QPoint", QMetaType::QPoint}, - {"QPointF", QMetaType::QPointF}, - {"QRegExp", QMetaType::QRegExp}, - {"QVariantHash", QMetaType::QVariantHash}, - {"QEasingCurve", QMetaType::QEasingCurve}, + QT_ADD_STATIC_METATYPE("void", QMetaType::Void), + QT_ADD_STATIC_METATYPE("bool", QMetaType::Bool), + QT_ADD_STATIC_METATYPE("int", QMetaType::Int), + QT_ADD_STATIC_METATYPE("uint", QMetaType::UInt), + QT_ADD_STATIC_METATYPE("qlonglong", QMetaType::LongLong), + QT_ADD_STATIC_METATYPE("qulonglong", QMetaType::ULongLong), + QT_ADD_STATIC_METATYPE("double", QMetaType::Double), + QT_ADD_STATIC_METATYPE("QChar", QMetaType::QChar), + QT_ADD_STATIC_METATYPE("QVariantMap", QMetaType::QVariantMap), + QT_ADD_STATIC_METATYPE("QVariantList", QMetaType::QVariantList), + QT_ADD_STATIC_METATYPE("QString", QMetaType::QString), + QT_ADD_STATIC_METATYPE("QStringList", QMetaType::QStringList), + QT_ADD_STATIC_METATYPE("QByteArray", QMetaType::QByteArray), + QT_ADD_STATIC_METATYPE("QBitArray", QMetaType::QBitArray), + QT_ADD_STATIC_METATYPE("QDate", QMetaType::QDate), + QT_ADD_STATIC_METATYPE("QTime", QMetaType::QTime), + QT_ADD_STATIC_METATYPE("QDateTime", QMetaType::QDateTime), + QT_ADD_STATIC_METATYPE("QUrl", QMetaType::QUrl), + QT_ADD_STATIC_METATYPE("QLocale", QMetaType::QLocale), + QT_ADD_STATIC_METATYPE("QRect", QMetaType::QRect), + QT_ADD_STATIC_METATYPE("QRectF", QMetaType::QRectF), + QT_ADD_STATIC_METATYPE("QSize", QMetaType::QSize), + QT_ADD_STATIC_METATYPE("QSizeF", QMetaType::QSizeF), + QT_ADD_STATIC_METATYPE("QLine", QMetaType::QLine), + QT_ADD_STATIC_METATYPE("QLineF", QMetaType::QLineF), + QT_ADD_STATIC_METATYPE("QPoint", QMetaType::QPoint), + QT_ADD_STATIC_METATYPE("QPointF", QMetaType::QPointF), + QT_ADD_STATIC_METATYPE("QRegExp", QMetaType::QRegExp), + QT_ADD_STATIC_METATYPE("QVariantHash", QMetaType::QVariantHash), + QT_ADD_STATIC_METATYPE("QEasingCurve", QMetaType::QEasingCurve), /* All GUI types */ - {"QColorGroup", 63}, - {"QFont", QMetaType::QFont}, - {"QPixmap", QMetaType::QPixmap}, - {"QBrush", QMetaType::QBrush}, - {"QColor", QMetaType::QColor}, - {"QPalette", QMetaType::QPalette}, - {"QIcon", QMetaType::QIcon}, - {"QImage", QMetaType::QImage}, - {"QPolygon", QMetaType::QPolygon}, - {"QRegion", QMetaType::QRegion}, - {"QBitmap", QMetaType::QBitmap}, - {"QCursor", QMetaType::QCursor}, - {"QSizePolicy", QMetaType::QSizePolicy}, - {"QKeySequence", QMetaType::QKeySequence}, - {"QPen", QMetaType::QPen}, - {"QTextLength", QMetaType::QTextLength}, - {"QTextFormat", QMetaType::QTextFormat}, - {"QMatrix", QMetaType::QMatrix}, - {"QTransform", QMetaType::QTransform}, - {"QMatrix4x4", QMetaType::QMatrix4x4}, - {"QVector2D", QMetaType::QVector2D}, - {"QVector3D", QMetaType::QVector3D}, - {"QVector4D", QMetaType::QVector4D}, - {"QQuaternion", QMetaType::QQuaternion}, + QT_ADD_STATIC_METATYPE("QColorGroup", 63), + QT_ADD_STATIC_METATYPE("QFont", QMetaType::QFont), + QT_ADD_STATIC_METATYPE("QPixmap", QMetaType::QPixmap), + QT_ADD_STATIC_METATYPE("QBrush", QMetaType::QBrush), + QT_ADD_STATIC_METATYPE("QColor", QMetaType::QColor), + QT_ADD_STATIC_METATYPE("QPalette", QMetaType::QPalette), + QT_ADD_STATIC_METATYPE("QIcon", QMetaType::QIcon), + QT_ADD_STATIC_METATYPE("QImage", QMetaType::QImage), + QT_ADD_STATIC_METATYPE("QPolygon", QMetaType::QPolygon), + QT_ADD_STATIC_METATYPE("QRegion", QMetaType::QRegion), + QT_ADD_STATIC_METATYPE("QBitmap", QMetaType::QBitmap), + QT_ADD_STATIC_METATYPE("QCursor", QMetaType::QCursor), + QT_ADD_STATIC_METATYPE("QSizePolicy", QMetaType::QSizePolicy), + QT_ADD_STATIC_METATYPE("QKeySequence", QMetaType::QKeySequence), + QT_ADD_STATIC_METATYPE("QPen", QMetaType::QPen), + QT_ADD_STATIC_METATYPE("QTextLength", QMetaType::QTextLength), + QT_ADD_STATIC_METATYPE("QTextFormat", QMetaType::QTextFormat), + QT_ADD_STATIC_METATYPE("QMatrix", QMetaType::QMatrix), + QT_ADD_STATIC_METATYPE("QTransform", QMetaType::QTransform), + QT_ADD_STATIC_METATYPE("QMatrix4x4", QMetaType::QMatrix4x4), + QT_ADD_STATIC_METATYPE("QVector2D", QMetaType::QVector2D), + QT_ADD_STATIC_METATYPE("QVector3D", QMetaType::QVector3D), + QT_ADD_STATIC_METATYPE("QVector4D", QMetaType::QVector4D), + QT_ADD_STATIC_METATYPE("QQuaternion", QMetaType::QQuaternion), /* All Metatype builtins */ - {"void*", QMetaType::VoidStar}, - {"long", QMetaType::Long}, - {"short", QMetaType::Short}, - {"char", QMetaType::Char}, - {"ulong", QMetaType::ULong}, - {"ushort", QMetaType::UShort}, - {"uchar", QMetaType::UChar}, - {"float", QMetaType::Float}, - {"QObject*", QMetaType::QObjectStar}, - {"QWidget*", QMetaType::QWidgetStar}, + QT_ADD_STATIC_METATYPE("void*", QMetaType::VoidStar), + QT_ADD_STATIC_METATYPE("long", QMetaType::Long), + QT_ADD_STATIC_METATYPE("short", QMetaType::Short), + QT_ADD_STATIC_METATYPE("char", QMetaType::Char), + QT_ADD_STATIC_METATYPE("ulong", QMetaType::ULong), + QT_ADD_STATIC_METATYPE("ushort", QMetaType::UShort), + QT_ADD_STATIC_METATYPE("uchar", QMetaType::UChar), + QT_ADD_STATIC_METATYPE("float", QMetaType::Float), + QT_ADD_STATIC_METATYPE("QObject*", QMetaType::QObjectStar), + QT_ADD_STATIC_METATYPE("QWidget*", QMetaType::QWidgetStar), /* Type aliases - order doesn't matter */ - {"unsigned long", QMetaType::ULong}, - {"unsigned int", QMetaType::UInt}, - {"unsigned short", QMetaType::UShort}, - {"unsigned char", QMetaType::UChar}, - {"long long", QMetaType::LongLong}, - {"unsigned long long", QMetaType::ULongLong}, - {"qint8", QMetaType::Char}, - {"quint8", QMetaType::UChar}, - {"qint16", QMetaType::Short}, - {"quint16", QMetaType::UShort}, - {"qint32", QMetaType::Int}, - {"quint32", QMetaType::UInt}, - {"qint64", QMetaType::LongLong}, - {"quint64", QMetaType::ULongLong}, - {"QList<QVariant>", QMetaType::QVariantList}, - {"QMap<QString,QVariant>", QMetaType::QVariantMap}, - {"QHash<QString,QVariant>", QMetaType::QVariantHash}, + QT_ADD_STATIC_METATYPE("unsigned long", QMetaType::ULong), + QT_ADD_STATIC_METATYPE("unsigned int", QMetaType::UInt), + QT_ADD_STATIC_METATYPE("unsigned short", QMetaType::UShort), + QT_ADD_STATIC_METATYPE("unsigned char", QMetaType::UChar), + QT_ADD_STATIC_METATYPE("long long", QMetaType::LongLong), + QT_ADD_STATIC_METATYPE("unsigned long long", QMetaType::ULongLong), + QT_ADD_STATIC_METATYPE("qint8", QMetaType::Char), + QT_ADD_STATIC_METATYPE("quint8", QMetaType::UChar), + QT_ADD_STATIC_METATYPE("qint16", QMetaType::Short), + QT_ADD_STATIC_METATYPE("quint16", QMetaType::UShort), + QT_ADD_STATIC_METATYPE("qint32", QMetaType::Int), + QT_ADD_STATIC_METATYPE("quint32", QMetaType::UInt), + QT_ADD_STATIC_METATYPE("qint64", QMetaType::LongLong), + QT_ADD_STATIC_METATYPE("quint64", QMetaType::ULongLong), + QT_ADD_STATIC_METATYPE("QList<QVariant>", QMetaType::QVariantList), + QT_ADD_STATIC_METATYPE("QMap<QString,QVariant>", QMetaType::QVariantMap), + QT_ADD_STATIC_METATYPE("QHash<QString,QVariant>", QMetaType::QVariantHash), // let QMetaTypeId2 figure out the type at compile time - {"qreal", QMetaTypeId2<qreal>::MetaType}, + QT_ADD_STATIC_METATYPE("qreal", QMetaTypeId2<qreal>::MetaType), - {0, QMetaType::Void} + {0, 0, QMetaType::Void} }; struct QMetaTypeGuiHelper @@ -410,24 +413,35 @@ const char *QMetaType::typeName(int type) } /*! \internal - Same as QMetaType::type(), but doesn't lock the mutex. + Similar to QMetaType::type(), but only looks in the static set of types. */ -static int qMetaTypeType_unlocked(const QByteArray &typeName) +static inline int qMetaTypeStaticType(const char *typeName, int length) { int i = 0; - while (types[i].typeName && strcmp(typeName.constData(), types[i].typeName)) + while (types[i].typeName && ((length != types[i].typeNameLength) + || strcmp(typeName, types[i].typeName))) { ++i; - if (!types[i].type) { - const QVector<QCustomTypeInfo> * const ct = customTypes(); - if (!ct) - return 0; + } + return types[i].type; +} + +/*! \internal + Similar to QMetaType::type(), but only looks in the custom set of + types, and doesn't lock the mutex. +*/ +static int qMetaTypeCustomType_unlocked(const char *typeName, int length) +{ + const QVector<QCustomTypeInfo> * const ct = customTypes(); + if (!ct) + return 0; - for (int v = 0; v < ct->count(); ++v) { - if (ct->at(v).typeName == typeName) - return v + QMetaType::User; + for (int v = 0; v < ct->count(); ++v) { + if ((length == ct->at(v).typeName.size()) + && !strcmp(typeName, ct->at(v).typeName.constData())) { + return v + QMetaType::User; } } - return types[i].type; + return 0; } /*! \internal @@ -449,16 +463,21 @@ int QMetaType::registerType(const char *typeName, Destructor destructor, NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName); #endif - QWriteLocker locker(customTypesLock()); - int idx = qMetaTypeType_unlocked(normalizedTypeName); + int idx = qMetaTypeStaticType(normalizedTypeName.constData(), + normalizedTypeName.size()); if (!idx) { - QCustomTypeInfo inf; - inf.typeName = normalizedTypeName; - inf.constr = constructor; - inf.destr = destructor; - idx = ct->size() + User; - ct->append(inf); + QWriteLocker locker(customTypesLock()); + idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), + normalizedTypeName.size()); + if (!idx) { + QCustomTypeInfo inf; + inf.typeName = normalizedTypeName; + inf.constr = constructor; + inf.destr = destructor; + idx = ct->size() + User; + ct->append(inf); + } } return idx; } @@ -517,14 +536,24 @@ bool QMetaType::isRegistered(int type) */ int QMetaType::type(const char *typeName) { -#ifdef QT_NO_QOBJECT - const NS(QByteArray) normalizedTypeName = typeName; -#else - const NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName); + int length = qstrlen(typeName); + int type = qMetaTypeStaticType(typeName, length); + if (!type) { + QReadLocker locker(customTypesLock()); + type = qMetaTypeCustomType_unlocked(typeName, length); +#ifndef QT_NO_QOBJECT + if (!type) { + const NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName); + type = qMetaTypeStaticType(normalizedTypeName.constData(), + normalizedTypeName.size()); + if (!type) { + type = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), + normalizedTypeName.size()); + } + } #endif - - QReadLocker locker(customTypesLock()); - return qMetaTypeType_unlocked(normalizedTypeName); + } + return type; } #ifndef QT_NO_DATASTREAM diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 384a3cd..227a60d 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1936,13 +1936,13 @@ static const ushort map_from_three[MapFromThreeCount] = QVariant::Date, QVariant::Time, QVariant::DateTime, - QVariant::EasingCurve, QVariant::ByteArray, QVariant::BitArray, QVariant::KeySequence, QVariant::Pen, QVariant::LongLong, - QVariant::ULongLong + QVariant::ULongLong, + QVariant::EasingCurve }; /*! diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index ec50ac8..43df13a 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -41,6 +41,7 @@ #include "qplatformdefs.h" #include "qmutex.h" +#include <qdebug.h> #ifndef QT_NO_THREAD #include "qatomic.h" @@ -159,8 +160,7 @@ void QMutex::lock() if (!isLocked) { #ifndef QT_NO_DEBUG if (d->owner == self) - qWarning("QMutex::lock: Deadlock detected in thread %ld", - long(d->owner)); + qWarning() << "QMutex::lock: Deadlock detected in thread" << d->owner; #endif // didn't get the lock, wait for it @@ -197,8 +197,7 @@ void QMutex::lock() if (!isLocked) { #ifndef QT_NO_DEBUG if (d->owner == self) - qWarning("QMutex::lock: Deadlock detected in thread %ld", - long(d->owner)); + qWarning() << "QMutex::lock: Deadlock detected in thread" << d->owner; #endif // didn't get the lock, wait for it diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 89edb2d..d4b2c27 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -860,8 +860,8 @@ QDebug operator<<(QDebug debug, const QEasingCurve &item) QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) { - stream << easing.d_ptr->type; - stream << quint64(intptr_t(easing.d_ptr->func)); + stream << quint8(easing.d_ptr->type); + stream << quint64(quintptr(easing.d_ptr->func)); bool hasConfig = easing.d_ptr->config; stream << hasConfig; @@ -886,14 +886,14 @@ QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) { QEasingCurve::Type type; - int int_type; + quint8 int_type; stream >> int_type; type = static_cast<QEasingCurve::Type>(int_type); easing.setType(type); quint64 ptr_func; stream >> ptr_func; - easing.d_ptr->func = QEasingCurve::EasingFunction(intptr_t(ptr_func)); + easing.d_ptr->func = QEasingCurve::EasingFunction(quintptr(ptr_func)); bool hasConfig; stream >> hasConfig; diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index f1030ae..3374c80 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -625,6 +625,7 @@ template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<Key> QHash<Key, T>::uniqueKeys() const { QList<Key> res; + res.reserve(size()); // May be too much, but assume short lifetime const_iterator i = begin(); if (i != end()) { for (;;) { @@ -644,6 +645,7 @@ template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<Key> QHash<Key, T>::keys() const { QList<Key> res; + res.reserve(size()); const_iterator i = begin(); while (i != end()) { res.append(i.key()); @@ -688,6 +690,7 @@ template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<T> QHash<Key, T>::values() const { QList<T> res; + res.reserve(size()); const_iterator i = begin(); while (i != end()) { res.append(i.value()); diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 3a29e13..c6dd106 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -525,7 +525,8 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::append(const T &t) PodNode cpy = *reinterpret_cast<const PodNode *>(&t); Node *n = reinterpret_cast<Node *>(p.append()); QT_TRY { - node_construct(n, *reinterpret_cast<const T *>(&cpy)); + void *ptr = &cpy; + node_construct(n, *reinterpret_cast<T *>(ptr)); } QT_CATCH(...) { --d->end; QT_RETHROW; @@ -559,7 +560,8 @@ inline void QList<T>::prepend(const T &t) PodNode cpy = *reinterpret_cast<const PodNode *>(&t); Node *n = reinterpret_cast<Node *>(p.prepend()); QT_TRY { - node_construct(n, *reinterpret_cast<const T *>(&cpy)); + void *ptr = &cpy; + node_construct(n, *reinterpret_cast<T *>(ptr)); } QT_CATCH(...) { ++d->begin; QT_RETHROW; @@ -593,7 +595,8 @@ inline void QList<T>::insert(int i, const T &t) PodNode cpy = *reinterpret_cast<const PodNode *>(&t); Node *n = reinterpret_cast<Node *>(p.insert(i)); QT_TRY { - node_construct(n, *reinterpret_cast<const T *>(&cpy)); + void *ptr = &cpy; + node_construct(n, *reinterpret_cast<T *>(ptr)); } QT_CATCH(...) { p.remove(i); QT_RETHROW; @@ -808,15 +811,22 @@ Q_OUTOFLINE_TEMPLATE typename QList<T>::iterator QList<T>::erase(typename QList< template <typename T> Q_OUTOFLINE_TEMPLATE QList<T> &QList<T>::operator+=(const QList<T> &l) { - Node *n = (d->ref != 1) - ? detach_helper_grow(INT_MAX, l.size()) - : reinterpret_cast<Node *>(p.append2(l.p)); - QT_TRY{ - node_copy(n, reinterpret_cast<Node *>(p.end()), reinterpret_cast<Node *>(l.p.begin())); - } QT_CATCH(...) { - // restore the old end - d->end -= int(reinterpret_cast<Node *>(p.end()) - n); - QT_RETHROW; + if (!l.isEmpty()) { + if (isEmpty()) { + *this = l; + } else { + Node *n = (d->ref != 1) + ? detach_helper_grow(INT_MAX, l.size()) + : reinterpret_cast<Node *>(p.append2(l.p)); + QT_TRY { + node_copy(n, reinterpret_cast<Node *>(p.end()), + reinterpret_cast<Node *>(l.p.begin())); + } QT_CATCH(...) { + // restore the old end + d->end -= int(reinterpret_cast<Node *>(p.end()) - n); + QT_RETHROW; + } + } } return *this; } diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index b4bfcaf..84bc154 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -465,7 +465,7 @@ static QString winToQtFormat(const QString &sys_fmt) if (text == QLatin1String("'")) result += QLatin1String("''"); else - result += QLatin1Char('\'') + text + QLatin1Char('\''); + result += QString(QLatin1Char('\'') + text + QLatin1Char('\'')); continue; } @@ -681,8 +681,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case DateTimeFormatLong: case DateTimeFormatShort: - return query(type == DateTimeFormatLong ? DateFormatLong : DateFormatShort).toString() - + QLatin1Char(' ') + query(type == DateTimeFormatLong ? TimeFormatLong : TimeFormatShort).toString(); + return QString(query(type == DateTimeFormatLong ? DateFormatLong : DateFormatShort).toString() + + QLatin1Char(' ') + query(type == DateTimeFormatLong ? TimeFormatLong : TimeFormatShort).toString()); case DayNameLong: case DayNameShort: return winDayName(in.toInt(), (type == DayNameShort)); @@ -698,8 +698,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case DateTimeToStringShort: case DateTimeToStringLong: { const QDateTime dt = in.toDateTime(); - return winDateToString(dt.date(), type == DateTimeToStringShort ? DATE_SHORTDATE : DATE_LONGDATE) - + QLatin1Char(' ') + winTimeToString(dt.time()); } + return QString(winDateToString(dt.date(), type == DateTimeToStringShort ? DATE_SHORTDATE : DATE_LONGDATE) + + QLatin1Char(' ') + winTimeToString(dt.time())); } case ZeroDigit: locale_info = LOCALE_SNATIVEDIGITS; diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index b1a7caa..58e3ba8 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -841,7 +841,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const return symbianTimeFormat(); case DateTimeFormatLong: case DateTimeFormatShort: - return symbianDateFormat( (type == DateTimeFormatShort) ) + QLatin1Char(' ') + symbianTimeFormat(); + return QString(symbianDateFormat( (type == DateTimeFormatShort) ) + QLatin1Char(' ') + symbianTimeFormat()); case DateToStringShort: case DateToStringLong: return symbianDateToString(in.toDate(), (type == DateToStringShort) ); @@ -851,8 +851,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case DateTimeToStringShort: case DateTimeToStringLong: { const QDateTime dt = in.toDateTime(); - return symbianDateToString(dt.date(), (type == DateTimeToStringShort) ) - + QLatin1Char(' ') + symbianTimeToString(dt.time()); + return QString(symbianDateToString(dt.date(), (type == DateTimeToStringShort) ) + + QLatin1Char(' ') + symbianTimeToString(dt.time())); } case MeasurementSystem: return static_cast<int>(symbianMeasurementSystem()); diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 2e21547..df0ae46 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -773,6 +773,7 @@ template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::uniqueKeys() const { QList<Key> res; + res.reserve(size()); // May be too much, but assume short lifetime const_iterator i = begin(); if (i != end()) { for (;;) { @@ -792,6 +793,7 @@ template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::keys() const { QList<Key> res; + res.reserve(size()); const_iterator i = begin(); while (i != end()) { res.append(i.key()); @@ -836,6 +838,7 @@ template <class Key, class T> Q_OUTOFLINE_TEMPLATE QList<T> QMap<Key, T>::values() const { QList<T> res; + res.reserve(size()); const_iterator i = begin(); while (i != end()) { res.append(i.value()); diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 25255f9..20ad444 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -1466,9 +1466,14 @@ void QRegExpMatchState::match(const QChar *str0, int len0, int pos0, #ifndef QT_NO_REGEXP_CAPTURE for (int i = 0; i < numCaptures; ++i) { int j = eng->captureForOfficialCapture.at(i); - int len = capEnd[j] - capBegin[j]; - *c++ = (len > 0) ? pos + capBegin[j] : 0; - *c++ = len; + if (capBegin[j] != EmptyCapture) { + int len = capEnd[j] - capBegin[j]; + *c++ = (len > 0) ? pos + capBegin[j] : 0; + *c++ = len; + } else { + *c++ = -1; + *c++ = -1; + } } #endif } else { diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp index 12badf0..e7dd769 100644 --- a/src/corelib/tools/qscopedpointer.cpp +++ b/src/corelib/tools/qscopedpointer.cpp @@ -225,4 +225,59 @@ QT_BEGIN_NAMESPACE Swap this pointer with \a other. */ +/*! + \class QScopedArrayPointer + + \brief The QScopedArrayPointer class stores a pointer to a + dynamically allocated array of objects, and deletes it upon + destruction. + + \since 4.6 + \reentrant + \ingroup misc + + A QScopedArrayPointer is a QScopedPointer that defaults to + deleting the object it is pointing to with the delete[] operator. It + also features operator[] for convenience, so we can write: + + \code + void foo() + { + QScopedArrayPointer<int> i(new int[10]); + i[2] = 42; + ... + return; // our integer array is now deleted using delete[] + } + \endcode +*/ + +/*! + \fn QScopedArrayPointer::QScopedArrayPointer(T *p = 0) + + Constructs this QScopedArrayPointer instance and sets its pointer + to \a p. +*/ + +/*! + \fn T *QScopedArrayPointer::operator[](int i) + + Provides access to entry \a i of the scoped pointer's array of + objects. + + If the contained pointer is \c null, behavior is undefined. + + \sa isNull() +*/ + +/*! + \fn T *QScopedArrayPointer::operator[](int i) const + + Provides access to entry \a i of the scoped pointer's array of + objects. + + If the contained pointer is \c null, behavior is undefined. + + \sa isNull() +*/ + QT_END_NAMESPACE diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index d85c248..bfc65bc 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -209,6 +209,7 @@ namespace QtSharedPointer { inline bool destroy() { destroyer(this); return true; } inline void operator delete(void *ptr) { ::operator delete(ptr); } + inline void operator delete(void *, void *) { } }; // sizeof(ExternalRefCountWithDestroyFn) = 16 (32-bit) / 24 (64-bit) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp new file mode 100644 index 0000000..52d2cea --- /dev/null +++ b/src/corelib/tools/qsimd.cpp @@ -0,0 +1,246 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the 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 "qsimd_p.h" +#include <QByteArray> + +QT_BEGIN_NAMESPACE + +uint qDetectCPUFeatures() +{ + static uint features = 0xffffffff; + if (features != 0xffffffff) + return features; + +#if defined (Q_OS_WINCE) +#if defined (ARM) + if (IsProcessorFeaturePresent(PF_ARM_INTEL_WMMX)) { + features = IWMMXT; + return features; + } +#elif defined(_X86_) + features = 0; +#if defined QT_HAVE_MMX + if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE)) + features |= MMX; +#endif +#if defined QT_HAVE_3DNOW + if (IsProcessorFeaturePresent(PF_3DNOW_INSTRUCTIONS_AVAILABLE)) + features |= MMX3DNOW; +#endif + return features; +#endif + features = 0; + return features; +#elif defined(QT_HAVE_IWMMXT) + // runtime detection only available when running as a previlegied process + static const bool doIWMMXT = !qgetenv("QT_NO_IWMMXT").toInt(); + features = doIWMMXT ? IWMMXT : 0; + return features; +#elif defined(QT_HAVE_NEON) + static const bool doNEON = !qgetenv("QT_NO_NEON").toInt(); + features = doNEON ? NEON : 0; + return features; +#else + features = 0; +#if defined(__x86_64__) || defined(Q_OS_WIN64) + features = MMX|SSE|SSE2|CMOV; +#elif defined(__ia64__) + features = MMX|SSE|SSE2; +#elif defined(__i386__) || defined(_M_IX86) + unsigned int extended_result = 0; + uint result = 0; + /* see p. 118 of amd64 instruction set manual Vol3 */ +#if defined(Q_CC_GNU) + asm ("push %%ebx\n" + "pushf\n" + "pop %%eax\n" + "mov %%eax, %%ebx\n" + "xor $0x00200000, %%eax\n" + "push %%eax\n" + "popf\n" + "pushf\n" + "pop %%eax\n" + "xor %%edx, %%edx\n" + "xor %%ebx, %%eax\n" + "jz 1f\n" + + "mov $0x00000001, %%eax\n" + "cpuid\n" + "1:\n" + "pop %%ebx\n" + "mov %%edx, %0\n" + : "=r" (result) + : + : "%eax", "%ecx", "%edx" + ); + + asm ("push %%ebx\n" + "pushf\n" + "pop %%eax\n" + "mov %%eax, %%ebx\n" + "xor $0x00200000, %%eax\n" + "push %%eax\n" + "popf\n" + "pushf\n" + "pop %%eax\n" + "xor %%edx, %%edx\n" + "xor %%ebx, %%eax\n" + "jz 2f\n" + + "mov $0x80000000, %%eax\n" + "cpuid\n" + "cmp $0x80000000, %%eax\n" + "jbe 2f\n" + "mov $0x80000001, %%eax\n" + "cpuid\n" + "2:\n" + "pop %%ebx\n" + "mov %%edx, %0\n" + : "=r" (extended_result) + : + : "%eax", "%ecx", "%edx" + ); +#elif defined (Q_OS_WIN) + _asm { + push eax + push ebx + push ecx + push edx + pushfd + pop eax + mov ebx, eax + xor eax, 00200000h + push eax + popfd + pushfd + pop eax + mov edx, 0 + xor eax, ebx + jz skip + + mov eax, 1 + cpuid + mov result, edx + skip: + pop edx + pop ecx + pop ebx + pop eax + } + + _asm { + push eax + push ebx + push ecx + push edx + pushfd + pop eax + mov ebx, eax + xor eax, 00200000h + push eax + popfd + pushfd + pop eax + mov edx, 0 + xor eax, ebx + jz skip2 + + mov eax, 80000000h + cpuid + cmp eax, 80000000h + jbe skip2 + mov eax, 80000001h + cpuid + mov extended_result, edx + skip2: + pop edx + pop ecx + pop ebx + pop eax + } +#endif + + // result now contains the standard feature bits + if (result & (1u << 15)) + features |= CMOV; + if (result & (1u << 23)) + features |= MMX; + if (extended_result & (1u << 22)) + features |= MMXEXT; + if (extended_result & (1u << 31)) + features |= MMX3DNOW; + if (extended_result & (1u << 30)) + features |= MMX3DNOWEXT; + if (result & (1u << 25)) + features |= SSE; + if (result & (1u << 26)) + features |= SSE2; +#endif // i386 + +#if defined(QT_HAVE_MMX) + if (qgetenv("QT_NO_MMX").toInt()) + features ^= MMX; +#endif + if (qgetenv("QT_NO_MMXEXT").toInt()) + features ^= MMXEXT; + +#if defined(QT_HAVE_3DNOW) + if (qgetenv("QT_NO_3DNOW").toInt()) + features ^= MMX3DNOW; +#endif + if (qgetenv("QT_NO_3DNOWEXT").toInt()) + features ^= MMX3DNOWEXT; + +#if defined(QT_HAVE_SSE) + if (qgetenv("QT_NO_SSE").toInt()) + features ^= SSE; +#endif +#if defined(QT_HAVE_SSE2) + if (qgetenv("QT_NO_SSE2").toInt()) + features ^= SSE2; +#endif + + return features; +#endif +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h new file mode 100644 index 0000000..44c1798 --- /dev/null +++ b/src/corelib/tools/qsimd_p.h @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the 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$ +** +****************************************************************************/ + +#ifndef QSIMD_P_H +#define QSIMD_P_H + +#include <qglobal.h> + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__))) +// Disable MMX and SSE on Mac/PPC builds, or if the compiler +// does not support -Xarch argument passing +#undef QT_HAVE_SSE2 +#undef QT_HAVE_SSE +#undef QT_HAVE_3DNOW +#undef QT_HAVE_MMX +#endif + +// SSE intrinsics +#if defined(__SSE2__) && defined(QT_HAVE_SSE2) && !defined(QT_BOOTSTRAPPED) +#if defined(QT_LINUXBASE) +/// this is an evil hack - the posix_memalign declaration in LSB +/// is wrong - see http://bugs.linuxbase.org/show_bug.cgi?id=2431 +# define posix_memalign _lsb_hack_posix_memalign +# include <emmintrin.h> +# undef posix_memalign +#else +# include <emmintrin.h> +#endif + +#define QT_ALWAYS_HAVE_SSE2 +#endif + +// NEON intrinsics +#if defined(QT_HAVE_NEON) +#include <arm_neon.h> +#endif + + +// IWMMXT intrinsics +#if defined(QT_HAVE_IWMMXT) +#include <mmintrin.h> +#if defined(Q_OS_WINCE) +# include "qplatformdefs.h" +#endif +#endif + +#if defined(QT_HAVE_IWMMXT) +#if !defined(__IWMMXT__) && !defined(Q_OS_WINCE) +# include <xmmintrin.h> +#elif defined(Q_OS_WINCE_STD) && defined(_X86_) +# pragma warning(disable: 4391) +# include <xmmintrin.h> +#endif +#endif + +// 3D now intrinsics +#if defined(QT_HAVE_3DNOW) +#include <mm3dnow.h> +#endif + +enum CPUFeatures { + None = 0, + MMX = 0x1, + MMXEXT = 0x2, + MMX3DNOW = 0x4, + MMX3DNOWEXT = 0x8, + SSE = 0x10, + SSE2 = 0x20, + CMOV = 0x40, + IWMMXT = 0x80, + NEON = 0x100 +}; + + +QT_END_NAMESPACE + +QT_END_HEADER + +Q_CORE_EXPORT uint qDetectCPUFeatures(); + +#endif // QSIMD_P_H diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index ac1bee7..e9b7b9a 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -46,6 +46,7 @@ #include <qtextcodec.h> #endif #include <private/qutfcodec_p.h> +#include "qsimd_p.h" #include <qdatastream.h> #include <qlist.h> #include "qlocale.h" @@ -3479,12 +3480,82 @@ static QByteArray toLatin1_helper(const QChar *data, int length) QByteArray ba; if (length) { ba.resize(length); - const ushort *i = reinterpret_cast<const ushort *>(data); - const ushort *e = i + length; - uchar *s = (uchar*) ba.data(); - while (i != e) { - *s++ = (*i>0xff) ? '?' : (uchar) *i; - ++i; + const ushort *src = reinterpret_cast<const ushort *>(data); + uchar *dst = (uchar*) ba.data(); +#if defined(QT_ALWAYS_HAVE_SSE2) + if (length >= 16) { + const int chunkCount = length >> 4; // divided by 16 + const __m128i questionMark = _mm_set1_epi16('?'); + // SSE has no compare instruction for unsigned comparison. + // The variables must be shiffted + 0x8000 to be compared + const __m128i signedBitOffset = _mm_set1_epi16(0x8000); + const __m128i thresholdMask = _mm_set1_epi16(0xff + 0x8000); + for (int i = 0; i < chunkCount; ++i) { + __m128i chunk1 = _mm_loadu_si128((__m128i*)src); // load + src += 8; + { + // each 16 bit is equal to 0xFF if the source is outside latin 1 (>0xff) + const __m128i signedChunk = _mm_add_epi16(chunk1, signedBitOffset); + const __m128i offLimitMask = _mm_cmpgt_epi16(signedChunk, thresholdMask); + + // offLimitQuestionMark contains '?' for each 16 bits that was off-limit + // the 16 bits that were correct contains zeros + const __m128i offLimitQuestionMark = _mm_and_si128(offLimitMask, questionMark); + + // correctBytes contains the bytes that were in limit + // the 16 bits that were off limits contains zeros + const __m128i correctBytes = _mm_andnot_si128(offLimitMask, chunk1); + + // merge offLimitQuestionMark and correctBytes to have the result + chunk1 = _mm_or_si128(correctBytes, offLimitQuestionMark); + } + + __m128i chunk2 = _mm_loadu_si128((__m128i*)src); // load + src += 8; + { + // exactly the same operations as for the previous chunk of data + const __m128i signedChunk = _mm_add_epi16(chunk2, signedBitOffset); + const __m128i offLimitMask = _mm_cmpgt_epi16(signedChunk, thresholdMask); + const __m128i offLimitQuestionMark = _mm_and_si128(offLimitMask, questionMark); + const __m128i correctBytes = _mm_andnot_si128(offLimitMask, chunk2); + chunk2 = _mm_or_si128(correctBytes, offLimitQuestionMark); + } + + // pack the two vector to 16 x 8bits elements + const __m128i result = _mm_packus_epi16(chunk1, chunk2); + + _mm_storeu_si128((__m128i*)dst, result); // store + dst += 16; + } + length = length % 16; + } +#elif QT_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 + // 2) packing is done to 64 bits (8 x 8bits component). + if (length >= 16) { + const int chunkCount = length >> 3; // divided by 8 + const uint16x8_t questionMark = vdupq_n_u16('?'); // set + const uint16x8_t thresholdMask = vdupq_n_u16(0xff); // set + for (int i = 0; i < chunkCount; ++i) { + uint16x8_t chunk = vld1q_u16((uint16_t *)src); // load + src += 8; + + const uint16x8_t offLimitMask = vcgtq_u16(chunk, thresholdMask); // chunk > thresholdMask + const uint16x8_t offLimitQuestionMark = vandq_u16(offLimitMask, questionMark); // offLimitMask & questionMark + const uint16x8_t correctBytes = vbicq_u16(chunk, offLimitMask); // !offLimitMask & chunk + chunk = vorrq_u16(correctBytes, offLimitQuestionMark); // correctBytes | offLimitQuestionMark + const uint8x8_t result = vmovn_u16(chunk); // narrowing move->packing + vst1_u8(dst, result); // store + dst += 8; + } + length = length % 8; + } +#endif + while (length--) { + *dst++ = (*src>0xff) ? '?' : (uchar) *src; + ++src; } } return ba; @@ -3647,10 +3718,35 @@ QString::Data *QString::fromLatin1_helper(const char *str, int size) d->alloc = d->size = size; d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0; d->data = d->array; - ushort *i = d->data; d->array[size] = '\0'; + ushort *dst = d->data; + /* SIMD: + * Unpacking with SSE has been shown to improve performance on recent CPUs + * The same method gives no improvement with NEON. + */ +#if defined(QT_ALWAYS_HAVE_SSE2) + if (size >= 16) { + int chunkCount = size >> 4; // divided by 16 + const __m128i nullMask = _mm_set1_epi32(0); + for (int i = 0; i < chunkCount; ++i) { + const __m128i chunk = _mm_loadu_si128((__m128i*)str); // load + str += 16; + + // unpack the first 8 bytes, padding with zeros + const __m128i firstHalf = _mm_unpacklo_epi8(chunk, nullMask); + _mm_storeu_si128((__m128i*)dst, firstHalf); // store + dst += 8; + + // unpack the last 8 bytes, padding with zeros + const __m128i secondHalf = _mm_unpackhi_epi8 (chunk, nullMask); + _mm_storeu_si128((__m128i*)dst, secondHalf); // store + dst += 8; + } + size = size % 16; + } +#endif while (size--) - *i++ = (uchar)*str++; + *dst++ = (uchar)*str++; } return d; } diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 8de3c7d..a59c0bd 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -73,6 +73,16 @@ typedef std::basic_string<wchar_t> QStdWString; #error qstring.h must be included before any header file that defines truncate #endif +#if defined(Q_CC_GNU) && (__GNUC__ == 4 && __GNUC_MINOR__ == 0) +//There is a bug in GCC 4.0 that tries to instantiate template of annonymous enum +# ifdef QT_USE_FAST_OPERATOR_PLUS +# undef QT_USE_FAST_OPERATOR_PLUS +# endif +# ifdef QT_USE_FAST_CONCATENATION +# undef QT_USE_FAST_CONCATENATION +# endif +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 74661c2..0c3ba06 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -100,14 +100,18 @@ public: operator QString() const { - QString s(QConcatenable< QStringBuilder<A, B> >::size(*this), - Qt::Uninitialized); + const uint size = QConcatenable< QStringBuilder<A, B> >::size(*this); + QString s(size, Qt::Uninitialized); QChar *d = s.data(); + const QChar * const start = d; QConcatenable< QStringBuilder<A, B> >::appendTo(*this, d); - // this resize is necessary since we allocate a bit too much - // when dealing with variable sized 8-bit encodings - s.resize(d - s.data()); + + if (!QConcatenable< QStringBuilder<A, B> >::ExactSize && int(size) != d - start) { + // this resize is necessary since we allocate a bit too much + // when dealing with variable sized 8-bit encodings + s.resize(d - start); + } return s; } QByteArray toLatin1() const { return QString(*this).toLatin1(); } @@ -116,10 +120,24 @@ public: const B &b; }; +template <> +class QStringBuilder <QString, QString> +{ + public: + QStringBuilder(const QString &a_, const QString &b_) : a(a_), b(b_) {} + + operator QString() const + { QString r(a); r += b; return r; } + QByteArray toLatin1() const { return QString(*this).toLatin1(); } + + const QString &a; + const QString &b; +}; template <> struct QConcatenable<char> : private QAbstractConcatenable { typedef char type; + enum { ExactSize = true }; static int size(const char) { return 1; } static inline void appendTo(const char c, QChar *&out) { @@ -130,6 +148,7 @@ template <> struct QConcatenable<char> : private QAbstractConcatenable template <> struct QConcatenable<QLatin1Char> { typedef QLatin1Char type; + enum { ExactSize = true }; static int size(const QLatin1Char) { return 1; } static inline void appendTo(const QLatin1Char c, QChar *&out) { @@ -140,6 +159,7 @@ template <> struct QConcatenable<QLatin1Char> template <> struct QConcatenable<QChar> { typedef QChar type; + enum { ExactSize = true }; static int size(const QChar) { return 1; } static inline void appendTo(const QChar c, QChar *&out) { @@ -150,6 +170,7 @@ template <> struct QConcatenable<QChar> template <> struct QConcatenable<QCharRef> { typedef QCharRef type; + enum { ExactSize = true }; static int size(const QCharRef &) { return 1; } static inline void appendTo(const QCharRef &c, QChar *&out) { @@ -160,6 +181,7 @@ template <> struct QConcatenable<QCharRef> template <> struct QConcatenable<QLatin1String> { typedef QLatin1String type; + enum { ExactSize = true }; static int size(const QLatin1String &a) { return qstrlen(a.latin1()); } static inline void appendTo(const QLatin1String &a, QChar *&out) { @@ -172,6 +194,7 @@ template <> struct QConcatenable<QLatin1String> template <> struct QConcatenable<QLatin1Literal> { typedef QLatin1Literal type; + enum { ExactSize = true }; static int size(const QLatin1Literal &a) { return a.size(); } static inline void appendTo(const QLatin1Literal &a, QChar *&out) { @@ -183,6 +206,7 @@ template <> struct QConcatenable<QLatin1Literal> template <> struct QConcatenable<QString> { typedef QString type; + enum { ExactSize = true }; static int size(const QString &a) { return a.size(); } static inline void appendTo(const QString &a, QChar *&out) { @@ -195,6 +219,7 @@ template <> struct QConcatenable<QString> template <> struct QConcatenable<QStringRef> { typedef QStringRef type; + enum { ExactSize = true }; static int size(const QStringRef &a) { return a.size(); } static inline void appendTo(QStringRef a, QChar *&out) { @@ -208,6 +233,7 @@ template <> struct QConcatenable<QStringRef> template <int N> struct QConcatenable<char[N]> : private QAbstractConcatenable { typedef char type[N]; + enum { ExactSize = false }; static int size(const char[N]) { return N - 1; @@ -221,6 +247,7 @@ template <int N> struct QConcatenable<char[N]> : private QAbstractConcatenable template <int N> struct QConcatenable<const char[N]> : private QAbstractConcatenable { typedef const char type[N]; + enum { ExactSize = false }; static int size(const char[N]) { return N - 1; } static inline void appendTo(const char a[N], QChar *&out) { @@ -231,6 +258,7 @@ template <int N> struct QConcatenable<const char[N]> : private QAbstractConcaten template <> struct QConcatenable<const char *> : private QAbstractConcatenable { typedef char const *type; + enum { ExactSize = false }; static int size(const char *a) { return qstrlen(a); } static inline void appendTo(const char *a, QChar *&out) { @@ -241,6 +269,7 @@ template <> struct QConcatenable<const char *> : private QAbstractConcatenable template <> struct QConcatenable<QByteArray> : private QAbstractConcatenable { typedef QByteArray type; + enum { ExactSize = false }; static int size(const QByteArray &ba) { return qstrnlen(ba.constData(), ba.size()); } static inline void appendTo(const QByteArray &ba, QChar *&out) { @@ -253,6 +282,7 @@ template <typename A, typename B> struct QConcatenable< QStringBuilder<A, B> > { typedef QStringBuilder<A, B> type; + enum { ExactSize = QConcatenable<A>::ExactSize && QConcatenable<B>::ExactSize }; static int size(const type &p) { return QConcatenable<A>::size(p.a) + QConcatenable<B>::size(p.b); diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 3406e41..6d64915 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -33,6 +33,7 @@ HEADERS += \ tools/qsharedpointer.h \ tools/qsharedpointer_impl.h \ tools/qset.h \ + tools/qsimd_p.h \ tools/qsize.h \ tools/qstack.h \ tools/qstring.h \ @@ -68,6 +69,7 @@ SOURCES += \ tools/qregexp.cpp \ tools/qshareddata.cpp \ tools/qsharedpointer.cpp \ + tools/qsimd.cpp \ tools/qsize.cpp \ tools/qstring.cpp \ tools/qstringbuilder.cpp \ diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index cf1080b..34e4834 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,7 +1,17 @@ ============================================================================= The changes below are pre Qt 4.7.0 alpha +Flickable: renamed viewportWidth -> contentWidth +Flickable: renamed viewportHeight -> contentHeight +Flickable: renamed viewportX -> contentX +Flickable: renamed viewportY -> contentY +Removed Flickable.reportedVelocitySmoothing Renamed MouseRegion -> MouseArea +Connection: syntax and rename: + Connection { sender: a; signal: foo(); script: xxx } + Connection { sender: a; signal: bar(); script: yyy } + becomes: + Connections { target: a; onFoo: xxx; onBar: yyy } QmlView ------- diff --git a/src/declarative/graphicsitems/qdeclarativeeffects.cpp b/src/declarative/graphicsitems/qdeclarativeeffects.cpp index efab24e..ea1f9cc 100644 --- a/src/declarative/graphicsitems/qdeclarativeeffects.cpp +++ b/src/declarative/graphicsitems/qdeclarativeeffects.cpp @@ -45,6 +45,7 @@ /*! \qmlclass Blur QGraphicsBlurEffect + \since 4.7 \brief The Blur object provides a blur effect. A blur effect blurs the source item. This effect is useful for reducing details; @@ -80,6 +81,7 @@ /*! \qmlclass Colorize QGraphicsColorizeEffect + \since 4.7 \brief The Colorize object provides a colorize effect. A colorize effect renders the source item with a tint of its color. @@ -106,6 +108,7 @@ /*! \qmlclass DropShadow QGraphicsDropShadowEffect + \since 4.7 \brief The DropShadow object provides a drop shadow effect. A drop shadow effect renders the source item with a drop shadow. The color of @@ -147,6 +150,7 @@ /*! \qmlclass Opacity QGraphicsOpacityEffect + \since 4.7 \brief The Opacity object provides an opacity effect. An opacity effect renders the source with an opacity. This effect is useful diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp index d2cbb54..8be2f40 100644 --- a/src/declarative/graphicsitems/qdeclarativeevents.cpp +++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp @@ -114,6 +114,7 @@ Item { /*! \qmlclass MouseEvent QDeclarativeMouseEvent + \since 4.7 \brief The MouseEvent object provides information about a mouse event. The position of the mouse can be found via the x and y properties. diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 9f19f53..c54ddd0 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -128,7 +128,7 @@ QDeclarativeFlickablePrivate::QDeclarativeFlickablePrivate() , vWidth(-1), vHeight(-1), overShoot(true), flicked(false), moving(false), stealMouse(false) , pressed(false), atXEnd(false), atXBeginning(true), atYEnd(false), atYBeginning(true) , interactive(true), deceleration(500), maxVelocity(2000), reportedVelocitySmoothing(100) - , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(200) + , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(600) , horizontalVelocity(this), verticalVelocity(this), vTime(0), visibleArea(0) , flickDirection(QDeclarativeFlickable::AutoFlickDirection) { @@ -142,12 +142,29 @@ void QDeclarativeFlickablePrivate::init() QObject::connect(&timeline, SIGNAL(completed()), q, SLOT(movementEnding())); q->setAcceptedMouseButtons(Qt::LeftButton); q->setFiltersChildEvents(true); - QObject::connect(viewport, SIGNAL(xChanged()), q, SIGNAL(positionXChanged())); - QObject::connect(viewport, SIGNAL(yChanged()), q, SIGNAL(positionYChanged())); + QObject::connect(viewport, SIGNAL(xChanged()), q, SIGNAL(contentXChanged())); + QObject::connect(viewport, SIGNAL(yChanged()), q, SIGNAL(contentYChanged())); QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(heightChange())); QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(widthChange())); } +/* + Returns the amount to overshoot by given a velocity. + Will be roughly in range 0 - size/4 +*/ +qreal QDeclarativeFlickablePrivate::overShootDistance(qreal velocity, qreal size) +{ + Q_Q(QDeclarativeFlickable); + if (maxVelocity <= 0) + return 0.0; + + velocity = qAbs(velocity); + if (velocity > maxVelocity) + velocity = maxVelocity; + qreal dist = size / 4 * velocity / maxVelocity; + return dist; +} + void QDeclarativeFlickablePrivate::flickX(qreal velocity) { Q_Q(QDeclarativeFlickable); @@ -156,12 +173,12 @@ void QDeclarativeFlickablePrivate::flickX(qreal velocity) if (velocity > 0) { const qreal minX = q->minXExtent(); if (_moveX.value() < minX) - maxDistance = qAbs(minX -_moveX.value() + (overShoot?30:0)); + maxDistance = qAbs(minX -_moveX.value() + (overShoot?overShootDistance(velocity,q->width()):0)); flickTargetX = minX; } else { const qreal maxX = q->maxXExtent(); if (_moveX.value() > maxX) - maxDistance = qAbs(maxX - _moveX.value()) + (overShoot?30:0); + maxDistance = qAbs(maxX - _moveX.value()) + (overShoot?overShootDistance(velocity,q->width()):0); flickTargetX = maxX; } if (maxDistance > 0) { @@ -194,12 +211,12 @@ void QDeclarativeFlickablePrivate::flickY(qreal velocity) if (velocity > 0) { const qreal minY = q->minYExtent(); if (_moveY.value() < minY) - maxDistance = qAbs(minY -_moveY.value() + (overShoot?30:0)); + maxDistance = qAbs(minY -_moveY.value() + (overShoot?overShootDistance(velocity,q->height()):0)); flickTargetY = minY; } else { const qreal maxY = q->maxYExtent(); if (_moveY.value() > maxY) - maxDistance = qAbs(maxY - _moveY.value()) + (overShoot?30:0); + maxDistance = qAbs(maxY - _moveY.value()) + (overShoot?overShootDistance(velocity,q->height()):0); flickTargetY = maxY; } if (maxDistance > 0) { @@ -233,18 +250,24 @@ void QDeclarativeFlickablePrivate::fixupX() if (_moveX.value() > q->minXExtent() || (q->maxXExtent() > q->minXExtent())) { timeline.reset(_moveX); if (_moveX.value() != q->minXExtent()) { - if (fixupDuration) - timeline.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration); - else - _moveY.setValue(q->minYExtent()); + if (fixupDuration) { + qreal dist = q->minXExtent() - _moveX; + timeline.move(_moveX, q->minXExtent() - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4); + timeline.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4); + } else { + _moveX.setValue(q->minXExtent()); + } } //emit flickingChanged(); } else if (_moveX.value() < q->maxXExtent()) { timeline.reset(_moveX); - if (fixupDuration) - timeline.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration); - else - _moveY.setValue(q->maxYExtent()); + if (fixupDuration) { + qreal dist = q->maxXExtent() - _moveX; + timeline.move(_moveX, q->maxXExtent() - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4); + timeline.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4); + } else { + _moveX.setValue(q->maxXExtent()); + } //emit flickingChanged(); } else { flicked = false; @@ -272,18 +295,24 @@ void QDeclarativeFlickablePrivate::fixupY() if (_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) { timeline.reset(_moveY); if (_moveY.value() != q->minYExtent()) { - if (fixupDuration) - timeline.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration); - else + if (fixupDuration) { + qreal dist = q->minYExtent() - _moveY; + timeline.move(_moveY, q->minYExtent() - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4); + timeline.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4); + } else { _moveY.setValue(q->minYExtent()); + } } //emit flickingChanged(); } else if (_moveY.value() < q->maxYExtent()) { timeline.reset(_moveY); - if (fixupDuration) - timeline.move(_moveY, q->maxYExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration); - else + if (fixupDuration) { + qreal dist = q->maxYExtent() - _moveY; + timeline.move(_moveY, q->maxYExtent() - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4); + timeline.move(_moveY, q->maxYExtent(), QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4); + } else { _moveY.setValue(q->maxYExtent()); + } //emit flickingChanged(); } else { flicked = false; @@ -336,6 +365,7 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() /*! \qmlclass Flickable QDeclarativeFlickable + \since 4.7 \brief The Flickable item provides a surface that can be "flicked". \inherits Item @@ -343,7 +373,7 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() \code Flickable { - width: 200; height: 200; viewportWidth: image.width; viewportHeight: image.height + width: 200; height: 200; contentWidth: image.width; contentHeight: image.height Image { id: image; source: "bigimage.png" } } \endcode @@ -429,20 +459,20 @@ QDeclarativeFlickable::~QDeclarativeFlickable() } /*! - \qmlproperty int Flickable::viewportX - \qmlproperty int Flickable::viewportY + \qmlproperty int Flickable::contentX + \qmlproperty int Flickable::contentY These properties hold the surface coordinate currently at the top-left corner of the Flickable. For example, if you flick an image up 100 pixels, - \c yPosition will be 100. + \c contentY will be 100. */ -qreal QDeclarativeFlickable::viewportX() const +qreal QDeclarativeFlickable::contentX() const { Q_D(const QDeclarativeFlickable); return -d->_moveX.value(); } -void QDeclarativeFlickable::setViewportX(qreal pos) +void QDeclarativeFlickable::setContentX(qreal pos) { Q_D(QDeclarativeFlickable); pos = qRound(pos); @@ -454,13 +484,13 @@ void QDeclarativeFlickable::setViewportX(qreal pos) } } -qreal QDeclarativeFlickable::viewportY() const +qreal QDeclarativeFlickable::contentY() const { Q_D(const QDeclarativeFlickable); return -d->_moveY.value(); } -void QDeclarativeFlickable::setViewportY(qreal pos) +void QDeclarativeFlickable::setContentY(qreal pos) { Q_D(QDeclarativeFlickable); pos = qRound(pos); @@ -506,12 +536,10 @@ void QDeclarativeFlickable::setInteractive(bool interactive) /*! \qmlproperty real Flickable::horizontalVelocity \qmlproperty real Flickable::verticalVelocity - \qmlproperty real Flickable::reportedVelocitySmoothing The instantaneous velocity of movement along the x and y axes, in pixels/sec. The reported velocity is smoothed to avoid erratic output. - reportedVelocitySmoothing determines how much smoothing is applied. */ qreal QDeclarativeFlickable::horizontalVelocity() const { @@ -584,8 +612,8 @@ QDeclarativeFlickableVisibleArea *QDeclarativeFlickable::visibleArea() \list \o AutoFlickDirection (default) - allows flicking vertically if the - \e viewportHeight is not equal to the \e height of the Flickable. - Allows flicking horizontally if the \e viewportWidth is not equal + \e contentHeight is not equal to the \e height of the Flickable. + Allows flicking horizontally if the \e contentWidth is not equal to the \e width of the Flickable. \o HorizontalFlick - allows flicking horizontally. \o VerticalFlick - allows flicking vertically. @@ -968,10 +996,10 @@ QDeclarativeListProperty<QDeclarativeItem> QDeclarativeFlickable::flickableChild /*! \qmlproperty bool Flickable::overShoot - This property holds the number of pixels the surface may overshoot the + This property holds whether the surface may overshoot the Flickable's boundaries when flicked. - If overShoot is non-zero the contents can be flicked beyond the boundary + If overShoot is true the contents can be flicked beyond the boundary of the Flickable before being moved back to the boundary. This provides the feeling that the edges of the view are soft, rather than a hard physical boundary. @@ -992,26 +1020,26 @@ void QDeclarativeFlickable::setOverShoot(bool o) } /*! - \qmlproperty int Flickable::viewportWidth - \qmlproperty int Flickable::viewportHeight + \qmlproperty int Flickable::contentWidth + \qmlproperty int Flickable::contentHeight - The dimensions of the viewport (the surface controlled by Flickable). Typically this + The dimensions of the content (the surface controlled by Flickable). Typically this should be set to the combined size of the items placed in the Flickable. \code Flickable { - width: 320; height: 480; viewportWidth: image.width; viewportHeight: image.height + width: 320; height: 480; contentWidth: image.width; contentHeight: image.height Image { id: image; source: "bigimage.png" } } \endcode */ -qreal QDeclarativeFlickable::viewportWidth() const +qreal QDeclarativeFlickable::contentWidth() const { Q_D(const QDeclarativeFlickable); return d->vWidth; } -void QDeclarativeFlickable::setViewportWidth(qreal w) +void QDeclarativeFlickable::setContentWidth(qreal w) { Q_D(QDeclarativeFlickable); if (d->vWidth == w) @@ -1024,7 +1052,7 @@ void QDeclarativeFlickable::setViewportWidth(qreal w) // Make sure that we're entirely in view. if (!d->pressed) d->fixupX(); - emit viewportWidthChanged(); + emit contentWidthChanged(); d->updateBeginningEnd(); } @@ -1033,7 +1061,7 @@ void QDeclarativeFlickable::widthChange() Q_D(QDeclarativeFlickable); if (d->vWidth < 0) { d->viewport->setWidth(width()); - emit viewportWidthChanged(); + emit contentWidthChanged(); } d->updateBeginningEnd(); } @@ -1043,18 +1071,18 @@ void QDeclarativeFlickable::heightChange() Q_D(QDeclarativeFlickable); if (d->vHeight < 0) { d->viewport->setHeight(height()); - emit viewportHeightChanged(); + emit contentHeightChanged(); } d->updateBeginningEnd(); } -qreal QDeclarativeFlickable::viewportHeight() const +qreal QDeclarativeFlickable::contentHeight() const { Q_D(const QDeclarativeFlickable); return d->vHeight; } -void QDeclarativeFlickable::setViewportHeight(qreal h) +void QDeclarativeFlickable::setContentHeight(qreal h) { Q_D(QDeclarativeFlickable); if (d->vHeight == h) @@ -1067,7 +1095,7 @@ void QDeclarativeFlickable::setViewportHeight(qreal h) // Make sure that we're entirely in view. if (!d->pressed) d->fixupY(); - emit viewportHeightChanged(); + emit contentHeightChanged(); d->updateBeginningEnd(); } @@ -1259,22 +1287,6 @@ void QDeclarativeFlickable::setPressDelay(int delay) emit pressDelayChanged(); } -qreal QDeclarativeFlickable::reportedVelocitySmoothing() const -{ - Q_D(const QDeclarativeFlickable); - return d->reportedVelocitySmoothing; -} - -void QDeclarativeFlickable::setReportedVelocitySmoothing(qreal reportedVelocitySmoothing) -{ - Q_D(QDeclarativeFlickable); - Q_ASSERT(reportedVelocitySmoothing >= 0); - if (reportedVelocitySmoothing == d->reportedVelocitySmoothing) - return; - d->reportedVelocitySmoothing = reportedVelocitySmoothing; - emit reportedVelocitySmoothingChanged(reportedVelocitySmoothing); -} - /*! \qmlproperty bool Flickable::moving diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h index 19fb2a9..4617688 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h @@ -56,14 +56,13 @@ class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem { Q_OBJECT - Q_PROPERTY(qreal viewportWidth READ viewportWidth WRITE setViewportWidth NOTIFY viewportWidthChanged) - Q_PROPERTY(qreal viewportHeight READ viewportHeight WRITE setViewportHeight NOTIFY viewportHeightChanged) - Q_PROPERTY(qreal viewportX READ viewportX WRITE setViewportX NOTIFY positionXChanged) - Q_PROPERTY(qreal viewportY READ viewportY WRITE setViewportY NOTIFY positionYChanged) + Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged) + Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged) + Q_PROPERTY(qreal contentX READ contentX WRITE setContentX NOTIFY contentXChanged) + Q_PROPERTY(qreal contentY READ contentY WRITE setContentY NOTIFY contentYChanged) Q_PROPERTY(qreal horizontalVelocity READ horizontalVelocity NOTIFY horizontalVelocityChanged) Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged) - Q_PROPERTY(qreal reportedVelocitySmoothing READ reportedVelocitySmoothing WRITE setReportedVelocitySmoothing NOTIFY reportedVelocitySmoothingChanged) Q_PROPERTY(bool overShoot READ overShoot WRITE setOverShoot NOTIFY overShootChanged) Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged) @@ -98,17 +97,17 @@ public: bool overShoot() const; void setOverShoot(bool); - qreal viewportWidth() const; - void setViewportWidth(qreal); + qreal contentWidth() const; + void setContentWidth(qreal); - qreal viewportHeight() const; - void setViewportHeight(qreal); + qreal contentHeight() const; + void setContentHeight(qreal); - qreal viewportX() const; - void setViewportX(qreal pos); + qreal contentX() const; + void setContentX(qreal pos); - qreal viewportY() const; - void setViewportY(qreal pos); + qreal contentY() const; + void setContentY(qreal pos); bool isMoving() const; bool isFlicking() const; @@ -116,9 +115,6 @@ public: int pressDelay() const; void setPressDelay(int delay); - qreal reportedVelocitySmoothing() const; - void setReportedVelocitySmoothing(qreal); - qreal maximumFlickVelocity() const; void setMaximumFlickVelocity(qreal); @@ -143,17 +139,16 @@ public: void setFlickDirection(FlickDirection); Q_SIGNALS: - void viewportWidthChanged(); - void viewportHeightChanged(); - void positionXChanged(); - void positionYChanged(); + void contentWidthChanged(); + void contentHeightChanged(); + void contentXChanged(); + void contentYChanged(); void movingChanged(); void flickingChanged(); void movementStarted(); void movementEnded(); void flickStarted(); void flickEnded(); - void reportedVelocitySmoothingChanged(int); void horizontalVelocityChanged(); void verticalVelocityChanged(); void isAtBoundaryChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h index dc3a8a2..ad7a04d 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h @@ -85,6 +85,8 @@ public: void setRoundedViewportX(qreal x); void setRoundedViewportY(qreal y); + qreal overShootDistance(qreal velocity, qreal size); + public: QDeclarativeItem *viewport; QDeclarativeTimeLineValueProxy<QDeclarativeFlickablePrivate> _moveX; @@ -132,8 +134,10 @@ public: Velocity(QDeclarativeFlickablePrivate *p) : parent(p) {} virtual void setValue(qreal v) { - QDeclarativeTimeLineValue::setValue(v); - parent->updateVelocity(); + if (v != value()) { + QDeclarativeTimeLineValue::setValue(v); + parent->updateVelocity(); + } } QDeclarativeFlickablePrivate *parent; }; diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index b378db2..b43b30b 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -133,14 +133,14 @@ public: qreal position() const { Q_Q(const QDeclarativeGridView); - return flow == QDeclarativeGridView::LeftToRight ? q->viewportY() : q->viewportX(); + return flow == QDeclarativeGridView::LeftToRight ? q->contentY() : q->contentX(); } void setPosition(qreal pos) { Q_Q(QDeclarativeGridView); if (flow == QDeclarativeGridView::LeftToRight) - q->setViewportY(pos); + q->setContentY(pos); else - q->setViewportX(pos); + q->setContentX(pos); } int size() const { Q_Q(const QDeclarativeGridView); @@ -315,9 +315,9 @@ FxGridItem *QDeclarativeGridViewPrivate::createItem(int modelIndex) if (QDeclarativeItem *item = model->item(modelIndex, false)) { listItem = new FxGridItem(item, q); listItem->index = modelIndex; + listItem->item->setZValue(1); // complete model->completeItem(); - listItem->item->setZValue(1); listItem->item->setParent(q->viewport()); unrequestedItems.remove(listItem->item); } @@ -458,9 +458,9 @@ void QDeclarativeGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) } if (changed) { if (flow == QDeclarativeGridView::LeftToRight) - q->setViewportHeight(endPosition() - startPosition()); + q->setContentHeight(endPosition() - startPosition()); else - q->setViewportWidth(endPosition() - startPosition()); + q->setContentWidth(endPosition() - startPosition()); } else if (!doBuffer && buffer && bufferMode != NoBuffer) { refill(from, to, true); } @@ -473,9 +473,9 @@ void QDeclarativeGridViewPrivate::updateGrid() columns = (int)qMax((flow == QDeclarativeGridView::LeftToRight ? q->width() : q->height()) / colSize(), qreal(1.)); if (isValid()) { if (flow == QDeclarativeGridView::LeftToRight) - q->setViewportHeight(endPosition() - startPosition()); + q->setContentHeight(endPosition() - startPosition()); else - q->setViewportWidth(endPosition() - startPosition()); + q->setContentWidth(endPosition() - startPosition()); } } @@ -516,10 +516,10 @@ void QDeclarativeGridViewPrivate::layout(bool removed) updateHighlight(); moveReason = Other; if (flow == QDeclarativeGridView::LeftToRight) { - q->setViewportHeight(endPosition() - startPosition()); + q->setContentHeight(endPosition() - startPosition()); fixupY(); } else { - q->setViewportWidth(endPosition() - startPosition()); + q->setContentWidth(endPosition() - startPosition()); fixupX(); } updateUnrequestedPositions(); @@ -607,11 +607,11 @@ void QDeclarativeGridViewPrivate::createHighlight() item->setParent(q->viewport()); highlight = new FxGridItem(item, q); highlightXAnimator = new QDeclarativeEaseFollow(q); - highlightXAnimator->setTarget(QDeclarativeMetaProperty(highlight->item, QLatin1String("x"))); + highlightXAnimator->setTarget(QDeclarativeProperty(highlight->item, QLatin1String("x"))); highlightXAnimator->setDuration(150); highlightXAnimator->setEnabled(autoHighlight); highlightYAnimator = new QDeclarativeEaseFollow(q); - highlightYAnimator->setTarget(QDeclarativeMetaProperty(highlight->item, QLatin1String("y"))); + highlightYAnimator->setTarget(QDeclarativeProperty(highlight->item, QLatin1String("y"))); highlightYAnimator->setDuration(150); highlightYAnimator->setEnabled(autoHighlight); changed = true; @@ -675,6 +675,7 @@ void QDeclarativeGridViewPrivate::updateCurrent(int modelIndex) /*! \qmlclass GridView QDeclarativeGridView + \since 4.7 \inherits Flickable \brief The GridView item provides a grid view of items provided by a model. @@ -1028,10 +1029,10 @@ void QDeclarativeGridView::setFlow(Flow flow) if (d->flow != flow) { d->flow = flow; if (d->flow == LeftToRight) { - setViewportWidth(-1); + setContentWidth(-1); setFlickDirection(QDeclarativeFlickable::VerticalFlick); } else { - setViewportHeight(-1); + setContentHeight(-1); setFlickDirection(QDeclarativeFlickable::HorizontalFlick); } d->clear(); diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 338b086..99ab053 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -127,7 +127,7 @@ QT_BEGIN_NAMESPACE QDeclarativeImage::QDeclarativeImage(QDeclarativeItem *parent) : QDeclarativeImageBase(*(new QDeclarativeImagePrivate), parent) { - connect(this, SIGNAL(sourceChanged(QUrl)), this, SLOT(updatePaintedGeometry())); + connect(this, SIGNAL(pixmapChanged()), this, SLOT(updatePaintedGeometry())); } QDeclarativeImage::QDeclarativeImage(QDeclarativeImagePrivate &dd, QDeclarativeItem *parent) @@ -139,12 +139,6 @@ QDeclarativeImage::~QDeclarativeImage() { } -void QDeclarativeImage::setSource(const QUrl &url) -{ - QDeclarativeImageBase::setSource(url); - updatePaintedGeometry(); -} - /*! \qmlproperty QPixmap Image::pixmap @@ -268,10 +262,10 @@ void QDeclarativeImage::updatePaintedGeometry() Q_D(QDeclarativeImage); if (d->fillMode == PreserveAspectFit) { - qreal widthScale = width() / qreal(d->pix.width()); - qreal heightScale = height() / qreal(d->pix.height()); if (!d->pix.width() || !d->pix.height()) return; + qreal widthScale = width() / qreal(d->pix.width()); + qreal heightScale = height() / qreal(d->pix.height()); if (widthScale <= heightScale) { d->paintedWidth = width(); d->paintedHeight = widthScale * qreal(d->pix.height()); diff --git a/src/declarative/graphicsitems/qdeclarativeimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h index 5b365e7..fb77ac9 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h @@ -76,7 +76,6 @@ public: qreal paintedWidth() const; qreal paintedHeight() const; - void setSource(const QUrl &url); void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); Q_SIGNALS: diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index c282808..f48c761 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1730,8 +1730,12 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry, if (d->_anchors) d->_anchors->d_func()->updateMe(); - if (transformOrigin() != QDeclarativeItem::TopLeft) - setTransformOriginPoint(d->computeTransformOrigin()); + if (transformOrigin() != QDeclarativeItem::TopLeft + && (newGeometry.width() != oldGeometry.width() || newGeometry.height() != oldGeometry.height())) { + QPointF origin = d->computeTransformOrigin(); + if (transformOriginPoint() != origin) + setTransformOriginPoint(origin); + } if (newGeometry.x() != oldGeometry.x()) emit xChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h index 81c5688..4b4917e 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h @@ -60,8 +60,8 @@ #include "qdeclarativeitemchangelistener_p.h" #include <private/qpodvector_p.h> -#include "../util/qdeclarativestate_p.h" -#include "../util/qdeclarativenullablevalue_p_p.h" +#include <private/qdeclarativestate_p.h> +#include <private/qdeclarativenullablevalue_p_p.h> #include <qdeclarative.h> #include <qdeclarativecontext.h> diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index bd2f4fc..03303a0 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -203,14 +203,14 @@ public: qreal position() const { Q_Q(const QDeclarativeListView); - return orient == QDeclarativeListView::Vertical ? q->viewportY() : q->viewportX(); + return orient == QDeclarativeListView::Vertical ? q->contentY() : q->contentX(); } void setPosition(qreal pos) { Q_Q(QDeclarativeListView); if (orient == QDeclarativeListView::Vertical) - q->setViewportY(pos); + q->setContentY(pos); else - q->setViewportX(pos); + q->setContentX(pos); } qreal size() const { Q_Q(const QDeclarativeListView); @@ -382,9 +382,9 @@ public: void updateViewport() { Q_Q(QDeclarativeListView); if (orient == QDeclarativeListView::Vertical) { - q->setViewportHeight(endPosition() - startPosition() + 1); + q->setContentHeight(endPosition() - startPosition() + 1); } else { - q->setViewportWidth(endPosition() - startPosition() + 1); + q->setContentWidth(endPosition() - startPosition() + 1); } } @@ -530,9 +530,9 @@ FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex) listItem->attached->m_prevSection = sectionAt(modelIndex-1); } } + listItem->item->setZValue(1); // complete model->completeItem(); - listItem->item->setZValue(1); listItem->item->setParent(q->viewport()); QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item)); itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); @@ -804,13 +804,13 @@ void QDeclarativeListViewPrivate::createHighlight() highlight->item->setWidth(currentItem->item->width()); const QLatin1String posProp(orient == QDeclarativeListView::Vertical ? "y" : "x"); highlightPosAnimator = new QDeclarativeEaseFollow(q); - highlightPosAnimator->setTarget(QDeclarativeMetaProperty(highlight->item, posProp)); + highlightPosAnimator->setTarget(QDeclarativeProperty(highlight->item, posProp)); highlightPosAnimator->setVelocity(highlightMoveSpeed); highlightPosAnimator->setEnabled(autoHighlight); const QLatin1String sizeProp(orient == QDeclarativeListView::Vertical ? "height" : "width"); highlightSizeAnimator = new QDeclarativeEaseFollow(q); highlightSizeAnimator->setVelocity(highlightResizeSpeed); - highlightSizeAnimator->setTarget(QDeclarativeMetaProperty(highlight->item, sizeProp)); + highlightSizeAnimator->setTarget(QDeclarativeProperty(highlight->item, sizeProp)); highlightSizeAnimator->setEnabled(autoHighlight); changed = true; } @@ -1073,7 +1073,7 @@ void QDeclarativeListViewPrivate::fixupY() qreal pos = currentItem->position() - highlightRangeStart; timeline.reset(_moveY); if (fixupDuration) - timeline.move(_moveY, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration); + timeline.move(_moveY, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2); else _moveY.setValue(-pos); vTime = timeline.time(); @@ -1085,7 +1085,7 @@ void QDeclarativeListViewPrivate::fixupY() if (dist > 0) { timeline.reset(_moveY); if (fixupDuration) - timeline.move(_moveY, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration); + timeline.move(_moveY, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2); else _moveY.setValue(-pos); vTime = timeline.time(); @@ -1155,7 +1155,7 @@ void QDeclarativeListViewPrivate::flickX(qreal velocity) if (FxListItem *item = firstVisibleItem()) maxDistance = qAbs(item->position() + _moveX.value()); } else if (_moveX.value() < minX) { - maxDistance = qAbs(minX -_moveX.value() + (overShoot?30:0)); + maxDistance = qAbs(minX -_moveX.value() + (overShoot?overShootDistance(velocity, q->width()):0)); } if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange) flickTargetX = minX; @@ -1164,7 +1164,7 @@ void QDeclarativeListViewPrivate::flickX(qreal velocity) if (FxListItem *item = nextVisibleItem()) maxDistance = qAbs(item->position() + _moveX.value()); } else if (_moveX.value() > maxX) { - maxDistance = qAbs(maxX - _moveX.value()) + (overShoot?30:0); + maxDistance = qAbs(maxX - _moveX.value()) + (overShoot?overShootDistance(velocity, q->width()):0); } if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange) flickTargetX = maxX; @@ -1196,7 +1196,7 @@ void QDeclarativeListViewPrivate::flickX(qreal velocity) overshootDist = 0.0; } else { flickTargetX = velocity > 0 ? minX : maxX; - overshootDist = overShoot ? 30 : 0; + overshootDist = overShoot ? overShootDistance(v, q->width()) : 0; } timeline.reset(_moveX); timeline.accel(_moveX, v, accel, maxDistance + overshootDist); @@ -1253,7 +1253,7 @@ void QDeclarativeListViewPrivate::flickY(qreal velocity) if (FxListItem *item = firstVisibleItem()) maxDistance = qAbs(item->position() + _moveY.value()); } else if (_moveY.value() < minY) { - maxDistance = qAbs(minY -_moveY.value() + (overShoot?30:0)); + maxDistance = qAbs(minY -_moveY.value() + (overShoot?overShootDistance(velocity, q->height()):0)); } if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange) flickTargetY = minY; @@ -1262,7 +1262,7 @@ void QDeclarativeListViewPrivate::flickY(qreal velocity) if (FxListItem *item = nextVisibleItem()) maxDistance = qAbs(item->position() + _moveY.value()); } else if (_moveY.value() > maxY) { - maxDistance = qAbs(maxY - _moveY.value()) + (overShoot?30:0); + maxDistance = qAbs(maxY - _moveY.value()) + (overShoot?overShootDistance(velocity, q->height()):0); } if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange) flickTargetY = maxY; @@ -1294,7 +1294,7 @@ void QDeclarativeListViewPrivate::flickY(qreal velocity) overshootDist = 0.0; } else { flickTargetY = velocity > 0 ? minY : maxY; - overshootDist = overShoot ? 30 : 0; + overshootDist = overShoot ? overShootDistance(v, q->height()) : 0; } timeline.reset(_moveY); timeline.accel(_moveY, v, accel, maxDistance + overshootDist); @@ -1819,10 +1819,10 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie if (d->orient != orientation) { d->orient = orientation; if (d->orient == QDeclarativeListView::Vertical) { - setViewportWidth(-1); + setContentWidth(-1); setFlickDirection(VerticalFlick); } else { - setViewportHeight(-1); + setContentHeight(-1); setFlickDirection(HorizontalFlick); } d->clear(); @@ -1980,6 +1980,12 @@ void QDeclarativeListView::setHighlightResizeSpeed(qreal speed) visible item at the time the mouse button is released. This mode is particularly useful for moving one page at a time. \endlist + + snapMode does not affect the currentIndex. To update the + currentIndex as the list is moved set \e highlightRangeMode + to \e StrictlyEnforceRange. + + \sa highlightRangeMode */ QDeclarativeListView::SnapMode QDeclarativeListView::snapMode() const { diff --git a/src/declarative/graphicsitems/qdeclarativeparticles.cpp b/src/declarative/graphicsitems/qdeclarativeparticles.cpp index 3c07798..1a58d3f 100644 --- a/src/declarative/graphicsitems/qdeclarativeparticles.cpp +++ b/src/declarative/graphicsitems/qdeclarativeparticles.cpp @@ -1260,7 +1260,7 @@ void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphics const int myX = x() + parentItem()->x(); const int myY = y() + parentItem()->y(); - QVarLengthArray<QDrawPixmaps::Data, 256> pixmapData; + QVarLengthArray<QPainter::Fragment, 256> pixmapData; pixmapData.resize(d->particles.count()); const QRectF sourceRect = d->image.rect(); @@ -1268,16 +1268,20 @@ void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphics qreal halfPHeight = sourceRect.height()/2.; for (int i = 0; i < d->particles.count(); ++i) { const QDeclarativeParticle &particle = d->particles.at(i); - pixmapData[i].point = QPointF(particle.x - myX + halfPWidth, particle.y - myY + halfPHeight); + pixmapData[i].x = particle.x - myX + halfPWidth; + pixmapData[i].y = particle.y - myY + halfPHeight; pixmapData[i].opacity = particle.opacity; //these never change pixmapData[i].rotation = 0; pixmapData[i].scaleX = 1; pixmapData[i].scaleY = 1; - pixmapData[i].source = sourceRect; + pixmapData[i].sourceLeft = sourceRect.left(); + pixmapData[i].sourceTop = sourceRect.top(); + pixmapData[i].width = sourceRect.width(); + pixmapData[i].height = sourceRect.height(); } - qDrawPixmaps(p, pixmapData.data(), d->particles.count(), d->image); + p->drawPixmapFragments(pixmapData.data(), d->particles.count(), d->image); } void QDeclarativeParticles::componentComplete() diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index c131f4c..f1b0213 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -111,7 +111,7 @@ QDeclarativeItem *QDeclarativePathViewPrivate::getItem(int modelIndex) { Q_Q(QDeclarativePathView); requestedIndex = modelIndex; - QDeclarativeItem *item = model->item(modelIndex); + QDeclarativeItem *item = model->item(modelIndex, false); if (item) { if (QObject *obj = QDeclarativePathView::qmlAttachedProperties(item)) static_cast<QDeclarativePathViewAttached *>(obj)->setOnPath(true); @@ -655,6 +655,7 @@ void QDeclarativePathViewPrivate::regenerate() } items.append(item); item->setZValue(i); + model->completeItem(); if (currentIndex == index) item->setFocus(true); } @@ -715,6 +716,7 @@ void QDeclarativePathView::refill() int index = (d->firstIndex + d->items.count())%d->model->count(); QDeclarativeItem *item = d->getItem(index); item->setZValue(wrapIndex); + d->model->completeItem(); if (d->currentIndex == index) item->setFocus(true); d->items << item; @@ -731,6 +733,7 @@ void QDeclarativePathView::refill() d->firstIndex = d->model->count() - 1; QDeclarativeItem *item = d->getItem(d->firstIndex); item->setZValue(d->firstIndex); + d->model->completeItem(); if (d->currentIndex == d->firstIndex) item->setFocus(true); d->items.prepend(item); @@ -757,6 +760,7 @@ void QDeclarativePathView::itemsInserted(int modelIndex, int count) for (int i = 0; i < count; ++i) { QDeclarativeItem *item = d->getItem(modelIndex + i); item->setZValue(modelIndex + i); + d->model->completeItem(); d->items.insert(modelIndex + i, item); } refill(); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index ff6fc4b..f38847c 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -44,7 +44,7 @@ #include "qdeclarativeitem.h" -#include "../util/qdeclarativestate_p.h" +#include <private/qdeclarativestate_p.h> #include <private/qpodvector_p.h> #include <QtCore/QObject> diff --git a/src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h b/src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h index 92b3f91..fbf9040 100644 --- a/src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h @@ -44,7 +44,7 @@ #include "qdeclarativeborderimage_p.h" -#include "../util/qdeclarativepixmapcache_p.h" +#include <private/qdeclarativepixmapcache_p.h> #include <qdeclarative.h> #include <QtCore/QString> diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 9919904..3382628 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -704,6 +704,8 @@ bool QDeclarativeTextInput::event(QEvent* ev) break; default: handled = d->control->processEvent(ev); + if (ev->type() == QEvent::InputMethod) + updateSize(); } if(!handled) return QDeclarativePaintedItem::event(ev); diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 2402648..cd72ef9 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -917,7 +917,7 @@ QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(Q if (inPackage) { emit destroyingPackage(qobject_cast<QDeclarativePackage*>(obj)); } else { - item->setVisible(false); + item->setOpacity(0.0); static_cast<QGraphicsItem*>(item)->setParentItem(0); } stat |= Destroyed; diff --git a/src/declarative/graphicsitems/qdeclarativewebview.cpp b/src/declarative/graphicsitems/qdeclarativewebview.cpp index 61b5b56..a2b16ba 100644 --- a/src/declarative/graphicsitems/qdeclarativewebview.cpp +++ b/src/declarative/graphicsitems/qdeclarativewebview.cpp @@ -177,6 +177,8 @@ void QDeclarativeWebView::init() { Q_D(QDeclarativeWebView); + QWebSettings::enablePersistentStorage(); + setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::LeftButton); setFlag(QGraphicsItem::ItemHasNoContents, false); @@ -955,6 +957,7 @@ void QDeclarativeWebView::setPage(QWebPage *page) connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect))); connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged())); connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); + connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged())); connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize))); connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout())); diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g index e1cb5a5..7cf81b2 100644 --- a/src/declarative/qml/parser/qdeclarativejs.g +++ b/src/declarative/qml/parser/qdeclarativejs.g @@ -65,6 +65,7 @@ %token T_PUBLIC "public" %token T_IMPORT "import" %token T_AS "as" +%token T_ON "on" --- feed tokens %token T_FEED_UI_PROGRAM @@ -773,6 +774,17 @@ case $rule_number: { } break; ./ +UiObjectMember: UiQualifiedId T_ON UiQualifiedId UiObjectInitializer ; +/. +case $rule_number: { + AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(), + sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer); + node->colonToken = loc(2); + node->hasOnToken = true; + sym(1).Node = node; +} break; +./ + UiObjectMember: UiQualifiedId T_COLON Block ; /.case $rule_number:./ @@ -870,8 +882,8 @@ case $rule_number: { } break; ./ -UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT T_IDENTIFIER T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT T_IDENTIFIER T_SEMICOLON ; +UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_AUTOMATIC_SEMICOLON ; +UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_SEMICOLON ; /. case $rule_number: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval); @@ -885,8 +897,8 @@ case $rule_number: { } break; ./ -UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_SEMICOLON ; +UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ; +UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ; /. case $rule_number: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval); @@ -898,8 +910,8 @@ case $rule_number: { } break; ./ -UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_SEMICOLON ; +UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ; +UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ; /. case $rule_number: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval); @@ -913,8 +925,8 @@ case $rule_number: { } break; ./ -UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_SEMICOLON ; +UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ; +UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ; /. case $rule_number: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval, @@ -928,8 +940,8 @@ case $rule_number: { } break; ./ -UiObjectMember: T_READONLY T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_READONLY T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_SEMICOLON ; +UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ; +UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ; /. case $rule_number: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval, @@ -945,8 +957,8 @@ case $rule_number: { } break; ./ -UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_AUTOMATIC_SEMICOLON ; -UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_SEMICOLON ; +UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ; +UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ; /. case $rule_number: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval, @@ -1005,6 +1017,15 @@ case $rule_number: { } ./ +JsIdentifier: T_ON ; +/. +case $rule_number: { + QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]); + sym(1).sval = driver->intern(s.constData(), s.length()); + break; +} +./ + -------------------------------------------------------------------------------------------------------- -- Expressions -------------------------------------------------------------------------------------------------------- diff --git a/src/declarative/qml/parser/qdeclarativejsast_p.h b/src/declarative/qml/parser/qdeclarativejsast_p.h index 0a83fe2..c1945ce 100644 --- a/src/declarative/qml/parser/qdeclarativejsast_p.h +++ b/src/declarative/qml/parser/qdeclarativejsast_p.h @@ -2599,11 +2599,17 @@ public: UiObjectInitializer *initializer) : qualifiedId(qualifiedId), qualifiedTypeNameId(qualifiedTypeNameId), - initializer(initializer) + initializer(initializer), + hasOnToken(false) { kind = K; } virtual SourceLocation firstSourceLocation() const - { return qualifiedId->identifierToken; } + { + if (hasOnToken && qualifiedTypeNameId) + return qualifiedTypeNameId->identifierToken; + + return qualifiedId->identifierToken; + } virtual SourceLocation lastSourceLocation() const { return initializer->rbraceToken; } @@ -2615,6 +2621,7 @@ public: UiQualifiedId *qualifiedTypeNameId; UiObjectInitializer *initializer; SourceLocation colonToken; + bool hasOnToken; }; class QML_PARSER_EXPORT UiScriptBinding: public UiObjectMember diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp index aadb432..0677bc5 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp +++ b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp @@ -54,581 +54,608 @@ const char *const QDeclarativeJSGrammar::spell [] = { ")", ";", 0, "*", "*=", "string literal", "property", "signal", "readonly", "switch", "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^", "^=", "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "comment", "public", - "import", "as", 0, 0, 0, 0, 0, 0, 0, 0}; + "import", "as", "on", 0, 0, 0, 0, 0, 0, 0, + 0}; const short QDeclarativeJSGrammar::lhs [] = { - 100, 100, 100, 100, 100, 100, 101, 107, 107, 110, - 110, 112, 111, 111, 111, 111, 111, 111, 111, 111, - 114, 109, 108, 117, 117, 118, 118, 119, 119, 116, - 105, 105, 105, 105, 105, 105, 105, 125, 125, 125, - 126, 126, 127, 127, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 115, 115, 115, 115, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 120, 132, 132, 132, 132, 131, - 131, 134, 134, 136, 136, 136, 136, 136, 136, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 138, 138, 113, 113, 113, 113, 113, 141, 141, 142, - 142, 142, 142, 140, 140, 143, 143, 144, 144, 145, - 145, 145, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 147, 147, 147, 147, 148, 148, 148, 149, - 149, 149, 149, 150, 150, 150, 150, 150, 150, 150, - 151, 151, 151, 151, 151, 151, 152, 152, 152, 152, - 152, 153, 153, 153, 153, 153, 154, 154, 155, 155, + 101, 101, 101, 101, 101, 101, 102, 108, 108, 111, + 111, 113, 112, 112, 112, 112, 112, 112, 112, 112, + 115, 110, 109, 118, 118, 119, 119, 120, 120, 117, + 106, 106, 106, 106, 106, 106, 106, 106, 126, 126, + 126, 127, 127, 128, 128, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 116, 116, 116, 116, 116, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 121, 133, 133, 133, + 133, 132, 132, 135, 135, 137, 137, 137, 137, 137, + 137, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 139, 139, 114, 114, 114, 114, 114, 142, + 142, 143, 143, 143, 143, 141, 141, 144, 144, 145, + 145, 146, 146, 146, 147, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 148, 148, 148, 148, 149, 149, + 149, 150, 150, 150, 150, 151, 151, 151, 151, 151, + 151, 151, 152, 152, 152, 152, 152, 152, 153, 153, + 153, 153, 153, 154, 154, 154, 154, 154, 155, 155, 156, 156, 157, 157, 158, 158, 159, 159, 160, 160, 161, 161, 162, 162, 163, 163, 164, 164, 165, 165, - 135, 135, 166, 166, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 103, 103, 168, 168, - 169, 169, 170, 170, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 121, - 182, 182, 181, 181, 129, 129, 183, 183, 184, 184, - 186, 186, 185, 187, 190, 188, 188, 191, 189, 189, - 122, 123, 123, 124, 124, 171, 171, 171, 171, 171, - 171, 171, 172, 172, 172, 172, 173, 173, 173, 173, - 174, 174, 175, 177, 192, 192, 195, 195, 193, 193, - 196, 194, 176, 176, 176, 178, 178, 179, 179, 179, - 197, 198, 180, 180, 128, 139, 202, 202, 199, 199, - 200, 200, 203, 106, 204, 204, 104, 104, 201, 201, - 133, 133, 205}; + 166, 166, 136, 136, 167, 167, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 104, 104, + 169, 169, 170, 170, 171, 171, 103, 103, 103, 103, + 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, + 103, 122, 183, 183, 182, 182, 130, 130, 184, 184, + 185, 185, 187, 187, 186, 188, 191, 189, 189, 192, + 190, 190, 123, 124, 124, 125, 125, 172, 172, 172, + 172, 172, 172, 172, 173, 173, 173, 173, 174, 174, + 174, 174, 175, 175, 176, 178, 193, 193, 196, 196, + 194, 194, 197, 195, 177, 177, 177, 179, 179, 180, + 180, 180, 198, 199, 181, 181, 129, 140, 203, 203, + 200, 200, 201, 201, 204, 107, 205, 205, 105, 105, + 202, 202, 134, 134, 206}; const short QDeclarativeJSGrammar::rhs [] = { 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 1, 2, 2, 3, 3, 5, 5, 4, 4, 2, 0, 1, 1, 2, 1, 3, 2, 3, 2, - 1, 5, 4, 3, 3, 3, 3, 1, 1, 1, - 0, 1, 2, 4, 6, 6, 3, 3, 7, 7, - 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, + 1, 5, 4, 4, 3, 3, 3, 3, 1, 1, + 1, 0, 1, 2, 4, 6, 6, 3, 3, 7, + 7, 4, 4, 5, 5, 6, 6, 7, 7, 7, + 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 3, 4, 5, 3, 4, 3, 1, 1, 2, 3, + 4, 1, 2, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, - 5, 3, 4, 3, 1, 1, 2, 3, 4, 1, - 2, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 4, 3, 5, 1, 2, 4, - 4, 4, 3, 0, 1, 1, 3, 1, 1, 1, - 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 1, 3, 3, 3, 1, 3, 3, 1, - 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, - 1, 3, 3, 3, 3, 3, 1, 3, 3, 3, - 3, 1, 3, 3, 3, 3, 1, 3, 1, 3, + 1, 1, 1, 1, 1, 1, 4, 3, 5, 1, + 2, 4, 4, 4, 3, 0, 1, 1, 3, 1, + 1, 1, 2, 2, 1, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 1, 3, 3, 3, 1, 3, + 3, 1, 3, 3, 3, 1, 3, 3, 3, 3, + 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, + 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, - 1, 3, 1, 3, 1, 3, 1, 5, 1, 5, - 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 0, 1, - 1, 3, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 5, + 1, 5, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 1, 2, 0, 1, 3, 3, 1, 1, 1, 3, - 1, 3, 2, 2, 2, 0, 1, 2, 0, 1, - 1, 2, 2, 7, 5, 7, 7, 5, 9, 10, - 7, 8, 2, 2, 3, 3, 2, 2, 3, 3, - 3, 3, 5, 5, 3, 5, 1, 2, 0, 1, - 4, 3, 3, 3, 3, 3, 3, 3, 3, 4, - 5, 2, 2, 2, 8, 8, 1, 3, 0, 1, - 0, 1, 1, 1, 1, 2, 1, 1, 0, 1, - 0, 1, 2}; + 0, 1, 1, 3, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 2, 0, 1, 3, 3, 1, 1, + 1, 3, 1, 3, 2, 2, 2, 0, 1, 2, + 0, 1, 1, 2, 2, 7, 5, 7, 7, 5, + 9, 10, 7, 8, 2, 2, 3, 3, 2, 2, + 3, 3, 3, 3, 5, 5, 3, 5, 1, 2, + 0, 1, 4, 3, 3, 3, 3, 3, 3, 3, + 3, 4, 5, 2, 2, 2, 8, 8, 1, 3, + 0, 1, 0, 1, 1, 1, 1, 2, 1, 1, + 0, 1, 0, 1, 2}; const short QDeclarativeJSGrammar::action_default [] = { - 0, 0, 0, 0, 0, 0, 22, 0, 170, 237, - 201, 209, 205, 149, 221, 197, 3, 134, 68, 150, - 213, 217, 138, 167, 148, 153, 133, 187, 174, 0, - 75, 76, 71, 339, 63, 341, 0, 0, 0, 0, - 73, 0, 0, 69, 72, 0, 0, 64, 66, 65, - 74, 67, 0, 70, 0, 0, 163, 0, 0, 150, - 169, 152, 151, 0, 0, 0, 165, 166, 164, 168, - 0, 198, 0, 0, 0, 0, 188, 0, 0, 0, - 0, 0, 0, 178, 0, 0, 0, 172, 173, 171, - 176, 180, 179, 177, 175, 190, 189, 191, 0, 206, - 0, 202, 0, 0, 144, 131, 143, 132, 100, 101, - 102, 127, 103, 128, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 129, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 130, 0, - 0, 142, 238, 145, 0, 146, 0, 147, 141, 0, - 234, 227, 225, 232, 233, 231, 230, 236, 229, 228, - 226, 235, 222, 0, 210, 0, 0, 214, 0, 0, - 218, 0, 0, 144, 136, 0, 135, 0, 140, 154, - 0, 340, 329, 330, 0, 327, 0, 328, 0, 331, - 245, 252, 251, 259, 247, 0, 248, 332, 0, 338, - 249, 250, 255, 253, 335, 333, 337, 256, 0, 267, - 0, 0, 0, 0, 339, 63, 0, 341, 64, 239, - 281, 65, 0, 0, 0, 268, 0, 0, 257, 258, - 0, 246, 254, 282, 283, 326, 336, 0, 297, 298, - 299, 300, 0, 293, 294, 295, 296, 323, 324, 0, - 0, 0, 0, 0, 286, 287, 243, 241, 203, 211, - 207, 223, 199, 244, 0, 150, 215, 219, 192, 181, - 0, 0, 200, 0, 0, 0, 0, 193, 0, 0, - 0, 0, 0, 185, 183, 186, 184, 182, 195, 194, - 196, 0, 208, 0, 204, 0, 242, 150, 0, 224, - 239, 240, 0, 239, 0, 0, 289, 0, 0, 0, - 291, 0, 212, 0, 0, 216, 0, 0, 220, 279, - 0, 271, 280, 274, 0, 278, 0, 239, 272, 0, - 239, 0, 0, 290, 0, 0, 0, 292, 340, 329, - 0, 0, 331, 0, 325, 0, 315, 0, 0, 0, - 285, 0, 284, 0, 342, 0, 99, 261, 264, 0, - 100, 267, 103, 128, 105, 106, 71, 110, 111, 63, - 112, 115, 69, 72, 64, 239, 65, 74, 118, 67, - 120, 70, 122, 123, 268, 125, 126, 130, 0, 92, - 0, 0, 94, 98, 96, 83, 95, 97, 0, 93, - 82, 262, 260, 138, 139, 144, 0, 137, 0, 314, - 0, 301, 302, 0, 313, 0, 0, 0, 304, 309, - 307, 310, 0, 0, 308, 309, 0, 305, 0, 306, - 263, 312, 0, 263, 311, 0, 316, 317, 0, 263, - 318, 319, 0, 0, 320, 0, 0, 0, 321, 322, - 156, 155, 0, 0, 0, 288, 0, 0, 0, 303, - 276, 269, 0, 277, 273, 0, 275, 265, 0, 266, - 270, 86, 0, 0, 90, 77, 0, 79, 88, 0, - 80, 89, 91, 81, 87, 78, 0, 84, 160, 158, - 162, 159, 157, 161, 6, 334, 4, 2, 61, 85, - 0, 0, 64, 66, 65, 31, 5, 0, 62, 0, - 40, 39, 38, 0, 0, 53, 0, 54, 0, 59, - 60, 0, 40, 0, 0, 0, 0, 0, 49, 50, - 0, 51, 0, 52, 0, 55, 56, 0, 0, 0, - 0, 0, 57, 58, 0, 47, 41, 48, 42, 0, - 0, 0, 0, 44, 0, 45, 46, 43, 0, 0, - 30, 34, 35, 36, 37, 138, 263, 0, 0, 100, - 267, 103, 128, 105, 106, 71, 110, 111, 63, 112, - 115, 69, 72, 64, 239, 65, 74, 118, 67, 120, - 70, 122, 123, 268, 125, 126, 130, 138, 0, 26, - 0, 0, 32, 27, 33, 28, 24, 0, 29, 25, - 8, 0, 10, 0, 9, 0, 1, 21, 12, 0, - 13, 0, 14, 0, 19, 20, 0, 15, 16, 0, - 17, 18, 11, 23, 7, 343}; + 0, 0, 0, 0, 0, 0, 22, 0, 172, 239, + 203, 211, 207, 151, 223, 199, 3, 136, 70, 152, + 215, 219, 140, 169, 150, 155, 135, 189, 176, 0, + 77, 78, 73, 341, 64, 343, 0, 0, 0, 0, + 75, 0, 0, 71, 74, 68, 0, 0, 65, 67, + 66, 76, 69, 0, 72, 0, 0, 165, 0, 0, + 152, 171, 154, 153, 0, 0, 0, 167, 168, 166, + 170, 0, 200, 0, 0, 0, 0, 190, 0, 0, + 0, 0, 0, 0, 180, 0, 0, 0, 174, 175, + 173, 178, 182, 181, 179, 177, 192, 191, 193, 0, + 208, 0, 204, 0, 0, 146, 133, 145, 134, 102, + 103, 104, 129, 105, 130, 106, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 118, 131, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 132, + 0, 0, 144, 240, 147, 0, 148, 0, 149, 143, + 0, 236, 229, 227, 234, 235, 233, 232, 238, 231, + 230, 228, 237, 224, 0, 212, 0, 0, 216, 0, + 0, 220, 0, 0, 146, 138, 0, 137, 0, 142, + 156, 0, 342, 331, 332, 0, 329, 0, 330, 0, + 333, 247, 254, 253, 261, 249, 0, 250, 334, 0, + 340, 251, 252, 257, 255, 337, 335, 339, 258, 0, + 269, 0, 0, 0, 0, 341, 64, 0, 343, 65, + 241, 283, 66, 0, 0, 0, 270, 0, 0, 259, + 260, 0, 248, 256, 284, 285, 328, 338, 0, 299, + 300, 301, 302, 0, 295, 296, 297, 298, 325, 326, + 0, 0, 0, 0, 0, 288, 289, 245, 243, 205, + 213, 209, 225, 201, 246, 0, 152, 217, 221, 194, + 183, 0, 0, 202, 0, 0, 0, 0, 195, 0, + 0, 0, 0, 0, 187, 185, 188, 186, 184, 197, + 196, 198, 0, 210, 0, 206, 0, 244, 152, 0, + 226, 241, 242, 0, 241, 0, 0, 291, 0, 0, + 0, 293, 0, 214, 0, 0, 218, 0, 0, 222, + 281, 0, 273, 282, 276, 0, 280, 0, 241, 274, + 0, 241, 0, 0, 292, 0, 0, 0, 294, 342, + 331, 0, 0, 333, 0, 327, 0, 317, 0, 0, + 0, 287, 0, 286, 0, 344, 0, 101, 263, 266, + 0, 102, 269, 105, 130, 107, 108, 73, 112, 113, + 64, 114, 117, 71, 74, 65, 241, 66, 76, 120, + 69, 122, 72, 124, 125, 270, 127, 128, 132, 0, + 94, 0, 0, 96, 100, 98, 85, 97, 99, 0, + 95, 84, 264, 262, 140, 141, 146, 0, 139, 0, + 316, 0, 303, 304, 0, 315, 0, 0, 0, 306, + 311, 309, 312, 0, 0, 310, 311, 0, 307, 0, + 308, 265, 314, 0, 265, 313, 0, 318, 319, 0, + 265, 320, 321, 0, 0, 322, 0, 0, 0, 323, + 324, 158, 157, 0, 0, 0, 290, 0, 0, 0, + 305, 278, 271, 0, 279, 275, 0, 277, 267, 0, + 268, 272, 88, 0, 0, 92, 79, 0, 81, 90, + 0, 82, 91, 93, 83, 89, 80, 0, 86, 162, + 160, 164, 161, 159, 163, 6, 336, 4, 2, 62, + 87, 0, 0, 65, 67, 66, 31, 5, 0, 63, + 0, 41, 40, 39, 0, 0, 54, 0, 55, 0, + 60, 61, 0, 41, 0, 0, 0, 0, 0, 50, + 51, 0, 52, 0, 53, 0, 56, 57, 0, 0, + 0, 0, 0, 58, 59, 0, 48, 42, 49, 43, + 0, 0, 0, 0, 45, 0, 46, 47, 44, 0, + 0, 0, 30, 35, 36, 37, 38, 140, 265, 0, + 0, 102, 269, 105, 130, 107, 108, 73, 112, 113, + 64, 114, 117, 71, 74, 65, 241, 66, 76, 120, + 69, 122, 72, 124, 125, 270, 127, 128, 132, 140, + 0, 26, 0, 0, 32, 27, 33, 28, 24, 0, + 29, 25, 0, 34, 8, 0, 10, 0, 9, 0, + 1, 21, 12, 0, 13, 0, 14, 0, 19, 20, + 0, 15, 16, 0, 17, 18, 11, 23, 7, 345}; const short QDeclarativeJSGrammar::goto_default [] = { - 7, 616, 206, 195, 204, 506, 494, 615, 634, 610, - 614, 612, 617, 22, 613, 18, 505, 607, 598, 560, - 507, 190, 194, 196, 200, 523, 549, 548, 199, 231, - 26, 473, 472, 355, 354, 9, 353, 356, 106, 17, - 144, 24, 13, 143, 19, 25, 56, 23, 8, 28, - 27, 268, 15, 262, 10, 258, 12, 260, 11, 259, - 20, 266, 21, 267, 14, 261, 257, 298, 410, 263, - 264, 201, 192, 191, 203, 232, 202, 207, 228, 229, - 193, 359, 358, 230, 462, 461, 320, 321, 464, 323, - 463, 322, 418, 422, 425, 421, 420, 440, 441, 184, - 198, 180, 183, 197, 205, 0}; + 7, 620, 207, 196, 205, 507, 495, 619, 638, 614, + 618, 616, 621, 22, 617, 18, 506, 609, 600, 562, + 508, 191, 195, 197, 201, 524, 550, 549, 200, 232, + 26, 474, 473, 356, 355, 9, 354, 357, 107, 17, + 145, 24, 13, 144, 19, 25, 57, 23, 8, 28, + 27, 269, 15, 263, 10, 259, 12, 261, 11, 260, + 20, 267, 21, 268, 14, 262, 258, 299, 411, 264, + 265, 202, 193, 192, 204, 233, 203, 208, 229, 230, + 194, 360, 359, 231, 463, 462, 321, 322, 465, 324, + 464, 323, 419, 423, 426, 422, 421, 441, 442, 185, + 199, 181, 184, 198, 206, 0}; const short QDeclarativeJSGrammar::action_index [] = { - 439, 1109, 2228, 2228, 2132, 814, -74, 18, 147, -100, - 31, -17, -49, 232, -100, 318, 85, -100, -100, 554, - 33, 94, 331, 215, -100, -100, -100, 448, 231, 1109, - -100, -100, -100, 320, -100, 1940, 1472, 1109, 1109, 1109, - -100, 724, 1109, -100, -100, 1109, 1109, -100, -100, -100, - -100, -100, 1109, -100, 1109, 1109, -100, 1109, 1109, 129, - 157, -100, -100, 1109, 1109, 1109, -100, -100, -100, 200, - 1109, 293, 1109, 1109, 1109, 1109, 466, 1109, 1109, 1109, - 1109, 1109, 1109, 179, 1109, 1109, 1109, 119, 125, 95, - 188, 198, 184, 203, 178, 567, 567, 484, 1109, -5, - 1109, 67, 1844, 1109, 1109, -100, -100, -100, -100, -100, - -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, - -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, - -100, -100, -100, -100, -100, -100, -100, -100, -100, 110, - 1109, -100, -100, 70, 61, -100, 1109, -100, -100, 1109, - -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, - -100, -100, -100, 1109, 55, 1109, 1109, 73, 63, 1109, - -100, 1844, 1109, 1109, -100, 141, -100, 41, -100, -100, - 87, -100, 255, 80, 78, -100, 287, -100, 83, 2228, - -100, -100, -100, -100, -100, 225, -100, -100, 52, -100, - -100, -100, -100, -100, -100, 2228, -100, -100, 420, -100, - 408, 113, 2132, 50, 330, 65, 46, 2420, 72, 1109, - -100, 74, 75, 1109, 77, -100, 53, 56, -100, -100, - 323, -100, -100, -100, -100, -100, -100, 96, -100, -100, - -100, -100, 99, -100, -100, -100, -100, -100, -100, 60, - 47, 1109, 118, 93, -100, -100, 1291, -100, 79, 66, - 64, -100, 413, 76, 51, 664, 89, 97, 393, 183, - 337, 1109, 413, 1109, 1109, 1109, 1109, 411, 1109, 1109, - 1109, 1109, 1109, 252, 272, 212, 217, 221, 490, 490, - 383, 1109, 64, 1109, 84, 1109, -100, 536, 1109, -100, - 1109, 69, 68, 1109, 44, 2132, -100, 1109, 124, 2132, - -100, 1109, 54, 1109, 1109, 71, 88, 1109, -100, 82, - 122, 154, -100, -100, 1109, -100, 343, 1109, -100, 81, - 1109, 90, 2132, -100, 1109, 112, 2132, -100, 86, 333, - -39, -10, 2228, -33, -100, 2132, -100, 1109, 246, 2132, - 4, 2132, -100, 10, 16, -21, -100, -100, 2132, -26, - 480, 19, 462, 128, 1109, 2132, 6, -9, 400, 8, - -22, 840, -3, -6, -100, 1202, -100, -7, -28, 5, - 1109, 2, -23, 1109, 0, 1109, -34, -30, 1109, -100, - 2036, 21, -100, -100, -100, -100, -100, -100, 1109, -100, - -100, -100, -100, 209, -100, 1109, 40, -100, 2132, -100, - 101, -100, -100, 2132, -100, 1109, 120, 43, -100, 62, - -100, 59, 109, 1109, -100, 57, 58, -100, 39, -100, - 2132, -100, 117, 2132, -100, 199, -100, -100, 107, 2132, - 34, -100, 24, 11, -100, 346, -19, 14, -100, -100, - -100, -100, 1109, 133, 2132, -100, 1109, 126, 2132, -100, - 20, -100, 173, -100, -100, 1109, -100, -100, 303, -100, - -100, -100, 100, 1656, -100, -100, 1564, -100, -100, 1748, - -100, -100, -100, -100, -100, -100, 131, -100, -100, -100, - -100, -100, -100, -100, -100, 2228, -100, -100, -100, 158, - -20, 752, 165, -16, 22, -100, -100, 98, -100, 189, - -100, -100, -100, 28, 170, -100, 1109, -100, 230, -100, - -100, 247, 1, 13, 238, 37, -24, 106, -100, -100, - 273, -100, 1109, -100, 265, -100, -100, 242, -4, 12, - 1109, 241, -100, -100, 234, -100, 245, -100, 3, 9, - 311, 190, 316, -100, 134, -100, -100, -100, 1380, 1020, - -100, -100, -100, -100, -100, 359, 2324, 1472, 15, 444, - 38, 394, 138, 1109, 2132, 36, 17, 397, 42, 23, - 840, 32, 29, -100, 1202, -100, 26, 35, 48, 1109, - 45, 25, 1109, 49, 1109, 27, 30, 314, 132, -100, - 7, 752, -100, -100, -100, -100, -100, 930, -100, -100, - -100, 752, -100, 253, -87, 617, -100, -100, 102, 290, - -100, 191, -100, 140, -100, -100, 275, -100, -100, 91, - -100, -100, -100, -100, -100, -100, + 314, 1273, 2404, 2404, 2307, 1001, 58, 98, 78, -101, + 95, 56, 4, 236, -101, 296, 86, -101, -101, 545, + 97, 115, 162, 197, -101, -101, -101, 447, 192, 1273, + -101, -101, -101, 369, -101, 2113, 1919, 1273, 1273, 1273, + -101, 732, 1273, -101, -101, -101, 1273, 1273, -101, -101, + -101, -101, -101, 1273, -101, 1273, 1273, -101, 1273, 1273, + 81, 195, -101, -101, 1273, 1273, 1273, -101, -101, -101, + 185, 1273, 283, 1273, 1273, 1273, 1273, 447, 1273, 1273, + 1273, 1273, 1273, 1273, 297, 1273, 1273, 1273, 107, 85, + 116, 297, 297, 297, 297, 191, 447, 447, 447, 1273, + 74, 1273, 102, 2016, 1273, 1273, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, + 112, 1273, -101, -101, 92, 61, -101, 1273, -101, -101, + 1273, -101, -101, -101, -101, -101, -101, -101, -101, -101, + -101, -101, -101, -101, 1273, 36, 1273, 1273, 65, 62, + 1273, -101, 2016, 1273, 1273, -101, 127, -101, 42, -101, + -101, 57, -101, 294, 60, 35, -101, 259, -101, 32, + 2404, -101, -101, -101, -101, -101, 200, -101, -101, 33, + -101, -101, -101, -101, -101, -101, 2404, -101, -101, 436, + -101, 433, 100, 2307, 34, 369, 67, 45, 2598, 71, + 1273, -101, 72, 51, 1273, 59, -101, 54, 55, -101, + -101, 324, -101, -101, -101, -101, -101, -101, 88, -101, + -101, -101, -101, 76, -101, -101, -101, -101, -101, -101, + 5, 49, 1273, 104, 84, -101, -101, 1457, -101, 70, + 41, 1, -101, 287, 68, 46, 643, 73, 77, 364, + 297, 369, 1273, 238, 1273, 1273, 1273, 1273, 341, 1273, + 1273, 1273, 1273, 1273, 297, 175, 167, 161, 176, 348, + 315, 331, 1273, -13, 1273, 63, 1273, -101, 545, 1273, + -101, 1273, 64, 40, 1273, 2, 2307, -101, 1273, 152, + 2307, -101, 1273, 69, 1273, 1273, 75, 79, 1273, -101, + 44, 149, 66, -101, -101, 1273, -101, 369, 1273, -101, + 52, 1273, -54, 2307, -101, 1273, 151, 2307, -101, -29, + 369, -41, -11, 2404, -46, -101, 2307, -101, 1273, 131, + 2307, -5, 2307, -101, 8, 13, -55, -101, -101, 2307, + -51, 360, -2, 352, 119, 1273, 2307, 39, -19, 366, + 3, -24, 910, 6, 7, -101, 1367, -101, 11, -16, + -4, 1273, -6, -31, 1273, 9, 1273, -12, 17, 1273, + -101, 2210, 37, -101, -101, -101, -101, -101, -101, 1273, + -101, -101, -101, -101, 258, -101, 1273, -15, -101, 2307, + -101, 117, -101, -101, 2307, -101, 1273, 106, 16, -101, + 38, -101, 135, 96, 1273, -101, 135, 43, -101, 18, + -101, 2307, -101, 101, 2307, -101, 179, -101, -101, 99, + 2307, 31, -101, -7, -8, -101, 369, -34, -1, -101, + -101, -101, -101, 1273, 124, 2307, -101, 1273, 122, 2307, + -101, 25, -101, 207, -101, -101, 1273, -101, -101, 290, + -101, -101, -101, 114, 1733, -101, -101, 1826, -101, -101, + 1550, -101, -101, -101, -101, -101, -101, 103, -101, -101, + -101, -101, -101, -101, -101, -101, 2404, -101, -101, -101, + 221, -43, 704, 164, -26, 12, -101, -101, 188, -101, + 196, -101, -101, -101, 369, 183, -101, 1273, -101, 165, + -101, -101, 170, 0, 369, 160, 10, 369, 113, -101, + -101, 215, -101, 1273, -101, 225, -101, -101, 203, 369, + 28, 1273, 229, -101, -101, 202, -101, 218, -101, 30, + -21, 369, 199, 278, -101, 110, -101, -101, -101, 1640, + 1092, 583, -101, -101, -101, -101, -101, 284, 2501, 1919, + 14, 388, 29, 424, 93, 1273, 2307, 39, -9, 338, + 21, -3, 821, 24, 23, -101, 1367, -101, 48, 20, + 47, 1273, 50, 26, 1273, 53, 1273, 27, 22, 264, + 120, -101, 15, 813, -101, -101, -101, -101, -101, 1183, + -101, -101, 19, -101, -101, 498, -101, 249, -82, 902, + -101, -101, 118, 369, -101, 204, -101, 80, -101, -101, + 369, -101, -101, 82, -101, -101, -101, -101, -101, -101, - -106, 12, -87, 18, 17, 212, -106, -106, -106, -106, - -106, -106, -106, -106, -106, -106, -106, -106, -106, -53, - -106, -106, -106, -106, -106, -106, -106, -106, -106, 162, - -106, -106, -106, -4, -106, -106, -11, 24, 75, 76, - -106, 83, 55, -106, -106, 157, 158, -106, -106, -106, - -106, -106, 150, -106, 172, 176, -106, 168, 167, -106, - -106, -106, -106, 173, 154, 115, -106, -106, -106, -106, - 147, -106, 121, 113, 112, 125, -106, 128, 143, 146, - 140, 139, 136, -106, 122, 138, 130, -106, -106, -106, - -106, -106, -106, -106, -106, -106, -106, -106, 149, -106, - 153, -106, 110, 82, 46, -106, -106, -106, -106, -106, - -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, 17, -83, 19, 24, 228, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -49, + -106, -106, -106, -106, -106, -106, -106, -106, -106, 101, + -106, -106, -106, 2, -106, -106, -2, 29, 107, 166, + -106, 204, 183, -106, -106, -106, 174, 169, -106, -106, + -106, -106, -106, 145, -106, 141, 137, -106, 152, 161, + -106, -106, -106, -106, 163, 158, 157, -106, -106, -106, + -106, 132, -106, 142, 138, 187, 178, -106, 167, 181, + 81, 82, 85, 83, -106, 93, 114, 96, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, 170, + -106, 74, -106, 109, 80, 51, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, - 35, -106, -106, -106, -106, -106, 37, -106, -106, 45, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, -106, -106, 92, -106, 88, 58, -106, -106, 51, - -106, 209, 72, 78, -106, -106, -106, -106, -106, -106, - -106, -106, 27, -106, -106, -106, 63, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, -106, -106, -106, -106, 50, -106, -106, 28, -106, - 29, -106, 47, -106, 33, -106, -106, 66, -106, 73, - -106, -106, -106, 81, 53, -106, -106, -106, -106, -106, - -13, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, 25, -106, -106, -106, -106, -106, 41, -106, -106, + 50, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, 98, -106, 104, 43, -106, -106, + 42, -106, 221, 64, 117, -106, -106, -106, -106, -106, + -106, -106, -106, 54, -106, -106, -106, 55, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, 9, -106, -106, -106, -106, 111, -106, -106, -106, + -106, -106, -106, -106, -106, -106, 47, -106, -106, 38, + -106, 33, -106, 92, -106, 73, -106, -106, 88, -106, + 86, -106, -106, -106, 94, 23, -106, -106, -106, -106, + -106, -11, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, - 3, 186, -106, 220, 228, 234, 204, -106, 90, 91, - 94, 97, 93, -106, -106, -106, -106, -106, -106, -106, - -106, 210, -106, 187, -106, 214, -106, -106, 208, -106, - 207, -106, -106, 155, -106, 8, -106, 4, -106, -1, - -106, 217, -106, 177, 185, -106, -106, 184, -106, -106, - -106, -106, -106, -106, 183, -106, 194, 105, -106, -106, - 99, -106, 71, -106, 74, -106, 65, -106, -106, 114, - -106, -106, -55, -106, -106, 64, -106, 44, -106, 30, - -106, 31, -106, -106, -106, -106, -106, -106, 57, -106, - 36, -106, 40, -106, 70, 59, -106, -106, 42, -106, - -106, 104, -106, -106, -106, 38, -106, -106, -106, -106, - 79, -106, 69, 108, -106, 84, -106, -106, 56, -106, - 68, -106, -106, -106, -106, -106, -106, -106, 52, -106, - -106, -106, -106, -106, -106, 109, -106, -106, 77, -106, - -106, -106, -106, 86, -106, 80, -106, -106, -106, -106, - -106, -59, -106, 43, -106, -63, -106, -106, -106, -106, - 98, -106, -106, 95, -106, -106, -106, -106, -106, 60, - -34, -106, -106, 32, -106, 41, -106, 39, -106, -106, - -106, -106, 49, -106, 61, -106, 62, -106, 48, -106, - -106, -106, -106, -106, -106, 23, -106, -106, 96, -106, - -106, -106, -106, 34, -106, -106, 133, -106, -106, 54, + -106, -106, 22, -106, -106, -106, -106, 105, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, -106, -106, -106, -106, 67, -106, -106, -106, -106, - -106, 22, -106, -106, -106, -106, -106, -106, -106, -22, - -106, -106, -106, -106, -106, -106, 2, -106, -106, -106, - -106, -106, -106, -106, -19, -106, -106, -106, -106, -106, - -106, -106, 100, -106, -106, -106, -106, -21, -106, -106, - -3, -106, -106, -106, -106, -106, 13, -106, -106, -106, - 11, 14, 10, -106, -106, -106, -106, -106, 279, 283, - -106, -106, -106, -106, -106, -106, 19, 273, 15, 16, - -106, 21, -106, 224, 6, -106, -106, 25, -106, -106, - 85, -106, -106, -106, 26, -106, -106, -106, -106, 20, - -106, 7, 87, -106, 107, -106, -106, -106, -106, -106, - -106, 317, -106, -106, -106, -106, -106, 277, -106, -106, - -106, 0, -106, -106, -2, 271, -106, -106, -106, 1, - -106, -106, -106, -106, -106, -106, 5, -106, -106, -106, - -106, -106, -106, -106, -106, -106}; + -106, 7, 235, -106, 249, 219, 216, 222, -106, 124, + 125, 123, 122, 116, -106, -106, -106, -106, -106, -106, + -106, -106, 191, -106, 232, -106, 225, -106, -106, 231, + -106, 156, -106, -106, 130, -106, 91, -106, 5, -106, + 8, -106, 233, -106, 200, 189, -106, -106, 198, -106, + -106, -106, -106, -106, -106, 245, -106, 108, 95, -106, + -106, 298, -106, 195, -106, 89, -106, 71, -106, -106, + 120, -106, -106, -5, -106, -106, 52, -106, 53, -106, + 56, -106, 60, -106, -106, -106, -106, -106, -106, 39, + -106, 37, -106, 49, -106, 133, 69, -106, -106, 59, + -106, -106, 102, -106, -106, -106, 79, -106, -106, -106, + -106, 62, -106, 45, 67, -106, 75, -106, -106, 44, + -106, 1, -106, -106, -106, -106, -106, -106, -106, 46, + -106, -106, -106, -106, -106, -106, 115, -106, -106, 66, + -106, -106, -106, -106, 70, -106, 77, -106, -106, -106, + -106, -106, -9, -106, 72, -106, -38, -106, -106, -106, + -106, 97, -106, -106, 99, -106, -106, -106, -106, -106, + 40, -51, -106, -106, 36, -106, 34, -106, 63, -106, + -106, -106, -106, 35, -106, 48, -106, 58, -106, 57, + -106, -106, -106, -106, -106, -106, 28, -106, -106, 90, + -106, -106, -106, -106, 65, -106, -106, 159, -106, -106, + 61, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, 87, -106, -106, -106, + -106, -106, -13, -106, -106, -106, -106, -106, -106, -106, + -18, -106, -106, -106, -10, -106, -106, 0, -106, -106, + -106, -106, -106, -106, -4, -12, -106, -6, -106, -106, + -106, -106, -106, 3, -106, -106, -106, -106, -23, -14, + -106, 11, -106, -106, -106, -106, -106, 15, -106, -106, + -106, 16, 18, 14, -106, -106, -106, -106, -106, 292, + 399, 180, -106, -106, -106, -106, -106, -106, 26, 286, + 20, 21, -106, 30, -106, 177, 10, -106, -106, 31, + -106, -106, 193, -106, -106, -106, 32, -106, -106, -106, + -106, 27, -106, 13, 76, -106, 68, -106, -106, -106, + -106, -106, -106, 230, -106, -106, -106, -106, -106, 290, + -106, -106, -3, -106, -106, 6, -106, -106, 4, 270, + -106, -106, -106, 9, -106, -106, -106, -106, -106, -106, + 12, -106, -106, -106, -106, -106, -106, -106, -106, -106}; const short QDeclarativeJSGrammar::action_info [] = { - -97, -98, 452, 611, -116, 527, 456, -124, 415, -121, - 439, 551, -119, -108, 347, -94, 611, 388, 635, 540, - 351, 341, 344, 342, 390, 539, -127, 256, 398, 402, - 100, 98, 70, -97, 400, 163, -98, 465, 524, -116, - 559, 447, 530, -108, 439, -127, 509, 439, 559, -94, - 537, 544, -121, 256, 443, -119, -124, 514, 439, 347, - 445, 526, 423, 452, 423, 430, 456, 423, 70, 554, - 169, 415, 345, 311, 100, 163, 419, 140, 146, 408, - 271, 413, 347, 251, 295, 271, 256, 0, 186, 452, - 0, 311, 456, 140, 429, 317, 0, 0, 0, 324, - 407, 178, 291, 98, 305, 558, 0, 235, 476, 0, - 439, 415, 300, 442, 291, 0, 189, 171, 140, 426, - 140, 148, 339, 182, 433, 140, 140, 443, 140, 303, - 326, 559, 140, 0, 140, 57, 172, 250, 188, 140, - 601, 140, 330, 293, 165, 0, 58, 313, 166, 140, - 332, 314, 631, 630, 255, 254, 477, 241, 240, 57, - 246, 245, 412, 411, 427, 57, 141, 529, 528, 63, - 58, 61, 336, 171, 248, 247, 58, 516, 253, 0, - 417, 468, 62, 327, 309, 334, 458, 57, 602, 248, - 247, 487, 172, 454, 522, 556, 555, 176, 58, 248, - 247, 625, 624, 84, 84, 85, 85, 140, 84, 84, - 85, 85, 63, 84, 64, 85, 86, 86, 510, 510, - 65, 86, 86, 84, 171, 85, 86, 63, 84, 0, - 85, 517, 515, 140, 469, 467, 86, 84, 140, 85, - 512, 86, 84, 172, 85, 405, 84, 102, 85, 140, - 86, 511, 628, 627, 140, 86, 84, 64, 85, 86, - 437, 436, 171, 65, 512, 512, 103, 510, 104, 86, - 546, 510, 64, 140, 510, 511, 511, 84, 65, 85, - 532, 172, 626, 405, 34, 0, 234, 233, 0, 0, - 86, 520, 519, 0, 0, 547, 545, 84, 0, 85, - 621, 0, 543, 542, 34, 0, 349, 0, 0, 0, - 86, 72, 73, 512, 622, 620, 34, 512, 0, 34, - 512, 47, 49, 48, 511, 0, 536, 535, 511, 171, - 0, 511, 34, 0, 533, 531, 72, 73, 74, 75, - 34, 47, 49, 48, 619, 34, 171, -85, 172, 34, - 173, 0, 34, 47, 49, 48, 47, 49, 48, 34, - 0, 0, 34, 74, 75, 172, 34, 173, 0, 47, - 49, 48, 34, 0, 171, 34, 0, 47, 49, 48, - 0, 0, 47, 49, 48, 0, 47, 49, 48, 47, - 49, 48, -85, 172, 0, 173, 47, 49, 48, 47, - 49, 48, 0, 47, 49, 48, 278, 279, 0, 47, - 49, 48, 47, 49, 48, 280, 278, 279, 281, 0, - 282, 0, 0, 34, 0, 280, 34, 0, 281, 34, - 282, 273, 274, -339, 278, 279, -339, 34, 0, 0, - 0, 0, 0, 280, 0, 0, 281, 0, 282, 34, - 0, 0, 0, 0, 0, 244, 243, 0, 275, 276, - 47, 49, 48, 47, 49, 48, 47, 49, 48, 244, - 243, 77, 78, 34, 47, 49, 48, 0, 0, 79, - 80, 239, 238, 81, 0, 82, 47, 49, 48, 77, - 78, 34, 0, 0, 0, 0, 0, 79, 80, 0, - 0, 81, 0, 82, 0, 239, 238, 77, 78, 34, - 47, 49, 48, 278, 279, 79, 80, 0, 0, 81, - 0, 82, 280, 244, 243, 281, 0, 282, 47, 49, - 48, 6, 5, 4, 1, 3, 2, 0, 0, 150, - 0, 239, 238, 0, 0, 0, 47, 49, 48, 151, - 0, 0, 0, 152, 0, 0, 0, 150, 0, 0, - 0, 0, 153, 0, 154, 0, 0, 151, 0, 0, - 0, 152, 0, 0, 0, 155, 0, 156, 61, 0, - 153, 0, 154, 0, 0, 157, 0, 0, 158, 62, - 77, 78, 0, 155, 159, 156, 61, 0, 79, 80, - 160, 0, 81, 157, 82, 0, 158, 62, 0, 0, - 0, 0, 159, 0, 0, 0, 161, 0, 160, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, - 31, 0, 0, 0, 161, 0, 0, 0, 0, 33, - 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, - 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, - 501, 0, 0, 0, 44, 0, 0, 150, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 151, 0, 0, - 0, 152, 50, 47, 49, 48, 0, 51, 0, 0, - 153, 0, 154, 0, 0, 307, 0, 0, 43, 53, - 32, 0, 0, 155, 40, 156, 61, 0, 0, 0, - 0, 0, 0, 157, 0, 0, 158, 62, 0, 0, - 0, 0, 159, 0, 0, 0, 0, 0, 160, 0, + 401, -123, 440, -121, 403, -129, 333, 340, 615, 345, + -96, 352, 348, -118, -100, 389, -126, 257, -99, 342, + 416, 391, 343, 510, 453, 440, 448, 257, -96, 446, + -100, -118, 440, 348, 527, 541, -129, 525, 552, 555, + 538, 545, 466, 424, 399, 408, -110, 560, 560, 420, + 431, 444, 560, 457, -121, -99, 416, -123, 457, 440, + -126, 325, 306, 453, 272, 190, 294, 164, 187, 170, + 257, 272, 141, 430, 346, 312, 296, 312, 409, 414, + 294, 348, 251, 101, 99, 252, 318, 416, 236, 292, + 453, 457, 440, 183, 141, 189, 71, 335, 639, 164, + 147, 304, 179, 71, 99, 443, 427, 301, 434, 141, + 0, 141, 141, 331, 141, 0, 0, 292, 58, 444, + 141, 149, 477, 62, 0, 58, 0, 314, 603, 59, + 141, 315, 141, 172, 63, 141, 59, 247, 246, 141, + 424, 629, 628, 635, 634, 256, 255, 58, 615, 242, + 241, 428, 173, 101, 249, 248, 58, 327, 59, 141, + 141, 249, 248, 488, 254, 166, 418, 59, 142, 167, + 478, 557, 556, 141, 530, 529, 604, 172, 413, 412, + 249, 248, 459, 177, 455, 172, 85, 141, 86, 511, + 517, 350, 85, 523, 86, 559, 173, 64, 174, 87, + 85, 85, 86, 86, 173, 87, 406, 64, 141, 64, + 328, 337, 310, 87, 87, 469, 85, 85, 86, 86, + 0, 560, 533, 0, 0, 511, 521, 520, 511, 87, + 87, 0, 511, 141, 0, 513, 172, 141, 547, 513, + 438, 437, 65, 0, 518, 516, 512, 511, 66, 0, + 512, 103, 65, 0, 65, 173, 274, 275, 66, 0, + 66, 235, 234, 548, 546, 632, 631, 0, 470, 468, + 104, 513, 105, 172, 513, 0, 534, 532, 513, 172, + 561, 0, 512, 276, 277, 512, 537, 536, 34, 512, + 544, 543, 173, 513, 406, 630, 625, -87, 173, 172, + 174, 73, 74, 0, 512, 274, 275, 34, 0, 0, + 626, 624, 0, 0, 73, 74, 0, -87, 173, 34, + 174, 0, 85, 34, 86, 48, 50, 49, 75, 76, + 0, 0, 276, 277, 0, 87, 0, 0, 279, 280, + 623, 75, 76, 0, 48, 50, 49, 281, 0, 0, + 282, 45, 283, 34, 279, 280, 48, 50, 49, 0, + 48, 50, 49, 281, 279, 280, 282, 34, 283, 0, + 45, 279, 280, 281, -341, 0, 282, 0, 283, 0, + 281, 34, 45, 282, 0, 283, 45, 279, 280, 34, + 48, 50, 49, 0, 0, 34, 281, 0, 34, 282, + 0, 283, -341, 0, 48, 50, 49, 6, 5, 4, + 1, 3, 2, 245, 244, 0, 45, 34, 48, 50, + 49, 240, 239, 0, 0, 0, 48, 50, 49, 0, + 45, 0, 48, 50, 49, 48, 50, 49, 0, 0, + 0, 0, 0, 0, 45, 0, 0, 0, 0, 240, + 239, 0, 45, 34, 48, 50, 49, 0, 45, 0, + 0, 45, 34, 0, 0, 34, 0, 0, 0, 0, + 78, 79, 0, 0, 0, 0, 0, 0, 80, 81, + 45, 0, 82, 0, 83, 245, 244, 0, 0, 0, + 48, 50, 49, 0, 245, 244, 0, 240, 239, 48, + 50, 49, 48, 50, 49, 0, 0, 0, 0, 0, + 30, 31, 0, 0, 0, 0, 45, 0, 0, 0, + 33, 0, 0, 0, 0, 45, 0, 34, 45, 0, + 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, + 0, 502, 0, 0, 0, 44, 0, 0, 151, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 152, 0, + 0, 0, 153, 51, 48, 50, 49, 0, 52, 0, + 0, 154, 0, 155, 0, 0, 0, 0, 0, 43, + 54, 32, 0, 0, 156, 40, 157, 62, 0, 0, + 45, 0, 0, 0, 158, 30, 31, 159, 63, 0, + 0, 0, 0, 160, 0, 33, 0, 0, 0, 161, + 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, + 0, 0, 0, 0, 0, 162, 502, 0, 0, 0, + 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 151, 0, 51, 48, + 50, 49, 0, 52, 0, 0, 152, 0, 0, 0, + 153, 0, 0, 0, 43, 54, 32, 0, 0, 154, + 40, 155, 0, 0, 308, 45, 0, 0, 0, 0, + 0, 0, 156, 0, 157, 62, 0, 0, 0, 0, + 0, 0, 158, 0, 0, 159, 63, 0, 0, 0, + 0, 160, 0, 0, 0, 0, 0, 161, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, 0, 0, - 0, 0, 0, 0, 161, 0, 33, 0, 0, 0, + 0, 0, 0, 162, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, - 37, 0, 0, 0, 30, 31, 0, 41, 0, 0, + 37, 0, 0, 0, 30, 31, 0, 502, 0, 0, 0, 44, 0, 0, 33, 0, 0, 0, 0, 0, - 0, 34, 0, 0, 0, 35, 36, 0, 37, 50, - 47, 49, 48, 0, 51, 501, 0, 0, 0, 44, - 0, 0, 0, 0, 0, 43, 53, 32, 0, 0, - 0, 40, 0, 0, 0, 0, 0, 50, 47, 49, - 48, 0, 51, 0, 500, 0, 30, 31, 0, 0, - 0, 0, 0, 43, 53, 32, 214, 0, 0, 40, - 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, - 37, 0, 30, 31, 0, 0, 0, 501, 0, 0, - 0, 44, 33, 0, 0, 0, 0, 0, 0, 34, - 0, 0, 0, 35, 36, 0, 37, 0, 0, 50, - 502, 504, 503, 41, 51, 0, 0, 44, 0, 225, - 0, 0, 0, 0, 0, 43, 53, 32, 209, 0, - 0, 40, 0, 0, 0, 50, 47, 49, 48, 0, - 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 43, 53, 32, 0, 0, 0, 40, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 500, 0, 30, 31, 0, 0, 0, 0, 0, 0, - 0, 0, 214, 0, 0, 0, 0, 0, 0, 34, - 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, - 0, 0, 0, 501, 0, 0, 0, 44, 0, 0, - 0, 0, 0, 0, 0, 608, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 50, 502, 504, 503, 0, - 51, 0, 0, 0, 0, 225, 0, 0, 0, 0, - 0, 43, 53, 32, 209, 0, 0, 40, 0, 0, + 0, 34, 0, 0, 0, 35, 36, 0, 37, 51, + 48, 50, 49, 0, 52, 41, 0, 0, 0, 44, + 0, 0, 0, 0, 0, 43, 54, 32, 0, 0, + 0, 40, 0, 0, 0, 0, 45, 51, 48, 50, + 49, 0, 52, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 43, 54, 32, 0, 0, 0, 40, + 0, 0, 0, 0, 45, 30, 31, 0, 0, 0, + 0, 0, 0, 30, 31, 33, 0, 0, 0, 0, + 0, 0, 34, 33, 0, 0, 35, 36, 0, 37, + 34, 0, 0, 0, 35, 36, 502, 37, 0, 0, + 44, 0, 0, 0, 41, 0, 0, 0, 44, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, + 50, 49, 0, 52, 0, 0, 51, 48, 50, 49, + 0, 52, 0, 0, 43, 54, 32, 0, 0, 0, + 40, 0, 43, 54, 32, 45, 0, 0, 40, 0, + 0, 0, 0, 45, 30, 31, 0, 0, 0, 0, + 0, 0, 30, 31, 33, 0, 0, 0, 0, 0, + 0, 34, 33, 0, 0, 35, 36, 0, 37, 34, + 0, 0, 0, 35, 36, 502, 37, 0, 0, 44, + 0, 0, 0, 41, 0, 0, 0, 44, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 51, 48, 50, + 49, 0, 52, 0, 0, 51, 48, 50, 49, 0, + 52, 0, 0, 43, 54, 32, 0, 0, 0, 40, + 0, 43, 54, 32, 45, 0, 0, 40, 0, 0, + 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, + 0, 501, 0, 30, 31, 0, 0, 0, 0, 0, + 0, 0, 0, 215, 0, 0, 0, 0, 0, 0, + 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, + 0, 0, 0, 0, 502, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 500, 0, 30, 31, 0, 0, 0, 0, 0, 0, - 0, 0, 214, 0, 0, 0, 0, 0, 0, 34, + 0, 0, 0, 0, 0, 0, 51, 503, 505, 504, + 0, 52, 0, 0, 0, 0, 226, 0, 0, 0, + 0, 0, 43, 54, 32, 210, 0, 0, 40, 0, + 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, + 0, 0, 501, 0, 30, 31, 0, 0, 0, 0, + 0, 0, 0, 0, 215, 0, 0, 0, 0, 0, + 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, + 0, 0, 0, 0, 0, 502, 0, 0, 0, 44, + 0, 0, 0, 0, 0, 0, 0, 607, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 51, 503, 505, + 504, 0, 52, 0, 0, 0, 0, 226, 0, 0, + 0, 0, 0, 43, 54, 32, 210, 0, 0, 40, + 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, + 0, 0, 0, 501, 0, 30, 31, 0, 0, 0, + 0, 0, 0, 0, 0, 215, 0, 0, 0, 0, + 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, + 0, 0, 0, 0, 0, 0, 502, 0, 0, 0, + 44, 0, 0, 0, 0, 0, 0, 0, 610, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 51, 503, + 505, 504, 0, 52, 0, 0, 0, 0, 226, 0, + 0, 0, 0, 0, 43, 54, 32, 210, 0, 0, + 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, + 0, 0, 0, 0, 29, 30, 31, 0, 0, 0, + 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, + 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, + 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, + 44, 0, 0, 0, 46, 0, 47, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, + 50, 49, 0, 52, 0, 53, 0, 55, 0, 56, + 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, + 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, + 0, 0, 0, 0, -119, 0, 0, 0, 29, 30, + 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, + 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, + 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, + 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, + 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 51, 48, 50, 49, 0, 52, 0, 53, + 0, 55, 0, 56, 0, 0, 0, 0, 43, 54, + 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, + 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, + 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, + 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, + 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, + 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, + 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 51, 48, 50, 49, 0, 52, 0, 53, + 0, 55, 271, 56, 0, 0, 0, 0, 43, 54, + 32, 0, 0, 0, 40, 0, 0, 0, 0, 45, + 0, 0, 0, 0, 0, 0, 0, 0, 483, 0, + 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, + 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, - 0, 0, 0, 501, 0, 0, 0, 44, 0, 0, - 0, 0, 0, 0, 0, 605, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 50, 502, 504, 503, 0, - 51, 0, 0, 0, 0, 225, 0, 0, 0, 0, - 0, 43, 53, 32, 209, 0, 0, 40, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, + 0, 46, 0, 47, 0, 0, 484, 0, 0, 0, + 0, 0, 0, 0, 0, 51, 48, 50, 49, 0, + 52, 0, 53, 0, 55, 0, 56, 0, 0, 0, + 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, + 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, + 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, + 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, + 217, 0, 0, 568, 569, 0, 37, 0, 0, 0, + 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, + 0, 46, 0, 47, 0, 0, 0, 0, 0, 0, + 0, 221, 0, 0, 0, 51, 48, 50, 49, 0, + 52, 0, 53, 0, 55, 0, 56, 0, 0, 0, + 0, 43, 54, 32, 0, 0, 0, 40, 0, 0, + 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, + 0, 483, 0, 0, 29, 30, 31, 0, 0, 0, + 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, + 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, + 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, + 44, 0, 0, 0, 46, 0, 47, 0, 0, 486, + 0, 0, 0, 0, 0, 0, 0, 0, 51, 48, + 50, 49, 0, 52, 0, 53, 0, 55, 0, 56, + 0, 0, 0, 0, 43, 54, 32, 0, 0, 0, + 40, 0, 0, 0, 0, 45, 0, 0, 0, 0, + 0, 0, 0, 0, 475, 0, 0, 29, 30, 31, + 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, + 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, + 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, + 42, 0, 0, 44, 0, 0, 0, 46, 0, 47, + 0, 0, 481, 0, 0, 0, 0, 0, 0, 0, + 0, 51, 48, 50, 49, 0, 52, 0, 53, 0, + 55, 0, 56, 0, 0, 0, 0, 43, 54, 32, + 0, 0, 0, 40, 0, 0, 0, 0, 45, 0, + 0, 0, 0, 0, 0, 0, 0, 475, 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, - 45, 0, 46, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 47, 49, 48, 0, 51, - 0, 52, 0, 54, 0, 55, 0, 0, 0, 0, - 43, 53, 32, 0, 0, 0, 40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -117, - 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, - 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, - 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, - 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, - 0, 0, 0, 45, 0, 46, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 50, 47, 49, - 48, 0, 51, 0, 52, 0, 54, 0, 55, 0, - 0, 0, 0, 43, 53, 32, 0, 0, 0, 40, + 46, 0, 47, 0, 0, 476, 0, 0, 0, 0, + 0, 0, 0, 0, 51, 48, 50, 49, 0, 52, + 0, 53, 0, 55, 0, 56, 0, 0, 0, 0, + 43, 54, 32, 0, 0, 0, 40, 0, 0, 0, + 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, + 109, 110, 111, 0, 0, 113, 115, 116, 0, 0, + 117, 0, 118, 0, 0, 0, 120, 121, 122, 0, + 0, 0, 0, 0, 0, 34, 123, 124, 125, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, - 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, - 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, - 0, 0, 45, 0, 46, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 50, 47, 49, 48, - 0, 51, 0, 52, 0, 54, 270, 55, 0, 0, - 0, 0, 43, 53, 32, 0, 0, 0, 40, 0, + 0, 0, 0, 0, 0, 129, 0, 0, 0, 0, + 0, 0, 48, 50, 49, 130, 131, 132, 0, 134, + 135, 136, 137, 138, 139, 0, 0, 127, 133, 119, + 112, 114, 128, 0, 0, 0, 0, 0, 45, 0, + 0, 0, 0, 0, 0, 0, 0, 109, 110, 111, + 0, 0, 113, 115, 116, 0, 0, 117, 0, 118, + 0, 0, 0, 120, 121, 122, 0, 0, 0, 0, + 0, 0, 393, 123, 124, 125, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 126, 0, 0, 0, + 394, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 129, 0, 0, 0, 0, 0, 398, 395, + 397, 0, 130, 131, 132, 0, 134, 135, 136, 137, + 138, 139, 0, 0, 127, 133, 119, 112, 114, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, - 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, - 216, 0, 0, 566, 567, 0, 37, 0, 0, 0, - 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, - 0, 45, 0, 46, 0, 0, 0, 0, 0, 0, - 0, 220, 0, 0, 0, 50, 47, 49, 48, 0, - 51, 0, 52, 0, 54, 0, 55, 0, 0, 0, - 0, 43, 53, 32, 0, 0, 0, 40, 0, 0, + 0, 0, 0, 0, 109, 110, 111, 0, 0, 113, + 115, 116, 0, 0, 117, 0, 118, 0, 0, 0, + 120, 121, 122, 0, 0, 0, 0, 0, 0, 393, + 123, 124, 125, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 126, 0, 0, 0, 394, 0, 0, + 0, 0, 0, 0, 0, 396, 0, 0, 0, 129, + 0, 0, 0, 0, 0, 398, 395, 397, 0, 130, + 131, 132, 0, 134, 135, 136, 137, 138, 139, 0, + 0, 127, 133, 119, 112, 114, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 474, 0, 0, 29, 30, 31, 0, 0, 0, 0, - 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, - 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, - 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, - 0, 0, 0, 45, 0, 46, 0, 0, 475, 0, - 0, 0, 0, 0, 0, 0, 0, 50, 47, 49, - 48, 0, 51, 0, 52, 0, 54, 0, 55, 0, - 0, 0, 0, 43, 53, 32, 0, 0, 0, 40, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 474, 0, 0, 29, 30, 31, 0, 0, - 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, - 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, + 0, 209, 0, 0, 0, 0, 211, 0, 29, 30, + 31, 213, 0, 0, 0, 0, 0, 0, 214, 33, + 0, 0, 0, 0, 0, 0, 216, 217, 0, 0, + 218, 36, 0, 37, 0, 0, 0, 38, 0, 39, + 41, 42, 0, 0, 44, 0, 0, 0, 46, 0, + 47, 0, 0, 0, 0, 0, 220, 0, 221, 0, + 0, 0, 51, 219, 222, 49, 223, 52, 224, 53, + 225, 55, 226, 56, 227, 228, 0, 0, 43, 54, + 32, 210, 212, 0, 40, 0, 0, 0, 0, 45, + 0, 0, 0, 0, 0, 0, 0, 0, 209, 0, + 0, 0, 0, 211, 0, 29, 30, 31, 213, 0, + 0, 0, 0, 0, 0, 214, 215, 0, 0, 0, + 0, 0, 0, 216, 217, 0, 0, 218, 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, - 0, 44, 0, 0, 0, 45, 0, 46, 0, 0, - 480, 0, 0, 0, 0, 0, 0, 0, 0, 50, - 47, 49, 48, 0, 51, 0, 52, 0, 54, 0, - 55, 0, 0, 0, 0, 43, 53, 32, 0, 0, - 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 482, 0, 0, 29, 30, 31, - 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, - 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, - 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, - 42, 0, 0, 44, 0, 0, 0, 45, 0, 46, - 0, 0, 485, 0, 0, 0, 0, 0, 0, 0, - 0, 50, 47, 49, 48, 0, 51, 0, 52, 0, - 54, 0, 55, 0, 0, 0, 0, 43, 53, 32, - 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 482, 0, 0, 29, - 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, - 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, - 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, - 39, 41, 42, 0, 0, 44, 0, 0, 0, 45, - 0, 46, 0, 0, 483, 0, 0, 0, 0, 0, - 0, 0, 0, 50, 47, 49, 48, 0, 51, 0, - 52, 0, 54, 0, 55, 0, 0, 0, 0, 43, - 53, 32, 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, - 110, 0, 0, 112, 114, 115, 0, 0, 116, 0, - 117, 0, 0, 0, 119, 120, 121, 0, 0, 0, - 0, 0, 0, 34, 122, 123, 124, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 125, 0, 0, + 0, 44, 0, 0, 0, 46, 0, 47, 0, 0, + 0, 0, 0, 220, 0, 221, 0, 0, 0, 51, + 219, 222, 49, 223, 52, 224, 53, 225, 55, 226, + 56, 227, 228, 0, 0, 43, 54, 32, 210, 212, + 0, 40, 0, 0, 0, 0, 45, 0, 0, 0, + 0, 0, 0, 0, 0, 571, 110, 111, 0, 0, + 573, 115, 575, 30, 31, 576, 0, 118, 0, 0, + 0, 120, 578, 579, 0, 0, 0, 0, 0, 0, + 580, 581, 124, 125, 218, 36, 0, 37, 0, 0, + 0, 38, 0, 39, 582, 42, 0, 0, 584, 0, + 0, 0, 46, 0, 47, 0, 0, 0, 0, 0, + 586, 0, 221, 0, 0, 0, 588, 585, 587, 49, + 589, 590, 591, 53, 593, 594, 595, 596, 597, 598, + 0, 0, 583, 592, 577, 572, 574, 128, 40, 0, + 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, + 0, 0, 361, 110, 111, 0, 0, 363, 115, 365, + 30, 31, 366, 0, 118, 0, 0, 0, 120, 368, + 369, 0, 0, 0, 0, 0, 0, 370, 371, 124, + 125, 218, 36, 0, 37, 0, 0, 0, 38, 0, + 39, 372, 42, 0, 0, 374, 0, 0, 0, 46, + 0, 47, 0, -265, 0, 0, 0, 376, 0, 221, + 0, 0, 0, 378, 375, 377, 49, 379, 380, 381, + 53, 383, 384, 385, 386, 387, 388, 0, 0, 373, + 382, 367, 362, 364, 128, 40, 0, 0, 0, 0, + 45, 0, 0, 0, 0, 0, 0, 0, 0, + + 522, 540, 539, 519, 461, 515, 535, 514, 309, 528, + 311, 531, 250, 526, 542, 636, 613, 182, 150, 622, + 16, 496, 320, 497, 627, 253, 498, 633, 358, 554, + 436, 558, 487, 472, 439, 302, 238, 392, 454, 606, + 551, 402, 358, 553, 439, 243, 182, 445, 243, 447, + 456, 237, 238, 238, 347, 429, 349, 450, 351, 460, + 143, 458, 353, 467, 243, 436, 439, 176, 410, 186, + 188, 250, 415, 338, 182, 433, 148, 171, 169, 390, + 417, 400, 302, 140, 449, 163, 146, 425, 339, 302, + 358, 237, 336, 307, 250, 344, 482, 436, 302, 358, + 485, 358, 0, 0, 0, 461, 0, 0, 0, 0, + 0, 60, 60, 451, 452, 404, 0, 0, 60, 60, + 60, 452, 451, 320, 106, 60, 60, 60, 102, 60, + 92, 93, 95, 302, 94, 186, 0, 60, 0, 0, + 60, 88, 60, 405, 90, 60, 108, 180, 60, 266, + 146, 60, 146, 489, 270, 407, 165, 178, 60, 302, + 60, 0, 89, 330, 168, 288, 60, 60, 60, 60, + 0, 287, 286, 284, 285, 471, 60, 60, 432, 180, + 435, 60, 60, 452, 72, 60, 60, 451, 96, 60, + 480, 494, 77, 500, 479, 329, 60, 334, 305, 61, + 612, 60, 60, 69, 68, 60, 404, 60, 70, 67, + 60, 60, 490, 60, 60, 493, 84, 404, 60, 341, + 492, 60, 60, 180, 303, 60, 100, 60, 98, 491, + 91, 60, 0, 298, 405, 60, 106, 97, 270, 0, + 270, 500, 298, 500, 60, 405, 605, 270, 293, 270, + 602, 0, 0, 0, 0, 317, 499, 509, 108, 175, + 60, 316, 0, 60, 319, 270, 60, 290, 270, 298, + 289, 270, 0, 291, 270, 298, 60, 60, 0, 60, + 270, 270, 270, 500, 270, 0, 637, 295, 273, 298, + 602, 297, 313, 60, 270, 611, 0, 300, 270, 599, + 278, 302, 601, 500, 0, 567, 602, 0, 0, 0, + 0, 326, 570, 563, 564, 565, 566, 0, 499, 509, + 0, 472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, - 47, 49, 48, 129, 130, 131, 0, 133, 134, 135, - 136, 137, 138, 0, 0, 126, 132, 118, 111, 113, - 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 108, 109, 110, 0, 0, 112, - 114, 115, 0, 0, 116, 0, 117, 0, 0, 0, - 119, 120, 121, 0, 0, 0, 0, 0, 0, 392, - 122, 123, 124, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 125, 0, 0, 0, 393, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, - 0, 0, 0, 0, 0, 397, 394, 396, 0, 129, - 130, 131, 0, 133, 134, 135, 136, 137, 138, 0, - 0, 126, 132, 118, 111, 113, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 108, 109, 110, 0, 0, 112, 114, 115, 0, 0, - 116, 0, 117, 0, 0, 0, 119, 120, 121, 0, - 0, 0, 0, 0, 0, 392, 122, 123, 124, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 125, - 0, 0, 0, 393, 0, 0, 0, 0, 0, 0, - 0, 395, 0, 0, 0, 128, 0, 0, 0, 0, - 0, 397, 394, 396, 0, 129, 130, 131, 0, 133, - 134, 135, 136, 137, 138, 0, 0, 126, 132, 118, - 111, 113, 127, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 208, 0, 0, 0, - 0, 210, 0, 29, 30, 31, 212, 0, 0, 0, - 0, 0, 0, 213, 33, 0, 0, 0, 0, 0, - 0, 215, 216, 0, 0, 217, 36, 0, 37, 0, - 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, - 0, 0, 0, 45, 0, 46, 0, 0, 0, 0, - 0, 219, 0, 220, 0, 0, 0, 50, 218, 221, - 48, 222, 51, 223, 52, 224, 54, 225, 55, 226, - 227, 0, 0, 43, 53, 32, 209, 211, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 208, 0, 0, 0, 0, 210, 0, 29, - 30, 31, 212, 0, 0, 0, 0, 0, 0, 213, - 214, 0, 0, 0, 0, 0, 0, 215, 216, 0, - 0, 217, 36, 0, 37, 0, 0, 0, 38, 0, - 39, 41, 42, 0, 0, 44, 0, 0, 0, 45, - 0, 46, 0, 0, 0, 0, 0, 219, 0, 220, - 0, 0, 0, 50, 218, 221, 48, 222, 51, 223, - 52, 224, 54, 225, 55, 226, 227, 0, 0, 43, - 53, 32, 209, 211, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 569, 109, - 110, 0, 0, 571, 114, 573, 30, 31, 574, 0, - 117, 0, 0, 0, 119, 576, 577, 0, 0, 0, - 0, 0, 0, 578, 579, 123, 124, 217, 36, 0, - 37, 0, 0, 0, 38, 0, 39, 580, 42, 0, - 0, 582, 0, 0, 0, 45, 0, 46, 0, 0, - 0, 0, 0, 584, 0, 220, 0, 0, 0, 586, - 583, 585, 48, 587, 588, 589, 52, 591, 592, 593, - 594, 595, 596, 0, 0, 581, 590, 575, 570, 572, - 127, 40, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 360, 109, 110, 0, 0, 362, - 114, 364, 30, 31, 365, 0, 117, 0, 0, 0, - 119, 367, 368, 0, 0, 0, 0, 0, 0, 369, - 370, 123, 124, 217, 36, 0, 37, 0, 0, 0, - 38, 0, 39, 371, 42, 0, 0, 373, 0, 0, - 0, 45, 0, 46, 0, -263, 0, 0, 0, 375, - 0, 220, 0, 0, 0, 377, 374, 376, 48, 378, - 379, 380, 52, 382, 383, 384, 385, 386, 387, 0, - 0, 372, 381, 366, 361, 363, 127, 40, 0, 0, + 0, 0, 0, 0, 0, 0, 332, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 541, 310, 460, 513, 538, 518, 525, 308, 249, 632, - 306, 181, 252, 618, 149, 16, 623, 495, 319, 497, - 629, 357, 496, 435, 471, 553, 557, 486, 438, 301, - 428, 237, 350, 352, 604, 521, 242, 424, 550, 552, - 181, 301, 185, 237, 242, 343, 432, 348, 338, 249, - 459, 237, 453, 449, 236, 242, 446, 181, 466, 401, - 448, 249, 357, 455, 444, 457, 346, 337, 357, 484, - 142, 236, 147, 333, 438, 175, 301, 335, 187, 409, - 162, 145, 435, 416, 435, 139, 170, 399, 414, 481, - 438, 389, 0, 168, 0, 0, 403, 357, 403, 59, - 357, 490, 301, 534, 391, 0, 0, 0, 301, 0, - 0, 460, 0, 145, 59, 0, 179, 403, 177, 59, - 59, 488, 489, 0, 404, 105, 404, 0, 59, 185, - 451, 59, 59, 450, 59, 59, 59, 59, 59, 283, - 284, 59, 287, 285, 145, 404, 286, 107, 167, 406, - 164, 59, 59, 451, 450, 265, 59, 59, 301, 59, - 269, 68, 96, 95, 479, 59, 59, 331, 478, 59, - 87, 76, 59, 329, 59, 97, 434, 83, 89, 431, - 59, 470, 59, 59, 59, 94, 88, 59, 93, 92, - 59, 59, 90, 59, 59, 91, 493, 59, 59, 71, - 67, 59, 59, 491, 492, 99, 59, 101, 179, 319, - 301, 59, 59, 340, 69, 60, 59, 59, 450, 66, - 59, 59, 451, 304, 105, 499, 269, 297, 297, 297, - 59, 59, 269, 269, 269, 269, 269, 0, 315, 272, - 498, 508, 294, 0, 0, 0, 107, 174, 59, 325, - 318, 316, 297, 269, 59, 290, 0, 269, 297, 269, - 0, 59, 0, 269, 59, 0, 269, 292, 59, 269, - 179, 277, 59, 0, 299, 302, 312, 269, 59, 288, - 296, 328, 609, 269, 499, 289, 597, 633, 606, 599, - 499, 600, 565, 600, 0, 0, 499, 0, 0, 568, - 561, 562, 563, 564, 0, 498, 508, 0, 471, 0, - 0, 498, 508, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 499, 0, 0, 603, 0, 0, 0, 600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 608, 0, 0, 0, 0, 0, + 0, 0, 500, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 499, 509, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -636,148 +663,174 @@ const short QDeclarativeJSGrammar::action_info [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0}; + 0, 0, 0, 0, 0}; const short QDeclarativeJSGrammar::action_check [] = { - 7, 7, 36, 90, 7, 29, 36, 7, 36, 7, - 33, 8, 7, 7, 36, 7, 90, 7, 0, 7, - 16, 60, 55, 33, 8, 29, 7, 36, 7, 55, - 79, 48, 1, 7, 55, 2, 7, 17, 37, 7, - 33, 60, 29, 7, 33, 7, 66, 33, 33, 7, - 66, 29, 7, 36, 20, 7, 7, 29, 33, 36, - 36, 24, 5, 36, 5, 7, 36, 5, 1, 60, - 7, 36, 7, 2, 79, 2, 33, 8, 8, 7, - 1, 7, 36, 36, 8, 1, 36, -1, 8, 36, - -1, 2, 36, 8, 55, 7, -1, -1, -1, 17, - 60, 60, 48, 48, 60, 7, -1, 55, 8, -1, - 33, 36, 61, 6, 48, -1, 33, 15, 8, 10, - 8, 60, 36, 36, 7, 8, 8, 20, 8, 61, - 8, 33, 8, -1, 8, 40, 34, 77, 60, 8, - 8, 8, 61, 79, 50, -1, 51, 50, 54, 8, - 60, 54, 61, 62, 61, 62, 56, 61, 62, 40, - 61, 62, 61, 62, 55, 40, 56, 61, 62, 12, - 51, 42, 60, 15, 61, 62, 51, 7, 60, -1, - 60, 8, 53, 61, 60, 31, 60, 40, 56, 61, - 62, 60, 34, 60, 29, 61, 62, 56, 51, 61, - 62, 61, 62, 25, 25, 27, 27, 8, 25, 25, - 27, 27, 12, 25, 57, 27, 38, 38, 29, 29, - 63, 38, 38, 25, 15, 27, 38, 12, 25, -1, - 27, 61, 62, 8, 61, 62, 38, 25, 8, 27, - 75, 38, 25, 34, 27, 36, 25, 15, 27, 8, - 38, 86, 61, 62, 8, 38, 25, 57, 27, 38, - 61, 62, 15, 63, 75, 75, 34, 29, 36, 38, - 36, 29, 57, 8, 29, 86, 86, 25, 63, 27, - 7, 34, 91, 36, 29, -1, 61, 62, -1, -1, - 38, 61, 62, -1, -1, 61, 62, 25, -1, 27, - 47, -1, 61, 62, 29, -1, 60, -1, -1, -1, - 38, 18, 19, 75, 61, 62, 29, 75, -1, 29, - 75, 66, 67, 68, 86, -1, 61, 62, 86, 15, - -1, 86, 29, -1, 61, 62, 18, 19, 45, 46, - 29, 66, 67, 68, 91, 29, 15, 33, 34, 29, - 36, -1, 29, 66, 67, 68, 66, 67, 68, 29, - -1, -1, 29, 45, 46, 34, 29, 36, -1, 66, - 67, 68, 29, -1, 15, 29, -1, 66, 67, 68, - -1, -1, 66, 67, 68, -1, 66, 67, 68, 66, - 67, 68, 33, 34, -1, 36, 66, 67, 68, 66, - 67, 68, -1, 66, 67, 68, 23, 24, -1, 66, - 67, 68, 66, 67, 68, 32, 23, 24, 35, -1, - 37, -1, -1, 29, -1, 32, 29, -1, 35, 29, - 37, 18, 19, 36, 23, 24, 36, 29, -1, -1, - -1, -1, -1, 32, -1, -1, 35, -1, 37, 29, - -1, -1, -1, -1, -1, 61, 62, -1, 45, 46, - 66, 67, 68, 66, 67, 68, 66, 67, 68, 61, - 62, 23, 24, 29, 66, 67, 68, -1, -1, 31, - 32, 61, 62, 35, -1, 37, 66, 67, 68, 23, - 24, 29, -1, -1, -1, -1, -1, 31, 32, -1, - -1, 35, -1, 37, -1, 61, 62, 23, 24, 29, - 66, 67, 68, 23, 24, 31, 32, -1, -1, 35, - -1, 37, 32, 61, 62, 35, -1, 37, 66, 67, - 68, 92, 93, 94, 95, 96, 97, -1, -1, 3, - -1, 61, 62, -1, -1, -1, 66, 67, 68, 13, - -1, -1, -1, 17, -1, -1, -1, 3, -1, -1, - -1, -1, 26, -1, 28, -1, -1, 13, -1, -1, - -1, 17, -1, -1, -1, 39, -1, 41, 42, -1, - 26, -1, 28, -1, -1, 49, -1, -1, 52, 53, - 23, 24, -1, 39, 58, 41, 42, -1, 31, 32, - 64, -1, 35, 49, 37, -1, 52, 53, -1, -1, - -1, -1, 58, -1, -1, -1, 80, -1, 64, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, - 13, -1, -1, -1, 80, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, - 43, -1, -1, -1, 47, -1, -1, 3, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 13, -1, -1, - -1, 17, 65, 66, 67, 68, -1, 70, -1, -1, - 26, -1, 28, -1, -1, 31, -1, -1, 81, 82, - 83, -1, -1, 39, 87, 41, 42, -1, -1, -1, - -1, -1, -1, 49, -1, -1, 52, 53, -1, -1, - -1, -1, 58, -1, -1, -1, -1, -1, 64, -1, + 55, 7, 33, 7, 55, 7, 60, 36, 90, 55, + 7, 16, 36, 7, 7, 7, 7, 36, 7, 60, + 36, 8, 33, 66, 36, 33, 60, 36, 7, 36, + 7, 7, 33, 36, 24, 7, 7, 37, 8, 60, + 66, 29, 17, 5, 7, 60, 7, 33, 33, 33, + 7, 20, 33, 36, 7, 7, 36, 7, 36, 33, + 7, 17, 60, 36, 1, 33, 79, 2, 8, 7, + 36, 1, 8, 55, 7, 2, 8, 2, 7, 7, + 79, 36, 77, 79, 48, 36, 7, 36, 55, 48, + 36, 36, 33, 36, 8, 60, 1, 31, 0, 2, + 8, 61, 60, 1, 48, 6, 10, 61, 7, 8, + -1, 8, 8, 61, 8, -1, -1, 48, 40, 20, + 8, 60, 8, 42, -1, 40, -1, 50, 8, 51, + 8, 54, 8, 15, 53, 8, 51, 61, 62, 8, + 5, 61, 62, 61, 62, 61, 62, 40, 90, 61, + 62, 55, 34, 79, 61, 62, 40, 8, 51, 8, + 8, 61, 62, 60, 60, 50, 60, 51, 56, 54, + 56, 61, 62, 8, 61, 62, 56, 15, 61, 62, + 61, 62, 60, 56, 60, 15, 25, 8, 27, 29, + 7, 60, 25, 29, 27, 7, 34, 12, 36, 38, + 25, 25, 27, 27, 34, 38, 36, 12, 8, 12, + 61, 60, 60, 38, 38, 8, 25, 25, 27, 27, + -1, 33, 7, -1, -1, 29, 61, 62, 29, 38, + 38, -1, 29, 8, -1, 75, 15, 8, 36, 75, + 61, 62, 57, -1, 61, 62, 86, 29, 63, -1, + 86, 15, 57, -1, 57, 34, 18, 19, 63, -1, + 63, 61, 62, 61, 62, 61, 62, -1, 61, 62, + 34, 75, 36, 15, 75, -1, 61, 62, 75, 15, + 92, -1, 86, 45, 46, 86, 61, 62, 29, 86, + 61, 62, 34, 75, 36, 91, 47, 33, 34, 15, + 36, 18, 19, -1, 86, 18, 19, 29, -1, -1, + 61, 62, -1, -1, 18, 19, -1, 33, 34, 29, + 36, -1, 25, 29, 27, 66, 67, 68, 45, 46, + -1, -1, 45, 46, -1, 38, -1, -1, 23, 24, + 91, 45, 46, -1, 66, 67, 68, 32, -1, -1, + 35, 92, 37, 29, 23, 24, 66, 67, 68, -1, + 66, 67, 68, 32, 23, 24, 35, 29, 37, -1, + 92, 23, 24, 32, 36, -1, 35, -1, 37, -1, + 32, 29, 92, 35, -1, 37, 92, 23, 24, 29, + 66, 67, 68, -1, -1, 29, 32, -1, 29, 35, + -1, 37, 36, -1, 66, 67, 68, 93, 94, 95, + 96, 97, 98, 61, 62, -1, 92, 29, 66, 67, + 68, 61, 62, -1, -1, -1, 66, 67, 68, -1, + 92, -1, 66, 67, 68, 66, 67, 68, -1, -1, + -1, -1, -1, -1, 92, -1, -1, -1, -1, 61, + 62, -1, 92, 29, 66, 67, 68, -1, 92, -1, + -1, 92, 29, -1, -1, 29, -1, -1, -1, -1, + 23, 24, -1, -1, -1, -1, -1, -1, 31, 32, + 92, -1, 35, -1, 37, 61, 62, -1, -1, -1, + 66, 67, 68, -1, 61, 62, -1, 61, 62, 66, + 67, 68, 66, 67, 68, -1, -1, -1, -1, -1, + 12, 13, -1, -1, -1, -1, 92, -1, -1, -1, + 22, -1, -1, -1, -1, 92, -1, 29, 92, -1, + -1, 33, 34, -1, 36, -1, -1, -1, -1, -1, + -1, 43, -1, -1, -1, 47, -1, -1, 3, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 13, -1, + -1, -1, 17, 65, 66, 67, 68, -1, 70, -1, + -1, 26, -1, 28, -1, -1, -1, -1, -1, 81, + 82, 83, -1, -1, 39, 87, 41, 42, -1, -1, + 92, -1, -1, -1, 49, 12, 13, 52, 53, -1, + -1, -1, -1, 58, -1, 22, -1, -1, -1, 64, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, -1, -1, 80, 43, -1, -1, -1, + 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 3, -1, 65, 66, + 67, 68, -1, 70, -1, -1, 13, -1, -1, -1, + 17, -1, -1, -1, 81, 82, 83, -1, -1, 26, + 87, 28, -1, -1, 31, 92, -1, -1, -1, -1, + -1, -1, 39, -1, 41, 42, -1, -1, -1, -1, + -1, -1, 49, -1, -1, 52, 53, -1, -1, -1, + -1, 58, -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, 12, 13, -1, -1, - -1, -1, -1, -1, 80, -1, 22, -1, -1, -1, + -1, -1, -1, 80, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 12, 13, -1, 43, -1, -1, -1, 47, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, 65, 66, 67, 68, -1, 70, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, 81, 82, 83, -1, -1, - -1, 87, -1, -1, -1, -1, -1, 65, 66, 67, - 68, -1, 70, -1, 10, -1, 12, 13, -1, -1, - -1, -1, -1, 81, 82, 83, 22, -1, -1, 87, - -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, - 36, -1, 12, 13, -1, -1, -1, 43, -1, -1, - -1, 47, 22, -1, -1, -1, -1, -1, -1, 29, - -1, -1, -1, 33, 34, -1, 36, -1, -1, 65, - 66, 67, 68, 43, 70, -1, -1, 47, -1, 75, - -1, -1, -1, -1, -1, 81, 82, 83, 84, -1, - -1, 87, -1, -1, -1, 65, 66, 67, 68, -1, - 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, - -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, - -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, - -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, - -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, - 70, -1, -1, -1, -1, 75, -1, -1, -1, -1, - -1, 81, 82, 83, 84, -1, -1, 87, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, - -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, - -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, + -1, 87, -1, -1, -1, -1, 92, 65, 66, 67, + 68, -1, 70, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, + -1, -1, -1, -1, 92, 12, 13, -1, -1, -1, + -1, -1, -1, 12, 13, 22, -1, -1, -1, -1, + -1, -1, 29, 22, -1, -1, 33, 34, -1, 36, + 29, -1, -1, -1, 33, 34, 43, 36, -1, -1, + 47, -1, -1, -1, 43, -1, -1, -1, 47, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, + 67, 68, -1, 70, -1, -1, 65, 66, 67, 68, + -1, 70, -1, -1, 81, 82, 83, -1, -1, -1, + 87, -1, 81, 82, 83, 92, -1, -1, 87, -1, + -1, -1, -1, 92, 12, 13, -1, -1, -1, -1, + -1, -1, 12, 13, 22, -1, -1, -1, -1, -1, + -1, 29, 22, -1, -1, 33, 34, -1, 36, 29, + -1, -1, -1, 33, 34, 43, 36, -1, -1, 47, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, - -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, - 70, -1, -1, -1, -1, 75, -1, -1, -1, -1, - -1, 81, 82, 83, 84, -1, -1, 87, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, - -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, - -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, - -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, - 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, - -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, - 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, - -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, - -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, - -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, - -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, - -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, - 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, - -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, + 68, -1, 70, -1, -1, 65, 66, 67, 68, -1, + 70, -1, -1, 81, 82, 83, -1, -1, -1, 87, + -1, 81, 82, 83, 92, -1, -1, 87, -1, -1, + -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, + -1, 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, - -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, - -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, - -1, 70, -1, 72, -1, 74, 75, 76, -1, -1, - -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, + -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, + -1, 70, -1, -1, -1, -1, 75, -1, -1, -1, + -1, -1, 81, 82, 83, 84, -1, -1, 87, -1, + -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, + -1, -1, 10, -1, 12, 13, -1, -1, -1, -1, + -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, + -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, + -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, + 68, -1, 70, -1, -1, -1, -1, 75, -1, -1, + -1, -1, -1, 81, 82, 83, 84, -1, -1, 87, + -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, + -1, -1, -1, 10, -1, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, + 47, -1, -1, -1, -1, -1, -1, -1, 55, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, + 67, 68, -1, 70, -1, -1, -1, -1, 75, -1, + -1, -1, -1, -1, 81, 82, 83, 84, -1, -1, + 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, + -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, + 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, + -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, + 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, + -1, -1, -1, -1, 7, -1, -1, -1, 11, 12, + 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, + -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, + 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, + 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, + 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, + -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, + 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, + -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, + 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, + -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, + 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, + 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, + 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, + -1, 74, 75, 76, -1, -1, -1, -1, 81, 82, + 83, -1, -1, -1, 87, -1, -1, -1, -1, 92, + -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, + -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, + -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, + -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, + 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, + -1, 51, -1, 53, -1, -1, 56, -1, -1, -1, + -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, + 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, + -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, + -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, @@ -786,25 +839,16 @@ const short QDeclarativeJSGrammar::action_check [] = { -1, 61, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, - -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, - -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, - -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, - -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, - -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, - 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, - -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, - -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, - -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, - 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, - -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, - 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, - 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, - 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, - -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, + -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, + -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, + -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, -1, 56, + -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, + 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, + -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, + 87, -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, @@ -813,120 +857,129 @@ const short QDeclarativeJSGrammar::action_check [] = { -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, - -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, - 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, - 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, - -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, - 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, - -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, - -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, - 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, - 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, - 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, - 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, - -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, + -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, + -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, + 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, + -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, + -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, + -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, + 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, + -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, + -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, + 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, + -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, + 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, + 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, + -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, + -1, -1, 66, 67, 68, 69, 70, 71, -1, 73, + 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, + 84, 85, 86, -1, -1, -1, -1, -1, 92, -1, + -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, + -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, + -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, + -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, + 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 59, -1, -1, -1, -1, -1, 65, 66, + 67, -1, 69, 70, 71, -1, 73, 74, 75, 76, + 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, - 66, 67, 68, 69, 70, 71, -1, 73, 74, 75, - 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, - 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, + -1, -1, -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, 70, 71, -1, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, - 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, - -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, - -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, - -1, 55, -1, -1, -1, 59, -1, -1, -1, -1, - -1, 65, 66, 67, -1, 69, 70, 71, -1, 73, - 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, - 84, 85, 86, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, - -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, - -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, - -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, - -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, - -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, - -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, -1, -1, 81, 82, 83, 84, 85, -1, 87, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 4, -1, -1, -1, -1, 9, -1, 11, - 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, - 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, - -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, - 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, - -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, - -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, - 82, 83, 84, 85, -1, 87, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, - 6, -1, -1, 9, 10, 11, 12, 13, 14, -1, - 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, - -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, + -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, + 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, + -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, + 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, + 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, + 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, + -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, + 83, 84, 85, -1, 87, -1, -1, -1, -1, 92, + -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, + -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, + -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, + -1, -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, - 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, - 10, 11, 12, 13, 14, -1, 16, -1, -1, -1, - 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, - 30, 31, 32, 33, 34, -1, 36, -1, -1, -1, - 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, - -1, 51, -1, 53, -1, 55, -1, -1, -1, 59, - -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, -1, - -1, 81, 82, 83, 84, 85, 86, 87, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, + -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, + 9, 10, 11, 12, 13, 14, -1, 16, -1, -1, + -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, + 29, 30, 31, 32, 33, 34, -1, 36, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, + -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, + 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + -1, -1, 81, 82, 83, 84, 85, 86, 87, -1, + -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, + -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, + 12, 13, 14, -1, 16, -1, -1, -1, 20, 21, + 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, + 32, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, 55, -1, -1, -1, 59, -1, 61, + -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, + 82, 83, 84, 85, 86, 87, -1, -1, -1, -1, + 92, -1, -1, -1, -1, -1, -1, -1, -1, - 3, 2, 15, 25, 25, 3, 25, 3, 2, 11, - 2, 15, 3, 13, 67, 3, 15, 104, 15, 2, - 15, 2, 4, 3, 35, 15, 15, 3, 21, 3, - 93, 15, 2, 2, 19, 13, 15, 96, 25, 25, - 15, 3, 15, 15, 15, 100, 3, 3, 15, 2, - 2, 15, 3, 21, 4, 15, 15, 15, 35, 2, - 21, 2, 2, 2, 98, 3, 2, 2, 2, 35, - 35, 4, 35, 2, 21, 3, 3, 3, 15, 2, - 35, 35, 3, 3, 3, 3, 35, 35, 2, 35, - 21, 35, -1, 35, -1, -1, 13, 2, 13, 44, - 2, 46, 3, 3, 36, -1, -1, -1, 3, -1, - -1, 15, -1, 35, 44, -1, 46, 13, 40, 44, - 44, 46, 46, -1, 41, 15, 41, -1, 44, 15, - 46, 44, 44, 46, 44, 44, 44, 44, 44, 49, - 49, 44, 49, 49, 35, 41, 49, 37, 60, 40, - 58, 44, 44, 46, 46, 44, 44, 44, 3, 44, - 49, 46, 50, 50, 31, 44, 44, 68, 35, 44, - 48, 50, 44, 68, 44, 50, 81, 49, 48, 81, - 44, 85, 44, 44, 44, 49, 48, 44, 49, 49, - 44, 44, 49, 44, 44, 49, 46, 44, 44, 52, - 46, 44, 44, 46, 46, 56, 44, 54, 46, 15, - 3, 44, 44, 99, 47, 47, 44, 44, 46, 46, - 44, 44, 46, 68, 15, 13, 49, 44, 44, 44, - 44, 44, 49, 49, 49, 49, 49, -1, 61, 53, - 28, 29, 55, -1, -1, -1, 37, 38, 44, 66, - 66, 66, 44, 49, 44, 51, -1, 49, 44, 49, - -1, 44, -1, 49, 44, -1, 49, 57, 44, 49, - 46, 51, 44, -1, 66, 68, 59, 49, 44, 51, - 66, 87, 5, 49, 13, 51, 13, 16, 5, 16, - 13, 20, 13, 20, -1, -1, 13, -1, -1, 20, - 21, 22, 23, 24, -1, 28, 29, -1, 35, -1, - -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, + 13, 15, 25, 3, 15, 15, 3, 25, 3, 15, + 2, 15, 2, 25, 3, 11, 19, 15, 67, 13, + 3, 104, 15, 4, 15, 3, 2, 15, 2, 15, + 3, 15, 3, 35, 21, 3, 15, 36, 3, 19, + 25, 2, 2, 25, 21, 15, 15, 98, 15, 15, + 2, 4, 15, 15, 2, 93, 3, 21, 2, 2, + 35, 3, 2, 35, 15, 3, 21, 3, 2, 15, + 15, 2, 2, 2, 15, 3, 35, 35, 35, 35, + 3, 35, 3, 3, 21, 35, 35, 96, 15, 3, + 2, 4, 3, 2, 2, 100, 35, 3, 3, 2, + 35, 2, -1, -1, -1, 15, -1, -1, -1, -1, + -1, 44, 44, 46, 46, 13, -1, -1, 44, 44, + 44, 46, 46, 15, 15, 44, 44, 44, 54, 44, + 49, 49, 49, 3, 49, 15, -1, 44, -1, -1, + 44, 48, 44, 41, 48, 44, 37, 46, 44, 44, + 35, 44, 35, 46, 49, 40, 58, 40, 44, 3, + 44, -1, 48, 68, 60, 49, 44, 44, 44, 44, + -1, 49, 49, 49, 49, 85, 44, 44, 81, 46, + 81, 44, 44, 46, 52, 44, 44, 46, 50, 44, + 31, 46, 50, 13, 35, 87, 44, 2, 68, 47, + 20, 44, 44, 46, 46, 44, 13, 44, 47, 46, + 44, 44, 46, 44, 44, 46, 49, 13, 44, 99, + 46, 44, 44, 46, 68, 44, 56, 44, 50, 46, + 49, 44, -1, 44, 41, 44, 15, 50, 49, -1, + 49, 13, 44, 13, 44, 41, 16, 49, 57, 49, + 20, -1, -1, -1, -1, 66, 28, 29, 37, 38, + 44, 61, -1, 44, 66, 49, 44, 51, 49, 44, + 51, 49, -1, 51, 49, 44, 44, 44, -1, 44, + 49, 49, 49, 13, 49, -1, 16, 55, 53, 44, + 20, 66, 59, 44, 49, 5, -1, 66, 49, 13, + 51, 3, 16, 13, -1, 13, 20, -1, -1, -1, + -1, 66, 20, 21, 22, 23, 24, -1, 28, 29, + -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 68, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 13, -1, -1, 16, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, + -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -934,6 +987,6 @@ const short QDeclarativeJSGrammar::action_check [] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1}; + -1, -1, -1, -1, -1}; QT_END_NAMESPACE diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h index d6c3d6b..2b2e3d1 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h +++ b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h @@ -61,10 +61,10 @@ QT_BEGIN_NAMESPACE class QDeclarativeJSGrammar { public: - enum VariousConstants { + enum { EOF_SYMBOL = 0, - REDUCE_HERE = 99, - SHIFT_THERE = 98, + REDUCE_HERE = 100, + SHIFT_THERE = 99, T_AND = 1, T_AND_AND = 2, T_AND_EQ = 3, @@ -90,12 +90,12 @@ public: T_EQ_EQ = 18, T_EQ_EQ_EQ = 19, T_FALSE = 83, - T_FEED_JS_EXPRESSION = 95, - T_FEED_JS_PROGRAM = 97, - T_FEED_JS_SOURCE_ELEMENT = 96, - T_FEED_JS_STATEMENT = 94, - T_FEED_UI_OBJECT_MEMBER = 93, - T_FEED_UI_PROGRAM = 92, + T_FEED_JS_EXPRESSION = 96, + T_FEED_JS_PROGRAM = 98, + T_FEED_JS_SOURCE_ELEMENT = 97, + T_FEED_JS_STATEMENT = 95, + T_FEED_UI_OBJECT_MEMBER = 94, + T_FEED_UI_PROGRAM = 93, T_FINALLY = 20, T_FOR = 21, T_FUNCTION = 22, @@ -127,6 +127,7 @@ public: T_NOT_EQ_EQ = 46, T_NULL = 81, T_NUMERIC_LITERAL = 47, + T_ON = 92, T_OR = 48, T_OR_EQ = 49, T_OR_OR = 50, @@ -163,15 +164,15 @@ public: T_XOR = 79, T_XOR_EQ = 80, - ACCEPT_STATE = 635, - RULE_COUNT = 343, - STATE_COUNT = 636, - TERMINAL_COUNT = 100, + ACCEPT_STATE = 639, + RULE_COUNT = 345, + STATE_COUNT = 640, + TERMINAL_COUNT = 101, NON_TERMINAL_COUNT = 106, - GOTO_INDEX_OFFSET = 636, - GOTO_INFO_OFFSET = 2520, - GOTO_CHECK_OFFSET = 2520 + GOTO_INDEX_OFFSET = 640, + GOTO_INFO_OFFSET = 2699, + GOTO_CHECK_OFFSET = 2699 }; static const char *const spell []; diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp index 384d00c..34163a4 100644 --- a/src/declarative/qml/parser/qdeclarativejslexer.cpp +++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp @@ -166,6 +166,8 @@ int Lexer::findReservedWord(const QChar *c, int size) const return QDeclarativeJSGrammar::T_IN; else if (c[0] == QLatin1Char('a') && c[1] == QLatin1Char('s')) return QDeclarativeJSGrammar::T_AS; + else if (c[0] == QLatin1Char('o') && c[1] == QLatin1Char('n')) + return QDeclarativeJSGrammar::T_ON; } break; case 3: { diff --git a/src/declarative/qml/parser/qdeclarativejsparser.cpp b/src/declarative/qml/parser/qdeclarativejsparser.cpp index 4aa4960..fd9e690 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser.cpp +++ b/src/declarative/qml/parser/qdeclarativejsparser.cpp @@ -356,7 +356,15 @@ case 32: { node->colonToken = loc(2); sym(1).Node = node; } break; -case 33:case 34:case 35:case 36: + +case 33: { + AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(), + sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer); + node->colonToken = loc(2); + node->hasOnToken = true; + sym(1).Node = node; +} break; +case 34:case 35:case 36:case 37: { AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(), sym(1).UiQualifiedId, sym(3).Statement); @@ -364,35 +372,35 @@ case 33:case 34:case 35:case 36: sym(1).Node = node; } break; -case 37: +case 38: -case 38: { +case 39: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); break; } -case 40: { +case 41: { sym(1).Node = 0; } break; -case 41: { +case 42: { sym(1).Node = sym(1).UiParameterList->finish (); } break; -case 42: { +case 43: { AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).sval, sym(2).sval); node->identifierToken = loc(2); sym(1).Node = node; } break; -case 43: { +case 44: { AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, sym(3).sval, sym(4).sval); node->commaToken = loc(2); node->identifierToken = loc(4); sym(1).Node = node; } break; -case 45: { +case 46: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); @@ -403,7 +411,7 @@ case 45: { sym(1).Node = node; } break; -case 47: { +case 48: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); @@ -413,7 +421,7 @@ case 47: { sym(1).Node = node; } break; -case 49: { +case 50: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval); node->typeModifier = sym(2).sval; node->propertyToken = loc(1); @@ -424,7 +432,7 @@ case 49: { sym(1).Node = node; } break; -case 51: { +case 52: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval); node->propertyToken = loc(1); node->typeToken = loc(2); @@ -433,7 +441,7 @@ case 51: { sym(1).Node = node; } break; -case 53: { +case 54: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval); node->isDefaultMember = true; node->defaultToken = loc(1); @@ -444,7 +452,7 @@ case 53: { sym(1).Node = node; } break; -case 55: { +case 56: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval, sym(5).Expression); node->propertyToken = loc(1); @@ -455,7 +463,7 @@ case 55: { sym(1).Node = node; } break; -case 57: { +case 58: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval, sym(6).Expression); node->isReadonlyMember = true; @@ -468,7 +476,7 @@ case 57: { sym(1).Node = node; } break; -case 59: { +case 60: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval, sym(6).Expression); node->isDefaultMember = true; @@ -481,75 +489,81 @@ case 59: { sym(1).Node = node; } break; -case 60: { +case 61: { sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node); } break; -case 61: { +case 62: { sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node); } break; -case 63: { +case 64: { QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_PROPERTY]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 64: { +case 65: { QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_SIGNAL]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 65: { +case 66: { QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 66: { +case 67: { + QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]); + sym(1).sval = driver->intern(s.constData(), s.length()); + break; +} + +case 68: { AST::ThisExpression *node = makeAstNode<AST::ThisExpression> (driver->nodePool()); node->thisToken = loc(1); sym(1).Node = node; } break; -case 67: { +case 69: { AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 68: { +case 70: { AST::NullExpression *node = makeAstNode<AST::NullExpression> (driver->nodePool()); node->nullToken = loc(1); sym(1).Node = node; } break; -case 69: { +case 71: { AST::TrueLiteral *node = makeAstNode<AST::TrueLiteral> (driver->nodePool()); node->trueToken = loc(1); sym(1).Node = node; } break; -case 70: { +case 72: { AST::FalseLiteral *node = makeAstNode<AST::FalseLiteral> (driver->nodePool()); node->falseToken = loc(1); sym(1).Node = node; } break; -case 71: { +case 73: { AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 72: -case 73: { +case 74: +case 75: { AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 74: { +case 76: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -560,7 +574,7 @@ case 74: { sym(1).Node = node; } break; -case 75: { +case 77: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -571,28 +585,28 @@ case 75: { sym(1).Node = node; } break; -case 76: { +case 78: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), (AST::Elision *) 0); node->lbracketToken = loc(1); node->rbracketToken = loc(2); sym(1).Node = node; } break; -case 77: { +case 79: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision->finish()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 78: { +case 80: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 79: { +case 81: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), (AST::Elision *) 0); node->lbracketToken = loc(1); @@ -601,7 +615,7 @@ case 79: { sym(1).Node = node; } break; -case 80: { +case 82: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision->finish()); node->lbracketToken = loc(1); @@ -610,7 +624,7 @@ case 80: { sym(1).Node = node; } break; -case 81: { +case 83: { AST::ObjectLiteral *node = 0; if (sym(2).Node) node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(), @@ -622,7 +636,7 @@ case 81: { sym(1).Node = node; } break; -case 82: { +case 84: { AST::ObjectLiteral *node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); @@ -630,14 +644,14 @@ case 82: { sym(1).Node = node; } break; -case 83: { +case 85: { AST::NestedExpression *node = makeAstNode<AST::NestedExpression>(driver->nodePool(), sym(2).Expression); node->lparenToken = loc(1); node->rparenToken = loc(3); sym(1).Node = node; } break; -case 84: { +case 86: { if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken, QLatin1String("Ignored annotation"))); @@ -657,48 +671,48 @@ case 84: { } } break; -case 85: { +case 87: { sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), (AST::Elision *) 0, sym(1).Expression); } break; -case 86: { +case 88: { sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).Elision->finish(), sym(2).Expression); } break; -case 87: { +case 89: { AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, (AST::Elision *) 0, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 88: { +case 90: { AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision->finish(), sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 89: { +case 91: { AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool()); node->commaToken = loc(1); sym(1).Node = node; } break; -case 90: { +case 92: { AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool(), sym(1).Elision); node->commaToken = loc(2); sym(1).Node = node; } break; -case 91: { +case 93: { AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; -case 92: { +case 94: { AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); @@ -706,40 +720,36 @@ case 92: { sym(1).Node = node; } break; -case 93: { +case 95: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 94: -case 95: { +case 96: +case 97: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 96: { +case 98: { AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 97: { +case 99: { AST::NumericLiteralPropertyName *node = makeAstNode<AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 98: { +case 100: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 99: - -case 100: - case 101: case 102: @@ -797,25 +807,29 @@ case 127: case 128: case 129: + +case 130: + +case 131: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); } break; -case 134: { +case 136: { AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 135: { +case 137: { AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 136: { +case 138: { AST::NewMemberExpression *node = makeAstNode<AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); @@ -823,316 +837,309 @@ case 136: { sym(1).Node = node; } break; -case 138: { +case 140: { AST::NewExpression *node = makeAstNode<AST::NewExpression> (driver->nodePool(), sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; -case 139: { +case 141: { AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 140: { +case 142: { AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 141: { +case 143: { AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 142: { +case 144: { AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 143: { +case 145: { sym(1).Node = 0; } break; -case 144: { +case 146: { sym(1).Node = sym(1).ArgumentList->finish(); } break; -case 145: { +case 147: { sym(1).Node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).Expression); } break; -case 146: { +case 148: { AST::ArgumentList *node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 150: { +case 152: { AST::PostIncrementExpression *node = makeAstNode<AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; -case 151: { +case 153: { AST::PostDecrementExpression *node = makeAstNode<AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; -case 153: { +case 155: { AST::DeleteExpression *node = makeAstNode<AST::DeleteExpression> (driver->nodePool(), sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; -case 154: { +case 156: { AST::VoidExpression *node = makeAstNode<AST::VoidExpression> (driver->nodePool(), sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; -case 155: { +case 157: { AST::TypeOfExpression *node = makeAstNode<AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; -case 156: { +case 158: { AST::PreIncrementExpression *node = makeAstNode<AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; -case 157: { +case 159: { AST::PreDecrementExpression *node = makeAstNode<AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; -case 158: { +case 160: { AST::UnaryPlusExpression *node = makeAstNode<AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; -case 159: { +case 161: { AST::UnaryMinusExpression *node = makeAstNode<AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; -case 160: { +case 162: { AST::TildeExpression *node = makeAstNode<AST::TildeExpression> (driver->nodePool(), sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; -case 161: { +case 163: { AST::NotExpression *node = makeAstNode<AST::NotExpression> (driver->nodePool(), sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; -case 163: { +case 165: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 164: { +case 166: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 165: { +case 167: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 167: { +case 169: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 168: { +case 170: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 170: { +case 172: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 171: { +case 173: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 172: { +case 174: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 174: { +case 176: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 175: { +case 177: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 176: { +case 178: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 177: { +case 179: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 178: { +case 180: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 179: { +case 181: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 181: { +case 183: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 182: { +case 184: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 183: { +case 185: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 184: { +case 186: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 185: { +case 187: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 187: { +case 189: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 188: { +case 190: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 189: { +case 191: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 190: { +case 192: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 192: { +case 194: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 193: { +case 195: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 194: { +case 196: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 195: { - AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::StrictNotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; - case 197: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::BitAnd, sym(3).Expression); + QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1146,7 +1153,7 @@ case 199: { case 201: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::BitXor, sym(3).Expression); + QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1160,7 +1167,7 @@ case 203: { case 205: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::BitOr, sym(3).Expression); + QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1174,7 +1181,7 @@ case 207: { case 209: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::And, sym(3).Expression); + QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1188,7 +1195,7 @@ case 211: { case 213: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::Or, sym(3).Expression); + QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1201,6 +1208,13 @@ case 215: { } break; case 217: { + AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, + QSOperator::Or, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; +} break; + +case 219: { AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1208,7 +1222,7 @@ case 217: { sym(1).Node = node; } break; -case 219: { +case 221: { AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1216,112 +1230,112 @@ case 219: { sym(1).Node = node; } break; -case 221: { +case 223: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 223: { +case 225: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 224: { +case 226: { sym(1).ival = QSOperator::Assign; } break; -case 225: { +case 227: { sym(1).ival = QSOperator::InplaceMul; } break; -case 226: { +case 228: { sym(1).ival = QSOperator::InplaceDiv; } break; -case 227: { +case 229: { sym(1).ival = QSOperator::InplaceMod; } break; -case 228: { +case 230: { sym(1).ival = QSOperator::InplaceAdd; } break; -case 229: { +case 231: { sym(1).ival = QSOperator::InplaceSub; } break; -case 230: { +case 232: { sym(1).ival = QSOperator::InplaceLeftShift; } break; -case 231: { +case 233: { sym(1).ival = QSOperator::InplaceRightShift; } break; -case 232: { +case 234: { sym(1).ival = QSOperator::InplaceURightShift; } break; -case 233: { +case 235: { sym(1).ival = QSOperator::InplaceAnd; } break; -case 234: { +case 236: { sym(1).ival = QSOperator::InplaceXor; } break; -case 235: { +case 237: { sym(1).ival = QSOperator::InplaceOr; } break; -case 237: { +case 239: { AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 238: { +case 240: { sym(1).Node = 0; } break; -case 241: { +case 243: { AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 242: { +case 244: { sym(1).Node = 0; } break; -case 259: { +case 261: { AST::Block *node = makeAstNode<AST::Block> (driver->nodePool(), sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 260: { +case 262: { sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).Statement); } break; -case 261: { +case 263: { sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement); } break; -case 262: { +case 264: { sym(1).Node = 0; } break; -case 263: { +case 265: { sym(1).Node = sym(1).StatementList->finish (); } break; -case 265: { +case 267: { AST::VariableStatement *node = makeAstNode<AST::VariableStatement> (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); @@ -1329,76 +1343,76 @@ case 265: { sym(1).Node = node; } break; -case 266: { +case 268: { sym(1).ival = T_CONST; } break; -case 267: { +case 269: { sym(1).ival = T_VAR; } break; -case 268: { +case 270: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 269: { +case 271: { AST::VariableDeclarationList *node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; -case 270: { +case 272: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 271: { +case 273: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; -case 272: { +case 274: { AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 273: { +case 275: { AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 274: { +case 276: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 275: { +case 277: { sym(1).Node = 0; } break; -case 277: { +case 279: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 278: { +case 280: { sym(1).Node = 0; } break; -case 280: { +case 282: { AST::EmptyStatement *node = makeAstNode<AST::EmptyStatement> (driver->nodePool()); node->semicolonToken = loc(1); sym(1).Node = node; } break; -case 282: { +case 284: { AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 283: { +case 285: { AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1407,7 +1421,7 @@ case 283: { sym(1).Node = node; } break; -case 284: { +case 286: { AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1415,7 +1429,7 @@ case 284: { sym(1).Node = node; } break; -case 286: { +case 288: { AST::DoWhileStatement *node = makeAstNode<AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); @@ -1425,7 +1439,7 @@ case 286: { sym(1).Node = node; } break; -case 287: { +case 289: { AST::WhileStatement *node = makeAstNode<AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); @@ -1433,7 +1447,7 @@ case 287: { sym(1).Node = node; } break; -case 288: { +case 290: { AST::ForStatement *node = makeAstNode<AST::ForStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); @@ -1444,7 +1458,7 @@ case 288: { sym(1).Node = node; } break; -case 289: { +case 291: { AST::LocalForStatement *node = makeAstNode<AST::LocalForStatement> (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); @@ -1457,7 +1471,7 @@ case 289: { sym(1).Node = node; } break; -case 290: { +case 292: { AST:: ForEachStatement *node = makeAstNode<AST::ForEachStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); @@ -1467,7 +1481,7 @@ case 290: { sym(1).Node = node; } break; -case 291: { +case 293: { AST::LocalForEachStatement *node = makeAstNode<AST::LocalForEachStatement> (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); @@ -1478,14 +1492,14 @@ case 291: { sym(1).Node = node; } break; -case 293: { +case 295: { AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool()); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 295: { +case 297: { AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval); node->continueToken = loc(1); node->identifierToken = loc(2); @@ -1493,14 +1507,14 @@ case 295: { sym(1).Node = node; } break; -case 297: { +case 299: { AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 299: { +case 301: { AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval); node->breakToken = loc(1); node->identifierToken = loc(2); @@ -1508,14 +1522,14 @@ case 299: { sym(1).Node = node; } break; -case 301: { +case 303: { AST::ReturnStatement *node = makeAstNode<AST::ReturnStatement> (driver->nodePool(), sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 302: { +case 304: { AST::WithStatement *node = makeAstNode<AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); @@ -1523,7 +1537,7 @@ case 302: { sym(1).Node = node; } break; -case 303: { +case 305: { AST::SwitchStatement *node = makeAstNode<AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); @@ -1531,90 +1545,90 @@ case 303: { sym(1).Node = node; } break; -case 304: { +case 306: { AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 305: { +case 307: { AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(5); sym(1).Node = node; } break; -case 306: { +case 308: { sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause); } break; -case 307: { +case 309: { sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); } break; -case 308: { +case 310: { sym(1).Node = 0; } break; -case 309: { +case 311: { sym(1).Node = sym(1).CaseClauses->finish (); } break; -case 310: { +case 312: { AST::CaseClause *node = makeAstNode<AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; -case 311: { +case 313: { AST::DefaultClause *node = makeAstNode<AST::DefaultClause> (driver->nodePool(), sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 312: -case 313: { +case 314: +case 315: { AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 314: { +case 316: { AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 316: { +case 318: { AST::ThrowStatement *node = makeAstNode<AST::ThrowStatement> (driver->nodePool(), sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 317: { +case 319: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; -case 318: { +case 320: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 319: { +case 321: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 320: { +case 322: { AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); @@ -1623,20 +1637,20 @@ case 320: { sym(1).Node = node; } break; -case 321: { +case 323: { AST::Finally *node = makeAstNode<AST::Finally> (driver->nodePool(), sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; -case 323: { +case 325: { AST::DebuggerStatement *node = makeAstNode<AST::DebuggerStatement> (driver->nodePool()); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 324: { +case 326: { AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); @@ -1647,7 +1661,7 @@ case 324: { sym(1).Node = node; } break; -case 325: { +case 327: { AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (sym(2).sval) @@ -1659,60 +1673,60 @@ case 325: { sym(1).Node = node; } break; -case 326: { +case 328: { AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 327: { +case 329: { AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 328: { +case 330: { sym(1).Node = 0; } break; -case 329: { +case 331: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; -case 330: { +case 332: { sym(1).Node = 0; } break; -case 332: { +case 334: { sym(1).Node = makeAstNode<AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ()); } break; -case 333: { +case 335: { sym(1).Node = makeAstNode<AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ()); } break; -case 334: { +case 336: { sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElement); } break; -case 335: { +case 337: { sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); } break; -case 336: { +case 338: { sym(1).Node = makeAstNode<AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement); } break; -case 337: { +case 339: { sym(1).Node = makeAstNode<AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration); } break; -case 338: { +case 340: { sym(1).sval = 0; } break; -case 340: { +case 342: { sym(1).Node = 0; } break; diff --git a/src/declarative/qml/parser/qdeclarativejsparser_p.h b/src/declarative/qml/parser/qdeclarativejsparser_p.h index c7e097a..3864398 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser_p.h +++ b/src/declarative/qml/parser/qdeclarativejsparser_p.h @@ -235,9 +235,9 @@ protected: -#define J_SCRIPT_REGEXPLITERAL_RULE1 74 +#define J_SCRIPT_REGEXPLITERAL_RULE1 76 -#define J_SCRIPT_REGEXPLITERAL_RULE2 75 +#define J_SCRIPT_REGEXPLITERAL_RULE2 77 QT_QML_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 720c562..88ca5cd 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -97,7 +97,7 @@ QDeclarativeBinding::~QDeclarativeBinding() { } -void QDeclarativeBinding::setTarget(const QDeclarativeMetaProperty &prop) +void QDeclarativeBinding::setTarget(const QDeclarativeProperty &prop) { Q_D(QDeclarativeBinding); d->bindingData()->property = prop; @@ -105,13 +105,13 @@ void QDeclarativeBinding::setTarget(const QDeclarativeMetaProperty &prop) update(); } -QDeclarativeMetaProperty QDeclarativeBinding::property() const +QDeclarativeProperty QDeclarativeBinding::property() const { Q_D(const QDeclarativeBinding); return d->bindingData()->property; } -void QDeclarativeBinding::update(QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) { Q_D(QDeclarativeBinding); @@ -130,7 +130,7 @@ void QDeclarativeBinding::update(QDeclarativeMetaPropertyPrivate::WriteFlags fla if (data->property.propertyType() == qMetaTypeId<QDeclarativeBinding *>()) { - int idx = data->property.coreIndex(); + int idx = data->property.index(); Q_ASSERT(idx != -1); @@ -161,7 +161,7 @@ void QDeclarativeBinding::update(QDeclarativeMetaPropertyPrivate::WriteFlags fla data->error.setDescription(QLatin1String("Unable to assign [undefined] to ") + QLatin1String(QMetaType::typeName(data->property.propertyType()))); } else if (!isUndefined && data->property.object() && - !QDeclarativeMetaPropertyPrivate::write(data->property, value, flags)) { + !QDeclarativePropertyPrivate::write(data->property, value, flags)) { QUrl url = QUrl(data->url); int line = data->line; @@ -204,7 +204,7 @@ void QDeclarativeBindingPrivate::emitValueChanged() q->update(); } -void QDeclarativeBinding::setEnabled(bool e, QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativeBinding::setEnabled(bool e, QDeclarativePropertyPrivate::WriteFlags flags) { Q_D(QDeclarativeBinding); d->bindingData()->enabled = e; @@ -223,7 +223,7 @@ void QDeclarativeBinding::setEnabled(bool e, QDeclarativeMetaPropertyPrivate::Wr int QDeclarativeBinding::propertyIndex() { Q_D(QDeclarativeBinding); - return d->bindingData()->property.coreIndex(); + return d->bindingData()->property.index(); } bool QDeclarativeBinding::enabled() const @@ -300,7 +300,7 @@ QString QDeclarativeAbstractBinding::expression() const return QLatin1String("<Unknown>"); } -void QDeclarativeAbstractBinding::setEnabled(bool e, QDeclarativeMetaPropertyPrivate::WriteFlags) +void QDeclarativeAbstractBinding::setEnabled(bool e, QDeclarativePropertyPrivate::WriteFlags) { if (e) m_mePtr = 0; } diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h index ac174fa..f66b9c7 100644 --- a/src/declarative/qml/qdeclarativebinding_p.h +++ b/src/declarative/qml/qdeclarativebinding_p.h @@ -56,8 +56,8 @@ #include "qdeclarative.h" #include "qdeclarativepropertyvaluesource.h" #include "qdeclarativeexpression.h" -#include "qdeclarativemetaproperty.h" -#include "qdeclarativemetaproperty_p.h" +#include "qdeclarativeproperty.h" +#include "qdeclarativeproperty_p.h" #include <QtCore/QObject> #include <QtCore/QMetaProperty> @@ -74,12 +74,12 @@ public: virtual QString expression() const; - void setEnabled(bool e) { setEnabled(e, QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } - virtual void setEnabled(bool, QDeclarativeMetaPropertyPrivate::WriteFlags) = 0; + void setEnabled(bool e) { setEnabled(e, QDeclarativePropertyPrivate::DontRemoveBinding); } + virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags) = 0; virtual int propertyIndex() = 0; - void update() { update(QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } - virtual void update(QDeclarativeMetaPropertyPrivate::WriteFlags) = 0; + void update() { update(QDeclarativePropertyPrivate::DontRemoveBinding); } + virtual void update(QDeclarativePropertyPrivate::WriteFlags) = 0; void addToObject(QObject *); void removeFromObject(); @@ -89,8 +89,8 @@ protected: private: friend class QDeclarativeDeclarativeData; - friend class QDeclarativeMetaProperty; - friend class QDeclarativeMetaPropertyPrivate; + friend class QDeclarativeProperty; + friend class QDeclarativePropertyPrivate; friend class QDeclarativeVME; QObject *m_object; @@ -110,19 +110,19 @@ public: QObject *parent); ~QDeclarativeBinding(); - void setTarget(const QDeclarativeMetaProperty &); - QDeclarativeMetaProperty property() const; + void setTarget(const QDeclarativeProperty &); + QDeclarativeProperty property() const; bool enabled() const; // Inherited from QDeclarativeAbstractBinding - virtual void setEnabled(bool, QDeclarativeMetaPropertyPrivate::WriteFlags flags); + virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags flags); virtual int propertyIndex(); - virtual void update(QDeclarativeMetaPropertyPrivate::WriteFlags flags); + virtual void update(QDeclarativePropertyPrivate::WriteFlags flags); virtual QString expression() const; public Q_SLOTS: - void update() { update(QDeclarativeMetaPropertyPrivate::DontRemoveBinding); } + void update() { update(QDeclarativePropertyPrivate::DontRemoveBinding); } protected: void emitValueChanged(); diff --git a/src/declarative/qml/qdeclarativebinding_p_p.h b/src/declarative/qml/qdeclarativebinding_p_p.h index ac88400..041103c 100644 --- a/src/declarative/qml/qdeclarativebinding_p_p.h +++ b/src/declarative/qml/qdeclarativebinding_p_p.h @@ -55,7 +55,7 @@ #include "qdeclarativebinding_p.h" -#include "qdeclarativemetaproperty.h" +#include "qdeclarativeproperty.h" #include "qdeclarativeexpression_p.h" QT_BEGIN_NAMESPACE @@ -69,7 +69,7 @@ public: bool updating:1; bool enabled:1; - QDeclarativeMetaProperty property; + QDeclarativeProperty property; virtual void refresh(); }; diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp index ce396fd..6a5a102 100644 --- a/src/declarative/qml/qdeclarativeboundsignal.cpp +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp @@ -104,7 +104,7 @@ QDeclarativeBoundSignal::QDeclarativeBoundSignal(QObject *scope, const QMetaMeth // is that they both do the work to figure it out. Boo hoo. if (evaluateIdx == -1) evaluateIdx = metaObject()->methodCount(); - QDeclarativeGraphics_setParent_noEvent(this, parent); + QDeclarative_setParent_noEvent(this, parent); QMetaObject::connect(scope, m_signal.methodIndex(), this, evaluateIdx); } @@ -120,7 +120,7 @@ QDeclarativeBoundSignal::QDeclarativeBoundSignal(QDeclarativeContext *ctxt, cons // is that they both do the work to figure it out. Boo hoo. if (evaluateIdx == -1) evaluateIdx = metaObject()->methodCount(); - QDeclarativeGraphics_setParent_noEvent(this, parent); + QDeclarative_setParent_noEvent(this, parent); QMetaObject::connect(scope, m_signal.methodIndex(), this, evaluateIdx); m_expression = new QDeclarativeExpression(ctxt, val, scope); diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index a88f02e..17937fd 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -109,9 +109,9 @@ public: scope(0), target(0), parent(0) {} // Inherited from QDeclarativeAbstractBinding - virtual void setEnabled(bool, QDeclarativeMetaPropertyPrivate::WriteFlags flags); + virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags flags); virtual int propertyIndex(); - virtual void update(QDeclarativeMetaPropertyPrivate::WriteFlags flags); + virtual void update(QDeclarativePropertyPrivate::WriteFlags flags); virtual void destroy(); int index:30; @@ -244,7 +244,7 @@ QDeclarativeAbstractBinding *QDeclarativeCompiledBindings::configBinding(int ind return rv; } -void QDeclarativeCompiledBindingsPrivate::Binding::setEnabled(bool e, QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativeCompiledBindingsPrivate::Binding::setEnabled(bool e, QDeclarativePropertyPrivate::WriteFlags flags) { if (e) { addToObject(target); @@ -267,7 +267,7 @@ int QDeclarativeCompiledBindingsPrivate::Binding::propertyIndex() return property & 0xFFFF; } -void QDeclarativeCompiledBindingsPrivate::Binding::update(QDeclarativeMetaPropertyPrivate::WriteFlags) +void QDeclarativeCompiledBindingsPrivate::Binding::update(QDeclarativePropertyPrivate::WriteFlags) { parent->run(this); } @@ -324,7 +324,7 @@ void QDeclarativeCompiledBindingsPrivate::run(Binding *binding) run(binding->index, cp, binding, binding->scope, target); vt->write(binding->target, binding->property & 0xFFFF, - QDeclarativeMetaPropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::DontRemoveBinding); } else { run(binding->index, cp, binding, binding->scope, binding->target); } @@ -1701,7 +1701,7 @@ bool QDeclarativeBindingCompilerPrivate::compile(QDeclarativeJS::AST::Node *node const QMetaObject *from = type.metaObject; const QMetaObject *to = engine->rawMetaObjectForType(destination->type); - if (QDeclarativeMetaPropertyPrivate::canConvert(from, to)) + if (QDeclarativePropertyPrivate::canConvert(from, to)) type.type = destination->type; } diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 9ac65f9..5da207d 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -58,7 +58,7 @@ #include "parser/qdeclarativejsast_p.h" #include "qdeclarativevmemetaobject_p.h" #include "qdeclarativeexpression_p.h" -#include "qdeclarativemetaproperty_p.h" +#include "qdeclarativeproperty_p.h" #include "qdeclarativerewrite_p.h" #include "qdeclarativescriptstring.h" #include "qdeclarativeglobal_p.h" @@ -1314,8 +1314,9 @@ int QDeclarativeCompiler::componentTypeRef() return output->types.count() - 1; } -int QDeclarativeCompiler::findSignalByName(const QMetaObject *mo, const QByteArray &name) +QMetaMethod QDeclarativeCompiler::findSignalByName(const QMetaObject *mo, const QByteArray &name) { + Q_ASSERT(mo); int methods = mo->methodCount(); for (int ii = methods - 1; ii >= 0; --ii) { QMetaMethod method = mo->method(ii); @@ -1324,7 +1325,7 @@ int QDeclarativeCompiler::findSignalByName(const QMetaObject *mo, const QByteArr methodName = methodName.left(idx); if (methodName == name) - return ii; + return method; } // If no signal is found, but the signal is of the form "onBlahChanged", @@ -1332,11 +1333,14 @@ int QDeclarativeCompiler::findSignalByName(const QMetaObject *mo, const QByteArr if (name.endsWith("Changed")) { QByteArray propName = name.mid(0, name.length() - 7); int propIdx = mo->indexOfProperty(propName.constData()); - if (propIdx >= 0) - return mo->property(propIdx).notifySignalIndex(); + if (propIdx >= 0) { + QMetaProperty prop = mo->property(propIdx); + if (prop.hasNotifySignal()) + return prop.notifySignal(); + } } - return -1; + return QMetaMethod(); } bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj, @@ -1351,7 +1355,7 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl if(name[0] >= 'A' && name[0] <= 'Z') name[0] = name[0] - 'A' + 'a'; - int sigIdx = findSignalByName(obj->metaObject(), name); + int sigIdx = findSignalByName(obj->metaObject(), name).methodIndex(); if (sigIdx == -1) { @@ -2036,7 +2040,7 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Pro if (propertyMetaObject) { const QMetaObject *c = v->object->metatype; while(c) { - isAssignable |= (QDeclarativeMetaPropertyPrivate::equal(c, propertyMetaObject)); + isAssignable |= (QDeclarativePropertyPrivate::equal(c, propertyMetaObject)); c = c->superClass(); } } @@ -2619,7 +2623,7 @@ int QDeclarativeCompiler::genValueTypeData(QDeclarativeParser::Property *valueTy QDeclarativeParser::Property *prop) { QByteArray data = - QDeclarativeMetaPropertyPrivate::saveValueType(prop->parent->metaObject(), prop->index, + QDeclarativePropertyPrivate::saveValueType(prop->parent->metaObject(), prop->index, QDeclarativeEnginePrivate::get(engine)->valueTypes[prop->type]->metaObject(), valueTypeProp->index); // valueTypeProp->index, valueTypeProp->type); @@ -2629,7 +2633,7 @@ int QDeclarativeCompiler::genValueTypeData(QDeclarativeParser::Property *valueTy int QDeclarativeCompiler::genPropertyData(QDeclarativeParser::Property *prop) { - return output->indexForByteArray(QDeclarativeMetaPropertyPrivate::saveProperty(prop->parent->metaObject(), prop->index)); + return output->indexForByteArray(QDeclarativePropertyPrivate::saveProperty(prop->parent->metaObject(), prop->index)); } bool QDeclarativeCompiler::completeComponentBuild() @@ -2735,7 +2739,7 @@ bool QDeclarativeCompiler::canCoerce(int to, QDeclarativeParser::Object *from) const QMetaObject *fromMo = from->metaObject(); while (fromMo) { - if (QDeclarativeMetaPropertyPrivate::equal(fromMo, toMo)) + if (QDeclarativePropertyPrivate::equal(fromMo, toMo)) return true; fromMo = fromMo->superClass(); } @@ -2754,7 +2758,7 @@ bool QDeclarativeCompiler::canCoerce(int to, int from) QDeclarativeEnginePrivate::get(engine)->rawMetaObjectForType(from); while (fromMo) { - if (QDeclarativeMetaPropertyPrivate::equal(fromMo, toMo)) + if (QDeclarativePropertyPrivate::equal(fromMo, toMo)) return true; fromMo = fromMo->superClass(); } diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 627490d..2ea3366 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -159,6 +159,8 @@ public: static bool isAttachedPropertyName(const QByteArray &); static bool isSignalPropertyName(const QByteArray &); + static QMetaMethod findSignalByName(const QMetaObject *, const QByteArray &name); + private: static void reset(QDeclarativeCompiledData *); @@ -263,7 +265,6 @@ private: int componentTypeRef(); - static int findSignalByName(const QMetaObject *, const QByteArray &name); static QDeclarativeType *toQmlType(QDeclarativeParser::Object *from); bool canCoerce(int to, QDeclarativeParser::Object *from); bool canCoerce(int to, int from); diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index aaf36e0..6a2d2d1 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -618,7 +618,7 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContext *context, const QB QObject *rv = begin(ctxt, ep, cc, start, count, &state, bindings); if (rv) { - QDeclarativeGraphics_setParent_noEvent(ctxt, rv); + QDeclarative_setParent_noEvent(ctxt, rv); } else { delete ctxt; } @@ -698,8 +698,8 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri state->bindValues.at(ii); for (int jj = 0; jj < bv.count; ++jj) { if(bv.at(jj)) - bv.at(jj)->setEnabled(true, QDeclarativeMetaPropertyPrivate::BypassInterceptor | - QDeclarativeMetaPropertyPrivate::DontRemoveBinding); + bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | + QDeclarativePropertyPrivate::DontRemoveBinding); } QDeclarativeEnginePrivate::clear(bv); } diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 4435a5b..af75e98 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -49,7 +49,6 @@ #include "qdeclarativecontext.h" #include "qdeclarativeexpression.h" #include "qdeclarativecomponent.h" -#include "qdeclarativemetaproperty_p.h" #include "qdeclarativebinding_p_p.h" #include "qdeclarativevme_p.h" #include "qdeclarativeenginedebug_p.h" @@ -110,7 +109,7 @@ #define CSIDL_APPDATA 0x001a // <username>\Application Data #endif -Q_DECLARE_METATYPE(QDeclarativeMetaProperty) +Q_DECLARE_METATYPE(QDeclarativeProperty) QT_BEGIN_NAMESPACE @@ -337,6 +336,7 @@ void QDeclarativeEnginePrivate::clear(SimpleList<QDeclarativeParserStatus> &pss) } Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer); +Q_GLOBAL_STATIC(QSet<QString>, qmlEnginePluginsWithRegisteredTypes); void QDeclarativeEnginePrivate::init() { @@ -1409,7 +1409,7 @@ public: qmldirParser.parse(); foreach (const QDeclarativeDirParser::Plugin &plugin, qmldirParser.plugins()) { - QString resolvedFilePath = QDeclarativeEnginePrivate::get(engine)->resolvePlugin(dir + QDir::separator() + plugin.path, + QString resolvedFilePath = QDeclarativeEnginePrivate::get(engine)->resolvePlugin(QDir(dir + QDir::separator() + plugin.path), plugin.name); if (!resolvedFilePath.isEmpty()) @@ -1622,10 +1622,32 @@ void QDeclarativeEngine::addImportPath(const QString& path) */ bool QDeclarativeEngine::importExtension(const QString &fileName, const QString &uri) { - QPluginLoader loader(fileName); + QFileInfo fileInfo(fileName); + const QString absoluteFilePath = fileInfo.absoluteFilePath(); + QPluginLoader loader(absoluteFilePath); if (QDeclarativeExtensionInterface *iface = qobject_cast<QDeclarativeExtensionInterface *>(loader.instance())) { - iface->initialize(this, uri.toUtf8().constData()); + const QByteArray bytes = uri.toUtf8(); + const char *moduleId = bytes.constData(); + + // ### this code should probably be protected with a mutex. + if (! qmlEnginePluginsWithRegisteredTypes()->contains(absoluteFilePath)) { + // types should only be registered once (they're global). + + qmlEnginePluginsWithRegisteredTypes()->insert(absoluteFilePath); + iface->registerTypes(moduleId); + } + + QDeclarativeEnginePrivate *d = QDeclarativeEnginePrivate::get(this); + + if (! d->initializedPlugins.contains(absoluteFilePath)) { + // things on the engine (eg. adding new global objects) have to be done for every engine. + + // protect against double initialization + d->initializedPlugins.insert(absoluteFilePath); + iface->initializeEngine(this, moduleId); + } + return true; } @@ -1670,7 +1692,6 @@ QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString const QStringList &suffixes, const QString &prefix) { - qWarning() << baseName; foreach (const QString &suffix, suffixes) { QString pluginFileName = prefix; diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index c4a40c5..0359f98 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -62,7 +62,7 @@ #include "qdeclarativevaluetype_p.h" #include "qdeclarativecontext.h" #include "qdeclarativeexpression.h" -#include "qdeclarativemetaproperty_p.h" +#include "qdeclarativeproperty_p.h" #include "qdeclarativepropertycache_p.h" #include "qdeclarativeobjectscriptclass_p.h" #include "qdeclarativecontextscriptclass_p.h" @@ -267,6 +267,7 @@ public: QStringList environmentImportPath; + QSet<QString> initializedPlugins; QString resolvePlugin(const QDir &dir, const QString &baseName, const QStringList &suffixes, diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 2ae0b54..09882cb 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -44,8 +44,8 @@ #include "qdeclarativeboundsignal_p.h" #include "qdeclarativeengine.h" #include "qdeclarativemetatype_p.h" -#include "qdeclarativemetaproperty.h" -#include "qdeclarativemetaproperty_p.h" +#include "qdeclarativeproperty.h" +#include "qdeclarativeproperty_p.h" #include "qdeclarativebinding_p.h" #include "qdeclarativecontext_p.h" #include "qdeclarativewatcher_p.h" @@ -110,7 +110,7 @@ QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) rv.name = QString::fromUtf8(prop.name()); rv.hasNotifySignal = prop.hasNotifySignal(); QDeclarativeAbstractBinding *binding = - QDeclarativeMetaPropertyPrivate::binding(QDeclarativeMetaProperty(obj, rv.name)); + QDeclarativePropertyPrivate::binding(QDeclarativeProperty(obj, rv.name)); if (binding) rv.binding = binding->expression(); diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/qml/qdeclarativeenginedebug_p.h index 89da399..a95449b 100644 --- a/src/declarative/qml/qdeclarativeenginedebug_p.h +++ b/src/declarative/qml/qdeclarativeenginedebug_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include "../debugger/qdeclarativedebugservice_p.h" +#include <private/qdeclarativedebugservice_p.h> #include <QtCore/qurl.h> #include <QtCore/qvariant.h> diff --git a/src/declarative/qml/qdeclarativeextensioninterface.h b/src/declarative/qml/qdeclarativeextensioninterface.h index a8ae064..0fabd6d 100644 --- a/src/declarative/qml/qdeclarativeextensioninterface.h +++ b/src/declarative/qml/qdeclarativeextensioninterface.h @@ -55,7 +55,8 @@ class QDeclarativeEngine; struct Q_DECLARATIVE_EXPORT QDeclarativeExtensionInterface { virtual ~QDeclarativeExtensionInterface() {} - virtual void initialize(QDeclarativeEngine *engine, const char *uri) = 0; + virtual void registerTypes(const char *uri) = 0; + virtual void initializeEngine(QDeclarativeEngine *engine, const char *uri) = 0; }; Q_DECLARE_INTERFACE(QDeclarativeExtensionInterface, "com.trolltech.Qt.QDeclarativeExtensionInterface/1.0") diff --git a/src/declarative/qml/qdeclarativeextensionplugin.cpp b/src/declarative/qml/qdeclarativeextensionplugin.cpp index 6af3a6d..3d44d63 100644 --- a/src/declarative/qml/qdeclarativeextensionplugin.cpp +++ b/src/declarative/qml/qdeclarativeextensionplugin.cpp @@ -63,9 +63,9 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QDeclarativeExtensionPlugin::initialize(QDeclarativeEngine *engine) + \fn void QDeclarativeExtensionPlugin::registerTypes(const char *uri) - Initializes the extension specified in the given \a engine. + Registers the QML types in the given \a uri. */ /*! @@ -84,4 +84,16 @@ QDeclarativeExtensionPlugin::~QDeclarativeExtensionPlugin() { } +/*! + \fn void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) + + Initializes the extension specified in the given \a engine. +*/ + +void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) +{ + Q_UNUSED(engine); + Q_UNUSED(uri); +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeextensionplugin.h b/src/declarative/qml/qdeclarativeextensionplugin.h index 79df52b..c2ad798 100644 --- a/src/declarative/qml/qdeclarativeextensionplugin.h +++ b/src/declarative/qml/qdeclarativeextensionplugin.h @@ -62,7 +62,8 @@ public: explicit QDeclarativeExtensionPlugin(QObject *parent = 0); ~QDeclarativeExtensionPlugin(); - virtual void initialize(QDeclarativeEngine *engine, const char *uri) = 0; + virtual void registerTypes(const char *uri) = 0; + virtual void initializeEngine(QDeclarativeEngine *engine, const char *uri); }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeglobal_p.h b/src/declarative/qml/qdeclarativeglobal_p.h index bbdc91c..1041992 100644 --- a/src/declarative/qml/qdeclarativeglobal_p.h +++ b/src/declarative/qml/qdeclarativeglobal_p.h @@ -79,7 +79,7 @@ struct QDeclarativeGraphics_DerivedObject : public QObject neither \a parent nor the object's previous parent (if it had one) will receive ChildRemoved or ChildAdded events. */ -inline void QDeclarativeGraphics_setParent_noEvent(QObject *object, QObject *parent) +inline void QDeclarative_setParent_noEvent(QObject *object, QObject *parent) { static_cast<QDeclarativeGraphics_DerivedObject *>(object)->setParent_noEvent(parent); } diff --git a/src/declarative/qml/qdeclarativelist.cpp b/src/declarative/qml/qdeclarativelist.cpp index 4c9586c..9691f32 100644 --- a/src/declarative/qml/qdeclarativelist.cpp +++ b/src/declarative/qml/qdeclarativelist.cpp @@ -42,7 +42,7 @@ #include "qdeclarativelist.h" #include "qdeclarativelist_p.h" #include "qdeclarativeengine_p.h" -#include "qdeclarativemetaproperty_p.h" +#include "qdeclarativeproperty_p.h" QT_BEGIN_NAMESPACE @@ -85,18 +85,57 @@ void QDeclarativeListReferencePrivate::release() delete this; } +/*! +\class QDeclarativeListReference +\brief The QDeclarativeListReference class allows the manipulation of QDeclarativeListProperty properties. + +QDeclarativeListReference allows programs to read from, and assign values to a QML list property in a +simple and type safe way. A QDeclarativeListReference can be created by passing an object and property +name or through a QDeclarativeProperty instance. These two are equivalant: + +\code +QDeclarativeListReference ref1(object, "children"); + +QDeclarativeProperty ref2(object, "children"); +QDeclarativeListReference ref2 = qvariant_cast<QDeclarativeListReference>(ref2.read()); +\endcode + +Not all QML list properties support all operations. A set of methods, canAppend(), canAt(), canClear() and +canCount() allow programs to query whether an operation is supported on a given property. + +QML list properties are typesafe. Only QObject's that derive from the correct base class can be assigned to +the list. The listElementType() method can be used to query the QMetaObject of the QObject type supported. +Attempting to add objects of the incorrect type to a list property will fail. + +Like with normal lists, when accessing a list element by index, it is the callers responsibility to ensure +that it does not request an out of range element using the count() method before calling at(). +*/ + +/*! +Constructs an invalid instance. +*/ QDeclarativeListReference::QDeclarativeListReference() : d(0) { } -QDeclarativeListReference::QDeclarativeListReference(QObject *o, const char *property, QDeclarativeEngine *engine) +/*! +Constructs a QDeclarativeListReference for \a object's \a property. If \a property is not a list +property, an invalid QDeclarativeListReference is created. If \a object is destroyed after +the reference is constructed, it will automatically become invalid. That is, it is safe to hold +QDeclarativeListReference instances even after \a object is deleted. + +Passing \a engine is required to access some QML created list properties. If in doubt, and an engine +is available, pass it. +*/ +QDeclarativeListReference::QDeclarativeListReference(QObject *object, const char *property, QDeclarativeEngine *engine) : d(0) { - if (!o || !property) return; + if (!object || !property) return; QDeclarativePropertyCache::Data local; - QDeclarativePropertyCache::Data *data = QDeclarativePropertyCache::property(engine, o, QLatin1String(property), local); + QDeclarativePropertyCache::Data *data = + QDeclarativePropertyCache::property(engine, object, QLatin1String(property), local); if (!data || !(data->flags & QDeclarativePropertyCache::Data::IsQList)) return; @@ -106,20 +145,22 @@ QDeclarativeListReference::QDeclarativeListReference(QObject *o, const char *pro if (listType == -1) return; d = new QDeclarativeListReferencePrivate; - d->object = o; + d->object = object; d->elementType = p?p->rawMetaObjectForType(listType):QDeclarativeMetaType::qmlType(listType)->baseMetaObject(); d->propertyType = data->propType; void *args[] = { &d->property, 0 }; - QMetaObject::metacall(o, QMetaObject::ReadProperty, data->coreIndex, args); + QMetaObject::metacall(object, QMetaObject::ReadProperty, data->coreIndex, args); } +/*! \internal */ QDeclarativeListReference::QDeclarativeListReference(const QDeclarativeListReference &o) : d(o.d) { if (d) d->addref(); } +/*! \internal */ QDeclarativeListReference &QDeclarativeListReference::operator=(const QDeclarativeListReference &o) { if (o.d) o.d->addref(); @@ -128,60 +169,108 @@ QDeclarativeListReference &QDeclarativeListReference::operator=(const QDeclarati return *this; } +/*! \internal */ QDeclarativeListReference::~QDeclarativeListReference() { if (d) d->release(); } +/*! +Returns true if the instance refers to a valid list property, otherwise false. +*/ bool QDeclarativeListReference::isValid() const { return d && d->object; } +/*! +Returns the list property's object. Returns 0 if the reference is invalid. +*/ QObject *QDeclarativeListReference::object() const { if (isValid()) return d->object; else return 0; } +/*! +Returns the QMetaObject for the elements stored in the list property. Returns 0 if the reference +is invalid. + +The QMetaObject can be used ahead of time to determine whether a given instance can be added +to a list. +*/ const QMetaObject *QDeclarativeListReference::listElementType() const { if (isValid()) return d->elementType; else return 0; } +/*! +Returns true if the list property can be appended to, otherwise false. Returns false if the +reference is invalid. + +\sa append() +*/ bool QDeclarativeListReference::canAppend() const { return (isValid() && d->property.append); } +/*! +Returns true if the list property can queried by index, otherwise false. Returns false if the +reference is invalid. + +\sa at() +*/ bool QDeclarativeListReference::canAt() const { return (isValid() && d->property.at); } +/*! +Returns true if the list property can be cleared, otherwise false. Returns false if the +reference is invalid. + +\sa clear() +*/ bool QDeclarativeListReference::canClear() const { return (isValid() && d->property.clear); } +/*! +Returns true if the list property can be queried for its element count, otherwise false. +Returns false if the reference is invalid. + +\sa count() +*/ bool QDeclarativeListReference::canCount() const { return (isValid() && d->property.count); } -bool QDeclarativeListReference::append(QObject *o) const +/*! +Appends \a object to the list. Returns true if the operation succeeded, otherwise false. + +\sa canAppend() +*/ +bool QDeclarativeListReference::append(QObject *object) const { if (!canAppend()) return false; - if (o && !QDeclarativeMetaPropertyPrivate::canConvert(o->metaObject(), d->elementType)) + if (object && !QDeclarativePropertyPrivate::canConvert(object->metaObject(), d->elementType)) return false; - d->property.append(&d->property, o); + d->property.append(&d->property, object); return true; } +/*! +Returns the list element at \a index, or 0 if the operation failed. + +\sa canAt() +*/ QObject *QDeclarativeListReference::at(int index) const { if (!canAt()) return 0; @@ -189,6 +278,11 @@ QObject *QDeclarativeListReference::at(int index) const return d->property.at(&d->property, index); } +/*! +Clears the list. Returns true if the operation succeeded, otherwise false. + +\sa canClear() +*/ bool QDeclarativeListReference::clear() const { if (!canClear()) return false; @@ -198,6 +292,9 @@ bool QDeclarativeListReference::clear() const return true; } +/*! +Returns the number of objects in the list, or 0 if the operation failed. +*/ int QDeclarativeListReference::count() const { if (!canCount()) return 0; diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index e87f8ba..abbb9d6 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -619,7 +619,7 @@ QDeclarativeType *QDeclarativeMetaType::qmlType(const QByteArray &name, int vers QList<QDeclarativeType*> types = data->nameToType.values(name); foreach (QDeclarativeType *t, types) { - // XXX version_major<0 just a kludge for QDeclarativeMetaPropertyPrivate::initProperty + // XXX version_major<0 just a kludge for QDeclarativePropertyPrivate::initProperty if (version_major<0 || t->availableInVersion(version_major,version_minor)) return t; } diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 50fe5c0..542f417 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -338,7 +338,7 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, } } - QDeclarativeAbstractBinding *delBinding = QDeclarativeMetaPropertyPrivate::setBinding(obj, *lastData, 0); + QDeclarativeAbstractBinding *delBinding = QDeclarativePropertyPrivate::setBinding(obj, *lastData, 0); if (delBinding) delBinding->destroy(); @@ -348,7 +348,7 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, } else { // ### Can well known types be optimized? QVariant v = QDeclarativeScriptClass::toVariant(engine, value); - QDeclarativeMetaPropertyPrivate::write(obj, *lastData, v, evalContext); + QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext); } } diff --git a/src/declarative/qml/qdeclarativemetaproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index a976140..e1ec2cd 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qdeclarativemetaproperty.h" -#include "qdeclarativemetaproperty_p.h" +#include "qdeclarativeproperty.h" +#include "qdeclarativeproperty_p.h" #include "qdeclarativecompositetypedata_p.h" #include "qdeclarative.h" @@ -53,6 +53,7 @@ #include "qdeclarativedeclarativedata_p.h" #include "qdeclarativestringconverters_p.h" #include "qdeclarativelist_p.h" +#include "qdeclarativecompiler_p.h" #include <QStringList> #include <QtCore/qdebug.h> @@ -62,71 +63,102 @@ QT_BEGIN_NAMESPACE /*! - \class QDeclarativeMetaProperty - \brief The QDeclarativeMetaProperty class abstracts accessing QML properties. - \internal - */ +\class QDeclarativeProperty +\brief The QDeclarativeProperty class abstracts accessing properties on objects created from QML. + +As QML uses Qt's meta-type system all of the existing QMetaObject classes can be used to introspect +and interact with objects created by QML. However, some of the new features provided by QML - such +as type safety and attached properties - are most easily used through the QDeclarativeProperty class +that simplifies some of their natural complexity. + +Unlike QMetaProperty which represents a property on a class type, QDeclarativeProperty encapsulates +a property on a specific object instance. To read a property's value, programmers create a +QDeclarativeProperty instance and call the read() method. Likewise to write a property value the +write() method is used. + +\code + +QObject *object = declarativeComponent.create(); + +QDeclarativeProperty property(object, "font.pixelSize"); +qWarning() << "Current pixel size:" << property.read().toInt(); +property.write(24); +qWarning() << "Pixel size should now be 24:" << property.read().toInt(); + +\endcode +*/ /*! - Create an invalid QDeclarativeMetaProperty. + Create an invalid QDeclarativeProperty. */ -QDeclarativeMetaProperty::QDeclarativeMetaProperty() -: d(new QDeclarativeMetaPropertyPrivate) +QDeclarativeProperty::QDeclarativeProperty() +: d(new QDeclarativePropertyPrivate) { d->q = this; } /*! \internal */ -QDeclarativeMetaProperty::~QDeclarativeMetaProperty() +QDeclarativeProperty::~QDeclarativeProperty() { delete d; d = 0; } /*! - Creates a QDeclarativeMetaProperty for the default property of \a obj. If there is no - default property, an invalid QDeclarativeMetaProperty will be created. + Creates a QDeclarativeProperty for the default property of \a obj. If there is no + default property, an invalid QDeclarativeProperty will be created. */ -QDeclarativeMetaProperty::QDeclarativeMetaProperty(QObject *obj) -: d(new QDeclarativeMetaPropertyPrivate) +QDeclarativeProperty::QDeclarativeProperty(QObject *obj) +: d(new QDeclarativePropertyPrivate) { d->q = this; d->initDefault(obj); } /*! - \internal - Creates a QDeclarativeMetaProperty for the default property of \a obj. If there is no - default property, an invalid QDeclarativeMetaProperty will be created. + Creates a QDeclarativeProperty for the default property of \a obj. If there is no + default property, an invalid QDeclarativeProperty will be created. */ -QDeclarativeMetaProperty::QDeclarativeMetaProperty(QObject *obj, QDeclarativeContext *ctxt) -: d(new QDeclarativeMetaPropertyPrivate) +QDeclarativeProperty::QDeclarativeProperty(QObject *obj, QDeclarativeContext *ctxt) +: d(new QDeclarativePropertyPrivate) { d->q = this; d->context = ctxt; + d->engine = ctxt?ctxt->engine():0; + d->initDefault(obj); +} + +/*! + Creates a QDeclarativeProperty for the default property of \a obj. If there is no + default property, an invalid QDeclarativeProperty will be created. + */ +QDeclarativeProperty::QDeclarativeProperty(QObject *obj, QDeclarativeEngine *engine) +: d(new QDeclarativePropertyPrivate) +{ + d->q = this; + d->context = 0; + d->engine = engine; d->initDefault(obj); } /*! Initialize from the default property of \a obj */ -void QDeclarativeMetaPropertyPrivate::initDefault(QObject *obj) +void QDeclarativePropertyPrivate::initDefault(QObject *obj) { if (!obj) return; QMetaProperty p = QDeclarativeMetaType::defaultProperty(obj); core.load(p); - if (core.isValid()) { - isDefaultProperty = true; + if (core.isValid()) object = obj; - } } /*! - Creates a QDeclarativeMetaProperty for the property \a name of \a obj. + Creates a QDeclarativeProperty for the property \a name of \a obj. */ -QDeclarativeMetaProperty::QDeclarativeMetaProperty(QObject *obj, const QString &name) -: d(new QDeclarativeMetaPropertyPrivate) +QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name) +: d(new QDeclarativePropertyPrivate) { d->q = this; d->initProperty(obj, name); @@ -134,25 +166,37 @@ QDeclarativeMetaProperty::QDeclarativeMetaProperty(QObject *obj, const QString & } /*! - \internal - Creates a QDeclarativeMetaProperty for the property \a name of \a obj. + Creates a QDeclarativeProperty for the property \a name of \a obj. */ -QDeclarativeMetaProperty::QDeclarativeMetaProperty(QObject *obj, const QString &name, QDeclarativeContext *ctxt) -: d(new QDeclarativeMetaPropertyPrivate) +QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QDeclarativeContext *ctxt) +: d(new QDeclarativePropertyPrivate) { d->q = this; d->context = ctxt; + d->engine = ctxt?ctxt->engine():0; + d->initProperty(obj, name); + if (!isValid()) { d->object = 0; d->context = 0; d->engine = 0; } +} + +/*! + Creates a QDeclarativeProperty for the property \a name of \a obj. + */ +QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QDeclarativeEngine *engine) +: d(new QDeclarativePropertyPrivate) +{ + d->q = this; + d->context = 0; + d->engine = engine; d->initProperty(obj, name); - if (!isValid()) { d->object = 0; d->context = 0; } + if (!isValid()) { d->object = 0; d->context = 0; d->engine = 0; } } Q_GLOBAL_STATIC(QDeclarativeValueTypeFactory, qmlValueTypes); -void QDeclarativeMetaPropertyPrivate::initProperty(QObject *obj, const QString &name) +void QDeclarativePropertyPrivate::initProperty(QObject *obj, const QString &name) { if (!obj) return; - QDeclarativeEngine *engine = context?context->engine():0; QDeclarativeTypeNameCache *typeNameCache = context?QDeclarativeContextPrivate::get(context)->imports:0; QStringList path = name.split(QLatin1Char('.')); @@ -235,7 +279,7 @@ void QDeclarativeMetaPropertyPrivate::initProperty(QObject *obj, const QString & QString signalName = terminal.mid(2); signalName[0] = signalName.at(0).toLower(); - QMetaMethod method = findSignal(currentObject, signalName); + QMetaMethod method = QDeclarativeCompiler::findSignalByName(currentObject->metaObject(), signalName.toLatin1().constData()); if (method.signature()) { object = currentObject; core.load(method); @@ -246,7 +290,7 @@ void QDeclarativeMetaPropertyPrivate::initProperty(QObject *obj, const QString & // Property QDeclarativePropertyCache::Data local; QDeclarativePropertyCache::Data *property = - QDeclarativePropertyCache::property(context?context->engine():0, currentObject, terminal, local); + QDeclarativePropertyCache::property(engine, currentObject, terminal, local); if (property && !(property->flags & QDeclarativePropertyCache::Data::IsFunction)) { object = currentObject; core = *property; @@ -256,63 +300,62 @@ void QDeclarativeMetaPropertyPrivate::initProperty(QObject *obj, const QString & /*! Create a copy of \a other. */ -QDeclarativeMetaProperty::QDeclarativeMetaProperty(const QDeclarativeMetaProperty &other) -: d(new QDeclarativeMetaPropertyPrivate(*other.d)) +QDeclarativeProperty::QDeclarativeProperty(const QDeclarativeProperty &other) +: d(new QDeclarativePropertyPrivate(*other.d)) { d->q = this; } /*! - \enum QDeclarativeMetaProperty::PropertyTypeCategory + \enum QDeclarativeProperty::PropertyTypeCategory This enum specifies a category of QML property. - \value InvalidCategory The property is invalid. - \value List The property is a QList pointer + \value InvalidCategory The property is invalid, or is a signal property. + \value List The property is a QDeclarativeListProperty list property \value Object The property is a QObject derived type pointer - \value Normal The property is none of the above. + \value Normal The property is a normal value property. */ /*! - \enum QDeclarativeMetaProperty::Type + \enum QDeclarativeProperty::Type This enum specifies a type of QML property. \value Invalid The property is invalid. \value Property The property is a regular Qt property. \value SignalProperty The property is a signal property. - \value Default The property is the default property. */ /*! Returns the property category. */ -QDeclarativeMetaProperty::PropertyTypeCategory QDeclarativeMetaProperty::propertyTypeCategory() const +QDeclarativeProperty::PropertyTypeCategory QDeclarativeProperty::propertyTypeCategory() const { return d->propertyTypeCategory(); } -QDeclarativeMetaProperty::PropertyTypeCategory -QDeclarativeMetaPropertyPrivate::propertyTypeCategory() const +QDeclarativeProperty::PropertyTypeCategory +QDeclarativePropertyPrivate::propertyTypeCategory() const { uint type = q->type(); - if (type & QDeclarativeMetaProperty::ValueTypeProperty) { - return QDeclarativeMetaProperty::Normal; - } else if (type & QDeclarativeMetaProperty::Property) { + if (isValueType()) { + return QDeclarativeProperty::Normal; + } else if (type & QDeclarativeProperty::Property) { int type = propertyType(); if (type == QVariant::Invalid) - return QDeclarativeMetaProperty::InvalidCategory; + return QDeclarativeProperty::InvalidCategory; else if ((uint)type < QVariant::UserType) - return QDeclarativeMetaProperty::Normal; + return QDeclarativeProperty::Normal; else if (core.flags & QDeclarativePropertyCache::Data::IsQObjectDerived) - return QDeclarativeMetaProperty::Object; + return QDeclarativeProperty::Object; else if (core.flags & QDeclarativePropertyCache::Data::IsQList) - return QDeclarativeMetaProperty::List; + return QDeclarativeProperty::List; else - return QDeclarativeMetaProperty::Normal; + return QDeclarativeProperty::Normal; } else { - return QDeclarativeMetaProperty::InvalidCategory; + return QDeclarativeProperty::InvalidCategory; } } @@ -320,9 +363,9 @@ QDeclarativeMetaPropertyPrivate::propertyTypeCategory() const Returns the type name of the property, or 0 if the property has no type name. */ -const char *QDeclarativeMetaProperty::propertyTypeName() const +const char *QDeclarativeProperty::propertyTypeName() const { - if (type() & ValueTypeProperty) { + if (d->isValueType()) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(d->context); QDeclarativeValueType *valueType = 0; @@ -343,10 +386,10 @@ const char *QDeclarativeMetaProperty::propertyTypeName() const } /*! - Returns true if \a other and this QDeclarativeMetaProperty represent the same + Returns true if \a other and this QDeclarativeProperty represent the same property. */ -bool QDeclarativeMetaProperty::operator==(const QDeclarativeMetaProperty &other) const +bool QDeclarativeProperty::operator==(const QDeclarativeProperty &other) const { // category is intentially omitted here as it is generated // from the other members @@ -359,17 +402,22 @@ bool QDeclarativeMetaProperty::operator==(const QDeclarativeMetaProperty &other) Returns the QVariant type of the property, or QVariant::Invalid if the property has no QVariant type. */ -int QDeclarativeMetaProperty::propertyType() const +int QDeclarativeProperty::propertyType() const { return d->propertyType(); } -int QDeclarativeMetaPropertyPrivate::propertyType() const +bool QDeclarativePropertyPrivate::isValueType() const +{ + return valueType.valueTypeCoreIdx != -1; +} + +int QDeclarativePropertyPrivate::propertyType() const { uint type = q->type(); - if (type & QDeclarativeMetaProperty::ValueTypeProperty) { + if (isValueType()) { return valueType.valueTypePropType; - } else if (type & QDeclarativeMetaProperty::Property) { + } else if (type & QDeclarativeProperty::Property) { if (core.propType == (int)QVariant::LastType) return qMetaTypeId<QVariant>(); else @@ -382,51 +430,49 @@ int QDeclarativeMetaPropertyPrivate::propertyType() const /*! Returns the type of the property. */ -QDeclarativeMetaProperty::Type QDeclarativeMetaProperty::type() const +QDeclarativeProperty::Type QDeclarativeProperty::type() const { if (d->core.flags & QDeclarativePropertyCache::Data::IsFunction) return SignalProperty; - else if (d->valueType.valueTypeCoreIdx != -1) - return (Type)(Property | ValueTypeProperty); else if (d->core.isValid()) - return (Type)(Property | ((d->isDefaultProperty)?Default:0)); + return Property; else return Invalid; } /*! - Returns true if this QDeclarativeMetaProperty represents a regular Qt property. + Returns true if this QDeclarativeProperty represents a regular Qt property. */ -bool QDeclarativeMetaProperty::isProperty() const +bool QDeclarativeProperty::isProperty() const { return type() & Property; } /*! - Returns true if this QDeclarativeMetaProperty represents a default property. + Returns true if this QDeclarativeProperty represents a QML signal property. */ -bool QDeclarativeMetaProperty::isDefault() const +bool QDeclarativeProperty::isSignalProperty() const { - return type() & Default; + return type() & SignalProperty; } /*! - Returns the QDeclarativeMetaProperty's QObject. + Returns the QDeclarativeProperty's QObject. */ -QObject *QDeclarativeMetaProperty::object() const +QObject *QDeclarativeProperty::object() const { return d->object; } /*! - Assign \a other to this QDeclarativeMetaProperty. + Assign \a other to this QDeclarativeProperty. */ -QDeclarativeMetaProperty &QDeclarativeMetaProperty::operator=(const QDeclarativeMetaProperty &other) +QDeclarativeProperty &QDeclarativeProperty::operator=(const QDeclarativeProperty &other) { d->context = other.d->context; + d->engine = other.d->engine; d->object = other.d->object; - d->isDefaultProperty = other.d->isDefaultProperty; d->isNameCached = other.d->isNameCached; d->core = other.d->core; d->nameCache = other.d->nameCache; @@ -439,9 +485,9 @@ QDeclarativeMetaProperty &QDeclarativeMetaProperty::operator=(const QDeclarative /*! Returns true if the property is writable, otherwise false. */ -bool QDeclarativeMetaProperty::isWritable() const +bool QDeclarativeProperty::isWritable() const { - QDeclarativeMetaProperty::PropertyTypeCategory category = propertyTypeCategory(); + QDeclarativeProperty::PropertyTypeCategory category = propertyTypeCategory(); if (!d->object) return false; @@ -458,7 +504,7 @@ bool QDeclarativeMetaProperty::isWritable() const /*! Returns true if the property is designable, otherwise false. */ -bool QDeclarativeMetaProperty::isDesignable() const +bool QDeclarativeProperty::isDesignable() const { if (type() & Property && d->core.isValid() && d->object) return d->object->metaObject()->property(d->core.coreIndex).isDesignable(); @@ -469,7 +515,7 @@ bool QDeclarativeMetaProperty::isDesignable() const /*! Returns true if the property is resettable, otherwise false. */ -bool QDeclarativeMetaProperty::isResettable() const +bool QDeclarativeProperty::isResettable() const { if (type() & Property && d->core.isValid() && d->object) return d->core.flags & QDeclarativePropertyCache::Data::IsResettable; @@ -478,10 +524,10 @@ bool QDeclarativeMetaProperty::isResettable() const } /*! - Returns true if the QDeclarativeMetaProperty refers to a valid property, otherwise + Returns true if the QDeclarativeProperty refers to a valid property, otherwise false. */ -bool QDeclarativeMetaProperty::isValid() const +bool QDeclarativeProperty::isValid() const { return type() != Invalid; } @@ -489,15 +535,15 @@ bool QDeclarativeMetaProperty::isValid() const /*! Return the name of this QML property. */ -QString QDeclarativeMetaProperty::name() const +QString QDeclarativeProperty::name() const { if (!d->isNameCached) { // ### if (!d->object) { - } else if (type() & ValueTypeProperty) { + } else if (d->isValueType()) { QString rv = d->core.name(d->object) + QLatin1Char('.'); - QDeclarativeEnginePrivate *ep = d->context?QDeclarativeEnginePrivate::get(d->context->engine()):0; + QDeclarativeEnginePrivate *ep = d->engine?QDeclarativeEnginePrivate::get(d->engine):0; QDeclarativeValueType *valueType = 0; if (ep) valueType = ep->valueTypes[d->core.propType]; else valueType = QDeclarativeValueTypeFactory::valueType(d->core.propType); @@ -525,7 +571,7 @@ QString QDeclarativeMetaProperty::name() const Returns the \l{QMetaProperty} {Qt property} associated with this QML property. */ -QMetaProperty QDeclarativeMetaProperty::property() const +QMetaProperty QDeclarativeProperty::property() const { if (type() & Property && d->core.isValid() && d->object) return d->object->metaObject()->property(d->core.coreIndex); @@ -537,7 +583,7 @@ QMetaProperty QDeclarativeMetaProperty::property() const Return the QMetaMethod for this property if it is a SignalProperty, otherwise returns an invalid QMetaMethod. */ -QMetaMethod QDeclarativeMetaProperty::method() const +QMetaMethod QDeclarativeProperty::method() const { if (type() & SignalProperty && d->object) return d->object->metaObject()->method(d->core.coreIndex); @@ -551,7 +597,7 @@ QMetaMethod QDeclarativeMetaProperty::method() const exists. */ QDeclarativeAbstractBinding * -QDeclarativeMetaPropertyPrivate::binding(const QDeclarativeMetaProperty &that) +QDeclarativePropertyPrivate::binding(const QDeclarativeProperty &that) { if (!that.isProperty() || !that.d->object) return 0; @@ -587,7 +633,7 @@ QDeclarativeMetaPropertyPrivate::binding(const QDeclarativeMetaProperty &that) the binding sets the intial value, it will use these flags for the write). */ QDeclarativeAbstractBinding * -QDeclarativeMetaPropertyPrivate::setBinding(const QDeclarativeMetaProperty &that, +QDeclarativePropertyPrivate::setBinding(const QDeclarativeProperty &that, QDeclarativeAbstractBinding *newBinding, WriteFlags flags) { @@ -601,7 +647,7 @@ QDeclarativeMetaPropertyPrivate::setBinding(const QDeclarativeMetaProperty &that } QDeclarativeAbstractBinding * -QDeclarativeMetaPropertyPrivate::setBinding(QObject *object, const QDeclarativePropertyCache::Data &core, +QDeclarativePropertyPrivate::setBinding(QObject *object, const QDeclarativePropertyCache::Data &core, QDeclarativeAbstractBinding *newBinding, WriteFlags flags) { QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(object, 0 != newBinding); @@ -634,9 +680,9 @@ QDeclarativeMetaPropertyPrivate::setBinding(QObject *object, const QDeclarativeP signal expression exists. */ QDeclarativeExpression * -QDeclarativeMetaPropertyPrivate::signalExpression(const QDeclarativeMetaProperty &that) +QDeclarativePropertyPrivate::signalExpression(const QDeclarativeProperty &that) { - if (!(that.type() & QDeclarativeMetaProperty::SignalProperty)) + if (!(that.type() & QDeclarativeProperty::SignalProperty)) return 0; const QObjectList &children = that.d->object->children(); @@ -645,7 +691,7 @@ QDeclarativeMetaPropertyPrivate::signalExpression(const QDeclarativeMetaProperty QObject *child = children.at(ii); QDeclarativeBoundSignal *signal = QDeclarativeBoundSignal::cast(child); - if (signal && signal->index() == that.coreIndex()) + if (signal && signal->index() == that.index()) return signal->expression(); } @@ -660,10 +706,10 @@ QDeclarativeMetaPropertyPrivate::signalExpression(const QDeclarativeMetaProperty assumed by the caller. */ QDeclarativeExpression * -QDeclarativeMetaPropertyPrivate::setSignalExpression(const QDeclarativeMetaProperty &that, +QDeclarativePropertyPrivate::setSignalExpression(const QDeclarativeProperty &that, QDeclarativeExpression *expr) { - if (!(that.type() & QDeclarativeMetaProperty::SignalProperty)) { + if (!(that.type() & QDeclarativeProperty::SignalProperty)) { delete expr; return 0; } @@ -674,7 +720,7 @@ QDeclarativeMetaPropertyPrivate::setSignalExpression(const QDeclarativeMetaPrope QObject *child = children.at(ii); QDeclarativeBoundSignal *signal = QDeclarativeBoundSignal::cast(child); - if (signal && signal->index() == that.coreIndex()) + if (signal && signal->index() == that.index()) return signal->setExpression(expr); } @@ -686,27 +732,10 @@ QDeclarativeMetaPropertyPrivate::setSignalExpression(const QDeclarativeMetaPrope } } -QMetaMethod QDeclarativeMetaPropertyPrivate::findSignal(QObject *obj, const QString &name) -{ - const QMetaObject *mo = obj->metaObject(); - - int methods = mo->methodCount(); - for (int ii = methods - 1; ii >= 0; --ii) { - QMetaMethod method = mo->method(ii); - QString methodName = QString::fromUtf8(method.signature()); - int idx = methodName.indexOf(QLatin1Char('(')); - methodName = methodName.left(idx); - - if (methodName == name) - return method; - } - return QMetaMethod(); -} - /*! Returns the property value. */ -QVariant QDeclarativeMetaProperty::read() const +QVariant QDeclarativeProperty::read() const { if (!d->object) return QVariant(); @@ -723,10 +752,48 @@ QVariant QDeclarativeMetaProperty::read() const return QVariant(); } -QVariant QDeclarativeMetaPropertyPrivate::readValueProperty() +/*! +Return the \a name property value of \a object. This method is equivalent to: +\code + QDeclarativeProperty p(object, name); + p.read(); +\endcode +*/ +QVariant QDeclarativeProperty::read(QObject *object, const QString &name) { - uint type = q->type(); - if(type & QDeclarativeMetaProperty::ValueTypeProperty) { + QDeclarativeProperty p(object, name); + return p.read(); +} + +/*! +Return the \a name property value of \a object. This method is equivalent to: +\code + QDeclarativeProperty p(object, name, context); + p.read(); +\endcode +*/ +QVariant QDeclarativeProperty::read(QObject *object, const QString &name, QDeclarativeContext *ctxt) +{ + QDeclarativeProperty p(object, name, ctxt); + return p.read(); +} + +/*! +Return the \a name property value of \a object. This method is equivalent to: +\code + QDeclarativeProperty p(object, name, engine); + p.read(); +\endcode +*/ +QVariant QDeclarativeProperty::read(QObject *object, const QString &name, QDeclarativeEngine *engine) +{ + QDeclarativeProperty p(object, name, engine); + return p.read(); +} + +QVariant QDeclarativePropertyPrivate::readValueProperty() +{ + if(isValueType()) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context); QDeclarativeValueType *valueType = 0; @@ -747,7 +814,7 @@ QVariant QDeclarativeMetaPropertyPrivate::readValueProperty() QDeclarativeListProperty<QObject> prop; void *args[] = { &prop, 0 }; QMetaObject::metacall(object, QMetaObject::ReadProperty, core.coreIndex, args); - return QVariant::fromValue(QDeclarativeListReferencePrivate::init(prop, core.propType, context?context->engine():0)); + return QVariant::fromValue(QDeclarativeListReferencePrivate::init(prop, core.propType, engine)); } else { @@ -756,10 +823,8 @@ QVariant QDeclarativeMetaPropertyPrivate::readValueProperty() } } -//### //writeEnumProperty MIRRORS the relelvant bit of QMetaProperty::write AND MUST BE KEPT IN SYNC! -//### -bool QDeclarativeMetaPropertyPrivate::writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object, const QVariant &value, int flags) +bool QDeclarativePropertyPrivate::writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object, const QVariant &value, int flags) { if (!object || !prop.isWritable()) return false; @@ -796,7 +861,7 @@ bool QDeclarativeMetaPropertyPrivate::writeEnumProperty(const QMetaProperty &pro return status; } -bool QDeclarativeMetaPropertyPrivate::writeValueProperty(const QVariant &value, WriteFlags flags) +bool QDeclarativePropertyPrivate::writeValueProperty(const QVariant &value, WriteFlags flags) { // Remove any existing bindings on this property if (!(flags & DontRemoveBinding)) { @@ -805,8 +870,7 @@ bool QDeclarativeMetaPropertyPrivate::writeValueProperty(const QVariant &value, } bool rv = false; - uint type = q->type(); - if (type & QDeclarativeMetaProperty::ValueTypeProperty) { + if (isValueType()) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context); QDeclarativeValueType *writeBack = 0; @@ -836,7 +900,7 @@ bool QDeclarativeMetaPropertyPrivate::writeValueProperty(const QVariant &value, return rv; } -bool QDeclarativeMetaPropertyPrivate::write(QObject *object, const QDeclarativePropertyCache::Data &property, +bool QDeclarativePropertyPrivate::write(QObject *object, const QDeclarativePropertyCache::Data &property, const QVariant &value, QDeclarativeContext *context, WriteFlags flags) { @@ -947,13 +1011,13 @@ bool QDeclarativeMetaPropertyPrivate::write(QObject *object, const QDeclarativeP for (int ii = 0; ii < list.count(); ++ii) { QObject *o = list.at(ii); - if (!canConvert(o->metaObject(), listType)) + if (o && !canConvert(o->metaObject(), listType)) o = 0; prop.append(&prop, (void *)o); } } else { QObject *o = enginePriv?enginePriv->toQObject(value):QDeclarativeMetaType::toQObject(value); - if (!canConvert(o->metaObject(), listType)) + if (o && !canConvert(o->metaObject(), listType)) o = 0; prop.append(&prop, (void *)o); } @@ -991,7 +1055,7 @@ bool QDeclarativeMetaPropertyPrivate::write(QObject *object, const QDeclarativeP return true; } -const QMetaObject *QDeclarativeMetaPropertyPrivate::rawMetaObjectForType(QDeclarativeEnginePrivate *engine, int userType) +const QMetaObject *QDeclarativePropertyPrivate::rawMetaObjectForType(QDeclarativeEnginePrivate *engine, int userType) { if (engine) { return engine->rawMetaObjectForType(userType); @@ -1004,15 +1068,56 @@ const QMetaObject *QDeclarativeMetaPropertyPrivate::rawMetaObjectForType(QDeclar /*! Set the property value to \a value. */ -bool QDeclarativeMetaProperty::write(const QVariant &value) const +bool QDeclarativeProperty::write(const QVariant &value) const { - return QDeclarativeMetaPropertyPrivate::write(*this, value, 0); + return QDeclarativePropertyPrivate::write(*this, value, 0); +} + +/*! +Writes \a value to the \a name property of \a object. This method is equivalent to: +\code + QDeclarativeProperty p(object, name); + p.write(value); +\endcode +*/ +bool QDeclarativeProperty::write(QObject *object, const QString &name, const QVariant &value) +{ + QDeclarativeProperty p(object, name); + return p.write(value); +} + +/*! +Writes \a value to the \a name property of \a object. This method is equivalent to: +\code + QDeclarativeProperty p(object, name, ctxt); + p.write(value); +\endcode +*/ +bool QDeclarativeProperty::write(QObject *object, const QString &name, const QVariant &value, + QDeclarativeContext *ctxt) +{ + QDeclarativeProperty p(object, name, ctxt); + return p.write(value); +} + +/*! +Writes \a value to the \a name property of \a object. This method is equivalent to: +\code + QDeclarativeProperty p(object, name, engine); + p.write(value); +\endcode +*/ +bool QDeclarativeProperty::write(QObject *object, const QString &name, const QVariant &value, + QDeclarativeEngine *engine) +{ + QDeclarativeProperty p(object, name, engine); + return p.write(value); } /*! Resets the property value. */ -bool QDeclarativeMetaProperty::reset() const +bool QDeclarativeProperty::reset() const { if (isResettable()) { void *args[] = { 0 }; @@ -1023,10 +1128,10 @@ bool QDeclarativeMetaProperty::reset() const } } -bool QDeclarativeMetaPropertyPrivate::write(const QDeclarativeMetaProperty &that, +bool QDeclarativePropertyPrivate::write(const QDeclarativeProperty &that, const QVariant &value, WriteFlags flags) { - if (that.d->object && that.type() & QDeclarativeMetaProperty::Property && + if (that.d->object && that.type() & QDeclarativeProperty::Property && that.d->core.isValid() && that.isWritable()) return that.d->writeValueProperty(value, flags); else @@ -1036,7 +1141,7 @@ bool QDeclarativeMetaPropertyPrivate::write(const QDeclarativeMetaProperty &that /*! Returns true if the property has a change notifier signal, otherwise false. */ -bool QDeclarativeMetaProperty::hasChangedNotifier() const +bool QDeclarativeProperty::hasNotifySignal() const { if (type() & Property && d->object) { return d->object->metaObject()->property(d->core.coreIndex).hasNotifySignal(); @@ -1051,7 +1156,7 @@ bool QDeclarativeMetaProperty::hasChangedNotifier() const Some properties, such as attached properties or those whose value never changes, do not require a change notifier. */ -bool QDeclarativeMetaProperty::needsChangedNotifier() const +bool QDeclarativeProperty::needsNotifySignal() const { return type() & Property && !property().isConstant(); } @@ -1064,7 +1169,7 @@ bool QDeclarativeMetaProperty::needsChangedNotifier() const change notifier signal, or if the \a dest object does not have the specified \a method. */ -bool QDeclarativeMetaProperty::connectNotifier(QObject *dest, int method) const +bool QDeclarativeProperty::connectNotifySignal(QObject *dest, int method) const { if (!(type() & Property) || !d->object) return false; @@ -1085,7 +1190,7 @@ bool QDeclarativeMetaProperty::connectNotifier(QObject *dest, int method) const change notifier signal, or if the \a dest object does not have the specified \a slot. */ -bool QDeclarativeMetaProperty::connectNotifier(QObject *dest, const char *slot) const +bool QDeclarativeProperty::connectNotifySignal(QObject *dest, const char *slot) const { if (!(type() & Property) || !d->object) return false; @@ -1102,18 +1207,18 @@ bool QDeclarativeMetaProperty::connectNotifier(QObject *dest, const char *slot) /*! Return the Qt metaobject index of the property. */ -int QDeclarativeMetaProperty::coreIndex() const +int QDeclarativeProperty::index() const { return d->core.coreIndex; } -int QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(const QDeclarativeMetaProperty &that) +int QDeclarativePropertyPrivate::valueTypeCoreIndex(const QDeclarativeProperty &that) { return that.d->valueType.valueTypeCoreIdx; } struct SerializedData { - QDeclarativeMetaProperty::Type type; + bool isValueType; QDeclarativePropertyCache::Data core; }; @@ -1121,14 +1226,14 @@ struct ValueTypeSerializedData : public SerializedData { QDeclarativePropertyCache::ValueTypeData valueType; }; -QByteArray QDeclarativeMetaPropertyPrivate::saveValueType(const QMetaObject *metaObject, int index, +QByteArray QDeclarativePropertyPrivate::saveValueType(const QMetaObject *metaObject, int index, const QMetaObject *subObject, int subIndex) { QMetaProperty prop = metaObject->property(index); QMetaProperty subProp = subObject->property(subIndex); ValueTypeSerializedData sd; - sd.type = QDeclarativeMetaProperty::ValueTypeProperty; + sd.isValueType = true; sd.core.load(metaObject->property(index)); sd.valueType.flags = QDeclarativePropertyCache::Data::flagsForProperty(subProp); sd.valueType.valueTypeCoreIdx = subIndex; @@ -1139,34 +1244,35 @@ QByteArray QDeclarativeMetaPropertyPrivate::saveValueType(const QMetaObject *met return rv; } -QByteArray QDeclarativeMetaPropertyPrivate::saveProperty(const QMetaObject *metaObject, int index) +QByteArray QDeclarativePropertyPrivate::saveProperty(const QMetaObject *metaObject, int index) { SerializedData sd; - sd.type = QDeclarativeMetaProperty::Property; + sd.isValueType = false; sd.core.load(metaObject->property(index)); QByteArray rv((const char *)&sd, sizeof(sd)); return rv; } -QDeclarativeMetaProperty -QDeclarativeMetaPropertyPrivate::restore(const QByteArray &data, QObject *object, QDeclarativeContext *ctxt) +QDeclarativeProperty +QDeclarativePropertyPrivate::restore(const QByteArray &data, QObject *object, QDeclarativeContext *ctxt) { - QDeclarativeMetaProperty prop; + QDeclarativeProperty prop; if (data.isEmpty()) return prop; prop.d->object = object; prop.d->context = ctxt; + prop.d->engine = ctxt?ctxt->engine():0; const SerializedData *sd = (const SerializedData *)data.constData(); - if (sd->type == QDeclarativeMetaProperty::Property) { - prop.d->core = sd->core; - } else if(sd->type == QDeclarativeMetaProperty::ValueTypeProperty) { + if (sd->isValueType) { const ValueTypeSerializedData *vt = (const ValueTypeSerializedData *)sd; prop.d->core = vt->core; prop.d->valueType = vt->valueType; + } else { + prop.d->core = sd->core; } return prop; @@ -1175,7 +1281,7 @@ QDeclarativeMetaPropertyPrivate::restore(const QByteArray &data, QObject *object /*! Returns true if lhs and rhs refer to the same metaobject data */ -bool QDeclarativeMetaPropertyPrivate::equal(const QMetaObject *lhs, const QMetaObject *rhs) +bool QDeclarativePropertyPrivate::equal(const QMetaObject *lhs, const QMetaObject *rhs) { return lhs == rhs || (1 && lhs && rhs && lhs->d.stringdata == rhs->d.stringdata); } @@ -1183,7 +1289,7 @@ bool QDeclarativeMetaPropertyPrivate::equal(const QMetaObject *lhs, const QMetaO /*! Returns true if from inherits to. */ -bool QDeclarativeMetaPropertyPrivate::canConvert(const QMetaObject *from, const QMetaObject *to) +bool QDeclarativePropertyPrivate::canConvert(const QMetaObject *from, const QMetaObject *to) { if (from && to == &QObject::staticMetaObject) return true; diff --git a/src/declarative/qml/qdeclarativemetaproperty.h b/src/declarative/qml/qdeclarativeproperty.h index 828749f..73bccf3 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.h +++ b/src/declarative/qml/qdeclarativeproperty.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QDECLARATIVEMETAPROPERTY_H -#define QDECLARATIVEMETAPROPERTY_H +#ifndef QDECLARATIVEPROPERTY_H +#define QDECLARATIVEPROPERTY_H #include <QtCore/qmetaobject.h> @@ -51,16 +51,12 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QObject; -class QDeclarativeAbstractBinding; -class QDeclarativeExpression; -class QStringList; class QVariant; -struct QMetaObject; class QDeclarativeContext; class QDeclarativeEngine; -class QDeclarativeMetaPropertyPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeMetaProperty +class QDeclarativePropertyPrivate; +class Q_DECLARATIVE_EXPORT QDeclarativeProperty { public: enum PropertyTypeCategory { @@ -70,64 +66,73 @@ public: Normal }; - enum Type { Invalid = 0x00, - Property = 0x01, - SignalProperty = 0x02, - Default = 0x08, - ValueTypeProperty = 0x10 + enum Type { + Invalid, + Property, + SignalProperty }; - QDeclarativeMetaProperty(); - ~QDeclarativeMetaProperty(); + QDeclarativeProperty(); + ~QDeclarativeProperty(); - QDeclarativeMetaProperty(QObject *); - QDeclarativeMetaProperty(QObject *, QDeclarativeContext *); + QDeclarativeProperty(QObject *); + QDeclarativeProperty(QObject *, QDeclarativeContext *); + QDeclarativeProperty(QObject *, QDeclarativeEngine *); - QDeclarativeMetaProperty(QObject *, const QString &); - QDeclarativeMetaProperty(QObject *, const QString &, QDeclarativeContext *); + QDeclarativeProperty(QObject *, const QString &); + QDeclarativeProperty(QObject *, const QString &, QDeclarativeContext *); + QDeclarativeProperty(QObject *, const QString &, QDeclarativeEngine *); - QDeclarativeMetaProperty(const QDeclarativeMetaProperty &); - QDeclarativeMetaProperty &operator=(const QDeclarativeMetaProperty &); + QDeclarativeProperty(const QDeclarativeProperty &); + QDeclarativeProperty &operator=(const QDeclarativeProperty &); + + bool operator==(const QDeclarativeProperty &) const; + + Type type() const; + bool isValid() const; + bool isProperty() const; + bool isSignalProperty() const; + + int propertyType() const; + PropertyTypeCategory propertyTypeCategory() const; + const char *propertyTypeName() const; QString name() const; QVariant read() const; + static QVariant read(QObject *, const QString &); + static QVariant read(QObject *, const QString &, QDeclarativeContext *); + static QVariant read(QObject *, const QString &, QDeclarativeEngine *); + bool write(const QVariant &) const; + static bool write(QObject *, const QString &, const QVariant &); + static bool write(QObject *, const QString &, const QVariant &, QDeclarativeContext *); + static bool write(QObject *, const QString &, const QVariant &, QDeclarativeEngine *); + bool reset() const; - bool hasChangedNotifier() const; - bool needsChangedNotifier() const; - bool connectNotifier(QObject *dest, const char *slot) const; - bool connectNotifier(QObject *dest, int method) const; + bool hasNotifySignal() const; + bool needsNotifySignal() const; + bool connectNotifySignal(QObject *dest, const char *slot) const; + bool connectNotifySignal(QObject *dest, int method) const; - Type type() const; - bool isProperty() const; - bool isDefault() const; bool isWritable() const; bool isDesignable() const; bool isResettable() const; - bool isValid() const; QObject *object() const; - int propertyType() const; - PropertyTypeCategory propertyTypeCategory() const; - const char *propertyTypeName() const; - - bool operator==(const QDeclarativeMetaProperty &) const; - - int coreIndex() const; + int index() const; QMetaProperty property() const; QMetaMethod method() const; private: - friend class QDeclarativeEnginePrivate; - friend class QDeclarativeMetaPropertyPrivate; - QDeclarativeMetaPropertyPrivate *d; + friend class QDeclarativePropertyPrivate; + QDeclarativePropertyPrivate *d; }; -typedef QList<QDeclarativeMetaProperty> QDeclarativeMetaProperties; +typedef QList<QDeclarativeProperty> QDeclarativeProperties; QT_END_NAMESPACE QT_END_HEADER -#endif // QDECLARATIVEMETAPROPERTY_H +#endif // QDECLARATIVEPROPERTY_H diff --git a/src/declarative/qml/qdeclarativemetaproperty_p.h b/src/declarative/qml/qdeclarativeproperty_p.h index a171545..1fda7f4 100644 --- a/src/declarative/qml/qdeclarativemetaproperty_p.h +++ b/src/declarative/qml/qdeclarativeproperty_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QDECLARATIVEMETAPROPERTY_P_H -#define QDECLARATIVEMETAPROPERTY_P_H +#ifndef QDECLARATIVEPROPERTY_P_H +#define QDECLARATIVEPROPERTY_P_H // // W A R N I N G @@ -53,7 +53,7 @@ // We mean it. // -#include "qdeclarativemetaproperty.h" +#include "qdeclarativeproperty.h" #include "qdeclarativepropertycache_p.h" #include "qdeclarativeguard_p.h" @@ -64,27 +64,28 @@ QT_BEGIN_NAMESPACE class QDeclarativeContext; class QDeclarativeEnginePrivate; -class Q_AUTOTEST_EXPORT QDeclarativeMetaPropertyPrivate +class QDeclarativeExpression; +class Q_AUTOTEST_EXPORT QDeclarativePropertyPrivate { public: enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02 }; Q_DECLARE_FLAGS(WriteFlags, WriteFlag) - QDeclarativeMetaPropertyPrivate() - : q(0), context(0), object(0), isDefaultProperty(false), isNameCached(false) {} + QDeclarativePropertyPrivate() + : q(0), context(0), engine(0), object(0), isNameCached(false) {} - QDeclarativeMetaPropertyPrivate(const QDeclarativeMetaPropertyPrivate &other) - : q(0), context(other.context), object(other.object), - isDefaultProperty(other.isDefaultProperty), isNameCached(other.isNameCached), + QDeclarativePropertyPrivate(const QDeclarativePropertyPrivate &other) + : q(0), context(other.context), engine(other.engine), object(other.object), + isNameCached(other.isNameCached), core(other.core), nameCache(other.nameCache), valueType(other.valueType) {} - QDeclarativeMetaProperty *q; + QDeclarativeProperty *q; QDeclarativeContext *context; + QDeclarativeEngine *engine; QDeclarativeGuard<QObject> object; - bool isDefaultProperty:1; bool isNameCached:1; QDeclarativePropertyCache::Data core; QString nameCache; @@ -97,8 +98,9 @@ public: QMetaMethod findSignal(QObject *, const QString &); + bool isValueType() const; int propertyType() const; - QDeclarativeMetaProperty::PropertyTypeCategory propertyTypeCategory() const; + QDeclarativeProperty::PropertyTypeCategory propertyTypeCategory() const; QVariant readValueProperty(); bool writeValueProperty(const QVariant &, WriteFlags); @@ -115,26 +117,26 @@ public: static QByteArray saveValueType(const QMetaObject *, int, const QMetaObject *, int); static QByteArray saveProperty(const QMetaObject *, int); - static QDeclarativeMetaProperty restore(const QByteArray &, QObject *, QDeclarativeContext *); + static QDeclarativeProperty restore(const QByteArray &, QObject *, QDeclarativeContext *); static bool equal(const QMetaObject *, const QMetaObject *); static bool canConvert(const QMetaObject *from, const QMetaObject *to); // "Public" (to QML) methods - static QDeclarativeAbstractBinding *binding(const QDeclarativeMetaProperty &that); - static QDeclarativeAbstractBinding *setBinding(const QDeclarativeMetaProperty &that, + static QDeclarativeAbstractBinding *binding(const QDeclarativeProperty &that); + static QDeclarativeAbstractBinding *setBinding(const QDeclarativeProperty &that, QDeclarativeAbstractBinding *, WriteFlags flags = DontRemoveBinding); - static QDeclarativeExpression *signalExpression(const QDeclarativeMetaProperty &that); - static QDeclarativeExpression *setSignalExpression(const QDeclarativeMetaProperty &that, + static QDeclarativeExpression *signalExpression(const QDeclarativeProperty &that); + static QDeclarativeExpression *setSignalExpression(const QDeclarativeProperty &that, QDeclarativeExpression *) ; - static bool write(const QDeclarativeMetaProperty &that, const QVariant &, WriteFlags); - static int valueTypeCoreIndex(const QDeclarativeMetaProperty &that); + static bool write(const QDeclarativeProperty &that, const QVariant &, WriteFlags); + static int valueTypeCoreIndex(const QDeclarativeProperty &that); }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeMetaPropertyPrivate::WriteFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePropertyPrivate::WriteFlags) QT_END_NAMESPACE -#endif // QDECLARATIVEMETAPROPERTY_P_H +#endif // QDECLARATIVEPROPERTY_P_H diff --git a/src/declarative/qml/qdeclarativepropertyvalueinterceptor.cpp b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.cpp index 7626d56..3f6d805 100644 --- a/src/declarative/qml/qdeclarativepropertyvalueinterceptor.cpp +++ b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.cpp @@ -66,7 +66,7 @@ QDeclarativePropertyValueInterceptor::~QDeclarativePropertyValueInterceptor() } /*! - \fn void QDeclarativePropertyValueInterceptor::setTarget(const QDeclarativeMetaProperty &property) + \fn void QDeclarativePropertyValueInterceptor::setTarget(const QDeclarativeProperty &property) Set the target \a property for the value interceptor. This method will be called by the QML engine when assigning a value interceptor. */ diff --git a/src/declarative/qml/qdeclarativepropertyvalueinterceptor.h b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.h index 2a29d5b..3de5abc 100644 --- a/src/declarative/qml/qdeclarativepropertyvalueinterceptor.h +++ b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.h @@ -50,13 +50,13 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeMetaProperty; +class QDeclarativeProperty; class Q_DECLARATIVE_EXPORT QDeclarativePropertyValueInterceptor { public: QDeclarativePropertyValueInterceptor(); virtual ~QDeclarativePropertyValueInterceptor(); - virtual void setTarget(const QDeclarativeMetaProperty &property) = 0; + virtual void setTarget(const QDeclarativeProperty &property) = 0; virtual void write(const QVariant &value) = 0; }; Q_DECLARE_INTERFACE(QDeclarativePropertyValueInterceptor, "com.trolltech.qml.QDeclarativePropertyValueInterceptor") diff --git a/src/declarative/qml/qdeclarativepropertyvaluesource.cpp b/src/declarative/qml/qdeclarativepropertyvaluesource.cpp index 626e391..b106d4f 100644 --- a/src/declarative/qml/qdeclarativepropertyvaluesource.cpp +++ b/src/declarative/qml/qdeclarativepropertyvaluesource.cpp @@ -63,7 +63,7 @@ QDeclarativePropertyValueSource::~QDeclarativePropertyValueSource() } /*! - \fn void QDeclarativePropertyValueSource::setTarget(const QDeclarativeMetaProperty &property) + \fn void QDeclarativePropertyValueSource::setTarget(const QDeclarativeProperty &property) Set the target \a property for the value source. This method will be called by the QML engine when assigning a value source. */ diff --git a/src/declarative/qml/qdeclarativepropertyvaluesource.h b/src/declarative/qml/qdeclarativepropertyvaluesource.h index 99c80af..70d2c03 100644 --- a/src/declarative/qml/qdeclarativepropertyvaluesource.h +++ b/src/declarative/qml/qdeclarativepropertyvaluesource.h @@ -50,13 +50,13 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeMetaProperty; +class QDeclarativeProperty; class Q_DECLARATIVE_EXPORT QDeclarativePropertyValueSource { public: QDeclarativePropertyValueSource(); virtual ~QDeclarativePropertyValueSource(); - virtual void setTarget(const QDeclarativeMetaProperty &) = 0; + virtual void setTarget(const QDeclarativeProperty &) = 0; }; Q_DECLARE_INTERFACE(QDeclarativePropertyValueSource, "com.trolltech.qml.QDeclarativePropertyValueSource") diff --git a/src/declarative/qml/qdeclarativescript.cpp b/src/declarative/qml/qdeclarativescript.cpp index acfb9e1..ac4b2c1 100644 --- a/src/declarative/qml/qdeclarativescript.cpp +++ b/src/declarative/qml/qdeclarativescript.cpp @@ -43,6 +43,7 @@ /*! \qmlclass Script QDeclarativeScript + \since 4.7 \brief The Script element provides a way to add JavaScript code snippets in QML. \ingroup group_utility diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp index d35371f..01fa214 100644 --- a/src/declarative/qml/qdeclarativevaluetype.cpp +++ b/src/declarative/qml/qdeclarativevaluetype.cpp @@ -100,7 +100,7 @@ void QDeclarativePointFValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativePointFValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativePointFValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &point, 0, &status, &flags }; @@ -148,7 +148,7 @@ void QDeclarativePointValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativePointValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativePointValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &point, 0, &status, &flags }; @@ -196,7 +196,7 @@ void QDeclarativeSizeFValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeSizeFValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativeSizeFValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &size, 0, &status, &flags }; @@ -244,7 +244,7 @@ void QDeclarativeSizeValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeSizeValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativeSizeValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &size, 0, &status, &flags }; @@ -292,7 +292,7 @@ void QDeclarativeRectFValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeRectFValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativeRectFValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &rect, 0, &status, &flags }; @@ -360,7 +360,7 @@ void QDeclarativeRectValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeRectValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativeRectValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &rect, 0, &status, &flags }; @@ -428,7 +428,7 @@ void QDeclarativeVector3DValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeVector3DValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativeVector3DValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &vector, 0, &status, &flags }; @@ -486,7 +486,7 @@ void QDeclarativeEasingValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeEasingValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativeEasingValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &easing, 0, &status, &flags }; @@ -554,7 +554,7 @@ void QDeclarativeFontValueType::read(QObject *obj, int idx) QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } -void QDeclarativeFontValueType::write(QObject *obj, int idx, QDeclarativeMetaPropertyPrivate::WriteFlags flags) +void QDeclarativeFontValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags) { int status = -1; void *a[] = { &font, 0, &status, &flags }; diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h index 792598b..cb153be 100644 --- a/src/declarative/qml/qdeclarativevaluetype_p.h +++ b/src/declarative/qml/qdeclarativevaluetype_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "qdeclarativemetaproperty.h" -#include "qdeclarativemetaproperty_p.h" +#include "qdeclarativeproperty.h" +#include "qdeclarativeproperty_p.h" #include <QtCore/qobject.h> #include <QtCore/qrect.h> @@ -71,7 +71,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeValueType : public QObject public: QDeclarativeValueType(QObject *parent = 0); virtual void read(QObject *, int) = 0; - virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags flags) = 0; + virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags flags) = 0; virtual QVariant value() = 0; virtual void setValue(QVariant) = 0; }; @@ -96,7 +96,7 @@ public: QDeclarativePointFValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); + virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -118,7 +118,7 @@ public: QDeclarativePointValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); + virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -140,7 +140,7 @@ public: QDeclarativeSizeFValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); + virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -162,7 +162,7 @@ public: QDeclarativeSizeValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); + virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -186,7 +186,7 @@ public: QDeclarativeRectFValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); + virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -215,7 +215,7 @@ public: QDeclarativeRectValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); + virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -243,7 +243,7 @@ public: QDeclarativeVector3DValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); + virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -297,7 +297,7 @@ public: QDeclarativeEasingValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); + virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); @@ -348,7 +348,7 @@ public: QDeclarativeFontValueType(QObject *parent = 0); virtual void read(QObject *, int); - virtual void write(QObject *, int, QDeclarativeMetaPropertyPrivate::WriteFlags); + virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags); virtual QVariant value(); virtual void setValue(QVariant value); diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index f7af843..fc3722d 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -156,7 +156,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati QDeclarativeContextPrivate *cp = (QDeclarativeContextPrivate *)QObjectPrivate::get(ctxt); int status = -1; //for dbus - QDeclarativeMetaPropertyPrivate::WriteFlags flags = QDeclarativeMetaPropertyPrivate::BypassInterceptor; + QDeclarativePropertyPrivate::WriteFlags flags = QDeclarativePropertyPrivate::BypassInterceptor; for (int ii = start; !isError() && ii < (start + count); ++ii) { const QDeclarativeInstruction &instr = comp->bytecode.at(ii); @@ -217,7 +217,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati // TODO: parent might be a layout } } else { - QDeclarativeGraphics_setParent_noEvent(o, parent); + QDeclarative_setParent_noEvent(o, parent); // o->setParent(parent); } } @@ -515,8 +515,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati int sigIdx = instr.assignSignalObject.signal; const QByteArray &pr = datas.at(sigIdx); - QDeclarativeMetaProperty prop(target, QString::fromUtf8(pr)); - if (prop.type() & QDeclarativeMetaProperty::SignalProperty) { + QDeclarativeProperty prop(target, QString::fromUtf8(pr)); + if (prop.type() & QDeclarativeProperty::SignalProperty) { QMetaMethod method = QDeclarativeMetaType::defaultMethod(assign); if (method.signature() == 0) @@ -525,7 +525,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature())) VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature()))); - QMetaObject::connect(target, prop.coreIndex(), assign, method.methodIndex()); + QMetaObject::connect(target, prop.index(), assign, method.methodIndex()); } else { VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr))); @@ -590,10 +590,10 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati QObject *context = stack.at(stack.count() - 1 - instr.assignBinding.context); - QDeclarativeMetaProperty mp = - QDeclarativeMetaPropertyPrivate::restore(datas.at(instr.assignBinding.property), target, ctxt); + QDeclarativeProperty mp = + QDeclarativePropertyPrivate::restore(datas.at(instr.assignBinding.property), target, ctxt); - int coreIndex = mp.coreIndex(); + int coreIndex = mp.index(); if (stack.count() == 1 && bindingSkipList.testBit(coreIndex)) break; @@ -631,8 +631,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati QDeclarativePropertyValueSource *vs = reinterpret_cast<QDeclarativePropertyValueSource *>(reinterpret_cast<char *>(obj) + instr.assignValueSource.castValue); QObject *target = stack.at(stack.count() - 1 - instr.assignValueSource.owner); - QDeclarativeMetaProperty prop = - QDeclarativeMetaPropertyPrivate::restore(datas.at(instr.assignValueSource.property), target, ctxt); + QDeclarativeProperty prop = + QDeclarativePropertyPrivate::restore(datas.at(instr.assignValueSource.property), target, ctxt); obj->setParent(target); vs->setTarget(prop); } @@ -643,12 +643,12 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati QObject *obj = stack.pop(); QDeclarativePropertyValueInterceptor *vi = reinterpret_cast<QDeclarativePropertyValueInterceptor *>(reinterpret_cast<char *>(obj) + instr.assignValueInterceptor.castValue); QObject *target = stack.at(stack.count() - 1 - instr.assignValueInterceptor.owner); - QDeclarativeMetaProperty prop = - QDeclarativeMetaPropertyPrivate::restore(datas.at(instr.assignValueInterceptor.property), target, ctxt); + QDeclarativeProperty prop = + QDeclarativePropertyPrivate::restore(datas.at(instr.assignValueInterceptor.property), target, ctxt); obj->setParent(target); vi->setTarget(prop); QDeclarativeVMEMetaObject *mo = static_cast<QDeclarativeVMEMetaObject *>((QMetaObject*)target->metaObject()); - mo->registerInterceptor(prop.coreIndex(), QDeclarativeMetaPropertyPrivate::valueTypeCoreIndex(prop), vi); + mo->registerInterceptor(prop.index(), QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), vi); } break; @@ -807,7 +807,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati static_cast<QDeclarativeValueType *>(stack.pop()); QObject *target = stack.top(); valueHandler->write(target, instr.fetchValue.property, - QDeclarativeMetaPropertyPrivate::BypassInterceptor); + QDeclarativePropertyPrivate::BypassInterceptor); } break; diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp index 6edb707..d67c834 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject.cpp +++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp @@ -105,7 +105,7 @@ int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) int id = _id; if(c == QMetaObject::WriteProperty) { int flags = *reinterpret_cast<int*>(a[3]); - if (!(flags & QDeclarativeMetaPropertyPrivate::BypassInterceptor) + if (!(flags & QDeclarativePropertyPrivate::BypassInterceptor) && !aInterceptors.isEmpty() && aInterceptors.testBit(id)) { QPair<int, QDeclarativePropertyValueInterceptor*> pair = interceptors.value(id); diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index 8a43cec..aa1a34b 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -6,7 +6,7 @@ SOURCES += \ $$PWD/qdeclarativeengine.cpp \ $$PWD/qdeclarativeexpression.cpp \ $$PWD/qdeclarativebinding.cpp \ - $$PWD/qdeclarativemetaproperty.cpp \ + $$PWD/qdeclarativeproperty.cpp \ $$PWD/qdeclarativecomponent.cpp \ $$PWD/qdeclarativecontext.cpp \ $$PWD/qdeclarativecustomparser.cpp \ @@ -62,7 +62,7 @@ HEADERS += \ $$PWD/qdeclarative.h \ $$PWD/qdeclarativebinding_p.h \ $$PWD/qdeclarativebinding_p_p.h \ - $$PWD/qdeclarativemetaproperty.h \ + $$PWD/qdeclarativeproperty.h \ $$PWD/qdeclarativecomponent.h \ $$PWD/qdeclarativecomponent_p.h \ $$PWD/qdeclarativecustomparser_p.h \ @@ -87,7 +87,7 @@ HEADERS += \ $$PWD/qdeclarativestringconverters_p.h \ $$PWD/qdeclarativeclassfactory_p.h \ $$PWD/qdeclarativeinfo.h \ - $$PWD/qdeclarativemetaproperty_p.h \ + $$PWD/qdeclarativeproperty_p.h \ $$PWD/qdeclarativecontext_p.h \ $$PWD/qdeclarativecompositetypedata_p.h \ $$PWD/qdeclarativecompositetypemanager_p.h \ diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index a327ccb..10230d3 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -52,7 +52,7 @@ #include <qdeclarativestringconverters_p.h> #include <qdeclarativeglobal_p.h> #include <qdeclarativemetatype_p.h> -#include <qdeclarativemetaproperty_p.h> +#include <qdeclarativeproperty_p.h> #include <qvariant.h> #include <qcolor.h> @@ -63,6 +63,7 @@ #include <QtCore/qrect.h> #include <QtCore/qpoint.h> #include <QtCore/qsize.h> +#include <QtCore/qmath.h> #include <private/qvariantanimation_p.h> @@ -70,7 +71,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Animation QDeclarativeAbstractAnimation - \since 4.7 + \since 4.7 \brief The Animation element is the base of all QML animations. The Animation element cannot be used directly in a QML file. It exists @@ -145,7 +146,7 @@ void QDeclarativeAbstractAnimationPrivate::commence() Q_Q(QDeclarativeAbstractAnimation); QDeclarativeStateActions actions; - QDeclarativeMetaProperties properties; + QDeclarativeProperties properties; q->transition(actions, properties, QDeclarativeAbstractAnimation::Forward); q->qtAnimation()->start(); @@ -155,15 +156,15 @@ void QDeclarativeAbstractAnimationPrivate::commence() } } -QDeclarativeMetaProperty QDeclarativeAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str, QObject *infoObj) +QDeclarativeProperty QDeclarativeAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str, QObject *infoObj) { - QDeclarativeMetaProperty prop(obj, str, qmlContext(infoObj)); + QDeclarativeProperty prop(obj, str, qmlContext(infoObj)); if (!prop.isValid()) { qmlInfo(infoObj) << QDeclarativeAbstractAnimation::tr("Cannot animate non-existent property \"%1\"").arg(str); - return QDeclarativeMetaProperty(); + return QDeclarativeProperty(); } else if (!prop.isWritable()) { qmlInfo(infoObj) << QDeclarativeAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str); - return QDeclarativeMetaProperty(); + return QDeclarativeProperty(); } return prop; } @@ -360,9 +361,6 @@ void QDeclarativeAbstractAnimation::setGroup(QDeclarativeAnimationGroup *g) if (d->group && !static_cast<QDeclarativeAnimationGroupPrivate *>(d->group->d_func())->animations.contains(this)) static_cast<QDeclarativeAnimationGroupPrivate *>(d->group->d_func())->animations.append(this); - if (d->group) - ((QAnimationGroup*)d->group->qtAnimation())->addAnimation(qtAnimation()); - //if (g) //if removed from a group, then the group should no longer be the parent setParent(g); } @@ -466,7 +464,7 @@ void QDeclarativeAbstractAnimation::complete() } } -void QDeclarativeAbstractAnimation::setTarget(const QDeclarativeMetaProperty &p) +void QDeclarativeAbstractAnimation::setTarget(const QDeclarativeProperty &p) { Q_D(QDeclarativeAbstractAnimation); d->defaultProperty = p; @@ -480,7 +478,7 @@ void QDeclarativeAbstractAnimation::setTarget(const QDeclarativeMetaProperty &p) so this function allows us to do the same thing as setTarget without that assumption */ -void QDeclarativeAbstractAnimation::setDefaultTarget(const QDeclarativeMetaProperty &p) +void QDeclarativeAbstractAnimation::setDefaultTarget(const QDeclarativeProperty &p) { Q_D(QDeclarativeAbstractAnimation); d->defaultProperty = p; @@ -498,7 +496,7 @@ void QDeclarativeAbstractAnimation::setDisableUserControl() } void QDeclarativeAbstractAnimation::transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction) { Q_UNUSED(actions); @@ -517,7 +515,7 @@ void QDeclarativeAbstractAnimation::timelineComplete() /*! \qmlclass PauseAnimation QDeclarativePauseAnimation - \since 4.7 + \since 4.7 \inherits Animation \brief The PauseAnimation element provides a pause for an animation. @@ -554,7 +552,7 @@ void QDeclarativePauseAnimationPrivate::init() { Q_Q(QDeclarativePauseAnimation); pa = new QPauseAnimation; - QDeclarativeGraphics_setParent_noEvent(pa, q); + QDeclarative_setParent_noEvent(pa, q); } /*! @@ -591,7 +589,7 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation() /*! \qmlclass ColorAnimation QDeclarativeColorAnimation - \since 4.7 + \since 4.7 \inherits PropertyAnimation \brief The ColorAnimation element allows you to animate color changes. @@ -655,7 +653,7 @@ void QDeclarativeColorAnimation::setTo(const QColor &t) /*! \qmlclass ScriptAction QDeclarativeScriptAction - \since 4.7 + \since 4.7 \inherits Animation \brief The ScriptAction element allows scripts to be run during an animation. @@ -679,7 +677,7 @@ void QDeclarativeScriptActionPrivate::init() { Q_Q(QDeclarativeScriptAction); rsa = new QActionAnimation(&proxy); - QDeclarativeGraphics_setParent_noEvent(rsa, q); + QDeclarative_setParent_noEvent(rsa, q); } /*! @@ -729,7 +727,7 @@ void QDeclarativeScriptActionPrivate::execute() } void QDeclarativeScriptAction::transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction) { Q_D(QDeclarativeScriptAction); @@ -761,7 +759,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() /*! \qmlclass PropertyAction QDeclarativePropertyAction - \since 4.7 + \since 4.7 \inherits Animation \brief The PropertyAction element allows immediate property changes during animation. @@ -797,7 +795,7 @@ void QDeclarativePropertyActionPrivate::init() { Q_Q(QDeclarativePropertyAction); spa = new QActionAnimation; - QDeclarativeGraphics_setParent_noEvent(spa, q); + QDeclarative_setParent_noEvent(spa, q); } /*! @@ -912,7 +910,7 @@ QAbstractAnimation *QDeclarativePropertyAction::qtAnimation() } void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction) { Q_D(QDeclarativePropertyAction); @@ -925,7 +923,7 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, { for (int ii = 0; ii < actions.count(); ++ii) { const QDeclarativeAction &action = actions.at(ii); - QDeclarativeMetaPropertyPrivate::write(action.property, action.toValue, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } } }; @@ -1010,7 +1008,7 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, /*! \qmlclass ParentAction QDeclarativeParentAction - \since 4.7 + \since 4.7 \inherits Animation \brief The ParentAction element allows parent changes during animation. @@ -1058,7 +1056,7 @@ void QDeclarativeParentActionPrivate::init() { Q_Q(QDeclarativeParentAction); cpa = new QActionAnimation; - QDeclarativeGraphics_setParent_noEvent(cpa, q); + QDeclarative_setParent_noEvent(cpa, q); } /*! @@ -1133,7 +1131,7 @@ QAbstractAnimation *QDeclarativeParentAction::qtAnimation() } void QDeclarativeParentAction::transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction) { Q_D(QDeclarativeParentAction); @@ -1214,7 +1212,7 @@ void QDeclarativeParentAction::transition(QDeclarativeStateActions &actions, /*! \qmlclass NumberAnimation QDeclarativeNumberAnimation - \since 4.7 + \since 4.7 \inherits PropertyAnimation \brief The NumberAnimation element allows you to animate changes in properties of type qreal. @@ -1278,7 +1276,7 @@ void QDeclarativeNumberAnimation::setTo(qreal t) /*! \qmlclass Vector3dAnimation QDeclarativeVector3dAnimation - \since 4.7 + \since 4.7 \inherits PropertyAnimation \brief The Vector3dAnimation element allows you to animate changes in properties of type QVector3d. */ @@ -1337,6 +1335,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) /*! \qmlclass RotationAnimation QDeclarativeRotationAnimation + \since 4.7 \inherits PropertyAnimation \brief The RotationAnimation element allows you to animate rotations. @@ -1511,12 +1510,18 @@ QDeclarativeAnimationGroup::QDeclarativeAnimationGroup(QObject *parent) { } +QDeclarativeAnimationGroup::QDeclarativeAnimationGroup(QDeclarativeAnimationGroupPrivate &dd, QObject *parent) + : QDeclarativeAbstractAnimation(dd, parent) +{ +} + void QDeclarativeAnimationGroupPrivate::append_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, QDeclarativeAbstractAnimation *a) { QDeclarativeAnimationGroup *q = qobject_cast<QDeclarativeAnimationGroup *>(list->object); if (q) { q->d_func()->animations.append(a); a->setGroup(q); + q->d_func()->ag->addAnimation(a->qtAnimation()); } } @@ -1545,7 +1550,7 @@ QDeclarativeListProperty<QDeclarativeAbstractAnimation> QDeclarativeAnimationGro /*! \qmlclass SequentialAnimation QDeclarativeSequentialAnimation - \since 4.7 + \since 4.7 \inherits Animation \brief The SequentialAnimation element allows you to run animations sequentially. @@ -1582,7 +1587,7 @@ QAbstractAnimation *QDeclarativeSequentialAnimation::qtAnimation() } void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction) { Q_D(QDeclarativeAnimationGroup); @@ -1606,7 +1611,7 @@ void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actio /*! \qmlclass ParallelAnimation QDeclarativeParallelAnimation - \since 4.7 + \since 4.7 \inherits Animation \brief The ParallelAnimation element allows you to run animations in parallel. @@ -1647,7 +1652,7 @@ QAbstractAnimation *QDeclarativeParallelAnimation::qtAnimation() } void QDeclarativeParallelAnimation::transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction) { Q_D(QDeclarativeAnimationGroup); @@ -1715,7 +1720,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int /*! \qmlclass PropertyAnimation QDeclarativePropertyAnimation - \since 4.7 + \since 4.7 \inherits Animation \brief The PropertyAnimation element allows you to animate property changes. @@ -1793,7 +1798,7 @@ void QDeclarativePropertyAnimationPrivate::init() { Q_Q(QDeclarativePropertyAnimation); va = new QDeclarativeTimeLineValueAnimator; - QDeclarativeGraphics_setParent_noEvent(va, q); + QDeclarative_setParent_noEvent(va, q); } /*! @@ -2231,7 +2236,7 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue QDeclarativeAction &action = actions[ii]; if (v == 1.) - QDeclarativeMetaPropertyPrivate::write(action.property, action.toValue, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); else { if (!fromSourced && !fromDefined) { action.fromValue = action.property.read(); @@ -2246,7 +2251,7 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue } } if (interpolator) - QDeclarativeMetaPropertyPrivate::write(action.property, interpolator(action.fromValue.constData(), action.toValue.constData(), v), QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(action.property, interpolator(action.fromValue.constData(), action.toValue.constData(), v), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } if (deleted) return; @@ -2257,7 +2262,7 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue }; void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction) { Q_D(QDeclarativePropertyAnimation); @@ -2366,6 +2371,241 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions } } +QDeclarativeParentAnimation::QDeclarativeParentAnimation(QObject *parent) + : QDeclarativeAnimationGroup(*(new QDeclarativeParentAnimationPrivate), parent) +{ + Q_D(QDeclarativeParentAnimation); + d->topLevelGroup = new QSequentialAnimationGroup; + QDeclarative_setParent_noEvent(d->topLevelGroup, this); + + d->startAction = new QActionAnimation; + d->topLevelGroup->addAnimation(d->startAction); + + d->ag = new QParallelAnimationGroup; + d->topLevelGroup->addAnimation(d->ag); + + d->endAction = new QActionAnimation; + d->topLevelGroup->addAnimation(d->endAction); +} + +QDeclarativeParentAnimation::~QDeclarativeParentAnimation() +{ +} + +QDeclarativeItem *QDeclarativeParentAnimation::target() const +{ + Q_D(const QDeclarativeParentAnimation); + return d->target; +} + +void QDeclarativeParentAnimation::setTarget(QDeclarativeItem *target) +{ + Q_D(QDeclarativeParentAnimation); + d->target = target; +} + +QDeclarativeItem *QDeclarativeParentAnimation::newParent() const +{ + Q_D(const QDeclarativeParentAnimation); + return d->newParent; +} + +void QDeclarativeParentAnimation::setNewParent(QDeclarativeItem *newParent) +{ + Q_D(QDeclarativeParentAnimation); + d->newParent = newParent; +} + +QDeclarativeItem *QDeclarativeParentAnimation::via() const +{ + Q_D(const QDeclarativeParentAnimation); + return d->via; +} + +void QDeclarativeParentAnimation::setVia(QDeclarativeItem *via) +{ + Q_D(QDeclarativeParentAnimation); + d->via = via; +} + +//### mirrors same-named function in QDeclarativeItem +QPointF QDeclarativeParentAnimationPrivate::computeTransformOrigin(QDeclarativeItem::TransformOrigin origin, qreal width, qreal height) const +{ + switch(origin) { + default: + case QDeclarativeItem::TopLeft: + return QPointF(0, 0); + case QDeclarativeItem::Top: + return QPointF(width / 2., 0); + case QDeclarativeItem::TopRight: + return QPointF(width, 0); + case QDeclarativeItem::Left: + return QPointF(0, height / 2.); + case QDeclarativeItem::Center: + return QPointF(width / 2., height / 2.); + case QDeclarativeItem::Right: + return QPointF(width, height / 2.); + case QDeclarativeItem::BottomLeft: + return QPointF(0, height); + case QDeclarativeItem::Bottom: + return QPointF(width / 2., height); + case QDeclarativeItem::BottomRight: + return QPointF(width, height); + } +} + +void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, + QDeclarativeProperties &modified, + TransitionDirection direction) +{ + Q_D(QDeclarativeParentAnimation); + + struct QDeclarativeParentActionData : public QAbstractAnimationAction + { + QDeclarativeParentActionData(): pc(0) {} + ~QDeclarativeParentActionData() { delete pc; } + + QDeclarativeStateActions actions; + bool reverse; + QDeclarativeParentChange *pc; + virtual void doAction() + { + for (int ii = 0; ii < actions.count(); ++ii) { + const QDeclarativeAction &action = actions.at(ii); + if (reverse) + action.event->reverse(); + else + action.event->execute(); + } + } + }; + + QDeclarativeParentActionData *data = new QDeclarativeParentActionData; + QDeclarativeParentActionData *viaData = new QDeclarativeParentActionData; + for (int i = 0; i < actions.size(); ++i) { + QDeclarativeAction &action = actions[i]; + if (action.event && action.event->typeName() == QLatin1String("ParentChange") + && (!d->target || static_cast<QDeclarativeParentChange*>(action.event)->object() == d->target)) { + + QDeclarativeParentChange *pc = static_cast<QDeclarativeParentChange*>(action.event); + QDeclarativeAction myAction = action; + data->reverse = action.reverseEvent; + action.actionDone = true; + data->actions << myAction; + + if (d->via) { + viaData->reverse = false; + QDeclarativeAction myAction; + QDeclarativeParentChange *vpc = new QDeclarativeParentChange; + vpc->setObject(pc->object()); + vpc->setParent(d->via); + myAction.event = vpc; + viaData->pc = vpc; + viaData->actions << myAction; + QDeclarativeAction dummyAction; + QDeclarativeAction &xAction = pc->xIsSet() ? actions[++i] : dummyAction; + QDeclarativeAction &yAction = pc->yIsSet() ? actions[++i] : dummyAction; + QDeclarativeAction &sAction = pc->scaleIsSet() ? actions[++i] : dummyAction; + QDeclarativeAction &rAction = pc->rotationIsSet() ? actions[++i] : dummyAction; + bool forward = (direction == QDeclarativeAbstractAnimation::Forward); + QDeclarativeItem *target = pc->object(); + QDeclarativeItem *targetParent = forward ? pc->parent() : pc->originalParent(); + + //### this mirrors the logic in QDeclarativeParentChange. + bool ok; + const QTransform &transform = targetParent->itemTransform(d->via, &ok); + if (transform.type() >= QTransform::TxShear || !ok) { + qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under complex transform"); + ok = false; + } + + qreal scale = 1; + qreal rotation = 0; + if (ok && transform.type() != QTransform::TxRotate) { + if (transform.m11() == transform.m22()) + scale = transform.m11(); + else { + qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under non-uniform scale"); + ok = false; + } + } else if (ok && transform.type() == QTransform::TxRotate) { + if (transform.m11() == transform.m22()) + scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12()); + else { + qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under non-uniform scale"); + ok = false; + } + + if (scale != 0) + rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI; + else { + qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under scale of 0"); + ok = false; + } + } + + const QPointF &point = transform.map(QPointF(xAction.toValue.toReal(),yAction.toValue.toReal())); + qreal x = point.x(); + qreal y = point.y(); + if (ok && target->transformOrigin() != QDeclarativeItem::TopLeft) { + qreal w = target->width(); + qreal h = target->height(); + if (pc->widthIsSet()) + w = actions[++i].toValue.toReal(); + if (pc->heightIsSet()) + h = actions[++i].toValue.toReal(); + const QPointF &transformOrigin + = d->computeTransformOrigin(target->transformOrigin(), w,h); + qreal tempxt = transformOrigin.x(); + qreal tempyt = transformOrigin.y(); + QTransform t; + t.translate(-tempxt, -tempyt); + t.rotate(rotation); + t.scale(scale, scale); + t.translate(tempxt, tempyt); + const QPointF &offset = t.map(QPointF(0,0)); + x += offset.x(); + y += offset.y(); + } + + if (ok) { + //qDebug() << x << y << rotation << scale; + xAction.toValue = x; + yAction.toValue = y; + sAction.toValue = sAction.toValue.toReal() * scale; + rAction.toValue = rAction.toValue.toReal() + rotation; + } + } + } + } + + if (data->actions.count()) { + if (direction == QDeclarativeAbstractAnimation::Forward) { + d->startAction->setAnimAction(d->via ? viaData : data, QActionAnimation::DeleteWhenStopped); + d->endAction->setAnimAction(d->via ? data : 0, QActionAnimation::DeleteWhenStopped); + } else { + d->endAction->setAnimAction(d->via ? viaData : data, QActionAnimation::DeleteWhenStopped); + d->startAction->setAnimAction(d->via ? data : 0, QActionAnimation::DeleteWhenStopped); + } + } else { + delete data; + delete viaData; + } + + //take care of any child animations + bool valid = d->defaultProperty.isValid(); + for (int ii = 0; ii < d->animations.count(); ++ii) { + if (valid) + d->animations.at(ii)->setDefaultTarget(d->defaultProperty); + d->animations.at(ii)->transition(actions, modified, direction); + } + +} +QAbstractAnimation *QDeclarativeParentAnimation::qtAnimation() +{ + Q_D(QDeclarativeParentAnimation); + return d->topLevelGroup; +} QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h index 02dacb3..0f23f5c 100644 --- a/src/declarative/util/qdeclarativeanimation_p.h +++ b/src/declarative/util/qdeclarativeanimation_p.h @@ -95,7 +95,7 @@ public: QDeclarativeAnimationGroup *group() const; void setGroup(QDeclarativeAnimationGroup *); - void setDefaultTarget(const QDeclarativeMetaProperty &); + void setDefaultTarget(const QDeclarativeProperty &); void setDisableUserControl(); void classBegin(); @@ -123,7 +123,7 @@ protected: public: enum TransitionDirection { Forward, Backward }; virtual void transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction); virtual QAbstractAnimation *qtAnimation() = 0; @@ -131,7 +131,7 @@ private Q_SLOTS: void timelineComplete(); private: - virtual void setTarget(const QDeclarativeMetaProperty &); + virtual void setTarget(const QDeclarativeProperty &); }; class QDeclarativePauseAnimationPrivate; @@ -177,7 +177,7 @@ public: protected: virtual void transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction); virtual QAbstractAnimation *qtAnimation(); }; @@ -221,7 +221,7 @@ Q_SIGNALS: protected: virtual void transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction); virtual QAbstractAnimation *qtAnimation(); }; @@ -248,7 +248,7 @@ public: protected: virtual void transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction); virtual QAbstractAnimation *qtAnimation(); }; @@ -300,7 +300,7 @@ public: protected: QDeclarativePropertyAnimation(QDeclarativePropertyAnimationPrivate &dd, QObject *parent); virtual void transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction); virtual QAbstractAnimation *qtAnimation(); @@ -413,6 +413,9 @@ public: QDeclarativeListProperty<QDeclarativeAbstractAnimation> animations(); friend class QDeclarativeAbstractAnimation; + +protected: + QDeclarativeAnimationGroup(QDeclarativeAnimationGroupPrivate &dd, QObject *parent); }; class QDeclarativeSequentialAnimation : public QDeclarativeAnimationGroup @@ -426,7 +429,7 @@ public: protected: virtual void transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, TransitionDirection direction); virtual QAbstractAnimation *qtAnimation(); }; @@ -442,7 +445,37 @@ public: protected: virtual void transition(QDeclarativeStateActions &actions, - QDeclarativeMetaProperties &modified, + QDeclarativeProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); +}; + +class QDeclarativeParentAnimationPrivate; +class QDeclarativeParentAnimation : public QDeclarativeAnimationGroup +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QDeclarativeParentAnimation) + + Q_PROPERTY(QDeclarativeItem *target READ target WRITE setTarget) + //Q_PROPERTY(QDeclarativeItem *newParent READ newParent WRITE setNewParent) + Q_PROPERTY(QDeclarativeItem *via READ via WRITE setVia) + +public: + QDeclarativeParentAnimation(QObject *parent=0); + virtual ~QDeclarativeParentAnimation(); + + QDeclarativeItem *target() const; + void setTarget(QDeclarativeItem *); + + QDeclarativeItem *newParent() const; + void setNewParent(QDeclarativeItem *); + + QDeclarativeItem *via() const; + void setVia(QDeclarativeItem *); + +protected: + virtual void transition(QDeclarativeStateActions &actions, + QDeclarativeProperties &modified, TransitionDirection direction); virtual QAbstractAnimation *qtAnimation(); }; @@ -461,6 +494,7 @@ QML_DECLARE_TYPE(QDeclarativeSequentialAnimation) QML_DECLARE_TYPE(QDeclarativeParallelAnimation) QML_DECLARE_TYPE(QDeclarativeVector3dAnimation) QML_DECLARE_TYPE(QDeclarativeRotationAnimation) +QML_DECLARE_TYPE(QDeclarativeParentAnimation) QT_END_HEADER diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h index 65c9807..e582066 100644 --- a/src/declarative/util/qdeclarativeanimation_p_p.h +++ b/src/declarative/util/qdeclarativeanimation_p_p.h @@ -59,6 +59,7 @@ #include "qdeclarativetimeline_p_p.h" #include <qdeclarative.h> +#include <qdeclarativeitem.h> #include <qdeclarativecontext.h> #include <QtCore/QPauseAnimation> @@ -104,6 +105,12 @@ public: : QAbstractAnimation(parent), animAction(action), policy(KeepWhenStopped), running(false) {} ~QActionAnimation() { if (policy == DeleteWhenStopped) { delete animAction; animAction = 0; } } virtual int duration() const { return 0; } + void clearAnimAction() + { + if (policy == DeleteWhenStopped) + delete animAction; + animAction = 0; + } void setAnimAction(QAbstractAnimationAction *action, DeletionPolicy p) { if (state() == Running) @@ -226,11 +233,11 @@ public: void commence(); - QDeclarativeMetaProperty defaultProperty; + QDeclarativeProperty defaultProperty; QDeclarativeAnimationGroup *group; - static QDeclarativeMetaProperty createProperty(QObject *obj, const QString &str, QObject *infoObj); + static QDeclarativeProperty createProperty(QObject *obj, const QString &str, QObject *infoObj); }; class QDeclarativePauseAnimationPrivate : public QDeclarativeAbstractAnimationPrivate @@ -311,8 +318,6 @@ public: static void append_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, QDeclarativeAbstractAnimation *role); static void clear_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list); - static void removeAt_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, int i); - static void insert_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, int i, QDeclarativeAbstractAnimation *role); QList<QDeclarativeAbstractAnimation *> animations; QAnimationGroup *ag; }; @@ -362,6 +367,25 @@ public: QDeclarativeRotationAnimation::RotationDirection direction; }; +class QDeclarativeParentAnimationPrivate : public QDeclarativeAnimationGroupPrivate +{ + Q_DECLARE_PUBLIC(QDeclarativeParentAnimation) +public: + QDeclarativeParentAnimationPrivate() + : QDeclarativeAnimationGroupPrivate(), target(0), newParent(0), + via(0), topLevelGroup(0), startAction(0), endAction(0) {} + + QDeclarativeItem *target; + QDeclarativeItem *newParent; + QDeclarativeItem *via; + + QSequentialAnimationGroup *topLevelGroup; + QActionAnimation *startAction; + QActionAnimation *endAction; + + QPointF computeTransformOrigin(QDeclarativeItem::TransformOrigin origin, qreal width, qreal height) const; +}; + QT_END_NAMESPACE #endif // QDECLARATIVEANIMATION_P_H diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index b1f1677..5352341 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -46,7 +46,7 @@ #include <qdeclarativecontext.h> #include <qdeclarativeinfo.h> -#include <qdeclarativemetaproperty_p.h> +#include <qdeclarativeproperty_p.h> #include <QtCore/qparallelanimationgroup.h> @@ -62,7 +62,7 @@ class QDeclarativeBehaviorPrivate : public QObjectPrivate public: QDeclarativeBehaviorPrivate() : animation(0), enabled(true) {} - QDeclarativeMetaProperty property; + QDeclarativeProperty property; QVariant currentValue; QDeclarativeAbstractAnimation *animation; bool enabled; @@ -70,6 +70,7 @@ public: /*! \qmlclass Behavior QDeclarativeBehavior + \since 4.7 \brief The Behavior element allows you to specify a default animation for a property change. Behaviors provide one way to specify \l{qdeclarativeanimation.html}{animations} in QML. @@ -157,7 +158,7 @@ void QDeclarativeBehavior::write(const QVariant &value) { Q_D(QDeclarativeBehavior); if (!d->animation || !d->enabled) { - QDeclarativeMetaPropertyPrivate::write(d->property, value, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); return; } @@ -172,15 +173,15 @@ void QDeclarativeBehavior::write(const QVariant &value) action.toValue = value; actions << action; - QList<QDeclarativeMetaProperty> after; + QList<QDeclarativeProperty> after; if (d->animation) d->animation->transition(actions, after, QDeclarativeAbstractAnimation::Forward); d->animation->qtAnimation()->start(); if (!after.contains(d->property)) - QDeclarativeMetaPropertyPrivate::write(d->property, value, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } -void QDeclarativeBehavior::setTarget(const QDeclarativeMetaProperty &property) +void QDeclarativeBehavior::setTarget(const QDeclarativeProperty &property) { Q_D(QDeclarativeBehavior); d->property = property; diff --git a/src/declarative/util/qdeclarativebehavior_p.h b/src/declarative/util/qdeclarativebehavior_p.h index fbc19f8..a633b55 100644 --- a/src/declarative/util/qdeclarativebehavior_p.h +++ b/src/declarative/util/qdeclarativebehavior_p.h @@ -70,7 +70,7 @@ public: QDeclarativeBehavior(QObject *parent=0); ~QDeclarativeBehavior(); - virtual void setTarget(const QDeclarativeMetaProperty &); + virtual void setTarget(const QDeclarativeProperty &); virtual void write(const QVariant &value); QDeclarativeAbstractAnimation *animation(); diff --git a/src/declarative/util/qdeclarativebind.cpp b/src/declarative/util/qdeclarativebind.cpp index d75e98d..e95a03e 100644 --- a/src/declarative/util/qdeclarativebind.cpp +++ b/src/declarative/util/qdeclarativebind.cpp @@ -45,7 +45,7 @@ #include <qdeclarativeengine.h> #include <qdeclarativecontext.h> -#include <qdeclarativemetaproperty.h> +#include <qdeclarativeproperty.h> #include <QtCore/qfile.h> #include <QtCore/qdebug.h> @@ -196,7 +196,7 @@ void QDeclarativeBind::eval() if (!d->obj || d->value.isNull || !d->when || !d->componentComplete) return; - QDeclarativeMetaProperty prop(d->obj, d->prop); + QDeclarativeProperty prop(d->obj, d->prop); prop.write(d->value.value); } diff --git a/src/declarative/util/qdeclarativeconnection.cpp b/src/declarative/util/qdeclarativeconnection.cpp deleted file mode 100644 index e9ae74b..0000000 --- a/src/declarative/util/qdeclarativeconnection.cpp +++ /dev/null @@ -1,287 +0,0 @@ -/**************************************************************************** -** -** 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 QtDeclarative 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 "qdeclarativeconnection_p.h" - -#include <qdeclarativeexpression.h> -#include <qdeclarativeboundsignal_p.h> -#include <qdeclarativecontext.h> - -#include <QtCore/qdebug.h> -#include <QtCore/qstringlist.h> - -#include <private/qobject_p.h> - -QT_BEGIN_NAMESPACE - -class QDeclarativeConnectionPrivate : public QObjectPrivate -{ -public: - QDeclarativeConnectionPrivate() : boundsignal(0), signalSender(0), scriptset(false), componentcomplete(false) {} - - QDeclarativeBoundSignal *boundsignal; - QObject *signalSender; - QDeclarativeScriptString script; - bool scriptset; - QString signal; - bool componentcomplete; -}; - -/*! - \qmlclass Connection QDeclarativeConnection - \since 4.7 - \brief A Connection object describes generalized connections to signals. - - When connecting to signals in QML, the usual way is to create an - "on<Signal>" handler that reacts when a signal is received, like this: - - \qml - MouseArea { - onClicked: { foo(x+123,y+456) } - } - \endqml - - However, in some cases, it is not possible to connect to a signal in this - way. For example, JavaScript-in-HTML style signal properties do not allow: - - \list - \i connecting to signals with the same name but different parameters - \i conformance checking that parameters are correctly named - \i multiple connections to the same signal - \i connections outside the scope of the signal sender - \i signals in classes with coincidentally-named on<Signal> properties - \endlist - - When any of these are needed, the Connection object can be used instead. - - For example, the above code can be changed to use a Connection object, - like this: - - \qml - MouseArea { - Connection { - signal: "clicked(x,y)" - script: { foo(x+123,y+456) } - } - } - \endqml - - More generally, the Connection object can be a child of some other object than - the sender of the signal: - - \qml - MouseArea { - id: mr - } - ... - Connection { - sender: mr - signal: "clicked(x,y)" - script: { foo(x+123,y+456) } - } - \endqml -*/ - -/*! - \internal - \class QDeclarativeConnection - \brief The QDeclarativeConnection class describes generalized connections to signals. - -*/ -QDeclarativeConnection::QDeclarativeConnection(QObject *parent) : - QObject(*(new QDeclarativeConnectionPrivate), parent) -{ -} - -QDeclarativeConnection::~QDeclarativeConnection() -{ - Q_D(QDeclarativeConnection); - delete d->boundsignal; -} - -/*! - \qmlproperty Object Connection::sender - This property holds the object that sends the signal. - - By default, the sender is assumed to be the parent of the Connection. -*/ -QObject *QDeclarativeConnection::signalSender() const -{ - Q_D(const QDeclarativeConnection); - return d->signalSender ? d->signalSender : parent(); -} - -void QDeclarativeConnection::setSignalSender(QObject *obj) -{ - Q_D(QDeclarativeConnection); - if (d->signalSender == obj) - return; - disconnectIfValid(); - d->signalSender = obj; - connectIfValid(); -} - -void QDeclarativeConnection::connectIfValid() -{ - Q_D(QDeclarativeConnection); - if (!d->componentcomplete) - return; - // boundsignal must not exist - if ((d->signalSender || parent()) && !d->signal.isEmpty() && d->scriptset) { - // create - // XXX scope? - int sigIdx = -1; - int lparen = d->signal.indexOf(QLatin1Char('(')); - QList<QByteArray> sigparams; - if (lparen >= 0 && d->signal.length() > lparen+2) { - QStringList l = d->signal.mid(lparen+1,d->signal.length()-lparen-2).split(QLatin1Char(',')); - foreach (const QString &s, l) { - sigparams.append(s.trimmed().toUtf8()); - } - } - QString signalname = d->signal.left(lparen); - QObject *sender = d->signalSender ? d->signalSender : parent(); - const QMetaObject *mo = sender->metaObject(); - int methods = mo->methodCount(); - for (int ii = 0; ii < methods; ++ii) { - QMetaMethod method = mo->method(ii); - QString methodName = QString::fromUtf8(method.signature()); - int idx = methodName.indexOf(QLatin1Char('(')); - methodName = methodName.left(idx); - if (methodName == signalname && (lparen<0 || method.parameterNames() == sigparams)) { - sigIdx = ii; - break; - } - } - if (sigIdx < 0) { - // Cannot usefully warn, since could be in middle of - // changing sender and signal. - // XXX need state change transactions to do better - return; - } - - d->boundsignal = new QDeclarativeBoundSignal(qmlContext(this), d->script.script(), sender, mo->method(sigIdx), this); - } -} - -void QDeclarativeConnection::disconnectIfValid() -{ - Q_D(QDeclarativeConnection); - if (!d->componentcomplete) - return; - if ((d->signalSender || parent()) && !d->signal.isEmpty() && d->scriptset) { - // boundsignal must exist - // destroy - delete d->boundsignal; - d->boundsignal = 0; - } -} - -void QDeclarativeConnection::componentComplete() -{ - Q_D(QDeclarativeConnection); - d->componentcomplete=true; - connectIfValid(); -} - - -/*! - \qmlproperty script Connection::script - This property holds the JavaScript executed whenever the signal is sent. -*/ -QDeclarativeScriptString QDeclarativeConnection::script() const -{ - Q_D(const QDeclarativeConnection); - return d->script; -} - -void QDeclarativeConnection::setScript(const QDeclarativeScriptString& script) -{ - Q_D(QDeclarativeConnection); - if ((d->signalSender || parent()) && !d->signal.isEmpty()) { - if (!d->scriptset) { - // mustn't exist - create - d->scriptset = true; - d->script = script; - connectIfValid(); - } else { - // must exist - update - d->script = script; - d->boundsignal->expression()->setExpression(script.script()); - } - } else { - d->scriptset = true; - d->script = script; - } -} - -/*! - \qmlproperty string Connection::signal - This property holds the signal from the sender to which the script is attached. - - The signal's formal parameter names must be given in parentheses: - - \qml -Connection { - signal: "clicked(x,y)" - script: { ... } -} - \endqml -*/ -QString QDeclarativeConnection::signal() const -{ - Q_D(const QDeclarativeConnection); - return d->signal; -} - -void QDeclarativeConnection::setSignal(const QString& sig) -{ - Q_D(QDeclarativeConnection); - if (d->signal == sig) - return; - disconnectIfValid(); - d->signal = sig; - connectIfValid(); -} - - - -QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp new file mode 100644 index 0000000..0b9e3ab --- /dev/null +++ b/src/declarative/util/qdeclarativeconnections.cpp @@ -0,0 +1,245 @@ +/**************************************************************************** +** +** 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 QtDeclarative 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 "qdeclarativeconnections_p.h" + +#include <qdeclarativeexpression.h> +#include <qdeclarativeproperty_p.h> +#include <qdeclarativeboundsignal_p.h> +#include <qdeclarativecontext.h> +#include <qdeclarativeinfo.h> + +#include <QtCore/qdebug.h> +#include <QtCore/qstringlist.h> + +#include <private/qobject_p.h> + +QT_BEGIN_NAMESPACE + +class QDeclarativeConnectionsPrivate : public QObjectPrivate +{ +public: + QDeclarativeConnectionsPrivate() : target(0), componentcomplete(false) {} + + QList<QDeclarativeBoundSignal*> boundsignals; + QObject *target; + + bool componentcomplete; + + QByteArray data; +}; + +/*! + \qmlclass Connections QDeclarativeConnections + \since 4.7 + \brief A Connections object describes generalized connections to signals. + + When connecting to signals in QML, the usual way is to create an + "on<Signal>" handler that reacts when a signal is received, like this: + + \qml + MouseArea { + onClicked: { foo(...) } + } + \endqml + + However, in some cases, it is not possible to connect to a signal in this + way, such as: + + \list + \i multiple connections to the same signal + \i connections outside the scope of the signal sender + \i connections to targets not defined in QML + \endlist + + When any of these are needed, the Connections object can be used instead. + + For example, the above code can be changed to use a Connections object, + like this: + + \qml + MouseArea { + Connections { + onClicked: foo(...) + } + } + \endqml + + More generally, the Connections object can be a child of some other object than + the sender of the signal: + + \qml + MouseArea { + id: area + } + ... + Connections { + target: area + onClicked: foo(...) + } + \endqml +*/ + +/*! + \internal + \class QDeclarativeConnections + \brief The QDeclarativeConnections class describes generalized connections to signals. + +*/ +QDeclarativeConnections::QDeclarativeConnections(QObject *parent) : + QObject(*(new QDeclarativeConnectionsPrivate), parent) +{ +} + +QDeclarativeConnections::~QDeclarativeConnections() +{ +} + +/*! + \qmlproperty Object Connections::target + This property holds the object that sends the signal. + + By default, the target is assumed to be the parent of the Connections. +*/ +QObject *QDeclarativeConnections::target() const +{ + Q_D(const QDeclarativeConnections); + return d->target ? d->target : parent(); +} + +void QDeclarativeConnections::setTarget(QObject *obj) +{ + Q_D(QDeclarativeConnections); + if (d->target == obj) + return; + foreach (QDeclarativeBoundSignal *s, d->boundsignals) + delete s; + d->boundsignals.clear(); + d->target = obj; + connectSignals(); + emit targetChanged(); +} + + +QByteArray +QDeclarativeConnectionsParser::compile(const QList<QDeclarativeCustomParserProperty> &props) +{ + QByteArray rv; + QDataStream ds(&rv, QIODevice::WriteOnly); + + for(int ii = 0; ii < props.count(); ++ii) + { + QString propName = QString::fromUtf8(props.at(ii).name()); + if (!propName.startsWith(QLatin1String("on")) || !propName.at(2).isUpper()) { + error(props.at(ii), QDeclarativeConnections::tr("Cannot assign to non-existent property \"%1\"").arg(propName)); + return QByteArray(); + } + + QList<QVariant> values = props.at(ii).assignedValues(); + + for (int i = 0; i < values.count(); ++i) { + const QVariant &value = values.at(i); + + if (value.userType() == qMetaTypeId<QDeclarativeCustomParserNode>()) { + error(props.at(ii), QDeclarativeConnections::tr("Connections: nested objects not allowed")); + return QByteArray(); + } else if (value.userType() == qMetaTypeId<QDeclarativeCustomParserProperty>()) { + error(props.at(ii), QDeclarativeConnections::tr("Connections: syntax error")); + return QByteArray(); + } else { + QDeclarativeParser::Variant v = qvariant_cast<QDeclarativeParser::Variant>(value); + if (v.isScript()) { + ds << propName; + ds << v.asScript(); + } else { + error(props.at(ii), QDeclarativeConnections::tr("Connections: script expected")); + return QByteArray(); + } + } + } + } + + return rv; +} + +void QDeclarativeConnectionsParser::setCustomData(QObject *object, + const QByteArray &data) +{ + QDeclarativeConnectionsPrivate *p = + static_cast<QDeclarativeConnectionsPrivate *>(QObjectPrivate::get(object)); + p->data = data; +} + + +void QDeclarativeConnections::connectSignals() +{ + Q_D(QDeclarativeConnections); + if (!d->componentcomplete) + return; + + QDataStream ds(d->data); + while (!ds.atEnd()) { + QString propName; + ds >> propName; + QString script; + ds >> script; + QDeclarativeProperty prop(target(), propName); + if (!prop.isValid()) { + qmlInfo(this) << tr("Cannot assign to non-existent property \"%1\"").arg(propName); + } else if (prop.type() & QDeclarativeProperty::SignalProperty) { + QDeclarativeBoundSignal *signal = + new QDeclarativeBoundSignal(target(), prop.method(), this); + signal->setExpression(new QDeclarativeExpression(qmlContext(this), script, 0)); + d->boundsignals += signal; + } else { + qmlInfo(this) << tr("Cannot assign to non-existent property \"%1\"").arg(propName); + } + } +} + +void QDeclarativeConnections::componentComplete() +{ + Q_D(QDeclarativeConnections); + d->componentcomplete=true; + connectSignals(); +} + +QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativeconnection_p.h b/src/declarative/util/qdeclarativeconnections_p.h index ae2efe9..3eacf12 100644 --- a/src/declarative/util/qdeclarativeconnection_p.h +++ b/src/declarative/util/qdeclarativeconnections_p.h @@ -39,11 +39,12 @@ ** ****************************************************************************/ -#ifndef QDECLARATIVECONNECTION_H -#define QDECLARATIVECONNECTION_H +#ifndef QDECLARATIVECONNECTIONS_H +#define QDECLARATIVECONNECTIONS_H #include <qdeclarative.h> #include <qdeclarativescriptstring.h> +#include <private/qdeclarativecustomparser_p.h> #include <QtCore/qobject.h> #include <QtCore/qstring.h> @@ -56,37 +57,41 @@ QT_MODULE(Declarative) class QDeclarativeBoundSignal; class QDeclarativeContext; -class QDeclarativeConnectionPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeConnection : public QObject, public QDeclarativeParserStatus +class QDeclarativeConnectionsPrivate; +class Q_DECLARATIVE_EXPORT QDeclarativeConnections : public QObject, public QDeclarativeParserStatus { Q_OBJECT - Q_DECLARE_PRIVATE(QDeclarativeConnection) + Q_DECLARE_PRIVATE(QDeclarativeConnections) Q_INTERFACES(QDeclarativeParserStatus) - Q_PROPERTY(QObject *sender READ signalSender WRITE setSignalSender) - Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript) - Q_PROPERTY(QString signal READ signal WRITE setSignal) + Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) public: - QDeclarativeConnection(QObject *parent=0); - ~QDeclarativeConnection(); + QDeclarativeConnections(QObject *parent=0); + ~QDeclarativeConnections(); - QObject *signalSender() const; - void setSignalSender(QObject *); - QDeclarativeScriptString script() const; - void setScript(const QDeclarativeScriptString&); - QString signal() const; - void setSignal(const QString&); + QObject *target() const; + void setTarget(QObject *); + +Q_SIGNALS: + void targetChanged(); private: - void disconnectIfValid(); - void connectIfValid(); + void connectSignals(); void componentComplete(); }; +class QDeclarativeConnectionsParser : public QDeclarativeCustomParser +{ +public: + virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &); + virtual void setCustomData(QObject *, const QByteArray &); +}; + + QT_END_NAMESPACE -QML_DECLARE_TYPE(QDeclarativeConnection) +QML_DECLARE_TYPE(QDeclarativeConnections) QT_END_HEADER diff --git a/src/declarative/util/qdeclarativeeasefollow.cpp b/src/declarative/util/qdeclarativeeasefollow.cpp index 0430a0b..3fa9866 100644 --- a/src/declarative/util/qdeclarativeeasefollow.cpp +++ b/src/declarative/util/qdeclarativeeasefollow.cpp @@ -43,7 +43,7 @@ #include "qdeclarativeanimation_p_p.h" -#include <qdeclarativemetaproperty.h> +#include <qdeclarativeproperty.h> #include <QtCore/qdebug.h> @@ -77,7 +77,7 @@ public: qreal trackVelocity; - QDeclarativeMetaProperty target; + QDeclarativeProperty target; int clockOffset; int lastTick; @@ -251,6 +251,7 @@ void QDeclarativeEaseFollowPrivate::tick(int t) /*! \qmlclass EaseFollow QDeclarativeEaseFollow + \since 4.7 \brief The EaseFollow element allows a property to smoothly track a value. The EaseFollow smoothly animates a property's value to a set target value @@ -500,7 +501,7 @@ void QDeclarativeEaseFollow::setEnabled(bool enabled) emit enabledChanged(); } -void QDeclarativeEaseFollow::setTarget(const QDeclarativeMetaProperty &t) +void QDeclarativeEaseFollow::setTarget(const QDeclarativeProperty &t) { Q_D(QDeclarativeEaseFollow); d->target = t; diff --git a/src/declarative/util/qdeclarativeeasefollow_p.h b/src/declarative/util/qdeclarativeeasefollow_p.h index 6d14eb5..83d1eff 100644 --- a/src/declarative/util/qdeclarativeeasefollow_p.h +++ b/src/declarative/util/qdeclarativeeasefollow_p.h @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeMetaProperty; +class QDeclarativeProperty; class QDeclarativeEaseFollowPrivate; class Q_DECLARATIVE_EXPORT QDeclarativeEaseFollow : public QObject, public QDeclarativePropertyValueSource @@ -94,7 +94,7 @@ public: qreal maximumEasingTime() const; void setMaximumEasingTime(qreal); - virtual void setTarget(const QDeclarativeMetaProperty &); + virtual void setTarget(const QDeclarativeProperty &); Q_SIGNALS: void sourceChanged(); diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index ac30384..4d12ae1 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -75,6 +75,7 @@ public: /*! \qmlclass FontLoader QDeclarativeFontLoader + \since 4.7 \ingroup group_utility \brief This item allows using fonts by name or url. diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index e78e0e1..e3f26d7 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -70,6 +70,7 @@ static void dump(ModelNode *node, int ind); /*! \qmlclass ListModel QDeclarativeListModel + \since 4.7 \brief The ListModel element defines a free-form list data source. The ListModel is a simple hierarchy of elements containing data roles. The contents can @@ -936,6 +937,7 @@ bool QDeclarativeListModelParser::definesEmptyList(const QString &s) /*! \qmlclass ListElement + \since 4.7 \brief The ListElement element defines a data item in a ListModel. \sa ListModel diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h index 251a31f..8eb6583 100644 --- a/src/declarative/util/qdeclarativelistmodel_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p.h @@ -50,7 +50,7 @@ #include <QtCore/QHash> #include <QtCore/QList> #include <QtCore/QVariant> -#include "../3rdparty/qlistmodelinterface_p.h" +#include <private/qlistmodelinterface_p.h> #include <QtScript/qscriptvalue.h> QT_BEGIN_HEADER diff --git a/src/declarative/util/qdeclarativepackage.cpp b/src/declarative/util/qdeclarativepackage.cpp index 34ae466..d144777 100644 --- a/src/declarative/util/qdeclarativepackage.cpp +++ b/src/declarative/util/qdeclarativepackage.cpp @@ -42,7 +42,7 @@ #include "qdeclarativepackage_p.h" #include <private/qobject_p.h> -#include "private/qdeclarativeguard_p.h" +#include <private/qdeclarativeguard_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 454fb06..9c2b1e6 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -50,7 +50,7 @@ #include <qdeclarativebinding_p.h> #include <qdeclarativecontext.h> #include <qdeclarativeguard_p.h> -#include <qdeclarativemetaproperty_p.h> +#include <qdeclarativeproperty_p.h> #include <QtCore/qdebug.h> @@ -153,19 +153,19 @@ public: virtual QString typeName() const { return QLatin1String("ReplaceSignalHandler"); } - QDeclarativeMetaProperty property; + QDeclarativeProperty property; QDeclarativeExpression *expression; QDeclarativeExpression *reverseExpression; QDeclarativeExpression *rewindExpression; QDeclarativeGuard<QDeclarativeExpression> ownedExpression; virtual void execute() { - ownedExpression = QDeclarativeMetaPropertyPrivate::setSignalExpression(property, expression); + ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, expression); } virtual bool isReversable() { return true; } virtual void reverse() { - ownedExpression = QDeclarativeMetaPropertyPrivate::setSignalExpression(property, reverseExpression); + ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, reverseExpression); } virtual void saveOriginals() { @@ -174,10 +174,10 @@ public: } virtual void rewind() { - ownedExpression = QDeclarativeMetaPropertyPrivate::setSignalExpression(property, rewindExpression); + ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, rewindExpression); } virtual void saveCurrentValues() { - rewindExpression = QDeclarativeMetaPropertyPrivate::signalExpression(property); + rewindExpression = QDeclarativePropertyPrivate::signalExpression(property); } virtual bool override(QDeclarativeActionEvent*other) { @@ -212,7 +212,7 @@ public: QList<QPair<QByteArray, QDeclarativeExpression *> > expressions; QList<QDeclarativeReplaceSignalHandler*> signalReplacements; - QDeclarativeMetaProperty property(const QByteArray &); + QDeclarativeProperty property(const QByteArray &); }; void @@ -296,8 +296,8 @@ void QDeclarativePropertyChangesPrivate::decode() ds >> isScript; ds >> data; - QDeclarativeMetaProperty prop = property(name); //### better way to check for signal property? - if (prop.type() & QDeclarativeMetaProperty::SignalProperty) { + QDeclarativeProperty prop = property(name); //### better way to check for signal property? + if (prop.type() & QDeclarativeProperty::SignalProperty) { QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(q), data.toString(), object); QDeclarativeReplaceSignalHandler *handler = new QDeclarativeReplaceSignalHandler; handler->property = prop; @@ -371,17 +371,17 @@ void QDeclarativePropertyChanges::setRestoreEntryValues(bool v) d->restore = v; } -QDeclarativeMetaProperty +QDeclarativeProperty QDeclarativePropertyChangesPrivate::property(const QByteArray &property) { Q_Q(QDeclarativePropertyChanges); - QDeclarativeMetaProperty prop(object, QString::fromUtf8(property)); + QDeclarativeProperty prop(object, QString::fromUtf8(property)); if (!prop.isValid()) { qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property)); - return QDeclarativeMetaProperty(); - } else if (!(prop.type() & QDeclarativeMetaProperty::SignalProperty) && !prop.isWritable()) { + return QDeclarativeProperty(); + } else if (!(prop.type() & QDeclarativeProperty::SignalProperty) && !prop.isWritable()) { qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(QString::fromUtf8(property)); - return QDeclarativeMetaProperty(); + return QDeclarativeProperty(); } return prop; } @@ -426,7 +426,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions() for (int ii = 0; ii < d->expressions.count(); ++ii) { QByteArray property = d->expressions.at(ii).first; - QDeclarativeMetaProperty prop = d->property(property); + QDeclarativeProperty prop = d->property(property); if (prop.isValid()) { QDeclarativeAction a; diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp index b26a7e2..6205ab9 100644 --- a/src/declarative/util/qdeclarativespringfollow.cpp +++ b/src/declarative/util/qdeclarativespringfollow.cpp @@ -63,7 +63,7 @@ public: , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01) , modulus(0.0), useMass(false), haveModulus(false), enabled(true), mode(Track), clock(this) {} - QDeclarativeMetaProperty property; + QDeclarativeProperty property; qreal currentValue; qreal sourceValue; qreal maxVelocity; @@ -213,6 +213,7 @@ void QDeclarativeSpringFollowPrivate::stop() /*! \qmlclass SpringFollow QDeclarativeSpringFollow + \since 4.7 \brief The SpringFollow element allows a property to track a value. In example below, \e rect2 will follow \e rect1 moving with a velocity of up to 200: @@ -254,7 +255,7 @@ QDeclarativeSpringFollow::~QDeclarativeSpringFollow() { } -void QDeclarativeSpringFollow::setTarget(const QDeclarativeMetaProperty &property) +void QDeclarativeSpringFollow::setTarget(const QDeclarativeProperty &property) { Q_D(QDeclarativeSpringFollow); d->property = property; diff --git a/src/declarative/util/qdeclarativespringfollow_p.h b/src/declarative/util/qdeclarativespringfollow_p.h index 63d38a4..2ac0d82 100644 --- a/src/declarative/util/qdeclarativespringfollow_p.h +++ b/src/declarative/util/qdeclarativespringfollow_p.h @@ -74,7 +74,7 @@ public: QDeclarativeSpringFollow(QObject *parent=0); ~QDeclarativeSpringFollow(); - virtual void setTarget(const QDeclarativeMetaProperty &); + virtual void setTarget(const QDeclarativeProperty &); qreal sourceValue() const; void setSourceValue(qreal value); diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 3b06e33..1d70d33 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -334,7 +334,7 @@ void QDeclarativeState::cancel() void QDeclarativeAction::deleteFromBinding() { if (fromBinding) { - QDeclarativeMetaPropertyPrivate::setBinding(property, 0); + QDeclarativePropertyPrivate::setBinding(property, 0); fromBinding->destroy(); fromBinding = 0; } @@ -388,7 +388,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit else if (action.event->isRewindable()) action.event->saveCurrentValues(); } else { - action.fromBinding = QDeclarativeMetaPropertyPrivate::binding(action.property); + action.fromBinding = QDeclarativePropertyPrivate::binding(action.property); for (jj = 0; jj < d->revertList.count(); ++jj) { if (d->revertList.at(jj).property == action.property) { @@ -437,7 +437,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit if (!found) { QVariant cur = d->revertList.at(ii).property.read(); QDeclarativeAbstractBinding *delBinding = - QDeclarativeMetaPropertyPrivate::setBinding(d->revertList.at(ii).property, 0); + QDeclarativePropertyPrivate::setBinding(d->revertList.at(ii).property, 0); if (delBinding) delBinding->destroy(); diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h index 4a62481..0c6e7a3 100644 --- a/src/declarative/util/qdeclarativestate_p.h +++ b/src/declarative/util/qdeclarativestate_p.h @@ -43,7 +43,7 @@ #define QDECLARATIVESTATE_H #include <qdeclarative.h> -#include <qdeclarativemetaproperty.h> +#include <qdeclarativeproperty.h> #include <QtCore/qobject.h> QT_BEGIN_HEADER @@ -53,7 +53,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeActionEvent; +class QDeclarativeAbstractBinding; class QDeclarativeBinding; +class QDeclarativeExpression; class Q_DECLARATIVE_EXPORT QDeclarativeAction { public: @@ -65,7 +67,7 @@ public: bool reverseEvent:1; bool deletableToBinding:1; - QDeclarativeMetaProperty property; + QDeclarativeProperty property; QVariant fromValue; QVariant toValue; diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h index 6b32f04..6f52219 100644 --- a/src/declarative/util/qdeclarativestate_p_p.h +++ b/src/declarative/util/qdeclarativestate_p_p.h @@ -58,7 +58,7 @@ #include "qdeclarativeanimation_p_p.h" #include "qdeclarativetransitionmanager_p_p.h" -#include <qdeclarativemetaproperty_p.h> +#include <qdeclarativeproperty_p.h> #include <qdeclarativeguard_p.h> #include <private/qobject_p.h> @@ -77,7 +77,7 @@ public: event = a.event; if (state == StartState) { value = a.fromValue; - binding = QDeclarativeMetaPropertyPrivate::binding(property); + binding = QDeclarativePropertyPrivate::binding(property); reverseEvent = true; } else { value = a.toValue; @@ -86,7 +86,7 @@ public: } } - QDeclarativeMetaProperty property; + QDeclarativeProperty property; QVariant value; QDeclarativeAbstractBinding *binding; QObject *specifiedObject; @@ -139,7 +139,7 @@ public: QDeclarativeTransitionManager transitionManager; SimpleActionList revertList; - QList<QDeclarativeMetaProperty> reverting; + QList<QDeclarativeProperty> reverting; QString extends; mutable bool inState; QDeclarativeStateGroup *group; diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp index 1a7c256..083e87d 100644 --- a/src/declarative/util/qdeclarativestategroup.cpp +++ b/src/declarative/util/qdeclarativestategroup.cpp @@ -84,6 +84,7 @@ public: /*! \qmlclass StateGroup QDeclarativeStateGroup + \since 4.7 \brief The StateGroup element provides state support for non-Item elements. Item (and all dervied elements) provides built in support for states and transitions @@ -406,7 +407,7 @@ void QDeclarativeStateGroupPrivate::setCurrentStateInternal(const QString &state } if (oldState == 0 || newState == 0) { - if (!nullState) { nullState = new QDeclarativeState; QDeclarativeGraphics_setParent_noEvent(nullState, q); } + if (!nullState) { nullState = new QDeclarativeState; QDeclarative_setParent_noEvent(nullState, q); } if (!oldState) oldState = nullState; if (!newState) newState = nullState; } diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index 98edf85..cea9ad7 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -48,6 +48,7 @@ #include <qdeclarativeanchors_p_p.h> #include <qdeclarativeitem_p.h> #include <qdeclarativeguard_p.h> +#include <qdeclarativenullablevalue_p_p.h> #include <QtCore/qdebug.h> #include <QtGui/qgraphicsitem.h> @@ -62,7 +63,7 @@ class QDeclarativeParentChangePrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QDeclarativeParentChange) public: QDeclarativeParentChangePrivate() : target(0), parent(0), origParent(0), origStackBefore(0), - rewindParent(0), rewindStackBefore(0) {} + rewindParent(0), rewindStackBefore(0) {} QDeclarativeItem *target; QDeclarativeItem *parent; @@ -71,6 +72,13 @@ public: QDeclarativeItem *rewindParent; QDeclarativeItem *rewindStackBefore; + QDeclarativeNullableValue<qreal> x; + QDeclarativeNullableValue<qreal> y; + QDeclarativeNullableValue<qreal> width; + QDeclarativeNullableValue<qreal> height; + QDeclarativeNullableValue<qreal> scale; + QDeclarativeNullableValue<qreal> rotation; + void doChange(QDeclarativeItem *targetParent, QDeclarativeItem *stackBefore = 0); }; @@ -173,6 +181,120 @@ QDeclarativeParentChange::~QDeclarativeParentChange() { } +qreal QDeclarativeParentChange::x() const +{ + Q_D(const QDeclarativeParentChange); + return d->x.isNull ? qreal(0.) : d->x.value; +} + +void QDeclarativeParentChange::setX(qreal x) +{ + Q_D(QDeclarativeParentChange); + d->x = x; +} + +bool QDeclarativeParentChange::xIsSet() const +{ + Q_D(const QDeclarativeParentChange); + return d->x.isValid(); +} + +qreal QDeclarativeParentChange::y() const +{ + Q_D(const QDeclarativeParentChange); + return d->y.isNull ? qreal(0.) : d->y.value; +} + +void QDeclarativeParentChange::setY(qreal y) +{ + Q_D(QDeclarativeParentChange); + d->y = y; +} + +bool QDeclarativeParentChange::yIsSet() const +{ + Q_D(const QDeclarativeParentChange); + return d->y.isValid(); +} + +qreal QDeclarativeParentChange::width() const +{ + Q_D(const QDeclarativeParentChange); + return d->width.isNull ? qreal(0.) : d->width.value; +} + +void QDeclarativeParentChange::setWidth(qreal width) +{ + Q_D(QDeclarativeParentChange); + d->width = width; +} + +bool QDeclarativeParentChange::widthIsSet() const +{ + Q_D(const QDeclarativeParentChange); + return d->width.isValid(); +} + +qreal QDeclarativeParentChange::height() const +{ + Q_D(const QDeclarativeParentChange); + return d->height.isNull ? qreal(0.) : d->height.value; +} + +void QDeclarativeParentChange::setHeight(qreal height) +{ + Q_D(QDeclarativeParentChange); + d->height = height; +} + +bool QDeclarativeParentChange::heightIsSet() const +{ + Q_D(const QDeclarativeParentChange); + return d->height.isValid(); +} + +qreal QDeclarativeParentChange::scale() const +{ + Q_D(const QDeclarativeParentChange); + return d->scale.isNull ? qreal(1.) : d->scale.value; +} + +void QDeclarativeParentChange::setScale(qreal scale) +{ + Q_D(QDeclarativeParentChange); + d->scale = scale; +} + +bool QDeclarativeParentChange::scaleIsSet() const +{ + Q_D(const QDeclarativeParentChange); + return d->scale.isValid(); +} + +qreal QDeclarativeParentChange::rotation() const +{ + Q_D(const QDeclarativeParentChange); + return d->rotation.isNull ? qreal(0.) : d->rotation.value; +} + +void QDeclarativeParentChange::setRotation(qreal rotation) +{ + Q_D(QDeclarativeParentChange); + d->rotation = rotation; +} + +bool QDeclarativeParentChange::rotationIsSet() const +{ + Q_D(const QDeclarativeParentChange); + return d->rotation.isValid(); +} + +QDeclarativeItem *QDeclarativeParentChange::originalParent() const +{ + Q_D(const QDeclarativeParentChange); + return d->origParent; +} + /*! \qmlproperty Item ParentChange::target This property holds the item to be reparented @@ -213,10 +335,43 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() if (!d->target || !d->parent) return ActionList(); + ActionList actions; + QDeclarativeAction a; a.event = this; + actions << a; - return ActionList() << a; + if (d->x.isValid()) { + QDeclarativeAction xa(d->target, QLatin1String("x"), x()); + actions << xa; + } + + if (d->y.isValid()) { + QDeclarativeAction ya(d->target, QLatin1String("y"), y()); + actions << ya; + } + + if (d->scale.isValid()) { + QDeclarativeAction sa(d->target, QLatin1String("scale"), scale()); + actions << sa; + } + + if (d->rotation.isValid()) { + QDeclarativeAction ra(d->target, QLatin1String("rotation"), rotation()); + actions << ra; + } + + if (d->width.isValid()) { + QDeclarativeAction wa(d->target, QLatin1String("width"), width()); + actions << wa; + } + + if (d->height.isValid()) { + QDeclarativeAction ha(d->target, QLatin1String("height"), height()); + actions << ha; + } + + return actions; } class AccessibleFxItem : public QDeclarativeItem @@ -661,19 +816,19 @@ QList<QDeclarativeAction> QDeclarativeAnchorChanges::extraActions() if (d->target) { QDeclarativeAction a; a.fromValue = d->fromX; - a.property = QDeclarativeMetaProperty(d->target, QLatin1String("x")); + a.property = QDeclarativeProperty(d->target, QLatin1String("x")); extra << a; a.fromValue = d->fromY; - a.property = QDeclarativeMetaProperty(d->target, QLatin1String("y")); + a.property = QDeclarativeProperty(d->target, QLatin1String("y")); extra << a; a.fromValue = d->fromWidth; - a.property = QDeclarativeMetaProperty(d->target, QLatin1String("width")); + a.property = QDeclarativeProperty(d->target, QLatin1String("width")); extra << a; a.fromValue = d->fromHeight; - a.property = QDeclarativeMetaProperty(d->target, QLatin1String("height")); + a.property = QDeclarativeProperty(d->target, QLatin1String("height")); extra << a; } diff --git a/src/declarative/util/qdeclarativestateoperations_p.h b/src/declarative/util/qdeclarativestateoperations_p.h index 9204a58..dd4248023 100644 --- a/src/declarative/util/qdeclarativestateoperations_p.h +++ b/src/declarative/util/qdeclarativestateoperations_p.h @@ -45,7 +45,7 @@ #include "qdeclarativestate_p.h" #include <qdeclarativeitem.h> -#include "private/qdeclarativeanchors_p.h" +#include <private/qdeclarativeanchors_p.h> #include <qdeclarativescriptstring.h> QT_BEGIN_HEADER @@ -62,6 +62,12 @@ class Q_DECLARATIVE_EXPORT QDeclarativeParentChange : public QDeclarativeStateOp Q_PROPERTY(QDeclarativeItem *target READ object WRITE setObject) Q_PROPERTY(QDeclarativeItem *parent READ parent WRITE setParent) + Q_PROPERTY(qreal x READ x WRITE setX) + Q_PROPERTY(qreal y READ y WRITE setY) + Q_PROPERTY(qreal width READ width WRITE setWidth) + Q_PROPERTY(qreal height READ height WRITE setHeight) + Q_PROPERTY(qreal scale READ scale WRITE setScale) + Q_PROPERTY(qreal rotation READ rotation WRITE setRotation) public: QDeclarativeParentChange(QObject *parent=0); ~QDeclarativeParentChange(); @@ -72,6 +78,32 @@ public: QDeclarativeItem *parent() const; void setParent(QDeclarativeItem *); + QDeclarativeItem *originalParent() const; + + qreal x() const; + void setX(qreal x); + bool xIsSet() const; + + qreal y() const; + void setY(qreal y); + bool yIsSet() const; + + qreal width() const; + void setWidth(qreal width); + bool widthIsSet() const; + + qreal height() const; + void setHeight(qreal height); + bool heightIsSet() const; + + qreal scale() const; + void setScale(qreal scale); + bool scaleIsSet() const; + + qreal rotation() const; + void setRotation(qreal rotation); + bool rotationIsSet() const; + virtual ActionList actions(); virtual void saveOriginals(); diff --git a/src/declarative/util/qdeclarativesystempalette.cpp b/src/declarative/util/qdeclarativesystempalette.cpp index 1e00f22..d819c27 100644 --- a/src/declarative/util/qdeclarativesystempalette.cpp +++ b/src/declarative/util/qdeclarativesystempalette.cpp @@ -58,6 +58,7 @@ public: /*! \qmlclass SystemPalette QDeclarativeSystemPalette + \since 4.7 \ingroup group_utility \brief The SystemPalette item gives access to the Qt palettes. \sa QPalette diff --git a/src/declarative/util/qdeclarativetimer.cpp b/src/declarative/util/qdeclarativetimer.cpp index 89c461b..d7e02b1 100644 --- a/src/declarative/util/qdeclarativetimer.cpp +++ b/src/declarative/util/qdeclarativetimer.cpp @@ -70,6 +70,7 @@ public: /*! \qmlclass Timer QDeclarativeTimer + \since 4.7 \brief The Timer item triggers a handler at a specified interval. A timer can be used to trigger an action either once, or repeatedly diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index 3482814..ac07b10 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -148,7 +148,7 @@ void QDeclarativeTransition::setReversed(bool r) } void QDeclarativeTransition::prepare(QDeclarativeStateOperation::ActionList &actions, - QList<QDeclarativeMetaProperty> &after, + QList<QDeclarativeProperty> &after, QDeclarativeTransitionManager *endState) { Q_D(QDeclarativeTransition); diff --git a/src/declarative/util/qdeclarativetransition_p.h b/src/declarative/util/qdeclarativetransition_p.h index 96448b8..861111a 100644 --- a/src/declarative/util/qdeclarativetransition_p.h +++ b/src/declarative/util/qdeclarativetransition_p.h @@ -85,7 +85,7 @@ public: QDeclarativeListProperty<QDeclarativeAbstractAnimation> animations(); void prepare(QDeclarativeStateOperation::ActionList &actions, - QList<QDeclarativeMetaProperty> &after, + QList<QDeclarativeProperty> &after, QDeclarativeTransitionManager *end); void setReversed(bool r); diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp index 6429dab..e1143fa 100644 --- a/src/declarative/util/qdeclarativetransitionmanager.cpp +++ b/src/declarative/util/qdeclarativetransitionmanager.cpp @@ -45,7 +45,7 @@ #include <qdeclarativebinding_p.h> #include <qdeclarativeglobal_p.h> -#include <qdeclarativemetaproperty_p.h> +#include <qdeclarativeproperty_p.h> QT_BEGIN_NAMESPACE @@ -85,7 +85,7 @@ void QDeclarativeTransitionManager::complete() d->applyBindings(); for (int ii = 0; ii < d->completeList.count(); ++ii) { - const QDeclarativeMetaProperty &prop = d->completeList.at(ii).property; + const QDeclarativeProperty &prop = d->completeList.at(ii).property; prop.write(d->completeList.at(ii).value); } @@ -99,7 +99,7 @@ void QDeclarativeTransitionManagerPrivate::applyBindings() { foreach(const QDeclarativeAction &action, bindingsList) { if (action.toBinding) { - QDeclarativeMetaPropertyPrivate::setBinding(action.property, action.toBinding); + QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding); } else if (action.event) { if (action.reverseEvent) action.event->reverse(); @@ -123,7 +123,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> & if (action.toBinding) d->bindingsList << action; if (action.fromBinding) - QDeclarativeMetaPropertyPrivate::setBinding(action.property, 0); // Disable current binding + QDeclarativePropertyPrivate::setBinding(action.property, 0); // Disable current binding if (action.event && action.event->changesBindings()) { //### assume isReversable()? d->bindingsList << action; if (action.reverseEvent) @@ -150,9 +150,9 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> & for (int ii = 0; ii < applyList.size(); ++ii) { const QDeclarativeAction &action = applyList.at(ii); if (action.toBinding) { - QDeclarativeMetaPropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } else if (!action.event) { - QDeclarativeMetaPropertyPrivate::write(action.property, action.toValue, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } else if (action.event->isReversable()) { if (action.reverseEvent) action.event->reverse(); @@ -167,7 +167,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> & QDeclarativeAction *action = &applyList[ii]; if (action->event) continue; - const QDeclarativeMetaProperty &prop = action->property; + const QDeclarativeProperty &prop = action->property; if (action->toBinding || !action->toValue.isValid()) { //### is this always right (used for exta actions) action->toValue = prop.read(); } @@ -191,14 +191,14 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> & } if (action.toBinding) - QDeclarativeMetaPropertyPrivate::setBinding(action.property, 0); // Make sure this is disabled during the transition + QDeclarativePropertyPrivate::setBinding(action.property, 0); // Make sure this is disabled during the transition - QDeclarativeMetaPropertyPrivate::write(action.property, action.fromValue, QDeclarativeMetaPropertyPrivate::BypassInterceptor | QDeclarativeMetaPropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(action.property, action.fromValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } } if (transition) { - QList<QDeclarativeMetaProperty> touched; + QList<QDeclarativeProperty> touched; d->transition = transition; d->transition->prepare(applyList, touched, this); @@ -267,7 +267,7 @@ void QDeclarativeTransitionManager::cancel() for(int i = 0; i < d->bindingsList.count(); ++i) { QDeclarativeAction action = d->bindingsList[i]; if (action.toBinding && action.deletableToBinding) { - QDeclarativeMetaPropertyPrivate::setBinding(action.property, 0); + QDeclarativePropertyPrivate::setBinding(action.property, 0); action.toBinding->destroy(); action.toBinding = 0; action.deletableToBinding = false; diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp index ecaa607c..2b8c7de 100644 --- a/src/declarative/util/qdeclarativeutilmodule.cpp +++ b/src/declarative/util/qdeclarativeutilmodule.cpp @@ -45,7 +45,7 @@ #include "qdeclarativeanimation_p_p.h" #include "qdeclarativebehavior_p.h" #include "qdeclarativebind_p.h" -#include "qdeclarativeconnection_p.h" +#include "qdeclarativeconnections_p.h" #include "qdeclarativedatetimeformatter_p.h" #include "qdeclarativeeasefollow_p.h" #include "qdeclarativefontloader_p.h" @@ -80,7 +80,7 @@ void QDeclarativeUtilModule::defineModule() QML_REGISTER_TYPE(Qt,4,6,Behavior,QDeclarativeBehavior); QML_REGISTER_TYPE(Qt,4,6,Binding,QDeclarativeBind); QML_REGISTER_TYPE(Qt,4,6,ColorAnimation,QDeclarativeColorAnimation); - QML_REGISTER_TYPE(Qt,4,6,Connection,QDeclarativeConnection); + QML_REGISTER_TYPE(Qt,4,6,Connections,QDeclarativeConnections); QML_REGISTER_TYPE(Qt,4,6,DateTimeFormatter,QDeclarativeDateTimeFormatter); QML_REGISTER_TYPE(Qt,4,6,EaseFollow,QDeclarativeEaseFollow);; QML_REGISTER_TYPE(Qt,4,6,FontLoader,QDeclarativeFontLoader); @@ -90,6 +90,7 @@ void QDeclarativeUtilModule::defineModule() QML_REGISTER_TYPE(Qt,4,6,Package,QDeclarativePackage); QML_REGISTER_TYPE(Qt,4,6,ParallelAnimation,QDeclarativeParallelAnimation); QML_REGISTER_TYPE(Qt,4,6,ParentAction,QDeclarativeParentAction); + QML_REGISTER_TYPE(Qt,4,6,ParentAnimation,QDeclarativeParentAnimation); QML_REGISTER_TYPE(Qt,4,6,ParentChange,QDeclarativeParentChange); QML_REGISTER_TYPE(Qt,4,6,PauseAnimation,QDeclarativePauseAnimation); QML_REGISTER_TYPE(Qt,4,6,PropertyAction,QDeclarativePropertyAction); @@ -117,4 +118,5 @@ void QDeclarativeUtilModule::defineModule() QML_REGISTER_CUSTOM_TYPE(Qt, 4,6, ListModel, QDeclarativeListModel, QDeclarativeListModelParser); QML_REGISTER_CUSTOM_TYPE(Qt, 4,6, PropertyChanges, QDeclarativePropertyChanges, QDeclarativePropertyChangesParser); + QML_REGISTER_CUSTOM_TYPE(Qt, 4,6, Connections, QDeclarativeConnections, QDeclarativeConnectionsParser); } diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 386df46..162a669 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -709,8 +709,24 @@ void QDeclarativeXmlListModel::reload() d->qmlXmlQuery.abort(); d->queryId = -1; - if (d->size < 0) + int count = d->size; + if (count < 0) d->size = 0; + bool hasKeys = false; + for (int i=0; i<d->roleObjects.count(); i++) { + if (d->roleObjects[i]->isKey()) { + hasKeys = true; + break; + } + } + if (!hasKeys) { + d->data.clear(); + d->size = 0; + if (count > 0) { + emit itemsRemoved(0, count); + emit countChanged(); + } + } if (d->src.isEmpty() && d->xml.isEmpty()) return; @@ -782,9 +798,10 @@ void QDeclarativeXmlListModel::queryCompleted(int id, int size) d->data = d->qmlXmlQuery.modelData(); QList<QDeclarativeXmlListRange> removed = d->qmlXmlQuery.removedItemRanges(); + QList<QDeclarativeXmlListRange> inserted = d->qmlXmlQuery.insertedItemRanges(); + for (int i=0; i<removed.count(); i++) emit itemsRemoved(removed[i].first, removed[i].second); - QList<QDeclarativeXmlListRange> inserted = d->qmlXmlQuery.insertedItemRanges(); for (int i=0; i<inserted.count(); i++) emit itemsInserted(inserted[i].first, inserted[i].second); diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h index 132a53c..f0ad4b8 100644 --- a/src/declarative/util/qdeclarativexmllistmodel_p.h +++ b/src/declarative/util/qdeclarativexmllistmodel_p.h @@ -47,7 +47,7 @@ #include <QtCore/qurl.h> -#include "../3rdparty/qlistmodelinterface_p.h" +#include <private/qlistmodelinterface_p.h> QT_BEGIN_HEADER diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index 610eb3f..198e9e5 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -5,7 +5,7 @@ SOURCES += \ $$PWD/qdeclarativeview.cpp \ $$PWD/qfxperf.cpp \ $$PWD/qperformancelog.cpp \ - $$PWD/qdeclarativeconnection.cpp \ + $$PWD/qdeclarativeconnections.cpp \ $$PWD/qdeclarativepackage.cpp \ $$PWD/qdeclarativeanimation.cpp \ $$PWD/qdeclarativesystempalette.cpp \ @@ -37,7 +37,7 @@ HEADERS += \ $$PWD/qdeclarativeview.h \ $$PWD/qfxperf_p_p.h \ $$PWD/qperformancelog_p_p.h \ - $$PWD/qdeclarativeconnection_p.h \ + $$PWD/qdeclarativeconnections_p.h \ $$PWD/qdeclarativepackage_p.h \ $$PWD/qdeclarativeanimation_p.h \ $$PWD/qdeclarativeanimation_p_p.h \ diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm index bdcb872..8af0d2b 100644 --- a/src/gui/dialogs/qcolordialog_mac.mm +++ b/src/gui/dialogs/qcolordialog_mac.mm @@ -96,6 +96,7 @@ QT_USE_NAMESPACE - (void)finishOffWithCode:(NSInteger)result; - (void)showColorPanel; - (void)exec; +- (void)setResultSet:(BOOL)result; @end @implementation QCocoaColorPanelDelegate @@ -158,6 +159,11 @@ QT_USE_NAMESPACE [super dealloc]; } +- (void)setResultSet:(BOOL)result +{ + mResultSet = result; +} + - (BOOL)windowShouldClose:(id)window { Q_UNUSED(window); @@ -320,7 +326,7 @@ QT_USE_NAMESPACE } else { mPriv->colorDialog()->accept(); } - } + } } } @@ -433,7 +439,7 @@ void QColorDialogPrivate::openCocoaColorPanel(const QColor &initial, priv:this]; [colorPanel setDelegate:static_cast<QCocoaColorPanelDelegate *>(delegate)]; } - + [delegate setResultSet:false]; setCocoaPanelColor(initial); [static_cast<QCocoaColorPanelDelegate *>(delegate) showColorPanel]; } diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index 56580a9..a4bf15d 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -989,34 +989,24 @@ void QFontDialog::open(QObject *receiver, const char *member) void QFontDialog::setVisible(bool visible) { Q_D(QFontDialog); - if (visible) - d->selectedFont = QFont(); - -#if defined(Q_WS_MAC) - bool isCurrentlyVisible = (isVisible() || d->delegate); - - if (!visible == !isCurrentlyVisible) - return; - if (visible) { - if (!(d->opts & DontUseNativeDialog) && QFontDialogPrivate::sharedFontPanelAvailable) { - d->delegate = QFontDialogPrivate::openCocoaFontPanel( - currentFont(), parentWidget(), windowTitle(), options(), d); - QFontDialogPrivate::sharedFontPanelAvailable = false; - return; - } - - setWindowFlags(windowModality() == Qt::WindowModal ? Qt::Sheet : DefaultWindowFlags); - } else { - if (d->delegate) { - QFontDialogPrivate::closeCocoaFontPanel(d->delegate); - d->delegate = 0; - QFontDialogPrivate::sharedFontPanelAvailable = true; + if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden)) return; + } else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) + return; +#ifdef Q_WS_MAC + if (d->canBeNativeDialog()){ + if (d->setVisible_sys(visible)){ + d->nativeDialogInUse = true; + // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below + // updates the state correctly, but skips showing the non-native version: + setAttribute(Qt::WA_DontShowOnScreen, true); + } else { + d->nativeDialogInUse = false; + setAttribute(Qt::WA_DontShowOnScreen, false); } } -#endif - +#endif // Q_WS_MAC QDialog::setVisible(visible); } @@ -1032,11 +1022,14 @@ void QFontDialog::done(int result) Q_D(QFontDialog); QDialog::done(result); if (result == Accepted) { - d->selectedFont = currentFont(); + // We check if this is the same font we had before, if so we emit currentFontChanged + QFont selectedFont = currentFont(); + if(selectedFont != d->selectedFont) + emit(currentFontChanged(selectedFont)); + d->selectedFont = selectedFont; emit fontSelected(d->selectedFont); - } else { + } else d->selectedFont = QFont(); - } if (d->receiverToDisconnectOnClose) { disconnect(this, SIGNAL(fontSelected(QFont)), d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose); @@ -1045,6 +1038,23 @@ void QFontDialog::done(int result) d->memberToDisconnectOnClose.clear(); } +#ifdef Q_WS_MAC +bool QFontDialogPrivate::canBeNativeDialog() +{ + Q_Q(QFontDialog); + if (nativeDialogInUse) + return true; + if (q->testAttribute(Qt::WA_DontShowOnScreen)) + return false; + if (opts & QFontDialog::DontUseNativeDialog) + return false; + + QLatin1String staticName(QFontDialog::staticMetaObject.className()); + QLatin1String dynamicName(q->metaObject()->className()); + return (staticName == dynamicName); +} +#endif // Q_WS_MAC + /*! \fn QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget* parent, const char* name) \since 4.5 diff --git a/src/gui/dialogs/qfontdialog.h b/src/gui/dialogs/qfontdialog.h index e6f209e..6035a3a 100644 --- a/src/gui/dialogs/qfontdialog.h +++ b/src/gui/dialogs/qfontdialog.h @@ -131,6 +131,9 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_styleHighlighted(int)) Q_PRIVATE_SLOT(d_func(), void _q_sizeHighlighted(int)) Q_PRIVATE_SLOT(d_func(), void _q_updateSample()) +#if defined(Q_WS_MAC) + Q_PRIVATE_SLOT(d_func(), void _q_macRunNativeAppModalPanel()) +#endif }; Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions) diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index 68f5f00..67d32b8 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -49,6 +49,7 @@ #include <private/qfontengine_p.h> #include <private/qt_cocoa_helpers_mac_p.h> #include <private/qt_mac_p.h> +#include <qabstracteventdispatcher.h> #include <qdebug.h> #import <AppKit/AppKit.h> #import <Foundation/Foundation.h> @@ -372,7 +373,12 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) [NSApp endModalSession:mModalSession]; mModalSession = 0; } - + // Hack alert! + // Since this code path was never intended to be followed when starting from exec + // we need to force the dialog to communicate the new font, otherwise the signal + // won't get emitted. + if(code == NSOKButton) + mPriv->sampleEdit->setFont([self qtFont]); mPriv->done((code == NSOKButton) ? QDialog::Accepted : QDialog::Rejected); } else { [NSApp stopModalWithCode:code]; @@ -567,7 +573,6 @@ void *QFontDialogPrivate::openCocoaFontPanel(const QFont &initial, [ourPanel makeKeyAndOrderFront:ourPanel]; } } - return delegate; } @@ -640,6 +645,145 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font) [static_cast<QCocoaFontPanelDelegate *>(delegate) setQtFont:font]; } +void *QFontDialogPrivate::_q_constructNativePanel() +{ + QMacCocoaAutoReleasePool pool; + + bool sharedFontPanelExisted = [NSFontPanel sharedFontPanelExists]; + NSFontPanel *sharedFontPanel = [NSFontPanel sharedFontPanel]; + [sharedFontPanel setHidesOnDeactivate:false]; + + // hack to ensure that QCocoaApplication's validModesForFontPanel: + // implementation is honored + if (!sharedFontPanelExisted) { + [sharedFontPanel makeKeyAndOrderFront:sharedFontPanel]; + [sharedFontPanel close]; + } + + NSPanel *ourPanel = 0; + NSView *stolenContentView = 0; + NSButton *okButton = 0; + NSButton *cancelButton = 0; + + CGFloat dialogExtraWidth = 0.0; + CGFloat dialogExtraHeight = 0.0; + + // compute dialogExtra{Width,Height} + dialogExtraWidth = 2.0 * DialogSideMargin; + dialogExtraHeight = DialogTopMargin + ButtonTopMargin + ButtonMinHeight + + ButtonBottomMargin; + + // compute initial contents rectangle + NSRect contentRect = [sharedFontPanel contentRectForFrameRect:[sharedFontPanel frame]]; + contentRect.size.width += dialogExtraWidth; + contentRect.size.height += dialogExtraHeight; + + // create the new panel + ourPanel = [[NSPanel alloc] initWithContentRect:contentRect + styleMask:StyleMask + backing:NSBackingStoreBuffered + defer:YES]; + [ourPanel setReleasedWhenClosed:YES]; + + stolenContentView = [sharedFontPanel contentView]; + + // steal the font panel's contents view + [stolenContentView retain]; + [sharedFontPanel setContentView:0]; + + { + // create a new content view and add the stolen one as a subview + NSRect frameRect = { { 0.0, 0.0 }, { 0.0, 0.0 } }; + NSView *ourContentView = [[NSView alloc] initWithFrame:frameRect]; + [ourContentView addSubview:stolenContentView]; + + // create OK and Cancel buttons and add these as subviews + okButton = macCreateButton("&OK", ourContentView); + cancelButton = macCreateButton("Cancel", ourContentView); + + [ourPanel setContentView:ourContentView]; + [ourPanel setDefaultButtonCell:[okButton cell]]; + } + // create a delegate and set it + QCocoaFontPanelDelegate *delegate = + [[QCocoaFontPanelDelegate alloc] initWithFontPanel:sharedFontPanel + stolenContentView:stolenContentView + okButton:okButton + cancelButton:cancelButton + priv:this + extraWidth:dialogExtraWidth + extraHeight:dialogExtraHeight]; + [ourPanel setDelegate:delegate]; + [[NSFontManager sharedFontManager] setDelegate:delegate]; +#ifdef QT_MAC_USE_COCOA + [[NSFontManager sharedFontManager] setTarget:delegate]; +#endif + setFont(delegate, QApplication::font()); + + { + // hack to get correct initial layout + NSRect frameRect = [ourPanel frame]; + frameRect.size.width += 1.0; + [ourPanel setFrame:frameRect display:NO]; + frameRect.size.width -= 1.0; + frameRect.size = [delegate windowWillResize:ourPanel toSize:frameRect.size]; + [ourPanel setFrame:frameRect display:NO]; + [ourPanel center]; + } + NSString *title = @"Select font"; + [ourPanel setTitle:title]; + + [delegate setModalSession:[NSApp beginModalSessionForWindow:ourPanel]]; + return delegate; +} + +void QFontDialogPrivate::mac_nativeDialogModalHelp() +{ + // Copied from QFileDialogPrivate + // Do a queued meta-call to open the native modal dialog so it opens after the new + // event loop has started to execute (in QDialog::exec). Using a timer rather than + // a queued meta call is intentional to ensure that the call is only delivered when + // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not + // running (which is the case if e.g a top-most QEventLoop has been + // interrupted, and the second-most event loop has not yet been reactivated (regardless + // if [NSApp run] is still on the stack)), showing a native modal dialog will fail. + if (nativeDialogInUse) { + Q_Q(QFontDialog); + QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel())); + } +} + +// The problem with the native font dialog is that OS X does not +// offer a proper dialog, but a panel (i.e. without Ok and Cancel buttons). +// This means we need to "construct" a native dialog by taking the panel +// and "adding" the buttons. +void QFontDialogPrivate::_q_macRunNativeAppModalPanel() +{ + QBoolBlocker nativeDialogOnTop(QApplicationPrivate::native_modal_dialog_active); + Q_Q(QFontDialog); + QCocoaFontPanelDelegate *delegate = (QCocoaFontPanelDelegate *)_q_constructNativePanel(); + NSWindow *ourPanel = [delegate actualPanel]; + [ourPanel retain]; + int rval = [NSApp runModalForWindow:ourPanel]; + QAbstractEventDispatcher::instance()->interrupt(); + [ourPanel release]; + [delegate cleanUpAfterMyself]; + [delegate release]; + bool isOk = (rval == NSOKButton); + if(isOk) + rescode = QDialog::Accepted; + else + rescode = QDialog::Rejected; +} + +bool QFontDialogPrivate::setVisible_sys(bool visible) +{ + Q_Q(QFontDialog); + if (!visible == q->isHidden()) + return false; + return visible; +} + QT_END_NAMESPACE #endif diff --git a/src/gui/dialogs/qfontdialog_p.h b/src/gui/dialogs/qfontdialog_p.h index ca2b10b..7654a80 100644 --- a/src/gui/dialogs/qfontdialog_p.h +++ b/src/gui/dialogs/qfontdialog_p.h @@ -152,6 +152,12 @@ public: inline QFontDialog *fontDialog() { return q_func(); } void *delegate; + bool nativeDialogInUse; + bool canBeNativeDialog(); + bool setVisible_sys(bool visible); + void *_q_constructNativePanel(); + void _q_macRunNativeAppModalPanel(); + void mac_nativeDialogModalHelp(); static bool sharedFontPanelAvailable; #endif diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index ca20101..5735cd6 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -414,12 +414,6 @@ /*! \enum QGraphicsItem::GraphicsItemChange - ItemVisibleHasChanged, - ItemEnabledHasChanged, - ItemSelectedHasChanged, - ItemParentHasChanged, - ItemSceneHasChanged - This enum describes the state changes that are notified by QGraphicsItem::itemChange(). The notifications are sent as the state changes, and in some cases, adjustments can be made (see the documentation @@ -647,9 +641,16 @@ are children of a modal panel are not blocked. The values are: - \value NonModal The panel is not modal and does not block input to other panels. - \value PanelModal The panel is modal to a single item hierarchy and blocks input to its parent pane, all grandparent panels, and all siblings of its parent and grandparent panels. - \value SceneModal The window is modal to the entire scene and blocks input to all panels. + + \value NonModal The panel is not modal and does not block input to + other panels. This is the default value for panels. + + \value PanelModal The panel is modal to a single item hierarchy + and blocks input to its parent pane, all grandparent panels, and + all siblings of its parent and grandparent panels. + + \value SceneModal The window is modal to the entire scene and + blocks input to all panels. \sa QGraphicsItem::setPanelModality(), QGraphicsItem::panelModality(), QGraphicsItem::ItemIsPanel */ diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index a059a77..4c4bfaf 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -156,8 +156,8 @@ public: needSortChildren(0), allChildrenDirty(0), fullUpdatePending(0), - flags(0), dirtyChildrenBoundingRect(1), + flags(0), paintedViewBoundingRectsNeedRepaint(0), dirtySceneTransform(1), geometryChanged(1), @@ -474,11 +474,11 @@ public: quint32 inSetPosHelper : 1; quint32 needSortChildren : 1; quint32 allChildrenDirty : 1; + quint32 fullUpdatePending : 1; + quint32 dirtyChildrenBoundingRect : 1; // Packed 32 bits - quint32 fullUpdatePending : 1; quint32 flags : 17; - quint32 dirtyChildrenBoundingRect : 1; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; quint32 geometryChanged : 1; @@ -492,10 +492,10 @@ public: quint32 sceneTransformTranslateOnly : 1; quint32 notifyBoundingRectChanged : 1; quint32 notifyInvalidated : 1; - - // New 32 bits quint32 mouseSetsFocus : 1; quint32 explicitActivate : 1; + + // New 32 bits quint32 wantsActive : 1; quint32 holesInSiblingIndex : 1; quint32 sequentialOrdering : 1; @@ -503,6 +503,7 @@ public: quint32 scenePosDescendants : 1; quint32 pendingPolish : 1; quint32 mayHaveChildWithGraphicsEffect : 1; + quint32 padding : 25; // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index aaae88e..365afdd 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -693,6 +693,18 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) --selectionChanging; if (!selectionChanging && selectedItems.size() != oldSelectedItemsSize) emit q->selectionChanged(); + + QHash<QGesture *, QGraphicsObject *>::iterator it; + for (it = gestureTargets.begin(); it != gestureTargets.end();) { + if (it.value() == item) + it = gestureTargets.erase(it); + else + ++it; + } + QGraphicsObject *dummy = static_cast<QGraphicsObject *>(item); + cachedTargetItems.removeOne(dummy); + cachedItemGestures.remove(dummy); + cachedAlreadyDeliveredGestures.remove(dummy); } /*! @@ -801,7 +813,8 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, // do it ourselves. if (item) { for (int i = 0; i < views.size(); ++i) - views.at(i)->inputContext()->reset(); + if (views.at(i)->inputContext()) + views.at(i)->inputContext()->reset(); } } #endif //QT_NO_IM @@ -4680,7 +4693,8 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * if (widget) item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect); viewBoundingRect.adjust(-1, -1, 1, 1); - drawItem = exposedRegion ? exposedRegion->intersects(viewBoundingRect) : !viewBoundingRect.isEmpty(); + drawItem = exposedRegion ? exposedRegion->intersects(viewBoundingRect) + : !viewBoundingRect.normalized().isEmpty(); if (!drawItem) { if (!itemHasChildren) return; @@ -5900,45 +5914,51 @@ void QGraphicsScenePrivate::leaveModal(QGraphicsItem *panel) dispatchHoverEvent(&hoverEvent); } -void QGraphicsScenePrivate::getGestureTargets(const QSet<QGesture *> &gestures, - QWidget *viewport, - QMap<Qt::GestureType, QGesture *> *conflictedGestures, - QList<QList<QGraphicsObject *> > *conflictedItems, - QHash<QGesture *, QGraphicsObject *> *normalGestures) +void QGraphicsScenePrivate::gestureTargetsAtHotSpots(const QSet<QGesture *> &gestures, + Qt::GestureFlag flag, + QHash<QGraphicsObject *, QSet<QGesture *> > *targets, + QSet<QGraphicsObject *> *itemsSet, + QSet<QGesture *> *normal, + QSet<QGesture *> *conflicts) { + QSet<QGesture *> normalGestures; // that are not in conflicted state. foreach (QGesture *gesture, gestures) { - Qt::GestureType gestureType = gesture->gestureType(); - if (gesture->hasHotSpot()) { - QPoint screenPos = gesture->hotSpot().toPoint(); - QList<QGraphicsItem *> items = itemsAtPosition(screenPos, QPointF(), viewport); - QList<QGraphicsObject *> result; - for (int j = 0; j < items.size(); ++j) { - QGraphicsItem *item = items.at(j); + if (!gesture->hasHotSpot()) + continue; + const Qt::GestureType gestureType = gesture->gestureType(); + QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), gesture->d_func()->sceneHotSpot, 0); + for (int j = 0; j < items.size(); ++j) { + QGraphicsItem *item = items.at(j); - // Check if the item is blocked by a modal panel and use it as - // a target instead of this item. - (void) item->isBlockedByModalPanel(&item); + // Check if the item is blocked by a modal panel and use it as + // a target instead of this item. + (void) item->isBlockedByModalPanel(&item); - if (QGraphicsObject *itemobj = item->toGraphicsObject()) { - QGraphicsItemPrivate *d = item->d_func(); - if (d->gestureContext.contains(gestureType)) { - result.append(itemobj); + if (QGraphicsObject *itemobj = item->toGraphicsObject()) { + QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); + QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it = + d->gestureContext.find(gestureType); + if (it != d->gestureContext.end() && (!flag || (it.value() & flag))) { + if (normalGestures.contains(gesture)) { + normalGestures.remove(gesture); + if (conflicts) + conflicts->insert(gesture); + } else { + normalGestures.insert(gesture); } + if (targets) + (*targets)[itemobj].insert(gesture); + if (itemsSet) + (*itemsSet).insert(itemobj); } - // Don't propagate through panels. - if (item->isPanel()) - break; - } - DEBUG() << "QGraphicsScenePrivate::getGestureTargets:" - << gesture << result; - if (result.size() == 1) { - normalGestures->insert(gesture, result.first()); - } else if (!result.isEmpty()) { - conflictedGestures->insert(gestureType, gesture); - conflictedItems->append(result); } + // Don't propagate through panels. + if (item->isPanel()) + break; } } + if (normal) + *normal = normalGestures; } void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) @@ -5946,266 +5966,215 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) QWidget *viewport = event->widget(); if (!viewport) return; + QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(viewport->parent()); + if (!graphicsView) + return; + QList<QGesture *> allGestures = event->gestures(); DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" << "Delivering gestures:" << allGestures; - typedef QHash<QGraphicsObject *, QList<QGesture *> > GesturesPerItem; - GesturesPerItem gesturesPerItem; - - // gestures that are only supposed to propagate to parent items. - QSet<QGesture *> parentPropagatedGestures; - QSet<QGesture *> startedGestures; + QPoint delta = graphicsView->mapFromGlobal(QPoint()); + QTransform toScene = QTransform::fromTranslate(delta.x(), delta.y()) + * graphicsView->viewportTransform().inverted(); foreach (QGesture *gesture, allGestures) { + // cache scene coordinates of the hot spot + if (gesture->hasHotSpot()) { + gesture->d_func()->sceneHotSpot = toScene.map(gesture->hotSpot()); + } else { + gesture->d_func()->sceneHotSpot = QPointF(); + } + QGraphicsObject *target = gestureTargets.value(gesture, 0); if (!target) { // when we are not in started mode but don't have a target // then the only one interested in gesture is the view/scene if (gesture->state() == Qt::GestureStarted) startedGestures.insert(gesture); - } else { - gesturesPerItem[target].append(gesture); - Qt::GestureFlags flags = - target->QGraphicsItem::d_func()->gestureContext.value(gesture->gestureType()); - if (flags & Qt::IgnoredGesturesPropagateToParent) - parentPropagatedGestures.insert(gesture); } } - QMap<Qt::GestureType, QGesture *> conflictedGestures; - QList<QList<QGraphicsObject *> > conflictedItems; - QHash<QGesture *, QGraphicsObject *> normalGestures; - getGestureTargets(startedGestures, viewport, &conflictedGestures, &conflictedItems, - &normalGestures); - DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" - << "Conflicting gestures:" << conflictedGestures.values() << conflictedItems; - Q_ASSERT((conflictedGestures.isEmpty() && conflictedItems.isEmpty()) || - (!conflictedGestures.isEmpty() && !conflictedItems.isEmpty())); - - // gestures that were sent as override events, but no one accepted them - QHash<QGesture *, QGraphicsObject *> ignoredConflictedGestures; - - // deliver conflicted gestures as override events first - while (!conflictedGestures.isEmpty() && !conflictedItems.isEmpty()) { - // get the topmost item to deliver the override event - Q_ASSERT(!conflictedItems.isEmpty()); - Q_ASSERT(!conflictedItems.first().isEmpty()); - QGraphicsObject *topmost = conflictedItems.first().first(); - for (int i = 1; i < conflictedItems.size(); ++i) { - QGraphicsObject *item = conflictedItems.at(i).first(); - if (qt_closestItemFirst(item, topmost)) { - topmost = item; - } - } - // get a list of gestures to send to the item - QList<Qt::GestureType> grabbedGestures = - topmost->QGraphicsItem::d_func()->gestureContext.keys(); - QList<QGesture *> gestures; - for (int i = 0; i < grabbedGestures.size(); ++i) { - if (QGesture *g = conflictedGestures.value(grabbedGestures.at(i), 0)) { - gestures.append(g); - if (!ignoredConflictedGestures.contains(g)) - ignoredConflictedGestures.insert(g, topmost); - } - } - - // send gesture override to the topmost item - QGestureEvent ev(gestures); - ev.t = QEvent::GestureOverride; - ev.setWidget(event->widget()); - // mark event and individual gestures as ignored - ev.ignore(); - foreach(QGesture *g, gestures) - ev.setAccepted(g, false); + if (!startedGestures.isEmpty()) { + QSet<QGesture *> normalGestures; // that have just one target + QSet<QGesture *> conflictedGestures; // that have multiple possible targets + gestureTargetsAtHotSpots(startedGestures, Qt::GestureFlag(0), &cachedItemGestures, 0, + &normalGestures, &conflictedGestures); + cachedTargetItems = cachedItemGestures.keys(); + qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" - << "delivering override to" - << topmost << gestures; - sendEvent(topmost, &ev); - // mark all accepted gestures to deliver them as normal gesture events - foreach (QGesture *g, gestures) { - if (ev.isAccepted() || ev.isAccepted(g)) { - conflictedGestures.remove(g->gestureType()); - gestureTargets.remove(g); - // add the gesture to the list of normal delivered gestures - normalGestures.insert(g, topmost); + << "Conflicting gestures:" << conflictedGestures; + + // deliver conflicted gestures as override events AND remember + // initial gesture targets + if (!conflictedGestures.isEmpty()) { + for (int i = 0; i < cachedTargetItems.size(); ++i) { + QWeakPointer<QGraphicsObject> item = cachedTargetItems.at(i); + + // get gestures to deliver to the current item + QSet<QGesture *> gestures = conflictedGestures & cachedItemGestures.value(item.data()); + if (gestures.isEmpty()) + continue; + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" - << "override was accepted:" - << g << topmost; - ignoredConflictedGestures.remove(g); + << "delivering override to" + << item.data() << gestures; + // send gesture override + QGestureEvent ev(gestures.toList()); + ev.t = QEvent::GestureOverride; + ev.setWidget(event->widget()); + // mark event and individual gestures as ignored + ev.ignore(); + foreach(QGesture *g, gestures) + ev.setAccepted(g, false); + sendEvent(item.data(), &ev); + // mark all accepted gestures to deliver them as normal gesture events + foreach (QGesture *g, gestures) { + if (ev.isAccepted() || ev.isAccepted(g)) { + conflictedGestures.remove(g); + // mark the item as a gesture target + if (item) + gestureTargets.insert(g, item.data()); + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" + << "override was accepted:" + << g << item.data(); + } + // remember the first item that received the override event + // as it most likely become a target if noone else accepts + // the override event + if (!gestureTargets.contains(g) && item) + gestureTargets.insert(g, item.data()); + + } + if (conflictedGestures.isEmpty()) + break; } } - // remove the item that we've already delivered from the list - for (int i = 0; i < conflictedItems.size(); ) { - QList<QGraphicsObject *> &items = conflictedItems[i]; - if (items.first() == topmost) { - items.removeFirst(); - if (items.isEmpty()) { - conflictedItems.removeAt(i); - continue; + // remember the initial target item for each gesture that was not in + // the conflicted state. + if (!normalGestures.isEmpty()) { + for (int i = 0; i < cachedTargetItems.size() && !normalGestures.isEmpty(); ++i) { + QGraphicsObject *item = cachedTargetItems.at(i); + + // get gestures to deliver to the current item + foreach (QGesture *g, cachedItemGestures.value(item)) { + if (!gestureTargets.contains(g)) { + gestureTargets.insert(g, item); + normalGestures.remove(g); + } } } - ++i; } } - // put back those started gestures that are not in the conflicted state - // and remember their targets - QHash<QGesture *, QGraphicsObject *>::const_iterator it = normalGestures.begin(), - e = normalGestures.end(); - for (; it != e; ++it) { - QGesture *g = it.key(); - QGraphicsObject *receiver = it.value(); - Q_ASSERT(!gestureTargets.contains(g)); - gestureTargets.insert(g, receiver); - gesturesPerItem[receiver].append(g); - Qt::GestureFlags flags = - receiver->QGraphicsItem::d_func()->gestureContext.value(g->gestureType()); - if (flags & Qt::IgnoredGesturesPropagateToParent) - parentPropagatedGestures.insert(g); - } - it = ignoredConflictedGestures.begin(); - e = ignoredConflictedGestures.end(); - for (; it != e; ++it) { - QGesture *g = it.key(); - QGraphicsObject *receiver = it.value(); - Q_ASSERT(!gestureTargets.contains(g)); - gestureTargets.insert(g, receiver); - gesturesPerItem[receiver].append(g); - Qt::GestureFlags flags = - receiver->QGraphicsItem::d_func()->gestureContext.value(g->gestureType()); - if (flags & Qt::IgnoredGesturesPropagateToParent) - parentPropagatedGestures.insert(g); - } - - DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" - << "Started gestures:" << normalGestures.keys() - << "All gestures:" << gesturesPerItem.values(); // deliver all gesture events - QList<QGesture *> alreadyIgnoredGestures; - QHash<QGraphicsObject *, QSet<QGesture *> > itemIgnoredGestures; - QList<QGraphicsObject *> targetItems = gesturesPerItem.keys(); - qSort(targetItems.begin(), targetItems.end(), qt_closestItemFirst); - for (int i = 0; i < targetItems.size(); ++i) { - QGraphicsObject *item = targetItems.at(i); - QList<QGesture *> gestures = gesturesPerItem.value(item); - // remove gestures that were already delivered once and were ignored - DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" - << "already ignored gestures for item" - << item << ":" << itemIgnoredGestures.value(item); - - if (itemIgnoredGestures.contains(item)) // don't deliver twice to the same item - continue; - - QGraphicsItemPrivate *gid = item->QGraphicsItem::d_func(); - foreach(QGesture *g, alreadyIgnoredGestures) { - QMap<Qt::GestureType, Qt::GestureFlags>::iterator contextit = - gid->gestureContext.find(g->gestureType()); - bool deliver = false; - if (contextit != gid->gestureContext.end()) { - if (g->state() == Qt::GestureStarted) { - deliver = true; - } else { - const Qt::GestureFlags flags = contextit.value(); - if (flags & Qt::ReceivePartialGestures) { - QGraphicsObject *originalTarget = gestureTargets.value(g); - Q_ASSERT(originalTarget); - QGraphicsItemPrivate *otd = originalTarget->QGraphicsItem::d_func(); - const Qt::GestureFlags originalTargetFlags = otd->gestureContext.value(g->gestureType()); - if (originalTargetFlags & Qt::IgnoredGesturesPropagateToParent) { - // only deliver to parents of the original target item - deliver = item->isAncestorOf(originalTarget); - } else { - deliver = true; - } - } - } - } - if (deliver) - gestures += g; + QSet<QGesture *> undeliveredGestures; + QSet<QGesture *> parentPropagatedGestures; + foreach (QGesture *gesture, allGestures) { + if (QGraphicsObject *target = gestureTargets.value(gesture, 0)) { + cachedItemGestures[target].insert(gesture); + cachedTargetItems.append(target); + undeliveredGestures.insert(gesture); + QGraphicsItemPrivate *d = target->QGraphicsItem::d_func(); + const Qt::GestureFlags flags = d->gestureContext.value(gesture->gestureType()); + if (flags & Qt::IgnoredGesturesPropagateToParent) + parentPropagatedGestures.insert(gesture); } + } + qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); + for (int i = 0; i < cachedTargetItems.size(); ++i) { + QWeakPointer<QGraphicsObject> receiver = cachedTargetItems.at(i); + QSet<QGesture *> gestures = + undeliveredGestures & cachedItemGestures.value(receiver.data()); + gestures -= cachedAlreadyDeliveredGestures.value(receiver.data()); + if (gestures.isEmpty()) continue; + + cachedAlreadyDeliveredGestures[receiver.data()] += gestures; + const bool isPanel = receiver.data()->isPanel(); + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering to" - << item << gestures; - QGestureEvent ev(gestures); + << receiver.data() << gestures; + QGestureEvent ev(gestures.toList()); ev.setWidget(event->widget()); - sendEvent(item, &ev); + sendEvent(receiver.data(), &ev); QSet<QGesture *> ignoredGestures; foreach (QGesture *g, gestures) { if (!ev.isAccepted() && !ev.isAccepted(g)) { - ignoredGestures.insert(g); + // if the gesture was ignored by its target, we will update the + // targetItems list with a possible target items (items that + // want to receive partial gestures). + // ### wont' work if the target was destroyed in the event + // we will just stop delivering it. + if (receiver && receiver.data() == gestureTargets.value(g, 0)) + ignoredGestures.insert(g); } else { - if (g->state() == Qt::GestureStarted) - gestureTargets[g] = item; - } - } - if (!ignoredGestures.isEmpty()) { - // get a list of items under the (current) hotspot of each ignored - // gesture and start delivery again from the beginning - DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" - << "item has ignored the event, will propagate." - << item << ignoredGestures; - itemIgnoredGestures[item] += ignoredGestures; - alreadyIgnoredGestures = ignoredGestures.toList(); - - // remove gestures that are supposed to be propagated to - // parent items only. - QSet<QGesture *> parentGestures; - for (QSet<QGesture *>::iterator it = ignoredGestures.begin(); - it != ignoredGestures.end();) { - if (parentPropagatedGestures.contains(*it)) { - parentGestures.insert(*it); - it = ignoredGestures.erase(it); - } else { - ++it; + if (receiver && g->state() == Qt::GestureStarted) { + // someone accepted the propagated initial GestureStarted + // event, let it be the new target for all following events. + gestureTargets[g] = receiver.data(); } + undeliveredGestures.remove(g); } + } + if (undeliveredGestures.isEmpty()) + break; - QSet<QGraphicsObject *> itemsSet = targetItems.toSet(); - - foreach(QGesture *g, parentGestures) { - // get the original target for the gesture - QGraphicsItem *item = gestureTargets.value(g, 0); - Q_ASSERT(item); - const Qt::GestureType gestureType = g->gestureType(); - // iterate through parent items of the original gesture - // target item and collect potential receivers - do { - if (QGraphicsObject *obj = item->toGraphicsObject()) { - if (item->d_func()->gestureContext.contains(gestureType)) - itemsSet.insert(obj); + // ignoredGestures list is only filled when delivering to the gesture + // target item, so it is safe to assume item == target. + if (!ignoredGestures.isEmpty() && !isPanel) { + // look for new potential targets for gestures that were ignored + // and should be propagated. + + QSet<QGraphicsObject *> targetsSet = cachedTargetItems.toSet(); + + if (receiver) { + // first if the gesture should be propagated to parents only + for (QSet<QGesture *>::iterator it = ignoredGestures.begin(); + it != ignoredGestures.end();) { + if (parentPropagatedGestures.contains(*it)) { + QGesture *gesture = *it; + const Qt::GestureType gestureType = gesture->gestureType(); + QGraphicsItem *item = receiver.data(); + while (item) { + if (QGraphicsObject *obj = item->toGraphicsObject()) { + if (item->d_func()->gestureContext.contains(gestureType)) { + targetsSet.insert(obj); + cachedItemGestures[obj].insert(gesture); + } + } + if (item->isPanel()) + break; + item = item->parentItem(); + } + + it = ignoredGestures.erase(it); + continue; } - if (item->isPanel()) - break; - } while ((item = item->parentItem())); + ++it; + } } - QMap<Qt::GestureType, QGesture *> conflictedGestures; - QList<QList<QGraphicsObject *> > itemsForConflictedGestures; - QHash<QGesture *, QGraphicsObject *> normalGestures; - getGestureTargets(ignoredGestures, viewport, - &conflictedGestures, &itemsForConflictedGestures, - &normalGestures); - for (int k = 0; k < itemsForConflictedGestures.size(); ++k) - itemsSet += itemsForConflictedGestures.at(k).toSet(); - - targetItems = itemsSet.toList(); + gestureTargetsAtHotSpots(ignoredGestures, Qt::ReceivePartialGestures, + &cachedItemGestures, &targetsSet, 0, 0); - qSort(targetItems.begin(), targetItems.end(), qt_closestItemFirst); + cachedTargetItems = targetsSet.toList(); + qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" - << "new targets:" << targetItems; + << "new targets:" << cachedTargetItems; i = -1; // start delivery again continue; } } + foreach (QGesture *g, startedGestures) { if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) { DEBUG() << "lets try to cancel some"; // find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them - cancelGesturesForChildren(g, event->widget()); + cancelGesturesForChildren(g); } } @@ -6220,9 +6189,13 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) break; } } + + cachedTargetItems.clear(); + cachedItemGestures.clear(); + cachedAlreadyDeliveredGestures.clear(); } -void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidget *viewport) +void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original) { Q_ASSERT(original); QGraphicsItem *originalItem = gestureTargets.value(original); @@ -6278,8 +6251,7 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidge if (!g->hasHotSpot()) continue; - QPoint screenPos = g->hotSpot().toPoint(); - QList<QGraphicsItem *> items = itemsAtPosition(screenPos, QPointF(), viewport); + QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), g->d_func()->sceneHotSpot, 0); for (int j = 0; j < items.size(); ++j) { QGraphicsObject *item = items.at(j)->toGraphicsObject(); if (!item) diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 04ffe0f..ca8b829 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -294,13 +294,18 @@ public: bool allItemsIgnoreTouchEvents; void enableTouchEventsOnViews(); + QList<QGraphicsObject *> cachedTargetItems; + QHash<QGraphicsObject *, QSet<QGesture *> > cachedItemGestures; + QHash<QGraphicsObject *, QSet<QGesture *> > cachedAlreadyDeliveredGestures; QHash<QGesture *, QGraphicsObject *> gestureTargets; void gestureEventHandler(QGestureEvent *event); - void getGestureTargets(const QSet<QGesture *> &gestures, QWidget *viewport, - QMap<Qt::GestureType, QGesture *> *conflictedGestures, - QList<QList<QGraphicsObject *> > *conflictedItems, - QHash<QGesture *, QGraphicsObject *> *normalGestures); - void cancelGesturesForChildren(QGesture *original, QWidget *viewport); + void gestureTargetsAtHotSpots(const QSet<QGesture *> &gestures, + Qt::GestureFlag flag, + QHash<QGraphicsObject *, QSet<QGesture *> > *targets, + QSet<QGraphicsObject *> *itemsSet = 0, + QSet<QGesture *> *normal = 0, + QSet<QGesture *> *conflicts = 0); + void cancelGesturesForChildren(QGesture *original); void updateInputMethodSensitivityInViews(); diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 06b7438..1ced3d7 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -3400,6 +3400,13 @@ void QGraphicsView::paintEvent(QPaintEvent *event) if (!d->scene->d_func()->painterStateProtection) painter.setWorldTransform(viewTransform); } else { + // Make sure we don't have unpolished items before we draw + if (!d->scene->d_func()->unpolishedItems.isEmpty()) + d->scene->d_func()->_q_polishItems(); + // We reset updateAll here (after we've issued polish events) + // so that we can discard update requests coming from polishEvent(). + d->scene->d_func()->updateAll = false; + // Find all exposed items bool allItems = false; QList<QGraphicsItem *> itemList = d->findItems(d->exposedRegion, &allItems, viewTransform); @@ -3408,9 +3415,25 @@ void QGraphicsView::paintEvent(QPaintEvent *event) const int numItems = itemList.size(); QGraphicsItem **itemArray = &itemList[0]; // Relies on QList internals, but is perfectly valid. QStyleOptionGraphicsItem *styleOptionArray = d->allocStyleOptionsArray(numItems); + QTransform transform(Qt::Uninitialized); for (int i = 0; i < numItems; ++i) { - itemArray[i]->d_ptr->initStyleOption(&styleOptionArray[i], viewTransform, - d->exposedRegion, allItems); + QGraphicsItem *item = itemArray[i]; + QGraphicsItemPrivate *itemd = item->d_ptr.data(); + itemd->initStyleOption(&styleOptionArray[i], viewTransform, d->exposedRegion, allItems); + // Cache the item's area in view coordinates. + // Note that we have to do this here in case the base class implementation + // (QGraphicsScene::drawItems) is not called. If it is, we'll do this + // operation twice, but that's the price one has to pay for using indirect + // painting :-/. + const QRectF brect = adjustedItemEffectiveBoundingRect(item); + if (!itemd->itemIsUntransformable()) { + transform = item->sceneTransform(); + if (viewTransformed) + transform *= viewTransform; + } else { + transform = item->deviceTransform(viewTransform); + } + itemd->paintedViewBoundingRects.insert(d->viewport, transform.mapRect(brect).toRect()); } // Draw the items. drawItems(&painter, numItems, itemArray, styleOptionArray); diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 2226901..8446387 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -182,7 +182,7 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* qWarning() << "Error while marking the shared memory segment to be destroyed"; ok = (xshminfo.shmaddr != (char*)-1); if (ok) - image = QImage((uchar *)xshmimg->data, width, height, systemFormat()); + image = QImage((uchar *)xshmimg->data, width, height, format); } xshminfo.readOnly = false; if (ok) diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp index 1aeb524..029154b 100644 --- a/src/gui/image/qpaintengine_pic.cpp +++ b/src/gui/image/qpaintengine_pic.cpp @@ -486,8 +486,11 @@ void QPicturePaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti) qDebug() << " -> drawTextItem():" << p << ti.text(); #endif + const QTextItemInt &si = static_cast<const QTextItemInt &>(ti); + if (si.chars == 0) + QPaintEngine::drawTextItem(p, ti); // Draw as path + if (d->pic_d->formatMajor >= 9) { - const QTextItemInt &si = static_cast<const QTextItemInt &>(ti); int pos; SERIALIZE_CMD(QPicturePrivate::PdcDrawTextItem); QFont fnt = ti.font(); diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index adf3ce3..bc6db90 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2119,6 +2119,11 @@ void QAbstractItemView::focusOutEvent(QFocusEvent *event) Q_D(QAbstractItemView); QAbstractScrollArea::focusOutEvent(event); d->viewport->update(); + +#ifdef QT_SOFTKEYS_ENABLED + if(!hasEditFocus()) + removeAction(d->doneSoftKey); +#endif } /*! @@ -2144,7 +2149,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) if (!hasEditFocus()) { setEditFocus(true); #ifdef QT_SOFTKEYS_ENABLED - addAction(d->doneSoftKey); + // If we can't keypad navigate to any direction, there is no sense to add + // "Done" softkey, since it basically does nothing when there is + // only one widget in screen + if(QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) + || QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) + addAction(d->doneSoftKey); #endif return; } @@ -2160,6 +2170,26 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) event->ignore(); } return; + case Qt::Key_Down: + case Qt::Key_Up: + // Let's ignore vertical navigation events, only if there is no other widget + // what can take the focus in vertical direction. This means widget can handle navigation events + // even the widget don't have edit focus, and there is no other widget in requested direction. + if(QApplication::keypadNavigationEnabled() && !hasEditFocus() + && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { + event->ignore(); + return; + } + break; + case Qt::Key_Left: + case Qt::Key_Right: + // Similar logic as in up and down events + if(QApplication::keypadNavigationEnabled() && !hasEditFocus() + && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this))) { + event->ignore(); + return; + } + break; default: if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { event->ignore(); @@ -2245,7 +2275,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) case Qt::Key_Down: case Qt::Key_Up: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { + if (QApplication::keypadNavigationEnabled() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { event->accept(); // don't change focus break; } @@ -2253,8 +2283,10 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) case Qt::Key_Left: case Qt::Key_Right: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { - event->accept(); // don't change horizontal focus in directional mode + if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional + && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) + || (QWidgetPrivate::inTabWidget(this) && d->model->columnCount(d->root) > 1))) { + event->accept(); // don't change focus break; } #endif // QT_KEYPAD_NAVIGATION diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/gui/itemviews/qabstractproxymodel.cpp index 40345a7..43a1327 100644 --- a/src/gui/itemviews/qabstractproxymodel.cpp +++ b/src/gui/itemviews/qabstractproxymodel.cpp @@ -127,6 +127,7 @@ void QAbstractProxyModel::setSourceModel(QAbstractItemModel *sourceModel) } else { d->model = QAbstractItemModelPrivate::staticEmptyModel(); } + d->roleNames = d->model->roleNames(); } /*! diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index 1c26e51..5128b64 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -2221,7 +2221,8 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e) return; } case QHeaderViewPrivate::MoveSection: { - if (qAbs(pos - d->firstPos) >= QApplication::startDragDistance()) { + if (qAbs(pos - d->firstPos) >= QApplication::startDragDistance() + || !d->sectionIndicator->isHidden()) { int indicatorCenter = (d->orientation == Qt::Horizontal ? d->sectionIndicator->width() : d->sectionIndicator->height()) / 2; @@ -2233,12 +2234,6 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e) return; d->target = d->logicalIndex(visual); d->updateSectionIndicator(d->section, pos); - } else { - int visual = visualIndexAt(d->firstPos); - if (visual == -1) - return; - d->target = d->logicalIndex(visual); - d->updateSectionIndicator(d->section, d->firstPos); } return; } diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index e73013c..c63a07b 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -563,7 +563,7 @@ QVector<QPair<int, QVector<int > > > QSortFilterProxyModelPrivate::proxy_interva int proxy_item = 0; int source_items_index = 0; QVector<int> source_items_in_interval; - bool compare = (orient == Qt::Vertical && source_sort_column >= 0); + bool compare = (orient == Qt::Vertical && source_sort_column >= 0 && dynamic_sortfilter); while (source_items_index < source_items.size()) { source_items_in_interval.clear(); int first_new_source_item = source_items.at(source_items_index); @@ -1244,7 +1244,7 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsInserted( const QModelIndex &source_parent, int start, int end) { source_items_inserted(source_parent, start, end, Qt::Vertical); - if (update_source_sort_column()) //previous call to update_source_sort_column may fail if the model has no column. + if (update_source_sort_column() && dynamic_sortfilter) //previous call to update_source_sort_column may fail if the model has no column. sort(); // now it should succeed so we need to make sure to sort again } @@ -1281,8 +1281,8 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsInserted( if (source_parent.isValid()) return; //we sort according to the root column only if (source_sort_column == -1) { - //we update the source_sort_column depending on the prox_sort_column - if (update_source_sort_column()) + //we update the source_sort_column depending on the proxy_sort_column + if (update_source_sort_column() && dynamic_sortfilter) sort(); } else { if (start <= source_sort_column) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 706d2a8..37168eb 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -3770,10 +3770,15 @@ void QTreeViewPrivate::rowsRemoved(const QModelIndex &parent, if (previousSibiling != -1 && after && model->rowCount(parent) == start) viewItems[previousSibiling].hasMoreSiblings = false; - - updateChildCount(parentItem, -removedCount); - if (parentItem != -1 && viewItems.at(parentItem).total == 0) - viewItems[parentItem].hasChildren = false; //every children have been removed; + if (parentItem != -1) { + if (viewItems.at(parentItem).expanded) { + updateChildCount(parentItem, -removedCount); + if (viewItems.at(parentItem).total == 0) + viewItems[parentItem].hasChildren = false; //every children have been removed; + } else if (viewItems[parentItem].hasChildren && !hasVisibleChildren(parent)) { + viewItems[parentItem].hasChildren = false; + } + } if (after) { q->updateGeometries(); viewport->update(); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 3e2e6f6..baefdfd 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -597,7 +597,9 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod TUint s60Keysym = QApplicationPrivate::resolveS60ScanCode(keyEvent.iScanCode, keyEvent.iCode); int keyCode; - if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) { + if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used + keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode); + } else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) { // Normal characters keys. keyCode = s60Keysym; } else { @@ -1146,6 +1148,10 @@ void qt_init(QApplicationPrivate * /* priv */, int) #endif S60->wsSession().SetAutoFlush(ETrue); +#ifdef Q_SYMBIAN_WINDOW_SIZE_CACHE + TRAP_IGNORE(S60->wsSession().EnableWindowSizeCacheL()); +#endif + S60->updateScreenSize(); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 31d245f..131b9bb 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1905,8 +1905,13 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam break; if (!msg.wParam) { +#ifdef Q_WS_WINCE + // On Windows CE, lParam parameter is a constant, not a char pointer. + if (msg.lParam == INI_INTL) { +#else QString area = QString::fromWCharArray((wchar_t*)msg.lParam); if (area == QLatin1String("intl")) { +#endif QLocalePrivate::updateSystemPrivate(); if (!widget->testAttribute(Qt::WA_SetLocale)) widget->dptr()->setLocale_helper(QLocale(), true); diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index c6e192b..3c2c743 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2221,30 +2221,60 @@ void qt_init(QApplicationPrivate *priv, int, int format; unsigned long length, after; uchar *data = 0; + int rc; + + do { + if (!qgetenv("KDE_FULL_SESSION").isEmpty()) { + X11->desktopEnvironment = DE_KDE; + X11->desktopVersion = qgetenv("KDE_SESSION_VERSION").toInt(); + break; + } + + if (qgetenv("DESKTOP_SESSION") == "gnome") { + X11->desktopEnvironment = DE_GNOME; + break; + } + + // GNOME_DESKTOP_SESSION_ID is deprecated for some reason, but still check it + if (!qgetenv("GNOME_DESKTOP_SESSION_ID").isEmpty()) { + X11->desktopEnvironment = DE_GNOME; + break; + } + + rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_DT_SAVE_MODE), + 0, 2, False, XA_STRING, &type, &format, &length, + &after, &data); + if (rc == Success && length) { + if (!strcmp(reinterpret_cast<char *>(data), "xfce4")) { + // Pretend that xfce4 is gnome, as it uses the same libraries. + // The detection above is stolen from xdg-open. + X11->desktopEnvironment = DE_GNOME; + break; + } + + // We got the property but it wasn't xfce4. Free data before it gets overwritten. + XFree(data); + data = 0; + } + + rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING), + 0, 1, False, AnyPropertyType, &type, &format, &length, + &after, &data); + if (rc == Success && length) { + // DTWM is running, meaning most likely CDE is running... + X11->desktopEnvironment = DE_CDE; + break; + } + + rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), + ATOM(_SGI_DESKS_MANAGER), 0, 1, False, XA_WINDOW, + &type, &format, &length, &after, &data); + if (rc == Success && length) { + X11->desktopEnvironment = DE_4DWM; + break; + } + } while(0); - if (!qgetenv("KDE_FULL_SESSION").isEmpty()) { - X11->desktopEnvironment = DE_KDE; - X11->desktopVersion = qgetenv("KDE_SESSION_VERSION").toInt(); - } else if (!qgetenv("GNOME_DESKTOP_SESSION_ID").isEmpty() // Deprecated for some reason. - || qgetenv("DESKTOP_SESSION") == "gnome") { // De-facto-standardized by GNOME. - X11->desktopEnvironment = DE_GNOME; - } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_DT_SAVE_MODE), - 0, 2, False, XA_STRING, &type, &format, &length, - &after, &data) == Success - && !strcmp(reinterpret_cast<char *>(data), "xfce4")) { - // Pretend that xfce4 is gnome, as it uses the same libraries. - // The detection above is stolen from xdg-open. - X11->desktopEnvironment = DE_GNOME; - } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING), - 0, 1, False, AnyPropertyType, &type, &format, &length, - &after, &data) == Success && length) { - // DTWM is running, meaning most likely CDE is running... - X11->desktopEnvironment = DE_CDE; - } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_SGI_DESKS_MANAGER), - 0, 1, False, XA_WINDOW, &type, &format, &length, &after, &data) == Success - && length) { - X11->desktopEnvironment = DE_4DWM; - } if (data) XFree((char *)data); diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 455176e..6a16403 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -419,6 +419,8 @@ extern "C" { - (BOOL)isOpaque; { + if (!qwidgetprivate) + return [super isOpaque]; return qwidgetprivate->isOpaque; } @@ -450,7 +452,7 @@ extern "C" { } // Make sure the opengl context is updated on resize. - if (qwidgetprivate->isGLWidget) { + if (qwidgetprivate && qwidgetprivate->isGLWidget) { qwidgetprivate->needWindowChange = true; QEvent event(QEvent::MacGLWindowChange); qApp->sendEvent(qwidget, &event); @@ -459,11 +461,15 @@ extern "C" { - (void)drawRect:(NSRect)aRect { + if (!qwidget) + return; + if (QApplicationPrivate::graphicsSystem() != 0) { if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore()) { // Drawing is handled on the window level - // See qcocoasharedwindowmethods_mac_p. - return; + // See qcocoasharedwindowmethods_mac_p.h + if (!qwidget->testAttribute(Qt::WA_PaintOnScreen)) + return; } } CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; @@ -551,12 +557,18 @@ extern "C" { - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent { + if (!qwidget) + return NO; + Q_UNUSED(theEvent); return !qwidget->testAttribute(Qt::WA_MacNoClickThrough); } - (NSView *)hitTest:(NSPoint)aPoint { + if (!qwidget) + return [super hitTest:aPoint]; + if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) return nil; // You cannot hit a transparent for mouse event widget. return [super hitTest:aPoint]; @@ -564,6 +576,9 @@ extern "C" { - (void)updateTrackingAreas { + if (!qwidget) + return; + // [NSView addTrackingArea] is slow, so bail out early if we can: if (NSIsEmptyRect([self visibleRect])) return; @@ -597,6 +612,9 @@ extern "C" { - (void)mouseEntered:(NSEvent *)event { + if (!qwidget) + return; + if (qwidgetprivate->data.in_destructor) return; QEvent enterEvent(QEvent::Enter); @@ -619,6 +637,9 @@ extern "C" { - (void)mouseExited:(NSEvent *)event { + if (!qwidget) + return; + QEvent leaveEvent(QEvent::Leave); NSPoint globalPoint = [[event window] convertBaseToScreen:[event locationInWindow]]; if (!qAppInstance()->activeModalWidget() || QApplicationPrivate::tryModalHelper(qwidget, 0)) { @@ -637,6 +658,9 @@ extern "C" { - (void)flagsChanged:(NSEvent *)theEvent { + if (!qwidget) + return; + QWidget *widgetToGetKey = qwidget; QWidget *popup = qAppInstance()->activePopupWidget(); @@ -648,6 +672,9 @@ extern "C" { - (void)mouseMoved:(NSEvent *)theEvent { + if (!qwidget) + return; + // We always enable mouse tracking for all QCocoaView-s. In cases where we have // child views, we will receive mouseMoved for both parent & the child (if // mouse is over the child). We need to ignore the parent mouseMoved in such @@ -938,6 +965,8 @@ extern "C" { - (void)frameDidChange:(NSNotification *)note { Q_UNUSED(note); + if (!qwidget) + return; if (qwidget->isWindow()) return; NSRect newFrame = [self frame]; @@ -961,7 +990,7 @@ extern "C" { { QMacCocoaAutoReleasePool pool; [super setEnabled:flag]; - if (qwidget->isEnabled() != flag) + if (qwidget && qwidget->isEnabled() != flag) qwidget->setEnabled(flag); } @@ -972,6 +1001,8 @@ extern "C" { - (BOOL)acceptsFirstResponder { + if (!qwidget) + return NO; if (qwidget->isWindow()) return YES; // Always do it, so that windows can accept key press events. return qwidget->focusPolicy() != Qt::NoFocus; @@ -979,6 +1010,8 @@ extern "C" { - (BOOL)resignFirstResponder { + if (!qwidget) + return NO; // Seems like the following test only triggers if this // view is inside a QMacNativeWidget: if (qwidget == QApplication::focusWidget()) @@ -1014,6 +1047,12 @@ extern "C" { return qwidget; } +- (void) qt_clearQWidget +{ + qwidget = 0; + qwidgetprivate = 0; +} + - (BOOL)qt_leftButtonIsRightButton { return leftButtonIsRightButton; @@ -1067,9 +1106,11 @@ extern "C" { - (void)viewWillMoveToWindow:(NSWindow *)window { + if (qwidget == 0) + return; + if (qwidget->windowFlags() & Qt::MSWindowsOwnDC && (window != [self window])) { // OpenGL Widget - // Create a stupid ClearDrawable Event QEvent event(QEvent::MacGLClearDrawable); qApp->sendEvent(qwidget, &event); } @@ -1077,6 +1118,9 @@ extern "C" { - (void)viewDidMoveToWindow { + if (qwidget == 0) + return; + if (qwidget->windowFlags() & Qt::MSWindowsOwnDC && [self window]) { // call update paint event qwidgetprivate->needWindowChange = true; @@ -1272,6 +1316,9 @@ extern "C" { - (NSArray*) validAttributesForMarkedText { + if (qwidget == 0) + return nil; + if (!qwidget->testAttribute(Qt::WA_InputMethodEnabled)) return nil; // Not sure if that's correct, but it's saves a malloc. diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h index 4bb10c5..33aaa24 100644 --- a/src/gui/kernel/qcocoaview_mac_p.h +++ b/src/gui/kernel/qcocoaview_mac_p.h @@ -103,6 +103,7 @@ Q_GUI_EXPORT - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation; - (BOOL)isComposing; - (QWidget *)qt_qwidget; +- (void) qt_clearQWidget; - (BOOL)qt_leftButtonIsRightButton; - (void)qt_setLeftButtonIsRightButton:(BOOL)isSwapped; + (DnDParams*)currentMouseEvent; diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index dee5592..649a310 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -69,13 +69,13 @@ public: QGesturePrivate() : gestureType(Qt::CustomGesture), state(Qt::NoGesture), isHotSpotSet(false), gestureCancelPolicy(0) - { } Qt::GestureType gestureType; Qt::GestureState state; QPointF hotSpot; + QPointF sceneHotSpot; uint isHotSpotSet : 1; uint gestureCancelPolicy : 2; }; diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp index 8735d27..c88a9a7 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -181,6 +181,7 @@ void QGestureRecognizer::reset(QGesture *gesture) QGesturePrivate *d = gesture->d_func(); d->state = Qt::NoGesture; d->hotSpot = QPointF(); + d->sceneHotSpot = QPointF(); d->isHotSpotSet = false; } } diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index 09c36c88..3e42d6e 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -207,12 +207,12 @@ public: KeyboardLayoutItem *keyLayout[256]; #elif defined(Q_WS_QWS) #elif defined(Q_OS_SYMBIAN) -private: - QHash<TUint, int> s60ToQtKeyMap; - void fillKeyMap(); public: QString translateKeyEvent(int keySym, Qt::KeyboardModifiers modifiers); int mapS60KeyToQt(TUint s60key); + int mapS60ScanCodesToQt(TUint s60key); + int mapQtToS60Key(int qtKey); + int mapQtToS60ScanCodes(int qtKey); #endif }; diff --git a/src/gui/kernel/qkeymapper_s60.cpp b/src/gui/kernel/qkeymapper_s60.cpp index 6e21420..fd263ef 100644 --- a/src/gui/kernel/qkeymapper_s60.cpp +++ b/src/gui/kernel/qkeymapper_s60.cpp @@ -46,7 +46,6 @@ QT_BEGIN_NAMESPACE QKeyMapperPrivate::QKeyMapperPrivate() { - fillKeyMap(); } QKeyMapperPrivate::~QKeyMapperPrivate() @@ -74,174 +73,145 @@ QString QKeyMapperPrivate::translateKeyEvent(int keySym, Qt::KeyboardModifiers / return QString(QChar(keySym)); } -void QKeyMapperPrivate::fillKeyMap() +#include <e32keys.h> +struct KeyMapping{ + TKeyCode s60KeyCode; + TStdScanCode s60ScanCode; + Qt::Key qtKey; +}; + +using namespace Qt; + +static const KeyMapping keyMapping[] = { + {EKeyBackspace, EStdKeyBackspace, Key_Backspace}, + {EKeyTab, EStdKeyTab, Key_Tab}, + {EKeyEnter, EStdKeyEnter, Key_Enter}, + {EKeyEscape, EStdKeyEscape, Key_Escape}, + {EKeySpace, EStdKeySpace, Key_Space}, + {EKeyDelete, EStdKeyDelete, Key_Delete}, + {EKeyPrintScreen, EStdKeyPrintScreen, Key_SysReq}, + {EKeyPause, EStdKeyPause, Key_Pause}, + {EKeyHome, EStdKeyHome, Key_Home}, + {EKeyEnd, EStdKeyEnd, Key_End}, + {EKeyPageUp, EStdKeyPageUp, Key_PageUp}, + {EKeyPageDown, EStdKeyPageDown, Key_PageDown}, + {EKeyInsert, EStdKeyInsert, Key_Insert}, + {EKeyLeftArrow, EStdKeyLeftArrow, Key_Left}, + {EKeyRightArrow, EStdKeyRightArrow, Key_Right}, + {EKeyUpArrow, EStdKeyUpArrow, Key_Up}, + {EKeyDownArrow, EStdKeyDownArrow, Key_Down}, + {EKeyLeftShift, EStdKeyLeftShift, Key_Shift}, + {EKeyRightShift, EStdKeyRightShift, Key_Shift}, + {EKeyLeftAlt, EStdKeyLeftAlt, Key_Alt}, + {EKeyRightAlt, EStdKeyRightAlt, Key_AltGr}, + {EKeyLeftCtrl, EStdKeyLeftCtrl, Key_Control}, + {EKeyRightCtrl, EStdKeyRightCtrl, Key_Control}, + {EKeyLeftFunc, EStdKeyLeftFunc, Key_Super_L}, + {EKeyRightFunc, EStdKeyRightFunc, Key_Super_R}, + {EKeyCapsLock, EStdKeyCapsLock, Key_CapsLock}, + {EKeyNumLock, EStdKeyNumLock, Key_NumLock}, + {EKeyScrollLock, EStdKeyScrollLock, Key_ScrollLock}, + {EKeyF1, EStdKeyF1, Key_F1}, + {EKeyF2, EStdKeyF2, Key_F2}, + {EKeyF3, EStdKeyF3, Key_F3}, + {EKeyF4, EStdKeyF4, Key_F4}, + {EKeyF5, EStdKeyF5, Key_F5}, + {EKeyF6, EStdKeyF6, Key_F6}, + {EKeyF7, EStdKeyF7, Key_F7}, + {EKeyF8, EStdKeyF8, Key_F8}, + {EKeyF9, EStdKeyF9, Key_F9}, + {EKeyF10, EStdKeyF10, Key_F10}, + {EKeyF11, EStdKeyF11, Key_F11}, + {EKeyF12, EStdKeyF12, Key_F12}, + {EKeyF13, EStdKeyF13, Key_F13}, + {EKeyF14, EStdKeyF14, Key_F14}, + {EKeyF15, EStdKeyF15, Key_F15}, + {EKeyF16, EStdKeyF16, Key_F16}, + {EKeyF17, EStdKeyF17, Key_F17}, + {EKeyF18, EStdKeyF18, Key_F18}, + {EKeyF19, EStdKeyF19, Key_F19}, + {EKeyF20, EStdKeyF20, Key_F20}, + {EKeyF21, EStdKeyF21, Key_F21}, + {EKeyF22, EStdKeyF22, Key_F22}, + {EKeyF23, EStdKeyF23, Key_F23}, + {EKeyF24, EStdKeyF24, Key_F24}, + {EKeyOff, EStdKeyOff, Key_PowerOff}, +// {EKeyMenu, EStdKeyMenu, Key_Menu}, // Menu is EKeyApplication0 + {EKeyHelp, EStdKeyHelp, Key_Help}, + {EKeyDial, EStdKeyDial, Key_Call}, + {EKeyIncVolume, EStdKeyIncVolume, Key_VolumeUp}, + {EKeyDecVolume, EStdKeyDecVolume, Key_VolumeDown}, + {EKeyDevice0, EStdKeyDevice0, Key_Context1}, // Found by manual testing. + {EKeyDevice1, EStdKeyDevice1, Key_Context2}, // Found by manual testing. + {EKeyDevice3, EStdKeyDevice3, Key_Select}, +// {EKeyDevice7, EStdKeyDevice7, Key_Camera}, //not supported by qt yet + {EKeyApplication0, EStdKeyApplication0, Key_Menu}, // Found by manual testing. + {EKeyApplication1, EStdKeyApplication1, Key_Launch1}, // Found by manual testing. + {EKeyApplication2, EStdKeyApplication2, Key_MediaPlay}, // Found by manual testing. + {EKeyApplication3, EStdKeyApplication3, Key_MediaStop}, // Found by manual testing. + {EKeyApplication4, EStdKeyApplication4, Key_MediaNext}, // Found by manual testing. + {EKeyApplication5, EStdKeyApplication5, Key_MediaPrevious}, // Found by manual testing. + {EKeyApplication6, EStdKeyApplication6, Key_Launch6}, + {EKeyApplication7, EStdKeyApplication7, Key_Launch7}, + {EKeyApplication8, EStdKeyApplication8, Key_Launch8}, + {EKeyApplication9, EStdKeyApplication9, Key_Launch9}, + {EKeyApplicationA, EStdKeyApplicationA, Key_LaunchA}, + {EKeyApplicationB, EStdKeyApplicationB, Key_LaunchB}, + {EKeyApplicationC, EStdKeyApplicationC, Key_LaunchC}, + {EKeyApplicationD, EStdKeyApplicationD, Key_LaunchD}, + {EKeyApplicationE, EStdKeyApplicationE, Key_LaunchE}, + {EKeyApplicationF, EStdKeyApplicationF, Key_LaunchF}, +// {EKeyApplication19, EStdKeyApplication19, Key_CameraFocus}, //not supported by qt yet + {EKeyYes, EStdKeyYes, Key_Yes}, + {EKeyNo, EStdKeyNo, Key_No}, + {TKeyCode(0), TStdScanCode(0), Qt::Key(0)} +}; + +int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key) { - using namespace Qt; - static const struct { - TUint s60Key; - int qtKey; - } map[] = { - {EKeyBell, Key_unknown}, - {EKeyBackspace, Key_Backspace}, - {EKeyTab, Key_Tab}, - {EKeyLineFeed, Key_unknown}, - {EKeyVerticalTab, Key_unknown}, - {EKeyFormFeed, Key_unknown}, - {EKeyEnter, Key_Enter}, - {EKeyEscape, Key_Escape}, - {EKeySpace, Key_Space}, - {EKeyDelete, Key_Delete}, - {EKeyPrintScreen, Key_SysReq}, - {EKeyPause, Key_Pause}, - {EKeyHome, Key_Home}, - {EKeyEnd, Key_End}, - {EKeyPageUp, Key_PageUp}, - {EKeyPageDown, Key_PageDown}, - {EKeyInsert, Key_Insert}, - {EKeyLeftArrow, Key_Left}, - {EKeyRightArrow, Key_Right}, - {EKeyUpArrow, Key_Up}, - {EKeyDownArrow, Key_Down}, - {EKeyLeftShift, Key_Shift}, - {EKeyRightShift, Key_Shift}, - {EKeyLeftAlt, Key_Alt}, - {EKeyRightAlt, Key_AltGr}, - {EKeyLeftCtrl, Key_Control}, - {EKeyRightCtrl, Key_Control}, - {EKeyLeftFunc, Key_Super_L}, - {EKeyRightFunc, Key_Super_R}, - {EKeyCapsLock, Key_CapsLock}, - {EKeyNumLock, Key_NumLock}, - {EKeyScrollLock, Key_ScrollLock}, - {EKeyF1, Key_F1}, - {EKeyF2, Key_F2}, - {EKeyF3, Key_F3}, - {EKeyF4, Key_F4}, - {EKeyF5, Key_F5}, - {EKeyF6, Key_F6}, - {EKeyF7, Key_F7}, - {EKeyF8, Key_F8}, - {EKeyF9, Key_F9}, - {EKeyF10, Key_F10}, - {EKeyF11, Key_F11}, - {EKeyF12, Key_F12}, - {EKeyF13, Key_F13}, - {EKeyF14, Key_F14}, - {EKeyF15, Key_F15}, - {EKeyF16, Key_F16}, - {EKeyF17, Key_F17}, - {EKeyF18, Key_F18}, - {EKeyF19, Key_F19}, - {EKeyF20, Key_F20}, - {EKeyF21, Key_F21}, - {EKeyF22, Key_F22}, - {EKeyF23, Key_F23}, - {EKeyF24, Key_F24}, - {EKeyOff, Key_unknown}, - {EKeyIncContrast, Key_unknown}, - {EKeyDecContrast, Key_unknown}, - {EKeyBacklightOn, Key_unknown}, - {EKeyBacklightOff, Key_unknown}, - {EKeyBacklightToggle, Key_unknown}, - {EKeySliderDown, Key_unknown}, - {EKeySliderUp, Key_unknown}, - {EKeyMenu, Key_Menu}, - {EKeyDictaphonePlay, Key_unknown}, - {EKeyDictaphoneStop, Key_unknown}, - {EKeyDictaphoneRecord, Key_unknown}, - {EKeyHelp, Key_unknown}, - {EKeyDial, Key_Call}, - {EKeyScreenDimension0, Key_unknown}, - {EKeyScreenDimension1, Key_unknown}, - {EKeyScreenDimension2, Key_unknown}, - {EKeyScreenDimension3, Key_unknown}, - {EKeyIncVolume, Key_unknown}, - {EKeyDecVolume, Key_unknown}, - {EKeyDevice0, Key_Context1}, // Found by manual testing, left softkey. - {EKeyDevice1, Key_Context2}, // Found by manual testing. - {EKeyDevice2, Key_unknown}, - {EKeyDevice3, Key_Select}, // Found by manual testing. - {EKeyDevice4, Key_unknown}, - {EKeyDevice5, Key_unknown}, - {EKeyDevice6, Key_unknown}, - {EKeyDevice7, Key_unknown}, - {EKeyDevice8, Key_unknown}, - {EKeyDevice9, Key_unknown}, - {EKeyDeviceA, Key_unknown}, - {EKeyDeviceB, Key_unknown}, - {EKeyDeviceC, Key_unknown}, - {EKeyDeviceD, Key_unknown}, - {EKeyDeviceE, Key_unknown}, - {EKeyDeviceF, Key_unknown}, - {EKeyApplication0, Key_Launch0}, - {EKeyApplication1, Key_Launch1}, - {EKeyApplication2, Key_Launch2}, - {EKeyApplication3, Key_Launch3}, - {EKeyApplication4, Key_Launch4}, - {EKeyApplication5, Key_Launch5}, - {EKeyApplication6, Key_Launch6}, - {EKeyApplication7, Key_Launch7}, - {EKeyApplication8, Key_Launch8}, - {EKeyApplication9, Key_Launch9}, - {EKeyApplicationA, Key_LaunchA}, - {EKeyApplicationB, Key_LaunchB}, - {EKeyApplicationC, Key_LaunchC}, - {EKeyApplicationD, Key_LaunchD}, - {EKeyApplicationE, Key_LaunchE}, - {EKeyApplicationF, Key_LaunchF}, - {EKeyYes, Key_Yes}, - {EKeyNo, Key_No}, - {EKeyIncBrightness, Key_unknown}, - {EKeyDecBrightness, Key_unknown}, - {EKeyKeyboardExtend, Key_unknown}, - {EKeyDevice10, Key_unknown}, - {EKeyDevice11, Key_unknown}, - {EKeyDevice12, Key_unknown}, - {EKeyDevice13, Key_unknown}, - {EKeyDevice14, Key_unknown}, - {EKeyDevice15, Key_unknown}, - {EKeyDevice16, Key_unknown}, - {EKeyDevice17, Key_unknown}, - {EKeyDevice18, Key_unknown}, - {EKeyDevice19, Key_unknown}, - {EKeyDevice1A, Key_unknown}, - {EKeyDevice1B, Key_unknown}, - {EKeyDevice1C, Key_unknown}, - {EKeyDevice1D, Key_unknown}, - {EKeyDevice1E, Key_unknown}, - {EKeyDevice1F, Key_unknown}, - {EKeyApplication10, Key_unknown}, - {EKeyApplication11, Key_unknown}, - {EKeyApplication12, Key_unknown}, - {EKeyApplication13, Key_unknown}, - {EKeyApplication14, Key_unknown}, - {EKeyApplication15, Key_unknown}, - {EKeyApplication16, Key_unknown}, - {EKeyApplication17, Key_unknown}, - {EKeyApplication18, Key_unknown}, - {EKeyApplication19, Key_unknown}, - {EKeyApplication1A, Key_unknown}, - {EKeyApplication1B, Key_unknown}, - {EKeyApplication1C, Key_unknown}, - {EKeyApplication1D, Key_unknown}, - {EKeyApplication1E, Key_unknown}, - {EKeyApplication1F, Key_unknown} - }; - const int mapSize = int(sizeof(map)/sizeof(map[0])); - s60ToQtKeyMap.reserve(mapSize + 5); // +5? docs: Ideally, slightly more than number of items - for (int i = 0; i < mapSize; ++i) - s60ToQtKeyMap.insert(map[i].s60Key, map[i].qtKey); + int res = Qt::Key_unknown; + for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) { + if (keyMapping[i].s60KeyCode == s60key) { + res = keyMapping[i].qtKey; + break; + } + } + return res; } -int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key) +int QKeyMapperPrivate::mapS60ScanCodesToQt(TUint s60scanCode) { - QHash<TUint, int>::const_iterator mapping; - mapping = s60ToQtKeyMap.find(s60key); - if (mapping != s60ToQtKeyMap.end()) { - return *mapping; - } else { - return Qt::Key_unknown; + int res = Qt::Key_unknown; + for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) { + if (keyMapping[i].s60ScanCode == s60scanCode) { + res = keyMapping[i].qtKey; + break; + } } + return res; } +int QKeyMapperPrivate::mapQtToS60Key(int qtKey) +{ + int res = KErrUnknown; + for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) { + if (keyMapping[i].qtKey == qtKey) { + res = keyMapping[i].s60KeyCode; + break; + } + } + return res; +} + +int QKeyMapperPrivate::mapQtToS60ScanCodes(int qtKey) +{ + int res = KErrUnknown; + for (int i = 0; keyMapping[i].s60KeyCode != 0; i++) { + if (keyMapping[i].qtKey == qtKey) { + res = keyMapping[i].s60ScanCode; + break; + } + } + return res; +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp index 578f32a..e555c5c 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/gui/kernel/qkeymapper_win.cpp @@ -619,7 +619,7 @@ void QKeyMapperPrivate::clearMappings() /* MAKELCID()'s first argument is a WORD, and GetKeyboardLayout() * returns a DWORD. */ - LCID newLCID = MAKELCID((DWORD)GetKeyboardLayout(0), SORT_DEFAULT); + LCID newLCID = MAKELCID((quintptr)GetKeyboardLayout(0), SORT_DEFAULT); // keyboardInputLocale = qt_localeFromLCID(newLCID); bool bidi = false; diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index e9fdbda..9560952 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -369,6 +369,16 @@ QMacTabletHash *qt_mac_tablet_hash() } #ifdef QT_MAC_USE_COCOA + +// Clears the QWidget pointer that each QCocoaView holds. +void qt_mac_clearCocoaViewQWidgetPointers(QWidget *widget) +{ + QCocoaView *cocoaView = reinterpret_cast<QCocoaView *>(qt_mac_nativeview_for(widget)); + if (cocoaView && [cocoaView respondsToSelector:@selector(qt_qwidget)]) { + [cocoaView qt_clearQWidget]; + } +} + void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent) { NSEvent *proximityEvent = static_cast<NSEvent *>(tabletEvent); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index d433048..2f6ec6b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -118,6 +118,10 @@ #include "private/qgraphicssystem_p.h" #include "private/qgesturemanager_p.h" +#ifdef QT_KEYPAD_NAVIGATION +#include "qtabwidget.h" // Needed in inTabWidget() +#endif // QT_KEYPAD_NAVIGATION + // widget/widget data creation count //#define QWIDGET_EXTRA_DEBUG //#define ALIEN_DEBUG @@ -1468,6 +1472,15 @@ QWidget::~QWidget() d->declarativeData = 0; // don't activate again in ~QObject } +#ifdef QT_MAC_USE_COCOA + // QCocoaView holds a pointer back to this widget. Clear it now + // to make sure it's not followed later on. The lifetime of the + // QCocoaView might exceed the lifetime of this widget in cases + // where Cocoa itself holds references to it. + extern void qt_mac_clearCocoaViewQWidgetPointers(QWidget *); + qt_mac_clearCocoaViewQWidgetPointers(this); +#endif + if (!d->children.isEmpty()) d->deleteChildren(); @@ -11632,6 +11645,45 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction) } return targetWidget; } + +/*! + \internal + + Tells us if it there is currently a reachable widget by keypad navigation in + a certain \a orientation. + If no navigation is possible, occuring key events in that \a orientation may + be used to interact with the value in the focussed widget, even though it + currently has not the editFocus. + + \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus() +*/ +bool QWidgetPrivate::canKeypadNavigate(Qt::Orientation orientation) +{ + return orientation == Qt::Horizontal? + (QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionEast) + || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionWest)) + :(QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionNorth) + || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionSouth)); +} +/*! + \internal + + Checks, if the \a widget is inside a QTabWidget. If is is inside + one, left/right key events will be used to switch between tabs in keypad + navigation. If there is no QTabWidget, the horizontal key events can be used +to + interact with the value in the focussed widget, even though it currently has + not the editFocus. + + \sa QWidget::hasEditFocus() +*/ +bool QWidgetPrivate::inTabWidget(QWidget *widget) +{ + for (QWidget *tabWidget = widget; tabWidget; tabWidget = tabWidget->parentWidget()) + if (qobject_cast<const QTabWidget*>(tabWidget)) + return true; + return false; +} #endif /*! diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index da9e9eb..dcb87fc 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4543,8 +4543,20 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) } } + // ### Scroll the dirty regions as well, the following is not correct. + QRegion displayRegion = r.isNull() ? dirtyOnWidget : (dirtyOnWidget & r); + const QVector<QRect> &rects = dirtyOnWidget.rects(); + const QVector<QRect>::const_iterator end = rects.end(); + QVector<QRect>::const_iterator it = rects.begin(); + while (it != end) { + const QRect rect = *it; + const NSRect dirtyRect = NSMakeRect(rect.x() + dx, rect.y() + dy, + rect.width(), rect.height()); + [view setNeedsDisplayInRect:dirtyRect]; + ++it; + } + NSSize deltaSize = NSMakeSize(dx, dy); - [view translateRectsNeedingDisplayInRect:scrollRect by:deltaSize]; [view scrollRect:scrollRect by:deltaSize]; [view setNeedsDisplayInRect:deltaXRect]; [view setNeedsDisplayInRect:deltaYRect]; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 75b4c12..efd9a0a 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -475,6 +475,8 @@ public: #ifdef QT_KEYPAD_NAVIGATION static bool navigateToDirection(Direction direction); static QWidget *widgetInNavigationDirection(Direction direction); + static bool canKeypadNavigate(Qt::Orientation orientation); + static bool inTabWidget(QWidget *widget); #endif void setWindowIconText_sys(const QString &cap); diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 070491d..891f4c2 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -46,6 +46,7 @@ #include <private/qdrawhelper_armv6_p.h> #include <private/qdrawhelper_neon_p.h> #include <private/qmath_p.h> +#include <private/qsimd_p.h> #include <qmath.h> QT_BEGIN_NAMESPACE @@ -3700,7 +3701,7 @@ template <> Q_STATIC_TEMPLATE_SPECIALIZATION inline quint32 alpha_4(const qargb8555 *src) { - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint8 *src8 = reinterpret_cast<const quint8*>(src); return src8[0] << 24 | src8[3] << 16 | src8[6] << 8 | src8[9]; } @@ -4026,8 +4027,8 @@ template <> inline void interpolate_pixel_4(qargb8565 *dest, const qargb8565 *src, quint32 alpha) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = eff_alpha_4(alpha, dest); const quint32 ia = eff_ialpha_4(alpha, dest); @@ -4122,8 +4123,8 @@ template <> inline void interpolate_pixel_4(qargb8555 *dest, const qargb8555 *src, quint32 alpha) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = eff_alpha_4(alpha, dest); @@ -4218,8 +4219,8 @@ template <> inline void interpolate_pixel_4(qrgb888 *dest, const qrgb888 *src, quint32 alpha) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = eff_alpha_4(alpha, dest); const quint32 ia = eff_ialpha_4(alpha, dest); @@ -4291,8 +4292,8 @@ template <class DST, class SRC> inline void interpolate_pixel_4(DST *dest, quint8 a, const SRC *src, quint8 b) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); dest[0] = dest[0].byte_mul(a) + DST(src[0]).byte_mul(b); dest[1] = dest[1].byte_mul(a) + DST(src[1]).byte_mul(b); @@ -4303,8 +4304,8 @@ inline void interpolate_pixel_4(DST *dest, quint8 a, template <class DST, class SRC> inline void blend_sourceOver_4(DST *dest, const SRC *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { @@ -4319,8 +4320,8 @@ inline void blend_sourceOver_4(DST *dest, const SRC *src) template <> inline void blend_sourceOver_4(qargb8565 *dest, const qargb8565 *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { @@ -4333,8 +4334,8 @@ inline void blend_sourceOver_4(qargb8565 *dest, const qargb8565 *src) template <> inline void blend_sourceOver_4(qargb8555 *dest, const qargb8555 *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { @@ -4347,8 +4348,8 @@ inline void blend_sourceOver_4(qargb8555 *dest, const qargb8555 *src) template <> inline void blend_sourceOver_4(qargb6666 *dest, const qargb6666 *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { @@ -7720,199 +7721,6 @@ static void qt_memfill16_setup(quint16 *dest, quint16 value, int count); qt_memfill32_func qt_memfill32 = qt_memfill32_setup; qt_memfill16_func qt_memfill16 = qt_memfill16_setup; -enum CPUFeatures { - None = 0, - MMX = 0x1, - MMXEXT = 0x2, - MMX3DNOW = 0x4, - MMX3DNOWEXT = 0x8, - SSE = 0x10, - SSE2 = 0x20, - CMOV = 0x40, - IWMMXT = 0x80, - NEON = 0x100 -}; - -static uint detectCPUFeatures() -{ -#if defined (Q_OS_WINCE) -#if defined (ARM) - if (IsProcessorFeaturePresent(PF_ARM_INTEL_WMMX)) - return IWMMXT; -#elif defined(_X86_) - uint features = 0; -#if defined QT_HAVE_MMX - if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE)) - features |= MMX; -#endif -#if defined QT_HAVE_3DNOW - if (IsProcessorFeaturePresent(PF_3DNOW_INSTRUCTIONS_AVAILABLE)) - features |= MMX3DNOW; -#endif - return features; -#endif - return 0; -#elif defined(QT_HAVE_IWMMXT) - // runtime detection only available when running as a previlegied process - static const bool doIWMMXT = !qgetenv("QT_NO_IWMMXT").toInt(); - return doIWMMXT ? IWMMXT : 0; -#elif defined(QT_HAVE_NEON) - static const bool doNEON = !qgetenv("QT_NO_NEON").toInt(); - return doNEON ? NEON : 0; -#else - uint features = 0; -#if defined(__x86_64__) || defined(Q_OS_WIN64) - features = MMX|SSE|SSE2|CMOV; -#elif defined(__ia64__) - features = MMX|SSE|SSE2; -#elif defined(__i386__) || defined(_M_IX86) - unsigned int extended_result = 0; - uint result = 0; - /* see p. 118 of amd64 instruction set manual Vol3 */ -#if defined(Q_CC_GNU) - asm ("push %%ebx\n" - "pushf\n" - "pop %%eax\n" - "mov %%eax, %%ebx\n" - "xor $0x00200000, %%eax\n" - "push %%eax\n" - "popf\n" - "pushf\n" - "pop %%eax\n" - "xor %%edx, %%edx\n" - "xor %%ebx, %%eax\n" - "jz 1f\n" - - "mov $0x00000001, %%eax\n" - "cpuid\n" - "1:\n" - "pop %%ebx\n" - "mov %%edx, %0\n" - : "=r" (result) - : - : "%eax", "%ecx", "%edx" - ); - - asm ("push %%ebx\n" - "pushf\n" - "pop %%eax\n" - "mov %%eax, %%ebx\n" - "xor $0x00200000, %%eax\n" - "push %%eax\n" - "popf\n" - "pushf\n" - "pop %%eax\n" - "xor %%edx, %%edx\n" - "xor %%ebx, %%eax\n" - "jz 2f\n" - - "mov $0x80000000, %%eax\n" - "cpuid\n" - "cmp $0x80000000, %%eax\n" - "jbe 2f\n" - "mov $0x80000001, %%eax\n" - "cpuid\n" - "2:\n" - "pop %%ebx\n" - "mov %%edx, %0\n" - : "=r" (extended_result) - : - : "%eax", "%ecx", "%edx" - ); -#elif defined (Q_OS_WIN) - _asm { - push eax - push ebx - push ecx - push edx - pushfd - pop eax - mov ebx, eax - xor eax, 00200000h - push eax - popfd - pushfd - pop eax - mov edx, 0 - xor eax, ebx - jz skip - - mov eax, 1 - cpuid - mov result, edx - skip: - pop edx - pop ecx - pop ebx - pop eax - } - - _asm { - push eax - push ebx - push ecx - push edx - pushfd - pop eax - mov ebx, eax - xor eax, 00200000h - push eax - popfd - pushfd - pop eax - mov edx, 0 - xor eax, ebx - jz skip2 - - mov eax, 80000000h - cpuid - cmp eax, 80000000h - jbe skip2 - mov eax, 80000001h - cpuid - mov extended_result, edx - skip2: - pop edx - pop ecx - pop ebx - pop eax - } -#endif - - // result now contains the standard feature bits - if (result & (1u << 15)) - features |= CMOV; - if (result & (1u << 23)) - features |= MMX; - if (extended_result & (1u << 22)) - features |= MMXEXT; - if (extended_result & (1u << 31)) - features |= MMX3DNOW; - if (extended_result & (1u << 30)) - features |= MMX3DNOWEXT; - if (result & (1u << 25)) - features |= SSE; - if (result & (1u << 26)) - features |= SSE2; -#endif // i386 - - if (qgetenv("QT_NO_MMX").toInt()) - features ^= MMX; - if (qgetenv("QT_NO_MMXEXT").toInt()) - features ^= MMXEXT; - if (qgetenv("QT_NO_3DNOW").toInt()) - features ^= MMX3DNOW; - if (qgetenv("QT_NO_3DNOWEXT").toInt()) - features ^= MMX3DNOWEXT; - if (qgetenv("QT_NO_SSE").toInt()) - features ^= SSE; - if (qgetenv("QT_NO_SSE2").toInt()) - features ^= SSE2; - - return features; -#endif -} - #if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) // Move these to qdrawhelper_arm.c when all // functions are implemented using arm assembly. @@ -8005,10 +7813,7 @@ static void qt_blend_color_argb_armv6(int count, const QSpan *spans, void *userD void qInitDrawhelperAsm() { - static uint features = 0xffffffff; - if (features != 0xffffffff) - return; - features = detectCPUFeatures(); + const uint features = qDetectCPUFeatures(); qt_memfill32 = qt_memfill_template<quint32, quint32>; qt_memfill16 = qt_memfill_quint16; //qt_memfill_template<quint16, quint16>; diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index cb0db4f..f5b17ea 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -67,15 +67,6 @@ #include "QtGui/qscreen_qws.h" #endif -// Disable MMX and SSE on Mac/PPC builds, or if the compiler -// does not support -Xarch argument passing -#if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__))) -#undef QT_HAVE_SSE2 -#undef QT_HAVE_SSE -#undef QT_HAVE_3DNOW -#undef QT_HAVE_MMX -#endif - QT_BEGIN_NAMESPACE #if defined(Q_CC_MSVC) && _MSCVER <= 1300 && !defined(Q_CC_INTEL) @@ -1649,7 +1640,7 @@ inline void qt_memconvert(qrgb666 *dest, const quint32 *src, int count) return; } - const int align = (long(dest) & 3); + const int align = (quintptr(dest) & 3); switch (align) { case 1: *dest++ = qrgb666(*src++); --count; case 2: *dest++ = qrgb666(*src++); --count; diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index 5619a2e..d76c709 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1081,7 +1081,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, according to the \a margins structure. */ -typedef QVarLengthArray<QDrawPixmaps::Data, 16> QDrawPixmapsDataArray; +typedef QVarLengthArray<QPainter::Fragment, 16> QPixmapFragmentsArray; /*! \since 4.6 @@ -1102,12 +1102,12 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin const QPixmap &pixmap, const QRect &sourceRect,const QMargins &sourceMargins, const QTileRules &rules, QDrawBorderPixmap::DrawingHints hints) { - QDrawPixmaps::Data d; + QPainter::Fragment d; d.opacity = 1.0; d.rotation = 0.0; - QDrawPixmapsDataArray opaqueData; - QDrawPixmapsDataArray translucentData; + QPixmapFragmentsArray opaqueData; + QPixmapFragmentsArray translucentData; // source center const int sourceCenterTop = sourceRect.top() + sourceMargins.top(); @@ -1182,44 +1182,56 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin // corners if (targetMargins.top() > 0 && targetMargins.left() > 0 && sourceMargins.top() > 0 && sourceMargins.left() > 0) { // top left - d.point.setX(0.5 * (xTarget[1] + xTarget[0])); - d.point.setY(0.5 * (yTarget[1] + yTarget[0])); - d.source = QRectF(sourceRect.left(), sourceRect.top(), sourceMargins.left(), sourceMargins.top()); - d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.source.width(); - d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.source.height(); + d.x = (0.5 * (xTarget[1] + xTarget[0])); + d.y = (0.5 * (yTarget[1] + yTarget[0])); + d.sourceLeft = sourceRect.left(); + d.sourceTop = sourceRect.top(); + d.width = sourceMargins.left(); + d.height = sourceMargins.top(); + d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; + d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; if (hints & QDrawBorderPixmap::OpaqueTopLeft) opaqueData.append(d); else translucentData.append(d); } if (targetMargins.top() > 0 && targetMargins.right() > 0 && sourceMargins.top() > 0 && sourceMargins.right() > 0) { // top right - d.point.setX(0.5 * (xTarget[columns] + xTarget[columns - 1])); - d.point.setY(0.5 * (yTarget[1] + yTarget[0])); - d.source = QRectF(sourceCenterRight, sourceRect.top(), sourceMargins.right(), sourceMargins.top()); - d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.source.width(); - d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.source.height(); + d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); + d.y = (0.5 * (yTarget[1] + yTarget[0])); + d.sourceLeft = sourceCenterRight; + d.sourceTop = sourceRect.top(); + d.width = sourceMargins.right(); + d.height = sourceMargins.top(); + d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; + d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; if (hints & QDrawBorderPixmap::OpaqueTopRight) opaqueData.append(d); else translucentData.append(d); } if (targetMargins.bottom() > 0 && targetMargins.left() > 0 && sourceMargins.bottom() > 0 && sourceMargins.left() > 0) { // bottom left - d.point.setX(0.5 * (xTarget[1] + xTarget[0])); - d.point.setY(0.5 * (yTarget[rows] + yTarget[rows - 1])); - d.source = QRectF(sourceRect.left(), sourceCenterBottom, sourceMargins.left(), sourceMargins.bottom()); - d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.source.width(); - d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.source.height(); + d.x = (0.5 * (xTarget[1] + xTarget[0])); + d.y =(0.5 * (yTarget[rows] + yTarget[rows - 1])); + d.sourceLeft = sourceRect.left(); + d.sourceTop = sourceCenterBottom; + d.width = sourceMargins.left(); + d.height = sourceMargins.bottom(); + d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; + d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; if (hints & QDrawBorderPixmap::OpaqueBottomLeft) opaqueData.append(d); else translucentData.append(d); } if (targetMargins.bottom() > 0 && targetMargins.right() > 0 && sourceMargins.bottom() > 0 && sourceMargins.right() > 0) { // bottom right - d.point.setX(0.5 * (xTarget[columns] + xTarget[columns - 1])); - d.point.setY(0.5 * (yTarget[rows] + yTarget[rows - 1])); - d.source = QRectF(sourceCenterRight, sourceCenterBottom, sourceMargins.right(), sourceMargins.bottom()); - d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.source.width(); - d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.source.height(); + d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); + d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1])); + d.sourceLeft = sourceCenterRight; + d.sourceTop = sourceCenterBottom; + d.width = sourceMargins.right(); + d.height = sourceMargins.bottom(); + d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; + d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; if (hints & QDrawBorderPixmap::OpaqueBottomRight) opaqueData.append(d); else @@ -1229,151 +1241,107 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin // horizontal edges if (targetCenterWidth > 0 && sourceCenterWidth > 0) { if (targetMargins.top() > 0 && sourceMargins.top() > 0) { // top - QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueTop ? opaqueData : translucentData; - d.source = QRectF(sourceCenterLeft, sourceRect.top(), sourceCenterWidth, sourceMargins.top()); - d.point.setY(0.5 * (yTarget[1] + yTarget[0])); - d.scaleX = dx / d.source.width(); - d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.source.height(); + QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueTop ? opaqueData : translucentData; + d.sourceLeft = sourceCenterLeft; + d.sourceTop = sourceRect.top(); + d.width = sourceCenterWidth; + d.height = sourceMargins.top(); + d.y = (0.5 * (yTarget[1] + yTarget[0])); + d.scaleX = dx / d.width; + d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; for (int i = 1; i < columns - 1; ++i) { - d.point.setX(0.5 * (xTarget[i + 1] + xTarget[i])); + d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); data.append(d); } if (rules.horizontal == Qt::RepeatTile) - data[data.size() - 1].source.setWidth((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX); + data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX); } if (targetMargins.bottom() > 0 && sourceMargins.bottom() > 0) { // bottom - QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueBottom ? opaqueData : translucentData; - d.source = QRectF(sourceCenterLeft, sourceCenterBottom, sourceCenterWidth, sourceMargins.bottom());; - d.point.setY(0.5 * (yTarget[rows] + yTarget[rows - 1])); - d.scaleX = dx / d.source.width(); - d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.source.height(); + QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueBottom ? opaqueData : translucentData; + d.sourceLeft = sourceCenterLeft; + d.sourceTop = sourceCenterBottom; + d.width = sourceCenterWidth; + d.height = sourceMargins.bottom(); + d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1])); + d.scaleX = dx / d.width; + d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; for (int i = 1; i < columns - 1; ++i) { - d.point.setX(0.5 * (xTarget[i + 1] + xTarget[i])); + d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); data.append(d); } if (rules.horizontal == Qt::RepeatTile) - data[data.size() - 1].source.setWidth((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX); + data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX); } } // vertical edges if (targetCenterHeight > 0 && sourceCenterHeight > 0) { if (targetMargins.left() > 0 && sourceMargins.left() > 0) { // left - QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueLeft ? opaqueData : translucentData; - d.source = QRectF(sourceRect.left(), sourceCenterTop, sourceMargins.left(), sourceCenterHeight); - d.point.setX(0.5 * (xTarget[1] + xTarget[0])); - d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.source.width(); - d.scaleY = dy / d.source.height(); + QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueLeft ? opaqueData : translucentData; + d.sourceLeft = sourceRect.left(); + d.sourceTop = sourceCenterTop; + d.width = sourceMargins.left(); + d.height = sourceCenterHeight; + d.x = (0.5 * (xTarget[1] + xTarget[0])); + d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; + d.scaleY = dy / d.height; for (int i = 1; i < rows - 1; ++i) { - d.point.setY(0.5 * (yTarget[i + 1] + yTarget[i])); + d.y = (0.5 * (yTarget[i + 1] + yTarget[i])); data.append(d); } if (rules.vertical == Qt::RepeatTile) - data[data.size() - 1].source.setHeight((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY); + data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY); } if (targetMargins.right() > 0 && sourceMargins.right() > 0) { // right - QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueRight ? opaqueData : translucentData; - d.source = QRectF(sourceCenterRight, sourceCenterTop, sourceMargins.right(), sourceCenterHeight); - d.point.setX(0.5 * (xTarget[columns] + xTarget[columns - 1])); - d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.source.width(); - d.scaleY = dy / d.source.height(); + QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueRight ? opaqueData : translucentData; + d.sourceLeft = sourceCenterRight; + d.sourceTop = sourceCenterTop; + d.width = sourceMargins.right(); + d.height = sourceCenterHeight; + d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); + d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; + d.scaleY = dy / d.height; for (int i = 1; i < rows - 1; ++i) { - d.point.setY(0.5 * (yTarget[i + 1] + yTarget[i])); + d.y = (0.5 * (yTarget[i + 1] + yTarget[i])); data.append(d); } if (rules.vertical == Qt::RepeatTile) - data[data.size() - 1].source.setHeight((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY); + data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY); } } // center if (targetCenterWidth > 0 && targetCenterHeight > 0 && sourceCenterWidth > 0 && sourceCenterHeight > 0) { - QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueCenter ? opaqueData : translucentData; - d.source = QRectF(sourceCenterLeft, sourceCenterTop, sourceCenterWidth, sourceCenterHeight); - d.scaleX = dx / d.source.width(); - d.scaleY = dy / d.source.height(); + QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueCenter ? opaqueData : translucentData; + d.sourceLeft = sourceCenterLeft; + d.sourceTop = sourceCenterTop; + d.width = sourceCenterWidth; + d.height = sourceCenterHeight; + d.scaleX = dx / d.width; + d.scaleY = dy / d.height; qreal repeatWidth = (xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX; qreal repeatHeight = (yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY; for (int j = 1; j < rows - 1; ++j) { - d.point.setY(0.5 * (yTarget[j + 1] + yTarget[j])); + d.y = (0.5 * (yTarget[j + 1] + yTarget[j])); for (int i = 1; i < columns - 1; ++i) { - d.point.setX(0.5 * (xTarget[i + 1] + xTarget[i])); + d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); data.append(d); } if (rules.horizontal == Qt::RepeatTile) - data[data.size() - 1].source.setWidth(repeatWidth); + data[data.size() - 1].width = repeatWidth; } if (rules.vertical == Qt::RepeatTile) { for (int i = 1; i < columns - 1; ++i) - data[data.size() - i].source.setHeight(repeatHeight); + data[data.size() - i].height = repeatHeight; } } if (opaqueData.size()) - qDrawPixmaps(painter, opaqueData.data(), opaqueData.size(), pixmap, QDrawPixmaps::OpaqueHint); + painter->drawPixmapFragments(opaqueData.data(), opaqueData.size(), pixmap, QPainter::OpaqueHint); if (translucentData.size()) - qDrawPixmaps(painter, translucentData.data(), translucentData.size(), pixmap); -} - -/*! - \class QDrawPixmaps::Data - \since 4.6 - \internal - - This structure is used with the qDrawPixmaps() function. - - QPointF point: Specifies the center of the target rectangle. - QRectF source: Specifies the source rectangle in the pixmap passed into the qDrawPixmaps() call. - qreal scaleX: Specifies the horizontal scale of the target rectangle. - qreal scaleY: Specifies the vertical scale of the target rectangle. - qreal rotation: Specifies the rotation of the target rectangle in degrees. - The target rectangle is rotated after scaling. - qreal opacity: Specifies the opacity of the rectangle. -*/ - -/*! - \enum QDrawPixmaps::DrawingHint - \internal -*/ - -/*! - \internal - \since 4.6 - - This function is used to draw \a pixmap, or a sub-rectangle of \a pixmap, at multiple positions - with different scale, rotation and opacity on \a painter. \a drawingData is an array of \a - dataCount elements specifying the parameters used to draw each pixmap instance. - This can be used for example to implement a particle system. -*/ -void qDrawPixmaps(QPainter *painter, const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints) -{ - QPaintEngine *engine = painter->paintEngine(); - if (!engine) - return; - - if (engine->isExtended()) { - static_cast<QPaintEngineEx *>(engine)->drawPixmaps(drawingData, dataCount, pixmap, hints); - } else { - qreal oldOpacity = painter->opacity(); - QTransform oldTransform = painter->transform(); - - for (int i = 0; i < dataCount; ++i) { - QTransform transform = oldTransform; - transform.translate(drawingData[i].point.x(), drawingData[i].point.y()); - transform.rotate(drawingData[i].rotation); - painter->setOpacity(oldOpacity * drawingData[i].opacity); - painter->setTransform(transform); - - qreal w = drawingData[i].scaleX * drawingData[i].source.width(); - qreal h = drawingData[i].scaleY * drawingData[i].source.height(); - painter->drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source); - } - - painter->setOpacity(oldOpacity); - painter->setTransform(oldTransform); - } + painter->drawPixmapFragments(translucentData.data(), translucentData.size(), pixmap); } QT_END_NAMESPACE diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h index 2801b2f..31e352f 100644 --- a/src/gui/painting/qdrawutil.h +++ b/src/gui/painting/qdrawutil.h @@ -188,31 +188,6 @@ inline void qDrawBorderPixmap(QPainter *painter, qDrawBorderPixmap(painter, target, margins, pixmap, pixmap.rect(), margins); } -// For internal use only. -namespace QDrawPixmaps -{ - struct Data - { - QPointF point; - QRectF source; - qreal scaleX; - qreal scaleY; - qreal rotation; - qreal opacity; - }; - - enum DrawingHint - { - OpaqueHint = 0x01 - }; - - Q_DECLARE_FLAGS(DrawingHints, DrawingHint) -} - -// This function is private and may change without notice. Do not use outside Qt!!! -Q_GUI_EXPORT void qDrawPixmaps(QPainter *painter, const QDrawPixmaps::Data *drawingData, - int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints = 0); - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 60265c5..a7c2a0b 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3213,6 +3213,9 @@ QRasterPaintEnginePrivate::getPenFunc(const QRectF &rect, return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend; } +/*! + \reimp +*/ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) { ensurePen(); diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 4f2fffa..98762f0 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -893,7 +893,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount) for (int i=0; i<count; ++i) { pts[++oset] = points[i].x(); pts[++oset] = points[i].y(); - pts[++oset] = points[i].x() + 1/63; + pts[++oset] = points[i].x() + 1/63.; pts[++oset] = points[i].y(); } QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint); @@ -970,23 +970,26 @@ void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, con fill(path, brush); } -void QPaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints /*hints*/) +void QPaintEngineEx::drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, + const QPixmap &pixmap, QPainter::FragmentHints /*hints*/) { qreal oldOpacity = state()->opacity; QTransform oldTransform = state()->matrix; - for (int i = 0; i < dataCount; ++i) { + for (int i = 0; i < fragmentCount; ++i) { QTransform transform = oldTransform; - transform.translate(drawingData[i].point.x(), drawingData[i].point.y()); - transform.rotate(drawingData[i].rotation); - state()->opacity = oldOpacity * drawingData[i].opacity; + transform.translate(fragments[i].x, fragments[i].y); + transform.rotate(fragments[i].rotation); + state()->opacity = oldOpacity * fragments[i].opacity; state()->matrix = transform; opacityChanged(); transformChanged(); - qreal w = drawingData[i].scaleX * drawingData[i].source.width(); - qreal h = drawingData[i].scaleY * drawingData[i].source.height(); - drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source); + qreal w = fragments[i].scaleX * fragments[i].width; + qreal h = fragments[i].scaleY * fragments[i].height; + QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop, + fragments[i].width, fragments[i].height); + drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect); } state()->opacity = oldOpacity; diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 90c4f9f..2401b94 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -197,7 +197,7 @@ public: virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); - virtual void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QFlags<QDrawPixmaps::DrawingHint> hints); + virtual void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QFlags<QPainter::FragmentHint> hints); virtual void updateState(const QPaintEngineState &state); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 4f532c0..dc96c17 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5700,6 +5700,61 @@ void QPainter::drawImage(const QRectF &targetRect, const QImage &image, const QR d->engine->drawImage(QRectF(x, y, w, h), image, QRectF(sx, sy, sw, sh), flags); } + +void qt_draw_glyphs(QPainter *painter, const quint32 *glyphArray, const QPointF *positionArray, + int glyphCount) +{ + QPainterPrivate *painter_d = QPainterPrivate::get(painter); + painter_d->drawGlyphs(glyphArray, positionArray, glyphCount); +} + +void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, const QPointF *positionArray, + int glyphCount) +{ + updateState(state); + + QFontEngine *fontEngine = state->font.d->engineForScript(QUnicodeTables::Common); + + QVarLengthArray<QFixedPoint, 128> positions; + for (int i=0; i<glyphCount; ++i) { + QFixedPoint fp = QFixedPoint::fromPointF(positionArray[i]); + positions.append(fp); + } + + if (extended != 0) { + QStaticTextItem staticTextItem; + staticTextItem.color = state->pen.color(); + staticTextItem.font = state->font; + staticTextItem.fontEngine = fontEngine; + staticTextItem.numGlyphs = glyphCount; + staticTextItem.glyphs = reinterpret_cast<glyph_t *>(const_cast<glyph_t *>(glyphArray)); + staticTextItem.glyphPositions = positions.data(); + + extended->drawStaticTextItem(&staticTextItem); + } else { + QTextItemInt textItem; + textItem.f = &state->font; + textItem.fontEngine = fontEngine; + + QVarLengthArray<QFixed, 128> advances(glyphCount); + QVarLengthArray<QGlyphJustification, 128> glyphJustifications(glyphCount); + QVarLengthArray<HB_GlyphAttributes, 128> glyphAttributes(glyphCount); + qMemSet(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes)); + qMemSet(advances.data(), 0, advances.size() * sizeof(QFixed)); + qMemSet(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification)); + + textItem.glyphs.numGlyphs = glyphCount; + textItem.glyphs.glyphs = reinterpret_cast<HB_Glyph *>(const_cast<quint32 *>(glyphArray)); + textItem.glyphs.offsets = positions.data(); + textItem.glyphs.advances_x = advances.data(); + textItem.glyphs.advances_y = advances.data(); + textItem.glyphs.justifications = glyphJustifications.data(); + textItem.glyphs.attributes = glyphAttributes.data(); + + engine->drawTextItem(QPointF(0, 0), textItem); + } +} + /*! \fn void QPainter::drawStaticText(const QPoint &position, const QStaticText &staticText) @@ -8847,6 +8902,160 @@ QTransform QPainter::combinedTransform() const return d->state->worldMatrix * d->viewTransform(); } +/*! + \since 4.7 + + This function is used to draw \a pixmap, or a sub-rectangle of \a pixmap, + at multiple positions with different scale, rotation and opacity. \a + fragments is an array of \a fragmentCount elements specifying the + parameters used to draw each pixmap fragment. The \a hints + parameter can be used to pass in drawing hints. + + This function is potentially faster than multiple calls to drawPixmap(), + since the backend can optimize state changes. + + \sa QPainter::Fragment, QPainter::FragmentHint +*/ + +void QPainter::drawPixmapFragments(const Fragment *fragments, int fragmentCount, + const QPixmap &pixmap, FragmentHints hints) +{ + Q_D(QPainter); + + if (!d->engine) + return; + + if (d->engine->isExtended()) { + d->extended->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); + } else { + qreal oldOpacity = opacity(); + QTransform oldTransform = transform(); + + for (int i = 0; i < fragmentCount; ++i) { + QTransform transform = oldTransform; + transform.translate(fragments[i].x, fragments[i].y); + transform.rotate(fragments[i].rotation); + setOpacity(oldOpacity * fragments[i].opacity); + setTransform(transform); + + qreal w = fragments[i].scaleX * fragments[i].width; + qreal h = fragments[i].scaleY * fragments[i].height; + QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop, + fragments[i].width, fragments[i].height); + drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect); + } + + setOpacity(oldOpacity); + setTransform(oldTransform); + } +} + +/*! + \since 4.7 + \class QPainter::Fragment + + \brief This class is used in conjunction with the + QPainter::drawPixmapFragments() function to specify how a pixmap, or + sub-rect of a pixmap, is drawn. + + The \a sourceLeft, \a sourceTop, \a width and \a height variables are used + as a source rectangle within the pixmap passed into the + QPainter::drawPixmapFragments() function. The variables \a x, \a y, \a + width and \a height are used to calculate the target rectangle that is + drawn. \a x and \a y denotes the center of the target rectangle. The \a + width and \a heigth in the target rectangle is scaled by the \a scaleX and + \a scaleY values. The resulting target rectangle is then rotated \a + rotation degrees around the \a x, \a y center point. + + \sa QPainter::drawPixmapFragments() +*/ + +/*! + \since 4.7 + + This is a convenience function that returns a QPainter::Fragment that is + initialized with the \a pos, \a sourceRect, \a scaleX, \a scaleY, \a + rotation, \a opacity parameters. +*/ + +QPainter::Fragment QPainter::Fragment::create(const QPointF &pos, const QRectF &sourceRect, + qreal scaleX, qreal scaleY, qreal rotation, + qreal opacity) +{ + Fragment fragment = {pos.x(), pos.y(), sourceRect.x(), sourceRect.y(), sourceRect.width(), + sourceRect.height(), scaleX, scaleY, rotation, opacity}; + return fragment; +} + +/*! + \variable QPainter::Fragment::x + \brief the x coordinate of center point in the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::y + \brief the y coordinate of the center point in the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::sourceLeft + \brief the left coordinate of the source rectangle. +*/ + +/*! + \variable QPainter::Fragment::sourceTop + \brief the top coordinate of the source rectangle. +*/ + +/*! + \variable QPainter::Fragment::width + + \brief the width of the source rectangle and is used to calculate the width + of the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::height + + \brief the height of the source rectangle and is used to calculate the + height of the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::scaleX + \brief the horizontal scale of the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::scaleY + \brief the vertical scale of the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::rotation + + \brief the rotation of the target rectangle in degrees. The target + rectangle is rotated after it has been scaled. +*/ + +/*! + \variable QPainter::Fragment::opacity + + \brief the opacity of the target rectangle, where 0.0 is fully transparent + and 1.0 is fully opaque. +*/ + +/*! + \since 4.7 + + \enum QPainter::FragmentHint + + \value OpaqueHint Indicates that the pixmap fragments to be drawn are + opaque. Opaque fragments are potentially faster to draw. + + \sa QPainter::drawPixmapFragments(), QPainter::Fragment +*/ + void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation) { p->draw_helper(path, operation); diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index e9fd532..bcb0b50 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -99,6 +99,29 @@ public: Q_DECLARE_FLAGS(RenderHints, RenderHint) + class Fragment { + public: + qreal x; + qreal y; + qreal sourceLeft; + qreal sourceTop; + qreal width; + qreal height; + qreal scaleX; + qreal scaleY; + qreal rotation; + qreal opacity; + static Fragment Q_GUI_EXPORT create(const QPointF &pos, const QRectF &sourceRect, + qreal scaleX = 1, qreal scaleY = 1, + qreal rotation = 0, qreal opacity = 1); + }; + + enum FragmentHint { + OpaqueHint = 0x01 + }; + + Q_DECLARE_FLAGS(FragmentHints, FragmentHint) + QPainter(); explicit QPainter(QPaintDevice *); ~QPainter(); @@ -352,6 +375,9 @@ public: inline void drawPixmap(const QRect &r, const QPixmap &pm); inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm); + void drawPixmapFragments(const Fragment *fragments, int fragmentCount, + const QPixmap &pixmap, FragmentHints hints = 0); + void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags = Qt::AutoColor); inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect, diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index 02a91aa..9362dbe 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -228,6 +228,7 @@ public: void draw_helper(const QPainterPath &path, DrawOperation operation = StrokeAndFillDraw); void drawStretchedGradient(const QPainterPath &path, DrawOperation operation); void drawOpaqueBackground(const QPainterPath &path, DrawOperation operation); + void drawGlyphs(const quint32 *glyphArray, const QPointF *positionArray, int glyphCount); void updateMatrix(); void updateInvMatrix(); @@ -238,6 +239,11 @@ public: void checkEmulation(); + static QPainterPrivate *get(QPainter *painter) + { + return painter->d_ptr.data(); + } + QTransform viewTransform() const; static bool attachPainterPrivate(QPainter *q, QPaintDevice *pdev); void detachPainterPrivate(QPainter *q); @@ -252,6 +258,8 @@ public: }; Q_GUI_EXPORT void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation); +Q_GUI_EXPORT void qt_draw_glyphs(QPainter *painter, const quint32 *glyphArray, + const QPointF *positionArray, int glyphCount); QString qt_generate_brush_key(const QBrush &brush); diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp index d029b1e..ea9dc5d 100644 --- a/src/gui/painting/qprintengine_win.cpp +++ b/src/gui/painting/qprintengine_win.cpp @@ -368,7 +368,8 @@ void QWin32PrintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem } // We only want to convert the glyphs to text if the entire string is compatible with ASCII - bool convertToText = true; + // and if we actually have access to the chars. + bool convertToText = ti.chars != 0; for (int i=0; i < ti.num_chars; ++i) { if (ti.chars[i].unicode() >= 0x80) { convertToText = false; diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 40ee31d..116b03e 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3760,7 +3760,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QPalette np = tab->palette; np.setColor(QPalette::WindowText, QColor(255, 255, 255, 75)); QRect nr = subElementRect(SE_TabBarTabText, opt, w); - nr.moveTop(+1); + nr.moveTop(-1); int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextHideMnemonic; proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled, tab->text, QPalette::WindowText); diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 1f9fc32..bc1bece 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -5749,6 +5749,13 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c return positionRect(w, subRule, subRule2, pe, opt->rect, opt->direction); } +#ifndef QT_NO_TOOLBAR + case SE_ToolBarHandle: + if (hasStyleRule(w, PseudoElement_ToolBarHandle)) + return ParentStyle::subElementRect(se, opt, w); + break; +#endif //QT_NO_TOOLBAR + default: break; } diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index a2fff70..5adf237 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -291,6 +291,7 @@ private: friend class QFontMetricsF; friend class QFontInfo; friend class QPainter; + friend class QPainterPrivate; friend class QPSPrintEngineFont; friend class QApplication; friend class QWidget; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index c000457..e5975d2 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -587,8 +587,9 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t) { QImage i = alphaMapForGlyph(glyph); if (t.type() > QTransform::TxTranslate) - i = i.transformed(t); + i = i.transformed(t).convertToFormat(QImage::Format_Indexed8); Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format... + return i; } @@ -597,11 +598,14 @@ QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, int /* margin */, const Q QImage alphaMask = alphaMapForGlyph(glyph, t); QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32); + QVector<QRgb> colorTable = alphaMask.colorTable(); for (int y=0; y<alphaMask.height(); ++y) { uint *dst = (uint *) rgbMask.scanLine(y); uchar *src = (uchar *) alphaMask.scanLine(y); - for (int x=0; x<alphaMask.width(); ++x) - dst[x] = qRgb(src[x], src[x], src[x]); + for (int x=0; x<alphaMask.width(); ++x) { + int val = qAlpha(colorTable.at(src[x])); + dst[x] = qRgb(val, val, val); + } } return rgbMask; diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 1a815d3..55e93bd 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -208,7 +208,7 @@ void QFontEngineWin::getCMap() unitsPerEm = otm->otmEMSquare; x_height = (int)otm->otmsXHeight; loadKerningPairs(designToDevice); - _faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpFullName)).toLatin1(); + _faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFullName)).toLatin1(); lineWidth = otm->otmsUnderscoreSize; fsType = otm->otmfsType; free(otm); @@ -1006,8 +1006,8 @@ QFontEngine::Properties QFontEngineWin::properties() const Properties p; p.emSquare = unitsPerEm; p.italicAngle = otm->otmItalicAngle; - p.postscriptName = QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpFamilyName)).toLatin1(); - p.postscriptName += QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpStyleName)).toLatin1(); + p.postscriptName = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFamilyName)).toLatin1(); + p.postscriptName += QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpStyleName)).toLatin1(); #ifndef QT_NO_PRINTER p.postscriptName = QPdf::stripSpecialCharacters(p.postscriptName); #endif diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index a7138b9..8fe4c47 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -350,15 +350,13 @@ QStaticTextPrivate::QStaticTextPrivate() : items(0), itemCount(0), glyphPool(0), positionPool(0), needsClipRect(false), useBackendOptimizations(false), textFormat(Qt::AutoText) { - ref = 1; } QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other) : text(other.text), font(other.font), maximumSize(other.maximumSize), matrix(other.matrix), items(0), itemCount(0), glyphPool(0), positionPool(0), needsClipRect(false), - useBackendOptimizations(false), textFormat(other.textFormat) + useBackendOptimizations(other.useBackendOptimizations), textFormat(other.textFormat) { - ref = 1; } QStaticTextPrivate::~QStaticTextPrivate() diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 4bd7b5a..2888490 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -47,9 +47,6 @@ #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" #endif -#ifdef QT_KEYPAD_NAVIGATION -#include "qtabwidget.h" // Needed in inTabWidget() -#endif // QT_KEYPAD_NAVIGATION #include <limits.h> QT_BEGIN_NAMESPACE @@ -702,7 +699,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb stepsToScroll = qBound(-pageStep, int(offset * pageStep), pageStep); offset_accumulated = 0; } else { - // Calculate how many lines to scroll. Depending on what delta is (and + // Calculate how many lines to scroll. Depending on what delta is (and // offset), we might end up with a fraction (e.g. scroll 1.3 lines). We can // only scroll whole lines, so we keep the reminder until next event. qreal stepsToScrollF = @@ -749,45 +746,7 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e) } #endif -#ifdef QT_KEYPAD_NAVIGATION -/*! - \internal - - Tells us if it there is currently a reachable widget by keypad navigation in - a certain \a orientation. - If no navigation is possible, occuring key events in that \a orientation may - be used to interact with the value in the focussed widget, even though it - currently has not the editFocus. - \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus() -*/ -inline static bool canKeypadNavigate(Qt::Orientation orientation) -{ - return orientation == Qt::Horizontal? - (QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionEast) - || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionWest)) - :(QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionNorth) - || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionSouth)); -} -/*! - \internal - - Checks, if the \a widget is inside a QTabWidget. If is is inside - one, left/right key events will be used to switch between tabs in keypad - navigation. If there is no QTabWidget, the horizontal key events can be used to - interact with the value in the focussed widget, even though it currently has - not the editFocus. - - \sa QWidget::hasEditFocus() -*/ -inline static bool inTabWidget(QWidget *widget) -{ - for (QWidget *tabWidget = widget; tabWidget; tabWidget = tabWidget->parentWidget()) - if (qobject_cast<const QTabWidget*>(tabWidget)) - return true; - return false; -} -#endif // QT_KEYPAD_NAVIGATION /*! \reimp */ @@ -853,7 +812,8 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) if (QApplication::keypadNavigationEnabled() && (!hasEditFocus() && QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder || d->orientation == Qt::Vertical - || !hasEditFocus() && (canKeypadNavigate(Qt::Horizontal) || inTabWidget(this)))) { + || !hasEditFocus() + && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this)))) { ev->ignore(); return; } @@ -872,7 +832,8 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) if (QApplication::keypadNavigationEnabled() && (!hasEditFocus() && QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder || d->orientation == Qt::Vertical - || !hasEditFocus() && (canKeypadNavigate(Qt::Horizontal) || inTabWidget(this)))) { + || !hasEditFocus() + && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this)))) { ev->ignore(); return; } @@ -892,7 +853,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) if (QApplication::keypadNavigationEnabled() && (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder || d->orientation == Qt::Horizontal - || !hasEditFocus() && canKeypadNavigate(Qt::Vertical))) { + || !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical))) { ev->ignore(); break; } @@ -905,7 +866,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) if (QApplication::keypadNavigationEnabled() && (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder || d->orientation == Qt::Horizontal - || !hasEditFocus() && canKeypadNavigate(Qt::Vertical))) { + || !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical))) { ev->ignore(); break; } diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index 2b8cf59..c1b1ea3 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -2993,8 +2993,7 @@ bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget) QRect r = constrainedRect(placeHolder->topLevelRect, desktop.screenGeometry(dockWidget)); dockWidget->d_func()->setWindowState(true, true, r); } - dockWidget->show(); -// dockWidget->setVisible(!placeHolder->hidden); + dockWidget->setVisible(!placeHolder->hidden); #ifdef Q_WS_X11 if (placeHolder->window) // gets rid of the X11BypassWindowManager window flag dockWidget->d_func()->setWindowState(true); diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index 1aa7a2b..2c76a5c 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -129,7 +129,7 @@ void QLineEditPrivate::_q_editFocusChange(bool e) void QLineEditPrivate::_q_selectionChanged() { Q_Q(QLineEdit); - if (control->preeditAreaText().isEmpty()) { + if (!control->text().isEmpty() && control->preeditAreaText().isEmpty()) { QStyleOptionFrameV2 opt; q->initStyleOption(&opt); bool showCursor = control->hasSelectedText() ? diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index 45cafc1..fd892dd 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -190,18 +190,18 @@ QAudioInput::~QAudioInput() Passing a QIODevice allows the data to be transfered without any extra code. All that is required is to open the QIODevice. + If able to successfully get audio data from the systems audio device the + state() is set to either QAudio::ActiveState or QAudio::IdleState, + error() is set to QAudio::NoError and the stateChanged() signal is emitted. + + If a problem occurs during this process the error() is set to QAudio::OpenError, + state() is set to QAudio::StoppedState and stateChanged() signal is emitted. + \sa QIODevice */ void QAudioInput::start(QIODevice* device) { - /* - -If currently not StoppedState, stop - -If previous start was push mode, delete internal QIODevice. - -open audio input. - If ok, NoError and ActiveState, else OpenError and StoppedState. - -emit stateChanged() - */ d->start(device); } @@ -210,19 +210,18 @@ void QAudioInput::start(QIODevice* device) transfer. This QIODevice can be used to read() audio data directly. + If able to access the systems audio device the state() is set to + QAudio::IdleState, error() is set to QAudio::NoError + and the stateChanged() signal is emitted. + + If a problem occurs during this process the error() is set to QAudio::OpenError, + state() is set to QAudio::StoppedState and stateChanged() signal is emitted. + \sa QIODevice */ QIODevice* QAudioInput::start() { - /* - -If currently not StoppedState, stop - -If no internal QIODevice, create one. - -open audio input. - -If ok, NoError and IdleState, else OpenError and StoppedState - -emit stateChanged() - -return internal QIODevice - */ return d->start(0); } @@ -236,17 +235,14 @@ QAudioFormat QAudioInput::format() const } /*! - Stops the audio input. + Stops the audio input, detaching from the system resource. + + Sets error() to QAudio::NoError, state() to QAudio::StoppedState and + emit stateChanged() signal. */ void QAudioInput::stop() { - /* - -If StoppedState, return - -set to StoppedState - -detach from audio device - -emit stateChanged() - */ d->stop(); } @@ -256,42 +252,32 @@ void QAudioInput::stop() void QAudioInput::reset() { - /* - -drop all buffered audio, set buffers to zero. - -call stop() - */ d->reset(); } /*! Stops processing audio data, preserving buffered audio data. + + Sets error() to QAudio::NoError, state() to QAudio::SuspendedState and + emit stateChanged() signal. */ void QAudioInput::suspend() { - /* - -If not ActiveState|IdleState, return - -stop processing audio, saving all buffered audio data - -set NoError and SuspendedState - -emit stateChanged() - */ d->suspend(); } /*! Resumes processing audio data after a suspend(). + + Sets error() to QAudio::NoError. + Sets state() to QAudio::ActiveState if you previously called start(QIODevice*). + Sets state() to QAudio::IdleState if you previously called start(). + emits stateChanged() signal. */ void QAudioInput::resume() { - /* - -If SuspendedState, return - -resume audio - -(PULL MODE): set ActiveState, NoError - -(PUSH MODE): set IdleState, NoError - -kick start audio if needed - -emit stateChanged() - */ d->resume(); } @@ -327,6 +313,9 @@ int QAudioInput::bufferSize() const /*! Returns the amount of audio data available to read in bytes. + + NOTE: returned value is only valid while in QAudio::ActiveState or QAudio::IdleState + state, otherwise returns zero. */ int QAudioInput::bytesReady() const @@ -352,7 +341,10 @@ int QAudioInput::periodSize() const /*! Sets the interval for notify() signal to be emitted. This is based on the \a ms of audio data processed - not on actual real-time. The resolution of the timer is platform specific. + not on actual real-time. + The minimum resolution of the timer is platform specific and values + should be checked with notifyInterval() to confirm actual value + being used. */ void QAudioInput::setNotifyInterval(int ms) diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index 26e46b3..6010f3c 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -217,9 +217,11 @@ QIODevice* QAudioInputPrivate::start(QIODevice* device) //set to pull mode pullMode = true; audioSource = device; + deviceState = QAudio::ActiveState; } else { //set to push mode pullMode = false; + deviceState = QAudio::IdleState; audioSource = new InputPrivate(this); audioSource->open(QIODevice::ReadOnly | QIODevice::Unbuffered); } @@ -413,7 +415,6 @@ bool QAudioInputPrivate::open() timer->start(period_time*chunks/2000); errorState = QAudio::NoError; - deviceState = QAudio::ActiveState; totalTimeValue = 0; @@ -439,7 +440,7 @@ int QAudioInputPrivate::bytesReady() const if(resuming) return period_size; - if(deviceState != QAudio::ActiveState) + if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) return 0; int frames = snd_pcm_avail_update(handle); if((int)frames > (int)buffer_frames) @@ -450,8 +451,8 @@ int QAudioInputPrivate::bytesReady() const qint64 QAudioInputPrivate::read(char* data, qint64 len) { - Q_UNUSED(data) Q_UNUSED(len) + // Read in some audio data and write it to QIODevice, pull mode if ( !handle ) return 0; @@ -468,7 +469,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) if (readFrames >= 0) { err = snd_pcm_frames_to_bytes(handle, readFrames); #ifdef DEBUG_AUDIO - qDebug()<<QString::fromLatin1("PULL: read in bytes = %1 (frames=%2)").arg(err).arg(readFrames).toLatin1().constData(); + qDebug()<<QString::fromLatin1("read in bytes = %1 (frames=%2)").arg(err).arg(readFrames).toLatin1().constData(); #endif break; } else if((readFrames == -EAGAIN) || (readFrames == -EINTR)) { @@ -489,28 +490,46 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) if(err > 0) { // got some send it onward #ifdef DEBUG_AUDIO - qDebug()<<"PULL: frames to write to QIODevice = "<< + qDebug()<<"frames to write to QIODevice = "<< snd_pcm_bytes_to_frames( handle, (int)err )<<" ("<<err<<") bytes"; #endif - if(deviceState != QAudio::ActiveState) + if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) return 0; + if (pullMode) { + qint64 l = audioSource->write(audioBuffer,err); + if(l < 0) { + close(); + errorState = QAudio::IOError; + deviceState = QAudio::StoppedState; + emit stateChanged(deviceState); + } else if(l == 0) { + if (deviceState != QAudio::IdleState) { + errorState = QAudio::NoError; + deviceState = QAudio::IdleState; + emit stateChanged(deviceState); + } + } else { + totalTimeValue += err; + resuming = false; + if (deviceState != QAudio::ActiveState) { + errorState = QAudio::NoError; + deviceState = QAudio::ActiveState; + emit stateChanged(deviceState); + } + } + return l; - qint64 l = audioSource->write(audioBuffer,err); - if(l < 0) { - close(); - errorState = QAudio::IOError; - deviceState = QAudio::StoppedState; - emit stateChanged(deviceState); - } else if(l == 0) { - errorState = QAudio::NoError; - deviceState = QAudio::IdleState; } else { - totalTimeValue += snd_pcm_bytes_to_frames(handle, err)*1000000/settings.frequency(); + memcpy(data,audioBuffer,err); + totalTimeValue += err; resuming = false; - errorState = QAudio::NoError; - deviceState = QAudio::ActiveState; + if (deviceState != QAudio::ActiveState) { + errorState = QAudio::NoError; + deviceState = QAudio::ActiveState; + emit stateChanged(deviceState); + } + return err; } - return l; } return 0; } @@ -569,7 +588,7 @@ int QAudioInputPrivate::notifyInterval() const qint64 QAudioInputPrivate::processedUSecs() const { - return totalTimeValue; + return qint64(1000000) * totalTimeValue / settings.frequency(); } void QAudioInputPrivate::suspend() @@ -617,34 +636,10 @@ bool QAudioInputPrivate::deviceReady() qint64 QAudioInputPrivate::elapsedUSecs() const { - if(!handle) - return 0; - if (deviceState == QAudio::StoppedState) return 0; -#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) - snd_pcm_status_t* status; - snd_pcm_status_alloca(&status); - - snd_timestamp_t t1,t2; - if( snd_pcm_status(handle, status) >= 0) { - snd_pcm_status_get_tstamp(status,&t1); - snd_pcm_status_get_trigger_tstamp(status,&t2); - t1.tv_sec-=t2.tv_sec; - - signed long l = (signed long)t1.tv_usec - (signed long)t2.tv_usec; - if(l < 0) { - t1.tv_sec--; - l = -l; - l %= 1000000; - } - return ((t1.tv_sec * 1000000)+l); - } else - return 0; -#else return clockStamp.elapsed()*1000; -#endif } void QAudioInputPrivate::reset() @@ -670,43 +665,7 @@ InputPrivate::~InputPrivate() qint64 InputPrivate::readData( char* data, qint64 len) { - // push mode, user read() called - if((audioDevice->state() != QAudio::ActiveState) && !audioDevice->resuming) - return 0; - - int readFrames; - int count=0, err = 0; - - while(count < 5) { - int frames = snd_pcm_bytes_to_frames(audioDevice->handle, len); - readFrames = snd_pcm_readi(audioDevice->handle, data, frames); - if (readFrames >= 0) { - err = snd_pcm_frames_to_bytes(audioDevice->handle, readFrames); -#ifdef DEBUG_AUDIO - qDebug()<<QString::fromLatin1("PUSH: read in bytes = %1 (frames=%2)").arg(err).arg(readFrames).toLatin1().constData(); -#endif - break; - } else if((readFrames == -EAGAIN) || (readFrames == -EINTR)) { - audioDevice->errorState = QAudio::IOError; - err = 0; - break; - } else { - if(readFrames == -EPIPE) { - audioDevice->errorState = QAudio::UnderrunError; - err = snd_pcm_prepare(audioDevice->handle); - } else if(readFrames == -ESTRPIPE) { - err = snd_pcm_prepare(audioDevice->handle); - } - if(err != 0) break; - } - count++; - } - if(err > 0 && readFrames > 0) { - audioDevice->totalTimeValue += readFrames*1000/audioDevice->settings.frequency()*1000; - audioDevice->deviceState = QAudio::ActiveState; - return err; - } - return 0; + return audioDevice->read(data,len); } qint64 InputPrivate::writeData(const char* data, qint64 len) diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index cc4fdee..594f6ca 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -192,9 +192,11 @@ QIODevice* QAudioInputPrivate::start(QIODevice* device) //set to pull mode pullMode = true; audioSource = device; + deviceState = QAudio::ActiveState; } else { //set to push mode pullMode = false; + deviceState = QAudio::IdleState; audioSource = new InputPrivate(this); audioSource->open(QIODevice::ReadOnly | QIODevice::Unbuffered); } @@ -311,7 +313,6 @@ bool QAudioInputPrivate::open() elapsedTimeOffset = 0; totalTimeValue = 0; errorState = QAudio::NoError; - deviceState = QAudio::ActiveState; return true; } @@ -320,9 +321,9 @@ void QAudioInputPrivate::close() if(deviceState == QAudio::StoppedState) return; + deviceState = QAudio::StoppedState; waveInReset(hWaveIn); waveInClose(hWaveIn); - deviceState = QAudio::StoppedState; int count = 0; while(!finished && count < 500) { @@ -357,7 +358,6 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) char* p = data; qint64 l = 0; qint64 written = 0; - while(!done) { // Read in some audio data if(waveBlocks[header].dwBytesRecorded > 0 && waveBlocks[header].dwFlags & WHDR_DONE) { @@ -378,11 +378,12 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) errorState = QAudio::IOError; } else { - totalTimeValue += waveBlocks[header].dwBytesRecorded - /((settings.channels()*settings.sampleSize()/8)) - *10000/settings.frequency()*100; + totalTimeValue += waveBlocks[header].dwBytesRecorded; errorState = QAudio::NoError; - deviceState = QAudio::ActiveState; + if (deviceState != QAudio::ActiveState) { + deviceState = QAudio::ActiveState; + emit stateChanged(deviceState); + } resuming = false; } } else { @@ -392,16 +393,17 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) #ifdef DEBUG_AUDIO qDebug()<<"IN: "<<waveBlocks[header].dwBytesRecorded<<", OUT: "<<l; #endif - totalTimeValue += waveBlocks[header].dwBytesRecorded - /((settings.channels()*settings.sampleSize()/8)) - *10000/settings.frequency()*100; + totalTimeValue += waveBlocks[header].dwBytesRecorded; errorState = QAudio::NoError; - deviceState = QAudio::ActiveState; + if (deviceState != QAudio::ActiveState) { + deviceState = QAudio::ActiveState; + emit stateChanged(deviceState); + } resuming = false; } } else { //no data, not ready yet, next time - return 0; + break; } waveInUnprepareHeader(hWaveIn,&waveBlocks[header], sizeof(WAVEHDR)); @@ -510,7 +512,13 @@ int QAudioInputPrivate::notifyInterval() const qint64 QAudioInputPrivate::processedUSecs() const { - return totalTimeValue; + if (deviceState == QAudio::StoppedState) + return 0; + qint64 result = qint64(1000000) * totalTimeValue / + (settings.channels()*(settings.sampleSize()/8)) / + settings.frequency(); + + return result; } void QAudioInputPrivate::suspend() @@ -540,6 +548,9 @@ bool QAudioInputPrivate::deviceReady() QTime now(QTime::currentTime()); qDebug()<<now.second()<<"s "<<now.msec()<<"ms :deviceReady() INPUT"; #endif + if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) + return true; + if(pullMode) { // reads some audio data and writes it to QIODevice read(0,0); @@ -548,8 +559,6 @@ bool QAudioInputPrivate::deviceReady() InputPrivate* a = qobject_cast<InputPrivate*>(audioSource); a->trigger(); } - if(deviceState != QAudio::ActiveState) - return true; if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { emit notify(); @@ -582,7 +591,8 @@ InputPrivate::~InputPrivate() {} qint64 InputPrivate::readData( char* data, qint64 len) { // push mode, user read() called - if(audioDevice->deviceState != QAudio::ActiveState) + if(audioDevice->deviceState != QAudio::ActiveState && + audioDevice->deviceState != QAudio::IdleState) return 0; // Read in some audio data return audioDevice->read(data,len); diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index afd8a84..b0b5244 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -202,18 +202,18 @@ QAudioFormat QAudioOutput::format() const Passing a QIODevice allows the data to be transfered without any extra code. All that is required is to open the QIODevice. + If able to successfully output audio data to the systems audio device the + state() is set to QAudio::ActiveState, error() is set to QAudio::NoError + and the stateChanged() signal is emitted. + + If a problem occurs during this process the error() is set to QAudio::OpenError, + state() is set to QAudio::StoppedState and stateChanged() signal is emitted. + \sa QIODevice */ void QAudioOutput::start(QIODevice* device) { - /* - -If currently not StoppedState, stop. - -If previous start was push mode, delete internal QIODevice. - -open audio output. - -If ok, NoError and ActiveState, else OpenError and StoppedState - -emit stateChanged() - */ d->start(device); } @@ -221,34 +221,30 @@ void QAudioOutput::start(QIODevice* device) Returns a pointer to the QIODevice being used to handle the data transfer. This QIODevice can be used to write() audio data directly. + If able to access the systems audio device the state() is set to + QAudio::IdleState, error() is set to QAudio::NoError + and the stateChanged() signal is emitted. + + If a problem occurs during this process the error() is set to QAudio::OpenError, + state() is set to QAudio::StoppedState and stateChanged() signal is emitted. + \sa QIODevice */ QIODevice* QAudioOutput::start() { - /* - -If currently not StoppedState, stop. - -If no internal QIODevice, create one. - -open audio output. - -If ok, NoError and IdleState, else OpenError and StoppedState - -emit stateChanged() - -return internal QIODevice - */ return d->start(0); } /*! - Stops the audio output. + Stops the audio output, detaching from the system resource. + + Sets error() to QAudio::NoError, state() to QAudio::StoppedState and + emit stateChanged() signal. */ void QAudioOutput::stop() { - /* - -If StoppedState, return - -set to StoppedState - -detach from audio device - -emit stateChanged() - */ d->stop(); } @@ -258,55 +254,44 @@ void QAudioOutput::stop() void QAudioOutput::reset() { - /* - -drop all buffered audio, set buffers to zero. - -call stop() - */ d->reset(); } /*! Stops processing audio data, preserving buffered audio data. + + Sets error() to QAudio::NoError, state() to QAudio::SuspendedState and + emit stateChanged() signal. */ void QAudioOutput::suspend() { - /* - -If not ActiveState|IdleState, return - -stop processing audio, saving all buffered audio data - -set NoError and SuspendedState - -emit stateChanged() - */ d->suspend(); } /*! Resumes processing audio data after a suspend(). + + Sets error() to QAudio::NoError. + Sets state() to QAudio::ActiveState if you previously called start(QIODevice*). + Sets state() to QAudio::IdleState if you previously called start(). + emits stateChanged() signal. */ void QAudioOutput::resume() { - /* - -If SuspendedState, return - -resume audio - -(PULL MODE): set ActiveState, NoError - -(PUSH MODE): set IdleState, NoError - -kick start audio if needed - -emit stateChanged() - */ d->resume(); } /*! Returns the free space available in bytes in the audio buffer. + + NOTE: returned value is only valid while in QAudio::ActiveState or QAudio::IdleState + state, otherwise returns zero. */ int QAudioOutput::bytesFree() const { - /* - -If not ActiveState|IdleState, return 0 - -return space available in audio buffer in bytes - */ return d->bytesFree(); } @@ -353,7 +338,10 @@ int QAudioOutput::bufferSize() const /*! Sets the interval for notify() signal to be emitted. This is based on the \a ms of audio data processed - not on actual real-time. The resolution of the timer is platform specific. + not on actual real-time. + The minimum resolution of the timer is platform specific and values + should be checked with notifyInterval() to confirm actual value + being used. */ void QAudioOutput::setNotifyInterval(int ms) diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index 7b89cef..b127103 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -259,6 +259,7 @@ void QAudioOutputPrivate::stop() { if(deviceState == QAudio::StoppedState) return; + errorState = QAudio::NoError; deviceState = QAudio::StoppedState; close(); emit stateChanged(deviceState); @@ -494,10 +495,13 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) err = snd_pcm_writei( handle, data, frames ); } if(err > 0) { - totalTimeValue += err*1000000/settings.frequency(); + totalTimeValue += err; resuming = false; errorState = QAudio::NoError; - deviceState = QAudio::ActiveState; + if (deviceState != QAudio::ActiveState) { + deviceState = QAudio::ActiveState; + emit stateChanged(deviceState); + } return snd_pcm_frames_to_bytes( handle, err ); } else err = xrun_recovery(err); @@ -542,7 +546,7 @@ int QAudioOutputPrivate::notifyInterval() const qint64 QAudioOutputPrivate::processedUSecs() const { - return totalTimeValue; + return qint64(1000000) * totalTimeValue / settings.frequency(); } void QAudioOutputPrivate::resume() @@ -562,10 +566,8 @@ void QAudioOutputPrivate::resume() bytesAvailable = (int)snd_pcm_frames_to_bytes(handle, buffer_frames); } resuming = true; - if(pullMode) - deviceState = QAudio::ActiveState; - else - deviceState = QAudio::IdleState; + + deviceState = QAudio::ActiveState; errorState = QAudio::NoError; timer->start(period_time/1000); @@ -637,7 +639,9 @@ bool QAudioOutputPrivate::deviceReady() // Got some data to output if(deviceState != QAudio::ActiveState) return true; - write(audioBuffer,l); + qint64 bytesWritten = write(audioBuffer,l); + if (bytesWritten != l) + audioSource->seek(audioSource->pos()-(l-bytesWritten)); bytesAvailable = bytesFree(); } else if(l == 0) { @@ -645,9 +649,11 @@ bool QAudioOutputPrivate::deviceReady() bytesAvailable = bytesFree(); if(bytesAvailable > snd_pcm_frames_to_bytes(handle, buffer_frames-period_frames)) { // Underrun - errorState = QAudio::UnderrunError; - deviceState = QAudio::IdleState; - emit stateChanged(deviceState); + if (deviceState != QAudio::IdleState) { + errorState = QAudio::UnderrunError; + deviceState = QAudio::IdleState; + emit stateChanged(deviceState); + } } } else if(l < 0) { @@ -655,8 +661,17 @@ bool QAudioOutputPrivate::deviceReady() errorState = QAudio::IOError; emit stateChanged(deviceState); } - } else + } else { bytesAvailable = bytesFree(); + if(bytesAvailable > snd_pcm_frames_to_bytes(handle, buffer_frames-period_frames)) { + // Underrun + if (deviceState != QAudio::IdleState) { + errorState = QAudio::UnderrunError; + deviceState = QAudio::IdleState; + emit stateChanged(deviceState); + } + } + } if(deviceState != QAudio::ActiveState) return true; @@ -671,35 +686,10 @@ bool QAudioOutputPrivate::deviceReady() qint64 QAudioOutputPrivate::elapsedUSecs() const { - if(!handle) - return 0; - if (deviceState == QAudio::StoppedState) return 0; -#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) - snd_pcm_status_t* status; - snd_pcm_status_alloca(&status); - - snd_timestamp_t t1,t2; - if( snd_pcm_status(handle, status) >= 0) { - snd_pcm_status_get_tstamp(status,&t1); - snd_pcm_status_get_trigger_tstamp(status,&t2); - t1.tv_sec-=t2.tv_sec; - - signed long l = (signed long)t1.tv_usec - (signed long)t2.tv_usec; - if(l < 0) { - t1.tv_sec--; - l = -l; - l %= 1000000; - } - return ((t1.tv_sec * 1000000)+l); - } else - return 0; -#else return clockStamp.elapsed()*1000; -#endif - return 0; } void QAudioOutputPrivate::reset() diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index bce45c1..6200160 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -211,6 +211,13 @@ bool QAudioOutputPrivate::open() QTime now(QTime::currentTime()); qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()"; #endif + if (!(settings.frequency() >= 8000 && settings.frequency() <= 48000)) { + errorState = QAudio::OpenError; + deviceState = QAudio::StoppedState; + emit stateChanged(deviceState); + qWarning("QAudioOutput: open error, frequency out of range."); + return false; + } if(buffer_size == 0) { // Default buffer size, 200ms, default period size is 40ms buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.2; @@ -289,6 +296,7 @@ void QAudioOutputPrivate::close() return; deviceState = QAudio::StoppedState; + errorState = QAudio::NoError; int delay = (buffer_size-bytesFree())*1000/(settings.frequency() *settings.channels()*(settings.sampleSize()/8)); waveOutReset(hWaveOut); @@ -340,12 +348,20 @@ int QAudioOutputPrivate::notifyInterval() const qint64 QAudioOutputPrivate::processedUSecs() const { - return totalTimeValue; + if (deviceState == QAudio::StoppedState) + return 0; + qint64 result = qint64(1000000) * totalTimeValue / + (settings.channels()*(settings.sampleSize()/8)) / + settings.frequency(); + + return result; } qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) { // Write out some audio data + if (deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) + return 0; char* p = (char*)data; int l = (int)len; @@ -385,13 +401,16 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) current->dwBufferLength,waveFreeBlockCount); LeaveCriticalSection(&waveOutCriticalSection); #endif - totalTimeValue += current->dwBufferLength - /(settings.channels()*(settings.sampleSize()/8)) - *1000000/settings.frequency();; + totalTimeValue += current->dwBufferLength; waveCurrentBlock++; waveCurrentBlock %= buffer_size/period_size; current = &waveBlocks[waveCurrentBlock]; current->dwUser = 0; + errorState = QAudio::NoError; + if (deviceState != QAudio::ActiveState) { + deviceState = QAudio::ActiveState; + emit stateChanged(deviceState); + } } return (len-l); } @@ -409,8 +428,11 @@ void QAudioOutputPrivate::resume() void QAudioOutputPrivate::suspend() { - if(deviceState == QAudio::ActiveState) { + if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState) { + int delay = (buffer_size-bytesFree())*1000/(settings.frequency() + *settings.channels()*(settings.sampleSize()/8)); waveOutPause(hWaveOut); + Sleep(delay+10); deviceState = QAudio::SuspendedState; errorState = QAudio::NoError; emit stateChanged(deviceState); @@ -465,8 +487,16 @@ bool QAudioOutputPrivate::deviceReady() int l = audioSource->read(audioBuffer,input); if(l > 0) { int out= write(audioBuffer,l); - if(out > 0) - deviceState = QAudio::ActiveState; + if(out > 0) { + if (deviceState != QAudio::ActiveState) { + deviceState = QAudio::ActiveState; + emit stateChanged(deviceState); + } + } + if ( out < l) { + // Didnt write all data + audioSource->seek(audioSource->pos()-(l-out)); + } if(startup) waveOutRestart(hWaveOut); } else if(l == 0) { @@ -478,16 +508,28 @@ bool QAudioOutputPrivate::deviceReady() LeaveCriticalSection(&waveOutCriticalSection); if(check == buffer_size/period_size) { errorState = QAudio::UnderrunError; - deviceState = QAudio::IdleState; - emit stateChanged(deviceState); + if (deviceState != QAudio::IdleState) { + deviceState = QAudio::IdleState; + emit stateChanged(deviceState); + } } } else if(l < 0) { bytesAvailable = bytesFree(); errorState = QAudio::IOError; } + } else { + int buffered; + EnterCriticalSection(&waveOutCriticalSection); + buffered = waveFreeBlockCount; + LeaveCriticalSection(&waveOutCriticalSection); + errorState = QAudio::UnderrunError; + if (buffered >= buffer_size/period_size && deviceState == QAudio::ActiveState) { + deviceState = QAudio::IdleState; + emit stateChanged(deviceState); + } } - if(deviceState != QAudio::ActiveState) + if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) return true; if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { diff --git a/src/multimedia/base/qgraphicsvideoitem.cpp b/src/multimedia/base/qgraphicsvideoitem.cpp index 21ba8c9..d5ca9e8 100644 --- a/src/multimedia/base/qgraphicsvideoitem.cpp +++ b/src/multimedia/base/qgraphicsvideoitem.cpp @@ -177,9 +177,10 @@ void QGraphicsVideoItemPrivate::_q_mediaObjectDestroyed() /*! \class QGraphicsVideoItem - \brief The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject. + \since 4.7 + \ingroup multimedia Attaching a QGraphicsVideoItem to a QMediaObject allows it to display diff --git a/src/multimedia/base/qmediacontent.cpp b/src/multimedia/base/qmediacontent.cpp index fd519c6..b6bf56b 100644 --- a/src/multimedia/base/qmediacontent.cpp +++ b/src/multimedia/base/qmediacontent.cpp @@ -76,6 +76,7 @@ private: \class QMediaContent \preliminary \brief The QMediaContent class provides access to the resources relating to a media content. + \since 4.7 \ingroup multimedia @@ -206,6 +207,15 @@ QUrl QMediaContent::canonicalUrl() const } /*! + Returns a QNetworkRequest that represents that canonical resource for this media content. +*/ + +QNetworkRequest QMediaContent::canonicalRequest() const +{ + return canonicalResource().request(); +} + +/*! Returns a QMediaResource that represents that canonical resource for this media content. */ diff --git a/src/multimedia/base/qmediacontent.h b/src/multimedia/base/qmediacontent.h index b6f3017..5a279c1 100644 --- a/src/multimedia/base/qmediacontent.h +++ b/src/multimedia/base/qmediacontent.h @@ -75,6 +75,7 @@ public: bool isNull() const; QUrl canonicalUrl() const; + QNetworkRequest canonicalRequest() const; QMediaResource canonicalResource() const; QMediaResourceList resources() const; diff --git a/src/multimedia/base/qmediacontrol.cpp b/src/multimedia/base/qmediacontrol.cpp index c8bbfd4..b84c49e 100644 --- a/src/multimedia/base/qmediacontrol.cpp +++ b/src/multimedia/base/qmediacontrol.cpp @@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE /*! \class QMediaControl \ingroup multimedia-serv + \since 4.7 \preliminary \brief The QMediaControl class provides a base interface for media service controls. diff --git a/src/multimedia/base/qmediaobject.cpp b/src/multimedia/base/qmediaobject.cpp index b2b8c1b..0422718 100644 --- a/src/multimedia/base/qmediaobject.cpp +++ b/src/multimedia/base/qmediaobject.cpp @@ -67,6 +67,7 @@ void QMediaObjectPrivate::_q_notify() \class QMediaObject \preliminary \brief The QMediaObject class provides a common base for multimedia objects. + \since 4.7 \ingroup multimedia diff --git a/src/multimedia/base/qmediaplaylist.cpp b/src/multimedia/base/qmediaplaylist.cpp index ab91fd7..b3f3dd3 100644 --- a/src/multimedia/base/qmediaplaylist.cpp +++ b/src/multimedia/base/qmediaplaylist.cpp @@ -66,6 +66,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, playlistIOLoader, /*! \class QMediaPlaylist \ingroup multimedia + \since 4.7 \preliminary \brief The QMediaPlaylist class provides a list of media content to play. diff --git a/src/multimedia/base/qmediaplaylistcontrol.cpp b/src/multimedia/base/qmediaplaylistcontrol.cpp index 2ae03ad..ba3d224 100644 --- a/src/multimedia/base/qmediaplaylistcontrol.cpp +++ b/src/multimedia/base/qmediaplaylistcontrol.cpp @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE /*! \class QMediaPlaylistControl \ingroup multimedia-serv + \since 4.7 \preliminary \brief The QMediaPlaylistControl class provides access to the playlist functionality of a diff --git a/src/multimedia/base/qmediaplaylistioplugin.cpp b/src/multimedia/base/qmediaplaylistioplugin.cpp index 5f11e38..48fd721 100644 --- a/src/multimedia/base/qmediaplaylistioplugin.cpp +++ b/src/multimedia/base/qmediaplaylistioplugin.cpp @@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE /*! \class QMediaPlaylistReader \preliminary + \since 4.7 \brief The QMediaPlaylistReader class provides an interface for reading a playlist file. \sa QMediaPlaylistIOPlugin @@ -83,6 +84,7 @@ QMediaPlaylistReader::~QMediaPlaylistReader() /*! \class QMediaPlaylistWriter \preliminary + \since 4.7 \brief The QMediaPlaylistWriter class provides an interface for writing a playlist file. \sa QMediaPlaylistIOPlugin @@ -111,6 +113,7 @@ QMediaPlaylistWriter::~QMediaPlaylistWriter() /*! \class QMediaPlaylistIOPlugin + \since 4.7 \brief The QMediaPlaylistIOPlugin class provides an interface for media playlist I/O plug-ins. */ diff --git a/src/multimedia/base/qmediaplaylistnavigator.cpp b/src/multimedia/base/qmediaplaylistnavigator.cpp index 3c22ea4..0c52c71 100644 --- a/src/multimedia/base/qmediaplaylistnavigator.cpp +++ b/src/multimedia/base/qmediaplaylistnavigator.cpp @@ -193,6 +193,7 @@ int QMediaPlaylistNavigatorPrivate::previousItemPos(int steps) const /*! \class QMediaPlaylistNavigator \preliminary + \since 4.7 \brief The QMediaPlaylistNavigator class provides navigation for a media playlist. \sa QMediaPlaylist, QMediaPlaylistProvider diff --git a/src/multimedia/base/qmediaplaylistprovider.cpp b/src/multimedia/base/qmediaplaylistprovider.cpp index 65105dc..942f155 100644 --- a/src/multimedia/base/qmediaplaylistprovider.cpp +++ b/src/multimedia/base/qmediaplaylistprovider.cpp @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE /*! \class QMediaPlaylistProvider \preliminary + \since 4.7 \brief The QMediaPlaylistProvider class provides an abstract list of media. \sa QMediaPlaylist diff --git a/src/multimedia/base/qmediaresource.cpp b/src/multimedia/base/qmediaresource.cpp index 515e432..646d9a7 100644 --- a/src/multimedia/base/qmediaresource.cpp +++ b/src/multimedia/base/qmediaresource.cpp @@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE /*! \class QMediaResource \preliminary + \since 4.7 \brief The QMediaResource class provides a description of a media resource. \ingroup multimedia diff --git a/src/multimedia/base/qmediaservice.cpp b/src/multimedia/base/qmediaservice.cpp index e40688e..d9e980b 100644 --- a/src/multimedia/base/qmediaservice.cpp +++ b/src/multimedia/base/qmediaservice.cpp @@ -57,6 +57,7 @@ QT_MODULE(Multimedia) service implementations. \ingroup multimedia-serv \preliminary + \since 4.7 Media services provide implementations of the functionality promised by media objects, and allow multiple providers to implement a QMediaObject. diff --git a/src/multimedia/base/qmediaserviceprovider.cpp b/src/multimedia/base/qmediaserviceprovider.cpp index 02c9b29..eb6505c 100644 --- a/src/multimedia/base/qmediaserviceprovider.cpp +++ b/src/multimedia/base/qmediaserviceprovider.cpp @@ -82,6 +82,7 @@ public: /*! \class QMediaServiceProviderHint \preliminary + \since 4.7 \brief The QMediaServiceProviderHint class describes what is required of a QMediaService. \ingroup multimedia-serv @@ -489,6 +490,7 @@ Q_GLOBAL_STATIC(QPluginServiceProvider, pluginProvider); /*! \class QMediaServiceProvider \preliminary + \since 4.7 \brief The QMediaServiceProvider class provides an abstract allocator for media services. */ @@ -597,6 +599,7 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider() /*! \class QMediaServiceProviderPlugin \preliminary + \since 4.7 \brief The QMediaServiceProviderPlugin class interface provides an interface for QMediaService plug-ins. @@ -630,6 +633,7 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider() \class QMediaServiceSupportedFormatsInterface \brief The QMediaServiceSupportedFormatsInterface class interface identifies if a media service plug-in supports a media format. + \since 4.7 A QMediaServiceProviderPlugin may implement this interface. */ @@ -656,6 +660,7 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider() \class QMediaServiceSupportedDevicesInterface \brief The QMediaServiceSupportedDevicesInterface class interface identifies the devices supported by a media service plug-in. + \since 4.7 A QMediaServiceProviderPlugin may implement this interface. */ @@ -682,6 +687,7 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider() \class QMediaServiceFeaturesInterface \brief The QMediaServiceFeaturesInterface class interface identifies features supported by a media service plug-in. + \since 4.7 A QMediaServiceProviderPlugin may implement this interface. */ diff --git a/src/multimedia/base/qmediatimerange.cpp b/src/multimedia/base/qmediatimerange.cpp index 0ca1948..e1cea7e 100644 --- a/src/multimedia/base/qmediatimerange.cpp +++ b/src/multimedia/base/qmediatimerange.cpp @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE \class QMediaTimeInterval \brief The QMediaTimeInterval class represents a time interval with integer precision. \ingroup multimedia + \since 4.7 An interval is specified by an inclusive start() and end() time. These must be set in the constructor, as this is an immutable class. @@ -308,6 +309,7 @@ void QMediaTimeRangePrivate::removeInterval(const QMediaTimeInterval &interval) \brief The QMediaTimeRange class represents a set of zero or more disjoint time intervals. \ingroup multimedia + \since 4.7 \reentrant diff --git a/src/multimedia/base/qmetadatacontrol.cpp b/src/multimedia/base/qmetadatacontrol.cpp index 3ecbe8d..28a82ec 100644 --- a/src/multimedia/base/qmetadatacontrol.cpp +++ b/src/multimedia/base/qmetadatacontrol.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE /*! \class QMetaDataControl \ingroup multimedia-serv - + \since 4.7 \preliminary \brief The QMetaDataControl class provides access to the meta-data of a QMediaService's media. diff --git a/src/multimedia/base/qvideodevicecontrol.cpp b/src/multimedia/base/qvideodevicecontrol.cpp index 21db500..c0fe9a8 100644 --- a/src/multimedia/base/qvideodevicecontrol.cpp +++ b/src/multimedia/base/qvideodevicecontrol.cpp @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE /*! \class QVideoDeviceControl \preliminary + \since 4.7 \brief The QVideoDeviceControl class provides an video device selector media control. \ingroup multimedia-serv diff --git a/src/multimedia/base/qvideooutputcontrol.cpp b/src/multimedia/base/qvideooutputcontrol.cpp index a904385..58f1527 100644 --- a/src/multimedia/base/qvideooutputcontrol.cpp +++ b/src/multimedia/base/qvideooutputcontrol.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE /*! \class QVideoOutputControl \preliminary - + \since 4.7 \brief The QVideoOutputControl class provides a means of selecting the active video output control. diff --git a/src/multimedia/base/qvideorenderercontrol.cpp b/src/multimedia/base/qvideorenderercontrol.cpp index 4e7b3da..a34ef9b 100644 --- a/src/multimedia/base/qvideorenderercontrol.cpp +++ b/src/multimedia/base/qvideorenderercontrol.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE /*! \class QVideoRendererControl \preliminary - + \since 4.7 \brief The QVideoRendererControl class provides a control for rendering to a video surface. diff --git a/src/multimedia/base/qvideowidget.cpp b/src/multimedia/base/qvideowidget.cpp index 5df245e..aabfefc 100644 --- a/src/multimedia/base/qvideowidget.cpp +++ b/src/multimedia/base/qvideowidget.cpp @@ -488,7 +488,7 @@ void QVideoWidgetPrivate::_q_dimensionsChanged() /*! \class QVideoWidget \preliminary - + \since 4.7 \brief The QVideoWidget class provides a widget which presents video produced by a media object. \ingroup multimedia diff --git a/src/multimedia/base/qvideowidgetcontrol.cpp b/src/multimedia/base/qvideowidgetcontrol.cpp index bd7ce4e..c53c77b 100644 --- a/src/multimedia/base/qvideowidgetcontrol.cpp +++ b/src/multimedia/base/qvideowidgetcontrol.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE /*! \class QVideoWidgetControl \preliminary - + \since 4.7 \brief The QVideoWidgetControl class provides a media control which implements a video widget. diff --git a/src/multimedia/base/qvideowindowcontrol.cpp b/src/multimedia/base/qvideowindowcontrol.cpp index a23cb4b..da46823 100644 --- a/src/multimedia/base/qvideowindowcontrol.cpp +++ b/src/multimedia/base/qvideowindowcontrol.cpp @@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE /*! \class QVideoWindowControl \preliminary + \since 4.7 \ingroup multimedia-serv \brief The QVideoWindowControl class provides a media control for rendering video to a window. diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index ca34993..27bff02 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -66,7 +66,7 @@ QT_MODULE(Multimedia) \class QMediaPlayer \brief The QMediaPlayer class allows the playing of a media source. \ingroup multimedia - + \since 4.7 \preliminary The QMediaPlayer class is a high level media playback class. It can be used diff --git a/src/multimedia/playback/qmediaplayercontrol.cpp b/src/multimedia/playback/qmediaplayercontrol.cpp index 95ffade..2129098 100644 --- a/src/multimedia/playback/qmediaplayercontrol.cpp +++ b/src/multimedia/playback/qmediaplayercontrol.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE /*! \class QMediaPlayerControl \ingroup multimedia-serv - + \since 4.7 \preliminary \brief The QMediaPlayerControl class provides access to the media playing functionality of a QMediaService. diff --git a/src/multimedia/qml/multimediadeclarative.cpp b/src/multimedia/qml/multimediadeclarative.cpp index 086250a..7f5298f 100644 --- a/src/multimedia/qml/multimediadeclarative.cpp +++ b/src/multimedia/qml/multimediadeclarative.cpp @@ -55,14 +55,13 @@ namespace QtMultimedia \internal */ -void qRegisterDeclarativeElements(QDeclarativeEngine *engine, const char *uri) +void qRegisterDeclarativeElements(const char *uri) { - Q_UNUSED(engine) Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.multimedia")); - qmlRegisterType<QSoundEffect>("Qt.multimedia", 4, 7, "SoundEffect"); - qmlRegisterType<QDeclarativeAudio>("Qt.multimedia", 4, 7, "Audio"); - qmlRegisterType<QDeclarativeVideo>("Qt.multimedia", 4, 7, "Video"); + qmlRegisterType<QSoundEffect>(uri, 4, 7, "SoundEffect"); + qmlRegisterType<QDeclarativeAudio>(uri, 4, 7, "Audio"); + qmlRegisterType<QDeclarativeVideo>(uri, 4, 7, "Video"); } } diff --git a/src/multimedia/qml/multimediadeclarative.h b/src/multimedia/qml/multimediadeclarative.h index befddb6..29af65a 100644 --- a/src/multimedia/qml/multimediadeclarative.h +++ b/src/multimedia/qml/multimediadeclarative.h @@ -49,11 +49,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Multimedia) -class QDeclarativeEngine; - namespace QtMultimedia { -extern void Q_MULTIMEDIA_EXPORT qRegisterDeclarativeElements(QDeclarativeEngine* engine, const char *uri); +extern void Q_MULTIMEDIA_EXPORT qRegisterDeclarativeElements(const char *uri); } QT_END_NAMESPACE diff --git a/src/multimedia/qml/qdeclarativeaudio.cpp b/src/multimedia/qml/qdeclarativeaudio.cpp index 67df625..1cbf594 100644 --- a/src/multimedia/qml/qdeclarativeaudio.cpp +++ b/src/multimedia/qml/qdeclarativeaudio.cpp @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Audio QDeclarativeAudio + \since 4.7 \brief The Audio element allows you to add audio playback to a scene. \qml diff --git a/src/multimedia/qml/qdeclarativevideo.cpp b/src/multimedia/qml/qdeclarativevideo.cpp index d0e94f6..7f62075 100644 --- a/src/multimedia/qml/qdeclarativevideo.cpp +++ b/src/multimedia/qml/qdeclarativevideo.cpp @@ -69,6 +69,7 @@ void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString) /*! \qmlclass Video QDeclarativeVideo + \since 4.7 \brief The Video element allows you to add videos to a scene. \inherits Item diff --git a/src/multimedia/qml/qsoundeffect.cpp b/src/multimedia/qml/qsoundeffect.cpp index 919aa75..541e6c9 100644 --- a/src/multimedia/qml/qsoundeffect.cpp +++ b/src/multimedia/qml/qsoundeffect.cpp @@ -56,6 +56,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass SoundEffect QSoundEffect + \since 4.7 \brief The SoundEffect element provides a way to play sound effects in qml. The following example plays a wav file on mouse click. diff --git a/src/multimedia/qml/qsoundeffect_pulse_p.cpp b/src/multimedia/qml/qsoundeffect_pulse_p.cpp index ec851aa..7e9a25c 100644 --- a/src/multimedia/qml/qsoundeffect_pulse_p.cpp +++ b/src/multimedia/qml/qsoundeffect_pulse_p.cpp @@ -72,6 +72,8 @@ // Less than ideal #define PA_SCACHE_ENTRY_SIZE_MAX (1024*1024*16) +QT_BEGIN_NAMESPACE + namespace { inline pa_sample_spec audioFormatToSampleSpec(const QAudioFormat &format) @@ -502,3 +504,6 @@ void QSoundEffectPrivate::play_callback(pa_context *c, int success, void *userda } } +QT_END_NAMESPACE + + diff --git a/src/multimedia/qml/qsoundeffect_qmedia_p.cpp b/src/multimedia/qml/qsoundeffect_qmedia_p.cpp index 886380a..48fb257 100644 --- a/src/multimedia/qml/qsoundeffect_qmedia_p.cpp +++ b/src/multimedia/qml/qsoundeffect_qmedia_p.cpp @@ -59,6 +59,8 @@ #include "qsoundeffect_qmedia_p.h" +QT_BEGIN_NAMESPACE + QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent): QObject(parent), m_muted(false), @@ -161,3 +163,5 @@ void QSoundEffectPrivate::setMedia(const QMediaContent &media) m_player->setMedia(media.canonicalUrl()); } +QT_END_NAMESPACE + diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 62aa2d7..a887449 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -416,13 +416,25 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor lowPriorityQueue.prepend(pair); break; } + // this used to be called via invokeMethod and a QueuedConnection + // It is the only place _q_startNextRequest is called directly without going + // through the event loop using a QueuedConnection. + // This is dangerous because of recursion that might occur when emitting + // signals as DirectConnection from this code path. Therefore all signal + // emissions that can come out from this code path need to + // be QueuedConnection. + // We are currently trying to fine-tune this. _q_startNextRequest(); + + return reply; } void QHttpNetworkConnectionPrivate::requeueRequest(const HttpMessagePair &pair) { + Q_Q(QHttpNetworkConnection); + QHttpNetworkRequest request = pair.first; switch (request.priority()) { case QHttpNetworkRequest::HighPriority: @@ -433,8 +445,8 @@ void QHttpNetworkConnectionPrivate::requeueRequest(const HttpMessagePair &pair) lowPriorityQueue.prepend(pair); break; } - // this used to be called via invokeMethod and a QueuedConnection - _q_startNextRequest(); + + QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); } void QHttpNetworkConnectionPrivate::dequeueAndSendRequest(QAbstractSocket *socket) @@ -682,6 +694,8 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) +// This function must be called from the event loop. The only +// exception is documented in QHttpNetworkConnectionPrivate::queueRequest void QHttpNetworkConnectionPrivate::_q_startNextRequest() { //resend the necessary ones. diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index dbee72a..e92b2f3 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -459,6 +459,8 @@ void QHttpNetworkConnectionChannel::handleUnexpectedEOF() } else { reconnectAttempts--; reply->d_func()->clear(); + reply->d_func()->connection = connection; + reply->d_func()->connectionChannel = this; closeAndResendCurrentRequest(); } } diff --git a/src/network/access/qnetworkaccessdatabackend.cpp b/src/network/access/qnetworkaccessdatabackend.cpp index a2e7ef5..efb6e3e 100644 --- a/src/network/access/qnetworkaccessdatabackend.cpp +++ b/src/network/access/qnetworkaccessdatabackend.cpp @@ -44,6 +44,7 @@ #include "qnetworkreply.h" #include "qurlinfo.h" #include "private/qdataurl_p.h" +#include <qcoreapplication.h> QT_BEGIN_NAMESPACE @@ -72,7 +73,8 @@ void QNetworkAccessDataBackend::open() if (operation() != QNetworkAccessManager::GetOperation && operation() != QNetworkAccessManager::HeadOperation) { // data: doesn't support anything but GET - QString msg = QObject::tr("Operation not supported on %1") + const QString msg = QCoreApplication::translate("QNetworkAccessDataBackend", + "Operation not supported on %1") .arg(uri.toString()); error(QNetworkReply::ContentOperationNotPermittedError, msg); finished(); @@ -96,7 +98,8 @@ void QNetworkAccessDataBackend::open() } // something wrong with this URI - QString msg = QObject::tr("Invalid URI: %1").arg(uri.toString()); + const QString msg = QCoreApplication::translate("QNetworkAccessDataBackend", + "Invalid URI: %1").arg(uri.toString()); error(QNetworkReply::ProtocolFailure, msg); finished(); } diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp index 5926d0b..cd077e7 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend.cpp +++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp @@ -252,7 +252,7 @@ void QNetworkAccessDebugPipeBackend::socketError() break; } - error(code, QObject::tr("Socket error on %1: %2") + error(code, QNetworkAccessDebugPipeBackend::tr("Socket error on %1: %2") .arg(url().toString(), socket.errorString())); finished(); disconnect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected())); @@ -267,7 +267,7 @@ void QNetworkAccessDebugPipeBackend::socketDisconnected() // normal close } else { // abnormal close - QString msg = QObject::tr("Remote host closed the connection prematurely on %1") + QString msg = QNetworkAccessDebugPipeBackend::tr("Remote host closed the connection prematurely on %1") .arg(url().toString()); error(QNetworkReply::RemoteHostClosedError, msg); finished(); diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index b9bd52a..5876ee2 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -110,7 +110,8 @@ static void ensureInitialized() object, which holds the common configuration and settings for the requests it sends. It contains the proxy and cache configuration, as well as the signals related to such issues, and reply signals that can be used to - monitor the progress of a network operation. + monitor the progress of a network operation. One QNetworkAccessManager + should be enough for the whole Qt application. Once a QNetworkAccessManager object has been created, the application can use it to send requests over the network. A group of standard functions @@ -121,6 +122,7 @@ static void ensureInitialized() A simple download off the network could be accomplished with: \snippet doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp 0 + QNetworkAccessManager has an asynchronous API. When the \tt replyFinished slot above is called, the parameter it takes is the QNetworkReply object containing the downloaded data as well as meta-data (headers, etc.). @@ -130,6 +132,11 @@ static void ensureInitialized() delete it inside the slot connected to finished(). You can use the deleteLater() function. + \note QNetworkAccessManager queues the requests it receives. The number + of requests executed in parallel is dependent on the protocol. + Currently, for the HTTP protocol on desktop platforms, 6 requests are + executed in parallel for one host/port combination. + A more involved example, assuming the manager is already existent, can be: \snippet doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp 1 diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 2175686..b201380 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -565,7 +565,7 @@ void QNetworkReplyImplPrivate::finished() } } else { error(QNetworkReply::TemporaryNetworkFailureError, - q->tr("Temporary network failure.")); + QNetworkReply::tr("Temporary network failure.")); } } } diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index ec413cc..b4fbd1e 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -199,7 +199,7 @@ class QDisabledNetworkReply : public QNetworkReply public: QDisabledNetworkReply(QObject *parent, const QNetworkRequest &req, - const QNetworkAccessManager::Operation op); + QNetworkAccessManager::Operation op); ~QDisabledNetworkReply(); void abort() { } diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index e563f4e..61c116d 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -138,6 +138,8 @@ QT_BEGIN_NAMESPACE default follow redirections: it's up to the application to determine if the requested redirection should be allowed, according to its security policies. + The returned URL might be relative. Use QUrl::resolved() + to create an absolute URL out of it. \value ConnectionEncryptedAttribute Replies only, type: QVariant::Bool (default: false) diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 9de499e..93f6d13 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -165,7 +165,7 @@ int QHostInfo::lookupHost(const QString &name, QObject *receiver, if (name.isEmpty()) { QHostInfo hostInfo(id); hostInfo.setError(QHostInfo::HostNotFound); - hostInfo.setErrorString(QObject::tr("No host name given")); + hostInfo.setErrorString(QCoreApplication::translate("QHostInfo", "No host name given")); QScopedPointer<QHostInfoResult> result(new QHostInfoResult); QObject::connect(result.data(), SIGNAL(resultsReady(QHostInfo)), receiver, member, Qt::QueuedConnection); diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index be06b6e..a186e78 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -193,7 +193,9 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) results.setHostName(hostName); if (aceHostname.isEmpty()) { results.setError(QHostInfo::HostNotFound); - results.setErrorString(hostName.isEmpty() ? QObject::tr("No host name given") : QObject::tr("Invalid hostname")); + results.setErrorString(hostName.isEmpty() ? + QCoreApplication::translate("QHostInfoAgent", "No host name given") : + QCoreApplication::translate("QHostInfoAgent", "Invalid hostname")); return results; } diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 829df89..275c436 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -155,6 +155,9 @@ See the \l network/fortuneclient and \l network/blockingfortuneclient examples for an overview of both approaches. + \note We discourage the use of the blocking functions together + with signals. One of the two possibilities should be used. + QAbstractSocket can be used with QTextStream and QDataStream's stream operators (operator<<() and operator>>()). There is one issue to be aware of, though: You must make sure that enough data @@ -1682,9 +1685,12 @@ static int qt_timeout_value(int msecs, int elapsed) If msecs is -1, this function will not time out. - Note: This function may wait slightly longer than \a msecs, + \note This function may wait slightly longer than \a msecs, depending on the time it takes to complete the host lookup. + \note Multiple calls to this functions do not accumulate the time. + If the function times out, the connecting process will be aborted. + \sa connectToHost(), connected() */ bool QAbstractSocket::waitForConnected(int msecs) @@ -1722,7 +1728,7 @@ bool QAbstractSocket::waitForConnected(int msecs) d->_q_startConnecting(QHostInfo::fromName(d->hostName)); } if (state() == UnconnectedState) - return false; + return false; // connect not im progress anymore! bool timedOut = true; #if defined (QABSTRACTSOCKET_DEBUG) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index ea464d5..25ad5d7 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1309,7 +1309,6 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem) ? QFontEngineGlyphCache::Type(textItem->fontEngine->glyphFormat) : d->glyphCacheType; - // ### What about huge fonts? These are not passed through cache in drawTextItem(). d->drawCachedGlyphs(glyphType, textItem, true); } @@ -1642,21 +1641,23 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp s->matrix = old; } -void QGL2PaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints) +void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints) { Q_D(QGL2PaintEngineEx); // Use fallback for extended composition modes. if (state()->composition_mode > QPainter::CompositionMode_Plus) { - QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints); + QPaintEngineEx::drawPixmapFragments(fragments, fragmentCount, pixmap, hints); return; } ensureActive(); - d->drawPixmaps(drawingData, dataCount, pixmap, hints); + d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); } -void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints) +void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::Fragment *fragments, + int fragmentCount, const QPixmap &pixmap, + QPainter::FragmentHints hints) { GLfloat dx = 1.0f / pixmap.size().width(); GLfloat dy = 1.0f / pixmap.size().height(); @@ -1677,28 +1678,29 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData bool allOpaque = true; - for (int i = 0; i < dataCount; ++i) { + for (int i = 0; i < fragmentCount; ++i) { qreal s = 0; qreal c = 1; - if (drawingData[i].rotation != 0) { - s = qFastSin(drawingData[i].rotation * Q_PI / 180); - c = qFastCos(drawingData[i].rotation * Q_PI / 180); + if (fragments[i].rotation != 0) { + s = qFastSin(fragments[i].rotation * Q_PI / 180); + c = qFastCos(fragments[i].rotation * Q_PI / 180); } - qreal right = 0.5 * drawingData[i].scaleX * drawingData[i].source.width(); - qreal bottom = 0.5 * drawingData[i].scaleY * drawingData[i].source.height(); + qreal right = 0.5 * fragments[i].scaleX * fragments[i].width; + qreal bottom = 0.5 * fragments[i].scaleY * fragments[i].height; QGLPoint bottomRight(right * c - bottom * s, right * s + bottom * c); QGLPoint bottomLeft(-right * c - bottom * s, -right * s + bottom * c); - vertexCoordinateArray.lineToArray(bottomRight.x + drawingData[i].point.x(), bottomRight.y + drawingData[i].point.y()); - vertexCoordinateArray.lineToArray(-bottomLeft.x + drawingData[i].point.x(), -bottomLeft.y + drawingData[i].point.y()); - vertexCoordinateArray.lineToArray(-bottomRight.x + drawingData[i].point.x(), -bottomRight.y + drawingData[i].point.y()); - vertexCoordinateArray.lineToArray(-bottomRight.x + drawingData[i].point.x(), -bottomRight.y + drawingData[i].point.y()); - vertexCoordinateArray.lineToArray(bottomLeft.x + drawingData[i].point.x(), bottomLeft.y + drawingData[i].point.y()); - vertexCoordinateArray.lineToArray(bottomRight.x + drawingData[i].point.x(), bottomRight.y + drawingData[i].point.y()); + vertexCoordinateArray.lineToArray(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); + vertexCoordinateArray.lineToArray(-bottomLeft.x + fragments[i].x, -bottomLeft.y + fragments[i].y); + vertexCoordinateArray.lineToArray(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); + vertexCoordinateArray.lineToArray(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); + vertexCoordinateArray.lineToArray(bottomLeft.x + fragments[i].x, bottomLeft.y + fragments[i].y); + vertexCoordinateArray.lineToArray(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); - QGLRect src(drawingData[i].source.left() * dx, drawingData[i].source.top() * dy, - drawingData[i].source.right() * dx, drawingData[i].source.bottom() * dy); + QGLRect src(fragments[i].sourceLeft * dx, fragments[i].sourceTop * dy, + (fragments[i].sourceLeft + fragments[i].width) * dx, + (fragments[i].sourceTop + fragments[i].height) * dy); textureCoordinateArray.lineToArray(src.right, src.bottom); textureCoordinateArray.lineToArray(src.right, src.top); @@ -1707,7 +1709,7 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData textureCoordinateArray.lineToArray(src.left, src.bottom); textureCoordinateArray.lineToArray(src.right, src.bottom); - qreal opacity = drawingData[i].opacity * q->state()->opacity; + qreal opacity = fragments[i].opacity * q->state()->opacity; opacityArray << opacity << opacity << opacity << opacity << opacity << opacity; allOpaque &= (opacity >= 0.99f); } @@ -1720,21 +1722,22 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData if (texture->options & QGLContext::InvertedYBindOption) { // Flip texture y-coordinate. QGLPoint *data = textureCoordinateArray.data(); - for (int i = 0; i < 6 * dataCount; ++i) + for (int i = 0; i < 6 * fragmentCount; ++i) data[i].y = 1 - data[i].y; } transferMode(ImageArrayDrawingMode); bool isBitmap = pixmap.isQBitmap(); - bool isOpaque = !isBitmap && (!pixmap.hasAlphaChannel() || (hints & QDrawPixmaps::OpaqueHint)) && allOpaque; + bool isOpaque = !isBitmap && (!pixmap.hasAlphaChannel() || (hints & QPainter::OpaqueHint)) && allOpaque; updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); // Setup for texture drawing currentBrush = noBrush; - shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc); + shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc + : QGLEngineShaderManager::ImageSrc); if (prepareForDraw(isOpaque)) shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT); @@ -1743,7 +1746,7 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); } - glDrawArrays(GL_TRIANGLES, 0, 6 * dataCount); + glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount); } bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index d4932be..5d3608b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -125,7 +125,7 @@ public: virtual void drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr); virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); - virtual void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints); + virtual void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints); virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags = Qt::AutoColor); virtual void drawTextItem(const QPointF &p, const QTextItem &textItem); @@ -196,7 +196,7 @@ public: void fill(const QVectorPath &path); void stroke(const QVectorPath &path, const QPen &pen); void drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false); - void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints); + void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints); void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem, bool includeMatrixInCache); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 2ed185f..73cd6a8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -5559,7 +5559,7 @@ QSize QGLTexture::bindCompressedTexturePVR(const char *buf, int len) quint32 level = 0; quint32 width = pvrHeader->width; quint32 height = pvrHeader->height; - while (bufferSize > 0 && level < pvrHeader->mipMapCount) { + while (bufferSize > 0 && level <= pvrHeader->mipMapCount) { quint32 size = (qMax(width, minWidth) * qMax(height, minHeight) * pvrHeader->bitsPerPixel) / 8; diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 62f0293..35f552e 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -93,7 +93,7 @@ public: VGFont font; VGfloat scaleX; VGfloat scaleY; - + uint cachedGlyphsMask[256 / 32]; QSet<glyph_t> cachedGlyphs; }; @@ -130,8 +130,9 @@ public: void draw(VGPath path, const QPen& pen, const QBrush& brush, VGint rule = VG_EVEN_ODD); void stroke(VGPath path, const QPen& pen); void fill(VGPath path, const QBrush& brush, VGint rule = VG_EVEN_ODD); - VGPath vectorPathToVGPath(const QVectorPath& path); - VGPath painterPathToVGPath(const QPainterPath& path); + inline void releasePath(VGPath path); + VGPath vectorPathToVGPath(const QVectorPath& path, bool forceNewPath = false); + VGPath painterPathToVGPath(const QPainterPath& path, bool forceNewPath = false); VGPath roundedRectPath(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode); VGPaintType setBrush (VGPaint paint, const QBrush& brush, VGMatrixMode mode, @@ -177,6 +178,8 @@ public: VGPath roundRectPath; // Cached path for quick drawing of rounded rects. #endif + VGPath reusablePath; // Reusable path for vectorPathToVGPath(), etc. + QTransform transform; // Currently active transform. bool simpleTransform; // True if the transform is simple (non-projective). qreal penScale; // Pen scaling factor from "transform". @@ -349,6 +352,8 @@ void QVGPaintEnginePrivate::init() roundRectPath = 0; #endif + reusablePath = 0; + simpleTransform = true; pathTransformSet = false; penScale = 1.0; @@ -445,6 +450,15 @@ void QVGPaintEnginePrivate::initObjects() VG_PATH_CAPABILITY_ALL); vgAppendPathData(linePath, 2, segments, coords); #endif + + // This path can be reused over and over by calling vgClearPath(). + reusablePath = vgCreatePath(VG_PATH_FORMAT_STANDARD, + VG_PATH_DATATYPE_F, + 1.0f, // scale + 0.0f, // bias + 32 + 1, // segmentCapacityHint + 32 * 2, // coordCapacityHint + VG_PATH_CAPABILITY_ALL); } void QVGPaintEnginePrivate::destroy() @@ -464,6 +478,8 @@ void QVGPaintEnginePrivate::destroy() if (roundRectPath) vgDestroyPath(roundRectPath); #endif + if (reusablePath) + vgDestroyPath(reusablePath); #if !defined(QVG_NO_DRAW_GLYPHS) QVGFontCache::Iterator it; @@ -540,19 +556,32 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) qt_scaleForTransform(transform, &penScale); } -VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) +inline void QVGPaintEnginePrivate::releasePath(VGPath path) +{ + if (path == reusablePath) + vgClearPath(path, VG_PATH_CAPABILITY_ALL); + else + vgDestroyPath(path); +} + +VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path, bool forceNewPath) { int count = path.elementCount(); const qreal *points = path.points(); const QPainterPath::ElementType *elements = path.elements(); - VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - count + 1, // segmentCapacityHint - count * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath vgpath; + if (forceNewPath) { + vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, + VG_PATH_DATATYPE_F, + 1.0f, // scale + 0.0f, // bias + count + 1, // segmentCapacityHint + count * 2, // coordCapacityHint + VG_PATH_CAPABILITY_ALL); + } else { + vgpath = reusablePath; + } // Size is sufficient segments for drawRoundedRect() paths. QVarLengthArray<VGubyte, 20> segments; @@ -724,17 +753,22 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) return vgpath; } -VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path) +VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path, bool forceNewPath) { int count = path.elementCount(); - VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - count + 1, // segmentCapacityHint - count * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath vgpath; + if (forceNewPath) { + vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, + VG_PATH_DATATYPE_F, + 1.0f, // scale + 0.0f, // bias + count + 1, // segmentCapacityHint + count * 2, // coordCapacityHint + VG_PATH_CAPABILITY_ALL); + } else { + vgpath = reusablePath; + } if (count == 0) return vgpath; @@ -953,13 +987,7 @@ VGPath QVGPaintEnginePrivate::roundedRectPath(const QRectF &rect, qreal xRadius, vgModifyPathCoords(vgpath, 0, 9, pts); } #else - VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - 10, // segmentCapacityHint - 17 * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath vgpath = reusablePath; vgAppendPathData(vgpath, 10, roundedrect_types, pts); #endif @@ -1512,7 +1540,7 @@ void QVGPaintEngine::draw(const QVectorPath &path) d->draw(vgpath, s->pen, s->brush, VG_EVEN_ODD); else d->draw(vgpath, s->pen, s->brush, VG_NON_ZERO); - vgDestroyPath(vgpath); + d->releasePath(vgpath); } void QVGPaintEngine::fill(const QVectorPath &path, const QBrush &brush) @@ -1523,7 +1551,7 @@ void QVGPaintEngine::fill(const QVectorPath &path, const QBrush &brush) d->fill(vgpath, brush, VG_EVEN_ODD); else d->fill(vgpath, brush, VG_NON_ZERO); - vgDestroyPath(vgpath); + d->releasePath(vgpath); } void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen) @@ -1531,7 +1559,7 @@ void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen) Q_D(QVGPaintEngine); VGPath vgpath = d->vectorPathToVGPath(path); d->stroke(vgpath, pen); - vgDestroyPath(vgpath); + d->releasePath(vgpath); } // Determine if a co-ordinate transform is simple enough to allow @@ -1727,7 +1755,7 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) default: break; } - vgDestroyPath(vgpath); + d->releasePath(vgpath); vgSeti(VG_MASKING, VG_TRUE); d->maskValid = true; @@ -2044,7 +2072,7 @@ void QVGPaintEngine::clip(const QPainterPath &path, Qt::ClipOperation op) default: break; } - vgDestroyPath(vgpath); + d->releasePath(vgpath); vgSeti(VG_MASKING, VG_TRUE); d->maskValid = true; @@ -2395,7 +2423,7 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) return; // Check to see if we can use vgClear() for faster filling. - if (brush.style() == Qt::SolidPattern && + if (brush.style() == Qt::SolidPattern && brush.isOpaque() && clipTransformIsSimple(d->transform) && d->opacity == 1.0f && clearRect(rect, brush.color())) { return; @@ -2438,7 +2466,7 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QColor &color) Q_D(QVGPaintEngine); // Check to see if we can use vgClear() for faster filling. - if (clipTransformIsSimple(d->transform) && d->opacity == 1.0f && + if (clipTransformIsSimple(d->transform) && d->opacity == 1.0f && color.alpha() == 255 && clearRect(rect, color)) { return; } @@ -2483,7 +2511,7 @@ void QVGPaintEngine::drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, VGPath vgpath = d->roundedRectPath(rect, xrad, yrad, mode); d->draw(vgpath, s->pen, s->brush); #if defined(QVG_NO_MODIFY_PATH) - vgDestroyPath(vgpath); + d->releasePath(vgpath); #endif } else { QPaintEngineEx::drawRoundedRect(rect, xrad, yrad, mode); @@ -2632,13 +2660,7 @@ void QVGPaintEngine::drawEllipse(const QRectF &r) Q_D(QVGPaintEngine); if (d->simpleTransform) { QVGPainterState *s = state(); - VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - 4, // segmentCapacityHint - 12, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath path = d->reusablePath; static VGubyte segments[4] = { VG_MOVE_TO_ABS, VG_SCCWARC_TO_REL, @@ -2662,7 +2684,7 @@ void QVGPaintEngine::drawEllipse(const QRectF &r) coords[11] = 0.0f; vgAppendPathData(path, 4, segments, coords); d->draw(path, s->pen, s->brush); - vgDestroyPath(path); + d->releasePath(path); } else { // The projective transform version of an ellipse is difficult. // Generate a QVectorPath containing cubic curves and transform that. @@ -2686,7 +2708,7 @@ void QVGPaintEngine::drawPath(const QPainterPath &path) d->draw(vgpath, s->pen, s->brush, VG_EVEN_ODD); else d->draw(vgpath, s->pen, s->brush, VG_NON_ZERO); - vgDestroyPath(vgpath); + d->releasePath(vgpath); } void QVGPaintEngine::drawPoints(const QPointF *points, int pointCount) @@ -2761,13 +2783,7 @@ void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD { Q_D(QVGPaintEngine); QVGPainterState *s = state(); - VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - pointCount + 1, // segmentCapacityHint - pointCount * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath path = d->reusablePath; QVarLengthArray<VGfloat, 16> coords; QVarLengthArray<VGubyte, 10> segments; for (int i = 0; i < pointCount; ++i, ++points) { @@ -2801,20 +2817,14 @@ void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD d->draw(path, s->pen, s->brush, VG_EVEN_ODD); break; } - vgDestroyPath(path); + d->releasePath(path); } void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) { Q_D(QVGPaintEngine); QVGPainterState *s = state(); - VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - pointCount + 1, // segmentCapacityHint - pointCount * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath path = d->reusablePath; QVarLengthArray<VGfloat, 16> coords; QVarLengthArray<VGubyte, 10> segments; for (int i = 0; i < pointCount; ++i, ++points) { @@ -2848,7 +2858,7 @@ void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDr d->draw(path, s->pen, s->brush, VG_EVEN_ODD); break; } - vgDestroyPath(path); + d->releasePath(path); } void QVGPaintEnginePrivate::setImageOptions() @@ -3035,9 +3045,8 @@ void QVGPaintEngine::drawTiledPixmap // (i.e. no opacity), no rotation or scaling, and drawing the full // pixmap rather than parts of the pixmap. Even having just one of // these conditions will improve performance. -void QVGPaintEngine::drawPixmaps - (const QDrawPixmaps::Data *drawingData, int dataCount, - const QPixmap &pixmap, QFlags<QDrawPixmaps::DrawingHint> hints) +void QVGPaintEngine::drawPixmapFragments(const QPainter::Fragment *drawingData, int dataCount, + const QPixmap &pixmap, QFlags<QPainter::FragmentHint> hints) { #if !defined(QT_SHIVAVG) Q_D(QVGPaintEngine); @@ -3048,7 +3057,7 @@ void QVGPaintEngine::drawPixmaps if (!pd) return; // null QPixmap if (pd->classId() != QPixmapData::OpenVGClass || !d->simpleTransform) { - QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints); + QPaintEngineEx::drawPixmapFragments(drawingData, dataCount, pixmap, hints); return; } @@ -3072,7 +3081,7 @@ void QVGPaintEngine::drawPixmaps QVarLengthArray<QRect> cachedSources; // Select the opacity paint object. - if ((hints & QDrawPixmaps::OpaqueHint) != 0 && d->opacity == 1.0f) { + if ((hints & QPainter::OpaqueHint) != 0 && d->opacity == 1.0f) { d->setImageMode(VG_DRAW_IMAGE_NORMAL); } else { hints = 0; @@ -3084,12 +3093,13 @@ void QVGPaintEngine::drawPixmaps for (int i = 0; i < dataCount; ++i) { QTransform transform(d->imageTransform); - transform.translate(drawingData[i].point.x(), drawingData[i].point.y()); + transform.translate(drawingData[i].x, drawingData[i].y); transform.rotate(drawingData[i].rotation); VGImage child; QSize imageSize = vgpd->size(); - QRectF sr = drawingData[i].source; + QRectF sr(drawingData[i].sourceLeft, drawingData[i].sourceTop, + drawingData[i].width, drawingData[i].height); if (sr.topLeft().isNull() && sr.size() == imageSize) { child = vgImg; } else { @@ -3118,7 +3128,7 @@ void QVGPaintEngine::drawPixmaps transform.scale(scaleX, scaleY); d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); - if ((hints & QDrawPixmaps::OpaqueHint) == 0) { + if ((hints & QPainter::OpaqueHint) == 0) { qreal opacity = d->opacity * drawingData[i].opacity; if (opacity != 1.0f) { if (d->paintOpacity != opacity) { @@ -3144,7 +3154,7 @@ void QVGPaintEngine::drawPixmaps for (int i = 0; i < cachedImages.size(); ++i) vgDestroyImage(cachedImages[i]); #else - QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints); + QPaintEngineEx::drawPixmapFragments(drawingData, dataCount, pixmap, hints); #endif } @@ -3245,7 +3255,7 @@ void QVGFontGlyphCache::cacheGlyphs(QVGPaintEnginePrivate *d, fontEngine->getUnscaledGlyph(glyph, &path, &metrics); VGPath vgPath; if (!path.isEmpty()) { - vgPath = d->painterPathToVGPath(path); + vgPath = d->painterPathToVGPath(path, true); } else { // Probably a "space" character with no visible outline. vgPath = VG_INVALID_HANDLE; @@ -3274,7 +3284,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) QPaintEngineEx::drawTextItem(p, textItem); return; } - + // Get the glyphs and positions associated with the text item. QVarLengthArray<QFixedPoint> positions; QVarLengthArray<glyph_t> glyphs; @@ -3284,7 +3294,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) (ti.glyphs, matrix, ti.flags, glyphs, positions); if (!drawCachedGlyphs(glyphs.size(), glyphs.data(), ti.font(), ti.fontEngine, p)) - QPaintEngineEx::drawTextItem(p, textItem); + QPaintEngineEx::drawTextItem(p, textItem); #else // OpenGL 1.0 does not have support for VGFont and glyphs, // so fall back to the default Qt path stroking algorithm. @@ -3312,7 +3322,7 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) glyphCache = new QVGFontGlyphCache(); if (glyphCache->font == VG_INVALID_HANDLE) { qWarning("QVGPaintEngine::drawTextItem: OpenVG fonts are not supported by the OpenVG engine"); - delete glyphCache; + delete glyphCache; return false; } glyphCache->setScaleFromText(font, fontEngine); diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h index 3f73fed..1203af5 100644 --- a/src/openvg/qpaintengine_vg_p.h +++ b/src/openvg/qpaintengine_vg_p.h @@ -137,7 +137,7 @@ public: void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); - void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QFlags<QDrawPixmaps::DrawingHint> hints); + void drawPixmapFragments(const QPainter::Fragment *drawingData, int dataCount, const QPixmap &pixmap, QFlags<QPainter::FragmentHint> hints); void drawTextItem(const QPointF &p, const QTextItem &textItem); void drawStaticTextItem(QStaticTextItem *staticTextItem); diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index a5384d1..9a28a33 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -154,9 +154,9 @@ void QCoreWlanEngine::connectToId(const QString &id) NSDictionary *parametersDict; NSArray* apArray; - CW8021XProfile *user8021XProfile; - NSError *err; - NSMutableDictionary *params; + CW8021XProfile *user8021XProfile; + NSError *err; + NSMutableDictionary *params; while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile @@ -185,10 +185,8 @@ void QCoreWlanEngine::connectToId(const QString &id) bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err]; if(!result) { - qWarning() <<"ERROR"<< nsstringToQString([err localizedDescription ]); emit connectionError(id, ConnectError); } else { - [apNetwork release]; [autoreleasepool release]; return; } @@ -350,83 +348,81 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)]; - NSError *err = nil; - NSDictionary *parametersDict = nil; - NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err]; + if([currentInterface power]) { + NSError *err = nil; + NSDictionary *parametersDict = nil; + NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err]; - CWNetwork *apNetwork; - if (!err) { - for(uint row=0; row < [apArray count]; row++ ) { - NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init]; + CWNetwork *apNetwork; + if (!err) { + for(uint row=0; row < [apArray count]; row++ ) { + NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init]; - apNetwork = [apArray objectAtIndex:row]; + apNetwork = [apArray objectAtIndex:row]; - const QString networkSsid = nsstringToQString([apNetwork ssid]); + const QString networkSsid = nsstringToQString([apNetwork ssid]); - const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid)); - found.append(id); + const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid)); + found.append(id); - QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; - if ([currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { - if (networkSsid == nsstringToQString([currentInterface ssid])) - state = QNetworkConfiguration::Active; - } else { - if (isKnownSsid(interfaceName, networkSsid)) - state = QNetworkConfiguration::Discovered; - else - state = QNetworkConfiguration::Defined; - } + if ([currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { + if (networkSsid == nsstringToQString([currentInterface ssid])) + state = QNetworkConfiguration::Active; + } else { + if (isKnownSsid(interfaceName, networkSsid)) + state = QNetworkConfiguration::Discovered; + else + state = QNetworkConfiguration::Defined; + } - if (accessPointConfigurations.contains(id)) { - QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + if (accessPointConfigurations.contains(id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); - bool changed = false; + bool changed = false; - if (!ptr->isValid) { - ptr->isValid = true; - changed = true; - } + if (!ptr->isValid) { + ptr->isValid = true; + changed = true; + } - if (ptr->name != networkSsid) { - ptr->name = networkSsid; - changed = true; - } + if (ptr->name != networkSsid) { + ptr->name = networkSsid; + changed = true; + } - if (ptr->id != id) { - ptr->id = id; - changed = true; - } + if (ptr->id != id) { + ptr->id = id; + changed = true; + } - if (ptr->state != state) { - ptr->state = state; - changed = true; - } + if (ptr->state != state) { + ptr->state = state; + changed = true; + } - if (changed) - emit configurationChanged(ptr); - } else { - QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); + if (changed) + emit configurationChanged(ptr); + } else { + QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); - ptr->name = networkSsid; - ptr->isValid = true; - ptr->id = id; - ptr->state = state; - ptr->type = QNetworkConfiguration::InternetAccessPoint; - ptr->bearer = QLatin1String("WLAN"); + ptr->name = networkSsid; + ptr->isValid = true; + ptr->id = id; + ptr->state = state; + ptr->type = QNetworkConfiguration::InternetAccessPoint; + ptr->bearer = QLatin1String("WLAN"); - accessPointConfigurations.insert(id, ptr); - configurationInterface.insert(id, interfaceName); + accessPointConfigurations.insert(id, ptr); + configurationInterface.insert(id, interfaceName); - emit configurationAdded(ptr); + emit configurationAdded(ptr); + } + [looppool release]; } - [looppool release]; } - } else { - qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription]) - <<nsstringToQString([err domain]); } - [autoreleasepool drain]; #else Q_UNUSED(interfaceName); diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index a95b14b..e6c871d 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -60,8 +60,10 @@ #include <sys/ioctl.h> #include <net/if.h> #include <net/if_arp.h> +#include <unistd.h> #endif +QT_BEGIN_NAMESPACE static QString qGetInterfaceType(const QString &interface) { @@ -125,14 +127,11 @@ static QString qGetInterfaceType(const QString &interface) ifreq request; strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name)); - if (ioctl(sock, SIOCGIFHWADDR, &request) >= 0) { - switch (request.ifr_hwaddr.sa_family) { - case ARPHRD_ETHER: - return QLatin1String("Ethernet"); - } - } - + int result = ioctl(sock, SIOCGIFHWADDR, &request); close(sock); + + if (result >= 0 && request.ifr_hwaddr.sa_family == ARPHRD_ETHER) + return QLatin1String("Ethernet"); #else Q_UNUSED(interface); #endif diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index a9e93e0..e7c56a2 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -1080,14 +1080,14 @@ QString QNetworkSessionPrivateImpl::errorString() const QString errorStr; switch(q->error()) { case QNetworkSession::RoamingError: - errorStr = QObject::tr("Roaming error"); + errorStr = QNetworkSessionPrivateImpl::tr("Roaming error"); break; case QNetworkSession::SessionAbortedError: - errorStr = QObject::tr("Session aborted by user or system"); + errorStr = QNetworkSessionPrivateImpl::tr("Session aborted by user or system"); break; default: case QNetworkSession::UnknownSessionError: - errorStr = QObject::tr("Unidentified Error"); + errorStr = QNetworkSessionPrivateImpl::tr("Unidentified Error"); break; } return errorStr; diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index f41fdba..05ce62f 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -201,22 +201,22 @@ void QNetworkSessionPrivateImpl::stop() void QNetworkSessionPrivateImpl::migrate() { - qWarning("This platform does not support roaming (%s).", __FUNCTION__); + qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO); } void QNetworkSessionPrivateImpl::accept() { - qWarning("This platform does not support roaming (%s).", __FUNCTION__); + qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO); } void QNetworkSessionPrivateImpl::ignore() { - qWarning("This platform does not support roaming (%s).", __FUNCTION__); + qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO); } void QNetworkSessionPrivateImpl::reject() { - qWarning("This platform does not support roaming (%s).", __FUNCTION__); + qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO); } QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const diff --git a/src/plugins/bearer/symbian/symbian.pro b/src/plugins/bearer/symbian/symbian.pro index 9fd1a74..9613def 100644 --- a/src/plugins/bearer/symbian/symbian.pro +++ b/src/plugins/bearer/symbian/symbian.pro @@ -21,6 +21,7 @@ exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { } INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +symbian-abld:INCLUDEPATH += $$QT_BUILD_TREE/include/QtNetwork/private LIBS += -lcommdb \ -lapsettingshandlerui \ diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index cd4d5c2..cffd4e3 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1126,6 +1126,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec) if (displayArgs.contains(QLatin1String("boundingrectflip"), Qt::CaseInsensitive)) { d_ptr->directFBFlags |= BoundingRectFlip; + } else if (displayArgs.contains(QLatin1String("nopartialflip"), Qt::CaseInsensitive)) { + d_ptr->directFBFlags |= NoPartialFlip; } #ifdef QT_DIRECTFB_IMAGECACHE @@ -1139,6 +1141,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec) #endif d_ptr->dfb->SetCooperativeLevel(d_ptr->dfb, DFSCL_FULLSCREEN); + const bool forcePremultiplied = displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive); + DFBSurfaceDescription description; memset(&description, 0, sizeof(DFBSurfaceDescription)); IDirectFBSurface *surface; @@ -1167,7 +1171,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec) description.caps |= capabilities[i].cap; } - if (displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive)) { + if (forcePremultiplied) { description.caps |= DSCAPS_PREMULTIPLIED; } @@ -1217,6 +1221,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec) d_ptr->alphaPixmapFormat = QImage::Format_ARGB32_Premultiplied; break; case QImage::Format_ARGB32: + if (forcePremultiplied) + d_ptr->alphaPixmapFormat = pixelFormat = QImage::Format_ARGB32_Premultiplied; case QImage::Format_ARGB32_Premultiplied: case QImage::Format_ARGB4444_Premultiplied: case QImage::Format_ARGB8555_Premultiplied: @@ -1674,7 +1680,7 @@ bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *d uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl) { - void *mem; + void *mem = 0; const DFBResult result = surface->Lock(surface, flags, &mem, bpl); if (result != DFB_OK) { DirectFBError("QDirectFBScreen::lockSurface()", result); @@ -1683,11 +1689,22 @@ uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFla return reinterpret_cast<uchar*>(mem); } +static inline bool isFullUpdate(IDirectFBSurface *surface, const QRegion ®ion, const QPoint &offset) +{ + if (offset == QPoint(0, 0) && region.rectCount() == 1) { + QSize size; + surface->GetSize(surface, &size.rwidth(), &size.rheight()); + if (region.boundingRect().size() == size) + return true; + } + return false; +} void QDirectFBScreen::flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags, const QRegion ®ion, const QPoint &offset) { - if (!(flipFlags & DSFLIP_BLIT)) { + if (d_ptr->directFBFlags & NoPartialFlip + || (!(flipFlags & DSFLIP_BLIT) && QT_PREPEND_NAMESPACE(isFullUpdate(surface, region, offset)))) { surface->Flip(surface, 0, flipFlags); } else { if (!(d_ptr->directFBFlags & BoundingRectFlip) && region.rectCount() > 1) { diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index a8c4b43..c483020 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -144,7 +144,8 @@ public: NoFlags = 0x00, VideoOnly = 0x01, SystemOnly = 0x02, - BoundingRectFlip = 0x04 + BoundingRectFlip = 0x04, + NoPartialFlip = 0x08 }; Q_DECLARE_FLAGS(DirectFBFlags, DirectFBFlag); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 6764e75..a8bdb65 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -92,10 +92,6 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect mode = Offscreen; flags = Buffered; } -#else - noSystemBackground = widget && widget->testAttribute(Qt::WA_NoSystemBackground); - if (noSystemBackground) - flags &= ~Opaque; #endif setSurfaceFlags(flags); #ifdef QT_DIRECTFB_TIMING @@ -134,33 +130,35 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect) if (!layer) qFatal("QDirectFBWindowSurface: Unable to get primary display layer!"); + updateIsOpaque(); + DFBWindowDescription description; memset(&description, 0, sizeof(DFBWindowDescription)); + description.flags = DWDESC_CAPS|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT; description.caps = DWCAPS_NODECORATION; - description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY; -#if (Q_DIRECTFB_VERSION >= 0x010200) - description.flags |= DWDESC_OPTIONS; -#endif + description.surface_caps = DSCAPS_NONE; + imageFormat = screen->pixelFormat(); - if (noSystemBackground) { + if (!(surfaceFlags() & Opaque)) { + imageFormat = screen->alphaPixmapFormat(); description.caps |= DWCAPS_ALPHACHANNEL; #if (Q_DIRECTFB_VERSION >= 0x010200) + description.flags |= DWDESC_OPTIONS; description.options |= DWOP_ALPHACHANNEL; #endif } - + description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(imageFormat); description.posx = rect.x(); description.posy = rect.y(); description.width = rect.width(); description.height = rect.height(); - description.surface_caps = DSCAPS_NONE; + + if (QDirectFBScreen::isPremultiplied(imageFormat)) + description.surface_caps = DSCAPS_PREMULTIPLIED; + if (screen->directFBFlags() & QDirectFBScreen::VideoOnly) description.surface_caps |= DSCAPS_VIDEOONLY; - const QImage::Format format = (noSystemBackground ? screen->alphaPixmapFormat() : screen->pixelFormat()); - description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format); - if (QDirectFBScreen::isPremultiplied(format)) - description.surface_caps = DSCAPS_PREMULTIPLIED; DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow); @@ -182,7 +180,6 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect) Q_ASSERT(!dfbSurface); dfbWindow->GetSurface(dfbWindow, &dfbSurface); - updateFormat(); } static DFBResult setWindowGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect) @@ -267,15 +264,17 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) } } else { // mode == Offscreen if (!dfbSurface) { - dfbSurface = screen->createDFBSurface(rect.size(), screen->pixelFormat(), QDirectFBScreen::DontTrackSurface); + dfbSurface = screen->createDFBSurface(rect.size(), surfaceFlags() & Opaque ? screen->pixelFormat() : screen->alphaPixmapFormat(), + QDirectFBScreen::DontTrackSurface); } } if (result != DFB_OK) DirectFBErrorFatal("QDirectFBWindowSurface::setGeometry()", result); #endif } - if (oldSurface != dfbSurface) - updateFormat(); + if (oldSurface != dfbSurface) { + imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid; + } if (oldRect.size() != rect.size()) { QWSWindowSurface::setGeometry(rect); @@ -296,7 +295,7 @@ void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) if (state.size() == sizeof(this)) { sibling = *reinterpret_cast<QDirectFBWindowSurface *const*>(state.constData()); Q_ASSERT(sibling); - sibling->setSurfaceFlags(surfaceFlags()); + setSurfaceFlags(sibling->surfaceFlags()); } } @@ -359,8 +358,6 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, const quint8 windowOpacity = quint8(win->windowOpacity() * 0xff); const QRect windowGeometry = geometry(); #ifdef QT_DIRECTFB_WM - const bool wasNoSystemBackground = noSystemBackground; - noSystemBackground = win->testAttribute(Qt::WA_NoSystemBackground); quint8 currentOpacity; Q_ASSERT(dfbWindow); dfbWindow->GetOpacity(dfbWindow, ¤tOpacity); @@ -368,18 +365,9 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, dfbWindow->SetOpacity(dfbWindow, windowOpacity); } - setOpaque(noSystemBackground || windowOpacity != 0xff); - if (wasNoSystemBackground != noSystemBackground) { - releaseSurface(); - dfbWindow->Release(dfbWindow); - dfbWindow = 0; - createWindow(windowGeometry); - win->update(); - return; - } screen->flipSurface(dfbSurface, flipFlags, region, offset); #else - setOpaque(windowOpacity != 0xff); + setOpaque(windowOpacity == 0xff); if (mode == Offscreen) { screen->exposeRegion(region.translated(offset + geometry().topLeft()), 0); } else { @@ -442,11 +430,6 @@ IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget return dfbSurface; } -void QDirectFBWindowSurface::updateFormat() -{ - imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid; -} - void QDirectFBWindowSurface::releaseSurface() { if (dfbSurface) { @@ -465,9 +448,37 @@ void QDirectFBWindowSurface::releaseSurface() } } +void QDirectFBWindowSurface::updateIsOpaque() +{ + const QWidget *win = window(); + Q_ASSERT(win); + if (win->testAttribute(Qt::WA_OpaquePaintEvent) || win->testAttribute(Qt::WA_PaintOnScreen)) { + setOpaque(true); + return; + } -QT_END_NAMESPACE + if (qFuzzyCompare(static_cast<float>(win->windowOpacity()), 1.0f)) { + const QPalette &pal = win->palette(); -#endif // QT_NO_QWS_DIRECTFB + if (win->autoFillBackground()) { + const QBrush &autoFillBrush = pal.brush(win->backgroundRole()); + if (autoFillBrush.style() != Qt::NoBrush && autoFillBrush.isOpaque()) { + setOpaque(true); + return; + } + } + + if (win->isWindow() && !win->testAttribute(Qt::WA_NoSystemBackground)) { + const QBrush &windowBrush = win->palette().brush(QPalette::Window); + if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) { + setOpaque(true); + return; + } + } + } + setOpaque(false); +} +QT_END_NAMESPACE +#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index 9568067..a6138f6 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -97,8 +97,8 @@ public: IDirectFBWindow *directFBWindow() const; #endif private: + void updateIsOpaque(); void setOpaque(bool opaque); - void updateFormat(); void releaseSurface(); QDirectFBWindowSurface *sibling; @@ -113,7 +113,6 @@ private: #endif DFBSurfaceFlipFlags flipFlags; - bool noSystemBackground; bool boundingRectFlip; #ifdef QT_DIRECTFB_TIMING int frames; diff --git a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro index 312f99c..514fd69 100644 --- a/src/plugins/imageformats/tiff/tiff.pro +++ b/src/plugins/imageformats/tiff/tiff.pro @@ -47,14 +47,15 @@ contains(QT_CONFIG, system-tiff) { ../../../3rdparty/libtiff/libtiff/tif_warning.c \ ../../../3rdparty/libtiff/libtiff/tif_write.c \ ../../../3rdparty/libtiff/libtiff/tif_zip.c - win32 { + win32:!wince*: { SOURCES += ../../../3rdparty/libtiff/libtiff/tif_win32.c } unix: { SOURCES += ../../../3rdparty/libtiff/libtiff/tif_unix.c } wince*: { - SOURCES += ../../../corelib/kernel/qfunctions_wince.cpp + SOURCES += ../../../corelib/kernel/qfunctions_wince.cpp \ + ../../../3rdparty/libtiff/libtiff/tif_wince.c } symbian*: { SOURCES += ../../../3rdparty/libtiff/port/lfind.c diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp index 570b44a..5f72ca6 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp @@ -55,7 +55,7 @@ DirectShowAudioEndpointControl::DirectShowAudioEndpointControl( , m_deviceEnumerator(0) { if (CreateBindCtx(0, &m_bindContext) == S_OK) { - m_deviceEnumerator = com_new<ICreateDevEnum>(CLSID_SystemDeviceEnum); + m_deviceEnumerator = com_new<ICreateDevEnum>(CLSID_SystemDeviceEnum, IID_ICreateDevEnum); updateEndpoints(); @@ -82,6 +82,7 @@ QList<QString> DirectShowAudioEndpointControl::availableEndpoints() const QString DirectShowAudioEndpointControl::endpointDescription(const QString &name) const { +#ifdef __IPropertyBag_INTERFACE_DEFINED__ QString description; if (IMoniker *moniker = m_devices.value(name, 0)) { @@ -96,7 +97,11 @@ QString DirectShowAudioEndpointControl::endpointDescription(const QString &name) propertyBag->Release(); } } - return description;; + + return description; +#else + return name.section(QLatin1Char('\\'), -1); +#endif } QString DirectShowAudioEndpointControl::defaultEndpoint() const @@ -120,7 +125,7 @@ void DirectShowAudioEndpointControl::setActiveEndpoint(const QString &name) if (moniker->BindToObject( m_bindContext, 0, - __uuidof(IBaseFilter), + IID_IBaseFilter, reinterpret_cast<void **>(&filter)) == S_OK) { m_service->setAudioOutput(filter); diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h index 1c9fe54..e43e2a7 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h @@ -42,30 +42,30 @@ #ifndef DIRECTSHOWGLOBAL_H #define DIRECTSHOWGLOBAL_H -#include <dshow.h> +#include <QtCore/qglobal.h> +#include <dshow.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -template <typename T> T *com_cast(IUnknown *unknown) +template <typename T> T *com_cast(IUnknown *unknown, const IID &iid) { T *iface = 0; - return unknown && unknown->QueryInterface( - __uuidof(T), reinterpret_cast<void **>(&iface)) == S_OK + return unknown && unknown->QueryInterface(iid, reinterpret_cast<void **>(&iface)) == S_OK ? iface : 0; } -template <typename T> T *com_new(const IID &clsid) +template <typename T> T *com_new(const IID &clsid, const IID &iid) { T *object = 0; return CoCreateInstance( clsid, NULL, CLSCTX_INPROC_SERVER, - __uuidof(T), + iid, reinterpret_cast<void **>(&object)) == S_OK ? object : 0; @@ -75,4 +75,73 @@ QT_END_NAMESPACE QT_END_HEADER +#ifndef __IFilterGraph2_INTERFACE_DEFINED__ +#define __IFilterGraph2_INTERFACE_DEFINED__ +#define INTERFACE IFilterGraph2 +DECLARE_INTERFACE_(IFilterGraph2 ,IGraphBuilder) +{ + STDMETHOD(AddSourceFilterForMoniker)(THIS_ IMoniker *, IBindCtx *, LPCWSTR,IBaseFilter **) PURE; + STDMETHOD(ReconnectEx)(THIS_ IPin *, const AM_MEDIA_TYPE *) PURE; + STDMETHOD(RenderEx)(IPin *, DWORD, DWORD *) PURE; +}; +#undef INTERFACE +#endif + +#ifndef __IAMFilterMiscFlags_INTERFACE_DEFINED__ +#define __IAMFilterMiscFlags_INTERFACE_DEFINED__ +#define INTERFACE IAMFilterMiscFlags +DECLARE_INTERFACE_(IAMFilterMiscFlags ,IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + STDMETHOD_(ULONG,GetMiscFlags)(THIS) PURE; +}; +#undef INTERFACE +#endif + +#ifndef __IFileSourceFilter_INTERFACE_DEFINED__ +#define __IFileSourceFilter_INTERFACE_DEFINED__ +#define INTERFACE IFileSourceFilter +DECLARE_INTERFACE_(IFileSourceFilter ,IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + STDMETHOD(Load)(THIS_ LPCOLESTR, const AM_MEDIA_TYPE *) PURE; + STDMETHOD(GetCurFile)(THIS_ LPOLESTR *ppszFileName, AM_MEDIA_TYPE *) PURE; +}; +#undef INTERFACE +#endif + +#ifndef __IAMOpenProgress_INTERFACE_DEFINED__ +#define __IAMOpenProgress_INTERFACE_DEFINED__ +#define INTERFACE IAMOpenProgress +DECLARE_INTERFACE_(IAMOpenProgress ,IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + STDMETHOD(QueryProgress)(THIS_ LONGLONG *, LONGLONG *) PURE; + STDMETHOD(AbortOperation)(THIS) PURE; +}; +#undef INTERFACE +#endif + +#ifndef __IFilterChain_INTERFACE_DEFINED__ +#define __IFilterChain_INTERFACE_DEFINED__ +#define INTERFACE IFilterChain +DECLARE_INTERFACE_(IFilterChain ,IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + STDMETHOD(StartChain)(IBaseFilter *, IBaseFilter *) PURE; + STDMETHOD(PauseChain)(IBaseFilter *, IBaseFilter *) PURE; + STDMETHOD(StopChain)(IBaseFilter *, IBaseFilter *) PURE; + STDMETHOD(RemoveChain)(IBaseFilter *, IBaseFilter *) PURE; +}; +#undef INTERFACE +#endif + #endif diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp index 54446b8..7369099 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp @@ -143,7 +143,7 @@ HRESULT DirectShowIOReader::RequestAllocator( return S_OK; } else { - *ppActual = com_new<IMemAllocator>(CLSID_MemoryAllocator); + *ppActual = com_new<IMemAllocator>(CLSID_MemoryAllocator, IID_IMemAllocator); if (*ppActual) { if ((*ppActual)->SetProperties(pProps, &actualProperties) != S_OK) { diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp index 1dca465..7b66d56 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp @@ -121,6 +121,10 @@ void DirectShowIOSource::setAllocator(IMemAllocator *allocator) // IUnknown HRESULT DirectShowIOSource::QueryInterface(REFIID riid, void **ppvObject) { + // 2dd74950-a890-11d1-abe8-00a0c905f375 + static const GUID iid_IAmFilterMiscFlags = { + 0x2dd74950, 0xa890, 0x11d1, {0xab, 0xe8, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75}}; + if (!ppvObject) { return E_POINTER; } else if (riid == IID_IUnknown @@ -128,7 +132,7 @@ HRESULT DirectShowIOSource::QueryInterface(REFIID riid, void **ppvObject) || riid == IID_IMediaFilter || riid == IID_IBaseFilter) { *ppvObject = static_cast<IBaseFilter *>(this); - } else if (riid == IID_IAMFilterMiscFlags) { + } else if (riid == iid_IAmFilterMiscFlags) { *ppvObject = static_cast<IAMFilterMiscFlags *>(this); } else if (riid == IID_IPin) { *ppvObject = static_cast<IPin *>(this); @@ -414,8 +418,8 @@ HRESULT DirectShowIOSource::tryConnect(IPin *pin, const AM_MEDIA_TYPE *type) } else if (!m_allocator) { hr = VFW_E_NO_TRANSPORT; - if (IMemInputPin *memPin = com_cast<IMemInputPin>(pin)) { - if ((m_allocator = com_new<IMemAllocator>(CLSID_MemoryAllocator))) { + if (IMemInputPin *memPin = com_cast<IMemInputPin>(pin, IID_IMemInputPin)) { + if ((m_allocator = com_new<IMemAllocator>(CLSID_MemoryAllocator, IID_IMemAllocator))) { ALLOCATOR_PROPERTIES properties; if (memPin->GetAllocatorRequirements(&properties) == S_OK || m_allocator->GetProperties(&properties) == S_OK) { diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h index b626473..1d917df 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h @@ -42,17 +42,17 @@ #ifndef DIRECTSHOWIOSOURCE_H #define DIRECTSHOWIOSOURCE_H +#include "directshowglobal.h" #include "directshowioreader.h" #include "directshowmediatype.h" #include "directshowmediatypelist.h" +#include <QtCore/qfile.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#include <QtCore/qfile.h> - class DirectShowIOSource : public DirectShowMediaTypeList , public IBaseFilter diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp index f719b29..cf6d45b 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp @@ -54,20 +54,20 @@ namespace static const TypeLookup qt_typeLookup[] = { - { QVideoFrame::Format_RGB32, MEDIASUBTYPE_RGB32 }, - { QVideoFrame::Format_BGR24, MEDIASUBTYPE_RGB24 }, - { QVideoFrame::Format_RGB565, MEDIASUBTYPE_RGB565 }, - { QVideoFrame::Format_RGB555, MEDIASUBTYPE_RGB555 }, - { QVideoFrame::Format_AYUV444, MEDIASUBTYPE_AYUV }, - { QVideoFrame::Format_YUYV, MEDIASUBTYPE_YUY2 }, - { QVideoFrame::Format_UYVY, MEDIASUBTYPE_UYVY }, - { QVideoFrame::Format_IMC1, MEDIASUBTYPE_IMC1 }, - { QVideoFrame::Format_IMC2, MEDIASUBTYPE_IMC2 }, - { QVideoFrame::Format_IMC3, MEDIASUBTYPE_IMC3 }, - { QVideoFrame::Format_IMC4, MEDIASUBTYPE_IMC4 }, - { QVideoFrame::Format_YV12, MEDIASUBTYPE_YV12 }, - { QVideoFrame::Format_NV12, MEDIASUBTYPE_NV12 }, - { QVideoFrame::Format_YUV420P, MEDIASUBTYPE_IYUV } + { QVideoFrame::Format_RGB32, /*MEDIASUBTYPE_RGB32*/ {0xe436eb7e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} }, + { QVideoFrame::Format_BGR24, /*MEDIASUBTYPE_RGB24*/ {0xe436eb7d, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} }, + { QVideoFrame::Format_RGB565, /*MEDIASUBTYPE_RGB565*/ {0xe436eb7b, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} }, + { QVideoFrame::Format_RGB555, /*MEDIASUBTYPE_RGB555*/ {0xe436eb7c, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} }, + { QVideoFrame::Format_AYUV444, /*MEDIASUBTYPE_AYUV*/ {0x56555941, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }, + { QVideoFrame::Format_YUYV, /*MEDIASUBTYPE_YUY2*/ {0x32595559, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }, + { QVideoFrame::Format_UYVY, /*MEDIASUBTYPE_UYVY*/ {0x59565955, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }, + { QVideoFrame::Format_IMC1, /*MEDIASUBTYPE_IMC1*/ {0x31434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }, + { QVideoFrame::Format_IMC2, /*MEDIASUBTYPE_IMC2*/ {0x32434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }, + { QVideoFrame::Format_IMC3, /*MEDIASUBTYPE_IMC3*/ {0x33434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }, + { QVideoFrame::Format_IMC4, /*MEDIASUBTYPE_IMC4*/ {0x34434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }, + { QVideoFrame::Format_YV12, /*MEDIASUBTYPE_YV12*/ {0x32315659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }, + { QVideoFrame::Format_NV12, /*MEDIASUBTYPE_NV12*/ {0x3231564E, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }, + { QVideoFrame::Format_YUV420P, /*MEDIASUBTYPE_IYUV*/ {0x56555949, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} } }; } @@ -102,12 +102,16 @@ void DirectShowMediaType::freeData(AM_MEDIA_TYPE *type) GUID DirectShowMediaType::convertPixelFormat(QVideoFrame::PixelFormat format) { + // MEDIASUBTYPE_None; + static const GUID none = { + 0xe436eb8e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} }; + const int count = sizeof(qt_typeLookup) / sizeof(TypeLookup); for (int i = 0; i < count; ++i) if (qt_typeLookup[i].pixelFormat == format) return qt_typeLookup[i].mediaType; - return MEDIASUBTYPE_None; + return none; } QVideoSurfaceFormat DirectShowMediaType::formatFromType(const AM_MEDIA_TYPE &type) diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp index 7b2552f..89821c4 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp @@ -297,7 +297,7 @@ QVariant DirectShowMetaDataControl::metaData(QtMultimedia::MetaData key) const } if (string) { - value = QString::fromUtf16(string, ::SysStringLen(string)); + value = QString::fromUtf16(reinterpret_cast<ushort *>(string), ::SysStringLen(string)); ::SysFreeString(string); } @@ -344,7 +344,7 @@ void DirectShowMetaDataControl::updateGraph(IFilterGraph2 *graph, IBaseFilter *s if (m_headerInfo) m_headerInfo->Release(); - m_headerInfo = com_cast<IWMHeaderInfo>(source); + m_headerInfo = com_cast<IWMHeaderInfo>(source, IID_IWMHeaderInfo); #endif // DirectShowMediaPlayerService holds a lock at this point so defer emitting signals to a later // time. diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h index 966f9b8..9a81ba8 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h @@ -42,9 +42,10 @@ #ifndef DIRECTSHOWMETADATACONTROL_H #define DIRECTSHOWMETADATACONTROL_H +#include "directshowglobal.h" + #include <QtMultimedia/qmetadatacontrol.h> -#include <dshow.h> #include <qnetwork.h> #ifndef QT_NO_WMSDK diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp index b024557..bb7bac3 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp @@ -371,7 +371,7 @@ void DirectShowPlayerControl::updateAudioOutput(IBaseFilter *filter) if (m_audio) m_audio->Release(); - m_audio = com_cast<IBasicAudio>(filter); + m_audio = com_cast<IBasicAudio>(filter, IID_IBasicAudio); } void DirectShowPlayerControl::updateError(QMediaPlayer::Error error, const QString &errorString) diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp index 57f4bec..317fa5c 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp @@ -56,8 +56,6 @@ #include <QtCore/qthread.h> #include <QtCore/qvarlengtharray.h> -#include <uuids.h> - Q_GLOBAL_STATIC(DirectShowEventLoop, qt_directShowEventLoop) QT_BEGIN_NAMESPACE @@ -80,11 +78,11 @@ private: DirectShowPlayerService::DirectShowPlayerService(QObject *parent) : QMediaService(parent) , m_playerControl(0) - , m_audioEndpointControl(0) , m_metaDataControl(0) , m_videoOutputControl(0) , m_videoRendererControl(0) , m_videoWindowControl(0) + , m_audioEndpointControl(0) , m_taskThread(0) , m_loop(qt_directShowEventLoop()) , m_pendingTasks(0) @@ -203,9 +201,12 @@ void DirectShowPlayerService::load(const QMediaContent &media, QIODevice *stream m_graphStatus = InvalidMedia; m_error = QMediaPlayer::ResourceError; } else { + // {36b73882-c2c8-11cf-8b46-00805f6cef60} + static const GUID iid_IFilterGraph2 = { + 0x36b73882, 0xc2c8, 0x11cf, {0x8b, 0x46, 0x00, 0x80, 0x5f, 0x6c, 0xef, 0x60} }; m_graphStatus = Loading; - m_graph = com_new<IFilterGraph2>(CLSID_FilterGraph); + m_graph = com_new<IFilterGraph2>(CLSID_FilterGraph, iid_IFilterGraph2); if (stream) m_pendingTasks = SetStreamSource; @@ -231,15 +232,22 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker) HRESULT hr = E_FAIL; -#ifndef QT_NO_WMSDK if (url.scheme() == QLatin1String("http") || url.scheme() == QLatin1String("https")) { - if (IFileSourceFilter *fileSource = com_new<IFileSourceFilter>(CLSID_WMAsfReader)) { + static const GUID clsid_WMAsfReader = { + 0x187463a0, 0x5bb7, 0x11d3, {0xac, 0xbe, 0x00, 0x80, 0xc7, 0x5e, 0x24, 0x6e} }; + + // {56a868a6-0ad4-11ce-b03a-0020af0ba770} + static const GUID iid_IFileSourceFilter = { + 0x56a868a6, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} }; + + if (IFileSourceFilter *fileSource = com_new<IFileSourceFilter>( + clsid_WMAsfReader, iid_IFileSourceFilter)) { locker->unlock(); - hr = fileSource->Load(url.toString().utf16(), 0); + hr = fileSource->Load(reinterpret_cast<const OLECHAR *>(url.toString().utf16()), 0); locker->relock(); if (SUCCEEDED(hr)) { - source = com_cast<IBaseFilter>(fileSource); + source = com_cast<IBaseFilter>(fileSource, IID_IBaseFilter); if (!SUCCEEDED(hr = m_graph->AddFilter(source, L"Source")) && source) { source->Release(); @@ -259,13 +267,11 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker) } if (!SUCCEEDED(hr)) { -#endif locker->unlock(); - hr = m_graph->AddSourceFilter(url.toString().utf16(), L"Source", &source); + hr = m_graph->AddSourceFilter( + reinterpret_cast<const OLECHAR *>(url.toString().utf16()), L"Source", &source); locker->relock(); -#ifndef QT_NO_WMSDK } -#endif if (SUCCEEDED(hr)) { m_executedTasks = SetSource; @@ -299,7 +305,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker) default: m_error = QMediaPlayer::ResourceError; m_errorString = QString(); - qWarning("DirectShowPlayerService::doSetUrlSource: Unresolved error code %x", hr); + qWarning("DirectShowPlayerService::doSetUrlSource: Unresolved error code %x", uint(hr)); break; } @@ -342,7 +348,7 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker) { m_pendingTasks |= m_executedTasks & (Play | Pause); - if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) { + if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) { control->Stop(); control->Release(); } @@ -393,7 +399,7 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker) locker->unlock(); HRESULT hr; if (SUCCEEDED(hr = graph->RenderEx( - pin, AM_RENDEREX_RENDERTOEXISTINGRENDERERS, 0))) { + pin, /*AM_RENDEREX_RENDERTOEXISTINGRENDERERS*/ 1, 0))) { rendered = true; } else if (renderHr == S_OK || renderHr == VFW_E_NO_DECOMPRESSOR){ renderHr = hr; @@ -448,7 +454,7 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker) m_error = QMediaPlayer::ResourceError; m_errorString = QString(); qWarning("DirectShowPlayerService::doRender: Unresolved error code %x", - renderHr); + uint(renderHr)); } } @@ -462,11 +468,11 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker) void DirectShowPlayerService::doFinalizeLoad(QMutexLocker *locker) { if (m_graphStatus != Loaded) { - if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph)) { + if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph, IID_IMediaEvent)) { event->GetEventHandle(reinterpret_cast<OAEVENT *>(&m_eventHandle)); event->Release(); } - if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) { + if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) { LONGLONG duration = 0; seeking->GetDuration(&duration); m_duration = duration / 10; @@ -496,7 +502,12 @@ void DirectShowPlayerService::releaseGraph() { if (m_graph) { if (m_executingTask != 0) { - if (IAMOpenProgress *progress = com_cast<IAMOpenProgress>(m_graph)) { + // {8E1C39A1-DE53-11cf-AA63-0080C744528D} + static const GUID iid_IAMOpenProgress = { + 0x8E1C39A1, 0xDE53, 0x11cf, {0xAA, 0x63, 0x00, 0x80, 0xC7, 0x44, 0x52, 0x8D} }; + + if (IAMOpenProgress *progress = com_cast<IAMOpenProgress>( + m_graph, iid_IAMOpenProgress)) { progress->AbortOperation(); progress->Release(); } @@ -515,7 +526,7 @@ void DirectShowPlayerService::doReleaseGraph(QMutexLocker *locker) { Q_UNUSED(locker); - if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) { + if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) { control->Stop(); control->Release(); } @@ -630,7 +641,7 @@ void DirectShowPlayerService::play() void DirectShowPlayerService::doPlay(QMutexLocker *locker) { - if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) { + if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) { locker->unlock(); HRESULT hr = control->Run(); locker->relock(); @@ -644,7 +655,7 @@ void DirectShowPlayerService::doPlay(QMutexLocker *locker) } else { m_error = QMediaPlayer::ResourceError; m_errorString = QString(); - qWarning("DirectShowPlayerService::doPlay: Unresolved error code %x", hr); + qWarning("DirectShowPlayerService::doPlay: Unresolved error code %x", uint(hr)); QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error))); } @@ -672,7 +683,7 @@ void DirectShowPlayerService::pause() void DirectShowPlayerService::doPause(QMutexLocker *locker) { - if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) { + if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) { locker->unlock(); HRESULT hr = control->Pause(); locker->relock(); @@ -680,7 +691,7 @@ void DirectShowPlayerService::doPause(QMutexLocker *locker) control->Release(); if (SUCCEEDED(hr)) { - if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) { + if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) { LONGLONG position = 0; seeking->GetCurrentPosition(&position); @@ -697,7 +708,7 @@ void DirectShowPlayerService::doPause(QMutexLocker *locker) } else { m_error = QMediaPlayer::ResourceError; m_errorString = QString(); - qWarning("DirectShowPlayerService::doPause: Unresolved error code %x", hr); + qWarning("DirectShowPlayerService::doPause: Unresolved error code %x", uint(hr)); QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error))); } @@ -723,12 +734,12 @@ void DirectShowPlayerService::stop() void DirectShowPlayerService::doStop(QMutexLocker *locker) { if (m_executedTasks & (Play | Pause)) { - if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) { + if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) { control->Stop(); control->Release(); } - if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) { + if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) { LONGLONG position = 0; seeking->GetCurrentPosition(&position); @@ -763,7 +774,7 @@ void DirectShowPlayerService::setRate(qreal rate) void DirectShowPlayerService::doSetRate(QMutexLocker *locker) { - if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) { + if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) { // Cache current values as we can't query IMediaSeeking during a seek due to the // possibility of a deadlock when flushing the VideoSurfaceFilter. LONGLONG currentPosition = 0; @@ -801,7 +812,7 @@ qint64 DirectShowPlayerService::position() const if (m_graphStatus == Loaded) { if (m_executingTask == Seek || m_executingTask == SetRate) { return m_position; - } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) { + } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) { LONGLONG position = 0; seeking->GetCurrentPosition(&position); @@ -822,7 +833,7 @@ QMediaTimeRange DirectShowPlayerService::availablePlaybackRanges() const if (m_graphStatus == Loaded) { if (m_executingTask == Seek || m_executingTask == SetRate) { return m_playbackRange; - } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) { + } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) { LONGLONG minimum = 0; LONGLONG maximum = 0; @@ -850,7 +861,7 @@ void DirectShowPlayerService::seek(qint64 position) void DirectShowPlayerService::doSeek(QMutexLocker *locker) { - if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) { + if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) { LONGLONG seekPosition = LONGLONG(m_position) * 10; // Cache current values as we can't query IMediaSeeking during a seek due to the @@ -886,7 +897,8 @@ int DirectShowPlayerService::bufferStatus() const #ifndef QT_NO_WMSDK QMutexLocker locker(const_cast<QMutex *>(&m_mutex)); - if (IWMReaderAdvanced2 *reader = com_cast<IWMReaderAdvanced2>(m_source)) { + if (IWMReaderAdvanced2 *reader = com_cast<IWMReaderAdvanced2>( + m_source, IID_IWMReaderAdvanced2)) { DWORD percentage = 0; reader->GetBufferProgress(&percentage, 0); @@ -949,7 +961,7 @@ void DirectShowPlayerService::doReleaseAudioOutput(QMutexLocker *locker) { m_pendingTasks |= m_executedTasks & (Play | Pause); - if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) { + if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) { control->Stop(); control->Release(); } @@ -960,7 +972,11 @@ void DirectShowPlayerService::doReleaseAudioOutput(QMutexLocker *locker) decoder->AddRef(); } - if (IFilterChain *chain = com_cast<IFilterChain>(m_graph)) { + // {DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29} + static const GUID iid_IFilterChain = { + 0xDCFBDCF6, 0x0DC2, 0x45f5, {0x9A, 0xB2, 0x7C, 0x33, 0x0E, 0xA0, 0x9C, 0x29} }; + + if (IFilterChain *chain = com_cast<IFilterChain>(m_graph, iid_IFilterChain)) { chain->RemoveChain(decoder, m_audioOutput); chain->Release(); } else { @@ -1018,7 +1034,7 @@ void DirectShowPlayerService::doReleaseVideoOutput(QMutexLocker *locker) { m_pendingTasks |= m_executedTasks & (Play | Pause); - if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) { + if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) { control->Stop(); control->Release(); } @@ -1035,7 +1051,11 @@ void DirectShowPlayerService::doReleaseVideoOutput(QMutexLocker *locker) decoder->AddRef(); } - if (IFilterChain *chain = com_cast<IFilterChain>(m_graph)) { + // {DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29} + static const GUID iid_IFilterChain = { + 0xDCFBDCF6, 0x0DC2, 0x45f5, {0x9A, 0xB2, 0x7C, 0x33, 0x0E, 0xA0, 0x9C, 0x29} }; + + if (IFilterChain *chain = com_cast<IFilterChain>(m_graph, iid_IFilterChain)) { chain->RemoveChain(decoder, m_videoOutput); chain->Release(); } else { @@ -1118,7 +1138,7 @@ void DirectShowPlayerService::videoOutputChanged() void DirectShowPlayerService::graphEvent(QMutexLocker *locker) { - if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph)) { + if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph, IID_IMediaEvent)) { long eventCode; LONG_PTR param1; LONG_PTR param2; @@ -1137,7 +1157,7 @@ void DirectShowPlayerService::graphEvent(QMutexLocker *locker) m_buffering = false; m_atEnd = true; - if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) { + if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) { LONGLONG position = 0; seeking->GetCurrentPosition(&position); @@ -1149,7 +1169,7 @@ void DirectShowPlayerService::graphEvent(QMutexLocker *locker) QCoreApplication::postEvent(this, new QEvent(QEvent::Type(EndOfMedia))); break; case EC_LENGTH_CHANGED: - if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) { + if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) { LONGLONG duration = 0; seeking->GetDuration(&duration); m_duration = duration / 10; diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h index a5da9a4..23515d0 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h @@ -57,7 +57,6 @@ #include <QtCore/private/qwineventnotifier_p.h> - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri b/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri index a7adb38..99a1191 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri +++ b/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri @@ -2,7 +2,7 @@ INCLUDEPATH += $$PWD DEFINES += QMEDIA_DIRECTSHOW_PLAYER -win32-g++: DEFINES += QT_NO_WMSDK +!contains(QT_CONFIG, wmsdk): DEFINES += QT_NO_WMSDK HEADERS += \ $$PWD/directshowaudioendpointcontrol.h \ diff --git a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp index 7b4aad5..a471c68 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp @@ -84,7 +84,11 @@ VideoSurfaceFilter::~VideoSurfaceFilter() } HRESULT VideoSurfaceFilter::QueryInterface(REFIID riid, void **ppvObject) -{ +{ + // 2dd74950-a890-11d1-abe8-00a0c905f375 + static const GUID iid_IAmFilterMiscFlags = { + 0x2dd74950, 0xa890, 0x11d1, {0xab, 0xe8, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75} }; + if (!ppvObject) { return E_POINTER; } else if (riid == IID_IUnknown @@ -92,7 +96,7 @@ HRESULT VideoSurfaceFilter::QueryInterface(REFIID riid, void **ppvObject) || riid == IID_IMediaFilter || riid == IID_IBaseFilter) { *ppvObject = static_cast<IBaseFilter *>(this); - } else if (riid == IID_IAMFilterMiscFlags) { + } else if (riid == iid_IAmFilterMiscFlags) { *ppvObject = static_cast<IAMFilterMiscFlags *>(this); } else if (riid == IID_IPin) { *ppvObject = static_cast<IPin *>(this); @@ -446,7 +450,7 @@ HRESULT VideoSurfaceFilter::EndOfStream() QMutexLocker locker(&m_mutex); if (!m_sampleScheduler.scheduleEndOfStream()) { - if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph)) { + if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph, IID_IMediaEventSink)) { sink->Notify( EC_COMPLETE, S_OK, @@ -570,6 +574,10 @@ void VideoSurfaceFilter::supportedFormatsChanged() { QMutexLocker locker(&m_mutex); + // MEDIASUBTYPE_None; + static const GUID none = { + 0xe436eb8e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} }; + QList<QVideoFrame::PixelFormat> formats = m_surface->supportedPixelFormats(); QVector<AM_MEDIA_TYPE> mediaTypes; @@ -588,7 +596,7 @@ void VideoSurfaceFilter::supportedFormatsChanged() foreach (QVideoFrame::PixelFormat format, formats) { type.subtype = DirectShowMediaType::convertPixelFormat(format); - if (type.subtype != MEDIASUBTYPE_None) + if (type.subtype != none) mediaTypes.append(type); } @@ -610,7 +618,7 @@ void VideoSurfaceFilter::sampleReady() sample->Release(); if (eos) { - if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph)) { + if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph, IID_IMediaEventSink)) { sink->Notify( EC_COMPLETE, S_OK, diff --git a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h index 8f3a101..0607fd3 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h +++ b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h @@ -41,6 +41,7 @@ #ifndef VIDEOSURFACEFILTER_H #define VIDEOSURFACEFILTER_H +#include "directshowglobal.h" #include "directshowmediatypelist.h" #include "directshowsamplescheduler.h" #include "directshowmediatype.h" @@ -52,9 +53,6 @@ #include <QtCore/qstring.h> #include <QtCore/qwaitcondition.h> -#include <dshow.h> - - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp index a564e14..b1ddd98 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE Vmr9VideoWindowControl::Vmr9VideoWindowControl(QObject *parent) : QVideoWindowControl(parent) - , m_filter(com_new<IBaseFilter>(CLSID_VideoMixingRenderer9)) + , m_filter(com_new<IBaseFilter>(CLSID_VideoMixingRenderer9, IID_IBaseFilter)) , m_windowId(0) , m_dirtyValues(0) , m_brightness(0) @@ -57,7 +57,7 @@ Vmr9VideoWindowControl::Vmr9VideoWindowControl(QObject *parent) , m_saturation(0) , m_fullScreen(false) { - if (IVMRFilterConfig9 *config = com_cast<IVMRFilterConfig9>(m_filter)) { + if (IVMRFilterConfig9 *config = com_cast<IVMRFilterConfig9>(m_filter, IID_IVMRFilterConfig9)) { config->SetRenderingMode(VMR9Mode_Windowless); config->SetNumberOfStreams(1); config->Release(); @@ -81,7 +81,8 @@ void Vmr9VideoWindowControl::setWinId(WId id) { m_windowId = id; - if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) { + if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( + m_filter, IID_IVMRWindowlessControl9)) { control->SetVideoClippingWindow(m_windowId); control->Release(); } @@ -91,7 +92,8 @@ QRect Vmr9VideoWindowControl::displayRect() const { QRect rect; - if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) { + if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( + m_filter, IID_IVMRWindowlessControl9)) { RECT sourceRect; RECT displayRect; @@ -109,7 +111,8 @@ QRect Vmr9VideoWindowControl::displayRect() const void Vmr9VideoWindowControl::setDisplayRect(const QRect &rect) { - if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) { + if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( + m_filter, IID_IVMRWindowlessControl9)) { RECT sourceRect = { 0, 0, 0, 0 }; RECT displayRect = { rect.left(), rect.top(), rect.right(), rect.bottom() }; @@ -134,7 +137,8 @@ void Vmr9VideoWindowControl::repaint() if (QWidget *widget = QWidget::find(m_windowId)) { HDC dc = widget->getDC(); - if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) { + if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( + m_filter, IID_IVMRWindowlessControl9)) { control->RepaintVideo(m_windowId, dc); control->Release(); } @@ -146,7 +150,8 @@ QSize Vmr9VideoWindowControl::nativeSize() const { QSize size; - if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) { + if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( + m_filter, IID_IVMRWindowlessControl9)) { LONG width; LONG height; @@ -161,7 +166,8 @@ QVideoWidget::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const { QVideoWidget::AspectRatioMode mode = QVideoWidget::KeepAspectRatio; - if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) { + if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( + m_filter, IID_IVMRWindowlessControl9)) { DWORD arMode; if (control->GetAspectRatioMode(&arMode) == S_OK && arMode == VMR9ARMode_None) @@ -173,7 +179,8 @@ QVideoWidget::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const void Vmr9VideoWindowControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) { - if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) { + if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( + m_filter, IID_IVMRWindowlessControl9)) { switch (mode) { case QVideoWidget::IgnoreAspectRatio: control->SetAspectRatioMode(VMR9ARMode_None); @@ -254,7 +261,7 @@ void Vmr9VideoWindowControl::setSaturation(int saturation) void Vmr9VideoWindowControl::setProcAmpValues() { - if (IVMRMixerControl9 *control = com_cast<IVMRMixerControl9>(m_filter)) { + if (IVMRMixerControl9 *control = com_cast<IVMRMixerControl9>(m_filter, IID_IVMRMixerControl9)) { VMR9ProcAmpControl procAmp; procAmp.dwSize = sizeof(VMR9ProcAmpControl); procAmp.dwFlags = m_dirtyValues; diff --git a/src/plugins/mediaservices/gstreamer/gstreamer.pro b/src/plugins/mediaservices/gstreamer/gstreamer.pro index db0ee4e..22e3c16 100644 --- a/src/plugins/mediaservices/gstreamer/gstreamer.pro +++ b/src/plugins/mediaservices/gstreamer/gstreamer.pro @@ -8,16 +8,8 @@ unix:contains(QT_CONFIG, alsa) { LIBS += -lasound } -LIBS += -lXv - -CONFIG += link_pkgconfig - -PKGCONFIG += \ - gstreamer-0.10 \ - gstreamer-base-0.10 \ - gstreamer-interfaces-0.10 \ - gstreamer-audio-0.10 \ - gstreamer-video-0.10 +QMAKE_CXXFLAGS += $$QT_CFLAGS_GSTREAMER +LIBS += -lXv $$QT_LIBS_GSTREAMER -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10 -lgstaudio-0.10 # Input HEADERS += \ diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp index 4d0ffe4..eff6ea4 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp @@ -45,6 +45,8 @@ #include <gst/gstversion.h> +QT_BEGIN_NAMESPACE + struct QGstreamerMetaDataKeyLookup { QtMultimedia::MetaData key; @@ -202,3 +204,6 @@ void QGstreamerMetaDataProvider::updateTags() { emit metaDataChanged(); } + +QT_END_NAMESPACE + diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp index d417266..2d7aaa8 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp @@ -54,6 +54,8 @@ #include <fcntl.h> #include <unistd.h> +QT_BEGIN_NAMESPACE + QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *session, QObject *parent) : QMediaPlayerControl(parent) , m_session(session) @@ -341,3 +343,6 @@ void QGstreamerPlayerControl::closeFifo() m_bufferOffset = 0; } } + +QT_END_NAMESPACE + diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp index 2e5d10f..600621e 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -51,6 +51,9 @@ //#define USE_PLAYBIN2 + +QT_BEGIN_NAMESPACE + QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) :QObject(parent), m_state(QMediaPlayer::StoppedState), @@ -710,3 +713,6 @@ void QGstreamerPlayerSession::getStreamsInfo() emit streamsChanged(); } + +QT_END_NAMESPACE + diff --git a/src/plugins/mediaservices/gstreamer/qgstreamerbushelper.cpp b/src/plugins/mediaservices/gstreamer/qgstreamerbushelper.cpp index 59ae5be..5049fa1 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamerbushelper.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamerbushelper.cpp @@ -45,6 +45,7 @@ #include "qgstreamerbushelper.h" +QT_BEGIN_NAMESPACE #ifndef QT_NO_GLIB class QGstreamerBusHelperPrivate : public QObject @@ -200,4 +201,6 @@ void QGstreamerBusHelper::installSyncEventFilter(QGstreamerSyncEventFilter *filt d->filter = filter; } +QT_END_NAMESPACE + #include "qgstreamerbushelper.moc" diff --git a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp index 0a689d9..863b6d4 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp @@ -44,11 +44,13 @@ #include "qgstreamermessage.h" +QT_BEGIN_NAMESPACE + static int wuchi = qRegisterMetaType<QGstreamerMessage>(); /*! - \class QGstreamerMessage + \class gstreamer::QGstreamerMessage \internal */ @@ -91,3 +93,5 @@ QGstreamerMessage& QGstreamerMessage::operator=(QGstreamerMessage const& rhs) return *this; } + +QT_END_NAMESPACE diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp index 94ae847..406cefe11 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideoinputdevicecontrol.cpp @@ -57,6 +57,9 @@ #include <sys/mman.h> #include <linux/videodev2.h> + +QT_BEGIN_NAMESPACE + QGstreamerVideoInputDeviceControl::QGstreamerVideoInputDeviceControl(QObject *parent) :QVideoDeviceControl(parent), m_selectedDevice(0) { @@ -155,3 +158,6 @@ void QGstreamerVideoInputDeviceControl::update() ::close(fd); } } + +QT_END_NAMESPACE + diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooutputcontrol.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideooutputcontrol.cpp index decf524..f406bff 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideooutputcontrol.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooutputcontrol.cpp @@ -41,6 +41,8 @@ #include "qgstreamervideooutputcontrol.h" +QT_BEGIN_NAMESPACE + QGstreamerVideoOutputControl::QGstreamerVideoOutputControl(QObject *parent) : QVideoOutputControl(parent) , m_output(NoOutput) @@ -70,3 +72,6 @@ void QGstreamerVideoOutputControl::setOutput(Output output) if (m_output != output) emit outputChanged(m_output = output); } + +QT_END_NAMESPACE + diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp index 6c6c802..846a24a 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp @@ -46,6 +46,8 @@ #include "qx11videosurface.h" +QT_BEGIN_NAMESPACE + QGstreamerVideoOverlay::QGstreamerVideoOverlay(QObject *parent) : QVideoWindowControl(parent) , m_surface(new QX11VideoSurface) @@ -208,3 +210,6 @@ void QGstreamerVideoOverlay::setScaledDisplayRect() break; }; } + +QT_END_NAMESPACE + diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideorenderer.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideorenderer.cpp index 25a53cf..1f03990 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideorenderer.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideorenderer.cpp @@ -47,6 +47,9 @@ #include <gst/gst.h> + +QT_BEGIN_NAMESPACE + QGstreamerVideoRenderer::QGstreamerVideoRenderer(QObject *parent) :QVideoRendererControl(parent),m_videoSink(0) { @@ -80,3 +83,6 @@ void QGstreamerVideoRenderer::setSurface(QAbstractVideoSurface *surface) m_surface = surface; } +QT_END_NAMESPACE + + diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.cpp index 0a1c20d..886a064 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.cpp @@ -41,6 +41,12 @@ #include "qgstreamervideorendererinterface.h" + +QT_BEGIN_NAMESPACE + QGstreamerVideoRendererInterface::~QGstreamerVideoRendererInterface() { } + +QT_END_NAMESPACE + diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.h b/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.h index 39deee8..c63a757 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.h +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideorendererinterface.h @@ -59,11 +59,11 @@ public: virtual void precessNewStream() {} }; -QT_END_NAMESPACE - #define QGstreamerVideoRendererInterface_iid "com.nokia.Qt.QGstreamerVideoRendererInterface/1.0" Q_DECLARE_INTERFACE(QGstreamerVideoRendererInterface, QGstreamerVideoRendererInterface_iid) +QT_END_NAMESPACE + QT_END_HEADER #endif diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp index 1d8d43d..47fb451 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp @@ -51,6 +51,9 @@ #include <gst/interfaces/xoverlay.h> #include <gst/interfaces/propertyprobe.h> + +QT_BEGIN_NAMESPACE + class QGstreamerVideoWidget : public QWidget { public: @@ -320,3 +323,6 @@ void QGstreamerVideoWidgetControl::setSaturation(int saturation) emit saturationChanged(saturation); } } + +QT_END_NAMESPACE + diff --git a/src/plugins/mediaservices/gstreamer/qgstvideobuffer.cpp b/src/plugins/mediaservices/gstreamer/qgstvideobuffer.cpp index 9519db6..76289bf 100644 --- a/src/plugins/mediaservices/gstreamer/qgstvideobuffer.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstvideobuffer.cpp @@ -42,6 +42,8 @@ #include "qgstvideobuffer.h" +QT_BEGIN_NAMESPACE + QGstVideoBuffer::QGstVideoBuffer(GstBuffer *buffer, int bytesPerLine) : QAbstractVideoBuffer(NoHandle) , m_buffer(buffer) @@ -95,3 +97,5 @@ void QGstVideoBuffer::unmap() m_mode = NotMapped; } +QT_END_NAMESPACE + diff --git a/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp b/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp index 5b99817..b2e633d 100644 --- a/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.cpp @@ -47,6 +47,9 @@ #include "qgstxvimagebuffer.h" #include "qvideosurfacegstsink.h" + +QT_BEGIN_NAMESPACE + GstBufferClass *QGstXvImageBuffer::parent_class = NULL; GType QGstXvImageBuffer::get_type(void) @@ -274,3 +277,6 @@ void QGstXvImageBufferPool::destroyBuffer(QGstXvImageBuffer *xvBuffer) if (m_imagesToDestroy.size() == 1) QMetaObject::invokeMethod(this, "queuedDestroy", Qt::QueuedConnection); } + +QT_END_NAMESPACE + diff --git a/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.h b/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.h index beeb01f..30f77d1 100644 --- a/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.h +++ b/src/plugins/mediaservices/gstreamer/qgstxvimagebuffer.h @@ -56,14 +56,13 @@ #include <X11/extensions/Xv.h> #include <X11/extensions/Xvlib.h> - #include <gst/gst.h> + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE - class QGstXvImageBufferPool; struct QGstXvImageBuffer { @@ -82,7 +81,6 @@ struct QGstXvImageBuffer { const QAbstractVideoBuffer::HandleType XvHandleType = QAbstractVideoBuffer::HandleType(4); -Q_DECLARE_METATYPE(XvImage*) class QGstXvImageBufferPool : public QObject { @@ -125,6 +123,8 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(::XvImage*) + QT_END_HEADER diff --git a/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp b/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp index 402a225..76d87ce 100644 --- a/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp +++ b/src/plugins/mediaservices/gstreamer/qvideosurfacegstsink.cpp @@ -52,8 +52,11 @@ #include "qgstxvimagebuffer.h" + Q_DECLARE_METATYPE(QVideoSurfaceFormat) +QT_BEGIN_NAMESPACE + QVideoSurfaceGstDelegate::QVideoSurfaceGstDelegate(QAbstractVideoSurface *surface) : m_surface(surface) , m_renderReturn(GST_FLOW_ERROR) @@ -691,3 +694,6 @@ GstFlowReturn QVideoSurfaceGstSink::render(GstBaseSink *base, GstBuffer *buffer) return sink->delegate->render(buffer); } +QT_END_NAMESPACE + + diff --git a/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp b/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp index 6e282ff..cbd5a76 100644 --- a/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp +++ b/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp @@ -46,7 +46,9 @@ #include "qx11videosurface.h" -Q_DECLARE_METATYPE(XvImage*); +Q_DECLARE_METATYPE(::XvImage*); + +QT_BEGIN_NAMESPACE static QAbstractVideoBuffer::HandleType XvHandleType = QAbstractVideoBuffer::HandleType(4); @@ -507,3 +509,5 @@ void QX11VideoSurface::querySupportedFormats() XFree(attributes); } } + +QT_END_NAMESPACE diff --git a/src/plugins/mediaservices/mediaservices.pro b/src/plugins/mediaservices/mediaservices.pro index 0cef605..d84b276 100644 --- a/src/plugins/mediaservices/mediaservices.pro +++ b/src/plugins/mediaservices/mediaservices.pro @@ -5,16 +5,7 @@ contains(QT_CONFIG, mediaservice) { mac: SUBDIRS += qt7 - unix:!mac:!symbian { - TMP_GST_LIBS = \ - gstreamer-0.10 >= 0.10.19 \ - gstreamer-base-0.10 >= 0.10.19 \ - gstreamer-interfaces-0.10 >= 0.10.19 \ - gstreamer-audio-0.10 >= 0.10.19 \ - gstreamer-video-0.10 >= 0.10.19 - - system(pkg-config --exists \'$${TMP_GST_LIBS}\' --print-errors): { - SUBDIRS += gstreamer - } + unix:!mac:!symbian:contains(QT_CONFIG, xvideo):contains(QT_CONFIG, gstreamer) { + SUBDIRS += gstreamer } } diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm index a14981a..b046672 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm @@ -132,15 +132,19 @@ static OSStatus readMetaValue(QTMetaDataRef metaDataRef, QTMetaDataItem item, QT UInt32 propFlags; OSStatus err = QTMetaDataGetItemPropertyInfo(metaDataRef, item, propClass, id, &type, &propSize, &propFlags); - - *value = malloc(propSize); - - err = QTMetaDataGetItemProperty(metaDataRef, item, propClass, id, propSize, *value, size); - - if (type == 'code' || type == 'itsk' || type == 'itlk') { - // convert from native endian to big endian - OSTypePtr pType = (OSTypePtr)*value; - *pType = EndianU32_NtoB(*pType); + if (err == noErr) { + *value = malloc(propSize); + if (*value != 0) { + err = QTMetaDataGetItemProperty(metaDataRef, item, propClass, id, propSize, *value, size); + + if (err == noErr && (type == 'code' || type == 'itsk' || type == 'itlk')) { + // convert from native endian to big endian + OSTypePtr pType = (OSTypePtr)*value; + *pType = EndianU32_NtoB(*pType); + } + } + else + return -1; } return err; @@ -153,10 +157,14 @@ static UInt32 getMetaType(QTMetaDataRef metaDataRef, QTMetaDataItem item) OSStatus err = readMetaValue( metaDataRef, item, kPropertyClass_MetaDataItem, kQTMetaDataItemPropertyID_DataType, &value, &ignore); - UInt32 type = *((UInt32 *) value); - if (value) - free(value); - return type; + if (err == noErr) { + UInt32 type = *((UInt32 *) value); + if (value) + free(value); + return type; + } + + return 0; } static QString cFStringToQString(CFStringRef str) @@ -179,23 +187,26 @@ static QString getMetaValue(QTMetaDataRef metaDataRef, QTMetaDataItem item, SInt QTPropertyValuePtr value = 0; ByteCount size = 0; OSStatus err = readMetaValue(metaDataRef, item, kPropertyClass_MetaDataItem, id, &value, &size); - QString string; - UInt32 dataType = getMetaType(metaDataRef, item); - switch (dataType){ - case kQTMetaDataTypeUTF8: - case kQTMetaDataTypeMacEncodedText: - string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF8, false)); - break; - case kQTMetaDataTypeUTF16BE: - string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF16BE, false)); - break; - default: - break; + + if (err == noErr) { + UInt32 dataType = getMetaType(metaDataRef, item); + switch (dataType){ + case kQTMetaDataTypeUTF8: + case kQTMetaDataTypeMacEncodedText: + string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF8, false)); + break; + case kQTMetaDataTypeUTF16BE: + string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF16BE, false)); + break; + default: + break; + } + + if (value) + free(value); } - if (value) - free(value); return string; } @@ -234,10 +245,11 @@ void QT7PlayerMetaDataControl::updateTags() #ifdef QUICKTIME_C_API_AVAILABLE QTMetaDataRef metaDataRef; OSStatus err = QTCopyMovieMetaData([movie quickTimeMovie], &metaDataRef); - - readFormattedData(metaDataRef, kQTMetaDataStorageFormatUserData, metaMap); - readFormattedData(metaDataRef, kQTMetaDataStorageFormatQuickTime, metaMap); - readFormattedData(metaDataRef, kQTMetaDataStorageFormatiTunes, metaMap); + if (err == noErr) { + readFormattedData(metaDataRef, kQTMetaDataStorageFormatUserData, metaMap); + readFormattedData(metaDataRef, kQTMetaDataStorageFormatQuickTime, metaMap); + readFormattedData(metaDataRef, kQTMetaDataStorageFormatiTunes, metaMap); + } #else NSString *name = [movie attributeForKey:@"QTMovieDisplayNameAttribute"]; metaMap.insert(QLatin1String("nam"), QString::fromUtf8([name UTF8String])); diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm index faf75d1..205e862 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playerservice.mm @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE QT7PlayerService::QT7PlayerService(QObject *parent): QMediaService(parent) { - m_session = new QT7PlayerSession; + m_session = new QT7PlayerSession(this); m_control = new QT7PlayerControl(this); m_control->setSession(m_session); @@ -102,6 +102,7 @@ QT7PlayerService::QT7PlayerService(QObject *parent): QT7PlayerService::~QT7PlayerService() { + m_session->setVideoOutput(0); } QMediaControl *QT7PlayerService::control(const char *name) const diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h index 4742e2e..0ba3041 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h @@ -107,7 +107,7 @@ public slots: void setMuted(bool muted); void processEOS(); - void processStateChange(); + void processLoadStateChange(); void processVolumeChange(); void processNaturalSizeChange(); @@ -138,6 +138,10 @@ private: bool m_muted; int m_volume; qreal m_rate; + + qint64 m_duration; + bool m_videoAvailable; + bool m_audioAvailable; }; QT_END_NAMESPACE diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm index 3f198b9..d83c0e3 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm @@ -48,10 +48,13 @@ #include "qt7playercontrol.h" #include "qt7videooutputcontrol.h" +#include <QtNetwork/qnetworkcookie.h> #include <QtMultimedia/qmediaplaylistnavigator.h> #include <CoreFoundation/CoreFoundation.h> +#include <Foundation/Foundation.h> +#include <QtCore/qdatetime.h> #include <QtCore/qurl.h> #include <QtCore/qdebug.h> @@ -65,7 +68,9 @@ - (QTMovieObserver *) initWithPlayerSession:(QT7PlayerSession*)session; - (void) setMovie:(QTMovie *)movie; - (void) processEOS:(NSNotification *)notification; -- (void) processStateChange:(NSNotification *)notification; +- (void) processLoadStateChange:(NSNotification *)notification; +- (void) processVolumeChange:(NSNotification *)notification; +- (void) processNaturalSizeChange :(NSNotification *)notification; @end @implementation QTMovieObserver @@ -98,7 +103,7 @@ object:m_movie]; [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(processStateChange:) + selector:@selector(processLoadStateChange:) name:QTMovieLoadStateDidChangeNotification object:m_movie]; @@ -126,10 +131,10 @@ m_session->processEOS(); } -- (void) processStateChange:(NSNotification *)notification +- (void) processLoadStateChange:(NSNotification *)notification { Q_UNUSED(notification); - m_session->processStateChange(); + m_session->processLoadStateChange(); } - (void) processVolumeChange:(NSNotification *)notification @@ -164,6 +169,9 @@ QT7PlayerSession::QT7PlayerSession(QObject *parent) , m_muted(false) , m_volume(100) , m_rate(1.0) + , m_duration(0) + , m_videoAvailable(false) + , m_audioAvailable(false) { m_movieObserver = [[QTMovieObserver alloc] initWithPlayerSession:this]; } @@ -172,6 +180,7 @@ QT7PlayerSession::~QT7PlayerSession() { [(QTMovieObserver*)m_movieObserver setMovie:nil]; [(QTMovieObserver*)m_movieObserver release]; + [(QTMovie*)m_QTMovie release]; } void *QT7PlayerSession::movie() const @@ -365,17 +374,37 @@ void QT7PlayerSession::setMedia(const QMediaContent &content, QIODevice *stream) m_mediaStream = stream; m_mediaStatus = QMediaPlayer::NoMedia; - QUrl url; + QNetworkRequest request; if (!content.isNull()) - url = content.canonicalUrl(); + request = content.canonicalResource().request(); else return; -// qDebug() << "Open media" << url; + QVariant cookies = request.header(QNetworkRequest::CookieHeader); + if (cookies.isValid()) { + NSHTTPCookieStorage *store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; + QList<QNetworkCookie> cookieList = cookies.value<QList<QNetworkCookie> >(); + + foreach (const QNetworkCookie &requestCookie, cookieList) { + NSMutableDictionary *p = [NSMutableDictionary dictionaryWithObjectsAndKeys: + (NSString*)qString2CFStringRef(requestCookie.name()), NSHTTPCookieName, + (NSString*)qString2CFStringRef(requestCookie.value()), NSHTTPCookieValue, + (NSString*)qString2CFStringRef(requestCookie.domain()), NSHTTPCookieDomain, + (NSString*)qString2CFStringRef(requestCookie.path()), NSHTTPCookiePath, + nil + ]; + if (requestCookie.isSessionCookie()) + [p setObject:[NSString stringWithUTF8String:"TRUE"] forKey:NSHTTPCookieDiscard]; + else + [p setObject:[NSDate dateWithTimeIntervalSince1970:requestCookie.expirationDate().toTime_t()] forKey:NSHTTPCookieExpires]; + + [store setCookie:[NSHTTPCookie cookieWithProperties:p]]; + } + } NSError *err = 0; - NSString *urlString = (NSString *)qString2CFStringRef(url.toString()); + NSString *urlString = (NSString *)qString2CFStringRef(request.url().toString()); NSDictionary *attr = [NSDictionary dictionaryWithObjectsAndKeys: [NSURL URLWithString:urlString], QTMovieURLAttribute, @@ -400,7 +429,7 @@ void QT7PlayerSession::setMedia(const QMediaContent &content, QIODevice *stream) m_videoOutput->setMovie(m_QTMovie); m_videoOutput->setEnabled(true); } - processStateChange(); + processLoadStateChange(); [(QTMovie*)m_QTMovie setMuted:m_muted]; setVolume(m_volume); @@ -432,8 +461,11 @@ void QT7PlayerSession::processEOS() emit mediaStatusChanged(m_mediaStatus); } -void QT7PlayerSession::processStateChange() +void QT7PlayerSession::processLoadStateChange() { + if (!m_QTMovie) + return; + signed long state = [[(QTMovie*)m_QTMovie attributeForKey:QTMovieLoadStateAttribute] longValue]; // qDebug() << "Moview load state changed:" << state; @@ -461,32 +493,30 @@ void QT7PlayerSession::processStateChange() if (state == kMovieLoadStateError) { newStatus = QMediaPlayer::InvalidMedia; - emit error(QMediaPlayer::FormatError, tr("Playback failed")); + emit error(QMediaPlayer::FormatError, tr("Failed to load media")); + emit stateChanged(m_state = QMediaPlayer::StoppedState); } - if (newStatus != m_mediaStatus) { - switch (newStatus) { - case QMediaPlayer::BufferedMedia: - case QMediaPlayer::BufferingMedia: - //delayed playback start is necessary for network sources - if (m_state == QMediaPlayer::PlayingState) { - QMetaObject::invokeMethod(this, "play", Qt::QueuedConnection); - } - //fall - case QMediaPlayer::LoadedMedia: - case QMediaPlayer::LoadingMedia: - emit durationChanged(duration()); - emit audioAvailableChanged(isAudioAvailable()); - emit videoAvailableChanged(isVideoAvailable()); - break; - case QMediaPlayer::InvalidMedia: - emit stateChanged(m_state = QMediaPlayer::StoppedState); - default: - break; - } + if (state >= kMovieLoadStatePlayable && + m_state == QMediaPlayer::PlayingState && + [(QTMovie*)m_QTMovie rate] == 0) { + QMetaObject::invokeMethod(this, "play", Qt::QueuedConnection); + } - emit mediaStatusChanged(m_mediaStatus = newStatus); + if (state >= kMovieLoadStateLoaded) { + qint64 currentDuration = duration(); + if (m_duration != currentDuration) + emit durationChanged(m_duration = currentDuration); + + if (m_audioAvailable != isAudioAvailable()) + emit audioAvailableChanged(m_audioAvailable = !m_audioAvailable); + + if (m_videoAvailable != isVideoAvailable()) + emit videoAvailableChanged(m_videoAvailable = !m_videoAvailable); } + + if (newStatus != m_mediaStatus) + emit mediaStatusChanged(m_mediaStatus = newStatus); } void QT7PlayerSession::processVolumeChange() diff --git a/src/plugins/mediaservices/qt7/qt7movierenderer.mm b/src/plugins/mediaservices/qt7/qt7movierenderer.mm index 6b9fd21..1c1f5e4 100644 --- a/src/plugins/mediaservices/qt7/qt7movierenderer.mm +++ b/src/plugins/mediaservices/qt7/qt7movierenderer.mm @@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE +//#define USE_MAIN_MONITOR_COLOR_SPACE 1 + class CVGLTextureVideoBuffer : public QAbstractVideoBuffer { public: @@ -233,7 +235,24 @@ bool QT7MovieRenderer::createPixelBufferVisualContext() &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFDictionarySetValue(visualContextOptions, kQTVisualContextPixelBufferAttributesKey, pixelBufferOptions); - CFDictionarySetValue(visualContextOptions, kQTVisualContextWorkingColorSpaceKey, CGColorSpaceCreateDeviceRGB()); + + CGColorSpaceRef colorSpace = NULL; + +#if USE_MAIN_MONITOR_COLOR_SPACE + CMProfileRef sysprof = NULL; + + // Get the Systems Profile for the main display + if (CMGetSystemProfile(&sysprof) == noErr) { + // Create a colorspace with the systems profile + colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysprof); + CMCloseProfile(sysprof); + } +#endif + + if (!colorSpace) + colorSpace = CGColorSpaceCreateDeviceRGB(); + + CFDictionarySetValue(visualContextOptions, kQTVisualContextOutputColorSpaceKey, colorSpace); OSStatus err = QTPixelBufferContextCreate(kCFAllocatorDefault, visualContextOptions, diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm index 4043330..00ceffc 100644 --- a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm +++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm @@ -199,7 +199,6 @@ QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent) } } - bool QT7MovieVideoWidget::createVisualContext() { #ifdef QUICKTIME_C_API_AVAILABLE @@ -210,8 +209,20 @@ bool QT7MovieVideoWidget::createVisualContext() NSOpenGLPixelFormat *nsglPixelFormat = [NSOpenGLView defaultPixelFormat]; CGLPixelFormatObj cglPixelFormat = static_cast<CGLPixelFormatObj>([nsglPixelFormat CGLPixelFormatObj]); - CFTypeRef keys[] = { kQTVisualContextWorkingColorSpaceKey }; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CFTypeRef keys[] = { kQTVisualContextOutputColorSpaceKey }; + CGColorSpaceRef colorSpace = NULL; + CMProfileRef sysprof = NULL; + + // Get the Systems Profile for the main display + if (CMGetSystemProfile(&sysprof) == noErr) { + // Create a colorspace with the systems profile + colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysprof); + CMCloseProfile(sysprof); + } + + if (!colorSpace) + colorSpace = CGColorSpaceCreateDeviceRGB(); + CFDictionaryRef textureContextAttributes = CFDictionaryCreate(kCFAllocatorDefault, (const void **)keys, (const void **)&colorSpace, 1, diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp index e27dd8d..8becbf3 100644 --- a/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp +++ b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp @@ -49,9 +49,9 @@ class QMultimediaQmlModule : public QDeclarativeExtensionPlugin { Q_OBJECT public: - virtual void initialize(QDeclarativeEngine *engine, const char *uri) + virtual void registerTypes(const char *uri) { - QtMultimedia::qRegisterDeclarativeElements(engine, uri); + QtMultimedia::qRegisterDeclarativeElements(uri); } }; diff --git a/src/plugins/qdeclarativemodules/widgets/widgets.cpp b/src/plugins/qdeclarativemodules/widgets/widgets.cpp index 7229d88..ec21cc4 100644 --- a/src/plugins/qdeclarativemodules/widgets/widgets.cpp +++ b/src/plugins/qdeclarativemodules/widgets/widgets.cpp @@ -114,15 +114,8 @@ class QWidgetsQmlModule : public QDeclarativeExtensionPlugin { Q_OBJECT public: - QStringList keys() const + virtual void registerTypes(const char *uri) { - return QStringList() << QLatin1String("Qt.widgets"); - } - - virtual void initialize(QDeclarativeEngine *engine, const char *uri) - { - Q_UNUSED(engine); - Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.widgets")); QML_REGISTER_INTERFACE(QGraphicsLayoutItem); diff --git a/src/qbase.pri b/src/qbase.pri index ef5d9e5..835ed0e 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -157,6 +157,7 @@ contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE DEFINES *= QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS contains(QT_CONFIG, qt3support):DEFINES *= QT3_SUPPORT DEFINES *= QT_MOC_COMPAT #we don't need warnings from calling moc code in our generated code +DEFINES *= QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp index 21383bd..8614076 100644 --- a/src/qt3support/text/q3richtext.cpp +++ b/src/qt3support/text/q3richtext.cpp @@ -6667,7 +6667,7 @@ Q3TextImage::Q3TextImage(Q3TextDocument *p, const QMap<QString, QString> &attr, imageName = attr[QLatin1String("source")]; if (!imageName.isEmpty()) { - imgId = QString::fromLatin1("%1,%2,%3,%4").arg(imageName).arg(width).arg(height).arg((ulong)&factory); + imgId = QString::fromLatin1("%1,%2,%3,%4").arg(imageName).arg(width).arg(height).arg((quintptr)&factory); if (!pixmap_map) pixmap_map = new QMap<QString, QPixmapInt>; if (pixmap_map->contains(imgId)) { diff --git a/src/qt3support/text/q3textedit.cpp b/src/qt3support/text/q3textedit.cpp index 7f51bea..d4f75ed 100644 --- a/src/qt3support/text/q3textedit.cpp +++ b/src/qt3support/text/q3textedit.cpp @@ -6238,7 +6238,7 @@ void Q3TextEdit::optimParseTags(QString * line, int lineNo, int indexOffset) } else { tmp = tagStack.isEmpty() ? 0 : tagStack.pop(); if (!tmp) { - if (((QLatin1Char('/') + cur->tag) == tag->tag) || + if ((QString(QLatin1Char('/') + cur->tag) == tag->tag) || (tag->tag == QLatin1String("/font") && cur->tag.left(4) == QLatin1String("font"))) { // set up the left and parent of this tag tag->leftTag = cur; diff --git a/src/qt3support/text/q3textstream.cpp b/src/qt3support/text/q3textstream.cpp index 41aab4d..8c86c7c 100644 --- a/src/qt3support/text/q3textstream.cpp +++ b/src/qt3support/text/q3textstream.cpp @@ -2084,7 +2084,7 @@ Q3TextStream &Q3TextStream::operator<<( void *ptr ) setf( hex, basefield ); setf( showbase ); unsetf( uppercase ); - output_int( I_LONG | I_UNSIGNED, (ulong)ptr, FALSE ); + output_int( I_LONG | I_UNSIGNED, (quintptr)ptr, FALSE ); flags( f ); return *this; } diff --git a/src/qt3support/tools/q3gcache.cpp b/src/qt3support/tools/q3gcache.cpp index a31f827..ada8330 100644 --- a/src/qt3support/tools/q3gcache.cpp +++ b/src/qt3support/tools/q3gcache.cpp @@ -226,7 +226,7 @@ public: bool remove_ascii(Q3CacheItem *item) { return Q3GDict::remove_ascii((const char *)item->key,item); } bool remove_int(Q3CacheItem *item) - { return Q3GDict::remove_int((long)item->key,item);} + { return Q3GDict::remove_int((quintptr)item->key,item);} void statistics() { Q3GDict::statistics(); } @@ -426,7 +426,7 @@ bool Q3GCache::insert_other(const char *key, Q3PtrCollection::Item data, if (keytype == AsciiKey) dict->insert_ascii(key, ci); else - dict->insert_int((long)key, ci); + dict->insert_int((quintptr)key, ci); tCost += cost; return true; } @@ -486,7 +486,7 @@ Q3PtrCollection::Item Q3GCache::take_other(const char *key) if (keytype == AsciiKey) ci = dict->take_ascii(key); else - ci = dict->take_int((long)key); + ci = dict->take_int((quintptr)key); Item d; if (ci) { d = ci->data; @@ -563,7 +563,7 @@ Q3PtrCollection::Item Q3GCache::find_string(const QString &key, bool ref) const Q3PtrCollection::Item Q3GCache::find_other(const char *key, bool ref) const { Q3CacheItem *ci = keytype == AsciiKey ? dict->find_ascii(key) - : dict->find_int((long)key); + : dict->find_int((quintptr)key); #if defined(QT_DEBUG) lruList->finds++; #endif @@ -811,7 +811,7 @@ const char *Q3GCacheIterator::getKeyAscii() const long Q3GCacheIterator::getKeyInt() const { Q3CacheItem *item = it->current(); - return item ? (long)item->key : 0; + return item ? (quintptr)item->key : 0; } /*! diff --git a/src/qt3support/tools/q3gdict.cpp b/src/qt3support/tools/q3gdict.cpp index a968407..e8144fe 100644 --- a/src/qt3support/tools/q3gdict.cpp +++ b/src/qt3support/tools/q3gdict.cpp @@ -437,7 +437,7 @@ Q3PtrCollection::Item Q3GDict::look_int(long key, Q3PtrCollection::Item d, int o Q3PtrCollection::Item Q3GDict::look_ptr(void *key, Q3PtrCollection::Item d, int op) { Q3PtrBucket *n; - int index = (int)((ulong)key % vlen); // simple hash + int index = (int)((quintptr)key % vlen); // simple hash if (op == op_find) { // find for (n=(Q3PtrBucket*)vec[index]; n; n=(Q3PtrBucket*)n->getNext()) { @@ -650,7 +650,7 @@ Q3PtrBucket *Q3GDict::unlink_ptr(void *key, Q3PtrCollection::Item d) return 0; Q3PtrBucket *n; Q3PtrBucket *prev = 0; - int index = (int)((ulong)key % vlen); + int index = (int)((quintptr)key % vlen); for (n=(Q3PtrBucket *)vec[index]; n; n=(Q3PtrBucket *)n->getNext()) { bool found = (n->getKey() == key); if (found && d) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 98a24d0..d2e96d1 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -844,7 +844,7 @@ static QScriptValue __setupPackage__(QScriptContext *ctx, QScriptEngine *eng) } // namespace QScript QScriptEnginePrivate::QScriptEnginePrivate() - : registeredScriptValues(0), freeScriptValues(0), + : registeredScriptValues(0), freeScriptValues(0), freeScriptValuesCount(0), registeredScriptStrings(0), inEval(false) { qMetaTypeId<QScriptValue>(); diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index f69e537..d0d020a 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -354,6 +354,8 @@ public: int agentLineNumber; QScriptValuePrivate *registeredScriptValues; QScriptValuePrivate *freeScriptValues; + static const int maxFreeScriptValues = 256; + int freeScriptValuesCount; QScriptStringPrivate *registeredScriptStrings; QHash<int, QScriptTypeInfo*> m_typeInfos; int processEventsInterval; @@ -521,6 +523,7 @@ inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(siz if (freeScriptValues) { QScriptValuePrivate *p = freeScriptValues; freeScriptValues = p->next; + --freeScriptValuesCount; return p; } return reinterpret_cast<QScriptValuePrivate*>(qMalloc(size)); @@ -528,8 +531,13 @@ inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(siz inline void QScriptEnginePrivate::freeScriptValuePrivate(QScriptValuePrivate *p) { - p->next = freeScriptValues; - freeScriptValues = p; + if (freeScriptValuesCount < maxFreeScriptValues) { + p->next = freeScriptValues; + freeScriptValues = p; + ++freeScriptValuesCount; + } else { + qFree(p); + } } inline void QScriptEnginePrivate::registerScriptValue(QScriptValuePrivate *value) @@ -854,7 +862,7 @@ inline bool QScriptEnginePrivate::isQObject(JSC::JSValue value) inline bool QScriptEnginePrivate::isQMetaObject(JSC::JSValue value) { #ifndef QT_NO_QOBJECT - return JSC::asObject(value)->inherits(&QScript::QMetaObjectWrapperObject::info); + return isObject(value) && JSC::asObject(value)->inherits(&QScript::QMetaObjectWrapperObject::info); #else return false; #endif diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index b5c85e6..de2be89 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -56,6 +56,12 @@ #include <qvector.h> #include <qdebug.h> +// This is needed for oracle oci when compiling with mingw-w64 headers +#if defined(__MINGW64_VERSION_MAJOR) && defined(_WIN64) +#define _int64 __int64 +#endif + + #include <oci.h> #ifdef max #undef max diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index fab3ab3..9f7d267 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE #define ODBC_CHECK_DRIVER // newer platform SDKs use SQLLEN instead of SQLINTEGER -#if defined(WIN32) && (_MSC_VER < 1300) +#if defined(WIN32) && (_MSC_VER < 1300) && !defined(__MINGW64_VERSION_MAJOR) # define QSQLLEN SQLINTEGER # define QSQLULEN SQLUINTEGER #else diff --git a/src/svg/qgraphicssvgitem.cpp b/src/svg/qgraphicssvgitem.cpp index 7e80e50..69ff7a3 100644 --- a/src/svg/qgraphicssvgitem.cpp +++ b/src/svg/qgraphicssvgitem.cpp @@ -267,6 +267,7 @@ int QGraphicsSvgItem::type() const /*! \property QGraphicsSvgItem::maximumCacheSize + \since 4.6 This property holds the maximum size of the device coordinate cache for this item. @@ -312,7 +313,8 @@ QSize QGraphicsSvgItem::maximumCacheSize() const /*! \property QGraphicsSvgItem::elementId - + \since 4.6 + This property holds the element's XML ID. */ |