diff options
Diffstat (limited to 'src')
121 files changed, 1170 insertions, 572 deletions
diff --git a/src/3rdparty/libpng/pngconf.h b/src/3rdparty/libpng/pngconf.h index 2a41a297e4..b02f2a0cd8 100644 --- a/src/3rdparty/libpng/pngconf.h +++ b/src/3rdparty/libpng/pngconf.h @@ -286,6 +286,11 @@ # endif # endif +/* Avoid exporting libpng symbols from Qt DLL on Windows */ +# if defined (_MSC_VER) && defined(PNG_IMPEXP) +# undef PNG_IMPEXP +# endif + # ifndef PNG_IMPEXP # define PNG_IMPEXP # endif diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h index ace1eea508..1035631e9a 100644 --- a/src/corelib/global/qconfig-minimal.h +++ b/src/corelib/global/qconfig-minimal.h @@ -324,9 +324,6 @@ #ifndef QT_NO_QWSEMBEDWIDGET # define QT_NO_QWSEMBEDWIDGET #endif -#ifndef QT_NO_QWS_ALPHA_CURSOR -# define QT_NO_QWS_ALPHA_CURSOR -#endif #ifndef QT_NO_QWS_CURSOR # define QT_NO_QWS_CURSOR #endif diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h index 18ae261809..5aefdfeee5 100644 --- a/src/corelib/global/qconfig-nacl.h +++ b/src/corelib/global/qconfig-nacl.h @@ -247,9 +247,6 @@ #ifndef QT_NO_QWSEMBEDWIDGET # define QT_NO_QWSEMBEDWIDGET #endif -#ifndef QT_NO_QWS_ALPHA_CURSOR -# define QT_NO_QWS_ALPHA_CURSOR -#endif #ifndef QT_NO_QWS_CURSOR # define QT_NO_QWS_CURSOR #endif diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index e0b8a8fb6d..64d5f08686 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -178,9 +178,6 @@ // QWSEmbedWidget //#define QT_NO_QWSEMBEDWIDGET -// Alpha Cursor -//#define QT_NO_QWS_ALPHA_CURSOR - // Decoration //#define QT_NO_QWS_DECORATION_DEFAULT diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 6b861d4d17..dea05e0ac1 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -1268,13 +1268,6 @@ Requires: CURSOR Name: Cursor SeeAlso: ??? -Feature: QWS_ALPHA_CURSOR -Description: Supports alpha-blended cursors. -Section: Qt for Embedded Linux -Requires: -Name: Alpha Cursor -SeeAlso: ??? - Feature: QWS_MANAGER Description: Supports the window manager. Section: Qt for Embedded Linux diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 4ba8e0675d..48b9358fe9 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1872,7 +1872,10 @@ QString QDir::currentPath() Under non-Windows operating systems the \c HOME environment variable is used if it exists, otherwise the path returned by the - rootPath(). On Symbian always the same as the path returned by the rootPath(). + rootPath(). + + On Symbian this typically returns "c:/data", + i.e. the same as native PathInfo::PhoneMemoryRootPath(). \sa home(), currentPath(), rootPath(), tempPath() */ @@ -1936,9 +1939,8 @@ QString QDir::tempPath() /*! Returns the absolute path of the root directory. - For Unix operating systems this returns "/". For Windows file - systems this normally returns "c:/". On Symbian this typically returns - "c:/data", i.e. the same as native PathInfo::PhoneMemoryRootPath(). + For Unix operating systems this returns "/". For Windows and Symbian file + systems this normally returns "c:/". I.E. the root of the system drive. \sa root(), drives(), currentPath(), homePath(), tempPath() */ diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 06c403a117..d08574d456 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -1332,6 +1332,13 @@ bool QFile::open(const RFile &f, OpenMode mode, FileHandleFlags handleFlags) This function is not supported on Windows CE. + On Symbian, this function returns -1 if the file was opened normally, + as Symbian OS native file handles do not fit in an int, and are + incompatible with C library functions that the handle would be used for. + If the file was opened using the overloads that take an open C library + file handle / file descriptor, then this function returns that same + handle. + \sa QSocketNotifier */ diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 031d64ba80..28a72672c6 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -692,7 +692,7 @@ bool QFileSystemEngine::fillPermissions(const QFileSystemEntry &entry, QFileSyst if (what & QFileSystemMetaData::UserWritePermission) { if (::_waccess((wchar_t*)entry.nativeFilePath().utf16(), W_OK) == 0) data.entryFlags |= QFileSystemMetaData::UserWritePermission; - data.knownFlagsMask |= QFileSystemMetaData::UserReadPermission; + data.knownFlagsMask |= QFileSystemMetaData::UserWritePermission; } } @@ -1094,7 +1094,6 @@ QFileSystemEntry QFileSystemEngine::currentPath() if (ret.length() >= 2 && ret[1] == QLatin1Char(':')) ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters. #else - Q_UNUSED(fileName); //TODO - a race condition exists when using currentPath / setCurrentPath from multiple threads if (qfsPrivateCurrentDir.isEmpty()) qfsPrivateCurrentDir = QCoreApplication::applicationDirPath(); diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp index 63cc4f1ce6..fa857c61a9 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian.cpp +++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE QNotifyChangeEvent::QNotifyChangeEvent(RFs &fs, const TDesC &file, - QSymbianFileSystemWatcherEngine *e, bool aIsDir, + QSymbianFileSystemWatcherInterface *e, bool aIsDir, TInt aPriority) : CActive(aPriority), isDir(aIsDir), @@ -96,9 +96,9 @@ void QNotifyChangeEvent::RunL() if (!failureCount) { int err; - QT_TRYCATCH_ERROR(err, engine->emitPathChanged(this)); + QT_TRYCATCH_ERROR(err, engine->handlePathChanged(this)); if (err != KErrNone) - qWarning("QNotifyChangeEvent::RunL() - emitPathChanged threw exception (Converted error code: %d)", err); + qWarning("QNotifyChangeEvent::RunL() - handlePathChanged threw exception (Converted error code: %d)", err); } } } @@ -203,7 +203,7 @@ QStringList QSymbianFileSystemWatcherEngine::removePaths(const QStringList &path return p; } -void QSymbianFileSystemWatcherEngine::emitPathChanged(QNotifyChangeEvent *e) +void QSymbianFileSystemWatcherEngine::handlePathChanged(QNotifyChangeEvent *e) { QMutexLocker locker(&mutex); @@ -255,7 +255,7 @@ void QSymbianFileSystemWatcherEngine::addNativeListener(const QString &directory QMutexLocker locker(&mutex); QString nativeDir(QDir::toNativeSeparators(directoryPath)); TPtrC ptr(qt_QString2TPtrC(nativeDir)); - currentAddEvent = new QNotifyChangeEvent(qt_s60GetRFs(), ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive)); + currentAddEvent = q_check_ptr(new QNotifyChangeEvent(qt_s60GetRFs(), ptr, this, directoryPath.endsWith(QChar(L'/')))); syncCondition.wakeOne(); } diff --git a/src/corelib/io/qfilesystemwatcher_symbian_p.h b/src/corelib/io/qfilesystemwatcher_symbian_p.h index 0b317a062f..842df802c3 100644 --- a/src/corelib/io/qfilesystemwatcher_symbian_p.h +++ b/src/corelib/io/qfilesystemwatcher_symbian_p.h @@ -66,29 +66,35 @@ QT_BEGIN_NAMESPACE -class QSymbianFileSystemWatcherEngine; +class QSymbianFileSystemWatcherInterface; class QNotifyChangeEvent : public CActive { public: - QNotifyChangeEvent(RFs &fsSession, const TDesC &file, QSymbianFileSystemWatcherEngine *engine, + QNotifyChangeEvent(RFs &fsSession, const TDesC &file, QSymbianFileSystemWatcherInterface *engine, bool aIsDir, TInt aPriority = EPriorityStandard); ~QNotifyChangeEvent(); bool isDir; + TPath watchedPath; private: void RunL(); void DoCancel(); RFs &fsSession; - TPath watchedPath; - QSymbianFileSystemWatcherEngine *engine; + QSymbianFileSystemWatcherInterface *engine; int failureCount; }; -class QSymbianFileSystemWatcherEngine : public QFileSystemWatcherEngine +class QSymbianFileSystemWatcherInterface +{ +public: + virtual void handlePathChanged(QNotifyChangeEvent *e) = 0; +}; + +class QSymbianFileSystemWatcherEngine : public QFileSystemWatcherEngine, public QSymbianFileSystemWatcherInterface { Q_OBJECT @@ -111,7 +117,7 @@ public Q_SLOTS: private: friend class QNotifyChangeEvent; - void emitPathChanged(QNotifyChangeEvent *e); + void handlePathChanged(QNotifyChangeEvent *e); void startWatcher(); diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index e900663400..d70811c57d 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -2281,7 +2281,7 @@ QT_END_INCLUDE_NAMESPACE However, note that repeated calls to this function will recreate the list of environment variables, which is a non-trivial operation. - \note For new code, it is recommended to use QProcessEvironment::systemEnvironment() + \note For new code, it is recommended to use QProcessEnvironment::systemEnvironment() \sa QProcessEnvironment::systemEnvironment(), environment(), setEnvironment() */ diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 04acfb0362..4f953a7df1 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -45,6 +45,7 @@ #include "qcore_symbian_p.h" #include <string> #include <in_sock.h> +#include "qdebug.h" QT_BEGIN_NAMESPACE @@ -115,6 +116,23 @@ public: QS60RFsSession() { qt_symbian_throwIfError(iFs.Connect()); qt_symbian_throwIfError(iFs.ShareProtected()); + //BC with 4.7: create private path on system drive + TInt sysdrive = iFs.GetSystemDrive(); + TInt err = iFs.CreatePrivatePath(sysdrive); + if (err != KErrNone && err != KErrAlreadyExists) + qWarning("Failed to create private path on system drive."); + TFileName pfn = RProcess().FileName(); + TInt drive; + if (pfn.Length() > 0 && iFs.CharToDrive(pfn[0], drive) == KErrNone) { + //BC with 4.7: create private path on application drive (except rom or system drive which is done above) + if (drive != sysdrive && drive != EDriveZ) { + err = iFs.CreatePrivatePath(drive); + if (err != KErrNone && err != KErrAlreadyExists) + qWarning("Failed to create private path on application drive."); + } + //BC with 4.7: set working directory to same drive as application + iFs.SetSessionToPrivate(drive); + } } ~QS60RFsSession() { diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 752bbaa0dc..2eb68f7c8e 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1991,12 +1991,6 @@ QString QCoreApplication::applicationDirPath() appPath = qt_TDesC2QString(privatePath); appPath.prepend(QLatin1Char(':')).prepend(qDriveChar); - // Create the appPath if it doesn't exist. Non-existing appPath will cause - // Platform Security violations later on if the app doesn't have AllFiles capability. - err = fs.CreatePrivatePath(drive); - if (err != KErrNone) - qWarning("QCoreApplication::applicationDirPath: Failed to create private path."); - d->cachedApplicationDirPath = QFileInfo(appPath).path(); } #else @@ -2335,6 +2329,33 @@ QString QCoreApplication::applicationVersion() #ifndef QT_NO_LIBRARY +#if defined(Q_OS_SYMBIAN) +void qt_symbian_installLibraryPaths(QString installPathPlugins, QStringList& libPaths) +{ + // Add existing path on all drives for relative PluginsPath in Symbian + QString tempPath = installPathPlugins; + if (tempPath.at(tempPath.length() - 1) != QDir::separator()) { + tempPath += QDir::separator(); + } + RFs& fs = qt_s60GetRFs(); + TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData())); + // Symbian searches should start from Y:. Fix start drive otherwise TFindFile starts from the session drive + _LIT(KStartDir, "Y:"); + TFileName dirPath(KStartDir); + dirPath.Append(tempPathPtr); + TFindFile finder(fs); + TInt err = finder.FindByDir(tempPathPtr, dirPath); + while (err == KErrNone) { + QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()), + finder.File().Length()); + foundDir = QDir(foundDir).canonicalPath(); + if (!libPaths.contains(foundDir)) + libPaths.append(foundDir); + err = finder.Find(); + } +} +#endif + Q_GLOBAL_STATIC_WITH_ARGS(QMutex, libraryPathMutex, (QMutex::Recursive)) /*! @@ -2367,24 +2388,8 @@ QStringList QCoreApplication::libraryPaths() QStringList *app_libpaths = coreappdata()->app_libpaths = new QStringList; QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); #if defined(Q_OS_SYMBIAN) - // Add existing path on all drives for relative PluginsPath in Symbian if (installPathPlugins.at(1) != QChar(QLatin1Char(':'))) { - QString tempPath = installPathPlugins; - if (tempPath.at(tempPath.length() - 1) != QDir::separator()) { - tempPath += QDir::separator(); - } - RFs& fs = qt_s60GetRFs(); - TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData())); - TFindFile finder(fs); - TInt err = finder.FindByDir(tempPathPtr, tempPathPtr); - while (err == KErrNone) { - QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()), - finder.File().Length()); - foundDir = QDir(foundDir).canonicalPath(); - if (!app_libpaths->contains(foundDir)) - app_libpaths->append(foundDir); - err = finder.Find(); - } + qt_symbian_installLibraryPaths(installPathPlugins, *app_libpaths); } #else if (QFile::exists(installPathPlugins)) { @@ -2499,6 +2504,36 @@ void QCoreApplication::removeLibraryPath(const QString &path) QFactoryLoader::refreshAll(); } +#if defined(Q_OS_SYMBIAN) +void QCoreApplicationPrivate::rebuildInstallLibraryPaths() +{ + // check there is not a single fixed install path + QString nativeInstallPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); + if (nativeInstallPathPlugins.at(1) == QChar(QLatin1Char(':'))) + return; + QString installPathPlugins = QDir::cleanPath(nativeInstallPathPlugins); + // look for the install path at the drive roots + installPathPlugins.prepend(QChar(QLatin1Char(':'))); + + QMutexLocker locker(libraryPathMutex()); + QStringList &app_libpaths = *coreappdata()->app_libpaths; + // Build a new library path, copying non-installPath components, and replacing existing install path with new + QStringList newPaths; + bool installPathFound = false; + foreach (QString path, app_libpaths) { + if (path.mid(1).compare(installPathPlugins, Qt::CaseInsensitive) == 0) { + // skip existing install paths, insert new install path when we find the first + if (!installPathFound) + qt_symbian_installLibraryPaths(nativeInstallPathPlugins, newPaths); + installPathFound = true; + } else { + newPaths.append(path); + } + } + app_libpaths = newPaths; +} +#endif + #endif //QT_NO_LIBRARY /*! diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index c6c6489a51..6f75da309d 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -126,6 +126,9 @@ public: void symbianInit(); # endif static CApaCommandLine* symbianCommandLine(); +#ifndef QT_NO_LIBRARY + static void rebuildInstallLibraryPaths(); +#endif #endif static bool isTranslatorInstalled(QTranslator *translator); diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 281367b567..f1a04071f4 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -209,8 +209,8 @@ public: // last event id used = 132 #ifdef QT_KEYPAD_NAVIGATION - EnterEditFocus = 150, // enter edit mode in keypad navigation - LeaveEditFocus = 151, // enter edit mode in keypad navigation + EnterEditFocus = 150, // enter edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION) + LeaveEditFocus = 151, // leave edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION) #endif AcceptDropsChange = 152, diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 67dbadb1a5..5d6e4d7db2 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3002,7 +3002,7 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, } const void *cbdata[] = { sender, signal.mobj ? signalSignature.constData() : 0, receiver, method.mobj ? methodSignature.constData() : 0 }; - if (QInternal::activateCallbacks(QInternal::ConnectCallback, (void **) cbdata)) + if (QInternal::activateCallbacks(QInternal::DisconnectCallback, (void **) cbdata)) return true; } diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index c8831e5ae5..24b4be0e8a 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -50,8 +50,13 @@ #include "qmutex.h" #include "qplugin.h" #include "qpluginloader.h" +#include "qlibraryinfo.h" #include "private/qobject_p.h" #include "private/qcoreapplication_p.h" +#ifdef Q_OS_SYMBIAN +#include "private/qcore_symbian_p.h" +#include "private/qfilesystemwatcher_symbian_p.h" +#endif QT_BEGIN_NAMESPACE @@ -59,6 +64,23 @@ Q_GLOBAL_STATIC(QList<QFactoryLoader *>, qt_factory_loaders) Q_GLOBAL_STATIC_WITH_ARGS(QMutex, qt_factoryloader_mutex, (QMutex::Recursive)) +#ifdef Q_OS_SYMBIAN +class QSymbianSystemPluginWatcher : public QSymbianFileSystemWatcherInterface +{ +public: + QSymbianSystemPluginWatcher(); + ~QSymbianSystemPluginWatcher(); + + void watchForUpdates(); + void handlePathChanged(QNotifyChangeEvent *e); + + QList<QNotifyChangeEvent*> watchers; + TDriveList drives; +}; + +Q_GLOBAL_STATIC(QSymbianSystemPluginWatcher, qt_symbian_system_plugin_watcher) +#endif + class QFactoryLoaderPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QFactoryLoader) @@ -98,102 +120,117 @@ QFactoryLoader::QFactoryLoader(const char *iid, QMutexLocker locker(qt_factoryloader_mutex()); update(); qt_factory_loaders()->append(this); +#ifdef Q_OS_SYMBIAN + // kick off Symbian plugin watcher for updates + qt_symbian_system_plugin_watcher(); +#endif } - -void QFactoryLoader::update() +void QFactoryLoader::updateDir(const QString &pluginDir, QSettings& settings) { -#ifdef QT_SHARED Q_D(QFactoryLoader); - QStringList paths = QCoreApplication::libraryPaths(); - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - for (int i = 0; i < paths.count(); ++i) { - const QString &pluginDir = paths.at(i); - // Already loaded, skip it... - if (d->loadedPaths.contains(pluginDir)) - continue; - d->loadedPaths << pluginDir; + QString path = pluginDir + d->suffix; + if (!QDir(path).exists(QLatin1String("."))) + return; - QString path = pluginDir + d->suffix; - if (!QDir(path).exists(QLatin1String("."))) - continue; + QStringList plugins = QDir(path).entryList(QDir::Files); + QLibraryPrivate *library = 0; + for (int j = 0; j < plugins.count(); ++j) { + QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j)); - QStringList plugins = QDir(path).entryList(QDir::Files); - QLibraryPrivate *library = 0; - for (int j = 0; j < plugins.count(); ++j) { - QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j)); + if (qt_debug_component()) { + qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName; + } + library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath()); + if (!library->isPlugin(&settings)) { if (qt_debug_component()) { - qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName; + qDebug() << library->errorString; + qDebug() << " not a plugin"; } - library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath()); - if (!library->isPlugin(&settings)) { + library->release(); + continue; + } + QString regkey = QString::fromLatin1("Qt Factory Cache %1.%2/%3:/%4") + .arg((QT_VERSION & 0xff0000) >> 16) + .arg((QT_VERSION & 0xff00) >> 8) + .arg(QLatin1String(d->iid)) + .arg(fileName); + QStringList reg, keys; + reg = settings.value(regkey).toStringList(); + if (reg.count() && library->lastModified == reg[0]) { + keys = reg; + keys.removeFirst(); + } else { + if (!library->loadPlugin()) { if (qt_debug_component()) { qDebug() << library->errorString; - qDebug() << " not a plugin"; + qDebug() << " could not load"; } library->release(); continue; } - QString regkey = QString::fromLatin1("Qt Factory Cache %1.%2/%3:/%4") - .arg((QT_VERSION & 0xff0000) >> 16) - .arg((QT_VERSION & 0xff00) >> 8) - .arg(QLatin1String(d->iid)) - .arg(fileName); - QStringList reg, keys; - reg = settings.value(regkey).toStringList(); - if (reg.count() && library->lastModified == reg[0]) { - keys = reg; - keys.removeFirst(); - } else { - if (!library->loadPlugin()) { - if (qt_debug_component()) { - qDebug() << library->errorString; - qDebug() << " could not load"; - } - library->release(); - continue; - } - QObject *instance = library->instance(); - if (!instance) { - library->release(); - // ignore plugins that have a valid signature but cannot be loaded. - continue; - } - QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance); - if (instance && factory && instance->qt_metacast(d->iid)) - keys = factory->keys(); - if (keys.isEmpty()) - library->unload(); - reg.clear(); - reg << library->lastModified; - reg += keys; - settings.setValue(regkey, reg); - } - if (qt_debug_component()) { - qDebug() << "keys" << keys; - } - - if (keys.isEmpty()) { + QObject *instance = library->instance(); + if (!instance) { library->release(); + // ignore plugins that have a valid signature but cannot be loaded. continue; } - d->libraryList += library; - for (int k = 0; k < keys.count(); ++k) { - // first come first serve, unless the first - // library was built with a future Qt version, - // whereas the new one has a Qt version that fits - // better - QString key = keys.at(k); - if (!d->cs) - key = key.toLower(); - QLibraryPrivate *previous = d->keyMap.value(key); - if (!previous || (previous->qt_version > QT_VERSION && library->qt_version <= QT_VERSION)) { - d->keyMap[key] = library; - d->keyList += keys.at(k); - } + QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance); + if (instance && factory && instance->qt_metacast(d->iid)) + keys = factory->keys(); + if (keys.isEmpty()) + library->unload(); + reg.clear(); + reg << library->lastModified; + reg += keys; + settings.setValue(regkey, reg); + } + if (qt_debug_component()) { + qDebug() << "keys" << keys; + } + + if (keys.isEmpty()) { + library->release(); + continue; + } + + int keysUsed = 0; + for (int k = 0; k < keys.count(); ++k) { + // first come first serve, unless the first + // library was built with a future Qt version, + // whereas the new one has a Qt version that fits + // better + QString key = keys.at(k); + if (!d->cs) + key = key.toLower(); + QLibraryPrivate *previous = d->keyMap.value(key); + if (!previous || (previous->qt_version > QT_VERSION && library->qt_version <= QT_VERSION)) { + d->keyMap[key] = library; + d->keyList += keys.at(k); + keysUsed++; } } + if (keysUsed) + d->libraryList += library; + else + library->release(); + } +} + +void QFactoryLoader::update() +{ +#ifdef QT_SHARED + Q_D(QFactoryLoader); + QStringList paths = QCoreApplication::libraryPaths(); + QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); + for (int i = 0; i < paths.count(); ++i) { + const QString &pluginDir = paths.at(i); + // Already loaded, skip it... + if (d->loadedPaths.contains(pluginDir)) + continue; + d->loadedPaths << pluginDir; + updateDir(pluginDir, settings); } #else Q_D(QFactoryLoader); @@ -264,6 +301,56 @@ void QFactoryLoader::refreshAll() } } +#ifdef Q_OS_SYMBIAN +QSymbianSystemPluginWatcher::QSymbianSystemPluginWatcher() +{ + qt_s60GetRFs().DriveList(drives); + watchForUpdates(); +} + +QSymbianSystemPluginWatcher::~QSymbianSystemPluginWatcher() +{ + qDeleteAll(watchers); +} + +void QSymbianSystemPluginWatcher::watchForUpdates() +{ + QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); + if (installPathPlugins.at(1) == QChar(QLatin1Char(':'))) + return; + + installPathPlugins.prepend(QLatin1String("?:")); + installPathPlugins = QDir::toNativeSeparators(installPathPlugins); + RFs& fs = qt_s60GetRFs(); + for (int i=0; i<KMaxDrives; i++) { + int attr = drives[i]; + if ((attr & KDriveAttLocal) && !(attr & KDriveAttRom)) { + // start new watcher + TChar driveLetter; + fs.DriveToChar(i, driveLetter); + installPathPlugins[0] = driveLetter; + TPtrC ptr(qt_QString2TPtrC(installPathPlugins)); + QNotifyChangeEvent *event = q_check_ptr(new QNotifyChangeEvent(fs, ptr, this, true)); + watchers.push_back(event); + } + } +} + +void QSymbianSystemPluginWatcher::handlePathChanged(QNotifyChangeEvent *e) +{ + QCoreApplicationPrivate::rebuildInstallLibraryPaths(); + QMutexLocker locker(qt_factoryloader_mutex()); + QString dirName(QDir::cleanPath(qt_TDesC2QString(e->watchedPath))); + QList<QFactoryLoader *> *loaders = qt_factory_loaders(); + for (QList<QFactoryLoader *>::const_iterator it = loaders->constBegin(); + it != loaders->constEnd(); ++it) { + QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); + (*it)->updateDir(dirName, settings); + } +} + +#endif + QT_END_NAMESPACE #endif // QT_NO_LIBRARY diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h index e90ebf66c3..8548ab2359 100644 --- a/src/corelib/plugin/qfactoryloader_p.h +++ b/src/corelib/plugin/qfactoryloader_p.h @@ -82,6 +82,7 @@ public: #endif void update(); + void updateDir(const QString &pluginDir, QSettings& settings); static void refreshAll(); }; diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index bbb64e42e7..9f9ea1a4ed 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -198,7 +198,7 @@ QPluginLoader::~QPluginLoader() */ QObject *QPluginLoader::instance() { - if (!isLoaded() && !load()) + if (!load()) return 0; if (!d->inst && d->instance) d->inst = d->instance(); diff --git a/src/corelib/statemachine/qfinalstate.cpp b/src/corelib/statemachine/qfinalstate.cpp index c583c32183..7d659848c3 100644 --- a/src/corelib/statemachine/qfinalstate.cpp +++ b/src/corelib/statemachine/qfinalstate.cpp @@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE machine.start(); \endcode - \sa QStateMachine::finished(), QState::finished() + \sa QState::finished() */ class QFinalStatePrivate : public QAbstractStatePrivate diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 9db7d1ae83..b296129173 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -1481,7 +1481,8 @@ static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion ucs4 = QChar::surrogateToUcs4(high, ucs4); } } - if (QChar::unicodeVersion(ucs4) > version) + QChar::UnicodeVersion v = QChar::unicodeVersion(ucs4); + if (v == QChar::Unicode_Unassigned || v > version) continue; int length; int tag; @@ -1541,7 +1542,7 @@ static ushort ligatureHelper(ushort u1, ushort u2) return 0; } -static void composeHelper(QString *str, int from) +static void composeHelper(QString *str, QChar::UnicodeVersion version, int from) { QString &s = *str; @@ -1561,7 +1562,14 @@ static void composeHelper(QString *str, int from) ++pos; } } - int combining = QChar::combiningClass(uc); + const QUnicodeTables::Properties *p = qGetProp(uc); + if (p->unicodeVersion == QChar::Unicode_Unassigned || p->unicodeVersion > version) { + starter = -1; // to prevent starter == pos - 1 + lastCombining = 0; + ++pos; + continue; + } + int combining = p->combiningClass; if (starter == pos - 1 || combining > lastCombining) { // allowed to form ligature with S QChar ligature = ligatureHelper(s.at(starter).unicode(), uc); @@ -1608,7 +1616,7 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in ushort c2 = 0; { const QUnicodeTables::Properties *p = qGetProp(u2); - if ((QChar::UnicodeVersion)p->unicodeVersion <= version) + if (p->unicodeVersion != QChar::Unicode_Unassigned && p->unicodeVersion <= version) c2 = p->combiningClass; } if (c2 == 0) { @@ -1619,7 +1627,7 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in ushort c1 = 0; { const QUnicodeTables::Properties *p = qGetProp(u1); - if ((QChar::UnicodeVersion)p->unicodeVersion <= version) + if (p->unicodeVersion != QChar::Unicode_Unassigned && p->unicodeVersion <= version) c1 = p->combiningClass; } diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp index 0f67652fb5..9c7c243f49 100644 --- a/src/corelib/tools/qline.cpp +++ b/src/corelib/tools/qline.cpp @@ -302,10 +302,15 @@ QDataStream &operator>>(QDataStream &stream, QLine &line) #endif // QT_NO_DATASTREAM +inline static qreal q_deg2rad(qreal x) +{ + return x * qreal(0.01745329251994329576923690768489); /* pi/180 */ +} -#ifndef M_2PI -#define M_2PI 6.28318530717958647692528676655900576 -#endif +inline static qreal q_rad2deg(qreal x) +{ + return x * qreal(57.295779513082320876798154814105); /* 180/pi */ +} /*! \class QLineF @@ -575,7 +580,7 @@ qreal QLineF::angle() const const qreal dx = pt2.x() - pt1.x(); const qreal dy = pt2.y() - pt1.y(); - const qreal theta = qAtan2(-dy, dx) * 360.0 / M_2PI; + const qreal theta = q_rad2deg(qAtan2(-dy, dx)); const qreal theta_normalized = theta < 0 ? theta + 360 : theta; @@ -599,7 +604,7 @@ qreal QLineF::angle() const */ void QLineF::setAngle(qreal angle) { - const qreal angleR = angle * M_2PI / 360.0; + const qreal angleR = q_deg2rad(angle); const qreal l = length(); const qreal dx = qCos(angleR) * l; @@ -621,7 +626,7 @@ void QLineF::setAngle(qreal angle) */ QLineF QLineF::fromPolar(qreal length, qreal angle) { - const qreal angleR = angle * M_2PI / 360.0; + const qreal angleR = q_deg2rad(angle); return QLineF(0, 0, qCos(angleR) * length, -qSin(angleR) * length); } @@ -815,8 +820,8 @@ qreal QLineF::angle(const QLineF &l) const qreal cos_line = (dx()*l.dx() + dy()*l.dy()) / (length()*l.length()); qreal rad = 0; // only accept cos_line in the range [-1,1], if it is outside, use 0 (we return 0 rather than PI for those cases) - if (cos_line >= -1.0 && cos_line <= 1.0) rad = qAcos( cos_line ); - return rad * 360 / M_2PI; + if (cos_line >= qreal(-1.0) && cos_line <= qreal(1.0)) rad = qAcos( cos_line ); + return q_rad2deg(rad); } diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index f5efe55ec7..934b6ad429 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -6367,7 +6367,7 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar:: if (mode == QString::NormalizationForm_D || mode == QString::NormalizationForm_KD) return; - composeHelper(data, from); + composeHelper(data, version, from); } diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 3134c79d98..c81968ee5d 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -5,13 +5,14 @@ SOURCES += \ $$PWD/qpacketprotocol.cpp \ $$PWD/qdeclarativedebugservice.cpp \ $$PWD/qdeclarativedebugclient.cpp \ - $$PWD/qdeclarativedebug.cpp \ + $$PWD/qdeclarativeenginedebug.cpp \ $$PWD/qdeclarativedebugtrace.cpp \ $$PWD/qdeclarativedebughelper.cpp \ $$PWD/qdeclarativedebugserver.cpp \ $$PWD/qdeclarativeinspectorservice.cpp \ $$PWD/qjsdebuggeragent.cpp \ - $$PWD/qjsdebugservice.cpp + $$PWD/qjsdebugservice.cpp \ + $$PWD/qdeclarativeenginedebugservice.cpp HEADERS += \ $$PWD/qdeclarativedebuggerstatus_p.h \ @@ -19,7 +20,7 @@ HEADERS += \ $$PWD/qdeclarativedebugservice_p.h \ $$PWD/qdeclarativedebugservice_p_p.h \ $$PWD/qdeclarativedebugclient_p.h \ - $$PWD/qdeclarativedebug_p.h \ + $$PWD/qdeclarativeenginedebug_p.h \ $$PWD/qdeclarativedebugtrace_p.h \ $$PWD/qdeclarativedebughelper_p.h \ $$PWD/qdeclarativedebugserver_p.h \ @@ -27,4 +28,6 @@ HEADERS += \ $$PWD/qdeclarativeinspectorservice_p.h \ $$PWD/qdeclarativeinspectorinterface_p.h \ $$PWD/qjsdebuggeragent_p.h \ - $$PWD/qjsdebugservice_p.h + $$PWD/qjsdebugservice_p.h \ + $$PWD/qdeclarativedebug.h \ + $$PWD/qdeclarativeenginedebugservice_p.h diff --git a/src/declarative/debugger/qdeclarativedebug.h b/src/declarative/debugger/qdeclarativedebug.h new file mode 100644 index 0000000000..b7930b21f0 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebug.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEDEBUG_H +#define QDECLARATIVEDEBUG_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +struct Q_DECLARATIVE_EXPORT QDeclarativeDebuggingEnabler +{ + QDeclarativeDebuggingEnabler(); +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +#if defined(QT_DECLARATIVE_DEBUG) +static QDeclarativeDebuggingEnabler qmlEnableDebuggingHelper; +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUG_H diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp index 12691b2777..3e0c3265f8 100644 --- a/src/declarative/debugger/qdeclarativedebugserver.cpp +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -91,6 +91,7 @@ public: QStringList clientPlugins; bool gotHello; QString waitingForMsgFromService; + bool waitingForMsgSucceeded; private: // private slot @@ -100,7 +101,8 @@ private: QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() : connection(0), - gotHello(false) + gotHello(false), + waitingForMsgSucceeded(false) { } @@ -315,7 +317,7 @@ void QDeclarativeDebugServer::receiveMessage(const QByteArray &message) if (d->waitingForMsgFromService == name) { // deliver directly so that it is delivered before waitForMessage is returning. d->_q_deliverMessage(name, message); - d->waitingForMsgFromService.clear(); + d->waitingForMsgSucceeded = true; } else { // deliver message in next event loop run. // Fixes the case that the service does start it's own event loop ..., @@ -409,7 +411,9 @@ bool QDeclarativeDebugServer::waitForMessage(QDeclarativeDebugService *service) do { d->connection->waitForMessage(); - } while (!d->waitingForMsgFromService.isEmpty()); + } while (!d->waitingForMsgSucceeded); + d->waitingForMsgSucceeded = false; + d->waitingForMsgFromService.clear(); return true; } diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativeenginedebug.cpp index 620ee1d66a..85ce7108dd 100644 --- a/src/declarative/debugger/qdeclarativedebug.cpp +++ b/src/declarative/debugger/qdeclarativeenginedebug.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "private/qdeclarativedebug_p.h" +#include "private/qdeclarativeenginedebug_p.h" #include "private/qdeclarativedebugclient_p.h" -#include <qdeclarativeenginedebug_p.h> +#include <qdeclarativeenginedebugservice_p.h> #include <private/qobject_p.h> @@ -207,7 +207,7 @@ void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclara void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugObjectReference &o, bool simple) { - QDeclarativeEngineDebugServer::QDeclarativeObjectData data; + QDeclarativeEngineDebugService::QDeclarativeObjectData data; ds >> data; o.m_debugId = data.objectId; o.m_class = data.objectType; @@ -234,7 +234,7 @@ void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugOb ds >> propCount; for (int ii = 0; ii < propCount; ++ii) { - QDeclarativeEngineDebugServer::QDeclarativeObjectProperty data; + QDeclarativeEngineDebugService::QDeclarativeObjectProperty data; ds >> data; QDeclarativeDebugPropertyReference prop; prop.m_objectDebugId = o.m_debugId; @@ -243,21 +243,21 @@ void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugOb prop.m_hasNotifySignal = data.hasNotifySignal; prop.m_valueTypeName = data.valueTypeName; switch (data.type) { - case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Basic: - case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::List: - case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::SignalProperty: + case QDeclarativeEngineDebugService::QDeclarativeObjectProperty::Basic: + case QDeclarativeEngineDebugService::QDeclarativeObjectProperty::List: + case QDeclarativeEngineDebugService::QDeclarativeObjectProperty::SignalProperty: { prop.m_value = data.value; break; } - case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Object: + case QDeclarativeEngineDebugService::QDeclarativeObjectProperty::Object: { QDeclarativeDebugObjectReference obj; obj.m_debugId = prop.m_value.toInt(); prop.m_value = QVariant::fromValue(obj); break; } - case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Unknown: + case QDeclarativeEngineDebugService::QDeclarativeObjectProperty::Unknown: break; } o.m_properties << prop; diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativeenginedebug_p.h index f822637eb4..9b70e1c6bc 100644 --- a/src/declarative/debugger/qdeclarativedebug_p.h +++ b/src/declarative/debugger/qdeclarativeenginedebug_p.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QDECLARATIVEDEBUG_H -#define QDECLARATIVEDEBUG_H +#ifndef QDECLARATIVEENGINEDEBUG_H +#define QDECLARATIVEENGINEDEBUG_H #include <QtCore/qobject.h> #include <QtCore/qurl.h> @@ -384,4 +384,4 @@ Q_DECLARE_METATYPE(QDeclarativeDebugPropertyReference) QT_END_HEADER -#endif // QDECLARATIVEDEBUG_H +#endif // QDECLARATIVEENGINEDEBUG_H diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/debugger/qdeclarativeenginedebugservice.cpp index 8707a7f33b..768373337f 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/debugger/qdeclarativeenginedebugservice.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "private/qdeclarativeenginedebug_p.h" +#include "private/qdeclarativeenginedebugservice_p.h" #include "private/qdeclarativeboundsignal_p.h" #include "qdeclarativeengine.h" @@ -59,14 +59,14 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer); +Q_GLOBAL_STATIC(QDeclarativeEngineDebugService, qmlEngineDebugService); -QDeclarativeEngineDebugServer *QDeclarativeEngineDebugServer::instance() +QDeclarativeEngineDebugService *QDeclarativeEngineDebugService::instance() { - return qmlEngineDebugServer(); + return qmlEngineDebugService(); } -QDeclarativeEngineDebugServer::QDeclarativeEngineDebugServer(QObject *parent) +QDeclarativeEngineDebugService::QDeclarativeEngineDebugService(QObject *parent) : QDeclarativeDebugService(QLatin1String("QDeclarativeEngine"), parent), m_watch(new QDeclarativeWatcher(this)) { @@ -75,7 +75,7 @@ QDeclarativeEngineDebugServer::QDeclarativeEngineDebugServer(QObject *parent) } QDataStream &operator<<(QDataStream &ds, - const QDeclarativeEngineDebugServer::QDeclarativeObjectData &data) + const QDeclarativeEngineDebugService::QDeclarativeObjectData &data) { ds << data.url << data.lineNumber << data.columnNumber << data.idString << data.objectName << data.objectType << data.objectId << data.contextId; @@ -83,7 +83,7 @@ QDataStream &operator<<(QDataStream &ds, } QDataStream &operator>>(QDataStream &ds, - QDeclarativeEngineDebugServer::QDeclarativeObjectData &data) + QDeclarativeEngineDebugService::QDeclarativeObjectData &data) { ds >> data.url >> data.lineNumber >> data.columnNumber >> data.idString >> data.objectName >> data.objectType >> data.objectId >> data.contextId; @@ -91,7 +91,7 @@ QDataStream &operator>>(QDataStream &ds, } QDataStream &operator<<(QDataStream &ds, - const QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &data) + const QDeclarativeEngineDebugService::QDeclarativeObjectProperty &data) { ds << (int)data.type << data.name << data.value << data.valueTypeName << data.binding << data.hasNotifySignal; @@ -99,12 +99,12 @@ QDataStream &operator<<(QDataStream &ds, } QDataStream &operator>>(QDataStream &ds, - QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &data) + QDeclarativeEngineDebugService::QDeclarativeObjectProperty &data) { int type; ds >> type >> data.name >> data.value >> data.valueTypeName >> data.binding >> data.hasNotifySignal; - data.type = (QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Type)type; + data.type = (QDeclarativeEngineDebugService::QDeclarativeObjectProperty::Type)type; return ds; } @@ -131,8 +131,8 @@ static bool hasValidSignal(QObject *object, const QString &propertyName) return true; } -QDeclarativeEngineDebugServer::QDeclarativeObjectProperty -QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) +QDeclarativeEngineDebugService::QDeclarativeObjectProperty +QDeclarativeEngineDebugService::propertyData(QObject *obj, int propIdx) { QDeclarativeObjectProperty rv; @@ -164,7 +164,7 @@ QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) return rv; } -QVariant QDeclarativeEngineDebugServer::valueContents(const QVariant &value) const +QVariant QDeclarativeEngineDebugService::valueContents(const QVariant &value) const { int userType = value.userType(); @@ -193,7 +193,7 @@ QVariant QDeclarativeEngineDebugServer::valueContents(const QVariant &value) con return QLatin1String("<unknown value>"); } -void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message, +void QDeclarativeEngineDebugService::buildObjectDump(QDataStream &message, QObject *object, bool recur, bool dumpProperties) { message << objectData(object); @@ -264,7 +264,7 @@ void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message, message << fakeProperties[ii]; } -void QDeclarativeEngineDebugServer::prepareDeferredObjects(QObject *obj) +void QDeclarativeEngineDebugService::prepareDeferredObjects(QObject *obj) { qmlExecuteDeferred(obj); @@ -276,7 +276,7 @@ void QDeclarativeEngineDebugServer::prepareDeferredObjects(QObject *obj) } -void QDeclarativeEngineDebugServer::buildObjectList(QDataStream &message, QDeclarativeContext *ctxt) +void QDeclarativeEngineDebugService::buildObjectList(QDataStream &message, QDeclarativeContext *ctxt) { QDeclarativeContextData *p = QDeclarativeContextData::get(ctxt); @@ -316,7 +316,7 @@ void QDeclarativeEngineDebugServer::buildObjectList(QDataStream &message, QDecla } } -void QDeclarativeEngineDebugServer::buildStatesList(QDeclarativeContext *ctxt, bool cleanList=false) +void QDeclarativeEngineDebugService::buildStatesList(QDeclarativeContext *ctxt, bool cleanList=false) { if (cleanList) m_allStates.clear(); @@ -333,7 +333,7 @@ void QDeclarativeEngineDebugServer::buildStatesList(QDeclarativeContext *ctxt, b } } -void QDeclarativeEngineDebugServer::buildStatesList(QObject *obj) +void QDeclarativeEngineDebugService::buildStatesList(QObject *obj) { if (QDeclarativeState *state = qobject_cast<QDeclarativeState *>(obj)) { m_allStates.append(state); @@ -345,8 +345,8 @@ void QDeclarativeEngineDebugServer::buildStatesList(QObject *obj) } } -QDeclarativeEngineDebugServer::QDeclarativeObjectData -QDeclarativeEngineDebugServer::objectData(QObject *object) +QDeclarativeEngineDebugService::QDeclarativeObjectData +QDeclarativeEngineDebugService::objectData(QObject *object) { QDeclarativeData *ddata = QDeclarativeData::get(object); QDeclarativeObjectData rv; @@ -385,7 +385,7 @@ QDeclarativeEngineDebugServer::objectData(QObject *object) return rv; } -void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) +void QDeclarativeEngineDebugService::messageReceived(const QByteArray &message) { QDataStream ds(message); @@ -545,7 +545,7 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) } } -void QDeclarativeEngineDebugServer::setBinding(int objectId, +void QDeclarativeEngineDebugService::setBinding(int objectId, const QString &propertyName, const QVariant &expression, bool isLiteralValue, @@ -600,7 +600,7 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, oldBinding->destroy(); binding->update(); } else { - qWarning() << "QDeclarativeEngineDebugServer::setBinding: unable to set property" << propertyName << "on object" << object; + qWarning() << "QDeclarativeEngineDebugService::setBinding: unable to set property" << propertyName << "on object" << object; } } @@ -613,13 +613,13 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, propertyChanges->changeExpression(propertyName, expression.toString()); } } else { - qWarning() << "QDeclarativeEngineDebugServer::setBinding: unable to set property" << propertyName << "on object" << object; + qWarning() << "QDeclarativeEngineDebugService::setBinding: unable to set property" << propertyName << "on object" << object; } } } } -void QDeclarativeEngineDebugServer::resetBinding(int objectId, const QString &propertyName) +void QDeclarativeEngineDebugService::resetBinding(int objectId, const QString &propertyName) { QObject *object = objectForId(objectId); QDeclarativeContext *context = qmlContext(object); @@ -664,7 +664,7 @@ void QDeclarativeEngineDebugServer::resetBinding(int objectId, const QString &pr } } -void QDeclarativeEngineDebugServer::setMethodBody(int objectId, const QString &method, const QString &body) +void QDeclarativeEngineDebugService::setMethodBody(int objectId, const QString &method, const QString &body) { QObject *object = objectForId(objectId); QDeclarativeContext *context = qmlContext(object); @@ -703,7 +703,7 @@ void QDeclarativeEngineDebugServer::setMethodBody(int objectId, const QString &m vmeMetaObject->setVmeMethod(prop->coreIndex, QDeclarativeExpressionPrivate::evalInObjectScope(contextData, object, jsfunction, contextData->url.toString(), lineNumber, 0)); } -void QDeclarativeEngineDebugServer::propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value) +void QDeclarativeEngineDebugService::propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value) { QByteArray reply; QDataStream rs(&reply, QIODevice::WriteOnly); @@ -713,7 +713,7 @@ void QDeclarativeEngineDebugServer::propertyChanged(int id, int objectId, const sendMessage(reply); } -void QDeclarativeEngineDebugServer::addEngine(QDeclarativeEngine *engine) +void QDeclarativeEngineDebugService::addEngine(QDeclarativeEngine *engine) { Q_ASSERT(engine); Q_ASSERT(!m_engines.contains(engine)); @@ -721,7 +721,7 @@ void QDeclarativeEngineDebugServer::addEngine(QDeclarativeEngine *engine) m_engines.append(engine); } -void QDeclarativeEngineDebugServer::remEngine(QDeclarativeEngine *engine) +void QDeclarativeEngineDebugService::remEngine(QDeclarativeEngine *engine) { Q_ASSERT(engine); Q_ASSERT(m_engines.contains(engine)); @@ -729,7 +729,7 @@ void QDeclarativeEngineDebugServer::remEngine(QDeclarativeEngine *engine) m_engines.removeAll(engine); } -void QDeclarativeEngineDebugServer::objectCreated(QDeclarativeEngine *engine, QObject *object) +void QDeclarativeEngineDebugService::objectCreated(QDeclarativeEngine *engine, QObject *object) { Q_ASSERT(engine); Q_ASSERT(m_engines.contains(engine)); diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/debugger/qdeclarativeenginedebugservice_p.h index 804a043635..3674b83fe7 100644 --- a/src/declarative/qml/qdeclarativeenginedebug_p.h +++ b/src/declarative/debugger/qdeclarativeenginedebugservice_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QDECLARATIVEENGINEDEBUG_P_H -#define QDECLARATIVEENGINEDEBUG_P_H +#ifndef QDECLARATIVEENGINEDEBUGSERVICE_P_H +#define QDECLARATIVEENGINEDEBUGSERVICE_P_H // // W A R N I N G @@ -67,11 +67,11 @@ class QDeclarativeWatcher; class QDataStream; class QDeclarativeState; -class QDeclarativeEngineDebugServer : public QDeclarativeDebugService +class QDeclarativeEngineDebugService : public QDeclarativeDebugService { Q_OBJECT public: - QDeclarativeEngineDebugServer(QObject * = 0); + QDeclarativeEngineDebugService(QObject * = 0); struct QDeclarativeObjectData { QUrl url; @@ -98,7 +98,7 @@ public: void remEngine(QDeclarativeEngine *); void objectCreated(QDeclarativeEngine *, QObject *); - static QDeclarativeEngineDebugServer *instance(); + static QDeclarativeEngineDebugService *instance(); protected: virtual void messageReceived(const QByteArray &); @@ -123,12 +123,12 @@ private: QDeclarativeWatcher *m_watch; QList<QWeakPointer<QDeclarativeState> > m_allStates; }; -Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugServer::QDeclarativeObjectData &); -Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &, QDeclarativeEngineDebugServer::QDeclarativeObjectData &); -Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &); -Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &, QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &); +Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugService::QDeclarativeObjectData &); +Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &, QDeclarativeEngineDebugService::QDeclarativeObjectData &); +Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugService::QDeclarativeObjectProperty &); +Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &, QDeclarativeEngineDebugService::QDeclarativeObjectProperty &); QT_END_NAMESPACE -#endif // QDECLARATIVEENGINEDEBUG_P_H +#endif // QDECLARATIVEENGINEDEBUGSERVICE_P_H diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index 70fc702bee..4dcf17cfbc 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -228,9 +228,9 @@ void QDeclarativeFlipablePrivate::updateSceneTransformFromParent() if (current == QDeclarativeFlipable::Back && back) setBackTransform(); if (front) - front->setOpacity((current==QDeclarativeFlipable::Front)?1.:0.); + front->setOpacity((current==QDeclarativeFlipable::Front)?qreal(1.):qreal(0.)); if (back) - back->setOpacity((current==QDeclarativeFlipable::Back)?1.:0.); + back->setOpacity((current==QDeclarativeFlipable::Back)?qreal(1.):qreal(0.)); emit q->sideChanged(); } } diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 023737d0d0..a7d593a6b2 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1212,10 +1212,10 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m } qreal accel = deceleration; qreal v2 = v * v; - qreal overshootDist = 0.0; - if ((maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeGridView::SnapOneRow) { + qreal overshootDist = qreal(0.0); + if ((maxDistance > qreal(0.0) && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeGridView::SnapOneRow) { // + rowSize()/4 to encourage moving at least one item in the flick direction - qreal dist = v2 / (accel * 2.0) + rowSize()/4; + qreal dist = v2 / (accel * qreal(2.0)) + rowSize()/4; dist = qMin(dist, maxDistance); if (v > 0) dist = -dist; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 6a91e5fe9d..44d6a1a7f4 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1457,14 +1457,14 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m // the initial flick - estimate boundary qreal accel = deceleration; qreal v2 = v * v; - overshootDist = 0.0; + overshootDist = qreal(0.0); // + averageSize/4 to encourage moving at least one item in the flick direction - qreal dist = v2 / (accel * 2.0) + averageSize/4; + qreal dist = v2 / (accel * qreal(2.0)) + averageSize/4; if (maxDistance > 0) dist = qMin(dist, maxDistance); if (v > 0) dist = -dist; - if ((maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeListView::SnapOneItem) { + if ((maxDistance > qreal(0.0) && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeListView::SnapOneItem) { if (snapMode != QDeclarativeListView::SnapOneItem) { qreal distTemp = isRightToLeft() ? -dist : dist; data.flickTarget = -snapPosAt(-(dataValue - highlightStart) + distTemp) + highlightStart; diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 94f128dca8..ecd8982a96 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -246,7 +246,7 @@ void QDeclarativePathViewPrivate::updateHighlight() } else { qreal target = currentIndex; - offsetAdj = 0.0; + offsetAdj = qreal(0.0); tl.reset(moveHighlight); moveHighlight.setValue(highlightPosition); @@ -255,14 +255,14 @@ void QDeclarativePathViewPrivate::updateHighlight() if (target - highlightPosition > modelCount/2) { highlightUp = false; qreal distance = modelCount - target + highlightPosition; - tl.move(moveHighlight, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * highlightPosition / distance)); - tl.set(moveHighlight, modelCount-0.01); + tl.move(moveHighlight, qreal(0.0), QEasingCurve(QEasingCurve::InQuad), int(duration * highlightPosition / distance)); + tl.set(moveHighlight, modelCount-qreal(0.01)); tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * (modelCount-target) / distance)); } else if (target - highlightPosition <= -modelCount/2) { highlightUp = true; qreal distance = modelCount - highlightPosition + target; - tl.move(moveHighlight, modelCount-0.01, QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-highlightPosition) / distance)); - tl.set(moveHighlight, 0.0); + tl.move(moveHighlight, modelCount-qreal(0.01), QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-highlightPosition) / distance)); + tl.set(moveHighlight, qreal(0.0)); tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * target / distance)); } else { highlightUp = highlightPosition - target < 0; @@ -287,18 +287,18 @@ void QDeclarativePathViewPrivate::setHighlightPosition(qreal pos) qreal relativeHighlight = qmlMod(pos + offset, range) / range; if (!highlightUp && relativeHighlight > end * mappedRange) { - qreal diff = 1.0 - relativeHighlight; + qreal diff = qreal(1.0) - relativeHighlight; setOffset(offset + diff * range); } else if (highlightUp && relativeHighlight >= (end - start) * mappedRange) { qreal diff = relativeHighlight - (end - start) * mappedRange; - setOffset(offset - diff * range - 0.00001); + setOffset(offset - diff * range - qreal(0.00001)); } highlightPosition = pos; qreal pathPos = positionOfIndex(pos); updateItem(highlightItem, pathPos); if (QDeclarativePathViewAttached *att = attached(highlightItem)) - att->setOnPath(pathPos != -1.0); + att->setOnPath(pathPos != qreal(-1.0)); } } @@ -1200,7 +1200,7 @@ void QDeclarativePathViewPrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEve qreal elapsed = qreal(lastElapsed + QDeclarativeItemPrivate::elapsed(lastPosTime)) / 1000.; qreal velocity = elapsed > 0. ? lastDist / elapsed : 0; - if (model && modelCount && qAbs(velocity) > 1.) { + if (model && modelCount && qAbs(velocity) > qreal(1.)) { qreal count = pathItems == -1 ? modelCount : pathItems; if (qAbs(velocity) > count * 2) // limit velocity velocity = (velocity > 0 ? count : -count) * 2; @@ -1208,7 +1208,7 @@ void QDeclarativePathViewPrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEve qreal v2 = velocity*velocity; qreal accel = deceleration/10; // + 0.25 to encourage moving at least one item in the flick direction - qreal dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0) + 0.25)); + qreal dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * qreal(2.0)) + qreal(0.25))); if (haveHighlightRange && highlightRangeMode == QDeclarativePathView::StrictlyEnforceRange) { // round to nearest item. if (velocity > 0.) @@ -1217,13 +1217,13 @@ void QDeclarativePathViewPrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEve dist = qRound(dist - offset) + offset; // Calculate accel required to stop on item boundary if (dist <= 0.) { - dist = 0.; - accel = 0.; + dist = qreal(0.); + accel = qreal(0.); } else { accel = v2 / (2.0f * qAbs(dist)); } } - offsetAdj = 0.0; + offsetAdj = qreal(0.0); moveOffset.setValue(offset); tl.accel(moveOffset, velocity, accel, dist); tl.callback(QDeclarativeTimeLineCallback(&moveOffset, fixOffsetCallback, this)); @@ -1588,7 +1588,7 @@ void QDeclarativePathView::createdItem(int index, QDeclarativeItem *item) att->setOnPath(false); } item->setParentItem(this); - d->updateItem(item, index < d->firstIndex ? 0.0 : 1.0); + d->updateItem(item, index < d->firstIndex ? qreal(0.0) : qreal(1.0)); } } diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h index 5e8d0f45d2..399c20709b 100644 --- a/src/declarative/qml/qdeclarative.h +++ b/src/declarative/qml/qdeclarative.h @@ -405,17 +405,6 @@ QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true) return qmlAttachedPropertiesObject(&idx, obj, &T::staticMetaObject, create); } -// Enable debugging before any QDeclarativeEngine is created -struct Q_DECLARATIVE_EXPORT QDeclarativeDebuggingEnabler -{ - QDeclarativeDebuggingEnabler(); -}; - -// Execute code in constructor before first QDeclarativeEngine is instantiated -#if defined(QT_DECLARATIVE_DEBUG) -static QDeclarativeDebuggingEnabler qmlEnableDebuggingHelper; -#endif - QT_END_NAMESPACE QML_DECLARE_TYPE(QObject) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index d9f291ba64..f423f500de 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -53,7 +53,7 @@ #include "private/qdeclarativeglobal_p.h" #include "private/qdeclarativescriptparser_p.h" #include "private/qdeclarativedebugtrace_p.h" -#include "private/qdeclarativeenginedebug_p.h" +#include "private/qdeclarativeenginedebugservice_p.h" #include <QtScript/qscriptvalueiterator.h> #include <QStack> @@ -896,7 +896,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon if (enginePriv->isDebugging && rv) { if (!parentContext->isInternal) parentContext->asQDeclarativeContextPrivate()->instances.append(rv); - QDeclarativeEngineDebugServer::instance()->objectCreated(parentContext->engine, rv); + QDeclarativeEngineDebugService::instance()->objectCreated(parentContext->engine, rv); } return rv; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 34014f7166..1417b784eb 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -51,7 +51,7 @@ #include "qdeclarativecomponent.h" #include "private/qdeclarativebinding_p_p.h" #include "private/qdeclarativevme_p.h" -#include "private/qdeclarativeenginedebug_p.h" +#include "private/qdeclarativeenginedebugservice_p.h" #include "private/qdeclarativestringconverters_p.h" #include "private/qdeclarativexmlhttprequest_p.h" #include "private/qdeclarativesqldatabase_p.h" @@ -581,9 +581,9 @@ void QDeclarativeEnginePrivate::init() scriptEngine.globalObject().property(QLatin1String("Qt")).setProperty(QLatin1String("application"), applicationObject); if (QCoreApplication::instance()->thread() == q->thread() && - QDeclarativeEngineDebugServer::isDebuggingEnabled()) { + QDeclarativeEngineDebugService::isDebuggingEnabled()) { isDebugging = true; - QDeclarativeEngineDebugServer::instance()->addEngine(q); + QDeclarativeEngineDebugService::instance()->addEngine(q); QJSDebugService::instance()->addEngine(q); } } @@ -648,7 +648,7 @@ QDeclarativeEngine::~QDeclarativeEngine() { Q_D(QDeclarativeEngine); if (d->isDebugging) { - QDeclarativeEngineDebugServer::instance()->remEngine(this); + QDeclarativeEngineDebugService::instance()->remEngine(this); QJSDebugService::instance()->removeEngine(this); } } diff --git a/src/declarative/qml/qdeclarativeengine.h b/src/declarative/qml/qdeclarativeengine.h index 61ab2b2c63..4d6887f499 100644 --- a/src/declarative/qml/qdeclarativeengine.h +++ b/src/declarative/qml/qdeclarativeengine.h @@ -47,6 +47,7 @@ #include <QtCore/qmap.h> #include <QtScript/qscriptvalue.h> #include <QtDeclarative/qdeclarativeerror.h> +#include <QtDeclarative/qdeclarativedebug.h> QT_BEGIN_HEADER diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index bf261ef242..c2f00865ef 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -46,6 +46,7 @@ #include <QtCore/qfileinfo.h> #include <QtCore/qpluginloader.h> #include <QtCore/qlibraryinfo.h> +#include <QtCore/qalgorithms.h> #include <QtDeclarative/qdeclarativeextensioninterface.h> #include <private/qdeclarativeglobal_p.h> #include <private/qdeclarativetypenamecache_p.h> @@ -734,8 +735,12 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e) } RFs& fs = qt_s60GetRFs(); TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData())); + // Symbian searches should start from Y:. Fix start drive otherwise TFindFile starts from the session drive + _LIT(KStartDir, "Y:"); + TFileName dirPath(KStartDir); + dirPath.Append(tempPathPtr); TFindFile finder(fs); - TInt err = finder.FindByDir(tempPathPtr, tempPathPtr); + TInt err = finder.FindByDir(tempPathPtr, dirPath); while (err == KErrNone) { QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()), finder.File().Length()); @@ -743,6 +748,9 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e) addImportPath(foundDir); err = finder.Find(); } + // TFindFile found the directories in the order we want, but addImportPath reverses it. + // Reverse the order again to get it right. + QAlgorithmsPrivate::qReverse(fileImportPath.begin(), fileImportPath.end()); } else { addImportPath(installImportsPath); } diff --git a/src/declarative/qml/qdeclarativenotifier_p.h b/src/declarative/qml/qdeclarativenotifier_p.h index 5f70f7d138..14a7f82c14 100644 --- a/src/declarative/qml/qdeclarativenotifier_p.h +++ b/src/declarative/qml/qdeclarativenotifier_p.h @@ -99,8 +99,15 @@ private: enum { InvalidType, SignalType, NotifierType } type; union { - char signalData[sizeof(Signal)]; - char notifierData[sizeof(Notifier)]; + struct { + Signal *signal; + union { + char signalData[sizeof(Signal)]; + qint64 q_for_alignment_1; + double q_for_alignment_2; + }; + } signal; + Notifier notifier; }; inline Notifier *toNotifier(); @@ -194,7 +201,7 @@ void QDeclarativeNotifierEndpoint::connect(QDeclarativeNotifier *notifier) void QDeclarativeNotifierEndpoint::disconnect() { if (type == SignalType) { - Signal *s = (Signal *)&signalData; + Signal *s = asSignal(); if (s->source) { QMetaObject::disconnectOne(s->source, s->sourceSignal, target, targetMethod); s->source = 0; @@ -223,18 +230,19 @@ QDeclarativeNotifierEndpoint::Notifier *QDeclarativeNotifierEndpoint::toNotifier s->~Signal(); } + type = NotifierType; Notifier *n = asNotifier(); n->next = 0; n->prev = 0; n->disconnected = 0; n->notifier = 0; - type = NotifierType; return n; } QDeclarativeNotifierEndpoint::Notifier *QDeclarativeNotifierEndpoint::asNotifier() { - return (Notifier *)(¬ifierData); + Q_ASSERT(type == NotifierType); + return ¬ifier; } QDeclarativeNotifierEndpoint::Signal *QDeclarativeNotifierEndpoint::toSignal() @@ -243,16 +251,15 @@ QDeclarativeNotifierEndpoint::Signal *QDeclarativeNotifierEndpoint::toSignal() return asSignal(); disconnect(); - Signal *s = asSignal(); - new (s) Signal; + signal.signal = new (&signal.signalData) Signal; type = SignalType; - - return s; + return signal.signal; } QDeclarativeNotifierEndpoint::Signal *QDeclarativeNotifierEndpoint::asSignal() { - return (Signal *)(&signalData); + Q_ASSERT(type == SignalType); + return signal.signal; } QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h index 581f5197f4..c648d25cb7 100644 --- a/src/declarative/qml/qdeclarativepropertycache_p.h +++ b/src/declarative/qml/qdeclarativepropertycache_p.h @@ -111,7 +111,7 @@ public: int relatedIndex; // When IsFunction }; uint overrideIndexIsProperty : 1; - int overrideIndex : 31; + signed int overrideIndex : 31; int revision; int metaObjectOffset; diff --git a/src/declarative/qml/qdeclarativesqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp index 588b6bf306..513cae2da1 100644 --- a/src/declarative/qml/qdeclarativesqldatabase.cpp +++ b/src/declarative/qml/qdeclarativesqldatabase.cpp @@ -175,7 +175,7 @@ static const char* sqlerror[] = { static QString qmlsqldatabase_databasesPath(QScriptEngine *engine) { QDeclarativeScriptEngine *qmlengine = static_cast<QDeclarativeScriptEngine*>(engine); - return qmlengine->offlineStoragePath + return QDir::toNativeSeparators(qmlengine->offlineStoragePath) + QDir::separator() + QLatin1String("Databases"); } diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index bf9e54a986..5d171bfe41 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -27,7 +27,6 @@ SOURCES += \ $$PWD/qdeclarativeinfo.cpp \ $$PWD/qdeclarativeerror.cpp \ $$PWD/qdeclarativescriptparser.cpp \ - $$PWD/qdeclarativeenginedebug.cpp \ $$PWD/qdeclarativerewrite.cpp \ $$PWD/qdeclarativevaluetype.cpp \ $$PWD/qdeclarativecompiledbindings.cpp \ @@ -99,7 +98,6 @@ HEADERS += \ $$PWD/qdeclarativedata_p.h \ $$PWD/qdeclarativeerror.h \ $$PWD/qdeclarativescriptparser_p.h \ - $$PWD/qdeclarativeenginedebug_p.h \ $$PWD/qdeclarativerewrite_p.h \ $$PWD/qpodvector_p.h \ $$PWD/qbitfield_p.h \ diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index ce21bcd30e..455c4f6906 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -2719,7 +2719,7 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions, } if (scale != 0) - rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI; + rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/qreal(M_PI); else { qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under scale of 0"); ok = false; diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index b77db89043..e905d0ad84 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -51,7 +51,7 @@ #include <QtCore/qdebug.h> -#include <math.h> +#include <QtCore/qmath.h> #define DELAY_STOP_TIMER_INTERVAL 32 @@ -98,20 +98,20 @@ bool QSmoothedAnimation::recalc() s = to - initialValue; vi = initialVelocity; - s = (invert? -1.0: 1.0) * s; + s = (invert? qreal(-1.0): qreal(1.0)) * s; if (userDuration > 0 && velocity > 0) { tf = s / velocity; - if (tf > (userDuration / 1000.)) tf = (userDuration / 1000.); + if (tf > (userDuration / qreal(1000.))) tf = (userDuration / qreal(1000.)); } else if (userDuration > 0) { - tf = userDuration / 1000.; + tf = userDuration / qreal(1000.); } else if (velocity > 0) { tf = s / velocity; } else { return false; } - finalDuration = ceil(tf * 1000.0); + finalDuration = ceil(tf * qreal(1000.0)); if (maximumEasingTime == 0) { a = 0; @@ -121,33 +121,33 @@ bool QSmoothedAnimation::recalc() vp = velocity; sp = 0; sd = s; - } else if (maximumEasingTime != -1 && tf > (maximumEasingTime / 1000.)) { - qreal met = maximumEasingTime / 1000.; + } else if (maximumEasingTime != -1 && tf > (maximumEasingTime / qreal(1000.))) { + qreal met = maximumEasingTime / qreal(1000.); td = tf - met; qreal c1 = td; qreal c2 = (tf - td) * vi - tf * velocity; - qreal c3 = -0.5 * (tf - td) * vi * vi; + qreal c3 = qreal(-0.5) * (tf - td) * vi * vi; - qreal vp1 = (-c2 + sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1); + qreal vp1 = (-c2 + qSqrt(c2 * c2 - 4 * c1 * c3)) / (qreal(2.) * c1); vp = vp1; a = vp / met; d = a; tp = (vp - vi) / a; - sp = vi * tp + 0.5 * a * tp * tp; + sp = vi * tp + qreal(0.5) * a * tp * tp; sd = sp + (td - tp) * vp; } else { - qreal c1 = 0.25 * tf * tf; - qreal c2 = 0.5 * vi * tf - s; - qreal c3 = -0.25 * vi * vi; + qreal c1 = qreal(0.25) * tf * tf; + qreal c2 = qreal(0.5) * vi * tf - s; + qreal c3 = qreal(-0.25) * vi * vi; - qreal a1 = (-c2 + sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1); + qreal a1 = (-c2 + qSqrt(c2 * c2 - 4 * c1 * c3)) / (qreal(2.) * c1); - qreal tp1 = 0.5 * tf - 0.5 * vi / a1; + qreal tp1 = qreal(0.5) * tf - qreal(0.5) * vi / a1; qreal vp1 = a1 * tp1 + vi; - qreal sp1 = 0.5 * a1 * tp1 * tp1 + vi * tp1; + qreal sp1 = qreal(0.5) * a1 * tp1 * tp1 + vi * tp1; a = a1; d = a1; @@ -165,7 +165,7 @@ qreal QSmoothedAnimation::easeFollow(qreal time_seconds) qreal value; if (time_seconds < tp) { trackVelocity = vi + time_seconds * a; - value = 0.5 * a * time_seconds * time_seconds + vi * time_seconds; + value = qreal(0.5) * a * time_seconds * time_seconds + vi * time_seconds; } else if (time_seconds < td) { time_seconds -= tp; trackVelocity = vp; @@ -173,7 +173,7 @@ qreal QSmoothedAnimation::easeFollow(qreal time_seconds) } else if (time_seconds < tf) { time_seconds -= td; trackVelocity = vp - time_seconds * a; - value = sd - 0.5 * d * time_seconds * time_seconds + vp * time_seconds; + value = sd - qreal(0.5) * d * time_seconds * time_seconds + vp * time_seconds; } else { trackVelocity = 0; value = s; @@ -186,10 +186,10 @@ qreal QSmoothedAnimation::easeFollow(qreal time_seconds) void QSmoothedAnimation::updateCurrentTime(int t) { - qreal time_seconds = qreal(t - lastTime) / 1000.; + qreal time_seconds = qreal(t - lastTime) / qreal(1000.); qreal value = easeFollow(time_seconds); - value *= (invert? -1.0: 1.0); + value *= (invert? qreal(-1.0): qreal(1.0)); QDeclarativePropertyPrivate::write(target, initialValue + value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); @@ -213,7 +213,7 @@ void QSmoothedAnimation::init() return; } - bool hasReversed = trackVelocity != 0. && + bool hasReversed = trackVelocity != qreal(0.) && ((!invert) == ((initialValue - to) > 0)); if (hasReversed) { diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp index 2c6058caf6..0b453eed3f 100644 --- a/src/declarative/util/qdeclarativespringanimation.cpp +++ b/src/declarative/util/qdeclarativespringanimation.cpp @@ -161,17 +161,17 @@ bool QDeclarativeSpringAnimationPrivate::animate(const QDeclarativeProperty &pro animation.velocity = animation.velocity + (spring * diff - damping * animation.velocity) / mass; else animation.velocity = animation.velocity + spring * diff - damping * animation.velocity; - if (maxVelocity > 0.) { + if (maxVelocity > qreal(0.)) { // limit velocity if (animation.velocity > maxVelocity) animation.velocity = maxVelocity; else if (animation.velocity < -maxVelocity) animation.velocity = -maxVelocity; } - animation.currentValue += animation.velocity * 16.0 / 1000.0; + animation.currentValue += animation.velocity * qreal(16.0) / qreal(1000.0); if (haveModulus) { animation.currentValue = fmod(animation.currentValue, modulus); - if (animation.currentValue < 0.0) + if (animation.currentValue < qreal(0.0)) animation.currentValue += modulus; } } @@ -195,7 +195,7 @@ bool QDeclarativeSpringAnimationPrivate::animate(const QDeclarativeProperty &pro animation.currentValue = fmod(animation.currentValue, modulus); } else { animation.currentValue -= moveBy; - if (haveModulus && animation.currentValue < 0.0) + if (haveModulus && animation.currentValue < qreal(0.0)) animation.currentValue = fmod(animation.currentValue, modulus) + modulus; } if (lastTime - animation.start >= animation.duration) { diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index c260684eef..8f613b0212 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -123,7 +123,7 @@ void QDeclarativeParentChangePrivate::doChange(QDeclarativeItem *targetParent, Q } if (scale != 0) - rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI; + rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/qreal(M_PI); else { qmlInfo(q) << QDeclarativeParentChange::tr("Unable to preserve appearance under scale of 0"); ok = false; diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h index b3854fc94c..ef51934eec 100644 --- a/src/declarative/util/qdeclarativeview.h +++ b/src/declarative/util/qdeclarativeview.h @@ -47,6 +47,7 @@ #include <QtGui/qgraphicssceneevent.h> #include <QtGui/qgraphicsview.h> #include <QtGui/qwidget.h> +#include <QtDeclarative/qdeclarativedebug.h> QT_BEGIN_HEADER diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 658dcad0f0..980568e683 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -530,7 +530,7 @@ public: void notifyQueryStarted(bool remoteSource) { Q_Q(QDeclarativeXmlListModel); - progress = remoteSource ? 0.0 : 1.0; + progress = remoteSource ? qreal(0.0) : qreal(1.0); status = QDeclarativeXmlListModel::Loading; errorString.clear(); emit q->progressChanged(progress); diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index 2fb6c67e50..d2211af777 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -909,6 +909,10 @@ bool QDialog::symbianAdjustedPosition() AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect); } else { AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, statusPaneRect); + // In some native layouts, StaCon is not used. Try to fetch the status pane + // height from StatusPane component. + if (statusPaneRect.IsEmpty()) + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect); } p.setX(0); diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp index de8e33d897..6691ff1472 100644 --- a/src/gui/dialogs/qfiledialog_win.cpp +++ b/src/gui/dialogs/qfiledialog_win.cpp @@ -670,7 +670,7 @@ QStringList qt_win_get_open_file_names(const QFileDialogArgs &args, // GetOpenFileName() will return only one folder name for all the files. To retrieve // the correct path for all selected files, we have to use Common Item Dialog interfaces. #ifndef Q_WS_WINCE - if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) + if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) return qt_win_CID_get_open_file_names(args, initialDirectory, filterLst, selectedFilter, idx); #endif @@ -757,7 +757,7 @@ static int __stdcall winGetExistDirCallbackProc(HWND hwnd, QString qt_win_get_existing_directory(const QFileDialogArgs &args) { #ifndef Q_WS_WINCE - if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) + if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) return qt_win_CID_get_existing_directory(args); #endif diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index 66e7216b38..149e267999 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -548,8 +548,8 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button) \snippet doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp 6 This is the approach recommended in the - \l{http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/chapter_18_section_7.html} - {Mac OS X Guidlines}. Similar guidlines apply for the other + \l{http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-BABCAJID} + {Mac OS X Guidelines}. Similar guidelines apply for the other platforms, but note the different ways the \l{QMessageBox::informativeText} {informative text} is handled for different platforms. diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp index 83bdaa0e55..9f8d5266c9 100644 --- a/src/gui/dialogs/qwizard.cpp +++ b/src/gui/dialogs/qwizard.cpp @@ -572,8 +572,7 @@ public: #endif } #if !defined(QT_NO_STYLE_WINDOWSVISTA) - if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) + if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) vistaInitPending = true; #endif } diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 2a37d45089..6fe1c8c446 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -684,6 +684,37 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglPr else props = 0; EGLSurface surf; +#ifdef Q_OS_SYMBIAN + // On Symbian there might be situations (especially on 32MB GPU devices) + // where Qt is trying to create EGL surface while some other application + // is still holding all available GPU memory but is about to release it + // soon. For an example when exiting native video recorder and going back to + // Qt application behind it. Video stack tear down takes some time and Qt + // app might be too quick in reserving its EGL surface and thus running out + // of GPU memory right away. So if EGL surface creation fails due to bad + // alloc, let's try recreating it four times within ~1 second if needed. + // This strategy gives some time for video recorder to tear down its stack + // and a chance to Qt for creating a valid surface. + int tries = 4; + while(tries--) { + if (devType == QInternal::Widget) + surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props); + else + surf = eglCreatePixmapSurface(QEgl::display(), cfg, pixmapDrawable, props); + if (surf == EGL_NO_SURFACE) { + EGLint error = eglGetError(); + if (error == EGL_BAD_ALLOC) { + if (tries) { + User::After(1000 * 250); // 250ms + continue; + } + } + qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", error); + } else { + break; + } + } +#else if (devType == QInternal::Widget) surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props); else @@ -691,6 +722,7 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglPr if (surf == EGL_NO_SURFACE) { qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); } +#endif return surf; } #endif diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 9092593918..cb7349ca97 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -8868,7 +8868,7 @@ QPainterPath QGraphicsEllipseItem::shape() const return path; if (d->spanAngle != 360 * 16) { path.moveTo(d->rect.center()); - path.arcTo(d->rect, d->startAngle / 16.0, d->spanAngle / 16.0); + path.arcTo(d->rect, d->startAngle / qreal(16.0), d->spanAngle / qreal(16.0)); } else { path.addEllipse(d->rect); } diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 867880c621..d652f25e49 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4304,7 +4304,7 @@ static void _q_paintItem(QGraphicsItem *item, QPainter *painter, QGraphicsWidget *widgetItem = static_cast<QGraphicsWidget *>(item); QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(widgetItem); const qreal windowOpacity = (proxy && proxy->widget() && useWindowOpacity) - ? proxy->widget()->windowOpacity() : 1.0; + ? proxy->widget()->windowOpacity() : qreal(1.0); const qreal oldPainterOpacity = painter->opacity(); if (qFuzzyIsNull(windowOpacity)) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 548f79fa17..d2e21fba89 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -298,7 +298,7 @@ inline int q_round_bound(qreal d) //### (int)(qreal) INT_MAX != INT_MAX for sing return INT_MIN; else if (d >= (qreal) INT_MAX) return INT_MAX; - return d >= 0.0 ? int(d + 0.5) : int(d - int(d-1) + 0.5) + int(d-1); + return d >= 0.0 ? int(d + qreal(0.5)) : int(d - int(d-1) + qreal(0.5)) + int(d-1); } void QGraphicsViewPrivate::translateTouchEvent(QGraphicsViewPrivate *d, QTouchEvent *touchEvent) @@ -1830,14 +1830,14 @@ void QGraphicsView::centerOn(const QPointF &pos) qint64 horizontal = 0; horizontal += horizontalScrollBar()->minimum(); horizontal += horizontalScrollBar()->maximum(); - horizontal -= int(viewPoint.x() - width / 2.0); + horizontal -= int(viewPoint.x() - width / qreal(2.0)); horizontalScrollBar()->setValue(horizontal); } else { - horizontalScrollBar()->setValue(int(viewPoint.x() - width / 2.0)); + horizontalScrollBar()->setValue(int(viewPoint.x() - width / qreal(2.0))); } } if (!d->topIndent) - verticalScrollBar()->setValue(int(viewPoint.y() - height / 2.0)); + verticalScrollBar()->setValue(int(viewPoint.y() - height / qreal(2.0))); d->lastCenterPoint = oldCenterPoint; } @@ -1886,22 +1886,22 @@ void QGraphicsView::ensureVisible(const QRectF &rect, int xmargin, int ymargin) if (viewRect.left() <= left + xmargin) { // need to scroll from the left if (!d->leftIndent) - horizontalScrollBar()->setValue(int(viewRect.left() - xmargin - 0.5)); + horizontalScrollBar()->setValue(int(viewRect.left() - xmargin - qreal(0.5))); } if (viewRect.right() >= right - xmargin) { // need to scroll from the right if (!d->leftIndent) - horizontalScrollBar()->setValue(int(viewRect.right() - width + xmargin + 0.5)); + horizontalScrollBar()->setValue(int(viewRect.right() - width + xmargin + qreal(0.5))); } if (viewRect.top() <= top + ymargin) { // need to scroll from the top if (!d->topIndent) - verticalScrollBar()->setValue(int(viewRect.top() - ymargin - 0.5)); + verticalScrollBar()->setValue(int(viewRect.top() - ymargin - qreal(0.5))); } if (viewRect.bottom() >= bottom - ymargin) { // need to scroll from the bottom if (!d->topIndent) - verticalScrollBar()->setValue(int(viewRect.bottom() - height + ymargin + 0.5)); + verticalScrollBar()->setValue(int(viewRect.bottom() - height + ymargin + qreal(0.5))); } } diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index ca6713bf24..ec79a2fd30 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -482,8 +482,8 @@ static QSizeF closestAcceptableSize(const QSizeF &proposed, minw = maxw; minh = maxh; } - middlew = minw + (maxw - minw)/2.0; - middleh = minh + (maxh - minh)/2.0; + middlew = minw + (maxw - minw)/qreal(2.0); + middleh = minh + (maxh - minh)/qreal(2.0); min_hfw = minimumHeightForWidth(middlew, minh, maxh, widget); diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index 66b4a5b6b4..5c614357d8 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -84,7 +84,7 @@ static qreal fixedDescent(qreal descent, qreal ascent, qreal targetSize) Q_ASSERT(targetSize >= ascent + descent); qreal extra = targetSize - (ascent + descent); - return descent + (extra / 2.0); + return descent + (extra / qreal(2.0)); } static qreal compare(const QGridLayoutBox &box1, const QGridLayoutBox &box2, int which) @@ -292,9 +292,9 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz int stretch = stretches[start + i]; if (sumStretches == 0) { if (hasIgnoreFlag) { - factors[i] = (stretch < 0) ? 1.0 : 0.0; + factors[i] = (stretch < 0) ? qreal(1.0) : qreal(0.0); } else { - factors[i] = (stretch < 0) ? sizes[i] : 0.0; + factors[i] = (stretch < 0) ? sizes[i] : qreal(0.0); } } else if (stretch == sumStretches) { factors[i] = 1.0; @@ -373,7 +373,7 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz for (int i = 0; i < n; ++i) { if (newSizes[i] < 0.0) { - qreal delta = (sumFactors == 0.0) ? 0.0 + qreal delta = (sumFactors == 0.0) ? qreal(0.0) : sumCurrentAvailable * factors[i] / sumFactors; newSizes[i] = sizes[i] + delta; } diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp index eb8bcb8c1f..1b45d9d9f5 100644 --- a/src/gui/graphicsview/qsimplex_p.cpp +++ b/src/gui/graphicsview/qsimplex_p.cpp @@ -486,7 +486,7 @@ bool QSimplex::iterate() // Normalize Pivot Row qreal pivot = valueAt(pivotRow, pivotColumn); if (pivot != 1.0) - combineRows(pivotRow, pivotRow, (1.0 - pivot) / pivot); + combineRows(pivotRow, pivotRow, (qreal(1.0) - pivot) / pivot); // Update other rows for (int row=0; row < rows; ++row) { diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index a3378de443..f527bcf5cb 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -5908,12 +5908,12 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth uchar *dptr, int dbpl, int p_inc, int dHeight, const uchar *sptr, int sbpl, int sWidth, int sHeight) { - int m11 = int(trueMat.m11()*4096.0); - int m12 = int(trueMat.m12()*4096.0); - int m21 = int(trueMat.m21()*4096.0); - int m22 = int(trueMat.m22()*4096.0); - int dx = qRound(trueMat.dx()*4096.0); - int dy = qRound(trueMat.dy()*4096.0); + int m11 = int(trueMat.m11()*qreal(4096.0)); + int m12 = int(trueMat.m12()*qreal(4096.0)); + int m21 = int(trueMat.m21()*qreal(4096.0)); + int m22 = int(trueMat.m22()*qreal(4096.0)); + int dx = qRound(trueMat.dx()*qreal(4096.0)); + int dy = qRound(trueMat.dy()*qreal(4096.0)); int m21ydx = dx + (xoffset<<16) + (m11 + m21) / 2; int m22ydy = dy + (m12 + m22) / 2; diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index aebcbafd29..e1382dd747 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -153,7 +153,12 @@ QImage::Format QNativeImage::systemFormat() QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* isTextBuffer */, QWidget *widget) : xshmimg(0), xshmpm(0) { - if (!X11->use_mitshm) { + QX11Info info = widget->x11Info(); + + int dd = info.depth(); + Visual *vis = (Visual*) info.visual(); + + if (!X11->use_mitshm || format != QImage::Format_RGB16 && X11->bppForDepth.value(dd) != 32) { image = QImage(width, height, format); // follow good coding practice and set xshminfo attributes, though values not used in this case xshminfo.readOnly = true; @@ -163,11 +168,6 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* return; } - QX11Info info = widget->x11Info(); - - int dd = info.depth(); - Visual *vis = (Visual*) info.visual(); - xshmimg = XShmCreateImage(X11->display, vis, dd, ZPixmap, 0, &xshminfo, width, height); if (!xshmimg) { qWarning("QNativeImage: Unable to create shared XImage."); diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 77c2a2a9d9..0e1401cb16 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -897,12 +897,20 @@ void QX11PixmapData::fromImage(const QImage &img, } ) break; - case BPP24_888: // 24 bit MSB + case BPP24_888: CYCLE( - for (int x=0; x<w; x++) { - *dst++ = qRed (*p); - *dst++ = qGreen(*p); - *dst++ = qBlue (*p++); + if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { + for (int x=0; x<w; x++) { + *dst++ = qRed (*p); + *dst++ = qGreen(*p); + *dst++ = qBlue (*p++); + } + } else { + for (int x=0; x<w; x++) { + *dst++ = qBlue (*p); + *dst++ = qGreen(*p); + *dst++ = qRed (*p++); + } } ) break; diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp index 9734c82494..350d70ff42 100644 --- a/src/gui/image/qvolatileimage.cpp +++ b/src/gui/image/qvolatileimage.cpp @@ -248,12 +248,14 @@ void QVolatileImage::copyFrom(QVolatileImage *source, const QRect &rect) const uchar *sptr = srcImgRef.constBits() + r.y() * srcbpl; beginDataAccess(); QImage &dstImgRef(imageRef()); - int dstbpl = dstImgRef.bytesPerLine(); - uchar *dptr = dstImgRef.bits(); - for (int y = 0; y < r.height(); ++y) { - qMemCopy(dptr, sptr + r.x() * srcbpp, r.width() * srcbpp); - sptr += srcbpl; - dptr += dstbpl; + if (!dstImgRef.isNull()) { + int dstbpl = dstImgRef.bytesPerLine(); + uchar *dptr = dstImgRef.bits(); + for (int y = 0; y < r.height(); ++y) { + qMemCopy(dptr, sptr + r.x() * srcbpp, r.width() * srcbpp); + sptr += srcbpl; + dptr += dstbpl; + } } endDataAccess(); source->endDataAccess(true); diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 8ef9726632..ad51b4b265 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -136,6 +136,7 @@ private: private Q_SLOTS: void ensureInputCapabilitiesChanged(); void translateInputWidget(); + void ensureWidgetVisibility(); // From MCoeFepAwareTextEditor public: @@ -208,6 +209,7 @@ private: int m_splitViewResizeBy; Qt::WindowStates m_splitViewPreviousWindowStates; QRectF m_transformation; + QGraphicsItem *m_splitViewPreviousFocusItem; //can't use QPointer<> since QGraphicsItem is not a QObject. CAknCcpuSupport *m_ccpu; QAction *m_copyAction; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 90252216d8..8f13c53898 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -94,6 +94,11 @@ #define QT_EPSUidAknFep 0x100056de #define QT_EAknFepTouchInputActive 0x00000004 +// For compatibility with older Symbian^3 environments, which do not have this define yet. +#ifndef R_AVKON_DISCREET_POPUP_TEXT_COPIED +#define R_AVKON_DISCREET_POPUP_TEXT_COPIED 0x8cc0227 +#endif + _LIT(KAvkonResourceFile, "z:\\resource\\avkon.rsc" ); QT_BEGIN_NAMESPACE @@ -377,6 +382,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_hasTempPreeditString(false), m_splitViewResizeBy(0), m_splitViewPreviousWindowStates(Qt::WindowNoState), + m_splitViewPreviousFocusItem(0), m_ccpu(0) { m_fepState->SetObjectProvider(this); @@ -446,6 +452,11 @@ void QCoeFepInputContext::reset() if (m_cachedPreeditString.isEmpty() && !(currentHints & Qt::ImhNoPredictiveText)) m_cachedPreeditString = m_preeditString; commitCurrentString(true); + + // QGraphicsScene calls reset() when changing focus item. Unfortunately, the new focus item is + // set right after resetting the input context. Therefore, asynchronously call ensureWidgetVisibility(). + if (S60->splitViewLastWidget) + QMetaObject::invokeMethod(this,"ensureWidgetVisibility", Qt::QueuedConnection); } void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType) @@ -788,9 +799,8 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) { QGraphicsView *gv = qobject_cast<QGraphicsView*>(S60->splitViewLastWidget); - if (!gv) { + if (!gv) return; - } QSymbianControl *symControl = static_cast<QSymbianControl*>(gv->effectiveWinId()); symControl->CancelLongTapTimer(); @@ -805,11 +815,13 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) if (!alwaysResize) { if (gv->scene() && S60->partial_keyboardAutoTranslation) { if (gv->scene()->focusItem()) { + QGraphicsItem *focusItem = + m_splitViewPreviousFocusItem ? m_splitViewPreviousFocusItem : gv->scene()->focusItem(); // Check if the widget contains cursorPositionChanged signal and disconnect from it. QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged())); - int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1)); + int index = focusItem->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1)); if (index != -1) - disconnect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); + disconnect(focusItem->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); } QGraphicsItem *rootItem = 0; @@ -877,10 +889,18 @@ bool QCoeFepInputContext::isPartialKeyboardSupported() return (S60->partial_keyboard || !QApplication::testAttribute(Qt::AA_S60DisablePartialScreenInputMode)); } +void QCoeFepInputContext::ensureWidgetVisibility() +{ + ensureFocusWidgetVisible(S60->splitViewLastWidget); +} + // Ensure that the input widget is visible in the splitview rect. void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) { + if (!widget) + return; + // Native side opening and closing its virtual keyboard when it changes the keyboard layout, // has an adverse impact on long tap timer. Cancel the timer when splitview opens to avoid this. QSymbianControl *symControl = static_cast<QSymbianControl*>(widget->effectiveWinId()); @@ -908,17 +928,22 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) // states getting changed. if (!moveWithinVisibleArea) { - // Check if the widget contains cursorPositionChanged signal and connect to it. - QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged())); - if (gv->scene() && gv->scene()->focusItem() && S60->partial_keyboardAutoTranslation) { - int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1)); - if (index != -1) - connect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); - } S60->splitViewLastWidget = widget; m_splitViewPreviousWindowStates = windowToMove->windowState(); } + // Check if the widget contains cursorPositionChanged signal and connect to it. + if (gv->scene() && gv->scene()->focusItem() && S60->partial_keyboardAutoTranslation) { + QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged())); + if (m_splitViewPreviousFocusItem && m_splitViewPreviousFocusItem != gv->scene()->focusItem()) + disconnect(m_splitViewPreviousFocusItem->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); + int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1)); + if (index != -1) { + connect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); + m_splitViewPreviousFocusItem = gv->scene()->focusItem(); + } + } + int windowTop = widget->window()->pos().y(); const bool userResize = widget->testAttribute(Qt::WA_Resized); @@ -1083,6 +1108,9 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) } else if (hints & ImhNoAutoUppercase) { m_fepState->SetDefaultCase(EAknEditorLowerCase); m_fepState->SetCurrentCase(EAknEditorLowerCase); + } else if (hints & ImhHiddenText) { + m_fepState->SetDefaultCase(EAknEditorLowerCase); + m_fepState->SetCurrentCase(EAknEditorLowerCase); } else { m_fepState->SetDefaultCase(EAknEditorTextCase); m_fepState->SetCurrentCase(EAknEditorTextCase); @@ -1094,6 +1122,10 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) if (hints & ImhLowercaseOnly) { flags |= EAknEditorLowerCase; } + if (hints & ImhHiddenText) { + flags = EAknEditorAllCaseModes; + flags &= ~EAknEditorTextCase; + } if (flags == 0) { flags = EAknEditorAllCaseModes; if (hints & ImhNoAutoUppercase) { @@ -1254,10 +1286,15 @@ void QCoeFepInputContext::translateInputWidget() m_transformation = (rootItem->transform().isTranslating()) ? QRectF(0,0, gv->width(), rootItem->transform().dy()) : QRectF(); - // Adjust cursor bounding rect to be lower, so that view translates if the cursor gets near - // the splitview border. - QRect cursorRect = cursorP.boundingRect().adjusted(0, cursor.height(), 0, cursor.height()); - if (splitViewRect.contains(cursorRect)) + // Adjust cursor bounding rect towards navigation direction, + // so that view translates if the cursor gets near the splitview border. + QRect cursorRect = (cursorP.boundingRect().top() < 0) ? + cursorP.boundingRect().adjusted(0, -cursor.height(), 0, -cursor.height()) : + cursorP.boundingRect().adjusted(0, cursor.height(), 0, cursor.height()); + + // If the current cursor position and upcoming cursor positions are visible in the splitview + // area, do not move the view. + if (splitViewRect.contains(cursorRect) && splitViewRect.contains(cursorP.boundingRect())) return; // New Y position should be ideally just above the keyboard. @@ -1269,18 +1306,29 @@ void QCoeFepInputContext::translateInputWidget() const qreal itemHeight = path.boundingRect().height(); // Limit the maximum translation so that underlaying window content is not exposed. - qreal maxY = gv->sceneRect().bottom() - splitViewRect.bottom(); - maxY = m_transformation.height() ? (qMin(itemHeight, maxY) + m_transformation.height()) : maxY; - if (maxY < 0) - maxY = 0; + qreal availableSpace = gv->sceneRect().bottom() - splitViewRect.bottom(); + availableSpace = m_transformation.height() ? + (qMin(itemHeight, availableSpace) + m_transformation.height()) : + availableSpace; // Translation should happen row-by-row, but initially it needs to ensure that cursor is visible. const qreal translation = m_transformation.height() ? cursor.height() : (cursorRect.bottom() - vkbRect.top()); - const qreal dy = -(qMin(maxY, translation)); + qreal dy = 0.0; + if (availableSpace > 0) + dy = -(qMin(availableSpace, translation)); + else + dy = -(translation); + + // Correct the translation direction, if the cursor rect would be moved above application area. + if ((cursorP.boundingRect().bottom() + dy) < 0) + dy *= -1; - // Do not allow transform above screen top, nor beyond scenerect - if (m_transformation.height() + dy > 0 || gv->sceneRect().bottom() + m_transformation.height() < 0) { + // Do not allow transform above screen top, nor beyond scenerect. Also, if there is no available + // space anymore, skip translation. + if ((m_transformation.height() + dy) > 0 + || (gv->sceneRect().bottom() + m_transformation.height()) < 0 + || !availableSpace) { // If we already have some transformation, remove it. if (m_transformation.height() < 0 || gv->sceneRect().bottom() + m_transformation.height() < 0) { rootItem->resetTransform(); @@ -1596,8 +1644,6 @@ void QCoeFepInputContext::changeCBA(bool showCopyAndOrPaste) void QCoeFepInputContext::copyOrCutTextToClipboard(const char *operation) { - bool hasText = false; - QWidget *w = focusWidget(); QObject *focusObject = 0; if (!w) { @@ -1613,11 +1659,13 @@ void QCoeFepInputContext::copyOrCutTextToClipboard(const char *operation) if (cursor != anchor) { if (ccpuInvokeSlot(w, focusObject, operation)) { - TRAP_IGNORE( - CAknDiscreetPopup::ShowGlobalPopupL( - R_AVKON_DISCREET_POPUP_TEXT_COPIED, - KAvkonResourceFile); - ) + if (QSysInfo::symbianVersion() > QSysInfo::SV_SF_3) { + TRAP_IGNORE( + CAknDiscreetPopup::ShowGlobalPopupL( + R_AVKON_DISCREET_POPUP_TEXT_COPIED, + KAvkonResourceFile); + ) + } } } } @@ -1696,15 +1744,33 @@ TBool QCoeFepInputContext::CcpuIsFocused() const TBool QCoeFepInputContext::CcpuCanCut() const { bool retval = false; + if (m_inDestruction) + return retval; QWidget *w = focusWidget(); - if (!w) + QObject *focusObject = 0; + if (!w) { w = m_lastFocusedEditor; - else - w = getQWidgetFromQGraphicsView(w); + focusObject = m_lastFocusedObject; + } else { + w = getQWidgetFromQGraphicsView(w, &focusObject); + } if (w) { - int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); - int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt(); - retval = cursor != anchor; + QRect microFocus = w->inputMethodQuery(Qt::ImMicroFocus).toRect(); + if (microFocus.isNull()) { + // For some reason, the editor does not have microfocus. Most probably, + // it is due to using native fullscreen editing mode with QML apps. + // Try accessing "selectedText" directly. + QObject *invokeTarget = w; + if (focusObject) + invokeTarget = focusObject; + + QString selectedText = invokeTarget->property("selectedText").toString(); + retval = !selectedText.isNull(); + } else { + int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); + int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt(); + retval = cursor != anchor; + } } return retval; } @@ -1727,6 +1793,9 @@ void QCoeFepInputContext::CcpuCopyL() TBool QCoeFepInputContext::CcpuCanPaste() const { bool canPaste = false; + if (m_inDestruction) + return canPaste; + QString textToPaste = QApplication::clipboard()->text(); if (!textToPaste.isEmpty()) { QWidget *w = focusWidget(); diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 15d37c3c08..35a9559254 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -874,6 +874,10 @@ void QApplicationPrivate::construct( if (qt_is_gui_used) qt_guiPlatformPlugin(); #endif + +#ifdef Q_OS_SYMBIAN + symbianHandleLiteModeStartup(); +#endif } #if defined(Q_WS_X11) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index e1252a9589..0756d6ca6a 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -561,6 +561,7 @@ public: int symbianProcessWsEvent(const QSymbianEvent *symbianEvent); int symbianHandleCommand(const QSymbianEvent *symbianEvent); int symbianResourceChange(const QSymbianEvent *symbianEvent); + void symbianHandleLiteModeStartup(); void _q_aboutToQuit(); #endif diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 80bcdf0ea5..7d198ce14b 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -201,6 +201,32 @@ bool QS60Data::setRecursiveDecorationsVisibility(QWidget *window, Qt::WindowStat } #endif +void QS60Data::createStatusPaneAndCBA() +{ + CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi()); + MEikAppUiFactory *factory = CEikonEnv::Static()->AppUiFactory(); + QT_TRAP_THROWING( + factory->CreateResourceIndependentFurnitureL(ui); + CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, + CEikButtonGroupContainer::EHorizontal, ui, R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); + CEikButtonGroupContainer *oldCba = factory->SwapButtonGroup(cba); + Q_ASSERT(!oldCba); + S60->setButtonGroupContainer(cba); + CEikMenuBar *menuBar = new(ELeave) CEikMenuBar; + menuBar->ConstructL(ui, 0, R_AVKON_MENUPANE_EMPTY); + menuBar->SetMenuType(CEikMenuBar::EMenuOptions); + S60->appUi()->AddToStackL(menuBar, ECoeStackPriorityMenu, ECoeStackFlagRefusesFocus); + CEikMenuBar *oldMenu = factory->SwapMenuBar(menuBar); + Q_ASSERT(!oldMenu); + ) + if (S60->statusPane()) { + // Use QDesktopWidget as the status pane observer to proxy for the AppUi. + // Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver. + QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId()); + S60->statusPane()->SetObserver(desktopControl); + } +} + void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) { if (QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control)) { @@ -1493,12 +1519,15 @@ void QSymbianControl::handleClientAreaChange() } } -bool QSymbianControl::isSplitViewWidget(QWidget *widget) { +bool QSymbianControl::isSplitViewWidget(QWidget *widget) +{ bool returnValue = true; - //Ignore events sent to non-active windows, not visible widgets and not parents of input widget. + // Ignore events sent to non-active windows, not visible widgets and not parents of input widget + // and non-Qt dialogs. if (!qwidget->isActiveWindow() || !qwidget->isVisible() - || !qwidget->isAncestorOf(widget)) { + || !qwidget->isAncestorOf(widget) + || CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) { returnValue = false; } @@ -2577,6 +2606,24 @@ int QApplicationPrivate::symbianResourceChange(const QSymbianEvent *symbianEvent return ret; } +void QApplicationPrivate::symbianHandleLiteModeStartup() +{ + if (QCoreApplication::arguments().contains(QLatin1String("--startup-lite"))) { + if (!QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) + && !S60->buttonGroupContainer() && !S60->statusPane()) { + // hide and force this app to the background before creating screen furniture to avoid flickers + CAknAppUi *appui = static_cast<CAknAppUi*>(CCoeEnv::Static()->AppUi()); + if (appui) + appui->HideApplicationFromFSW(ETrue); + CCoeEnv::Static()->RootWin().SetOrdinalPosition(-1); + S60->createStatusPaneAndCBA(); + if (S60->statusPane()) { + S60->setStatusPaneAndButtonGroupVisibility(false, false); + } + } + } +} + #ifndef QT_NO_WHEELEVENT int QApplication::wheelScrollLines() { diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 756cb56b58..c472738254 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -682,7 +682,7 @@ void QApplicationPrivate::initializeWidgetPaletteHash() QColor menuText(qt_colorref2qrgb(GetSysColor(COLOR_MENUTEXT))); BOOL isFlat = false; if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) SystemParametersInfo(SPI_GETFLATMENU, 0, &isFlat, 0); QPalette menu(pal); // we might need a special color group for the menu. @@ -697,7 +697,7 @@ void QApplicationPrivate::initializeWidgetPaletteHash() menu.setColor(QPalette::Disabled, QPalette::Highlight, QColor(qt_colorref2qrgb(GetSysColor( (QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) && isFlat ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT)))); menu.setColor(QPalette::Disabled, QPalette::HighlightedText, disabled); menu.setColor(QPalette::Disabled, QPalette::Button, @@ -719,7 +719,7 @@ void QApplicationPrivate::initializeWidgetPaletteHash() QApplication::setPalette(menu, "QMenu"); if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) && isFlat) { + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) && isFlat) { QColor menubar(qt_colorref2qrgb(GetSysColor(COLOR_MENUBAR))); menu.setColor(QPalette::Active, QPalette::Button, menubar); menu.setColor(QPalette::Disabled, QPalette::Button, menubar); @@ -999,7 +999,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class style = CS_DBLCLKS; if (w->inherits("QTipLabel") || w->inherits("QAlphaWidget")) { if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) { + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { style |= CS_DROPSHADOW; } cname = QLatin1String("QToolTip"); @@ -1017,7 +1017,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class style |= CS_SAVEBITS; #endif if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) style |= CS_DROPSHADOW; icon = false; } else { @@ -4161,7 +4161,8 @@ PtrCloseTouchInputHandle QApplicationPrivate::CloseTouchInputHandle = 0; void QApplicationPrivate::initializeMultitouch_sys() { - if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) { + if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7 + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) { static const int QT_SM_DIGITIZER = 94; int value = GetSystemMetrics(QT_SM_DIGITIZER); static const int QT_NID_INTEGRATED_TOUCH = 0x01; diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index ef8e2b86ea..408e9acf3b 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -1896,6 +1896,12 @@ void qt_init(QApplicationPrivate *priv, int, X11->defaultScreen = DefaultScreen(X11->display); X11->screenCount = ScreenCount(X11->display); + int formatCount = 0; + XPixmapFormatValues *values = XListPixmapFormats(X11->display, &formatCount); + for (int i = 0; i < formatCount; ++i) + X11->bppForDepth[values[i].depth] = values[i].bits_per_pixel; + XFree(values); + X11->screens = new QX11InfoData[X11->screenCount]; X11->argbVisuals = new Visual *[X11->screenCount]; X11->argbColormaps = new Colormap[X11->screenCount]; diff --git a/src/gui/kernel/qcursor_win.cpp b/src/gui/kernel/qcursor_win.cpp index cef83f5a1b..a68472c584 100644 --- a/src/gui/kernel/qcursor_win.cpp +++ b/src/gui/kernel/qcursor_win.cpp @@ -477,7 +477,7 @@ void QCursorData::update() QPixmap pixmap = QApplicationPrivate::instance()->getPixmapCursor(cshape); hcurs = create32BitCursor(pixmap, hx, hy); } - break; + return; default: qWarning("QCursor::update: Invalid cursor shape %d", cshape); return; diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp index 708859d811..04fd111891 100644 --- a/src/gui/kernel/qguiplatformplugin.cpp +++ b/src/gui/kernel/qguiplatformplugin.cpp @@ -137,10 +137,10 @@ QString QGuiPlatformPlugin::styleName() return QLatin1String("WindowsCE"); #elif defined(Q_WS_WIN) if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) return QLatin1String("WindowsVista"); else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) return QLatin1String("WindowsXP"); else return QLatin1String("Windows"); // default styles for Windows diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 96b8141d61..5ad5b00772 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -163,6 +163,7 @@ public: int partial_keyboardAutoTranslation : 1; int partialKeyboardOpen : 1; int handleStatusPaneResizeNotifications : 1; + int screenFurnitureFullyCreated : 1; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type QPointer<QWidget> splitViewLastWidget; @@ -198,6 +199,7 @@ public: static inline void setButtonGroupContainer(CEikButtonGroupContainer* newCba); static void setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible); static bool setRecursiveDecorationsVisibility(QWidget *window, Qt::WindowStates newState); + static void createStatusPaneAndCBA(); #endif static void controlVisibilityChanged(CCoeControl *control, bool visible); static TRect clientRect(); @@ -365,6 +367,7 @@ inline QS60Data::QS60Data() partial_keyboardAutoTranslation(1), partialKeyboardOpen(0), handleStatusPaneResizeNotifications(1), + screenFurnitureFullyCreated(0), s60ApplicationFactory(0) #ifdef Q_OS_SYMBIAN ,s60InstalledTrapHandler(0) diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index 72acaf3538..fe4a631c5e 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -54,6 +54,7 @@ // #include "QtGui/qwindowdefs.h" +#include "QtCore/qhash.h" #include "QtCore/qlist.h" #include "QtCore/qvariant.h" @@ -467,6 +468,7 @@ struct QX11Data Colormap *argbColormaps; int screenCount; int defaultScreen; + QHash<int, int> bppForDepth; Time time; Time userTime; diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp index f880243a7e..178e7b1a46 100644 --- a/src/gui/kernel/qtooltip.cpp +++ b/src/gui/kernel/qtooltip.cpp @@ -184,7 +184,7 @@ QTipLabel::QTipLabel(const QString &text, QWidget *w) setAlignment(Qt::AlignLeft); setIndent(1); qApp->installEventFilter(this); - setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0); + setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / qreal(255.0)); setMouseTracking(true); fadingOut = false; reuseTip(text); diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp index 5328cb1fd1..da792500d0 100644 --- a/src/gui/kernel/qwhatsthis.cpp +++ b/src/gui/kernel/qwhatsthis.cpp @@ -227,7 +227,7 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor } #if defined(Q_WS_WIN) if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { BOOL shadow; SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0); @@ -305,7 +305,7 @@ void QWhatsThat::paintEvent(QPaintEvent*) bool drawShadow = true; #if defined(Q_WS_WIN) if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { BOOL shadow; SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 0aa1dfa283..7055c6b4b7 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2260,10 +2260,16 @@ void QWidgetPrivate::updateIsOpaque() #endif #ifdef Q_WS_S60 - if (q->windowType() == Qt::Dialog && q->testAttribute(Qt::WA_TranslucentBackground) - && S60->avkonComponentsSupportTransparency) { - setOpaque(false); - return; + if (q->testAttribute(Qt::WA_TranslucentBackground)) { + if (q->windowType() & Qt::Dialog || q->windowType() & Qt::Popup) { + if (S60->avkonComponentsSupportTransparency) { + setOpaque(false); + return; + } + } else { + setOpaque(false); + return; + } } #endif @@ -2283,11 +2289,16 @@ void QWidgetPrivate::updateIsOpaque() } if (q->isWindow() && !q->testAttribute(Qt::WA_NoSystemBackground)) { +#ifdef Q_WS_S60 + setOpaque(true); + return; +#else const QBrush &windowBrush = q->palette().brush(QPalette::Window); if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) { setOpaque(true); return; } +#endif } setOpaque(false); } @@ -10948,11 +10959,14 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) } break; case Qt::WA_TranslucentBackground: +#if defined(Q_OS_SYMBIAN) + setAttribute(Qt::WA_NoSystemBackground, on); +#else if (on) { setAttribute(Qt::WA_NoSystemBackground); d->updateIsTranslucent(); } - +#endif break; case Qt::WA_AcceptTouchEvents: #if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN) @@ -11049,7 +11063,7 @@ bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const qreal QWidget::windowOpacity() const { Q_D(const QWidget); - return (isWindow() && d->maybeTopData()) ? d->maybeTopData()->opacity / 255. : 1.0; + return (isWindow() && d->maybeTopData()) ? d->maybeTopData()->opacity / qreal(255.) : qreal(1.0); } void QWidget::setWindowOpacity(qreal opacity) diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index aefffb6ceb..9ac94795d5 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -233,6 +233,7 @@ struct QTLWExtra { uint inExpose : 1; // Prevents drawing recursion uint nativeWindowTransparencyEnabled : 1; // Tracks native window transparency uint forcedToRaster : 1; + uint noSystemRotationDisabled : 1; #elif defined(Q_WS_QPA) QPlatformWindow *platformWindow; QPlatformWindowFormat platformWindowFormat; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index e06b625812..396c3064f6 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -505,63 +505,41 @@ void QWidgetPrivate::show_sys() #ifdef Q_WS_S60 // Lazily initialize the S60 screen furniture when the first window is shown. if (q->isWindow() && !QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) - && !S60->buttonGroupContainer() && !S60->statusPane()) { - - if (!q->testAttribute(Qt::WA_DontShowOnScreen)) { - - // Create the status pane and CBA here - CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi()); - MEikAppUiFactory *factory = CEikonEnv::Static()->AppUiFactory(); - - QT_TRAP_THROWING( - factory->CreateResourceIndependentFurnitureL(ui); - - CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, - CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); - if (isFullscreen && !cbaRequested) - cba->MakeVisible(false); - - CEikButtonGroupContainer *oldCba = factory->SwapButtonGroup(cba); - Q_ASSERT(!oldCba); - S60->setButtonGroupContainer(cba); - - // If the creation of the first widget is delayed, for example by doing it - // inside the event loop, S60 somehow "forgets" to set the visibility of the - // toolbar (the three middle softkeys) when you flip the phone over, so we - // need to do it ourselves to avoid a "hole" in the application, even though - // Qt itself does not use the toolbar directly.. - CAknAppUi *appui = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi()); - if (appui) { - CAknToolbar *toolbar = appui->PopupToolbar(); - if (toolbar && !toolbar->IsVisible()) - toolbar->SetToolbarVisibility(ETrue); - } + && !q->testAttribute(Qt::WA_DontShowOnScreen) && !S60->screenFurnitureFullyCreated) { + // Create the status pane and CBA here if not yet done. These could be created earlier + // if application was launched in "App-Lite" version + if (!S60->buttonGroupContainer() && !S60->statusPane()) + S60->createStatusPaneAndCBA(); + + if (S60->buttonGroupContainer()) { + if (isFullscreen && !cbaRequested) + S60->buttonGroupContainer()->MakeVisible(false); + } + + // If the creation of the first widget is delayed, for example by doing it + // inside the event loop, S60 somehow "forgets" to set the visibility of the + // toolbar (the three middle softkeys) when you flip the phone over, so we + // need to do it ourselves to avoid a "hole" in the application, even though + // Qt itself does not use the toolbar directly.. + CAknAppUi *appui = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi()); + if (appui) { + CAknToolbar *toolbar = appui->PopupToolbar(); + if (toolbar && !toolbar->IsVisible()) + toolbar->SetToolbarVisibility(ETrue); + } - CEikMenuBar *menuBar = new(ELeave) CEikMenuBar; - menuBar->ConstructL(ui, 0, R_AVKON_MENUPANE_EMPTY); - menuBar->SetMenuType(CEikMenuBar::EMenuOptions); - S60->appUi()->AddToStackL(menuBar,ECoeStackPriorityMenu,ECoeStackFlagRefusesFocus); - - CEikMenuBar *oldMenu = factory->SwapMenuBar(menuBar); - Q_ASSERT(!oldMenu); - ) - - if (S60->statusPane()) { - // Use QDesktopWidget as the status pane observer to proxy for the AppUi. - // Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver. - QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId()); - S60->statusPane()->SetObserver(desktopControl); - if (isFullscreen) { - const bool cbaVisible = S60->buttonGroupContainer() && S60->buttonGroupContainer()->IsVisible(); - S60->setStatusPaneAndButtonGroupVisibility(false, cbaVisible); - if (cbaVisible) { - // Fix window dimensions as without screen furniture they will have - // defaulted to full screen dimensions initially. - id->handleClientAreaChange(); - } + if (S60->statusPane()) { + if (isFullscreen) { + const bool cbaVisible = S60->buttonGroupContainer() && S60->buttonGroupContainer()->IsVisible(); + S60->setStatusPaneAndButtonGroupVisibility(false, cbaVisible); + if (cbaVisible) { + // Fix window dimensions as without screen furniture they will have + // defaulted to full screen dimensions initially. + id->handleClientAreaChange(); } } } + S60->screenFurnitureFullyCreated = true; } #endif @@ -804,19 +782,12 @@ void QWidgetPrivate::setConstraints_sys() void QWidgetPrivate::s60UpdateIsOpaque() { Q_Q(QWidget); - if (!q->testAttribute(Qt::WA_WState_Created)) return; - const bool writeAlpha = extraData()->nativePaintMode == QWExtra::BlitWriteAlpha; - if (!q->testAttribute(Qt::WA_TranslucentBackground) && !writeAlpha) - return; const bool requireAlphaChannel = !isOpaque || writeAlpha; - createTLExtra(); - RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow()); - #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE if (QApplicationPrivate::instance()->useTranslucentEGLSurfaces && !extra->topextra->forcedToRaster) { @@ -825,25 +796,47 @@ void QWidgetPrivate::s60UpdateIsOpaque() return; } #endif + const bool recreateBackingStore = extra->topextra->backingStore.data() && ( + QApplicationPrivate::graphics_system_name == QLatin1String("openvg") || + QApplicationPrivate::graphics_system_name == QLatin1String("opengl") + ); if (requireAlphaChannel) { - const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA)); - if (window->SetTransparencyAlphaChannel() == KErrNone) { + window->SetRequiredDisplayMode(EColor16MA); + if (window->SetTransparencyAlphaChannel() == KErrNone) window->SetBackgroundColor(TRgb(255, 255, 255, 0)); - extra->topextra->nativeWindowTransparencyEnabled = 1; - if (extra->topextra->backingStore.data() && ( - QApplicationPrivate::graphics_system_name == QLatin1String("openvg") - || QApplicationPrivate::graphics_system_name == QLatin1String("opengl"))) { - // Semi-transparent EGL surfaces aren't supported. We need to - // recreate backing store to get translucent surface (raster surface). - extra->topextra->backingStore.create(q); - extra->topextra->backingStore.registerWidget(q); - // FixNativeOrientation() will not work without an EGL surface. + } else { + if (recreateBackingStore) { + // Clear the UI surface to ensure that the EGL surface content is visible + CWsScreenDevice *screenDevice = S60->screenDevice(q); + QScopedPointer<CWindowGc> gc(new CWindowGc(screenDevice)); + const int err = gc->Construct(); + if (!err) { + gc->Activate(*window); + window->BeginRedraw(); + gc->SetDrawMode(CWindowGc::EDrawModeWriteAlpha); + gc->SetBrushColor(TRgb(0, 0, 0, 0)); + gc->Clear(TRect(0, 0, q->width(), q->height())); + window->EndRedraw(); + } + } + if (extra->topextra->nativeWindowTransparencyEnabled) + window->SetTransparentRegion(TRegionFix<1>()); + } + extra->topextra->nativeWindowTransparencyEnabled = requireAlphaChannel; + if (recreateBackingStore) { + extra->topextra->backingStore.create(q); + extra->topextra->backingStore.registerWidget(q); + bool noSystemRotationDisabled = false; + if (requireAlphaChannel) { + if (q->testAttribute(Qt::WA_SymbianNoSystemRotation)) { + // FixNativeOrientation() will not work without an EGL surface q->setAttribute(Qt::WA_SymbianNoSystemRotation, false); + noSystemRotationDisabled = true; } + } else { + q->setAttribute(Qt::WA_SymbianNoSystemRotation, extra->topextra->noSystemRotationDisabled); } - } else if (extra->topextra->nativeWindowTransparencyEnabled) { - window->SetTransparentRegion(TRegionFix<1>()); - extra->topextra->nativeWindowTransparencyEnabled = 0; + extra->topextra->noSystemRotationDisabled = noSystemRotationDisabled; } } @@ -1004,6 +997,7 @@ void QWidgetPrivate::createTLSysExtra() extra->topextra->inExpose = 0; extra->topextra->nativeWindowTransparencyEnabled = 0; extra->topextra->forcedToRaster = 0; + extra->topextra->noSystemRotationDisabled = 0; } void QWidgetPrivate::deleteTLSysExtra() diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 3d895b7753..2fe68a8e58 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -1578,7 +1578,7 @@ QColor QColor::toRgb() const } // chromatic case - const qreal h = ct.ahsv.hue == 36000 ? 0 : ct.ahsv.hue / 6000.; + const qreal h = ct.ahsv.hue == 36000 ? 0 : ct.ahsv.hue / qreal(6000.); const qreal s = ct.ahsv.saturation / qreal(USHRT_MAX); const qreal v = ct.ahsv.value / qreal(USHRT_MAX); const int i = int(h); @@ -1638,7 +1638,7 @@ QColor QColor::toRgb() const color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0; } else { // chromatic case - const qreal h = ct.ahsl.hue == 36000 ? 0 : ct.ahsl.hue / 36000.; + const qreal h = ct.ahsl.hue == 36000 ? 0 : ct.ahsl.hue / qreal(36000.); const qreal s = ct.ahsl.saturation / qreal(USHRT_MAX); const qreal l = ct.ahsl.lightness / qreal(USHRT_MAX); diff --git a/src/gui/painting/qgraphicssystemex_symbian.cpp b/src/gui/painting/qgraphicssystemex_symbian.cpp index 4469704668..32e040fdc8 100644 --- a/src/gui/painting/qgraphicssystemex_symbian.cpp +++ b/src/gui/painting/qgraphicssystemex_symbian.cpp @@ -46,31 +46,108 @@ #include <e32property.h> +#ifdef Q_SYMBIAN_SUPPORTS_SURFACES +#include "private/qegl_p.h" +#endif + QT_BEGIN_NAMESPACE static bool bcm2727Initialized = false; static bool bcm2727 = false; +#ifdef Q_SYMBIAN_SUPPORTS_SURFACES +typedef EGLBoolean (*NOK_resource_profiling)(EGLDisplay, EGLint, EGLint*, EGLint, EGLint*); +#define EGL_PROF_TOTAL_MEMORY_NOK 0x3070 +#endif + +// Detect if Qt is running on BCM2727 chip. +// BCM2727 is a special case on Symbian because +// it has only 32MB GPU memory which exposes +// significant limitations to hw accelerated UI. bool QSymbianGraphicsSystemEx::hasBCM2727() { if (bcm2727Initialized) return bcm2727; - const TUid KIvePropertyCat = {0x2726beef}; - enum TIvePropertyChipType { - EVCBCM2727B1 = 0x00000000, - EVCBCM2763A0 = 0x04000100, - EVCBCM2763B0 = 0x04000102, - EVCBCM2763C0 = 0x04000103, - EVCBCM2763C1 = 0x04000104, - EVCBCMUnknown = 0x7fffffff - }; - - TInt chipType = EVCBCMUnknown; - if (RProperty::Get(KIvePropertyCat, 0, chipType) == KErrNone) { - if (chipType == EVCBCM2727B1) +#ifdef Q_SYMBIAN_SUPPORTS_SURFACES + EGLDisplay display = QEgl::display(); +#if 1 + // Hacky but fast ~0ms. + const char* vendor = eglQueryString(display, EGL_VENDOR); + if (strstr(vendor, "Broadcom")) { + const TUid KIvePropertyCat = {0x2726beef}; + enum TIvePropertyChipType { + EVCBCM2727B1 = 0x00000000, + EVCBCM2763A0 = 0x04000100, + EVCBCM2763B0 = 0x04000102, + EVCBCM2763C0 = 0x04000103, + EVCBCM2763C1 = 0x04000104, + EVCBCMUnknown = 0x7fffffff + }; + + // Broadcom driver publishes KIvePropertyCat PS key on + // devices which are running on BCM2727 chip and post Anna Symbian. + TInt chipType = EVCBCMUnknown; + if (RProperty::Get(KIvePropertyCat, 0, chipType) == KErrNone) { + if (chipType == EVCBCM2727B1) + bcm2727 = true; + } else if (QSysInfo::symbianVersion() <= QSysInfo::SV_SF_3) { + // Device is running on Symbian Anna or older Symbian^3 in which + // KIvePropertyCat is not published. These ones are always 32MB devices. + bcm2727 = true; + } else { + // We have some other Broadcom chip on post Anna Symbian. + // Should have > 32MB GPU memory. + } + } +#else + // Fool proof but takes 15-20ms and we don't want this delay on app startup... + + // All devices with <= 32MB GPU memory should be + // dealed in similar manner to BCM2727 + // So let's query max GPU memory amount. + NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK"); + if (eglQueryProfilingData) { + EGLint dataCount; + eglQueryProfilingData(display, + EGL_PROF_QUERY_GLOBAL_BIT_NOK | + EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK, + NULL, + 0, + (EGLint*)&dataCount); + + // Allocate room for the profiling data + EGLint* profData = (EGLint*)malloc(dataCount * sizeof(EGLint)); + memset(profData,0,dataCount * sizeof(EGLint)); + + // Retrieve the profiling data + eglQueryProfilingData(display, + EGL_PROF_QUERY_GLOBAL_BIT_NOK | + EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK, + profData, + dataCount, + (EGLint*)&dataCount); + + int totalMemory; + EGLint i = 0; + while (profData && i < dataCount) { + switch (profData[i++]) { + case EGL_PROF_TOTAL_MEMORY_NOK: + totalMemory = profData[i++]; + break; + default: + i++; + } + } + + // ok, hasBCM2727() naming is a bit misleading but Qt must + // behave the same on all chips like BCM2727 (<= 32MB GPU memory) + // and our code (and others) are already using this function. + if (totalMemory <= 33554432) bcm2727 = true; } +#endif +#endif // Q_SYMBIAN_SUPPORTS_SURFACES bcm2727Initialized = true; @@ -80,7 +157,9 @@ bool QSymbianGraphicsSystemEx::hasBCM2727() void QSymbianGraphicsSystemEx::releaseCachedGpuResources() { // Do nothing here - // This is implemented in graphics system specific plugin + + // This virtual function should be implemented in graphics system specific + // plugin } void QSymbianGraphicsSystemEx::releaseAllGpuResources() diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index bcc5f9d9b7..0fea2daf08 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1649,8 +1649,8 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) if (lines[i].p1() == lines[i].p2()) { if (s->lastPen.capStyle() != Qt::FlatCap) { QPointF p = lines[i].p1(); - QLineF line = s->matrix.map(QLineF(QPointF(p.x() - width*0.5, p.y()), - QPointF(p.x() + width*0.5, p.y()))); + QLineF line = s->matrix.map(QLineF(QPointF(p.x() - width*qreal(0.5), p.y()), + QPointF(p.x() + width*qreal(0.5), p.y()))); d->rasterizer->rasterizeLine(line.p1(), line.p2(), 1); } continue; @@ -5117,7 +5117,7 @@ static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, { const qreal a = qreal(rect.width()) / 2; const qreal b = qreal(rect.height()) / 2; - qreal d = b*b - (a*a*b) + 0.25*a*a; + qreal d = b*b - (a*a*b) + qreal(0.25)*a*a; int x = 0; int y = (rect.height() + 1) / 2; @@ -5140,7 +5140,7 @@ static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, pen_func, brush_func, pen_data, brush_data); // region 2 - d = b*b*(x + 0.5)*(x + 0.5) + a*a*((y - 1)*(y - 1) - b*b); + d = b*b*(x + qreal(0.5))*(x + qreal(0.5)) + a*a*((y - 1)*(y - 1) - b*b); const int miny = rect.height() & 0x1; while (y > miny) { if (d < 0) { // select SE diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 6df410b27d..eaedc4c8b4 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -748,8 +748,8 @@ void QPaintEngineEx::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yR qreal y2 = rect.bottom(); if (mode == Qt::RelativeSize) { - xRadius = xRadius * rect.width() / 200.; - yRadius = yRadius * rect.height() / 200.; + xRadius = xRadius * rect.width() / qreal(200.); + yRadius = yRadius * rect.height() / qreal(200.); } xRadius = qMin(xRadius, rect.width() / 2); @@ -863,7 +863,7 @@ void QPaintEngineEx::drawPoints(const QPointF *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/qreal(63.); pts[++oset] = points[i].y(); } QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint); @@ -873,7 +873,7 @@ void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount) } } else { for (int i=0; i<pointCount; ++i) { - qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 1/63., points[i].y() }; + qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 1/qreal(63.), points[i].y() }; QVectorPath path(pts, 2, 0); stroke(path, pen); } @@ -894,7 +894,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/qreal(63.); pts[++oset] = points[i].y(); } QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint); @@ -905,7 +905,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount) } else { for (int i=0; i<pointCount; ++i) { qreal pts[] = { qreal(points[i].x()), qreal(points[i].y()), - qreal(points[i].x() +1/63.), qreal(points[i].y()) }; + qreal(points[i].x() +1/qreal(63.)), qreal(points[i].y()) }; QVectorPath path(pts, 2, 0); stroke(path, pen); } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index efb016e9e2..fb5ce96ec7 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -403,8 +403,8 @@ void QPainterPrivate::draw_helper(const QPainterPath &originalPath, DrawOperatio QPainterPath stroke = stroker.createStroke(originalPath); strokeBounds = (stroke * state->matrix).boundingRect(); } else { - strokeOffsetX = qAbs(penWidth * state->matrix.m11() / 2.0); - strokeOffsetY = qAbs(penWidth * state->matrix.m22() / 2.0); + strokeOffsetX = qAbs(penWidth * state->matrix.m11() / qreal(2.0)); + strokeOffsetY = qAbs(penWidth * state->matrix.m22() / qreal(2.0)); } } } @@ -4460,8 +4460,8 @@ void QPainter::drawArc(const QRectF &r, int a, int alen) QRectF rect = r.normalized(); QPainterPath path; - path.arcMoveTo(rect, a/16.0); - path.arcTo(rect, a/16.0, alen/16.0); + path.arcMoveTo(rect, a/qreal(16.0)); + path.arcTo(rect, a/qreal(16.0), alen/qreal(16.0)); strokePath(path, d->state->pen); } @@ -4531,7 +4531,7 @@ void QPainter::drawPie(const QRectF &r, int a, int alen) QPainterPath path; path.moveTo(rect.center()); - path.arcTo(rect.x(), rect.y(), rect.width(), rect.height(), a/16.0, alen/16.0); + path.arcTo(rect.x(), rect.y(), rect.width(), rect.height(), a/qreal(16.0), alen/qreal(16.0)); path.closeSubpath(); drawPath(path); @@ -4592,8 +4592,8 @@ void QPainter::drawChord(const QRectF &r, int a, int alen) QRectF rect = r.normalized(); QPainterPath path; - path.arcMoveTo(rect, a/16.0); - path.arcTo(rect, a/16.0, alen/16.0); + path.arcMoveTo(rect, a/qreal(16.0)); + path.arcTo(rect, a/qreal(16.0), alen/qreal(16.0)); path.closeSubpath(); drawPath(path); } @@ -9242,7 +9242,7 @@ void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragment 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 + xOffset, -0.5 * h + yOffset, w, h), pixmap, sourceRect); + drawPixmap(QRectF(qreal(-0.5) * w + xOffset, qreal(-0.5) * h + yOffset, w, h), pixmap, sourceRect); } setOpacity(oldOpacity); diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 1d3f581b88..ca10e6aa68 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -51,8 +51,8 @@ QT_BEGIN_NAMESPACE typedef int Q16Dot16; -#define Q16Dot16ToFloat(i) ((i)/65536.) -#define FloatToQ16Dot16(i) (int)((i) * 65536.) +#define Q16Dot16ToFloat(i) ((i)/qreal(65536.)) +#define FloatToQ16Dot16(i) (int)((i) * qreal(65536.)) #define IntToQ16Dot16(i) ((i) << 16) #define Q16Dot16ToInt(i) ((i) >> 16) #define Q16Dot16Factor 65536 @@ -701,7 +701,7 @@ static Q16Dot16 intersectPixelFP(int x, Q16Dot16 top, Q16Dot16 bottom, Q16Dot16 static inline bool q26Dot6Compare(qreal p1, qreal p2) { - return int((p2 - p1) * 64.) == 0; + return int((p2 - p1) * qreal(64.)) == 0; } static inline qreal qFloorF(qreal v) @@ -1210,8 +1210,8 @@ void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule) QRectF bounds = path.controlPointRect(); - int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5 + (COORD_OFFSET - COORD_ROUNDING)/64.)); - int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5 + (COORD_OFFSET - COORD_ROUNDING)/64.)); + int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + qreal(0.5) + (COORD_OFFSET - COORD_ROUNDING)/qreal(64.))); + int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - qreal(0.5) + (COORD_OFFSET - COORD_ROUNDING)/qreal(64.))); if (iTopBound > iBottomBound) return; diff --git a/src/gui/painting/qtessellator.cpp b/src/gui/painting/qtessellator.cpp index 94a5128d90..15e4f65469 100644 --- a/src/gui/painting/qtessellator.cpp +++ b/src/gui/painting/qtessellator.cpp @@ -1400,7 +1400,7 @@ void QTessellator::tessellateRect(const QPointF &a_, const QPointF &b_, qreal wi if (delta.x == 0 && delta.y == 0) return; - qreal hw = 0.5 * width; + qreal hw = qreal(0.5) * width; if (delta.x == 0) { Q27Dot5 halfWidth = FloatToQ27Dot5(hw); diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 15ff044977..2a25bff712 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -254,8 +254,9 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi } else #endif { + int depth = widget->x11Info().depth(); const QImage &src = d->image->image; - if (src.format() != QImage::Format_RGB32 || widget->x11Info().depth() < 24) { + if (src.format() != QImage::Format_RGB32 || depth < 24 || X11->bppForDepth.value(depth) != 32) { Q_ASSERT(src.depth() >= 16); const QImage sub_src(src.scanLine(br.y()) + br.x() * (uint(src.depth()) / 8), br.width(), br.height(), src.bytesPerLine(), src.format()); @@ -267,7 +268,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi } else { // qpaintengine_x11.cpp extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth); - qt_x11_drawImage(br, wpos, src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth()); + qt_x11_drawImage(br, wpos, src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), depth); } } diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index eec2d15ca7..59bd0dd657 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1679,7 +1679,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafBarWaitAnim, painter, progressRect, flags | orientationFlag | QS60StylePrivate::SF_Animation ); } else { - const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? 1.0 + const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? qreal(1.0) : (qreal)optionProgressBar->progress / optionProgressBar->maximum; const int frameWidth = pixelMetric(PM_DefaultFrameWidth, option, widget); if (optionProgressBar->orientation == Qt::Horizontal) { @@ -2010,7 +2010,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (focusFrame->widget() && focusFrame->widget()->hasEditFocus()) editFocus = true; } - const qreal opacity = editFocus ? 1 : 0.75; // Trial and error factors. Feel free to improve. + const qreal opacity = editFocus ? 1 : qreal(0.75); // Trial and error factors. Feel free to improve. #else const qreal opacity = 0.85; #endif @@ -2148,8 +2148,8 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_IndicatorRadioButton: { QRect buttonRect = option->rect; //there is empty (a. 33%) space in svg graphics for radiobutton - const qreal reduceWidth = (qreal)buttonRect.width() / 3.0; - const qreal rectWidth = (qreal)option->rect.width() != 0 ? option->rect.width() : 1.0; + const qreal reduceWidth = (qreal)buttonRect.width() / qreal(3.0); + const qreal rectWidth = (qreal)option->rect.width() != 0 ? option->rect.width() : qreal(1.0); // Try to occupy the full area const qreal scaler = 1 + (reduceWidth/rectWidth); buttonRect.setWidth((int)((buttonRect.width()-reduceWidth) * scaler)); diff --git a/src/gui/styles/qstylefactory.cpp b/src/gui/styles/qstylefactory.cpp index 83b67484b8..de693db35b 100644 --- a/src/gui/styles/qstylefactory.cpp +++ b/src/gui/styles/qstylefactory.cpp @@ -225,12 +225,12 @@ QStringList QStyleFactory::keys() #endif #ifndef QT_NO_STYLE_WINDOWSXP if (!list.contains(QLatin1String("WindowsXP")) && - (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) list << QLatin1String("WindowsXP"); #endif #ifndef QT_NO_STYLE_WINDOWSVISTA if (!list.contains(QLatin1String("WindowsVista")) && - (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) list << QLatin1String("WindowsVista"); #endif #ifndef QT_NO_STYLE_MOTIF diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 7d2ed2af8c..c066631c3d 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -1247,20 +1247,20 @@ QPainterPath QRenderRule::borderClip(QRect r) const QRectF rect(r); const int *borders = border()->borders; QPainterPath path; - qreal curY = rect.y() + borders[TopEdge]/2.0; + qreal curY = rect.y() + borders[TopEdge]/qreal(2.0); path.moveTo(rect.x() + tlr.width(), curY); path.lineTo(rect.right() - trr.width(), curY); - qreal curX = rect.right() - borders[RightEdge]/2.0; + qreal curX = rect.right() - borders[RightEdge]/qreal(2.0); path.arcTo(curX - 2*trr.width() + borders[RightEdge], curY, trr.width()*2 - borders[RightEdge], trr.height()*2 - borders[TopEdge], 90, -90); path.lineTo(curX, rect.bottom() - brr.height()); - curY = rect.bottom() - borders[BottomEdge]/2.0; + curY = rect.bottom() - borders[BottomEdge]/qreal(2.0); path.arcTo(curX - 2*brr.width() + borders[RightEdge], curY - 2*brr.height() + borders[BottomEdge], brr.width()*2 - borders[RightEdge], brr.height()*2 - borders[BottomEdge], 0, -90); path.lineTo(rect.x() + blr.width(), curY); - curX = rect.left() + borders[LeftEdge]/2.0; + curX = rect.left() + borders[LeftEdge]/qreal(2.0); path.arcTo(curX, rect.bottom() - 2*blr.height() + borders[BottomEdge]/2, blr.width()*2 - borders[LeftEdge], blr.height()*2 - borders[BottomEdge], 270, -90); @@ -3810,7 +3810,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q if (inverted) reverse = !reverse; const bool indeterminate = pb->minimum == pb->maximum; - qreal fillRatio = indeterminate ? 0.50 : qreal(progress - minimum)/(maximum - minimum); + qreal fillRatio = indeterminate ? qreal(0.50) : qreal(progress - minimum)/(maximum - minimum); int fillWidth = int(rect.width() * fillRatio); int chunkWidth = fillWidth; if (subRule.hasContentsSize()) { diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 9732c7eba9..342c4c6184 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -125,7 +125,7 @@ QWindowsStylePrivate::QWindowsStylePrivate() { #if defined(Q_WS_WIN) && !defined(Q_OS_WINCE) if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) { + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { QSystemLibrary shellLib(QLatin1String("shell32")); pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo"); } @@ -1058,7 +1058,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl case SP_VistaShield: { if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) && pSHGetStockIconInfo) { QPixmap pixmap; @@ -1200,7 +1200,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid case SH_LineEdit_PasswordCharacter: { #ifdef Q_WS_WIN - if (widget && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) { + if (widget && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { const QFontMetrics &fm = widget->fontMetrics(); if (fm.inFont(QChar(0x25CF))) ret = 0x25CF; @@ -3362,7 +3362,7 @@ QIcon QWindowsStyle::standardIconImplementation(StandardPixmap standardIcon, con case SP_VistaShield: { if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) && pSHGetStockIconInfo) { icon.addPixmap(proxy()->standardPixmap(SP_VistaShield, option, widget)); //fetches small icon diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index b894eb43a0..997d429add 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -140,7 +140,7 @@ bool QWindowsVistaStylePrivate::useVista() { return (QWindowsVistaStylePrivate::useXP() && (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && - QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)); + (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))); } /*! diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 3c33df3d11..343f262483 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -791,7 +791,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa inspectData = (tmt_transparentcolor != 0 || tmt_borderonly || proporigin == PO_PART || proporigin == PO_STATE); // ### This is a vista-specific workaround for broken alpha in titlebar pixmaps - if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) { + if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { if (themeData.partId == WP_CAPTION || themeData.partId == WP_SMALLCAPTION) inspectData = false; } diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 1d463c47b2..796c455d37 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -1994,7 +1994,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family, const QtFontSize *size = style->pixelSizes + l; if (size->pixelSize != 0 && size->pixelSize != USHRT_MAX) { - const uint pointSize = qRound(size->pixelSize * 72.0 / dpi); + const uint pointSize = qRound(size->pixelSize * qreal(72.0) / dpi); if (! sizes.contains(pointSize)) sizes.append(pointSize); } @@ -2105,7 +2105,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family, const QtFontSize *size = style->pixelSizes + l; if (size->pixelSize != 0 && size->pixelSize != USHRT_MAX) { - const uint pointSize = qRound(size->pixelSize * 72.0 / dpi); + const uint pointSize = qRound(size->pixelSize * qreal(72.0) / dpi); if (! sizes.contains(pointSize)) sizes.append(pointSize); } diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index c9b672bb89..8f46a805cc 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -381,9 +381,9 @@ void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rig glyph_metrics_t gi = boundingBox(glyph); bool isValid = gi.isValid(); if (leftBearing != 0) - *leftBearing = isValid ? gi.x.toReal() : 0.0; + *leftBearing = isValid ? gi.x.toReal() : qreal(0.0); if (rightBearing != 0) - *rightBearing = isValid ? (gi.xoff - gi.x - gi.width).toReal() : 0.0; + *rightBearing = isValid ? (gi.xoff - gi.x - gi.width).toReal() : qreal(0.0); } glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index e20aa2556b..d00a04814c 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -801,7 +801,7 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags, if (set && set->outline_drawing) load_flags = FT_LOAD_NO_BITMAP; - if (default_hint_style == HintNone || (flags & HB_ShaperFlag_UseDesignMetrics) || set->outline_drawing) + if (default_hint_style == HintNone || (flags & HB_ShaperFlag_UseDesignMetrics) || (set && set->outline_drawing)) load_flags |= FT_LOAD_NO_HINTING; else load_flags |= load_target; diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 143dc1ab8c..de2e27ad2e 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -159,7 +159,7 @@ bool Qt::mightBeRichText(const QString& text) QString Qt::escape(const QString& plain) { QString rich; - rich.reserve(int(plain.length() * 1.1)); + rich.reserve(int(plain.length() * qreal(1.1))); for (int i = 0; i < plain.length(); ++i) { if (plain.at(i) == QLatin1Char('<')) rich += QLatin1String("<"); diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index d58da37974..0af2e59c54 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -445,6 +445,8 @@ void QLineControl::moveCursor(int pos, bool mark) void QLineControl::processInputMethodEvent(QInputMethodEvent *event) { int priorState = 0; + int originalSelectionStart = m_selstart; + int originalSelectionEnd = m_selend; bool isGettingInput = !event->commitString().isEmpty() || event->preeditString() != preeditAreaText() || event->replacementLength() > 0; @@ -523,6 +525,8 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) } m_textLayout.setAdditionalFormats(formats); updateDisplayText(/*force*/ true); + if (originalSelectionStart != m_selstart || originalSelectionEnd != m_selend) + emit selectionChanged(); if (cursorPositionChanged) emitCursorPositionChanged(); else if (m_preeditCursor != oldPreeditCursor) diff --git a/src/gui/widgets/qprogressbar.cpp b/src/gui/widgets/qprogressbar.cpp index dd92bda993..1b0a1a118c 100644 --- a/src/gui/widgets/qprogressbar.cpp +++ b/src/gui/widgets/qprogressbar.cpp @@ -462,7 +462,7 @@ QString QProgressBar::text() const return result; } - int progress = (qreal(d->value) - d->minimum) * 100.0 / totalSteps; + int progress = (qreal(d->value) - d->minimum) * qreal(100.0) / totalSteps; result.replace(QLatin1String("%p"), QString::number(progress)); return result; } diff --git a/src/gui/widgets/qtextbrowser.cpp b/src/gui/widgets/qtextbrowser.cpp index cd8fa117b7..e786c5cef9 100644 --- a/src/gui/widgets/qtextbrowser.cpp +++ b/src/gui/widgets/qtextbrowser.cpp @@ -619,7 +619,8 @@ void QTextBrowserPrivate::restoreHistoryEntry(const HistoryEntry entry) If you want to load documents stored in the Qt resource system use \c{qrc} as the scheme in the URL to load. For example, for the document resource path \c{:/docs/index.html} use \c{qrc:/docs/index.html} as - the URL with setSource(). + the URL with setSource(). To access local files, use \c{file} as the + scheme in the URL. \sa QTextEdit, QTextDocument */ diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index e0e8ce603a..c7ae73fe79 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -440,7 +440,7 @@ void QToolBarPrivate::plug(const QRect &r) pop up a menu containing the items that does not currently fit in the toolbar. - When a QToolBar is not a child of a QMainWindow, it looses the ability + When a QToolBar is not a child of a QMainWindow, it loses the ability to populate the extension pop up with widgets added to the toolbar using addWidget(). Please use widget actions created by inheriting QWidgetAction and implementing QWidgetAction::createWidget() instead. diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 1a02200572..6173b39ff9 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -891,7 +891,7 @@ bool QHttpNetworkReplyPrivate::expectContent() || statusCode == 204 || statusCode == 304) return false; if (request.operation() == QHttpNetworkRequest::Head) - return !shouldEmitSignals(); + return false; // no body expected for HEAD request qint64 expectedContentLength = contentLength(); if (expectedContentLength == 0) return false; diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 2fae7d6624..88c45d197b 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -57,20 +57,25 @@ QT_BEGIN_NAMESPACE -static bool factoryDataShutdown = false; class QNetworkAccessBackendFactoryData: public QList<QNetworkAccessBackendFactory *> { public: - QNetworkAccessBackendFactoryData() : mutex(QMutex::Recursive) { } + QNetworkAccessBackendFactoryData() : mutex(QMutex::Recursive) + { + valid.ref(); + } ~QNetworkAccessBackendFactoryData() { QMutexLocker locker(&mutex); // why do we need to lock? - factoryDataShutdown = true; + valid.deref(); } QMutex mutex; + //this is used to avoid (re)constructing factory data from destructors of other global classes + static QAtomicInt valid; }; Q_GLOBAL_STATIC(QNetworkAccessBackendFactoryData, factoryData) +QAtomicInt QNetworkAccessBackendFactoryData::valid; QNetworkAccessBackendFactory::QNetworkAccessBackendFactory() { @@ -80,7 +85,7 @@ QNetworkAccessBackendFactory::QNetworkAccessBackendFactory() QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory() { - if (!factoryDataShutdown) { + if (QNetworkAccessBackendFactoryData::valid) { QMutexLocker locker(&factoryData()->mutex); factoryData()->removeAll(this); } @@ -89,7 +94,7 @@ QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory() QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request) { - if (!factoryDataShutdown) { + if (QNetworkAccessBackendFactoryData::valid) { QMutexLocker locker(&factoryData()->mutex); QNetworkAccessBackendFactoryData::ConstIterator it = factoryData()->constBegin(), end = factoryData()->constEnd(); diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index ff0530633f..7f6aff9b79 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -110,9 +110,7 @@ public: // socket). virtual void open() = 0; -#ifndef QT_NO_BEARERMANAGEMENT virtual bool start(); -#endif virtual void closeDownstreamChannel() = 0; // slot-like: diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 06707385fb..a9bb318295 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -372,7 +372,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi // parse the first part, before the equal sign for (i = position; i < length; ++i) { register char c = text.at(i); - if (c == ';' || c == ',' || c == '=') + if (c == ';' || c == '=') break; } @@ -423,7 +423,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi for ( ; i < length; ++i) { register char c = text.at(i); - if (c == ',' || c == ';') + if (c == ';') break; } position = i; @@ -434,7 +434,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi register char c = text.at(i); // for name value pairs, we want to parse until reaching the next ';' // and not break when reaching a space char - if (c == ',' || c == ';' || ((isNameValue && (c == '\n' || c == '\r')) || (!isNameValue && isLWS(c)))) + if (c == ';' || ((isNameValue && (c == '\n' || c == '\r')) || (!isNameValue && isLWS(c)))) break; } @@ -461,8 +461,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi \value Full makes toRawForm() return the full cookie contents, as suitable for sending to a client in a - server's "Set-Cookie:" header. Multiple cookies are separated - by commas in a "Set-Cookie:" header. + server's "Set-Cookie:" header. Note that only the Full form of the cookie can be parsed back into its original contents. @@ -488,7 +487,6 @@ QByteArray QNetworkCookie::toRawForm(RawForm form) const result = d->name; result += '='; if ((d->value.contains(';') || - d->value.contains(',') || d->value.contains('"')) && (!d->value.startsWith('"') && !d->value.endsWith('"'))) { @@ -967,14 +965,8 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt cookie.setValue(field.second); position = nextNonWhitespace(cookieString, position); - bool endOfCookie = false; - while (!endOfCookie && position < length) { + while (position < length) { switch (cookieString.at(position++)) { - case ',': - // end of the cookie - endOfCookie = true; - break; - case ';': // new field in the cookie field = nextField(cookieString, position, false); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 0b568d4d24..6f2daecdf0 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -471,6 +471,7 @@ bool QNetworkReplyImplPrivate::isCachingEnabled() const void QNetworkReplyImplPrivate::setCachingEnabled(bool enable) { + Q_Q(QNetworkReplyImpl); if (!enable && !cacheEnabled) return; // nothing to do if (enable && cacheEnabled) @@ -493,15 +494,27 @@ void QNetworkReplyImplPrivate::setCachingEnabled(bool enable) networkCache()->remove(url); cacheSaveDevice = 0; cacheEnabled = false; + QObject::disconnect(networkCache(), SIGNAL(destroyed()), q, SLOT(_q_cacheDestroyed())); } } +void QNetworkReplyImplPrivate::_q_cacheDestroyed() +{ + //destruction of cache invalidates cacheSaveDevice + cacheSaveDevice = 0; + cacheEnabled = false; +} + void QNetworkReplyImplPrivate::completeCacheSave() { - if (cacheEnabled && errorCode != QNetworkReplyImpl::NoError) { - networkCache()->remove(url); - } else if (cacheEnabled && cacheSaveDevice) { - networkCache()->insert(cacheSaveDevice); + Q_Q(QNetworkReplyImpl); + if (cacheEnabled) { + if (errorCode != QNetworkReplyImpl::NoError) { + networkCache()->remove(url); + } else if (cacheSaveDevice) { + networkCache()->insert(cacheSaveDevice); + } + QObject::disconnect(networkCache(), SIGNAL(destroyed()), q, SLOT(_q_cacheDestroyed())); } cacheSaveDevice = 0; cacheEnabled = false; @@ -561,6 +574,8 @@ void QNetworkReplyImplPrivate::initCacheSaveDevice() networkCache()->remove(url); cacheSaveDevice = 0; cacheEnabled = false; + } else { + q->connect(networkCache(), SIGNAL(destroyed()), SLOT(_q_cacheDestroyed())); } } diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 089c87e693..286d8eaf5e 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -104,6 +104,7 @@ public: Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed()) #endif + Q_PRIVATE_SLOT(d_func(), void _q_cacheDestroyed()) }; class QNetworkReplyImplPrivate: public QNetworkReplyPrivate @@ -140,6 +141,7 @@ public: void _q_networkSessionConnected(); void _q_networkSessionFailed(); #endif + void _q_cacheDestroyed(); void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData); diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 18e29afd7a..96a534d60d 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -60,7 +60,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, #endif QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() - : QObject(), pollTimer(0), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true) + : QObject(), pollTimer(0), bearerThread(0), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true) { qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration"); qRegisterMetaType<QNetworkConfigurationPrivatePointer>("QNetworkConfigurationPrivatePointer"); diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index 6fc5b7bd24..10528634db 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -97,14 +97,15 @@ static void resolveLibrary() #if defined(Q_OS_WINCE) #include <qmutex.h> -QMutex qPrivCEMutex; +Q_GLOBAL_STATIC(QMutex, qPrivCEMutex) #endif QHostInfo QHostInfoAgent::fromName(const QString &hostName) { #if defined(Q_OS_WINCE) - QMutexLocker locker(&qPrivCEMutex); + QMutexLocker locker(qPrivCEMutex()); #endif + QWindowsSockInit winSock; // Load res_init on demand. diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index cedccaa69b..423fa08a1f 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -103,6 +103,7 @@ #ifdef Q_OS_SYMBIAN #include <private/qgltexturepool_p.h> +#include <private/qeglcontext_p.h> #endif // #define QT_GL_CONTEXT_RESOURCE_DEBUG @@ -3432,8 +3433,25 @@ const QGLContext* QGLContext::currentContext() return 0; #else QGLThreadContext *threadContext = qgl_context_storage.localData(); - if (threadContext) + if (threadContext) { +#ifdef Q_OS_SYMBIAN + // Query the current context and return null if it is different. + // This is needed to support mixed VG-GL rendering. + // QtOpenVG is free to make a QEglContext current at any time and + // QGLContext gets no notification that its underlying QEglContext is + // not current anymore. We query directly from EGL to be thread-safe. + // QEglContext does not store all the contexts per-thread. + if (threadContext->context) { + QEglContext *eglcontext = threadContext->context->d_func()->eglContext; + if (eglcontext) { + EGLContext ctx = eglcontext->context(); + if (ctx != eglGetCurrentContext()) + return 0; + } + } +#endif return threadContext->context; + } return 0; #endif //Q_WS_QPA } diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index be0929543b..34375020ff 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -4879,4 +4879,9 @@ EXPORTS ?languageId@QLocalePrivate@@QBEGXZ @ 4878 NONAME ; unsigned short QLocalePrivate::languageId(void) const ?started@QFutureWatcherBase@@IAEXXZ @ 4879 NONAME ; void QFutureWatcherBase::started(void) ?staticMetaObjectExtraData@QAbstractState@@0UQMetaObjectExtraData@@B @ 4880 NONAME ; struct QMetaObjectExtraData const QAbstractState::staticMetaObjectExtraData + ?rebuildInstallLibraryPaths@QCoreApplicationPrivate@@SAXXZ @ 4881 NONAME ; void QCoreApplicationPrivate::rebuildInstallLibraryPaths(void) + ?connectNotify@QFutureWatcherBase@@MAEXPBD@Z @ 4882 NONAME ; void QFutureWatcherBase::connectNotify(char const *) + ?event@QFutureWatcherBase@@UAE_NPAVQEvent@@@Z @ 4883 NONAME ; bool QFutureWatcherBase::event(class QEvent *) + ?updateDir@QFactoryLoader@@QAEXABVQString@@AAVQSettings@@@Z @ 4884 NONAME ; void QFactoryLoader::updateDir(class QString const &, class QSettings &) + ?disconnectNotify@QFutureWatcherBase@@MAEXPBD@Z @ 4885 NONAME ; void QFutureWatcherBase::disconnectNotify(char const *) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 16de776c58..335b94f3f1 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -13983,4 +13983,7 @@ EXPORTS ?qt_static_metacall@QShortcut@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13982 NONAME ; void QShortcut::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) ?endOfLine@QTextEngine@@AAEHH@Z @ 13983 NONAME ; int QTextEngine::endOfLine(int) ?queryKeyboardModifiers@QApplication@@SA?AV?$QFlags@W4KeyboardModifier@Qt@@@@XZ @ 13984 NONAME ; class QFlags<enum Qt::KeyboardModifier> QApplication::queryKeyboardModifiers(void) + ?resetFontEngineCache@QTextEngine@@QAEXXZ @ 13985 NONAME ; void QTextEngine::resetFontEngineCache(void) + ?symbianHandleLiteModeStartup@QApplicationPrivate@@QAEXXZ @ 13986 NONAME ; void QApplicationPrivate::symbianHandleLiteModeStartup(void) + ?_q_cleanupWinIds@QWidgetPrivate@@QAEXXZ @ 13987 NONAME ; void QWidgetPrivate::_q_cleanupWinIds(void) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index cf42b679d3..1fabdb295e 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -4162,4 +4162,6 @@ EXPORTS inflateReset2 @ 4161 NONAME inflateUndermine @ 4162 NONAME zlibCompileFlags @ 4163 NONAME + _ZN14QFactoryLoader9updateDirERK7QStringR9QSettings @ 4164 NONAME + _ZN23QCoreApplicationPrivate26rebuildInstallLibraryPathsEv @ 4165 NONAME diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 4133773ccf..3606f9cb98 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12796,4 +12796,7 @@ EXPORTS _ZTV20QBlittablePixmapData @ 12795 NONAME _Zls6QDebugPK13QSymbianEvent @ 12796 NONAME _ZN12QApplication22queryKeyboardModifiersEv @ 12797 NONAME + _ZN11QTextEngine20resetFontEngineCacheEv @ 12798 NONAME + _ZN14QWidgetPrivate16_q_cleanupWinIdsEv @ 12799 NONAME + _ZN19QApplicationPrivate28symbianHandleLiteModeStartupEv @ 12800 NONAME diff --git a/src/s60installs/qt_resources.iby b/src/s60installs/qt_resources.iby new file mode 100644 index 0000000000..f5fe1c4c20 --- /dev/null +++ b/src/s60installs/qt_resources.iby @@ -0,0 +1,11 @@ +#ifndef QT_RESOURCES_IBY +#define QT_RESOURCES_IBY + +#include <data_caging_paths_for_iby.hrh> + +// Localisation files + +data=DATAZ_\QT_TRANSLATIONS_DIR\qt.qm QT_TRANSLATIONS_DIR\qt.qm + +#endif // __QT_RESOURCES_IBY__ + diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index c2b462c313..08c4829462 100755 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -175,4 +175,5 @@ symbian: { } BLD_INF_RULES.prj_exports += "$$S60_INSTALLS_SOURCE_DIR/qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" + BLD_INF_RULES.prj_exports += "$$S60_INSTALLS_SOURCE_DIR/qt_resources.iby $$LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(qt_resources.iby)" } diff --git a/src/sql/drivers/symsql/qsql_symsql.cpp b/src/sql/drivers/symsql/qsql_symsql.cpp index 4ceac9b67b..f34212c2da 100644 --- a/src/sql/drivers/symsql/qsql_symsql.cpp +++ b/src/sql/drivers/symsql/qsql_symsql.cpp @@ -217,7 +217,7 @@ void QSymSQLResultPrivate::initColumns(QSqlRecord& rec) int nCols = stmt.ColumnCount(); if (nCols <= 0) { q->setLastError(qMakeError(access, QCoreApplication::translate("QSymSQLResult", - "Error retreving column count"), QSqlError::UnknownError, nCols)); + "Error retrieving column count"), QSqlError::UnknownError, nCols)); return; } @@ -227,7 +227,7 @@ void QSymSQLResultPrivate::initColumns(QSqlRecord& rec) if (err != KErrNone) { q->setLastError(qMakeError(access, QCoreApplication::translate("QSymSQLResult", - "Error retreving column name"), QSqlError::UnknownError, err)); + "Error retrieving column name"), QSqlError::UnknownError, err)); return; } @@ -240,7 +240,7 @@ void QSymSQLResultPrivate::initColumns(QSqlRecord& rec) if (err != KErrNone) { q->setLastError(qMakeError(access, QCoreApplication::translate("QSymSQLResult", - "Error retreving column type"), QSqlError::UnknownError, err)); + "Error retrieving column type"), QSqlError::UnknownError, err)); return; } diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp index e69fe508d8..e5e901d315 100644 --- a/src/xmlpatterns/api/qxmlquery.cpp +++ b/src/xmlpatterns/api/qxmlquery.cpp @@ -988,7 +988,12 @@ bool setFocusHelper(QXmlQuery *const queryInstance, const QXmlItem focusItem(focusResult.next()); if(focusItem.isNull() || focusResult.hasError()) + { + /* The previous focus must be cleared in error situations. + * Otherwise the query may be left in an inconsistent state. */ + queryInstance->setFocus(QXmlItem()); return false; + } else { queryInstance->setFocus(focusItem); diff --git a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp index 6215f3d449..3f3dbbb96a 100644 --- a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp +++ b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp @@ -41,6 +41,7 @@ #include <QStack> #include <QStringList> +#include <QFileInfo> #include "qanyuri_p.h" #include "qboolean_p.h" @@ -207,6 +208,21 @@ Item::Iterator::Ptr IdrefFN::evaluateSequence(const DynamicContext::Ptr &context return CommonValues::emptyIterator; /* TODO Haven't implemented further. */ } +/*! + * Attemps to resolve scheme if URL does not have scheme defined. + */ +static QUrl resolveScheme(const QUrl &url) +{ + // On Windows and Symbian the drive letter is detected as the scheme. + if (url.scheme().isEmpty() || (url.scheme().length() == 1)) { + QString filename = url.toString(); + QFileInfo file(filename); + if (file.exists()) + return QUrl::fromLocalFile(filename); + } + return url; +} + Item DocFN::evaluateSingleton(const DynamicContext::Ptr &context) const { const Item itemURI(m_operands.first()->evaluateSingleton(context)); @@ -219,7 +235,7 @@ Item DocFN::evaluateSingleton(const DynamicContext::Ptr &context) const * as part of a workaround for solaris-cc-64. DocFN::typeCheck() is in qsequencefns.cpp * as part of that workaround. */ const QUrl mayRela(AnyURI::toQUrl<ReportContext::FODC0005>(itemURI.stringValue(), context, this)); - const QUrl uri(context->resolveURI(mayRela, staticBaseURI())); + const QUrl uri(resolveScheme(context->resolveURI(mayRela, staticBaseURI()))); Q_ASSERT(uri.isValid()); Q_ASSERT(!uri.isRelative()); @@ -251,7 +267,7 @@ bool DocAvailableFN::evaluateEBV(const DynamicContext::Ptr &context) const /* These two lines are duplicated in DocFN::evaluateSingleton(), as part * of a workaround for solaris-cc-64. */ const QUrl mayRela(AnyURI::toQUrl<ReportContext::FODC0005>(itemURI.stringValue(), context, this)); - const QUrl uri(context->resolveURI(mayRela, staticBaseURI())); + const QUrl uri(resolveScheme(context->resolveURI(mayRela, staticBaseURI()))); Q_ASSERT(!uri.isRelative()); return context->resourceLoader()->isDocumentAvailable(uri); diff --git a/src/xmlpatterns/schema/qxsdtypechecker.cpp b/src/xmlpatterns/schema/qxsdtypechecker.cpp index fb47448691..e5709ae4b2 100644 --- a/src/xmlpatterns/schema/qxsdtypechecker.cpp +++ b/src/xmlpatterns/schema/qxsdtypechecker.cpp @@ -57,6 +57,7 @@ #include "qxsdschemahelper_p.h" #include "qxsdschemamerger_p.h" #include "qxsdstatemachine_p.h" +#include "qabstractfloat_p.h" #include "qxsdschemadebugger_p.h" @@ -697,7 +698,8 @@ bool XsdTypeChecker::checkConstrainingFacetsDouble(double value, const QString & } if (facets.contains(XsdFacet::Enumeration)) { const XsdFacet::Ptr facet = facets.value(XsdFacet::Enumeration); - const DerivedString<TypeString>::Ptr valueStr = DerivedString<TypeString>::fromLexical(m_namePool, QString::number(value)); + const Numeric::Ptr valuePtr = Double::fromValue(value); + const DerivedString<TypeString>::Ptr valueStr = DerivedString<TypeString>::fromLexical(m_namePool, valuePtr->stringValue()); const AtomicValue::List multiValue = facet->multiValue(); bool found = false; @@ -706,6 +708,13 @@ bool XsdTypeChecker::checkConstrainingFacetsDouble(double value, const QString & found = true; break; } + + // Handle case when both facet and value are NaN separately as equals for NaN returns always false. + const Numeric::Ptr facetValue = ValueFactory::fromLexical(multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue(), BuiltinTypes::xsDouble, m_context, m_reflection); + if (facetValue->isNaN() && valuePtr->isNaN()) { + found = true; + break; + } } if (!found) { |