diff options
Diffstat (limited to 'src')
273 files changed, 3793 insertions, 2089 deletions
diff --git a/src/3rdparty/libconninet/Makefile.am b/src/3rdparty/libconninet/Makefile.am deleted file mode 100644 index 250637a..0000000 --- a/src/3rdparty/libconninet/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -SUBDIRS = src tests - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = conninet.pc - -MAINTAINERCLEANFILES = \ - Makefile.in config.h.in configure \ - install-sh ltmain.sh missing mkinstalldirs \ - config.log config.status config.guess config.sub \ - build-stamp compile depcomp acinclude.m4 aclocal.m4 \ - debian/files \ - debian/libconninet0.postinst.debhelper \ - debian/libconninet0.postrm.debhelper \ - debian/libconninet0.substvars - -EXTRA_DIST = \ - debian/changelog \ - debian/compat \ - debian/control \ - debian/copyright \ - debian/libconninet0-dev.dirs \ - debian/libconninet0-dev.files \ - debian/libconninet0.dirs \ - debian/libconninet0.files \ - debian/rules - -# get rid of debian build dirs -maintainer-clean-local: - -rm -rf debian/build debian/tmp \ - debian/libconninet0 \ - debian/libconninet0-dev \ - debian/libconninet0-dbg - -if DOXYGEN_DOCS_ENABLED - DOXYGEN_LINE = $(DOXYGEN) doxygen.cfg -else - DOXYGEN_LINE = -endif - -.PHONY : doc - -doc: - $(DOXYGEN_LINE) - -deb: dist - -mkdir $(top_builddir)/debian-build - cd $(top_builddir)/debian-build && tar zxf ../$(top_builddir)/$(PACKAGE)-$(VERSION).tar.gz - cd $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -rfakeroot -sa -D - -rm -rf $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) diff --git a/src/3rdparty/libconninet/debian/changelog b/src/3rdparty/libconninet/debian/changelog index 436d318..4063317 100644 --- a/src/3rdparty/libconninet/debian/changelog +++ b/src/3rdparty/libconninet/debian/changelog @@ -1,9 +1,17 @@ -libconninet (0.41+0m6) unstable; urgency=low +libconninet (0.42+0m6) unstable; urgency=low * This entry has been added by BIFH queue processor - version has been changed to 0.41+0m6 + version has been changed to 0.42+0m6 - -- Qing Jin <ext-qing.1.jin@nokia.com> Thu, 15 Jul 2010 15:56:38 +0300 + -- Qing Jin <ext-qing.1.jin@nokia.com> Thu, 22 Jul 2010 14:04:58 +0300 + +libconninet (0.42) unstable; urgency=low + + * Fixes: NB#180536 - Uploads to online services are not working. + This is a regression caused by fix to bug 175098, the timeout was never + expiring when waiting reply from icd. + + -- Jukka Rissanen <jukka.rissanen@nokia.com> Mon, 19 Jul 2010 12:23:30 +0300 libconninet (0.41) unstable; urgency=low diff --git a/src/3rdparty/libconninet/src/Makefile.am b/src/3rdparty/libconninet/src/Makefile.am deleted file mode 100644 index be7a1e5..0000000 --- a/src/3rdparty/libconninet/src/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -DEFS = -DDBUS_API_SUBJECT_TO_CHANGE -DGCONF_DISABLE_DEPRECATED -INCLUDES = @GLIB_CFLAGS@ @DBUS_CFLAGS@ @GCONF_CFLAGS@ @OSSO_IC_CFLAGS@ @ICD_DEV_CFLAGS@ @QTCORE_CFLAGS@ @QTNETWORK_CFLAGS@ @QTDBUS_CFLAGS@ @QGCONF_CFLAGS@ @CONNSETTINGS_CFLAGS@ -LIBS = @GLIB_LIBS@ @DBUS_LIBS@ @GCONF_LIBS@ @OSSO_IC_LIBS@ @ICD_DEV_LIBS@ @QTCORE_LIBS@ @QTDBUS_LIBS@ @QTNETWORK_CFLAGS@ @QGCONF_LIBS@ @CONNSETTINGS_LIBS@ - -AM_CFLAGS = $(CONCFLAGS) - -lib_LTLIBRARIES = libconninet.la -libconninet_la_SOURCES = \ - maemo_icd.cpp \ - dbusdispatcher.cpp \ - iapconf.cpp \ - iapmonitor.cpp \ - proxyconf.cpp - -#libconninet_la_LDFLAGS = -version-info 0:0:0 - -conninetincludedir = $(includedir)/conninet -conninetinclude_HEADERS = \ - maemo_icd.h \ - dbusdispatcher.h \ - iapconf.h \ - iapmonitor.h \ - proxyconf.h - -nodist_libconninet_la_SOURCES = \ - moc_maemo_icd.cpp \ - moc_dbusdispatcher.cpp - -MAINTAINERCLEANFILES = Makefile.in - -# This rule lets GNU make create any moc_*.cpp from the equivalent *.h -moc_%.cpp: %.h - moc $< -o $@ - -# This line ensures that generated moc files are deleted when we make clean. -CLEANFILES = *_moc.cpp *.loT diff --git a/src/3rdparty/libconninet/src/maemo_icd.cpp b/src/3rdparty/libconninet/src/maemo_icd.cpp index bc84fbc..026241c 100644 --- a/src/3rdparty/libconninet/src/maemo_icd.cpp +++ b/src/3rdparty/libconninet/src/maemo_icd.cpp @@ -30,9 +30,30 @@ #include <dbus/dbus.h> #include <dbus/dbus-glib-lowlevel.h> +#include <sys/time.h> +#include <sys/types.h> +#include <unistd.h> namespace Maemo { +#undef PRINT_DEBUGINFO +#ifdef PRINT_DEBUGINFO + static FILE *fdebug = NULL; +#define PDEBUG(fmt, args...) \ + do { \ + struct timeval tv; \ + gettimeofday(&tv, 0); \ + fprintf(fdebug, "DEBUG[%d]:%ld.%ld:%s:%s():%d: " fmt, \ + getpid(), \ + tv.tv_sec, tv.tv_usec, \ + __FILE__, __FUNCTION__, __LINE__, args); \ + fflush(fdebug); \ + } while(0) +#else +#define PDEBUG(fmt...) +#endif + + /* Reference counting singleton class that creates a single connection * to icd so that icd reference counting works as expected. This is * needed because DBusDispatcher uses private dbus connections @@ -239,6 +260,13 @@ public: icd = myfriend; timeout = dbus_timeout; + +#ifdef PRINT_DEBUGINFO + if (!fdebug) { + fdebug = fopen("/tmp/maemoicd.log", "a+"); + } + PDEBUG("created %s\n", "IcdPrivate"); +#endif } void clearState() @@ -672,6 +700,8 @@ uint IcdPrivate::state_non_blocking(QList<IcdStateResult>& state_results) uint signals_left, total_signals; IcdStateResult result; + PDEBUG("%s\n", "non blocking state"); + clearState(); reply = mDBus->call(ICD_DBUS_API_STATE_REQ); if (reply.type() != QVariant::List) @@ -719,6 +749,7 @@ uint IcdPrivate::state_non_blocking(QList<IcdStateResult>& state_results) } timer.stop(); + PDEBUG("total_signals=%d\n", total_signals); return total_signals; } @@ -731,11 +762,14 @@ uint IcdPrivate::state_non_blocking(QList<IcdStateResult>& state_results) */ uint IcdPrivate::state(QList<IcdStateResult>& state_results) { - QTimer timer; QVariant reply; QVariantList vl; uint signals_left, total_signals; IcdStateResult result; + time_t started; + int timeout_secs = timeout / 1000; + + PDEBUG("%s\n", "state_results"); clearState(); reply = mDBus->call(ICD_DBUS_API_STATE_REQ); @@ -749,17 +783,16 @@ uint IcdPrivate::state(QList<IcdStateResult>& state_results) if (!signals_left) return 0; - timer.setSingleShot(true); - timer.start(timeout); + started = time(0); state_results.clear(); mError.clear(); while (signals_left) { mInterface.clear(); - while (timer.isActive() && mInterface.isEmpty()) { + while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) { mDBus->synchronousDispatch(1000); } - if (!timer.isActive()) { + if (time(0)>(started+timeout_secs)) { total_signals = 0; break; } @@ -782,8 +815,8 @@ uint IcdPrivate::state(QList<IcdStateResult>& state_results) break; } } - timer.stop(); + PDEBUG("total_signals=%d\n", total_signals); return total_signals; } @@ -956,11 +989,14 @@ static void get_addrinfo_all_result(QList<QVariant>& args, */ uint IcdPrivate::addrinfo(QList<IcdAddressInfoResult>& addr_results) { - QTimer timer; QVariant reply; QVariantList vl; uint signals_left, total_signals; IcdAddressInfoResult result; + time_t started; + int timeout_secs = timeout / 1000; + + PDEBUG("%s\n", "addr_results"); clearState(); reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ); @@ -976,16 +1012,15 @@ uint IcdPrivate::addrinfo(QList<IcdAddressInfoResult>& addr_results) if (!signals_left) return 0; - timer.setSingleShot(true); - timer.start(timeout); + started = time(0); addr_results.clear(); while (signals_left) { mInterface.clear(); - while (timer.isActive() && mInterface.isEmpty()) { + while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) { mDBus->synchronousDispatch(1000); } - if (!timer.isActive()) { + if (time(0)>(started+timeout_secs)) { total_signals = 0; break; } @@ -1003,7 +1038,8 @@ uint IcdPrivate::addrinfo(QList<IcdAddressInfoResult>& addr_results) break; } } - timer.stop(); + + PDEBUG("total_signals=%d\n", total_signals); return total_signals; } @@ -1015,6 +1051,8 @@ uint IcdPrivate::addrinfo_non_blocking(QList<IcdAddressInfoResult>& addr_results uint signals_left, total_signals; IcdAddressInfoResult result; + PDEBUG("%s\n", "non blocking addrinfo"); + clearState(); reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ); if (reply.type() != QVariant::List) @@ -1057,6 +1095,7 @@ uint IcdPrivate::addrinfo_non_blocking(QList<IcdAddressInfoResult>& addr_results } } timer.stop(); + PDEBUG("total_signals=%d\n", total_signals); return total_signals; } diff --git a/src/3rdparty/libconninet/tests/Makefile.am b/src/3rdparty/libconninet/tests/Makefile.am deleted file mode 100644 index f6f41ea..0000000 --- a/src/3rdparty/libconninet/tests/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -DEFS = -DDBUS_API_SUBJECT_TO_CHANGE -INCLUDES = @GLIB_CFLAGS@ @DBUS_CFLAGS@ @CONNSETTINGS_CFLAGS@ @OSSO_IC_CFLAGS@ @ICD_DEV_CFLAGS@ \ - @QTCORE_CFLAGS@ @QTDBUS_CFLAGS@ @QTCORE_CFLAGS@ @QTNETWORK_CFLAGS@ @QTTEST_CFLAGS@ \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src - -LIBS = @GLIB_LIBS@ @DBUS_LIBS@ @CONNSETTINGS_LIBS@ @OSSO_IC_LIBS@ @ICD_DEV_LIBS@ \ - @QTCORE_LIBS@ @QTDBUS_LIBS@ @QTCORE_LIBS@ @QTNETWORK_LIBS@ @QTTEST_LIBS@ \ - $(top_builddir)/src/libconninet.la - -AM_CFLAGS = $(CONCFLAGS) -AM_LDFLAGS = -static - -bin_PROGRAMS = test_dbusdispatcher test_iapconf test_maemo_icd test_iapmonitor test_proxyconf - -test_dbusdispatcher_SOURCES = ut_dbusdispatcher.cpp -ut_dbusdispatcher.o: ut_dbusdispatcher.moc - -test_iapconf_SOURCES = ut_iapconf.cpp -ut_iapconf.o: ut_iapconf.moc - -test_maemo_icd_SOURCES = ut_maemo_icd.cpp -ut_maemo_icd.o: ut_maemo_icd.moc - -test_iapmonitor_SOURCES = ut_iapmonitor.cpp -ut_iapmonitor.o: ut_iapmonitor.moc - -test_proxyconf_SOURCES = ut_proxyconf.cpp -ut_proxyconf.o: ut_proxyconf.moc - - -MAINTAINERCLEANFILES = Makefile.in - -# This rule lets GNU make create any *.moc from the equivalent *.cpp -%.moc: %.cpp - moc $< -o $@ - -# This line ensures that generated moc files are deleted when we make clean. -CLEANFILES = *.moc diff --git a/src/3rdparty/phonon/CMakeLists.txt b/src/3rdparty/phonon/CMakeLists.txt index ef7d6f5..fd6368c 100644 --- a/src/3rdparty/phonon/CMakeLists.txt +++ b/src/3rdparty/phonon/CMakeLists.txt @@ -94,7 +94,7 @@ if (CMAKE_COMPILER_IS_GNUCXX) set( __KDE_HAVE_GCC_VISIBILITY ${__KDE_HAVE_GCC_VISIBILITY} CACHE BOOL "GCC support for hidden visibility") # get the gcc version - exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info) + exec_program(${CMAKE_C_COMPILER} ARGS ${CMAKE_C_COMPILER_ARG1} --version OUTPUT_VARIABLE _gcc_version_info) string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}") # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the patch level, handle this here: @@ -152,8 +152,8 @@ set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) set(CMAKE_COLOR_MAKEFILE ON) set(PHONON_LIB_MAJOR_VERSION "4") -set(PHONON_LIB_MINOR_VERSION "3") -set(PHONON_LIB_PATCH_VERSION "80") +set(PHONON_LIB_MINOR_VERSION "4") +set(PHONON_LIB_PATCH_VERSION "0") set(PHONON_LIB_VERSION "${PHONON_LIB_MAJOR_VERSION}.4.0") set(PHONON_LIB_SOVERSION ${PHONON_LIB_MAJOR_VERSION}) diff --git a/src/3rdparty/phonon/phonon/phononnamespace.h b/src/3rdparty/phonon/phonon/phononnamespace.h index ec42d51..eb899de 100644 --- a/src/3rdparty/phonon/phonon/phononnamespace.h +++ b/src/3rdparty/phonon/phonon/phononnamespace.h @@ -41,12 +41,12 @@ /** * PHONON_VERSION is (major << 16) + (minor << 8) + patch. */ -#define PHONON_VERSION PHONON_VERSION_CHECK(4, 3, 1) +#define PHONON_VERSION PHONON_VERSION_CHECK(4, 4, 0) /** * PHONON_VERSION_STR is "major.minor.patch". E.g. "4.2.1" */ -#define PHONON_VERSION_STR "4.3.1" +#define PHONON_VERSION_STR "4.4.0" QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 0b414ab..d31a2b4 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -e6e692bb056670e2781dd0bc473a60757ae53992 +72b1c38579ca1fdb3f242e29cd16e5bfb4925813 diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index f8403fb..62aa8ce 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - e6e692bb056670e2781dd0bc473a60757ae53992 + 72b1c38579ca1fdb3f242e29cd16e5bfb4925813 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 5189eb5..98d4d51 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,50 @@ +2010-08-10 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + Make sure NPAPI plugins get an initial setNPWindow on Mac + + https://bugs.webkit.org/show_bug.cgi?id=43782 + + * plugins/mac/PluginViewMac.mm: + +2010-06-14 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Stack overflow when converting navigator object to QVariant + https://bugs.webkit.org/show_bug.cgi?id=40572 + + Protect against infinite recursion in JSValue->QVariant conversion. + This fixes a crash when trying to convert MimeType objects (they + recurse infinitely and on-the-fly via the enabledPlugin property.) + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + +2010-03-30 Kent Tamura <tkent@chromium.org> + + Reviewed by Brady Eidson. + + REGRESSION (r56439) - Crash when a renderer for a file upload control + with a selected file is recreated + https://bugs.webkit.org/show_bug.cgi?id=36723 + + RenderFileUploadControl::chooseIconForFiles was called before + m_fileChooser was initialized. + + * platform/FileChooser.cpp: + (WebCore::FileChooser::FileChooser): Introduce m_isInitializing flag to + avoid FileChooserClient::repaint() call. + (WebCore::FileChooser::loadIcon): + (WebCore::FileChooser::iconLoaded): + * platform/FileChooser.h: Add a FielChooser parameter to + FileChooserClient::chooseIconForFiles(). + * rendering/RenderFileUploadControl.cpp: + (WebCore::RenderFileUploadControl::chooseIconForFiles): + (WebCore::RenderFileUploadControl::paintObject): Add an assertion. + * rendering/RenderFileUploadControl.h: + 2010-07-06 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Dirk Schulze. diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp index a39dc7a..2212f58 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp @@ -162,9 +162,11 @@ static JSRealType valueRealType(ExecState* exec, JSValue val) return String; // I don't know. } -QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance, HashSet<JSObject*>* visitedObjects) +QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance, HashSet<JSObject*>* visitedObjects, int recursionLimit) { - if (!value) + --recursionLimit; + + if (!value || !recursionLimit) return QVariant(); JSObject* object = 0; @@ -344,7 +346,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type while(it != properties.end()) { if (object->propertyIsEnumerable(exec, *it)) { JSValue val = object->get(exec, *it); - QVariant v = convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects); + QVariant v = convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects, recursionLimit); if (objdist >= 0) { UString ustring = (*it).ustring(); QString id = QString((const QChar*)ustring.rep()->characters(), ustring.size()); @@ -368,7 +370,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type qConvDebug() << "converting a " << len << " length Array"; for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); - result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects)); + result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects, recursionLimit)); if (objdist == -1) { qConvDebug() << "Failed converting element at index " << i; break; // Failed converting a list entry, so fail the array @@ -387,7 +389,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type qConvDebug() << "converting a " << len << " length Array"; for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); - result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects)); + result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects, recursionLimit)); if (objdist == -1) { qConvDebug() << "Failed converting element at index " << i; break; // Failed converting a list entry, so fail the array @@ -401,7 +403,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type // Make a single length array int objdist; qConvDebug() << "making a single length variantlist"; - QVariant var = convertValueToQVariant(exec, value, QMetaType::Void, &objdist, visitedObjects); + QVariant var = convertValueToQVariant(exec, value, QMetaType::Void, &objdist, visitedObjects, recursionLimit); if (objdist != -1) { QVariantList result; result << var; @@ -645,7 +647,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<QObject*>()); else @@ -664,7 +666,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<QObject*>()); else @@ -679,7 +681,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type // Make a single length array QObjectList result; int itemdist = -1; - QVariant item = convertValueToQVariant(exec, value, QMetaType::QObjectStar, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, value, QMetaType::QObjectStar, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) { result.append(item.value<QObject*>()); dist = 10; @@ -696,7 +698,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<int>()); else @@ -715,7 +717,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<int>()); else @@ -730,7 +732,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type // Make a single length array QList<int> result; int itemdist = -1; - QVariant item = convertValueToQVariant(exec, value, QMetaType::Int, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, value, QMetaType::Int, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) { result.append(item.value<int>()); dist = 10; @@ -757,7 +759,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } // And then recurse with the autodetect flag - ret = convertValueToQVariant(exec, value, QMetaType::Void, distance, visitedObjects); + ret = convertValueToQVariant(exec, value, QMetaType::Void, distance, visitedObjects, recursionLimit); dist = 10; } break; @@ -777,8 +779,9 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance) { + const int recursionLimit = 200; HashSet<JSObject*> visitedObjects; - return convertValueToQVariant(exec, value, hint, distance, &visitedObjects); + return convertValueToQVariant(exec, value, hint, distance, &visitedObjects, recursionLimit); } JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& variant) diff --git a/src/3rdparty/webkit/WebCore/platform/FileChooser.cpp b/src/3rdparty/webkit/WebCore/platform/FileChooser.cpp index dd4fc0d..90dd567 100644 --- a/src/3rdparty/webkit/WebCore/platform/FileChooser.cpp +++ b/src/3rdparty/webkit/WebCore/platform/FileChooser.cpp @@ -39,9 +39,11 @@ FileChooserClient::~FileChooserClient() inline FileChooser::FileChooser(FileChooserClient* client, const Vector<String>& initialFilenames) : m_client(client) + , m_isInitializing(true) { m_filenames = initialFilenames; loadIcon(); + m_isInitializing = false; } PassRefPtr<FileChooser> FileChooser::create(FileChooserClient* client, const Vector<String>& initialFilenames) @@ -79,13 +81,13 @@ void FileChooser::chooseFiles(const Vector<String>& filenames) void FileChooser::loadIcon() { if (m_filenames.size() && m_client) - m_client->chooseIconForFiles(m_filenames); + m_client->chooseIconForFiles(this, m_filenames); } void FileChooser::iconLoaded(PassRefPtr<Icon> icon) { m_icon = icon; - if (m_icon && m_client) + if (!m_isInitializing && m_icon && m_client) m_client->repaint(); } diff --git a/src/3rdparty/webkit/WebCore/platform/FileChooser.h b/src/3rdparty/webkit/WebCore/platform/FileChooser.h index 4028d41..e93b9ac 100644 --- a/src/3rdparty/webkit/WebCore/platform/FileChooser.h +++ b/src/3rdparty/webkit/WebCore/platform/FileChooser.h @@ -35,6 +35,7 @@ namespace WebCore { +class FileChooser; class Font; class Icon; @@ -44,7 +45,7 @@ public: virtual void repaint() = 0; virtual bool allowsMultipleFiles() = 0; virtual String acceptTypes() = 0; - virtual void chooseIconForFiles(const Vector<String>&) = 0; + virtual void chooseIconForFiles(FileChooser*, const Vector<String>&) = 0; virtual ~FileChooserClient(); }; @@ -79,6 +80,7 @@ private: FileChooserClient* m_client; Vector<String> m_filenames; RefPtr<Icon> m_icon; + bool m_isInitializing; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.mm b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.mm index 57d74ab..c8781a8 100644 --- a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.mm +++ b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.mm @@ -227,7 +227,10 @@ bool PluginView::platformStart() #endif } - show(); + updatePluginWidget(); + + if (!m_plugin->quirks().contains(PluginQuirkDeferFirstSetWindowCall)) + setNPWindowIfNeeded(); // TODO: Implement null timer throttling depending on plugin activation m_nullEventTimer.set(new Timer<PluginView>(this, &PluginView::nullEventTimerFired)); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.cpp index 14d126d..6a5c1e0 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.cpp @@ -114,10 +114,10 @@ String RenderFileUploadControl::acceptTypes() return static_cast<HTMLInputElement*>(node())->accept(); } -void RenderFileUploadControl::chooseIconForFiles(const Vector<String>& filenames) +void RenderFileUploadControl::chooseIconForFiles(FileChooser* chooser, const Vector<String>& filenames) { if (Chrome* chromePointer = chrome()) - chromePointer->chooseIconForFiles(filenames, m_fileChooser); + chromePointer->chooseIconForFiles(filenames, chooser); } void RenderFileUploadControl::click() @@ -195,6 +195,7 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, int tx, int ty) { if (style()->visibility() != VISIBLE) return; + ASSERT(m_fileChooser); // Push a clip. if (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseChildBlockBackgrounds) { diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.h b/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.h index a5f3367..25d2639 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.h @@ -63,7 +63,7 @@ private: void repaint() { RenderBlock::repaint(); } bool allowsMultipleFiles(); String acceptTypes(); - void chooseIconForFiles(const Vector<String>&); + void chooseIconForFiles(FileChooser*, const Vector<String>&); Chrome* chrome() const; int maxFilenameWidth() const; diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index b2bff0c..5083ba5 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,36 @@ +2010-08-05 David Leong <david.leong@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Input mode states are not reset after entering a password field + https://bugs.webkit.org/show_bug.cgi?id=43530 + + Input mode hints are not reset if clicking on password <input> elements then + clicking on <textarea> elements + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + * tests/qwebview/resources/input_types.html: + * tests/qwebview/tst_qwebview.cpp: + (tst_QWebView::focusInputTypes): + + +2010-07-27 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Incorrect input method hints + https://bugs.webkit.org/show_bug.cgi?id=43037 + + Properly set or reset all input method hints when + activating input fields. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + * tests/qwebview/tst_qwebview.cpp: + (tst_QWebView::focusInputTypes): Extended unit test to verify that we + reset hints. + 2009-10-30 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 1cebef7..87e047e 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -599,6 +599,13 @@ void EditorClientQt::setInputMethodState(bool active) QWebPageClient* webPageClient = m_page->d->client; if (webPageClient) { #if QT_VERSION >= 0x040600 + // Make sure to reset input method hint + webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, false); + webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, false); + webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, false); + webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, false); + webPageClient->setInputMethodHint(Qt::ImhHiddenText, false); + HTMLInputElement* inputElement = 0; Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame(); if (frame && frame->document() && frame->document()->focusedNode()) @@ -606,20 +613,18 @@ void EditorClientQt::setInputMethodState(bool active) inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode()); if (inputElement) { - if (!active) { - // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag - // for password fields. The Qt platform is responsible for determining which widget - // will receive input method events for password fields. - active = inputElement->isPasswordField(); - webPageClient->setInputMethodHint(Qt::ImhHiddenText, active); - } else { - // Set input method hints for "number", "tel", "email", and "url" input elements. - webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField()); - webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField()); - webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField()); - webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField()); - webPageClient->setInputMethodHint(Qt::ImhHiddenText, inputElement->isPasswordField()); - } + // Set input method hints for "number", "tel", "email", "url" and "password" input elements. + webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField()); + webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField()); + webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField()); + webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField()); + // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag + // for password fields. The Qt platform is responsible for determining which widget + // will receive input method events for password fields. + bool isPasswordField = inputElement->isPasswordField(); + webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField); + if (isPasswordField) + active = true; } #if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN) diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp index 9dcba60..c1ca23d 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -139,6 +139,7 @@ void GraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* event) /*! \qmlclass WebView QDeclarativeWebView + \ingroup qml-view-elements \since 4.7 \brief The WebView item allows you to add web content to a canvas. \inherits Item diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index d3f5502..0335d46 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -1,6 +1,6 @@ /*! \module QtWebKit - \title QtWebKit Module + \title WebKit in Qt \contentspage All Qt Modules \previouspage QtSvg \nextpage QtXml diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html index 18ab314..2e893af 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html @@ -4,5 +4,6 @@ <input type='tel' style='position: absolute; left: 10px; top: 100px; height: 50px; width: 100px;'/><br> <input type='number' style='position: absolute; left: 10px; top: 150px; height: 50px; width: 100px;'/><br> <input type='email' style='position: absolute; left: 10px; top: 200px; height: 50px; width: 100px;'/><br> -<input type='url' style='position: absolute; left: 10px; top: 250px; height: 50px; width: 100px;'/><br>" -</body></html>
\ No newline at end of file +<input type='url' style='position: absolute; left: 10px; top: 250px; height: 50px; width: 100px;'/><br> +<textarea style='position: absolute; left: 10px; top: 310px; height: 50px; width: 100px;' rows="2" cols="20">blah blah blah blah</textarea><br> +</body></html> diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp index 835ad82..bd19578 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -264,26 +264,58 @@ void tst_QWebView::focusInputTypes() #else QVERIFY(webView->inputMethodHints() == Qt::ImhNone); #endif + QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); // 'password' field webView->fireMouseClick(QPoint(20, 60)); - QVERIFY(webView->inputMethodHints() & Qt::ImhHiddenText); + QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); + QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); // 'tel' field webView->fireMouseClick(QPoint(20, 110)); - QVERIFY(webView->inputMethodHints() & Qt::ImhDialableCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhDialableCharactersOnly); + QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); // 'number' field webView->fireMouseClick(QPoint(20, 160)); - QVERIFY(webView->inputMethodHints() & Qt::ImhDigitsOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhDigitsOnly); + QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); // 'email' field webView->fireMouseClick(QPoint(20, 210)); - QVERIFY(webView->inputMethodHints() & Qt::ImhEmailCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhEmailCharactersOnly); + QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); // 'url' field webView->fireMouseClick(QPoint(20, 260)); - QVERIFY(webView->inputMethodHints() & Qt::ImhUrlCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhUrlCharactersOnly); + QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); + + // 'password' field + webView->fireMouseClick(QPoint(20, 60)); + QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); + QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); + + // 'text' type + webView->fireMouseClick(QPoint(20, 10)); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) + QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase); + QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText); +#else + QVERIFY(webView->inputMethodHints() == Qt::ImhNone); +#endif + QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); + + // 'password' field + webView->fireMouseClick(QPoint(20, 60)); + QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); + QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); + + qWarning("clicking on text area"); + // 'text area' field + webView->fireMouseClick(QPoint(20, 320)); + QVERIFY(webView->inputMethodHints() == Qt::ImhNone); + QVERIFY(webView->testAttribute(Qt::WA_InputMethodEnabled)); delete webView; diff --git a/src/corelib/concurrent/qtconcurrentfilter.cpp b/src/corelib/concurrent/qtconcurrentfilter.cpp index 36febe7..29c3edb 100644 --- a/src/corelib/concurrent/qtconcurrentfilter.cpp +++ b/src/corelib/concurrent/qtconcurrentfilter.cpp @@ -117,7 +117,7 @@ function, and should merge the \e{intermediate} into the \e{result} variable. QtConcurrent::filteredReduced() guarantees that only one thread will call reduce at a time, so using a mutex to lock the result variable - is not neccesary. The QtConcurrent::ReduceOptions enum provides a way to + is not necessary. The QtConcurrent::ReduceOptions enum provides a way to control the order in which the reduction is done. \section1 Additional API Features diff --git a/src/corelib/concurrent/qtconcurrentmap.cpp b/src/corelib/concurrent/qtconcurrentmap.cpp index e74d69c..4303ff6 100644 --- a/src/corelib/concurrent/qtconcurrentmap.cpp +++ b/src/corelib/concurrent/qtconcurrentmap.cpp @@ -161,7 +161,7 @@ function, and should merge the \e{intermediate} into the \e{result} variable. QtConcurrent::mappedReduced() guarantees that only one thread will call reduce at a time, so using a mutex to lock the result variable - is not neccesary. The QtConcurrent::ReduceOptions enum provides a way to + is not necessary. The QtConcurrent::ReduceOptions enum provides a way to control the order in which the reduction is done. If QtConcurrent::UnorderedReduce is used (the default), the order is undefined, while QtConcurrent::OrderedReduce ensures that the reduction diff --git a/src/corelib/concurrent/qtconcurrentresultstore.cpp b/src/corelib/concurrent/qtconcurrentresultstore.cpp index ad4b2cf..65f3afa 100644 --- a/src/corelib/concurrent/qtconcurrentresultstore.cpp +++ b/src/corelib/concurrent/qtconcurrentresultstore.cpp @@ -236,7 +236,7 @@ int ResultStoreBase::count() const return resultCount; } -// returns the insert index, calling this funciton with +// returns the insert index, calling this function with // index equal to -1 returns the next available index. int ResultStoreBase::updateInsertIndex(int index, int _count) { diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 10666b4..f6e2f6b 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -53,39 +53,9 @@ symbian: { DEPLOYMENT = partial_upgrade $$DEPLOYMENT } -mmx { - DEFINES += QT_HAVE_MMX -} -3dnow { - DEFINES += QT_HAVE_3DNOW -} -sse { - DEFINES += QT_HAVE_SSE - DEFINES += QT_HAVE_MMXEXT -} -sse2 { - DEFINES += QT_HAVE_SSE2 -} -sse3 { - DEFINES += QT_HAVE_SSE3 -} -ssse3 { - DEFINES += QT_HAVE_SSSE3 -} -sse4_1 { - DEFINES += QT_HAVE_SSE4_1 -} -sse4_2 { - DEFINES += QT_HAVE_SSE4_2 -} -avx { - DEFINES += QT_HAVE_AVX -} -iwmmxt { - DEFINES += QT_HAVE_IWMMXT -} neon { DEFINES += QT_HAVE_NEON QMAKE_CXXFLAGS *= -mfpu=neon } + diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index d07ae4a..65699f6 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1886,9 +1886,9 @@ QSysInfo::SymbianVersion QSysInfo::symbianVersion() case SV_S60_5_0: return SV_9_4; case SV_S60_5_1: - return SV_9_4; + return SV_SF_2; case SV_S60_5_2: - return SV_9_4; + return SV_SF_3; default: return SV_Unknown; } @@ -2923,8 +2923,9 @@ int qrand() \relates <QtGlobal> You can use this macro to specify information about a custom type - \a Type. With accurate type information, Qt's \l{generic - containers} can choose appropriate storage methods and algorithms. + \a Type. With accurate type information, Qt's \l{Container Classes} + {generic containers} can choose appropriate storage methods and + algorithms. \a Flags can be one of the following: diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index f4ecc73..2d37a59 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -983,9 +983,11 @@ redefine to built-in booleans to make autotests work properly */ # undef QT_DEPRECATED_VARIABLE # undef QT_DEPRECATED_CONSTRUCTOR #elif defined(QT_DEPRECATED_WARNINGS) +# ifdef QT3_SUPPORT /* enable Qt3 support warnings as well */ -# undef QT3_SUPPORT_WARNINGS -# define QT3_SUPPORT_WARNINGS +# undef QT3_SUPPORT_WARNINGS +# define QT3_SUPPORT_WARNINGS +# endif # undef QT_DEPRECATED # define QT_DEPRECATED Q_DECL_DEPRECATED # undef QT_DEPRECATED_VARIABLE diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 3515777..ea7e2e4 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -476,7 +476,7 @@ QLibraryInfo::location(LibraryLocation loc) \value PrefixPath The default prefix for all paths. \value DocumentationPath The location for documentation upon install. \value HeadersPath The location for all headers. - \value LibrariesPath The location of installed librarires. + \value LibrariesPath The location of installed libraries. \value BinariesPath The location of installed Qt binaries (tools and applications). \value PluginsPath The location of installed Qt plugins. \value ImportsPath The location of installed QML extensions to import. diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 37591c5..61f7180 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -797,12 +797,12 @@ QString QFileInfo::suffix() const \bold{Note:} The QDir returned always corresponds to the object's parent directory, even if the QFileInfo represents a directory. - For each of the follwing, dir() returns a QDir for + For each of the following, dir() returns a QDir for \c{"~/examples/191697"}. \snippet doc/src/snippets/fileinfo/main.cpp 0 - For each of the follwing, dir() returns a QDir for + For each of the following, dir() returns a QDir for \c{"."}. \snippet doc/src/snippets/fileinfo/main.cpp 1 diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 99c165e..378ad20 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -295,12 +295,12 @@ void QKqueueFileSystemWatcherEngine::run() path = idToPath.value(id); if (path.isEmpty()) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent for a file we're not watching"; - continue; + goto process_next_event; } } if (kev.filter != EVFILT_VNODE) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent with the wrong filter"; - continue; + goto process_next_event; } if ((kev.fflags & (NOTE_DELETE | NOTE_REVOKE | NOTE_RENAME)) != 0) { @@ -337,6 +337,7 @@ void QKqueueFileSystemWatcherEngine::run() } // are there any more? +process_next_event: r = kevent(kqfd, 0, 0, &kev, 1, &ZeroTimeout); } while (r > 0); } diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 21930e1..35fa04b 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -1958,6 +1958,10 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + // Since this is a special case, we check if the return value was NULL and if so + // we change it to INVALID_HANDLE_VALUE to follow the logic inside this function. + if(0 == handle) + handle = INVALID_HANDLE_VALUE; #endif if (handle == INVALID_HANDLE_VALUE) { diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index af657b2..003e781 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -375,10 +375,9 @@ QProcessActive::QProcessActive() // Nothing to do } -// Called from ProcessManagerThread +// Called from main thread QProcessActive::~QProcessActive() { - Cancel(); process = NULL; pproc = NULL; } @@ -482,10 +481,9 @@ QProcessManagerMediator::QProcessManagerMediator() // Nothing to do } -// Called from ProcessManagerThread +// Called from main thread QProcessManagerMediator::~QProcessManagerMediator() { - Cancel(); processManagerThread.Close(); currentCommand = ENoCommand; currentObserver = NULL; @@ -648,25 +646,36 @@ QProcessManager::QProcessManager() QProcessManager::~QProcessManager() { QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager()"); - // Cancel death listening for all child processes - if (mediator) { - QMap<int, QProcessActive *>::Iterator it = children.begin(); - while (it != children.end()) { - // Remove all monitors - QProcessActive *active = it.value(); - mediator->remove(active); - - QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager() removed listening for a process"); - ++it; + + // Check if manager thread is still alive. If this destructor is ran as part of global + // static cleanup, manager thread will most likely be terminated by kernel at this point, + // so trying to delete QProcessActives and QProcessMediators will panic as they + // will still be active. They can also no longer be canceled as the thread is already gone. + // In case manager thread has already died, we simply do nothing and let the deletion of + // the main heap at process exit take care of stray objects. + + if (managerThread.Handle() && managerThread.ExitType() == EExitPending) { + // Cancel death listening for all child processes + if (mediator) { + QMap<int, QProcessActive *>::Iterator it = children.begin(); + while (it != children.end()) { + // Remove all monitors + QProcessActive *active = it.value(); + mediator->remove(active); + + QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager() removed listening for a process"); + ++it; + } + + // Terminate process manager thread. + mediator->terminate(); + delete mediator; } - // Terminate process manager thread. - mediator->terminate(); - delete mediator; + qDeleteAll(children.values()); + children.clear(); } - qDeleteAll(children.values()); - children.clear(); managerThread.Close(); managerMutex.Close(); } diff --git a/src/corelib/kernel/qbasictimer.cpp b/src/corelib/kernel/qbasictimer.cpp index d176170..d595ac1 100644 --- a/src/corelib/kernel/qbasictimer.cpp +++ b/src/corelib/kernel/qbasictimer.cpp @@ -54,7 +54,8 @@ QT_BEGIN_NAMESPACE This is a fast, lightweight, and low-level class used by Qt internally. We recommend using the higher-level QTimer class rather than this class if you want to use timers in your - applications. + applications. Note that this timer is a repeating timer that + will send subsequent timer events unless the stop() function is called. To use this class, create a QBasicTimer, and call its start() function with a timeout interval and with a pointer to a QObject @@ -88,8 +89,8 @@ QT_BEGIN_NAMESPACE /*! \fn bool QBasicTimer::isActive() const - Returns true if the timer is running, has not yet timed - out, and has not been stopped; otherwise returns false. + Returns true if the timer is running and has not been stopped; otherwise + returns false. \sa start() stop() */ diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 0a5e06e..512e193 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2308,6 +2308,7 @@ void QCoreApplication::setLibraryPaths(const QStringList &paths) if (!coreappdata()->app_libpaths) coreappdata()->app_libpaths = new QStringList; *(coreappdata()->app_libpaths) = paths; + locker.unlock(); QFactoryLoader::refreshAll(); } @@ -2341,6 +2342,7 @@ void QCoreApplication::addLibraryPath(const QString &path) if (!canonicalPath.isEmpty() && !coreappdata()->app_libpaths->contains(canonicalPath)) { coreappdata()->app_libpaths->prepend(canonicalPath); + locker.unlock(); QFactoryLoader::refreshAll(); } } diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 0c336e7..72f3c0e 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -335,7 +335,7 @@ QTimerInfoList::QTimerInfoList() } #endif - firstTimerInfo = currentTimerInfo = 0; + firstTimerInfo = 0; } timeval QTimerInfoList::updateCurrentTime() @@ -453,7 +453,7 @@ bool QTimerInfoList::timerWait(timeval &tm) // Find first waiting timer not already active QTimerInfo *t = 0; for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) { - if (!(*it)->inTimerEvent) { + if (!(*it)->activateRef) { t = *it; break; } @@ -482,7 +482,7 @@ void QTimerInfoList::registerTimer(int timerId, int interval, QObject *object) t->interval.tv_usec = (interval % 1000) * 1000; t->timeout = updateCurrentTime() + t->interval; t->obj = object; - t->inTimerEvent = false; + t->activateRef = 0; timerInsert(t); } @@ -497,8 +497,8 @@ bool QTimerInfoList::unregisterTimer(int timerId) removeAt(i); if (t == firstTimerInfo) firstTimerInfo = 0; - if (t == currentTimerInfo) - currentTimerInfo = 0; + if (t->activateRef) + *(t->activateRef) = 0; // release the timer id if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent) @@ -523,8 +523,8 @@ bool QTimerInfoList::unregisterTimers(QObject *object) removeAt(i); if (t == firstTimerInfo) firstTimerInfo = 0; - if (t == currentTimerInfo) - currentTimerInfo = 0; + if (t->activateRef) + *(t->activateRef) = 0; // release the timer id if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent) @@ -560,10 +560,7 @@ int QTimerInfoList::activateTimers() bool firstTime = true; timeval currentTime; int n_act = 0, maxCount = count(); - - QTimerInfo *saveFirstTimerInfo = firstTimerInfo; - QTimerInfo *saveCurrentTimerInfo = currentTimerInfo; - firstTimerInfo = currentTimerInfo = 0; + firstTimerInfo = 0; while (maxCount--) { currentTime = updateCurrentTime(); @@ -575,7 +572,7 @@ int QTimerInfoList::activateTimers() if (isEmpty()) break; - currentTimerInfo = first(); + QTimerInfo *currentTimerInfo = first(); if (currentTime < currentTimerInfo->timeout) break; // no timer has expired @@ -602,21 +599,19 @@ int QTimerInfoList::activateTimers() if (currentTimerInfo->interval.tv_usec > 0 || currentTimerInfo->interval.tv_sec > 0) n_act++; - if (!currentTimerInfo->inTimerEvent) { + if (!currentTimerInfo->activateRef) { // send event, but don't allow it to recurse - currentTimerInfo->inTimerEvent = true; + currentTimerInfo->activateRef = ¤tTimerInfo; QTimerEvent e(currentTimerInfo->id); QCoreApplication::sendEvent(currentTimerInfo->obj, &e); if (currentTimerInfo) - currentTimerInfo->inTimerEvent = false; + currentTimerInfo->activateRef = 0; } } - firstTimerInfo = saveFirstTimerInfo; - currentTimerInfo = saveCurrentTimerInfo; - + firstTimerInfo = 0; return n_act; } diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h index d38acf3..e1b6b1d 100644 --- a/src/corelib/kernel/qeventdispatcher_unix_p.h +++ b/src/corelib/kernel/qeventdispatcher_unix_p.h @@ -77,7 +77,7 @@ struct QTimerInfo { timeval interval; // - timer interval timeval timeout; // - when to sent event QObject *obj; // - object to receive event - bool inTimerEvent; + QTimerInfo **activateRef; // - ref from activateTimers }; class QTimerInfoList : public QList<QTimerInfo*> @@ -92,7 +92,7 @@ class QTimerInfoList : public QList<QTimerInfo*> #endif // state variables used by activateTimers() - QTimerInfo *firstTimerInfo, *currentTimerInfo; + QTimerInfo *firstTimerInfo; public: QTimerInfoList(); diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 79a38cd..9854e68 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1009,8 +1009,11 @@ QByteArray QMetaObject::normalizedSignature(const char *method) int argdepth = 0; int templdepth = 0; while (*d) { - if (argdepth == 1) + if (argdepth == 1) { d = qNormalizeType(d, templdepth, result); + if (!*d) //most likely an invalid signature. + break; + } if (*d == '(') ++argdepth; if (*d == ')') diff --git a/src/corelib/thread/qmutexpool.cpp b/src/corelib/thread/qmutexpool.cpp index d9abdc5..59211fb 100644 --- a/src/corelib/thread/qmutexpool.cpp +++ b/src/corelib/thread/qmutexpool.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE -// qt_global_mutexpool is here for backwards compatability only, +// qt_global_mutexpool is here for backwards compatibility only, // use QMutexpool::instance() in new clode. Q_CORE_EXPORT QMutexPool *qt_global_mutexpool = 0; Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (QMutex::Recursive)) diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h index 8e7bc21..d3db4e9 100644 --- a/src/corelib/tools/qbytearraymatcher.h +++ b/src/corelib/tools/qbytearraymatcher.h @@ -78,7 +78,7 @@ private: QByteArrayMatcherPrivate *d; QByteArray q_pattern; #ifdef Q_CC_RVCT -// explicitely allow anonymous unions for RVCT to prevent compiler warnings +// explicitly allow anonymous unions for RVCT to prevent compiler warnings # pragma push # pragma anon_unions #endif diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 1734b03..ee791e0 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -91,6 +91,16 @@ animation.setDuration(1000); animation.setEasingCurve(QEasingCurve::InOutQuad); \endcode + + The ability to set an amplitude, overshoot, or period depends on the QEasingCurve type. Amplitude access + is available to curves that behave as springs such as elastic and bounce curves. Changing the amplitude changes + the height of the curve. Period access is only available to elastic curves and setting a higher period slows + the rate of bounce. Only curves that have "boomerang" behaviors such as the InBack, OutBack, InOutBack, and OutInBack + have overshoot settings. These curves will interpolate beyond the end points and return to the end point, + acting similar to a boomerang. + + The \l{Easing Curves Example} contains samples of QEasingCurve types and lets you change the curve settings. + */ /*! @@ -140,15 +150,15 @@ accelerating from zero velocity. \value OutQuart \inlineimage qeasingcurve-outquart.png \br - Easing curve for a cubic (t^4) function: + Easing curve for a quartic (t^4) function: decelerating to zero velocity. \value InOutQuart \inlineimage qeasingcurve-inoutquart.png \br - Easing curve for a cubic (t^4) function: + Easing curve for a quartic (t^4) function: acceleration until halfway, then deceleration. \value OutInQuart \inlineimage qeasingcurve-outinquart.png \br - Easing curve for a cubic (t^4) function: + Easing curve for a quartic (t^4) function: deceleration until halfway, then acceleration. \value InQuint \inlineimage qeasingcurve-inquint.png \br @@ -156,15 +166,15 @@ in: accelerating from zero velocity. \value OutQuint \inlineimage qeasingcurve-outquint.png \br - Easing curve for a cubic (t^5) function: + Easing curve for a quintic (t^5) function: decelerating to zero velocity. \value InOutQuint \inlineimage qeasingcurve-inoutquint.png \br - Easing curve for a cubic (t^5) function: + Easing curve for a quintic (t^5) function: acceleration until halfway, then deceleration. \value OutInQuint \inlineimage qeasingcurve-outinquint.png \br - Easing curve for a cubic (t^5) function: + Easing curve for a quintic (t^5) function: deceleration until halfway, then acceleration. \value InSine \inlineimage qeasingcurve-insine.png \br diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc index e60243f..d49c09e 100644 --- a/src/corelib/tools/qpair.qdoc +++ b/src/corelib/tools/qpair.qdoc @@ -35,7 +35,7 @@ pair type is not available. It stores one value of type T1 and one value of type T2. It can be used as a return value for a function that needs to return two values, or as the value type of - a \l{generic container}. + a \l{Container classes}{generic container}. Here's an example of a QPair that stores one QString and one \c double value: @@ -53,7 +53,7 @@ requirements; these requirements are documented on a per-function basis. - \sa {Generic Containers} + \sa {Container Classes} */ /*! \typedef QPair::first_type diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index f102598..5fac960 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -67,8 +67,8 @@ QSharedPointer and QWeakPointer are thread-safe and operate atomically on the pointer value. Different threads can also access - the same QSharedPointer or QWeakPointer object at the same time - without need for locking mechanisms. + the QSharedPointer or QWeakPointer pointing to the same object at + the same time without need for locking mechanisms. It should be noted that, while the pointer value can be accessed in this manner, QSharedPointer and QWeakPointer provide no diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 5ff0f97..a3148fb 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -150,7 +150,9 @@ enum CPUFeatures { Q_CORE_EXPORT uint qDetectCPUFeatures(); -Q_CORE_EXPORT uint qDetectCPUFeatures(); + +#define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ + for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i) QT_END_NAMESPACE diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index d6ab5da..2fd9a0b 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -6645,8 +6645,9 @@ QString QString::arg(qlonglong a, int fieldWidth, int base, const QChar &fillCha QString locale_arg; if (d.locale_occurrences > 0) { QLocale locale; - locale_arg = locale.d()->longLongToString(a, -1, base, fieldWidth, - flags | QLocalePrivate::ThousandsGroup); + if (!locale.numberOptions() & QLocale::OmitGroupSeparator) + flags |= QLocalePrivate::ThousandsGroup; + locale_arg = locale.d()->longLongToString(a, -1, base, fieldWidth, flags); } return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar); @@ -6688,8 +6689,9 @@ QString QString::arg(qulonglong a, int fieldWidth, int base, const QChar &fillCh QString locale_arg; if (d.locale_occurrences > 0) { QLocale locale; - locale_arg = locale.d()->unsLongLongToString(a, -1, base, fieldWidth, - flags | QLocalePrivate::ThousandsGroup); + if (!locale.numberOptions() & QLocale::OmitGroupSeparator) + flags |= QLocalePrivate::ThousandsGroup; + locale_arg = locale.d()->unsLongLongToString(a, -1, base, fieldWidth, flags); } return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar); @@ -6822,7 +6824,8 @@ QString QString::arg(double a, int fieldWidth, char fmt, int prec, const QChar & if (d.locale_occurrences > 0) { QLocale locale; - flags |= QLocalePrivate::ThousandsGroup; + if (!locale.numberOptions() & QLocale::OmitGroupSeparator) + flags |= QLocalePrivate::ThousandsGroup; locale_arg = locale.d()->doubleToString(a, prec, form, fieldWidth, flags); } diff --git a/src/corelib/tools/qstringmatcher.h b/src/corelib/tools/qstringmatcher.h index 1aafcb8..451aeb6 100644 --- a/src/corelib/tools/qstringmatcher.h +++ b/src/corelib/tools/qstringmatcher.h @@ -78,7 +78,7 @@ private: QString q_pattern; Qt::CaseSensitivity q_cs; #ifdef Q_CC_RVCT -// explicitely allow anonymous unions for RVCT to prevent compiler warnings +// explicitly allow anonymous unions for RVCT to prevent compiler warnings # pragma push # pragma anon_unions #endif diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 853f311..91c3a19 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -1523,7 +1523,7 @@ ushort QXmlStreamReaderPrivate::getChar_helper() decoder = codec->makeDecoder(); } - decoder->toUnicode(&readBuffer, rawReadBuffer.data(), nbytesread); + decoder->toUnicode(&readBuffer, rawReadBuffer.constData(), nbytesread); if(lockEncoding && decoder->hasFailure()) { raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content.")); diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp index fbbc6a2..0bde085 100644 --- a/src/dbus/qdbusargument.cpp +++ b/src/dbus/qdbusargument.cpp @@ -825,7 +825,7 @@ void QDBusArgument::endStructure() \snippet doc/src/snippets/code/src_qdbus_qdbusargument.cpp 6 If the type you want to marshall is a QList, QVector or any of the - Qt's \l {Generic Containers} that take one template parameter, + Qt's \l {Container Classes} that take one template parameter, you need not declare an \c{operator<<} function for it, since QtDBus provides generic templates to do the job of marshalling the data. The same applies for STL's sequence containers, such @@ -952,7 +952,7 @@ void QDBusArgument::endStructure() const \snippet doc/src/snippets/code/src_qdbus_qdbusargument.cpp 9 If the type you want to demarshall is a QList, QVector or any of the - Qt's \l {Generic Containers} that take one template parameter, you + Qt's \l {Container Classes} that take one template parameter, you need not declare an \c{operator>>} function for it, since QtDBus provides generic templates to do the job of demarshalling the data. The same applies for STL's sequence containers, such as \c {std::list}, diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 5cbb8ca..bf771a8 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -173,6 +173,9 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP The connection is then torn down using the disconnectFromBus() function. + Once disconnected, calling connectToBus() will not reestablish a + connection, you must create a new QDBusConnection instance. + As a convenience for the two most common connection types, the sessionBus() and systemBus() functions return open connections to the session server daemon and the system server daemon, @@ -209,6 +212,7 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP \value ExportScriptableSlots export this object's scriptable slots \value ExportScriptableSignals export this object's scriptable signals \value ExportScriptableProperties export this object's scriptable properties + \value ExportScriptableInvokables export this object's scriptable invokables \value ExportScriptableContents shorthand form for ExportScriptableSlots | ExportScriptableSignals | ExportScriptableProperties @@ -216,6 +220,7 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP \value ExportNonScriptableSlots export this object's non-scriptable slots \value ExportNonScriptableSignals export this object's non-scriptable signals \value ExportNonScriptableProperties export this object's non-scriptable properties + \value ExportNonScriptableInvokables export this object's non-scriptable invokables \value ExportNonScriptableContents shorthand form for ExportNonScriptableSlots | ExportNonScriptableSignals | ExportNonScriptableProperties @@ -223,8 +228,8 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP \value ExportAllSlots export all of this object's slots \value ExportAllSignals export all of this object's signals \value ExportAllProperties export all of this object's properties + \value ExportAllInvokables export all of this object's invokables \value ExportAllContents export all of this object's contents - \value ExportChildObjects export this object's child objects \sa registerObject(), QDBusAbstractAdaptor, {usingadaptors.html}{Using adaptors} @@ -853,10 +858,6 @@ QDBusConnectionInterface *QDBusConnection::interface() const /*! Returns true if this QDBusConnection object is connected. - - If it isn't connected, calling connectToBus() on the same - connection name will not make be connected. You need to call the - QDBusConnection constructor again. */ bool QDBusConnection::isConnected() const { diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativedebug.cpp index b950aef..154df51 100644 --- a/src/declarative/debugger/qdeclarativedebug.cpp +++ b/src/declarative/debugger/qdeclarativedebug.cpp @@ -507,7 +507,7 @@ QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObject(const QDeclar QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId() - << false; + << false << true; d->client->sendMessage(message); } else { query->m_state = QDeclarativeDebugQuery::Error; @@ -530,7 +530,7 @@ QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObjectRecursive(cons QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId() - << true; + << true << true; d->client->sendMessage(message); } else { query->m_state = QDeclarativeDebugQuery::Error; diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index 878f42f..c2f7709 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -125,7 +125,7 @@ public: QObject::connect(this, SIGNAL(invalidPacket()), parent, SIGNAL(invalidPacket())); QObject::connect(dev, SIGNAL(readyRead()), - this, SLOT(readyToRead())); + this, SLOT(readyToRead()), Qt::QueuedConnection); QObject::connect(dev, SIGNAL(aboutToClose()), this, SLOT(aboutToClose())); QObject::connect(dev, SIGNAL(bytesWritten(qint64)), diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index d8527d3..e0a2149 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -62,7 +62,8 @@ QT_BEGIN_NAMESPACE \qmlclass AnimatedImage QDeclarativeAnimatedImage \inherits Image \since 4.7 - + \ingroup basic-visual-elements + The AnimatedImage element provides for playing animations stored as images containing a series of frames, such as GIF files. diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 4881248..e0c7fc2 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -56,6 +56,7 @@ QT_BEGIN_NAMESPACE \brief The BorderImage element provides an image that can be used as a border. \inherits Item \since 4.7 + \ingroup qm-basic-visual-elements A BorderImage breaks an image into 9 sections, as shown below: diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp index 81ec6e1..0a35a3f 100644 --- a/src/declarative/graphicsitems/qdeclarativeevents.cpp +++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp @@ -45,6 +45,8 @@ QT_BEGIN_NAMESPACE /*! \qmlclass KeyEvent QDeclarativeKeyEvent \since 4.7 + \ingroup qml-event-elements + \brief The KeyEvent object provides information about a key event. For example, the following changes the Item's state property when the Enter @@ -115,6 +117,8 @@ Item { /*! \qmlclass MouseEvent QDeclarativeMouseEvent \since 4.7 + \ingroup qml-event-elements + \brief The MouseEvent object provides information about a mouse event. The position of the mouse can be found via the x and y properties. diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 19cabdd..7fee44e 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -345,6 +345,8 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() /*! \qmlclass Flickable QDeclarativeFlickable \since 4.7 + \ingroup qml-basic-interaction-elements + \brief The Flickable item provides a surface that can be "flicked". \inherits Item @@ -1027,7 +1029,7 @@ void QDeclarativeFlickable::cancelFlick() void QDeclarativeFlickablePrivate::data_append(QDeclarativeListProperty<QObject> *prop, QObject *o) { - QDeclarativeItem *i = qobject_cast<QDeclarativeItem *>(o); + QGraphicsObject *i = qobject_cast<QGraphicsObject *>(o); if (i) i->setParentItem(static_cast<QDeclarativeFlickablePrivate*>(prop->data)->contentItem); else diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index 8c9d2dd..6ce0fa6 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -70,6 +70,8 @@ public: /*! \qmlclass Flipable QDeclarativeFlipable \since 4.7 + \ingroup qml-basic-interaction-elements + \brief The Flipable item provides a surface that can be flipped. \inherits Item @@ -83,10 +85,16 @@ public: \image flipable.gif - The \l Rotation element is used to specify the angle and axis of the flip, - and the \l State defines the changes in angle which produce the flipping - effect. Finally, the \l Transition creates the animation that changes the - angle over one second. + The \l Rotation element is used to specify the angle and axis of the flip. + When \c flipped is \c true, the item changes to the "back" state, where + the angle is changed to 180 degrees to produce the flipping effect. + Finally, the \l Transition creates the animation that changes the + angle over one second: when the item changes between its "back" and + default states, the NumberAnimation animates the angle between + its old and new values. + + See the \l {QML States} and \l {QML Animation} documentation for more + details on state changes and how animations work within transitions. \sa {declarative/ui-components/flipable}{Flipable example} */ diff --git a/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp b/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp index bd60e25..5c7959a 100644 --- a/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp +++ b/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp @@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE /*! \qmlclass FocusPanel QDeclarativeFocusPanel \since 4.7 + \ingroup qml-basic-interaction-elements + \brief The FocusPanel item explicitly creates a focus panel. \inherits Item diff --git a/src/declarative/graphicsitems/qdeclarativefocusscope.cpp b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp index e8e6fa2..4498275 100644 --- a/src/declarative/graphicsitems/qdeclarativefocusscope.cpp +++ b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE /*! \qmlclass FocusScope QDeclarativeFocusScope \since 4.7 + \ingroup qml-basic-interaction-elements + \brief The FocusScope object explicitly creates a focus scope. \inherits Item diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 68a4c64..d67e69a 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1056,6 +1056,8 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m /*! \qmlclass GridView QDeclarativeGridView \since 4.7 + \ingroup qml-view-elements + \inherits Flickable \brief The GridView item provides a grid view of items provided by a model. diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 37736cc..47a410c 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Image QDeclarativeImage \since 4.7 + \ingroup qml-vasic-visual-elements + \brief The Image element allows you to add bitmaps to a scene. \inherits Item diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 2c295cd..0f16a79 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -69,6 +69,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Transform QGraphicsTransform + \ingroup qml-transform-elements \since 4.7 \brief The Transform elements provide a way of building advanced transformations on Items. @@ -90,6 +91,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Translate QDeclarativeTranslate + \ingroup qml-transform-elements \since 4.7 \brief The Translate object provides a way to move an Item without changing its x or y properties. @@ -131,6 +133,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Scale QGraphicsScale + \ingroup qml-transform-elements \since 4.7 \brief The Scale element provides a way to scale an Item. @@ -172,6 +175,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Rotation QGraphicsRotation + \ingroup qml-transform-elements \since 4.7 \brief The Rotation object provides a way to rotate an Item. @@ -419,6 +423,7 @@ void QDeclarativeItemKeyFilter::componentComplete() /*! \qmlclass KeyNavigation QDeclarativeKeyNavigationAttached + \ingroup qml-basic-interaction-elements \since 4.7 \brief The KeyNavigation attached property supports key navigation by arrow keys. @@ -725,6 +730,7 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post) /*! \qmlclass Keys QDeclarativeKeysAttached + \ingroup qml-basic-interaction-elements \since 4.7 \brief The Keys attached property provides key handling to Items. @@ -1310,6 +1316,7 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec /*! \qmlclass Item QDeclarativeItem + \ingroup qml-basic-visual-elements \since 4.7 \brief The Item is the most basic of all visual items in QML. @@ -1432,11 +1439,6 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec */ /*! - \fn void QDeclarativeItem::childrenChanged() - \internal -*/ - -/*! \fn void QDeclarativeItem::focusChanged(bool) \internal */ @@ -2411,18 +2413,7 @@ void QDeclarativeItemPrivate::focusChanged(bool flag) Q_Q(QDeclarativeItem); if (!(flags & QGraphicsItem::ItemIsFocusScope) && parent) emit q->activeFocusChanged(flag); //see also QDeclarativeItemPrivate::subFocusItemChange() - - bool inScope = false; - QGraphicsItem *p = parent; - while (p) { - if (p->flags() & QGraphicsItem::ItemIsFocusScope) { - inScope = true; - break; - } - p = p->parentItem(); - } - if (!inScope) - emit q->focusChanged(flag); + emit q->focusChanged(flag); } /*! \internal */ @@ -2470,7 +2461,7 @@ QDeclarativeListProperty<QDeclarativeState> QDeclarativeItemPrivate::states() } \endqml - \sa {state-transitions}{Transitions} + \sa {qdeclarativeanimation.html#transitions}{QML Transitions} */ @@ -2516,7 +2507,9 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transi This property holds whether clipping is enabled. if clipping is enabled, an item will clip its own painting, as well - as the painting of its children, to its bounding rectangle. + as the painting of its children, to its bounding rectangle. If you set + clipping during an item's paint operation, remember to re-set it to + prevent clipping the rest of your scene. Non-rectangular clipping regions are not supported for performance reasons. */ @@ -2740,12 +2733,12 @@ QVariant QDeclarativeItem::itemChange(GraphicsItemChange change, } break; case ItemChildAddedChange: - if (d->_contents) + if (d->_contents && d->componentComplete) d->_contents->childAdded(qobject_cast<QDeclarativeItem*>( value.value<QGraphicsItem*>())); break; case ItemChildRemovedChange: - if (d->_contents) + if (d->_contents && d->componentComplete) d->_contents->childRemoved(qobject_cast<QDeclarativeItem*>( value.value<QGraphicsItem*>())); break; @@ -2855,6 +2848,41 @@ void QDeclarativeItem::setSmooth(bool smooth) } /*! + \property QDeclarativeItem::anchors + \internal +*/ + +/*! + \property QDeclarativeItem::left + \internal +*/ + +/*! + \property QDeclarativeItem::right + \internal +*/ + +/*! + \property QDeclarativeItem::horizontalCenter + \internal +*/ + +/*! + \property QDeclarativeItem::top + \internal +*/ + +/*! + \property QDeclarativeItem::bottom + \internal +*/ + +/*! + \property QDeclarativeItem::verticalCenter + \internal +*/ + +/*! \property QDeclarativeItem::focus \internal */ @@ -2875,6 +2903,41 @@ void QDeclarativeItem::setSmooth(bool smooth) */ /*! + \property QDeclarativeItem::baseline + \internal +*/ + +/*! + \property QDeclarativeItem::data + \internal +*/ + +/*! + \property QDeclarativeItem::resources + \internal +*/ + +/*! + \property QDeclarativeItem::state + \internal +*/ + +/*! + \property QDeclarativeItem::states + \internal +*/ + +/*! + \property QDeclarativeItem::transformOriginPoint + \internal +*/ + +/*! + \property QDeclarativeItem::transitions + \internal +*/ + +/*! \internal Return the width of the item */ @@ -3142,8 +3205,7 @@ bool QDeclarativeItem::hasActiveFocus() const { Q_D(const QDeclarativeItem); return focusItem() == this || - (d->flags & QGraphicsItem::ItemIsFocusScope && focusItem() != 0) || - (!parentItem() && focusItem() != 0); + (d->flags & QGraphicsItem::ItemIsFocusScope && focusItem() != 0); } /*! @@ -3163,10 +3225,8 @@ bool QDeclarativeItem::hasActiveFocus() const } \endqml - For the purposes of this property, the top level item in the scene - is assumed to act like a focus scope, and to always have active focus - when the scene has focus. On a practical level, that means the following - QML will give active focus to \c input on startup. + For the purposes of this property, the scene as a whole is assumed to act like a focus scope. + On a practical level, that means the following QML will give active focus to \c input on startup. \qml Rectangle { @@ -3192,7 +3252,7 @@ bool QDeclarativeItem::hasFocus() const p = p->parentItem(); } - return hasActiveFocus() ? true : (!QGraphicsItem::parentItem() ? true : false); + return hasActiveFocus(); } /*! \internal */ diff --git a/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp index 38d5f59..8509473 100644 --- a/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass LayoutItem QDeclarativeLayoutItem + \ingroup qml-utility-elements \since 4.7 \brief The LayoutItem element allows declarative UI elements to be placed inside Qt's Graphics View layouts. diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 82b3e1c..ec1b6cf 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1021,7 +1021,7 @@ void QDeclarativeListViewPrivate::updateCurrent(int modelIndex) if (oldCurrentItem && (!currentItem || oldCurrentItem->item != currentItem->item)) oldCurrentItem->attached->setIsCurrentItem(false); if (currentItem) { - if (modelIndex == visibleIndex - 1) { + if (modelIndex == visibleIndex - 1 && visibleItems.count()) { // We can calculate exact postion in this case currentItem->setPosition(visibleItems.first()->position() - currentItem->size() - spacing); } else { @@ -1357,6 +1357,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m /*! \qmlclass ListView QDeclarativeListView + \ingroup qml-view-elements \since 4.7 \inherits Flickable \brief The ListView item provides a list view of items provided by a model. diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index d28181e..4c6268f 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -108,6 +108,7 @@ void QDeclarativeLoaderPrivate::initResize() /*! \qmlclass Loader QDeclarativeLoader + \ingroup qml-utility-elements \since 4.7 \inherits Item diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index dcdb9f6..2823888 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -180,6 +180,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() /*! \qmlclass MouseArea QDeclarativeMouseArea + \ingroup qml-basic-interaction-elements \since 4.7 \brief The MouseArea item enables simple mouse handling. \inherits Item diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index c48011d3..62e03e7 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass PathElement QDeclarativePathElement + \ingroup qml-view-elements \since 4.7 \brief PathElement is the base path type. @@ -67,6 +68,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Path QDeclarativePath + \ingroup qml-view-elements \since 4.7 \brief A Path object defines a path for use by \l PathView. @@ -497,6 +499,7 @@ void QDeclarativeCurve::setY(qreal y) /*! \qmlclass PathAttribute QDeclarativePathAttribute + \ingroup qml-view-elements \since 4.7 \brief The PathAttribute allows setting an attribute at a given position in a Path. @@ -587,6 +590,7 @@ void QDeclarativePathAttribute::setValue(qreal value) /*! \qmlclass PathLine QDeclarativePathLine + \ingroup qml-view-elements \since 4.7 \brief The PathLine defines a straight line. @@ -627,6 +631,7 @@ void QDeclarativePathLine::addToPath(QPainterPath &path) /*! \qmlclass PathQuad QDeclarativePathQuad + \ingroup qml-view-elements \since 4.7 \brief The PathQuad defines a quadratic Bezier curve with a control point. @@ -713,6 +718,7 @@ void QDeclarativePathQuad::addToPath(QPainterPath &path) /*! \qmlclass PathCubic QDeclarativePathCubic + \ingroup qml-view-elements \since 4.7 \brief The PathCubic defines a cubic Bezier curve with two control points. @@ -828,6 +834,7 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path) /*! \qmlclass PathPercent QDeclarativePathPercent + \ingroup qml-view-elements \since 4.7 \brief The PathPercent manipulates the way a path is interpreted. diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 06ac275..535fb90 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -326,6 +326,7 @@ void QDeclarativePathViewPrivate::regenerate() /*! \qmlclass PathView QDeclarativePathView + \ingroup qml-view-elements \since 4.7 \brief The PathView element lays out model-provided items on a path. \inherits Item @@ -426,7 +427,7 @@ QDeclarativePathView::~QDeclarativePathView() The model provides a set of data that is used to create the items for the view. For large or dynamic datasets the model is usually provided by a C++ model object. - Models can also be created directly in XML, using the ListModel element. + Models can also be created directly in QML, using the ListModel element. \sa {qmlmodels}{Data Models} */ @@ -650,8 +651,8 @@ void QDeclarativePathViewPrivate::setOffset(qreal o) so as to stay with the current item. The below example demonstrates how to make a simple highlight. Note the use - of the PathView.onPath property to ensure that the highlight is hidden - when flicked off of the path. + of the \l{PathView::onPath}{PathView.onPath} attached property to ensure that + the highlight is hidden when flicked away from the path. \code Component { @@ -1061,7 +1062,7 @@ void QDeclarativePathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) if (!d->stealMouse) { QPointF delta = event->pos() - d->startPoint; - if (qAbs(delta.x()) > QApplication::startDragDistance() && qAbs(delta.y()) > QApplication::startDragDistance()) + if (qAbs(delta.x()) > QApplication::startDragDistance() || qAbs(delta.y()) > QApplication::startDragDistance()) d->stealMouse = true; } diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 179f13d..4ceb5d9 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -61,16 +61,37 @@ static const QDeclarativeItemPrivate::ChangeTypes watchedChanges | QDeclarativeItemPrivate::Opacity | QDeclarativeItemPrivate::Destroyed; -void QDeclarativeBasePositionerPrivate::watchChanges(QDeclarativeItem *other) +void QDeclarativeBasePositionerPrivate::watchChanges(QGraphicsObject *other) { - QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other)); - otherPrivate->addItemChangeListener(this, watchedChanges); + if (QGraphicsItemPrivate::get(other)->isDeclarativeItem) { + QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other)); + otherPrivate->addItemChangeListener(this, watchedChanges); + } else { + Q_Q(QDeclarativeBasePositioner); + QObject::connect(other, SIGNAL(widthChanged()), q, SLOT(graphicsWidgetGeometryChanged())); + QObject::connect(other, SIGNAL(heightChanged()), q, SLOT(graphicsWidgetGeometryChanged())); + QObject::connect(other, SIGNAL(opacityChanged()), q, SLOT(graphicsWidgetGeometryChanged())); + QObject::connect(other, SIGNAL(visibleChanged()), q, SLOT(graphicsWidgetGeometryChanged())); + } } -void QDeclarativeBasePositionerPrivate::unwatchChanges(QDeclarativeItem* other) +void QDeclarativeBasePositionerPrivate::unwatchChanges(QGraphicsObject* other) { - QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other)); - otherPrivate->removeItemChangeListener(this, watchedChanges); + if (QGraphicsItemPrivate::get(other)->isDeclarativeItem) { + QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other)); + otherPrivate->removeItemChangeListener(this, watchedChanges); + } else { + Q_Q(QDeclarativeBasePositioner); + QObject::disconnect(other, SIGNAL(widthChanged()), q, SLOT(graphicsWidgetGeometryChanged())); + QObject::disconnect(other, SIGNAL(heightChanged()), q, SLOT(graphicsWidgetGeometryChanged())); + QObject::disconnect(other, SIGNAL(opacityChanged()), q, SLOT(graphicsWidgetGeometryChanged())); + QObject::disconnect(other, SIGNAL(visibleChanged()), q, SLOT(graphicsWidgetGeometryChanged())); + } +} + +void QDeclarativeBasePositioner::graphicsWidgetGeometryChanged() +{ + prePositioning(); } /*! @@ -174,16 +195,16 @@ QVariant QDeclarativeBasePositioner::itemChange(GraphicsItemChange change, Q_D(QDeclarativeBasePositioner); if (change == ItemChildAddedChange){ QGraphicsItem* item = value.value<QGraphicsItem*>(); - QDeclarativeItem* child = 0; + QGraphicsObject* child = 0; if(item) - child = qobject_cast<QDeclarativeItem*>(item->toGraphicsObject()); + child = item->toGraphicsObject(); if (child) prePositioning(); } else if (change == ItemChildRemovedChange) { QGraphicsItem* item = value.value<QGraphicsItem*>(); - QDeclarativeItem* child = 0; + QGraphicsObject* child = 0; if(item) - child = qobject_cast<QDeclarativeItem*>(item->toGraphicsObject()); + child = item->toGraphicsObject(); if (child) { QDeclarativeBasePositioner::PositionedItem posItem(child); int idx = positionedItems.find(posItem); @@ -194,7 +215,6 @@ QVariant QDeclarativeBasePositioner::itemChange(GraphicsItemChange change, prePositioning(); } } - return QDeclarativeItem::itemChange(change, value); } @@ -216,10 +236,10 @@ void QDeclarativeBasePositioner::prePositioning() QPODVector<PositionedItem,8> oldItems; positionedItems.copyAndClear(oldItems); for (int ii = 0; ii < children.count(); ++ii) { - QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(ii)); + QGraphicsObject *child = children.at(ii)->toGraphicsObject(); if (!child) continue; - QDeclarativeItemPrivate *childPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(child)); + QGraphicsItemPrivate *childPrivate = static_cast<QGraphicsItemPrivate*>(QGraphicsItemPrivate::get(child)); PositionedItem *item = 0; PositionedItem posItem(child); int wIdx = oldItems.find(posItem); @@ -302,14 +322,15 @@ void QDeclarativeBasePositioner::finishApplyTransitions() d->moveActions.clear(); } -static inline bool isInvisible(QDeclarativeItem *child) +static inline bool isInvisible(QGraphicsObject *child) { - QDeclarativeItemPrivate *childPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(child)); - return child->opacity() == 0.0 || childPrivate->explicitlyHidden || !child->width() || !child->height(); + QGraphicsItemPrivate *childPrivate = static_cast<QGraphicsItemPrivate*>(QGraphicsItemPrivate::get(child)); + return child->opacity() == 0.0 || childPrivate->explicitlyHidden || !childPrivate->width() || !childPrivate->height(); } /*! \qmlclass Column QDeclarativeColumn + \ingroup qml-positioning-elements \since 4.7 \brief The Column item arranges its children vertically. \inherits Item @@ -440,9 +461,9 @@ void QDeclarativeColumn::doPositioning(QSizeF *contentSize) if(child.item->y() != voffset) positionY(voffset, child); - contentSize->setWidth(qMax(contentSize->width(), child.item->width())); + contentSize->setWidth(qMax(contentSize->width(), QGraphicsItemPrivate::get(child.item)->width())); - voffset += child.item->height(); + voffset += QGraphicsItemPrivate::get(child.item)->height(); voffset += spacing(); } @@ -454,8 +475,8 @@ void QDeclarativeColumn::reportConflictingAnchors() QDeclarativeBasePositionerPrivate *d = static_cast<QDeclarativeBasePositionerPrivate*>(QDeclarativeBasePositionerPrivate::get(this)); for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); - if (child.item) { - QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors; + if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) { + QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors; if (anchors) { QDeclarativeAnchors::Anchors usedAnchors = anchors->usedAnchors(); if (usedAnchors & QDeclarativeAnchors::TopAnchor || @@ -475,6 +496,7 @@ void QDeclarativeColumn::reportConflictingAnchors() /*! \qmlclass Row QDeclarativeRow + \ingroup qml-positioning-elements \since 4.7 \brief The Row item arranges its children horizontally. \inherits Item @@ -579,9 +601,9 @@ void QDeclarativeRow::doPositioning(QSizeF *contentSize) if(child.item->x() != hoffset) positionX(hoffset, child); - contentSize->setHeight(qMax(contentSize->height(), child.item->height())); + contentSize->setHeight(qMax(contentSize->height(), QGraphicsItemPrivate::get(child.item)->height())); - hoffset += child.item->width(); + hoffset += QGraphicsItemPrivate::get(child.item)->width(); hoffset += spacing(); } @@ -593,8 +615,8 @@ void QDeclarativeRow::reportConflictingAnchors() QDeclarativeBasePositionerPrivate *d = static_cast<QDeclarativeBasePositionerPrivate*>(QDeclarativeBasePositionerPrivate::get(this)); for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); - if (child.item) { - QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors; + if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) { + QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors; if (anchors) { QDeclarativeAnchors::Anchors usedAnchors = anchors->usedAnchors(); if (usedAnchors & QDeclarativeAnchors::LeftAnchor || @@ -613,6 +635,7 @@ void QDeclarativeRow::reportConflictingAnchors() /*! \qmlclass Grid QDeclarativeGrid + \ingroup qml-positioning-elements \since 4.7 \brief The Grid item positions its children in a grid. \inherits Item @@ -814,10 +837,11 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) const PositionedItem &child = positionedItems.at(childIndex++); if (!child.item || isInvisible(child.item)) continue; - if (child.item->width() > maxColWidth[j]) - maxColWidth[j] = child.item->width(); - if (child.item->height() > maxRowHeight[i]) - maxRowHeight[i] = child.item->height(); + QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child.item); + if (childPrivate->width() > maxColWidth[j]) + maxColWidth[j] = childPrivate->width(); + if (childPrivate->height() > maxRowHeight[i]) + maxRowHeight[i] = childPrivate->height(); } } } else { @@ -833,10 +857,11 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) const PositionedItem &child = positionedItems.at(childIndex++); if (!child.item || isInvisible(child.item)) continue; - if (child.item->width() > maxColWidth[j]) - maxColWidth[j] = child.item->width(); - if (child.item->height() > maxRowHeight[i]) - maxRowHeight[i] = child.item->height(); + QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child.item); + if (childPrivate->width() > maxColWidth[j]) + maxColWidth[j] = childPrivate->width(); + if (childPrivate->height() > maxRowHeight[i]) + maxRowHeight[i] = childPrivate->height(); } } } @@ -855,7 +880,7 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) } if (m_flow == LeftToRight) { - contentSize->setWidth(qMax(contentSize->width(), xoffset + child.item->width())); + contentSize->setWidth(qMax(contentSize->width(), xoffset + QGraphicsItemPrivate::get(child.item)->width())); contentSize->setHeight(yoffset + maxRowHeight[curRow]); xoffset+=maxColWidth[curCol]+spacing(); @@ -869,7 +894,7 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) break; } } else { - contentSize->setHeight(qMax(contentSize->height(), yoffset + child.item->height())); + contentSize->setHeight(qMax(contentSize->height(), yoffset + QGraphicsItemPrivate::get(child.item)->height())); contentSize->setWidth(xoffset + maxColWidth[curCol]); yoffset+=maxRowHeight[curRow]+spacing(); @@ -891,8 +916,8 @@ void QDeclarativeGrid::reportConflictingAnchors() QDeclarativeBasePositionerPrivate *d = static_cast<QDeclarativeBasePositionerPrivate*>(QDeclarativeBasePositionerPrivate::get(this)); for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); - if (child.item) { - QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors; + if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) { + QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors; if (anchors && (anchors->usedAnchors() || anchors->fill() || anchors->centerIn())) { d->anchorConflict = true; break; @@ -905,6 +930,7 @@ void QDeclarativeGrid::reportConflictingAnchors() /*! \qmlclass Flow QDeclarativeFlow + \ingroup qml-positioning-elements \since 4.7 \brief The Flow item arranges its children side by side, wrapping as necessary. \inherits Item @@ -1026,14 +1052,15 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) if (!child.item || isInvisible(child.item)) continue; + QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child.item); if (d->flow == LeftToRight) { - if (widthValid() && hoffset && hoffset + child.item->width() > width()) { + if (widthValid() && hoffset && hoffset + childPrivate->width() > width()) { hoffset = 0; voffset += linemax + spacing(); linemax = 0; } } else { - if (heightValid() && voffset && voffset + child.item->height() > height()) { + if (heightValid() && voffset && voffset + childPrivate->height() > height()) { voffset = 0; hoffset += linemax + spacing(); linemax = 0; @@ -1045,17 +1072,17 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) positionY(voffset, child); } - contentSize->setWidth(qMax(contentSize->width(), hoffset + child.item->width())); - contentSize->setHeight(qMax(contentSize->height(), voffset + child.item->height())); + contentSize->setWidth(qMax(contentSize->width(), hoffset + childPrivate->width())); + contentSize->setHeight(qMax(contentSize->height(), voffset + childPrivate->height())); if (d->flow == LeftToRight) { - hoffset += child.item->width(); + hoffset += childPrivate->width(); hoffset += spacing(); - linemax = qMax(linemax, qCeil(child.item->height())); + linemax = qMax(linemax, qCeil(childPrivate->height())); } else { - voffset += child.item->height(); + voffset += childPrivate->height(); voffset += spacing(); - linemax = qMax(linemax, qCeil(child.item->width())); + linemax = qMax(linemax, qCeil(childPrivate->width())); } } } @@ -1065,8 +1092,8 @@ void QDeclarativeFlow::reportConflictingAnchors() Q_D(QDeclarativeFlow); for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); - if (child.item) { - QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors; + if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) { + QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors; if (anchors && (anchors->usedAnchors() || anchors->fill() || anchors->centerIn())) { d->anchorConflict = true; break; diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index c03e518..f9ecc0a 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -91,14 +91,16 @@ Q_SIGNALS: protected Q_SLOTS: void prePositioning(); + void graphicsWidgetGeometryChanged(); protected: virtual void doPositioning(QSizeF *contentSize)=0; virtual void reportConflictingAnchors()=0; - struct PositionedItem { - PositionedItem(QDeclarativeItem *i) : item(i), isNew(false), isVisible(true) {} + class PositionedItem { + public : + PositionedItem(QGraphicsObject *i) : item(i), isNew(false), isVisible(true) {} bool operator==(const PositionedItem &other) const { return other.item == item; } - QDeclarativeItem *item; + QGraphicsObject *item; bool isNew; bool isVisible; }; diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h index 822079b..35946e9 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h @@ -94,8 +94,8 @@ public: QDeclarativeTransitionManager addTransitionManager; QDeclarativeTransitionManager moveTransitionManager; - void watchChanges(QDeclarativeItem *other); - void unwatchChanges(QDeclarativeItem* other); + void watchChanges(QGraphicsObject *other); + void unwatchChanges(QGraphicsObject* other); bool queuedPositioning : 1; bool doingPositioning : 1; bool anchorConflict : 1; @@ -123,6 +123,7 @@ public: if (newGeometry.size() != oldGeometry.size()) q->prePositioning(); } + virtual void itemVisibilityChanged(QDeclarativeItem *) { schedulePositioning(); diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index c49be46..5990c2d 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -84,6 +84,7 @@ void QDeclarativePen::setWidth(int w) /*! \qmlclass GradientStop QDeclarativeGradientStop + \ingroup qml-basic-visual-elements \since 4.7 \brief The GradientStop item defines the color at a position in a Gradient @@ -105,6 +106,7 @@ void QDeclarativeGradientStop::updateGradient() /*! \qmlclass Gradient QDeclarativeGradient + \ingroup qml-basic-visual-elements \since 4.7 \brief The Gradient item defines a gradient fill. @@ -152,6 +154,7 @@ void QDeclarativeGradient::doUpdate() /*! \qmlclass Rectangle QDeclarativeRectangle + \ingroup qml-basic-visual-elements \since 4.7 \brief The Rectangle item allows you to add rectangles to a scene. \inherits Item diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 2b268fb..4a951a2 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -62,6 +62,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() /*! \qmlclass Repeater QDeclarativeRepeater + \ingroup qml-utility-elements \since 4.7 \inherits Item @@ -133,13 +134,13 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() create items as they are required. Also, note that Repeater is \l {Item}-based, and can only repeat \l {Item}-derived objects. - For example, it cannot be used to repeat QtObjects: + For example, it cannot be used to repeat QObjects: \badcode Item { - //XXX does not work! Can't repeat QtObject as it doesn't derive from Item. + //XXX does not work! Can't repeat QObject as it doesn't derive from Item. Repeater { model: 10 - QtObject {} + QObject {} } } \endcode @@ -245,8 +246,8 @@ void QDeclarativeRepeater::setModel(const QVariant &model) connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); */ regenerate(); - emit countChanged(); } + emit countChanged(); } /*! @@ -377,6 +378,7 @@ void QDeclarativeRepeater::itemsInserted(int index, int count) d->deletables.insert(modelIndex, item); } } + emit countChanged(); } void QDeclarativeRepeater::itemsRemoved(int index, int count) @@ -391,6 +393,7 @@ void QDeclarativeRepeater::itemsRemoved(int index, int count) else break; } + emit countChanged(); } void QDeclarativeRepeater::itemsMoved(int from, int to, int count) @@ -420,6 +423,7 @@ void QDeclarativeRepeater::modelReset() if (!isComponentComplete()) return; regenerate(); + emit countChanged(); } QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index ab2be9c..fcd112e 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -162,7 +162,8 @@ QSet<QUrl> QTextDocumentWithImageResources::errors; /*! \qmlclass Text QDeclarativeText - \since 4.7 + \ingroup qml-basic-visual-elements + \since 4.7 \brief The Text item allows you to add formatted text to a scene. \inherits Item diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 8117676..b8e8726 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass TextEdit QDeclarativeTextEdit + \ingroup qml-basic-visual-elements \since 4.7 \brief The TextEdit item displays multiple lines of editable formatted text. \inherits Item diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 90f5a70..b4f36f4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass TextInput QDeclarativeTextInput + \ingroup qml-basic-visual-elements \since 4.7 \brief The TextInput item displays an editable line of text. \inherits Item @@ -276,8 +277,10 @@ void QDeclarativeTextInput::setSelectionColor(const QColor &color) QPalette p = d->control->palette(); p.setColor(QPalette::Highlight, d->selectionColor); d->control->setPalette(p); - clearCache(); - update(); + if (d->control->hasSelectedText()) { + clearCache(); + update(); + } emit selectionColorChanged(color); } @@ -302,8 +305,10 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color) QPalette p = d->control->palette(); p.setColor(QPalette::HighlightedText, d->selectedTextColor); d->control->setPalette(p); - clearCache(); - update(); + if (d->control->hasSelectedText()) { + clearCache(); + update(); + } emit selectedTextColorChanged(color); } @@ -561,6 +566,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b) /*! \qmlclass IntValidator QIntValidator + \ingroup qml-basic-visual-elements This element provides a validator for integer values. */ @@ -579,6 +585,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b) /*! \qmlclass DoubleValidator QDoubleValidator + \ingroup qml-basic-visual-elements This element provides a validator for non-integer numbers. */ @@ -617,6 +624,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b) /*! \qmlclass RegExpValidator QRegExpValidator + \ingroup qml-basic-visual-elements This element provides a validator, which counts as valid any string which matches a specified regular expression. @@ -1229,8 +1237,12 @@ void QDeclarativeTextInput::setPasswordCharacter(const QString &str) Q_D(QDeclarativeTextInput); if(str.length() < 1) return; - emit passwordCharacterChanged(); d->control->setPasswordCharacter(str.constData()[0]); + EchoMode echoMode_ = echoMode(); + if (echoMode_ == Password || echoMode_ == PasswordEchoOnEdit) { + updateSize(); + } + emit passwordCharacterChanged(); } /*! diff --git a/src/declarative/graphicsitems/qdeclarativetranslate.cpp b/src/declarative/graphicsitems/qdeclarativetranslate.cpp index be9b3f3..0bae0cd 100644 --- a/src/declarative/graphicsitems/qdeclarativetranslate.cpp +++ b/src/declarative/graphicsitems/qdeclarativetranslate.cpp @@ -125,12 +125,4 @@ void QDeclarativeTranslate::applyTo(QMatrix4x4 *matrix) const matrix->translate(d->x, d->y, 0); } -/*! - \fn QDeclarativeTranslate::positionChanged() - - QDeclarativeTranslate emits this signal when its position changes. - - \sa QDeclarativeTranslate::x, QDeclarativeTranslate::y -*/ - QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index ceb1961..764676a 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -128,6 +128,7 @@ public: /*! \qmlclass VisualItemModel QDeclarativeVisualItemModel + \ingroup qml-working-with-data \since 4.7 \brief The VisualItemModel allows items to be provided to a view. @@ -525,7 +526,7 @@ QVariant QDeclarativeVisualDataModelDataMetaObject::initialValue(int propId) QVariant value = model->m_listModelInterface->data(data->m_index, *it); return value; } else if (model->m_roles.count() == 1 && propName == "modelData") { - //for compatability with other lists, assign modelData if there is only a single role + //for compatibility with other lists, assign modelData if there is only a single role QVariant value = model->m_listModelInterface->data(data->m_index, model->m_roles.first()); return value; } @@ -644,6 +645,7 @@ QDeclarativeVisualDataModelData *QDeclarativeVisualDataModelPrivate::data(QObjec /*! \qmlclass VisualDataModel QDeclarativeVisualDataModel + \ingroup qml-working-with-data \brief The VisualDataModel encapsulates a model and delegate A VisualDataModel encapsulates a model and the delegate that will diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 507e47b..723da94 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -1628,7 +1628,7 @@ void QDeclarativeBindingCompiler::dump(const QByteArray &programData) /*! Clear the state associated with attempting to compile a specific binding. -This does not clear the global "commited binding" states. +This does not clear the global "committed binding" states. */ void QDeclarativeBindingCompilerPrivate::resetInstanceState() { diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index ba757fc..2b4a4a5 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2215,10 +2215,11 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) if (propNames.contains(prop.name)) COMPILE_EXCEPTION(&prop, tr("Duplicate property name")); - if (QString::fromUtf8(prop.name).at(0).isUpper()) + QString propName = QString::fromUtf8(prop.name); + if (propName.at(0).isUpper()) COMPILE_EXCEPTION(&prop, tr("Property names cannot begin with an upper case letter")); - if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(prop.name)) + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(propName)) COMPILE_EXCEPTION(&prop, tr("Illegal property name")); propNames.insert(prop.name); @@ -2228,9 +2229,10 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) QByteArray name = obj->dynamicSignals.at(ii).name; if (methodNames.contains(name)) COMPILE_EXCEPTION(obj, tr("Duplicate signal name")); - if (QString::fromUtf8(name).at(0).isUpper()) + QString nameStr = QString::fromUtf8(name); + if (nameStr.at(0).isUpper()) COMPILE_EXCEPTION(obj, tr("Signal names cannot begin with an upper case letter")); - if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name)) + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(nameStr)) COMPILE_EXCEPTION(obj, tr("Illegal signal name")); methodNames.insert(name); } @@ -2238,9 +2240,10 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) QByteArray name = obj->dynamicSlots.at(ii).name; if (methodNames.contains(name)) COMPILE_EXCEPTION(obj, tr("Duplicate method name")); - if (QString::fromUtf8(name).at(0).isUpper()) + QString nameStr = QString::fromUtf8(name); + if (nameStr.at(0).isUpper()) COMPILE_EXCEPTION(obj, tr("Method names cannot begin with an upper case letter")); - if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name)) + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(nameStr)) COMPILE_EXCEPTION(obj, tr("Illegal method name")); methodNames.insert(name); } diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 1d48b1a..15cef16 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -104,6 +104,7 @@ class QByteArray; /*! \qmlclass Component QDeclarativeComponent + \ingroup qml-utility-elements \since 4.7 \brief The Component element encapsulates a QML component definition. @@ -192,7 +193,7 @@ class QByteArray; \value Null This QDeclarativeComponent has no data. Call loadUrl() or setData() to add QML content. \value Ready This QDeclarativeComponent is ready and create() may be called. \value Loading This QDeclarativeComponent is loading network data. - \value Error An error has occured. Call errors() to retrieve a list of \{QDeclarativeError}{errors}. + \value Error An error has occurred. Call errors() to retrieve a list of \{QDeclarativeError}{errors}. */ void QDeclarativeComponentPrivate::typeDataReady() @@ -518,7 +519,7 @@ void QDeclarativeComponent::loadUrl(const QUrl &url) } /*! - Return the list of errors that occured during the last compile or create + Return the list of errors that occurred during the last compile or create operation. An empty list is returned if isError() is not set. */ QList<QDeclarativeError> QDeclarativeComponent::errors() const @@ -599,7 +600,7 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q property, or else the object will not be visible. Dynamically created instances can be deleted with the \c destroy() method. - See \l {Dynamic Object Management} for more information. + See \l {Dynamic Object Management in QML} for more information. */ /*! diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 3d25291..a58dc6c 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -80,10 +80,12 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() \code QDeclarativeEngine engine; + QStringListModel modelData; QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext()); - context->setContextProperty("myModel", modelData); + context->setContextProperty("myModel", &modelData); - QDeclarativeComponent component(&engine, "ListView { model=myModel }"); + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.7\nListView { model: myModel }", QUrl()); component.create(context); \endcode @@ -104,12 +106,13 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() ... }; - MyDataSet *myDataSet = new MyDataSet; + MyDataSet myDataSet; QDeclarativeEngine engine; QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext()); - context->setContextObject(myDataSet); + context->setContextObject(&myDataSet); - QDeclarativeComponent component(&engine, "ListView { model=myModel }"); + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.7\nListView { model: myModel }", QUrl()); component.create(context); \endcode diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index e8cb36e..513fc65 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -114,6 +114,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass QtObject QObject + \ingroup qml-utility-elements \since 4.7 \brief The QtObject element is the most basic element in QML. @@ -184,11 +185,13 @@ void QDeclarativeEnginePrivate::defineModule() } /*! -\keyword QmlGlobalQtObject -\qmlclass Qt QDeclarativeEnginePrivate +\qmlclass QML:Qt QDeclarativeEnginePrivate + \ingroup qml-utility-elements \brief The QML global Qt object provides useful enums and functions from Qt. -The \c Qt object provides useful enums and functions from Qt, for use in all QML files. +\keyword QmlGlobalQtObject + +\brief The \c Qt object provides useful enums and functions from Qt, for use in all QML files. The \c Qt object is not a QML element; it cannot be instantiated. It is a global object with enums and functions. To use it, call the members of the global \c Qt object directly. @@ -206,10 +209,9 @@ Text { \section1 Enums -The Qt object contains all enums in the Qt namespace. For example, you can -access the \c AlignLeft member of the \c Qt::AlignmentFlag enum with \c Qt.AlignLeft. +The Qt object contains enums that declared into Qt's Meta-Object System. For example, you can access +the \c Leftbutton member of the \c Qt::MouseButton enum with \c Qt.LeftButton. -For a full list of enums, see the \l{Qt Namespace} documentation. \section1 Types The Qt object also contains helper functions for creating objects of specific @@ -241,7 +243,7 @@ The format specification is described at \l{QML:Qt::formatDateTime}{Qt.formatDat \section1 Dynamic Object Creation The following functions on the global object allow you to dynamically create QML -items from files or strings. See \l{Dynamic Object Management} for an overview +items from files or strings. See \l{Dynamic Object Management in QML} for an overview of their use. \list @@ -1119,7 +1121,7 @@ For example: \snippet doc/src/snippets/declarative/createComponent-simple.qml 0 -See \l {Dynamic Object Management} for more information on using this function. +See \l {Dynamic Object Management in QML} for more information on using this function. To create a QML object from an arbitrary string of QML (instead of a file), use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}. @@ -1171,7 +1173,7 @@ Note that this function returns immediately, and therefore may not work if the \a qml string loads new components (that is, external QML files that have not yet been loaded). If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createComponent()} instead. -See \l {Dynamic Object Management} for more information on using this function. +See \l {Dynamic Object Management in QML} for more information on using this function. */ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine) diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 1837366..ed98e3c 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -182,7 +182,7 @@ QVariant QDeclarativeEngineDebugServer::valueContents(const QVariant &value) con } void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message, - QObject *object, bool recur) + QObject *object, bool recur, bool dumpProperties) { message << objectData(object); @@ -209,6 +209,8 @@ void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message, continue; QDeclarativeBoundSignal *signal = QDeclarativeBoundSignal::cast(child); if (signal) { + if (!dumpProperties) + continue; QDeclarativeObjectProperty prop; prop.type = QDeclarativeObjectProperty::SignalProperty; prop.hasNotifySignal = false; @@ -229,12 +231,17 @@ void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message, fakeProperties << prop; } else { if (recur) - buildObjectDump(message, child, recur); + buildObjectDump(message, child, recur, dumpProperties); else message << objectData(child); } } + if (!dumpProperties) { + message << 0; + return; + } + message << (object->metaObject()->propertyCount() + fakeProperties.count()); for (int ii = 0; ii < object->metaObject()->propertyCount(); ++ii) @@ -372,8 +379,9 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) int queryId; int objectId; bool recurse; + bool dumpProperties = true; - ds >> queryId >> objectId >> recurse; + ds >> queryId >> objectId >> recurse >> dumpProperties; QObject *object = QDeclarativeDebugService::objectForId(objectId); @@ -382,7 +390,7 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) rs << QByteArray("FETCH_OBJECT_R") << queryId; if (object) - buildObjectDump(rs, object, recurse); + buildObjectDump(rs, object, recurse, dumpProperties); sendMessage(reply); } else if (type == "WATCH_OBJECT") { diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/qml/qdeclarativeenginedebug_p.h index ea35b40..aa450f3 100644 --- a/src/declarative/qml/qdeclarativeenginedebug_p.h +++ b/src/declarative/qml/qdeclarativeenginedebug_p.h @@ -103,7 +103,7 @@ private Q_SLOTS: private: void buildObjectList(QDataStream &, QDeclarativeContext *); - void buildObjectDump(QDataStream &, QObject *, bool); + void buildObjectDump(QDataStream &, QObject *, bool, bool); QDeclarativeObjectData objectData(QObject *); QDeclarativeObjectProperty propertyData(QObject *, int); QVariant valueContents(const QVariant &defaultValue) const; diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index 585fb69..6fc4df0 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -143,16 +143,12 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContextData *ctxt, void *ex } else { -#if !defined(Q_OS_SYMBIAN) //XXX Why doesn't this work? if (!dd->cachedPrograms.at(progIdx)) { dd->cachedPrograms[progIdx] = new QScriptProgram(expression, url, line); } expressionFunction = evalInObjectScope(ctxt, me, *dd->cachedPrograms.at(progIdx), &expressionContext); -#else - expressionFunction = evalInObjectScope(ctxt, me, expression, &expressionContext); -#endif expressionFunctionMode = ExplicitContext; expressionFunctionValid = true; diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp index 241df87..ea68327 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.cpp +++ b/src/declarative/qml/qdeclarativeimageprovider.cpp @@ -59,13 +59,13 @@ public: \list \o Loaded using QPixmaps rather than actual image files - \o Loaded asynchronously in a separate thread, if imageType() is \l ImageType::Image + \o Loaded asynchronously in a separate thread, if imageType() is \l{QDeclarativeImageProvider::ImageType}{ImageType::Image} \endlist To specify that an image should be loaded by an image provider, use the \bold {"image:"} scheme for the URL source of the image, followed by the identifiers of the image provider and the requested image. For example: - + \qml Image { source: "image://myimageprovider/image.png" } \endqml @@ -83,7 +83,7 @@ public: and "red", respectively: \snippet examples/declarative/cppextensions/imageprovider/imageprovider-example.qml 0 - + When these images are loaded by QML, it looks for a matching image provider and calls its requestImage() or requestPixmap() method (depending on its imageType()) to load the image. The method is called with the \c id @@ -112,7 +112,7 @@ public: } \endcode - Now the images can be succesfully loaded in QML: + Now the images can be successfully loaded in QML: \image imageprovider.png @@ -136,7 +136,7 @@ public: main thread. In this case, if \l {Image::}{asynchronous} is set to \c true, the value is ignored and the image is loaded synchronously. - + \sa QDeclarativeEngine::addImageProvider() */ diff --git a/src/declarative/qml/qdeclarativeinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp index c980a2a..c6560dd 100644 --- a/src/declarative/qml/qdeclarativeinfo.cpp +++ b/src/declarative/qml/qdeclarativeinfo.cpp @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE /*! \fn QDeclarativeInfo qmlInfo(const QObject *object) + \relates QDeclarativeEngine \brief Prints warnings messages that include the file and line number for QML types. diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp index 0f7b09d..1767d2f 100644 --- a/src/declarative/qml/qdeclarativeinstruction.cpp +++ b/src/declarative/qml/qdeclarativeinstruction.cpp @@ -218,7 +218,7 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx) qWarning().nospace() << idx << "\t\t" << line << "\t" << "DEFER" << "\t\t\t" << instr->defer.deferCount; break; default: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "XXX UNKOWN INSTRUCTION" << "\t" << instr->type; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "XXX UNKNOWN INSTRUCTION" << "\t" << instr->type; break; } #endif // QT_NO_DEBUG_STREAM diff --git a/src/declarative/qml/qdeclarativelist.h b/src/declarative/qml/qdeclarativelist.h index 399b2a1..c10bc11 100644 --- a/src/declarative/qml/qdeclarativelist.h +++ b/src/declarative/qml/qdeclarativelist.h @@ -98,16 +98,16 @@ public: private: static void qlist_append(QDeclarativeListProperty *p, T *v) { - ((QList<T *> *)p->data)->append(v); + reinterpret_cast<QList<T *> *>(p->data)->append(v); } static int qlist_count(QDeclarativeListProperty *p) { - return ((QList<T *> *)p->data)->count(); + return reinterpret_cast<QList<T *> *>(p->data)->count(); } static T *qlist_at(QDeclarativeListProperty *p, int idx) { - return ((QList<T *> *)p->data)->at(idx); + return reinterpret_cast<QList<T *> *>(p->data)->at(idx); } static void qlist_clear(QDeclarativeListProperty *p) { - return ((QList<T *> *)p->data)->clear(); + return reinterpret_cast<QList<T *> *>(p->data)->clear(); } }; #endif diff --git a/src/declarative/qml/qdeclarativeprivate.h b/src/declarative/qml/qdeclarativeprivate.h index b2d7451..d45ddbc 100644 --- a/src/declarative/qml/qdeclarativeprivate.h +++ b/src/declarative/qml/qdeclarativeprivate.h @@ -105,7 +105,7 @@ namespace QDeclarativePrivate template<class From, class To> struct StaticCastSelectorClass<From, To, sizeof(int)> { - static inline int cast() { return (int)((intptr_t)static_cast<To *>((From *)0x10000000)) - 0x10000000; } + static inline int cast() { return int(reinterpret_cast<intptr_t>(static_cast<To *>(reinterpret_cast<From *>(0x10000000)))) - 0x10000000; } }; template<class From, class To> @@ -119,7 +119,7 @@ namespace QDeclarativePrivate static inline int cast() { - return StaticCastSelectorClass<From, To, sizeof(check((From *)0))>::cast(); + return StaticCastSelectorClass<From, To, sizeof(check(reinterpret_cast<From *>(0)))>::cast(); } }; @@ -132,6 +132,7 @@ namespace QDeclarativePrivate template <typename T, bool hasMember> class has_attachedPropertiesMethod { + public: typedef int yes_type; typedef char no_type; @@ -139,7 +140,6 @@ namespace QDeclarativePrivate static yes_type check(ReturnType *(*)(QObject *)); static no_type check(...); - public: static bool const value = sizeof(check(&T::qmlAttachedProperties)) == sizeof(yes_type); }; diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index 071dd07..515c4d6 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -640,7 +640,7 @@ QDeclarativePropertyPrivate::binding(const QDeclarativeProperty &that) is assumed by the caller. \a flags is passed through to the binding and is used for the initial update (when - the binding sets the intial value, it will use these flags for the write). + the binding sets the initial value, it will use these flags for the write). */ QDeclarativeAbstractBinding * QDeclarativePropertyPrivate::setBinding(const QDeclarativeProperty &that, diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index f703cf5..0657f49 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -760,7 +760,7 @@ bool ProcessAST::visit(AST::UiArrayBinding *node) prop->listValueRange.offset = node->lbracketToken.offset; prop->listValueRange.length = node->rbracketToken.offset + node->rbracketToken.length - node->lbracketToken.offset; - // Store the positions of the comma token too, again for the DOM to be able to retreive it. + // Store the positions of the comma token too, again for the DOM to be able to retrieve it. prop->listCommaPositions = collectCommas(node->members); while (propertyCount--) diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index aec84a6..789116e 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -514,6 +514,7 @@ void QDeclarativeWorkerScriptEngine::run() /*! \qmlclass WorkerScript QDeclarativeWorkerScript + \ingroup qml-utility-elements \brief The WorkerScript element enables the use of threads in QML. Use WorkerScript to run operations in a new thread. diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 6a9cf95..4e9e8d5 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -74,6 +74,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Animation QDeclarativeAbstractAnimation + \ingroup qml-animation-transition \since 4.7 \brief The Animation element is the base of all QML animations. @@ -554,6 +555,7 @@ void QDeclarativeAbstractAnimation::timelineComplete() /*! \qmlclass PauseAnimation QDeclarativePauseAnimation + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The PauseAnimation element provides a pause for an animation. @@ -630,6 +632,7 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation() /*! \qmlclass ColorAnimation QDeclarativeColorAnimation + \ingroup qml-animation-transition \since 4.7 \inherits PropertyAnimation \brief The ColorAnimation element animates changes in color values. @@ -645,12 +648,13 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation() Like any other animation element, a ColorAnimation can be applied in a number of ways, including transitions, behaviors and property value - sources. The \l PropertyAnimation documentation shows a variety of methods + sources. The \l {QML Animation} documentation shows a variety of methods for creating animations. - When used in a transition, ColorAnimation will by default animate - all properties of type color that have changed. If a \l{PropertyAnimation::}{property} - or \l{PropertyAnimation::}{properties} are explicitly set for the animation, + For convenience, when a ColorAnimation is used in a \l Transition, it will + animate any \c color properties that have been modified during the state + change. If a \l{PropertyAnimation::}{property} or + \l{PropertyAnimation::}{properties} are explicitly set for the animation, then those are used instead. \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} @@ -690,9 +694,12 @@ QDeclarativeColorAnimation::~QDeclarativeColorAnimation() } \endqml - If this value is not set and the ColorAnimation is defined within - a \l Transition, it defaults to the value defined in the starting - state of the \l Transition. + If the ColorAnimation is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the starting state of the + \l Transition, or the current value of the property at the moment the + \l Behavior is triggered. + + \sa {QML Animation} */ QColor QDeclarativeColorAnimation::from() const { @@ -710,9 +717,12 @@ void QDeclarativeColorAnimation::setFrom(const QColor &f) This property holds the color value at which the animation should end. - If this value is not set and the ColorAnimation is defined within - a \l Transition or \l Behavior, it defaults to the value defined in the end - state of the \l Transition or \l Behavior. + If the ColorAnimation is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the end state of the + \l Transition, or the value of the property change that triggered the + \l Behavior. + + \sa {QML Animation} */ QColor QDeclarativeColorAnimation::to() const { @@ -729,6 +739,7 @@ void QDeclarativeColorAnimation::setTo(const QColor &t) /*! \qmlclass ScriptAction QDeclarativeScriptAction + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The ScriptAction element allows scripts to be run during an animation. @@ -877,33 +888,50 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() /*! \qmlclass PropertyAction QDeclarativePropertyAction + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The PropertyAction element allows immediate property changes during animation. - PropertyAction is used to specify an immediate property change - during an animation. The property change is not animated. + PropertyAction is used to specify an immediate property change during an + animation. The property change is not animated. - For example, to explicitly set \c {theImage.smooth = true} during a \l Transition: - \code - transitions: Transition { - ... - PropertyAction { target: theImage; property: "smooth"; value: true } - ... - } - \endcode + It is useful for setting non-animated property values during an animation. - Or, to set \c theWebView.url to the value set for the destination state: - \code + For example, here is a SequentialAnimation that sets the image's + \l {Image::}{smooth} property to \c true, animates the width of the image, + then sets \l {Image::}{smooth} back to \c false: + + \snippet doc/src/snippets/declarative/propertyaction.qml standalone + + PropertyAction is also useful for setting the exact point at which a property + change should occur during a \l Transition. For example, if PropertyChanges + was used in a \l State to rotate an item around a particular + \l {Item::}{transformOrigin}, it might be implemented like this: + + \snippet doc/src/snippets/declarative/propertyaction.qml transition + + However, with this code, the \c transformOrigin is not set until \e after + the animation, as a \l State is taken to define the values at the \e end of + a transition. The animation would rotate at the default \c transformOrigin, + then jump to \c Item.BottomRight. To fix this, insert a PropertyChanges + before the RotationAnimation begins: + + \qml transitions: Transition { - ... - PropertyAction { target: theWebView; property: "url" } - ... + SequentialAnimation { + PropertyAction { target: rect; property: "transformOrigin" } + RotationAnimation { ... } + } } - \endcode - + \endqml + + This immediately sets the \c transformOrigin property to the value defined + in the end state of the \l Transition (i.e. the value defined in the + PropertyChanges object) so that the rotation animation begins with the + correct transform origin. - \sa QtDeclarative + \sa {QML Animation}, QtDeclarative */ /*! \internal @@ -1008,7 +1036,11 @@ QDeclarativeListProperty<QObject> QDeclarativePropertyAction::exclude() /*! \qmlproperty any PropertyAction::value This property holds the value to be set on the property. - If not set, then the value defined for the end state of the transition. + + If the PropertyAction is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the end state of the + \l Transition, or the value of the property change that triggered the + \l Behavior. */ QVariant QDeclarativePropertyAction::value() const { @@ -1128,6 +1160,7 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, /*! \qmlclass NumberAnimation QDeclarativeNumberAnimation + \ingroup qml-animation-transition \since 4.7 \inherits PropertyAnimation \brief The NumberAnimation element animates changes in qreal-type values. @@ -1143,7 +1176,7 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, Like any other animation element, a NumberAnimation can be applied in a number of ways, including transitions, behaviors and property value - sources. The \l PropertyAnimation documentation shows a variety of methods + sources. The \l {QML Animation} documentation shows a variety of methods for creating animations. Note that NumberAnimation may not animate smoothly if there are irregular @@ -1183,7 +1216,7 @@ void QDeclarativeNumberAnimation::init() /*! \qmlproperty real NumberAnimation::from - This property holds the starting number value. + This property holds the starting value for the animation. For example, the following animation is not applied until the \c x value has reached 100: @@ -1198,9 +1231,12 @@ void QDeclarativeNumberAnimation::init() } \endqml - If this value is not set and the NumberAnimation is defined within - a \l Transition, it defaults to the value defined in the start - state of the \l Transition. + If the NumberAnimation is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the starting state of the + \l Transition, or the current value of the property at the moment the + \l Behavior is triggered. + + \sa {QML Animation} */ qreal QDeclarativeNumberAnimation::from() const @@ -1216,11 +1252,14 @@ void QDeclarativeNumberAnimation::setFrom(qreal f) /*! \qmlproperty real NumberAnimation::to - This property holds the ending number value. + This property holds the end value for the animation. + + If the NumberAnimation is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the end state of the + \l Transition, or the value of the property change that triggered the + \l Behavior. - If this value is not set and the NumberAnimation is defined within - a \l Transition or \l Behavior, it defaults to the value defined in the end - state of the \l Transition or \l Behavior. + \sa {QML Animation} */ qreal QDeclarativeNumberAnimation::to() const { @@ -1237,6 +1276,7 @@ void QDeclarativeNumberAnimation::setTo(qreal t) /*! \qmlclass Vector3dAnimation QDeclarativeVector3dAnimation + \ingroup qml-animation-transition \since 4.7 \inherits PropertyAnimation \brief The Vector3dAnimation element animates changes in QVector3d values. @@ -1244,6 +1284,11 @@ void QDeclarativeNumberAnimation::setTo(qreal t) Vector3dAnimation is a specialized PropertyAnimation that defines an animation to be applied when a Vector3d value changes. + Like any other animation element, a Vector3dAnimation can be applied in a + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation} documentation shows a variety of methods + for creating animations. + \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ @@ -1267,10 +1312,14 @@ QDeclarativeVector3dAnimation::~QDeclarativeVector3dAnimation() /*! \qmlproperty real Vector3dAnimation::from - This property holds the starting value. + This property holds the starting value for the animation. - If this value is not set, it defaults to the value defined in the start - state of the \l Transition. + If the Vector3dAnimation is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the starting state of the + \l Transition, or the current value of the property at the moment the + \l Behavior is triggered. + + \sa {QML Animation} */ QVector3D QDeclarativeVector3dAnimation::from() const { @@ -1285,10 +1334,14 @@ void QDeclarativeVector3dAnimation::setFrom(QVector3D f) /*! \qmlproperty real Vector3dAnimation::to - This property holds the ending value. + This property holds the end value for the animation. + + If the Vector3dAnimation is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the end state of the + \l Transition, or the value of the property change that triggered the + \l Behavior. - If this value is not set, it defaults to the value defined in the end - state of the \l Transition or \l Behavior. + \sa {QML Animation} */ QVector3D QDeclarativeVector3dAnimation::to() const { @@ -1305,6 +1358,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) /*! \qmlclass RotationAnimation QDeclarativeRotationAnimation + \ingroup qml-animation-transition \since 4.7 \inherits PropertyAnimation \brief The RotationAnimation element animates changes in rotation values. @@ -1323,15 +1377,21 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) \snippet doc/src/snippets/declarative/rotationanimation.qml 0 - Notice the RotationAnimation did not need to set a \l {RotationAnimation::}{target} + Notice the RotationAnimation did not need to set a \l target value. As a convenience, when used in a transition, RotationAnimation will rotate all properties named "rotation" or "angle". You can override this by providing your own properties via \l {PropertyAnimation::properties}{properties} or \l {PropertyAnimation::property}{property}. + Also, note the \l Rectangle will be rotated around its default + \l {Item::}{transformOrigin} (which is \c Item.Center). To use a different + transform origin, set the origin in the PropertyChanges object and apply + the change at the start of the animation using PropertyAction. See the + PropertyAction documentation for more details. + Like any other animation element, a RotationAnimation can be applied in a number of ways, including transitions, behaviors and property value - sources. The \l PropertyAnimation documentation shows a variety of methods + sources. The \l {QML Animation} documentation shows a variety of methods for creating animations. \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} @@ -1394,7 +1454,7 @@ QDeclarativeRotationAnimation::~QDeclarativeRotationAnimation() /*! \qmlproperty real RotationAnimation::from - This property holds the starting number value. + This property holds the starting value for the animation. For example, the following animation is not applied until the \c angle value has reached 100: @@ -1409,8 +1469,12 @@ QDeclarativeRotationAnimation::~QDeclarativeRotationAnimation() } \endqml - If this value is not set, it defaults to the value defined in the start - state of the \l Transition. + If the RotationAnimation is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the starting state of the + \l Transition, or the current value of the property at the moment the + \l Behavior is triggered. + + \sa {QML Animation} */ qreal QDeclarativeRotationAnimation::from() const { @@ -1425,10 +1489,14 @@ void QDeclarativeRotationAnimation::setFrom(qreal f) /*! \qmlproperty real RotationAnimation::to - This property holds the ending value. + This property holds the end value for the animation.. + + If the RotationAnimation is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the end state of the + \l Transition, or the value of the property change that triggered the + \l Behavior. - If this value is not set, it defaults to the value defined in the end - state of the \l Transition or \l Behavior. + \sa {QML Animation} */ qreal QDeclarativeRotationAnimation::to() const { @@ -1534,6 +1602,7 @@ QDeclarativeListProperty<QDeclarativeAbstractAnimation> QDeclarativeAnimationGro /*! \qmlclass SequentialAnimation QDeclarativeSequentialAnimation + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The SequentialAnimation element allows animations to be run sequentially. @@ -1554,7 +1623,7 @@ QDeclarativeListProperty<QDeclarativeAbstractAnimation> QDeclarativeAnimationGro Like any other animation element, a SequentialAnimation can be applied in a number of ways, including transitions, behaviors and property value - sources. The \l PropertyAnimation documentation shows a variety of methods + sources. The \l {QML Animation} documentation shows a variety of methods for creating animations. \note Once an animation has been grouped into a SequentialAnimation or @@ -1607,6 +1676,7 @@ void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actio /*! \qmlclass ParallelAnimation QDeclarativeParallelAnimation + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The ParallelAnimation element allows animations to be run in parallel. @@ -1623,7 +1693,7 @@ void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actio Like any other animation element, a ParallelAnimation can be applied in a number of ways, including transitions, behaviors and property value - sources. The \l PropertyAnimation documentation shows a variety of methods + sources. The \l {QML Animation} documentation shows a variety of methods for creating animations. \note Once an animation has been grouped into a SequentialAnimation or @@ -1725,6 +1795,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int /*! \qmlclass PropertyAnimation QDeclarativePropertyAnimation + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The PropertyAnimation element animates changes in property values. @@ -1837,8 +1908,14 @@ void QDeclarativePropertyAnimation::setDuration(int duration) /*! \qmlproperty real PropertyAnimation::from - This property holds the starting value. - If not set, then the value defined in the start state of the transition. + This property holds the starting value for the animation. + + If the PropertyAnimation is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the starting state of the + \l Transition, or the current value of the property at the moment the + \l Behavior is triggered. + + \sa {QML Animation} */ QVariant QDeclarativePropertyAnimation::from() const { @@ -1858,8 +1935,14 @@ void QDeclarativePropertyAnimation::setFrom(const QVariant &f) /*! \qmlproperty real PropertyAnimation::to - This property holds the ending value. - If not set, then the value defined in the end state of the transition or \l Behavior. + This property holds the end value for the animation. + + If the PropertyAnimation is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the end state of the + \l Transition, or the value of the property change that triggered the + \l Behavior. + + \sa {QML Animation} */ QVariant QDeclarativePropertyAnimation::to() const { @@ -2386,18 +2469,20 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions d->actions = &data->actions; } else { delete data; + d->va->setFromSourcedValue(0); //clear previous data + d->va->setAnimValue(0, QAbstractAnimation::DeleteWhenStopped); //clear previous data d->actions = 0; } } /*! \qmlclass ParentAnimation QDeclarativeParentAnimation + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The ParentAnimation element animates changes in parent values. - ParentAnimation defines an animation to applied when a ParentChange - occurs. This allows parent changes to be smoothly animated. + ParentAnimation is used to animate a parent change for an \l Item. For example, the following ParentChange changes \c blueRect to become a child of \c redRect when it is clicked. The inclusion of the @@ -2415,10 +2500,16 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions to animate the parent change via another item that does not have clipping enabled. Such an item can be set using the \l via property. - By default, when used in a transition, ParentAnimation animates all parent - changes. This can be overridden by setting a specific target item using the + For convenience, when a ParentAnimation is used in a \l Transition, it will + animate any ParentChange that has occurred during the state change. + This can be overridden by setting a specific target item using the \l target property. + Like any other animation element, a ParentAnimation can be applied in a + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation} documentation shows a variety of methods + for creating animations. + \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ @@ -2477,7 +2568,10 @@ void QDeclarativeParentAnimation::setTarget(QDeclarativeItem *target) \qmlproperty Item ParentAnimation::newParent The new parent to animate to. - If not set, then the parent defined in the end state of the transition. + If the ParentAnimation is defined within a \l Transition or \l Behavior, + this value defaults to the value defined in the end state of the + \l Transition, or the value of the property change that triggered the + \l Behavior. */ QDeclarativeItem *QDeclarativeParentAnimation::newParent() const { @@ -2746,18 +2840,28 @@ QAbstractAnimation *QDeclarativeParentAnimation::qtAnimation() /*! \qmlclass AnchorAnimation QDeclarativeAnchorAnimation + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The AnchorAnimation element animates changes in anchor values. - AnchorAnimation is used to animate an AnchorChange. It will anchor all - anchor changes specified in a \l State. + AnchorAnimation is used to animate an anchor change. In the following snippet we animate the addition of a right anchor to a \l Rectangle: \snippet doc/src/snippets/declarative/anchoranimation.qml 0 - \sa AnchorChanges + For convenience, when an AnchorAnimation is used in a \l Transition, it will + animate any AnchorChanges that have occurred during the state change. + This can be overridden by setting a specific target item using the + \l target property. + + Like any other animation element, an AnchorAnimation can be applied in a + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation} documentation shows a variety of methods + for creating animations. + + \sa {QML Animation}, AnchorChanges */ QDeclarativeAnchorAnimation::QDeclarativeAnchorAnimation(QObject *parent) diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index fadb2ae..f1b6f9a 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -72,6 +72,7 @@ public: /*! \qmlclass Behavior QDeclarativeBehavior + \ingroup qml-animation-transition \since 4.7 \brief The Behavior element allows you to specify a default animation for a property change. @@ -84,12 +85,15 @@ public: \snippet doc/src/snippets/declarative/behavior.qml 0 - To run multiple animations within a Behavior, use ParallelAnimation or + Note that a property cannot have more than one assigned Behavior. To provide + multiple animations within a Behavior, use ParallelAnimation or SequentialAnimation. - Note that a property cannot have more than one assigned Behavior. + If a \l{QML States}{state change} has a \l Transition that matches the same property as a + Behavior, the \l Transition animation overrides the Behavior for that + state change. - \sa {Property Behaviors}, {declarative/animation/behaviors}{Behavior example}, QtDeclarative + \sa {QML Animation}, {declarative/animation/behaviors}{Behavior example}, QtDeclarative */ diff --git a/src/declarative/util/qdeclarativebind.cpp b/src/declarative/util/qdeclarativebind.cpp index 5fab631..86d08f5 100644 --- a/src/declarative/util/qdeclarativebind.cpp +++ b/src/declarative/util/qdeclarativebind.cpp @@ -72,6 +72,7 @@ public: /*! \qmlclass Binding QDeclarativeBind + \ingroup qml-working-with-data \since 4.7 \brief The Binding element allows arbitrary property bindings to be created. diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp index b364821..293928e 100644 --- a/src/declarative/util/qdeclarativeconnections.cpp +++ b/src/declarative/util/qdeclarativeconnections.cpp @@ -71,6 +71,7 @@ public: /*! \qmlclass Connections QDeclarativeConnections + \ingroup qml-utility-elements \since 4.7 \brief A Connections element describes generalized connections to signals. diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index 83bdb17..291583c 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -78,6 +78,7 @@ public: /*! \qmlclass FontLoader QDeclarativeFontLoader + \ingroup qml-utility-elements \since 4.7 \brief The FontLoader element allows fonts to be loaded by name or URL. diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 3ede335..1f66f0f 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -68,6 +68,7 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM /*! \qmlclass ListModel QDeclarativeListModel + \ingroup qml-working-with-data \since 4.7 \brief The ListModel element defines a free-form list data source. @@ -108,9 +109,9 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM \snippet doc/src/snippets/declarative/listmodel-modify.qml delegate - When creating content dynamically, note that the set of available properties cannot be changed - except by first clearing the model. Whatever properties are first added to the model are then the - only permitted properties in the model until it is cleared. + Note that when creating content dynamically the set of available properties cannot be changed + once set. Whatever properties are first added to the model are the + only permitted properties in the model. \section2 Using threaded list models with WorkerScript @@ -129,7 +130,7 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM \snippet examples/declarative/threading/threadedlistmodel/dataloader.js 0 - The application's \tt Timer object periodically sends a message to the +working-with-data worker script by calling \l WorkerScript::sendMessage(). When this message is received, \l {WorkerScript::onMessage}{WorkerScript.onMessage()} is invoked in \tt dataloader.js, which appends the current time to the list model. @@ -283,8 +284,7 @@ int QDeclarativeListModel::count() const /*! \qmlmethod ListModel::clear() - Deletes all content from the model. The properties are cleared such that - different properties may be set on subsequent additions. + Deletes all content from the model. \sa append() remove() */ @@ -770,6 +770,7 @@ bool QDeclarativeListModelParser::definesEmptyList(const QString &s) /*! \qmlclass ListElement + \ingroup qml-working-with-data \since 4.7 \brief The ListElement element defines a data item in a ListModel. @@ -945,13 +946,14 @@ bool FlatListModel::addValue(const QScriptValue &value, QHash<int, QVariant> *ro } NestedListModel::NestedListModel(QDeclarativeListModel *base) - : _root(0), m_listModel(base), _rolesOk(false) + : _root(0), m_ownsRoot(false), m_listModel(base), _rolesOk(false) { } NestedListModel::~NestedListModel() { - delete _root; + if (m_ownsRoot) + delete _root; } QVariant NestedListModel::valueForNode(ModelNode *node, bool *hasNested) const @@ -1051,8 +1053,8 @@ void NestedListModel::clear() _rolesOk = false; roleStrings.clear(); - delete _root; - _root = 0; + if (_root) + _root->clear(); } void NestedListModel::remove(int index) @@ -1067,8 +1069,10 @@ void NestedListModel::remove(int index) bool NestedListModel::insert(int index, const QScriptValue& valuemap) { - if (!_root) + if (!_root) { _root = new ModelNode; + m_ownsRoot = true; + } ModelNode *mn = new ModelNode; mn->setObjectValue(valuemap); @@ -1099,8 +1103,10 @@ void NestedListModel::move(int from, int to, int n) bool NestedListModel::append(const QScriptValue& valuemap) { - if (!_root) + if (!_root) { _root = new ModelNode; + m_ownsRoot = true; + } ModelNode *mn = new ModelNode; mn->setObjectValue(valuemap); _root->values << qVariantFromValue(mn); @@ -1205,16 +1211,22 @@ ModelNode::ModelNode() ModelNode::~ModelNode() { - qDeleteAll(properties.values()); + clear(); + if (modelCache) { modelCache->m_nested->_root = 0/* ==this */; delete modelCache; modelCache = 0; } + if (objectCache) { delete objectCache; objectCache = 0; } +} +void ModelNode::clear() +{ ModelNode *node; for (int ii = 0; ii < values.count(); ++ii) { node = qvariant_cast<ModelNode *>(values.at(ii)); if (node) { delete node; node = 0; } } + values.clear(); - if (modelCache) { modelCache->m_nested->_root = 0/* ==this */; delete modelCache; modelCache = 0; } - if (objectCache) { delete objectCache; objectCache = 0; } + qDeleteAll(properties.values()); + properties.clear(); } void ModelNode::setObjectValue(const QScriptValue& valuemap) { diff --git a/src/declarative/util/qdeclarativelistmodel_p_p.h b/src/declarative/util/qdeclarativelistmodel_p_p.h index 532eefa..8231414 100644 --- a/src/declarative/util/qdeclarativelistmodel_p_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p_p.h @@ -130,6 +130,7 @@ public: void checkRoles() const; ModelNode *_root; + bool m_ownsRoot; QDeclarativeListModel *m_listModel; private: @@ -157,6 +158,8 @@ struct ModelNode QList<QVariant> values; QHash<QString, ModelNode *> properties; + void clear(); + QDeclarativeListModel *model(const NestedListModel *model) { if (!modelCache) { modelCache = new QDeclarativeListModel; diff --git a/src/declarative/util/qdeclarativepackage.cpp b/src/declarative/util/qdeclarativepackage.cpp index 1a4f2a7..a5ec9b3 100644 --- a/src/declarative/util/qdeclarativepackage.cpp +++ b/src/declarative/util/qdeclarativepackage.cpp @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Package QDeclarativePackage + \ingroup qml-working-with-data \brief Package provides a collection of named items. The Package class is used in conjunction with diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index 9ced14f..de2de21 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -525,6 +525,7 @@ void QDeclarativePixmapReader::cancel(QDeclarativePixmapReply *reply) mutex.lock(); if (reply->loading) { cancelled.append(reply); + reply->data = 0; // XXX if (threadObject) threadObject->processJobs(); } else { @@ -738,7 +739,6 @@ void QDeclarativePixmapData::release() if (refCount == 0) { if (reply) { - reply->data = 0; reply->reader->cancel(reply); reply = 0; } diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 12c6353..c28ada3 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -61,51 +61,34 @@ QT_BEGIN_NAMESPACE /*! \qmlclass PropertyChanges QDeclarativePropertyChanges + \ingroup qml-state-elements \since 4.7 \brief The PropertyChanges element describes new property bindings or values for a state. - PropertyChanges provides a state change that modifies the properties of an item. + PropertyChanges is used to define the property values or bindings in a + \l State. This enables an item's property values to be changed when it + \l {QML States}{changes between states}. - Here is a property change that modifies the text and color of a \l Text element - when it is clicked: + To create a PropertyChanges object, specify the \l target item whose + properties are to be modified, and define the new property values or + bindings. For example: - \qml - Text { - id: myText - width: 100; height: 100 - text: "Hello" - color: "blue" - - states: State { - name: "myState" - - PropertyChanges { - target: myText - text: "Goodbye" - color: "red" - } - } - - MouseArea { anchors.fill: parent; onClicked: myText.state = 'myState' } - } - \endqml - - By default, PropertyChanges will establish new bindings where appropriate. - For example, the following creates a new binding for myItem's \c height property. - - \qml - PropertyChanges { - target: myItem - height: parent.height - } - \endqml - - If you don't want a binding to be established (and instead just want to assign - the value of the binding at the time the state is entered), - you should set the PropertyChange's \l{PropertyChanges::explicit}{explicit} + \snippet doc/src/snippets/declarative/propertychanges.qml import + \codeline + \snippet doc/src/snippets/declarative/propertychanges.qml 0 + + When the mouse is pressed, the \l Rectangle changes to the \e resized + state. In this state, the PropertyChanges object sets the rectangle's + color to blue and the \c height value to that of \c container.height. + + Note this automatically binds \c rect.height to \c container.height + in the \e resized state. If a property binding should not be + established, and the height should just be set to the value of + \c container.height at the time of the state change, set the \l explicit property to \c true. - - State-specific script for signal handlers can also be specified: + + A PropertyChanges object can also override the default signal handler + for an object to implement a signal handler specific to the new state: \qml PropertyChanges { @@ -114,36 +97,31 @@ QT_BEGIN_NAMESPACE } \endqml - You can reset a property in a state change by assigning \c undefined. In the following - example we reset \c theText's width when we enter state1. This will give the text its - natural width (which is the whole string on one line). + \note PropertyChanges can be used to change anchor margins, but not other anchor + values; use AnchorChanges for this instead. Similarly, to change an \l Item's + \l {Item::}{parent} value, use ParentChanges instead. - \qml - import Qt 4.7 - - Rectangle { - width: 640 - height: 480 - Text { - id: theText - width: 50 - wrapMode: Text.WordWrap - text: "a text string that is longer than 50 pixels" - } - states: State { - name: "state1" - PropertyChanges { - target: theText - width: undefined - } - } - } - \endqml + \section2 Resetting property values - Anchor margins should be changed with PropertyChanges, but other anchor changes or changes to - an Item's parent should be done using the associated change elements - (ParentChange and AnchorChanges, respectively). + The \c undefined value can be used to reset the property value for a state. + In the following example, when \c theText changes to the \e widerText + state, its \c width property is reset, giving the text its natural width + and displaying the whole string on a single line. + + \snippet doc/src/snippets/declarative/propertychanges.qml reset + + + \section2 Immediate property changes in transitions + + When \l Transitions are used to animate state changes, they animate + properties from their values in the current state to those defined in the + new state (as defined by PropertyChanges objects). However, + it is sometimes desirable to set a property value \e immediately during a + \l Transition, without animation; in these cases, the PropertyAction + element can be used to force an immediate property change. + + See the PropertyAction documentation for more details. \sa {declarative/animation/states}{states example}, {qmlstate}{States}, QtDeclarative */ @@ -396,12 +374,12 @@ void QDeclarativePropertyChanges::setObject(QObject *o) /*! \qmlproperty bool PropertyChanges::restoreEntryValues - - Whether or not the previous values should be restored when - leaving the state. By default, restoreEntryValues is true. - By setting restoreEntryValues to false, you can create a temporary state - that has permanent effects on property values. + This property holds whether the previous values should be restored when + leaving the state. + + The default value is \c true. Setting this value to \c false creates a + temporary state that has permanent effects on property values. */ bool QDeclarativePropertyChanges::restoreEntryValues() const { diff --git a/src/declarative/util/qdeclarativepropertymap.cpp b/src/declarative/util/qdeclarativepropertymap.cpp index 919727f..6b43040 100644 --- a/src/declarative/util/qdeclarativepropertymap.cpp +++ b/src/declarative/util/qdeclarativepropertymap.cpp @@ -104,22 +104,25 @@ void QDeclarativePropertyMapMetaObject::propertyCreated(int, QMetaPropertyBuilde The following example shows how you might declare data in C++ and then access it in QML. - Setup in C++: + In the C++ file: \code - //create our data + // create our data QDeclarativePropertyMap ownerData; ownerData.insert("name", QVariant(QString("John Smith"))); ownerData.insert("phone", QVariant(QString("555-5555"))); - //expose it to the UI layer - QDeclarativeContext *ctxt = view->rootContext(); - ctxt->setProperty("owner", &data); + // expose it to the UI layer + QDeclarativeView view; + QDeclarativeContext *ctxt = view.rootContext(); + ctxt->setContextProperty("owner", &ownerData); + + view.setSource(QUrl::fromLocalFile("main.qml")); + view.show(); \endcode - Then, in QML: + Then, in \c main.qml: \code - Text { text: owner.name } - Text { text: owner.phone } + Text { text: owner.name + " " + owner.phone } \endcode The binding is dynamic - whenever a key's value is updated, anything bound to that diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index 727f427..b2f02e6 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -249,6 +249,7 @@ void QSmoothedAnimation::init() /*! \qmlclass SmoothedAnimation QDeclarativeSmoothedAnimation + \ingroup qml-animation-transition \since 4.7 \inherits NumberAnimation \brief The SmoothedAnimation element allows a property to smoothly track a value. @@ -287,7 +288,7 @@ void QSmoothedAnimation::init() Like any other animation element, a SmoothedAnimation can be applied in a number of ways, including transitions, behaviors and property value - sources. The \l PropertyAnimation documentation shows a variety of methods + sources. The \l {QML Animation} documentation shows a variety of methods for creating animations. \sa SpringAnimation, NumberAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example} diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp index 8ce4832..fce4097 100644 --- a/src/declarative/util/qdeclarativespringanimation.cpp +++ b/src/declarative/util/qdeclarativespringanimation.cpp @@ -54,36 +54,32 @@ QT_BEGIN_NAMESPACE - -class QDeclarativeSpringAnimationPrivate : public QDeclarativeAbstractAnimationPrivate +class QDeclarativeSpringAnimationPrivate : public QDeclarativePropertyAnimationPrivate { Q_DECLARE_PUBLIC(QDeclarativeSpringAnimation) public: - QDeclarativeSpringAnimationPrivate() - : currentValue(0), to(0), from(0), maxVelocity(0), lastTime(0) - , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01) - , modulus(0.0), useMass(false), haveModulus(false), enabled(true) - , fromDefined(false), toDefined(false) - , mode(Track), clock(this) {} - - qreal currentValue; - qreal to; - qreal from; + + + struct SpringAnimation { + SpringAnimation() + : currentValue(0), to(0), velocity(0){} + qreal currentValue; + qreal to; + qreal velocity; + }; + QHash<QDeclarativeProperty, SpringAnimation> activeAnimations; + qreal maxVelocity; qreal velocityms; int lastTime; qreal mass; qreal spring; qreal damping; - qreal velocity; qreal epsilon; qreal modulus; bool useMass : 1; bool haveModulus : 1; - bool enabled : 1; - bool fromDefined : 1; - bool toDefined : 1; enum Mode { Track, @@ -92,38 +88,68 @@ public: }; Mode mode; - void tick(int); + QDeclarativeSpringAnimationPrivate() + : maxVelocity(0), velocityms(0), lastTime(0) + , mass(1.0), spring(0.), damping(0.), epsilon(0.01) + , modulus(0.0), useMass(false), haveModulus(false) + , mode(Track), clock(0) + { } + + void tick(int time); + bool animate(const QDeclarativeProperty &property, SpringAnimation &animation, int elapsed); void updateMode(); - QTickAnimationProxy<QDeclarativeSpringAnimationPrivate, &QDeclarativeSpringAnimationPrivate::tick> clock; + typedef QTickAnimationProxy<QDeclarativeSpringAnimationPrivate, &QDeclarativeSpringAnimationPrivate::tick> Clock; + Clock *clock; }; void QDeclarativeSpringAnimationPrivate::tick(int time) { if (mode == Track) { - clock.stop(); + clock->stop(); return; } - int elapsed = time - lastTime; if (!elapsed) return; - qreal srcVal = to; + + if (mode == Spring) { + if (elapsed < 16) // capped at 62fps. + return; + int count = elapsed / 16; + lastTime = time - (elapsed - count * 16); + } else { + lastTime = time; + } + + QMutableHashIterator<QDeclarativeProperty, SpringAnimation> it(activeAnimations); + while (it.hasNext()) { + it.next(); + if (animate(it.key(), it.value(), elapsed)) + it.remove(); + } + + if (activeAnimations.isEmpty()) + clock->stop(); +} + +bool QDeclarativeSpringAnimationPrivate::animate(const QDeclarativeProperty &property, SpringAnimation &animation, int elapsed) +{ + + qreal srcVal = animation.to; bool stop = false; if (haveModulus) { - currentValue = fmod(currentValue, modulus); + animation.currentValue = fmod(animation.currentValue, modulus); srcVal = fmod(srcVal, modulus); } if (mode == Spring) { - if (elapsed < 16) // capped at 62fps. - return; // Real men solve the spring DEs using RK4. // We'll do something much simpler which gives a result that looks fine. int count = elapsed / 16; for (int i = 0; i < count; ++i) { - qreal diff = srcVal - currentValue; + qreal diff = srcVal - animation.currentValue; if (haveModulus && qAbs(diff) > modulus / 2) { if (diff < 0) diff += modulus; @@ -131,32 +157,31 @@ void QDeclarativeSpringAnimationPrivate::tick(int time) diff -= modulus; } if (useMass) - velocity = velocity + (spring * diff - damping * velocity) / mass; + animation.velocity = animation.velocity + (spring * diff - damping * animation.velocity) / mass; else - velocity = velocity + spring * diff - damping * velocity; + animation.velocity = animation.velocity + spring * diff - damping * animation.velocity; if (maxVelocity > 0.) { // limit velocity - if (velocity > maxVelocity) - velocity = maxVelocity; - else if (velocity < -maxVelocity) - velocity = -maxVelocity; + if (animation.velocity > maxVelocity) + animation.velocity = maxVelocity; + else if (animation.velocity < -maxVelocity) + animation.velocity = -maxVelocity; } - currentValue += velocity * 16.0 / 1000.0; + animation.currentValue += animation.velocity * 16.0 / 1000.0; if (haveModulus) { - currentValue = fmod(currentValue, modulus); - if (currentValue < 0.0) - currentValue += modulus; + animation.currentValue = fmod(animation.currentValue, modulus); + if (animation.currentValue < 0.0) + animation.currentValue += modulus; } } - if (qAbs(velocity) < epsilon && qAbs(srcVal - currentValue) < epsilon) { - velocity = 0.0; - currentValue = srcVal; + if (qAbs(animation.velocity) < epsilon && qAbs(srcVal - animation.currentValue) < epsilon) { + animation.velocity = 0.0; + animation.currentValue = srcVal; stop = true; } - lastTime = time - (elapsed - count * 16); } else { qreal moveBy = elapsed * velocityms; - qreal diff = srcVal - currentValue; + qreal diff = srcVal - animation.currentValue; if (haveModulus && qAbs(diff) > modulus / 2) { if (diff < 0) diff += modulus; @@ -164,33 +189,31 @@ void QDeclarativeSpringAnimationPrivate::tick(int time) diff -= modulus; } if (diff > 0) { - currentValue += moveBy; + animation.currentValue += moveBy; if (haveModulus) - currentValue = fmod(currentValue, modulus); - if (currentValue > to) { - currentValue = to; + animation.currentValue = fmod(animation.currentValue, modulus); + if (animation.currentValue > animation.to) { + animation.currentValue = animation.to; stop = true; } } else { - currentValue -= moveBy; - if (haveModulus && currentValue < 0.0) - currentValue = fmod(currentValue, modulus) + modulus; - if (currentValue < to) { - currentValue = to; + animation.currentValue -= moveBy; + if (haveModulus && animation.currentValue < 0.0) + animation.currentValue = fmod(animation.currentValue, modulus) + modulus; + if (animation.currentValue < animation.to) { + animation.currentValue = animation.to; stop = true; } } - lastTime = time; } - qreal old_to = to; + qreal old_to = animation.to; - QDeclarativePropertyPrivate::write(defaultProperty, currentValue, + QDeclarativePropertyPrivate::write(property, animation.currentValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); - if (stop && old_to == to) // do not stop if we got restarted - clock.stop(); + return (stop && old_to == animation.to); // do not stop if we got restarted } void QDeclarativeSpringAnimationPrivate::updateMode() @@ -205,6 +228,8 @@ void QDeclarativeSpringAnimationPrivate::updateMode() /*! \qmlclass SpringAnimation QDeclarativeSpringAnimation + \ingroup qml-animation-transition + \inherits Animation \since 4.7 \brief The SpringAnimation element allows a property to track a value in a spring-like motion. @@ -223,86 +248,23 @@ void QDeclarativeSpringAnimationPrivate::updateMode() Like any other animation element, a SpringAnimation can be applied in a number of ways, including transitions, behaviors and property value - sources. The \l PropertyAnimation documentation shows a variety of methods + sources. The \l {QML Animation} documentation shows a variety of methods for creating animations. \sa SmoothedAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example}, {declarative/toys/clocks}{Clocks example} */ QDeclarativeSpringAnimation::QDeclarativeSpringAnimation(QObject *parent) -: QDeclarativeAbstractAnimation(*(new QDeclarativeSpringAnimationPrivate),parent) -{ -} - -QDeclarativeSpringAnimation::~QDeclarativeSpringAnimation() -{ -} - -void QDeclarativeSpringAnimation::setTarget(const QDeclarativeProperty &property) +: QDeclarativeNumberAnimation(*(new QDeclarativeSpringAnimationPrivate),parent) { Q_D(QDeclarativeSpringAnimation); - d->defaultProperty = property; - d->currentValue = property.read().toReal(); - if (!d->avoidPropertyValueSourceStart) { - setRunning(true); - } -} - -qreal QDeclarativeSpringAnimation::to() const -{ - Q_D(const QDeclarativeSpringAnimation); - return d->toDefined ? d->to : 0; -} - -/*! - \qmlproperty real SpringAnimation::to - - This property holds the value at which the animation will end. - - If not set, the animation will continue until it reaches the - value that is being tracked. -*/ - -void QDeclarativeSpringAnimation::setTo(qreal value) -{ - Q_D(QDeclarativeSpringAnimation); - if (d->to == value) - return; - - d->to = value; - d->toDefined = true; - d->lastTime = 0; - emit toChanged(value); + d->clock = new QDeclarativeSpringAnimationPrivate::Clock(d, this); } -qreal QDeclarativeSpringAnimation::from() const -{ - Q_D(const QDeclarativeSpringAnimation); - return d->fromDefined ? d->from : 0; -} - -/*! - \qmlproperty real SpringAnimation::from - - This property holds the value from which the animation will begin. - - If not set, the animation will start whenever the tracked value has - changed, regardless of its value. -*/ - -void QDeclarativeSpringAnimation::setFrom(qreal value) +QDeclarativeSpringAnimation::~QDeclarativeSpringAnimation() { - Q_D(QDeclarativeSpringAnimation); - if (d->from == value) - return; - - d->currentValue = d->from = value; - d->fromDefined = true; - d->lastTime = 0; - emit fromChanged(value); } - /*! \qmlproperty real SpringAnimation::velocity @@ -452,17 +414,25 @@ void QDeclarativeSpringAnimation::transition(QDeclarativeStateActions &actions, Q_D(QDeclarativeSpringAnimation); Q_UNUSED(direction); - if (d->clock.state() != QAbstractAnimation::Running) + if (d->clock->state() != QAbstractAnimation::Running) { d->lastTime = 0; + } - if (!actions.isEmpty()) { - for (int i = 0; i < actions.size(); ++i) { - if (!d->toDefined) - d->to = actions.at(i).toValue.toReal(); - if (!d->fromDefined) - d->currentValue = actions.at(i).fromValue.toReal(); - if (d->mode != QDeclarativeSpringAnimationPrivate::Track) - modified << d->defaultProperty; + QDeclarativeNumberAnimation::transition(actions, modified, direction); + + if (!d->actions) + return; + + if (!d->actions->isEmpty()) { + for (int i = 0; i < d->actions->size(); ++i) { + const QDeclarativeProperty &property = d->actions->at(i).property; + QDeclarativeSpringAnimationPrivate::SpringAnimation &animation + = d->activeAnimations[property]; + animation.to = d->actions->at(i).toValue.toReal(); + if (d->fromIsDefined) + animation.currentValue = d->actions->at(i).fromValue.toReal(); + else + animation.currentValue = property.read().toReal(); } } } @@ -471,7 +441,7 @@ void QDeclarativeSpringAnimation::transition(QDeclarativeStateActions &actions, QAbstractAnimation *QDeclarativeSpringAnimation::qtAnimation() { Q_D(QDeclarativeSpringAnimation); - return &d->clock; + return d->clock; } QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativespringanimation_p.h b/src/declarative/util/qdeclarativespringanimation_p.h index 6f574ef..ee276ec 100644 --- a/src/declarative/util/qdeclarativespringanimation_p.h +++ b/src/declarative/util/qdeclarativespringanimation_p.h @@ -54,14 +54,12 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeSpringAnimationPrivate; -class Q_AUTOTEST_EXPORT QDeclarativeSpringAnimation : public QDeclarativeAbstractAnimation +class Q_AUTOTEST_EXPORT QDeclarativeSpringAnimation : public QDeclarativeNumberAnimation { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeSpringAnimation) Q_INTERFACES(QDeclarativePropertyValueSource) - Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) - Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity) Q_PROPERTY(qreal spring READ spring WRITE setSpring) Q_PROPERTY(qreal damping READ damping WRITE setDamping) @@ -73,14 +71,6 @@ public: QDeclarativeSpringAnimation(QObject *parent=0); ~QDeclarativeSpringAnimation(); - virtual void setTarget(const QDeclarativeProperty &); - - qreal to() const; - void setTo(qreal value); - - qreal from() const; - void setFrom(qreal value); - qreal velocity() const; void setVelocity(qreal velocity); @@ -99,9 +89,6 @@ public: qreal modulus() const; void setModulus(qreal modulus); - bool enabled() const; - void setEnabled(bool enabled); - virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, TransitionDirection direction); @@ -110,8 +97,6 @@ protected: virtual QAbstractAnimation *qtAnimation(); Q_SIGNALS: - void toChanged(qreal); - void fromChanged(qreal); void modulusChanged(); void massChanged(); void syncChanged(); diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 0d43d21..6e17cf2 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -133,6 +133,7 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje /*! \qmlclass State QDeclarativeState + \ingroup qml-state-elements \since 4.7 \brief The State element defines configurations of objects and properties. @@ -154,13 +155,14 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje Notice the default state is referred to using an empty string (""). - States are commonly used together with \l {state-transitions}{Transitions} to provide + States are commonly used together with \l {Transitions} to provide animations when state changes occur. \note Setting the state of an object from within another state of the same object is not allowed. - \sa {declarative/animation/states}{states example}, {qmlstates}{States}, {state-transitions}{Transitions}, QtDeclarative + \sa {declarative/animation/states}{states example}, {qmlstates}{States}, + {qdeclarativeanimation.html#transitions}{QML Transitions}, QtDeclarative */ /*! diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp index 67cd12e..fc90baa 100644 --- a/src/declarative/util/qdeclarativestategroup.cpp +++ b/src/declarative/util/qdeclarativestategroup.cpp @@ -88,6 +88,7 @@ public: /*! \qmlclass StateGroup QDeclarativeStateGroup + \ingroup qml-state-elements \since 4.7 \brief The StateGroup element provides state support for non-Item elements. @@ -112,7 +113,7 @@ public: } \endqml - \sa {qmlstate}{States} {state-transitions}{Transitions}, {QtDeclarative} + \sa {qmlstate}{States} {Transitions}, {QtDeclarative} */ QDeclarativeStateGroup::QDeclarativeStateGroup(QObject *parent) @@ -204,7 +205,7 @@ void QDeclarativeStateGroupPrivate::clear_states(QDeclarativeListProperty<QDecla } \endqml - \sa {state-transitions}{Transitions} + \sa {Transitions} */ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeStateGroup::transitionsProperty() { diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index 2291c16..6e6f0cb 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -161,6 +161,7 @@ void QDeclarativeParentChangePrivate::doChange(QDeclarativeItem *targetParent, Q /*! \preliminary \qmlclass ParentChange QDeclarativeParentChange + \ingroup qml-state-elements \brief The ParentChange element allows you to reparent an Item in a state change. ParentChange reparents an item while preserving its visual appearance (position, size, @@ -589,6 +590,7 @@ public: /*! \qmlclass StateChangeScript QDeclarativeStateChangeScript + \ingroup qml-state-elements \brief The StateChangeScript element allows you to run a script in a state. A StateChangeScript is run upon entering a state. You can optionally use @@ -693,6 +695,7 @@ QString QDeclarativeStateChangeScript::typeName() const /*! \qmlclass AnchorChanges QDeclarativeAnchorChanges + \ingroup qml-state-elements \brief The AnchorChanges element allows you to change the anchors of an item in a state. The AnchorChanges element is used to modify the anchors of an item in a \l State. diff --git a/src/declarative/util/qdeclarativesystempalette.cpp b/src/declarative/util/qdeclarativesystempalette.cpp index c334859..7b80736 100644 --- a/src/declarative/util/qdeclarativesystempalette.cpp +++ b/src/declarative/util/qdeclarativesystempalette.cpp @@ -58,6 +58,7 @@ public: /*! \qmlclass SystemPalette QDeclarativeSystemPalette + \ingroup qml-utility-elements \since 4.7 \brief The SystemPalette element provides access to the Qt palettes. diff --git a/src/declarative/util/qdeclarativetimer.cpp b/src/declarative/util/qdeclarativetimer.cpp index 838a8f3..56320e6 100644 --- a/src/declarative/util/qdeclarativetimer.cpp +++ b/src/declarative/util/qdeclarativetimer.cpp @@ -70,6 +70,7 @@ public: /*! \qmlclass Timer QDeclarativeTimer + \ingroup qml-utility-elements \since 4.7 \brief The Timer item triggers a handler at a specified interval. diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index 582191b..21d7ded 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Transition QDeclarativeTransition + \ingroup qml-animation-transition \since 4.7 \brief The Transition element defines animated transitions that occur on state changes. @@ -60,12 +61,25 @@ QT_BEGIN_NAMESPACE For example, the following \l Rectangle has two states: the default state, and an added "moved" state. In the "moved state, the rectangle's position changes - to (50, 50). The added \l Transition specifies that when the rectangle + to (50, 50). The added Transition specifies that when the rectangle changes between the default and the "moved" state, any changes to the \c x and \c y properties should be animated, using an \c Easing.InOutQuad. - + \snippet doc/src/snippets/declarative/transition.qml 0 + Notice the example does not require \l{PropertyAnimation::}{to} and + \l{PropertyAnimation::}{from} values for the NumberAnimation. As a convenience, + these properties are automatically set to the values of \c x and \c y before + and after the state change; the \c from values are provided by + the current values of \c x and \c y, and the \c to values are provided by + the PropertyChanges object. If you wish, you can provide \l{PropertyAnimation::}{to} and + \l{PropertyAnimation::}{from} values anyway to override the default values. + + By default, a Transition's animations are applied for any state change in the + parent item. The Transition \l {Transition::}{from} and \l {Transition::}{to} + values can be set to restrict the animations to only be applied when changing + from one particular state to another. + To define multiple transitions, specify \l Item::transitions as a list: \qml @@ -78,7 +92,11 @@ QT_BEGIN_NAMESPACE } \endqml - \sa {declarative/animation/states}{states example}, {qmlstates}{States}, {state-transitions}{Transitions}, {QtDeclarative} + If a state change has a Transition that matches the same property as a + \l Behavior, the Transition animation overrides the \l Behavior for that + state change. + + \sa {QML Animation}, {declarative/animation/states}{states example}, {qmlstates}{States}, {QtDeclarative} */ /*! diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 7c1e1fd..7b3d4a8 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -72,6 +72,7 @@ typedef QPair<int, int> QDeclarativeXmlListRange; /*! \qmlclass XmlRole QDeclarativeXmlListModelRole + \ingroup qml-working-with-data \since 4.7 \brief The XmlRole element allows you to specify a role for an XmlListModel. @@ -505,6 +506,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla /*! \qmlclass XmlListModel QDeclarativeXmlListModel + \ingroup qml-working-with-data \since 4.7 \brief The XmlListModel element is used to specify a model using XPath expressions. @@ -560,7 +562,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla ListView { width: 180; height: 300 model: xmlModel - delegate: Text { text: title + " (" + pubDate + ")" } + delegate: Text { text: title + ": " + pubDate } } \endqml @@ -855,6 +857,12 @@ qreal QDeclarativeXmlListModel::progress() const return d->progress; } +/*! + \qmlmethod void XmlListModel::errorString() + + Returns a string description of the last error that occurred + if \l status is XmlListModel::Error. +*/ QString QDeclarativeXmlListModel::errorString() const { Q_D(const QDeclarativeXmlListModel); diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index bb8ef3f..9c63dfa 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -131,6 +131,7 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin - (QFont)qtFont; - (void)finishOffWithCode:(NSInteger)result; - (void)cleanUpAfterMyself; +- (void)setSubwindowStacking; @end static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) @@ -187,6 +188,12 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) [cancelButton setTarget:self]; } + mQtFont = new QFont(); + return self; +} + +- (void)setSubwindowStacking +{ #ifdef QT_MAC_USE_COCOA // Stack the native dialog in front of its parent, if any: QFontDialog *q = mPriv->fontDialog(); @@ -199,9 +206,6 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) } } #endif - - mQtFont = new QFont(); - return self; } - (void)dealloc @@ -610,6 +614,7 @@ void QFontDialogPrivate::createNSFontPanelDelegate() [ourPanel setFrame:frameRect display:NO]; [ourPanel center]; } + [del setSubwindowStacking]; NSString *title = @"Select font"; [ourPanel setTitle:title]; } diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index fea6e8d..15cc109 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -165,7 +165,7 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) if (chosenVisualInfo) { // Skip size checks if implementation supports non-matching visual // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). - if (QEgl::hasExtension("EGL_NV_post_convert_replication")) + if (QEgl::hasExtension("EGL_NV_post_convert_rounding")) return visualId; int visualRedSize = countBits(chosenVisualInfo->red_mask); diff --git a/src/gui/embedded/qkbdlinuxinput_qws.cpp b/src/gui/embedded/qkbdlinuxinput_qws.cpp index 6c91a08..f53c444 100644 --- a/src/gui/embedded/qkbdlinuxinput_qws.cpp +++ b/src/gui/embedded/qkbdlinuxinput_qws.cpp @@ -138,7 +138,7 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h, // record the original mode so we can restore it again in the destructor. ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode); - // setting this tranlation mode is even needed in INPUT mode to prevent + // setting this translation mode is even needed in INPUT mode to prevent // the shell from also interpreting codes, if the process has a tty // attached: e.g. Ctrl+C wouldn't copy, but kill the application. ::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW); diff --git a/src/gui/embedded/qkbdqnx_qws.cpp b/src/gui/embedded/qkbdqnx_qws.cpp index fbc683e..72d1cb5 100644 --- a/src/gui/embedded/qkbdqnx_qws.cpp +++ b/src/gui/embedded/qkbdqnx_qws.cpp @@ -150,7 +150,7 @@ void QWSQnxKeyboardHandler::socketActivated() // figure out whether it's a press bool isPress = packet.data.key_cap & KEY_DOWN; - // figure out wheter the key is still pressed and the key event is repeated + // figure out whether the key is still pressed and the key event is repeated bool isRepeat = packet.data.key_cap & KEY_REPEAT; Qt::Key key = Qt::Key_unknown; diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp index 062b5ac..3fc7f10 100644 --- a/src/gui/graphicsview/qgraphicsgridlayout.cpp +++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp @@ -641,7 +641,8 @@ QSizeF QGraphicsGridLayout::sizeHint(Qt::SizeHint which, const QSizeF &constrain Q_D(const QGraphicsGridLayout); qreal left, top, right, bottom; getContentsMargins(&left, &top, &right, &bottom); - return d->engine.sizeHint(d->styleInfo(), which , constraint) + QSizeF(left + right, top + bottom); + const QSizeF extraMargins(left + right, top + bottom); + return d->engine.sizeHint(d->styleInfo(), which , constraint - extraMargins) + extraMargins; } diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 1626d83..0b3b164 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -3259,8 +3259,12 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim QGraphicsItem *p = parent; while (p) { if (p->flags() & QGraphicsItem::ItemIsFocusScope) { + QGraphicsItem *oldFocusScopeItem = p->d_ptr->focusScopeItem; p->d_ptr->focusScopeItem = q_ptr; if (!p->focusItem() && !focusFromShow) { + if (oldFocusScopeItem) + oldFocusScopeItem->d_ptr->focusScopeItemChange(false); + focusScopeItemChange(true); // If you call setFocus on a child of a focus scope that // doesn't currently have a focus item, then stop. return; @@ -5595,6 +5599,7 @@ void QGraphicsItemPrivate::subFocusItemChange() */ void QGraphicsItemPrivate::focusScopeItemChange(bool isSubFocusItem) { + Q_UNUSED(isSubFocusItem); } /*! @@ -7753,6 +7758,21 @@ void QGraphicsItemPrivate::resetHeight() } /*! + \property QGraphicsObject::children + \internal +*/ + +/*! + \property QGraphicsObject::width + \internal +*/ + +/*! + \property QGraphicsObject::height + \internal +*/ + +/*! \property QGraphicsObject::parent \brief the parent of the item @@ -7965,6 +7985,24 @@ void QGraphicsItemPrivate::resetHeight() */ /*! + \property QGraphicsObject::children + \since 4.7 + \internal +*/ + +/*! + \property QGraphicsObject::width + \since 4.7 + \internal +*/ + +/*! + \property QGraphicsObject::height + \since 4.7 + \internal +*/ + +/*! \class QAbstractGraphicsShapeItem \brief The QAbstractGraphicsShapeItem class provides a common base for all path items. diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index 5a7f1af..3707591 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -48,6 +48,7 @@ #include "qgraphicslayoutitem.h" #include "qgraphicslayoutitem_p.h" #include "qwidget.h" +#include "qgraphicswidget.h" #include <QtDebug> @@ -139,9 +140,11 @@ QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) if (!sizeHintCacheDirty && cachedConstraint == constraint) return cachedSizeHints; + const bool hasConstraint = constraint.width() >= 0 || constraint.height() >= 0; + for (int i = 0; i < Qt::NSizeHints; ++i) { cachedSizeHints[i] = constraint; - if (userSizeHints) + if (userSizeHints && !hasConstraint) combineSize(cachedSizeHints[i], userSizeHints[i]); } @@ -259,6 +262,52 @@ void QGraphicsLayoutItemPrivate::setSizeComponent( q->updateGeometry(); } + +bool QGraphicsLayoutItemPrivate::hasHeightForWidth() const +{ + Q_Q(const QGraphicsLayoutItem); + if (isLayout) { + const QGraphicsLayout *l = static_cast<const QGraphicsLayout *>(q); + for (int i = l->count() - 1; i >= 0; --i) { + if (QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasHeightForWidth()) + return true; + } + } else if (QGraphicsItem *item = q->graphicsItem()) { + if (item->isWidget()) { + QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); + if (w->layout()) { + return QGraphicsLayoutItemPrivate::get(w->layout())->hasHeightForWidth(); + } + } + } + return q->sizePolicy().hasHeightForWidth(); +} + +bool QGraphicsLayoutItemPrivate::hasWidthForHeight() const +{ + // enable this code when we add QSizePolicy::hasWidthForHeight() (For 4.8) +#if 1 + return false; +#else + Q_Q(const QGraphicsLayoutItem); + if (isLayout) { + const QGraphicsLayout *l = static_cast<const QGraphicsLayout *>(q); + for (int i = l->count() - 1; i >= 0; --i) { + if (QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasWidthForHeight()) + return true; + } + } else if (QGraphicsItem *item = q->graphicsItem()) { + if (item->isWidget()) { + QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); + if (w->layout()) { + return QGraphicsLayoutItemPrivate::get(w->layout())->hasWidthForHeight(); + } + } + } + return q->sizePolicy().hasWidthForHeight(); +#endif +} + /*! \class QGraphicsLayoutItem \brief The QGraphicsLayoutItem class can be inherited to allow your custom diff --git a/src/gui/graphicsview/qgraphicslayoutitem_p.h b/src/gui/graphicsview/qgraphicslayoutitem_p.h index 15cc7a5..b752e03 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem_p.h +++ b/src/gui/graphicsview/qgraphicslayoutitem_p.h @@ -65,6 +65,9 @@ class Q_AUTOTEST_EXPORT QGraphicsLayoutItemPrivate public: virtual ~QGraphicsLayoutItemPrivate(); QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *parent, bool isLayout); + static QGraphicsLayoutItemPrivate *get(QGraphicsLayoutItem *q) { return q->d_func();} + static const QGraphicsLayoutItemPrivate *get(const QGraphicsLayoutItem *q) { return q->d_func();} + void init(); QSizeF *effectiveSizeHints(const QSizeF &constraint) const; QGraphicsItem *parentItem() const; @@ -73,6 +76,9 @@ public: enum SizeComponent { Width, Height }; void setSizeComponent(Qt::SizeHint which, SizeComponent component, qreal value); + bool hasHeightForWidth() const; + bool hasWidthForHeight() const; + QSizePolicy sizePolicy; QGraphicsLayoutItem *parent; diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index 37408ef..1588364 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -528,7 +528,8 @@ QSizeF QGraphicsLinearLayout::sizeHint(Qt::SizeHint which, const QSizeF &constra Q_D(const QGraphicsLinearLayout); qreal left, top, right, bottom; getContentsMargins(&left, &top, &right, &bottom); - return d->engine.sizeHint(d->styleInfo(), which , constraint) + QSizeF(left + right, top + bottom); + const QSizeF extraMargins(left + right, top + bottom); + return d->engine.sizeHint(d->styleInfo(), which , constraint - extraMargins) + extraMargins; } /*! diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 48a0093..a98ce6f 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -831,6 +831,11 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, #endif //QT_NO_IM } + // This handles the case that the item has been removed from the + // scene in response to the FocusOut event. + if (item && item->scene() != q) + item = 0; + if (item) focusItem = item; updateInputMethodSensitivityInViews(); diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index 986bee6..bd3f2ef 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -345,6 +345,24 @@ void QGraphicsScale::applyTo(QMatrix4x4 *matrix) const */ /*! + \fn QGraphicsScale::xScaleChanged() + + QGraphicsScale emits this signal when its xScale changes. +*/ + +/*! + \fn QGraphicsScale::yScaleChanged() + + QGraphicsScale emits this signal when its yScale changes. +*/ + +/*! + \fn QGraphicsScale::zScaleChanged() + + QGraphicsScale emits this signal when its zScale changes. +*/ + +/*! \fn QGraphicsScale::scaleChanged() This signal is emitted whenever the xScale, yScale, or zScale @@ -565,6 +583,27 @@ void QGraphicsRotation::applyTo(QMatrix4x4 *matrix) const \sa QGraphicsRotation::axis */ +/*! + \fn QGraphicsScale::xScaleChanged() + \since 4.7 + + This signal is emitted whenever the \l xScale property changes. +*/ + +/*! + \fn QGraphicsScale::yScaleChanged() + \since 4.7 + + This signal is emitted whenever the \l yScale property changes. +*/ + +/*! + \fn QGraphicsScale::zScaleChanged() + \since 4.7 + + This signal is emitted whenever the \l zScale property changes. +*/ + #include "moc_qgraphicstransform.cpp" QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index c486c45..0fabd18 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -385,12 +385,12 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) if (wd->inSetPos) { //set the new pos d->geom.moveTopLeft(pos()); + emit geometryChanged(); return; } } QSizeF oldSize = size(); QGraphicsLayoutItem::setGeometry(newGeom); - emit geometryChanged(); // Send resize event bool resized = newGeom.size() != oldSize; if (resized) { @@ -403,6 +403,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) emit heightChanged(); QApplication::sendEvent(this, &re); } + emit geometryChanged(); } /*! diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index a084647..f3b2026 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -250,6 +250,7 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz sumAvailable = targetSize - totalBox.q_preferredSize; if (sumAvailable > 0.0) { + qreal sumCurrentAvailable = sumAvailable; bool somethingHasAMaximumSize = false; qreal sumPreferredSizes = 0.0; @@ -308,12 +309,12 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz qreal ultimateFactor = (stretch * ultimateSumPreferredSizes / sumStretches) - (box.q_preferredSize); - qreal transitionalFactor = sumAvailable + qreal transitionalFactor = sumCurrentAvailable * (ultimatePreferredSize - box.q_preferredSize) / (ultimateSumPreferredSizes - sumPreferredSizes); - qreal alpha = qMin(sumAvailable, + qreal alpha = qMin(sumCurrentAvailable, ultimateSumPreferredSizes - sumPreferredSizes); qreal beta = ultimateSumPreferredSizes - sumPreferredSizes; @@ -321,7 +322,7 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz + ((beta - alpha) * transitionalFactor)) / beta; } sumFactors += factors[i]; - if (desired < sumAvailable) + if (desired < sumCurrentAvailable) somethingHasAMaximumSize = true; newSizes[i] = -1.0; @@ -337,12 +338,12 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz continue; const QGridLayoutBox &box = boxes.at(start + i); - qreal avail = sumAvailable * factors[i] / sumFactors; + qreal avail = sumCurrentAvailable * factors[i] / sumFactors; if (sizes[i] + avail >= box.q_maximumSize) { newSizes[i] = box.q_maximumSize; - sumAvailable -= box.q_maximumSize - sizes[i]; + sumCurrentAvailable -= box.q_maximumSize - sizes[i]; sumFactors -= factors[i]; - keepGoing = (sumAvailable > 0.0); + keepGoing = (sumCurrentAvailable > 0.0); if (!keepGoing) break; } @@ -352,7 +353,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 - : sumAvailable * factors[i] / sumFactors; + : sumCurrentAvailable * factors[i] / sumFactors; newSizes[i] = sizes[i] + delta; } } @@ -545,6 +546,24 @@ QSizePolicy::Policy QGridLayoutItem::sizePolicy(Qt::Orientation orientation) con : sizePolicy.verticalPolicy(); } +/* + returns true if the size policy returns true for either hasHeightForWidth() + or hasWidthForHeight() + */ +bool QGridLayoutItem::hasDynamicConstraint() const +{ + return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() + || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight(); +} + +Qt::Orientation QGridLayoutItem::dynamicConstraintOrientation() const +{ + if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth()) + return Qt::Vertical; + else //if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight()) + return Qt::Horizontal; +} + QSizePolicy::ControlTypes QGridLayoutItem::controlTypes(LayoutSide /* side */) const { return q_layoutItem->sizePolicy().controlType(); @@ -613,7 +632,14 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig qreal cellWidth = width; qreal cellHeight = height; - QSizeF size = effectiveMaxSize().boundedTo(QSizeF(cellWidth, cellHeight)); + QSize constraint; + if (hasDynamicConstraint()) { + if (dynamicConstraintOrientation() == Qt::Vertical) + constraint.setWidth(cellWidth); + else + constraint.setHeight(cellHeight); + } + QSizeF size = effectiveMaxSize(constraint).boundedTo(QSizeF(cellWidth, cellHeight)); width = size.width(); height = size.height(); @@ -675,13 +701,13 @@ void QGridLayoutItem::insertOrRemoveRows(int row, int delta, Qt::Orientation ori Note that effectiveSizeHint does not take sizePolicy into consideration, (since it only evaluates the hints, as the name implies) */ -QSizeF QGridLayoutItem::effectiveMaxSize() const +QSizeF QGridLayoutItem::effectiveMaxSize(const QSizeF &constraint) const { - QSizeF size; + QSizeF size = constraint; bool vGrow = (sizePolicy(Qt::Vertical) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; bool hGrow = (sizePolicy(Qt::Horizontal) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; if (!vGrow || !hGrow) { - QSizeF pref = layoutItem()->effectiveSizeHint(Qt::PreferredSize); + QSizeF pref = layoutItem()->effectiveSizeHint(Qt::PreferredSize, constraint); if (!vGrow) size.setHeight(pref.height()); if (!hGrow) @@ -689,7 +715,7 @@ QSizeF QGridLayoutItem::effectiveMaxSize() const } if (!size.isValid()) { - QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize); + QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize, constraint); if (size.width() == -1) size.setWidth(maxSize.width()); if (size.height() == -1) @@ -1010,6 +1036,7 @@ void QGridLayoutEngine::invalidate() q_cachedEffectiveLastRows[Ver] = -1; q_cachedDataForStyleInfo.invalidate(); q_cachedSize = QSizeF(); + q_cachedConstraintOrientation = UnknownConstraint; } static void visualRect(QRectF *geom, Qt::LayoutDirection dir, const QRectF &contentsRect) @@ -1074,10 +1101,13 @@ QRectF QGridLayoutEngine::cellRect(const QLayoutStyleInfo &styleInfo, } QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, - const QSizeF & /* constraint */) const + const QSizeF &constraint) const { ensureColumnAndRowData(styleInfo); + if (hasDynamicConstraint()) + return dynamicallyConstrainedSizeHint(which, constraint); + switch (which) { case Qt::MinimumSize: return QSizeF(q_totalBoxes[Hor].q_minimumSize, q_totalBoxes[Ver].q_minimumSize); @@ -1375,7 +1405,11 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt box = &multiCell.q_box; multiCell.q_stretch = itemStretch; } - box->combine(item->box(orientation)); + // Items with constraints are not included in the orientation that + // they are constrained (since it depends on the hfw/constraint function). + // They must be combined at a later stage. + if (!item->hasDynamicConstraint() || orientation != item->dynamicConstraintOrientation()) + box->combine(item->box(orientation)); if (effectiveRowSpan == 1) { QSizePolicy::ControlTypes controls = item->controlTypes(top); @@ -1532,6 +1566,138 @@ void QGridLayoutEngine::ensureColumnAndRowData(const QLayoutStyleInfo &styleInfo q_cachedDataForStyleInfo = styleInfo; } +QSizeF QGridLayoutEngine::dynamicallyConstrainedSizeHint(Qt::SizeHint which, + const QSizeF &constraint) const +{ + Q_ASSERT(hasDynamicConstraint()); + if (constraint.width() < 0 && constraint.height() < 0) { + // Process the hfw / wfh items that we did not process in fillRowData() + const Qt::Orientation constraintOrient = constraintOrientation(); + + QGridLayoutRowData rowData = constraintOrient == Qt::Vertical ? q_rowData : q_columnData; + for (int i = q_items.count() - 1; i >= 0; --i) { + QGridLayoutItem *item = q_items.at(i); + if (item->hasDynamicConstraint()) { + QGridLayoutBox box = item->box(constraintOrient); + QGridLayoutBox &rowBox = rowData.boxes[item->firstRow(constraintOrient)]; + rowBox.combine(box); + } + } + + QGridLayoutBox totalBoxes[2]; + if (constraintOrient == Qt::Vertical) { + totalBoxes[Hor] = q_columnData.totalBox(0, columnCount()); + totalBoxes[Ver] = rowData.totalBox(0, rowCount()); + } else { + totalBoxes[Hor] = rowData.totalBox(0, columnCount()); + totalBoxes[Ver] = q_rowData.totalBox(0, rowCount()); + } + return QSizeF(totalBoxes[Hor].q_sizes(which), totalBoxes[Ver].q_sizes(which)); + } + + + Q_ASSERT(constraint.width() >= 0 || constraint.height() >= 0); + q_xx.resize(columnCount()); + q_yy.resize(rowCount()); + q_widths.resize(columnCount()); + q_heights.resize(rowCount()); + q_descents.resize(rowCount()); + + + const Qt::Orientation orientation = constraintOrientation(); + QGridLayoutRowData *colData; + QGridLayoutRowData constrainedRowData; + QGridLayoutBox *totalBox; + qreal *sizes; + qreal *pos; + qreal *descents; + qreal targetSize; + qreal cCount; + qreal rCount; + + if (orientation == Qt::Vertical) { + // height for width + colData = &q_columnData; + totalBox = &q_totalBoxes[Hor]; + sizes = q_widths.data(); + pos = q_xx.data(); + descents = 0; + targetSize = constraint.width(); + cCount = columnCount(); + rCount = rowCount(); + constrainedRowData = q_rowData; + } else { + // width for height + colData = &q_rowData; + totalBox = &q_totalBoxes[Ver]; + sizes = q_heights.data(); + pos = q_yy.data(); + descents = q_descents.data(); + targetSize = constraint.height(); + cCount = rowCount(); + rCount = columnCount(); + constrainedRowData = q_columnData; + } + colData->calculateGeometries(0, cCount, targetSize, pos, sizes, descents, *totalBox); + for (int i = q_items.count() - 1; i >= 0; --i) { + QGridLayoutItem *item = q_items.at(i); + + if (item->hasDynamicConstraint()) { + const qreal size = sizes[item->firstColumn(orientation)]; + QGridLayoutBox box = item->box(orientation, size); + QGridLayoutBox &rowBox = constrainedRowData.boxes[item->firstRow(orientation)]; + rowBox.combine(box); + } + } + const qreal newSize = constrainedRowData.totalBox(0, rCount).q_sizes(which); + + return (orientation == Qt::Vertical) ? QSizeF(targetSize, newSize) : QSizeF(newSize, targetSize); +} + + +/** + returns false if the layout has contradicting constraints (i.e. some items with a horizontal + constraint and other items with a vertical constraint) + */ +bool QGridLayoutEngine::ensureDynamicConstraint() const +{ + if (q_cachedConstraintOrientation == UnknownConstraint) { + for (int i = q_items.count() - 1; i >= 0; --i) { + QGridLayoutItem *item = q_items.at(i); + if (item->hasDynamicConstraint()) { + Qt::Orientation itemConstraintOrientation = item->dynamicConstraintOrientation(); + if (q_cachedConstraintOrientation == UnknownConstraint) { + q_cachedConstraintOrientation = itemConstraintOrientation; + } else if (q_cachedConstraintOrientation != itemConstraintOrientation) { + q_cachedConstraintOrientation = UnfeasibleConstraint; + qWarning("QGridLayoutEngine: Unfeasible, cannot mix horizontal and" + " vertical constraint in the same layout"); + return false; + } + } + } + if (q_cachedConstraintOrientation == UnknownConstraint) + q_cachedConstraintOrientation = NoConstraint; + } + return true; +} + +bool QGridLayoutEngine::hasDynamicConstraint() const +{ + if (!ensureDynamicConstraint()) + return false; + return q_cachedConstraintOrientation != NoConstraint; +} + +/* + * return value is only valid if hasConstraint() returns true + */ +Qt::Orientation QGridLayoutEngine::constraintOrientation() const +{ + (void)ensureDynamicConstraint(); + return (Qt::Orientation)q_cachedConstraintOrientation; +} + void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, const QSizeF &size) const { @@ -1544,10 +1710,74 @@ void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, q_widths.resize(columnCount()); q_heights.resize(rowCount()); q_descents.resize(rowCount()); - q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), - 0, q_totalBoxes[Hor]); - q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), - q_descents.data(), q_totalBoxes[Ver]); + + + Qt::Orientation orientation = Qt::Vertical; + if (hasDynamicConstraint()) + orientation = constraintOrientation(); + + /* + In order to do hfw we need to first distribute the columns, then the rows. + In order to do wfh we need to first distribute the rows, then the columns. + + If there is no constraint, the order of distributing the rows or columns first is irrelevant. + We choose horizontal just to keep the same behaviour as before (however, there shouldn't + be any behaviour difference). + */ + + QGridLayoutRowData *colData; + QGridLayoutRowData rowData; + qreal *widths; + qreal *heights; + qreal *xx; + qreal *yy; + qreal *xdescents = 0; + qreal *ydescents = 0; + qreal cCount; + qreal rCount; + QSizeF oSize = size; + if (orientation == Qt::Vertical) { + // height for width + colData = &q_columnData; + rowData = q_rowData; + widths = q_widths.data(); + heights = q_heights.data(); + xx = q_xx.data(); + yy = q_yy.data(); + cCount = columnCount(); + rCount = rowCount(); + ydescents = q_descents.data(); + } else { + // width for height + colData = &q_rowData; + rowData = q_columnData; + widths = q_heights.data(); + heights = q_widths.data(); + xx = q_yy.data(); + yy = q_xx.data(); + cCount = rowCount(); + rCount = columnCount(); + xdescents = q_descents.data(); + oSize.transpose(); + } + + colData->calculateGeometries(0, cCount, oSize.width(), xx, widths, + xdescents, q_totalBoxes[orientation == Qt::Horizontal]); + for (int i = q_items.count() - 1; i >= 0; --i) { + QGridLayoutItem *item = q_items.at(i); + const int col = item->firstColumn(orientation); + const int row = item->firstRow(orientation); + if (item->hasDynamicConstraint()) { + const qreal sz = widths[col]; + QGridLayoutBox box = item->box(orientation, sz); + rowData.boxes[row].combine(box); + } + } + + QGridLayoutBox &totalBox = q_totalBoxes[orientation == Qt::Vertical]; + totalBox = rowData.totalBox(0, rCount); + rowData.calculateGeometries(0, rCount, oSize.height(), yy, heights, + ydescents, totalBox); q_cachedSize = size; } diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h index 9ac9a8e..580af7e 100644 --- a/src/gui/graphicsview/qgridlayoutengine_p.h +++ b/src/gui/graphicsview/qgridlayoutengine_p.h @@ -91,6 +91,14 @@ enum LayoutSide { Bottom }; +enum { + NoConstraint, + HorizontalConstraint, + VerticalConstraint, + UnknownConstraint, // need to update cache + UnfeasibleConstraint // not feasible, it be has some items with Vertical and others with Horizontal constraints +}; + template <typename T> class QLayoutParameter { @@ -270,6 +278,10 @@ public: inline void setAlignment(Qt::Alignment alignment) { q_alignment = alignment; } QSizePolicy::Policy sizePolicy(Qt::Orientation orientation) const; + + bool hasDynamicConstraint() const; + Qt::Orientation dynamicConstraintOrientation() const; + QSizePolicy::ControlTypes controlTypes(LayoutSide side) const; QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; QGridLayoutBox box(Qt::Orientation orientation, qreal constraint = -1.0) const; @@ -280,7 +292,7 @@ public: void setGeometry(const QRectF &rect); void transpose(); void insertOrRemoveRows(int row, int delta, Qt::Orientation orientation = Qt::Vertical); - QSizeF effectiveMaxSize() const; + QSizeF effectiveMaxSize(const QSizeF &constraint) const; #ifdef QT_DEBUG void dump(int indent = 0) const; @@ -372,6 +384,14 @@ public: int column, int rowSpan, int columnSpan) const; QSizeF sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, const QSizeF &constraint) const; + + // heightForWidth / widthForHeight support + QSizeF dynamicallyConstrainedSizeHint(Qt::SizeHint which, const QSizeF &constraint) const; + bool ensureDynamicConstraint() const; + bool hasDynamicConstraint() const; + Qt::Orientation constraintOrientation() const; + + QSizePolicy::ControlTypes controlTypes(LayoutSide side) const; void transpose(); void setVisualDirection(Qt::LayoutDirection direction); @@ -405,6 +425,7 @@ private: // Lazily computed from the above user input mutable int q_cachedEffectiveFirstRows[NOrientations]; mutable int q_cachedEffectiveLastRows[NOrientations]; + mutable quint8 q_cachedConstraintOrientation : 2; // Layout item input mutable QLayoutStyleInfo q_cachedDataForStyleInfo; diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 41de3f2..ad79130 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -77,20 +77,28 @@ symbian { DEPLOYMENT = partial_upgrade $$DEPLOYMENT } +neon:*-g++* { + DEFINES += QT_HAVE_NEON + QMAKE_CXXFLAGS *= -mfpu=neon + HEADERS += $$NEON_HEADERS + SOURCES += $$NEON_SOURCES + + DRAWHELPER_NEON_ASM_FILES = $$NEON_ASM + + neon_compiler.commands = $$QMAKE_CXX -c + neon_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + neon_compiler.dependency_type = TYPE_C + neon_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + neon_compiler.input = DRAWHELPER_NEON_ASM_FILES + neon_compiler.variable_out = OBJECTS + neon_compiler.name = compiling[neon] ${QMAKE_FILE_IN} + silent:neon_compiler.commands = @echo compiling[neon] ${QMAKE_FILE_IN} && $$neon_compiler.commands + QMAKE_EXTRA_COMPILERS += neon_compiler +} + contains(QMAKE_MAC_XARCH, no) { DEFINES += QT_NO_MAC_XARCH } else { - mmx:DEFINES += QT_HAVE_MMX - 3dnow:DEFINES += QT_HAVE_3DNOW - sse:DEFINES += QT_HAVE_SSE QT_HAVE_MMXEXT - sse2:DEFINES += QT_HAVE_SSE2 - sse3:DEFINES += QT_HAVE_SSE3 - ssse3:DEFINES += QT_HAVE_SSSE3 - sse4_1:DEFINES += QT_HAVE_SSE4_1 - sse4_2:DEFINES += QT_HAVE_SSE4_2 - avx:DEFINES += QT_HAVE_AVX - iwmmxt:DEFINES += QT_HAVE_IWMMXT - win32-g++*|!win32:!*-icc* { mmx { mmx_compiler.commands = $$QMAKE_CXX -c -Winline diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 1d89a68..92ea397 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -99,5 +99,6 @@ contains(QT_CONFIG, tiff):include($$PWD/qtiffhandler.pri) contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri) # SIMD +NEON_SOURCES += image/qimage_neon.cpp SSE2_SOURCES += image/qimage_sse2.cpp SSSE3_SOURCES += image/qimage_ssse3.cpp diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 30cf758..ac148ee 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3769,6 +3769,14 @@ void qInitImageConversions() converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_ssse3; } #endif +#ifdef QT_HAVE_NEON + if (features & NEON) { + extern void convert_RGB888_to_RGB32_neon(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); + converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_neon; + converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_neon; + converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_neon; + } +#endif } /*! @@ -4829,7 +4837,7 @@ QImage QImage::rgbSwapped() const QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { uint *q = (uint*)res.scanLine(i); - uint *p = (uint*)scanLine(i); + uint *p = (uint*)constScanLine(i); uint *end = p + d->width; while (p < end) { *q = ((*p << 16) & 0xff0000) | ((*p >> 16) & 0xff) | (*p & 0xff00ff00); @@ -4843,7 +4851,7 @@ QImage QImage::rgbSwapped() const QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { ushort *q = (ushort*)res.scanLine(i); - const ushort *p = (const ushort*)scanLine(i); + const ushort *p = (const ushort*)constScanLine(i); const ushort *end = p + d->width; while (p < end) { *q = ((*p << 11) & 0xf800) | ((*p >> 11) & 0x1f) | (*p & 0x07e0); @@ -4856,12 +4864,15 @@ QImage QImage::rgbSwapped() const res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - quint8 *p = (quint8*)scanLine(i); + const quint8 *p = constScanLine(i); + quint8 *q = res.scanLine(i); const quint8 *end = p + d->width * sizeof(qargb8565); while (p < end) { - quint16 *q = reinterpret_cast<quint16*>(p + 1); - *q = ((*q << 11) & 0xf800) | ((*q >> 11) & 0x1f) | (*q & 0x07e0); + q[0] = p[0]; + q[1] = (p[1] & 0xe0) | (p[2] >> 3); + q[2] = (p[2] & 0x07) | (p[1] << 3); p += sizeof(qargb8565); + q += sizeof(qargb8565); } } break; @@ -4870,7 +4881,7 @@ QImage QImage::rgbSwapped() const QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { qrgb666 *q = reinterpret_cast<qrgb666*>(res.scanLine(i)); - const qrgb666 *p = reinterpret_cast<const qrgb666*>(scanLine(i)); + const qrgb666 *p = reinterpret_cast<const qrgb666*>(constScanLine(i)); const qrgb666 *end = p + d->width; while (p < end) { const QRgb rgb = quint32(*p++); @@ -4882,12 +4893,15 @@ QImage QImage::rgbSwapped() const res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - qargb6666 *q = reinterpret_cast<qargb6666*>(res.scanLine(i)); - const qargb6666 *p = reinterpret_cast<const qargb6666*>(scanLine(i)); - const qargb6666 *end = p + d->width; + const quint8 *p = constScanLine(i); + const quint8 *end = p + d->width * sizeof(qargb6666); + quint8 *q = res.scanLine(i); while (p < end) { - const QRgb rgb = quint32(*p++); - *q++ = qRgba(qBlue(rgb), qGreen(rgb), qRed(rgb), qAlpha(rgb)); + q[0] = (p[1] >> 4) | ((p[2] & 0x3) << 4) | (p[0] & 0xc0); + q[1] = (p[1] & 0xf) | (p[0] << 4); + q[2] = (p[2] & 0xfc) | ((p[0] >> 4) & 0x3); + p += sizeof(qargb6666); + q += sizeof(qargb6666); } } break; @@ -4895,11 +4909,11 @@ QImage QImage::rgbSwapped() const res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - ushort *q = (ushort*)res.scanLine(i); - const ushort *p = (const ushort*)scanLine(i); - const ushort *end = p + d->width; + quint16 *q = (quint16*)res.scanLine(i); + const quint16 *p = (const quint16*)constScanLine(i); + const quint16 *end = p + d->width; while (p < end) { - *q = ((*p << 10) & 0x7800) | ((*p >> 10) & 0x1f) | (*p & 0x83e0); + *q = ((*p << 10) & 0x7c00) | ((*p >> 10) & 0x1f) | (*p & 0x3e0); p++; q++; } @@ -4909,12 +4923,15 @@ QImage QImage::rgbSwapped() const res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - quint8 *p = (quint8*)scanLine(i); + const quint8 *p = constScanLine(i); + quint8 *q = res.scanLine(i); const quint8 *end = p + d->width * sizeof(qargb8555); while (p < end) { - quint16 *q = reinterpret_cast<quint16*>(p + 1); - *q = ((*q << 10) & 0x7800) | ((*q >> 10) & 0x1f) | (*q & 0x83e0); + q[0] = p[0]; + q[1] = (p[1] & 0xe0) | (p[2] >> 2); + q[2] = (p[2] & 0x03) | ((p[1] << 2) & 0x7f); p += sizeof(qargb8555); + q += sizeof(qargb8555); } } break; @@ -4922,8 +4939,8 @@ QImage QImage::rgbSwapped() const res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i)); - const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i)); + quint8 *q = res.scanLine(i); + const quint8 *p = constScanLine(i); const quint8 *end = p + d->width * sizeof(qrgb888); while (p < end) { q[0] = p[2]; @@ -4935,32 +4952,17 @@ QImage QImage::rgbSwapped() const } break; case Format_RGB444: - res = QImage(d->width, d->height, d->format); - QIMAGE_SANITYCHECK_MEMORY(res); - for (int i = 0; i < d->height; i++) { - quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i)); - const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i)); - const quint8 *end = p + d->width * sizeof(qrgb444); - while (p < end) { - q[0] = (p[0] & 0xf0) | ((p[1] & 0x0f) << 8); - q[1] = ((p[0] & 0x0f) >> 8) | (p[1] & 0xf0); - q += sizeof(qrgb444); - p += sizeof(qrgb444); - } - } - break; case Format_ARGB4444_Premultiplied: res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i)); - const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i)); - const quint8 *end = p + d->width * sizeof(qargb4444); + quint16 *q = reinterpret_cast<quint16*>(res.scanLine(i)); + const quint16 *p = reinterpret_cast<const quint16*>(constScanLine(i)); + const quint16 *end = p + d->width; while (p < end) { - q[0] = (p[0] & 0xf0) | ((p[1] & 0x0f) << 8); - q[1] = ((p[0] & 0x0f) >> 8) | (p[1] & 0xf0); - q += sizeof(qargb4444); - p += sizeof(qargb4444); + *q = (*p & 0xf0f0) | ((*p & 0x0f) << 8) | ((*p & 0xf00) >> 8); + p++; + q++; } } break; diff --git a/src/gui/image/qimage_neon.cpp b/src/gui/image/qimage_neon.cpp new file mode 100644 index 0000000..15bf472 --- /dev/null +++ b/src/gui/image/qimage_neon.cpp @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qimage.h> +#include <private/qimage_p.h> +#include <private/qsimd_p.h> + +#ifdef QT_HAVE_NEON + +QT_BEGIN_NAMESPACE + +Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, const uchar *src, int len) +{ + if (!len) + return; + + const quint32 *const end = dst + len; + + // align dst on 64 bits + const int offsetToAlignOn8Bytes = (reinterpret_cast<quintptr>(dst) >> 2) & 0x1; + for (int i = 0; i < offsetToAlignOn8Bytes; ++i) { + *dst++ = qRgb(src[0], src[1], src[2]); + src += 3; + } + + if ((len - offsetToAlignOn8Bytes) >= 8) { + const quint32 *const simdEnd = end - 7; + register uint8x8_t fullVector asm ("d3") = vdup_n_u8(0xff); + do { +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + asm volatile ( + "vld3.8 { d4, d5, d6 }, [%[SRC]] !\n\t" + "vst4.8 { d3, d4, d5, d6 }, [%[DST],:64] !\n\t" + : [DST]"+r" (dst), [SRC]"+r" (src) + : "w"(fullVector) + : "memory", "d4", "d5", "d6" + ); +#else + asm volatile ( + "vld3.8 { d0, d1, d2 }, [%[SRC]] !\n\t" + "vswp d0, d2\n\t" + "vst4.8 { d0, d1, d2, d3 }, [%[DST],:64] !\n\t" + : [DST]"+r" (dst), [SRC]"+r" (src) + : "w"(fullVector) + : "memory", "d0", "d1", "d2" + ); +#endif + } while (dst < simdEnd); + } + + while (dst != end) { + *dst++ = qRgb(src[0], src[1], src[2]); + src += 3; + } +} + +void convert_RGB888_to_RGB32_neon(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->format == QImage::Format_RGB888); + Q_ASSERT(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const uchar *src_data = (uchar *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + qt_convert_rgb888_to_rgb32_neon(dest_data, src_data, src->width); + src_data += src->bytes_per_line; + dest_data = (quint32 *)((uchar*)dest_data + dest->bytes_per_line); + } +} + +QT_END_NAMESPACE + +#endif // QT_HAVE_NEON diff --git a/src/gui/image/qimage_ssse3.cpp b/src/gui/image/qimage_ssse3.cpp index 1c664f2..9aed011 100644 --- a/src/gui/image/qimage_ssse3.cpp +++ b/src/gui/image/qimage_ssse3.cpp @@ -45,13 +45,12 @@ #ifdef QT_HAVE_SSSE3 -#include <stdio.h> QT_BEGIN_NAMESPACE // Convert a scanline of RGB888 (src) to RGB32 (dst) // src must be at least len * 3 bytes // dst must be at least len * 4 bytes -inline void convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len) +Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len) { quint32 *const end = dst + len; @@ -139,7 +138,7 @@ void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt:: quint32 *dest_data = (quint32 *) dest->data; for (int i = 0; i < src->height; ++i) { - convert_rgb888_to_rgb32_ssse3(dest_data, src_data, src->width); + qt_convert_rgb888_to_rgb32_ssse3(dest_data, src_data, src->width); src_data += src->bytes_per_line; dest_data = (quint32 *)((uchar*)dest_data + dest->bytes_per_line); } diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index 972dd65..eda5efb 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -45,6 +45,7 @@ #include <qvariant.h> #include <qvector.h> #include <qbuffer.h> +#include <private/qsimd_p.h> #include <stdio.h> // jpeglib needs this to be pre-included #include <setjmp.h> @@ -75,6 +76,19 @@ extern "C" { QT_BEGIN_NAMESPACE +void QT_FASTCALL convert_rgb888_to_rgb32_C(quint32 *dst, const uchar *src, int len) +{ + // Expand 24->32 bpp. + for (int i = 0; i < len; ++i) { + *dst++ = qRgb(src[0], src[1], src[2]); + src += 3; + } +} + +typedef void (QT_FASTCALL *Rgb888ToRgb32Converter)(quint32 *dst, const uchar *src, int len); + +static Rgb888ToRgb32Converter rgb888ToRgb32ConverterPtr = convert_rgb888_to_rgb32_C; + struct my_error_mgr : public jpeg_error_mgr { jmp_buf setjmp_buffer; }; @@ -393,13 +407,9 @@ static bool read_jpeg_image(QImage *outImage, continue; // Haven't reached the starting line yet. if (info->output_components == 3) { - // Expand 24->32 bpp. uchar *in = rows[0] + clip.x() * 3; QRgb *out = (QRgb*)outImage->scanLine(y); - for (int i = 0; i < clip.width(); ++i) { - *out++ = qRgb(in[0], in[1], in[2]); - in += 3; - } + rgb888ToRgb32ConverterPtr(out, in, clip.width()); } else if (info->out_color_space == JCS_CMYK) { // Convert CMYK->RGB. uchar *in = rows[0] + clip.x() * 4; @@ -793,6 +803,22 @@ bool QJpegHandlerPrivate::read(QImage *image) QJpegHandler::QJpegHandler() : d(new QJpegHandlerPrivate(this)) { + const uint features = qDetectCPUFeatures(); + Q_UNUSED(features); +#if defined(QT_HAVE_NEON) + // from qimage_neon.cpp + Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, const uchar *src, int len); + + if (features & NEON) + rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_neon; +#endif // QT_HAVE_NEON +#if defined(QT_HAVE_SSSE3) + // from qimage_ssse3.cpp + Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len); + + if (features & SSSE3) + rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_ssse3; +#endif // QT_HAVE_SSSE3 } QJpegHandler::~QJpegHandler() diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 394d374..c4d60a5 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -364,10 +364,10 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) commitTemporaryPreeditString(); - bool numbersOnly = hints & ImhDigitsOnly || hints & ImhFormattedNumbersOnly - || hints & ImhDialableCharactersOnly; - bool noOnlys = !(numbersOnly || hints & ImhUppercaseOnly - || hints & ImhLowercaseOnly); + const bool anynumbermodes = hints & (ImhDigitsOnly | ImhFormattedNumbersOnly | ImhDialableCharactersOnly); + const bool anytextmodes = hints & (ImhUppercaseOnly | ImhLowercaseOnly | ImhEmailCharactersOnly | ImhUrlCharactersOnly); + const bool numbersOnly = anynumbermodes && !anytextmodes; + const bool noOnlys = !(hints & ImhExclusiveInputMask); TInt flags; Qt::InputMethodHints oldHints = hints; @@ -379,8 +379,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) } if (!noOnlys) { // Make sure that the preference is within the permitted set. - if (hints & ImhPreferNumbers && !(hints & ImhDigitsOnly || hints & ImhFormattedNumbersOnly - || hints & ImhDialableCharactersOnly)) { + if (hints & ImhPreferNumbers && !anynumbermodes) { hints &= ~ImhPreferNumbers; } else if (hints & ImhPreferUppercase && !(hints & ImhUppercaseOnly)) { hints &= ~ImhPreferUppercase; @@ -393,8 +392,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) hints |= ImhPreferLowercase; } else if (hints & ImhUppercaseOnly) { hints |= ImhPreferUppercase; - } else if (hints & ImhDigitsOnly || hints & ImhFormattedNumbersOnly - || hints & ImhDialableCharactersOnly) { + } else if (numbersOnly) { hints |= ImhPreferNumbers; } } @@ -408,13 +406,21 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) m_fepState->SetCurrentInputMode(EAknEditorTextInputMode); } flags = 0; - if (numbersOnly) { + if (noOnlys || (anynumbermodes && anytextmodes)) { + flags = EAknEditorAllInputModes; + } + else if (anynumbermodes) { flags |= EAknEditorNumericInputMode; + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 + && ((hints & ImhFormattedNumbersOnly) || (hints & ImhDialableCharactersOnly))) { + //workaround - the * key does not launch the symbols menu, making it impossible to use these modes unless text mode is enabled. + flags |= EAknEditorTextInputMode; + } } - if (hints & ImhUppercaseOnly || hints & ImhLowercaseOnly) { + else if (anytextmodes) { flags |= EAknEditorTextInputMode; } - if (flags == 0) { + else { flags = EAknEditorAllInputModes; } m_fepState->SetPermittedInputModes(flags); @@ -461,24 +467,33 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) if (hints & ImhNoPredictiveText || hints & ImhHiddenText) { flags |= EAknEditorFlagNoT9; } + // if alphanumeric input, or if multiple incompatible number modes are selected; + // then make all symbols available in numeric mode too. + if (!numbersOnly || ((hints & ImhFormattedNumbersOnly) && (hints & ImhDialableCharactersOnly))) + flags |= EAknEditorFlagUseSCTNumericCharmap; m_fepState->SetFlags(flags); ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateFlagsUpdate); - if (hints & ImhFormattedNumbersOnly) { + if (hints & ImhDialableCharactersOnly) { + // This is first, because if (ImhDialableCharactersOnly | ImhFormattedNumbersOnly) + // is specified, this one is more natural (# key enters a #) + flags = EAknEditorStandardNumberModeKeymap; + } else if (hints & ImhFormattedNumbersOnly) { + // # key enters decimal point flags = EAknEditorCalculatorNumberModeKeymap; } else if (hints & ImhDigitsOnly) { + // This is last, because it is most restrictive (# key is inactive) flags = EAknEditorPlainNumberModeKeymap; } else { - // ImhDialableCharactersOnly is the fallback as well, so we don't need to check for - // that flag. flags = EAknEditorStandardNumberModeKeymap; } m_fepState->SetNumericKeymap(static_cast<TAknEditorNumericKeymap>(flags)); - if (hints & ImhEmailCharactersOnly) { - m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_EMAIL_ADDR_SPECIAL_CHARACTER_TABLE_DIALOG); - } else if (hints & ImhUrlCharactersOnly) { + if (hints & ImhUrlCharactersOnly) { + // URL characters is everything except space, so a superset of the other restrictions m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG); + } else if (hints & ImhEmailCharactersOnly) { + m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_EMAIL_ADDR_SPECIAL_CHARACTER_TABLE_DIALOG); } else { m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); } diff --git a/src/gui/inputmethod/qinputcontextfactory.cpp b/src/gui/inputmethod/qinputcontextfactory.cpp index ec8d8e2..865c1b2 100644 --- a/src/gui/inputmethod/qinputcontextfactory.cpp +++ b/src/gui/inputmethod/qinputcontextfactory.cpp @@ -73,7 +73,7 @@ #endif #ifdef Q_WS_S60 #include "qcoefepinputcontext_p.h" -#include "akninputlanguageinfo.h" +#include "AknInputLanguageInfo.h" #endif #include "private/qfactoryloader_p.h" diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 97499f3..4ffd284 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2270,9 +2270,11 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) } else { d->selectionModel->setCurrentIndex(newCurrent, command); d->pressedPosition = visualRect(newCurrent).center() + d->offset(); - // We copy the same behaviour as for mousePressEvent(). - QRect rect(d->pressedPosition - d->offset(), QSize(1, 1)); - setSelection(rect, command); + if (newCurrent.isValid()) { + // We copy the same behaviour as for mousePressEvent(). + QRect rect(d->pressedPosition - d->offset(), QSize(1, 1)); + setSelection(rect, command); + } } event->accept(); return; diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index f9b6b94..953a7f1 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -774,7 +774,7 @@ void QSortFilterProxyModelPrivate::source_items_inserted( if (model->rowCount(source_parent) == delta_item_count) { // Items were inserted where there were none before. // If it was new rows make sure to create mappings for columns so that a - // valid mapping can be retreived later and vice-versa. + // valid mapping can be retrieved later and vice-versa. QVector<int> &orthogonal_proxy_to_source = (orient == Qt::Horizontal) ? m->source_rows : m->source_columns; QVector<int> &orthogonal_source_to_proxy = (orient == Qt::Horizontal) ? m->proxy_rows : m->proxy_columns; diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 08852af..b5af8b6 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -477,7 +477,7 @@ int qt_antialiasing_threshold = -1; static int drag_time = 500; #ifdef Q_OS_SYMBIAN // The screens are a bit too small to for your thumb when using only 4 pixels drag distance. -static int drag_distance = 8; +static int drag_distance = 12; #else static int drag_distance = 4; #endif @@ -1060,6 +1060,18 @@ QApplication::~QApplication() QApplicationPrivate::is_app_closing = true; QApplicationPrivate::is_app_running = false; + // delete all widgets + if (QWidgetPrivate::allWidgets) { + QWidgetSet *mySet = QWidgetPrivate::allWidgets; + QWidgetPrivate::allWidgets = 0; + for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) { + register QWidget *w = *it; + if (!w->parent()) // window + w->destroy(true, true); + } + delete mySet; + } + delete qt_desktopWidget; qt_desktopWidget = 0; @@ -1080,18 +1092,6 @@ QApplication::~QApplication() delete QWidgetPrivate::mapper; QWidgetPrivate::mapper = 0; - // delete all widgets - if (QWidgetPrivate::allWidgets) { - QWidgetSet *mySet = QWidgetPrivate::allWidgets; - QWidgetPrivate::allWidgets = 0; - for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) { - register QWidget *w = *it; - if (!w->parent()) // window - w->destroy(true, true); - } - delete mySet; - } - delete QApplicationPrivate::app_pal; QApplicationPrivate::app_pal = 0; delete QApplicationPrivate::sys_pal; @@ -2549,6 +2549,13 @@ void QApplication::setActiveWindow(QWidget* act) sendSpontaneousEvent(w, &activationChange); } +#ifdef QT_MAC_USE_COCOA + // In case the user clicked on a child window, we need to + // reestablish the stacking order of the window so + // it pops in front of other child windows in cocoa: + qt_cocoaStackChildWindowOnTopOfOtherChildren(window); +#endif + for(int i = 0; i < toBeDeactivated.size(); ++i) { QWidget *w = toBeDeactivated.at(i); sendSpontaneousEvent(w, &windowDeactivate); diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 799d4c2..0242582 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -412,6 +412,9 @@ private: #if defined(QT_RX71_MULTITOUCH) Q_PRIVATE_SLOT(d_func(), void _q_readRX71MultiTouchEvents()) #endif +#if defined(Q_OS_SYMBIAN) + Q_PRIVATE_SLOT(d_func(), void _q_aboutToQuit()) +#endif }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 44aa20a..416ac06 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -561,6 +561,7 @@ public: int symbianHandleCommand(const QSymbianEvent *symbianEvent); int symbianResourceChange(const QSymbianEvent *symbianEvent); + void _q_aboutToQuit(); #endif #if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_QPA) void sendSyntheticEnterLeave(QWidget *widget); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index f8734b2..670bf34 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -87,6 +87,10 @@ #include <hal.h> #include <hal_data.h> +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS +#include <graphics/wstfxconst.h> +#endif + QT_BEGIN_NAMESPACE // Goom Events through Window Server @@ -131,6 +135,38 @@ void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, boo } #endif +void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) +{ + if (QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control)) { + QWidget *const widget = QWidgetPrivate::mapper->value(control); + QWidget *const window = widget->window(); + if (QTLWExtra *topData = qt_widget_private(window)->maybeTopData()) { + QWidgetBackingStoreTracker &backingStore = topData->backingStore; + if (visible) { + if (backingStore.data()) { + backingStore.registerWidget(widget); + } else { +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + S60->wsSession().SendEffectCommand(ETfxCmdRestoreLayer); +#endif + backingStore.create(window); + backingStore.registerWidget(widget); + qt_widget_private(widget)->invalidateBuffer(widget->rect()); + widget->repaint(); + } + } else { +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + S60->wsSession().SendEffectCommand(ETfxCmdDeallocateLayer); +#endif + backingStore.unregisterWidget(widget); + // In order to ensure that any resources used by the window surface + // are immediately freed, we flush the WSERV command buffer. + S60->wsSession().Flush(); + } + } + } +} + bool qt_nograb() // application no-grab option { #if defined(QT_DEBUG) @@ -372,7 +408,7 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop) { if (!desktop) { - if (isWindowOwning or !qwidget->parentWidget()) + if (isWindowOwning || !qwidget->parentWidget()) CreateWindowL(S60->windowGroup()); else /** @@ -395,6 +431,34 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop) DrawableWindow()->SetPointerGrab(ETrue); } + +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + if (OwnsWindow()) { + TTfxWindowPurpose windowPurpose(ETfxPurposeNone); + switch (qwidget->windowType()) { + case Qt::Dialog: + windowPurpose = ETfxPurposeDialogWindow; + break; + case Qt::Popup: + windowPurpose = ETfxPurposePopupWindow; + break; + case Qt::Tool: + windowPurpose = ETfxPurposeToolWindow; + break; + case Qt::ToolTip: + windowPurpose = ETfxPurposeToolTipWindow; + break; + case Qt::SplashScreen: + windowPurpose = ETfxPurposeSplashScreenWindow; + break; + default: + windowPurpose = (isWindowOwning || !qwidget->parentWidget()) + ? ETfxPurposeWindow : ETfxPurposeChildWindow; + break; + } + Window().SetPurpose(windowPurpose); + } +#endif } QSymbianControl::~QSymbianControl() @@ -1035,7 +1099,7 @@ void QSymbianControl::Draw(const TRect& controlRect) const if (QApplicationPrivate::runtime_graphics_system) { QRuntimeWindowSurface *rtSurface = static_cast<QRuntimeWindowSurface*>(qwidget->windowSurface()); - s60Surface = static_cast<QS60WindowSurface *>(rtSurface->m_windowSurface); + s60Surface = static_cast<QS60WindowSurface *>(rtSurface->m_windowSurface.data()); } else #endif s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface()); @@ -1055,7 +1119,8 @@ void QSymbianControl::Draw(const TRect& controlRect) const break; case QWExtra::ZeroFill: - if (Window().DisplayMode() == EColor16MA) { + if (Window().DisplayMode() == EColor16MA + || Window().DisplayMode() == Q_SYMBIAN_ECOLOR16MAP) { gc.SetBrushStyle(CGraphicsContext::ESolidBrush); gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); gc.SetBrushColor(TRgb::Color16MA(0)); @@ -1328,7 +1393,7 @@ void qt_init(QApplicationPrivate * /* priv */, int) // framework destruction. TTrapHandler *origTrapHandler = User::TrapHandler(); - // The S60 framework has not been initalized. We need to do it. + // The S60 framework has not been initialized. We need to do it. TApaApplicationFactory factory(S60->s60ApplicationFactory ? S60->s60ApplicationFactory : newS60Application); CApaCommandLine* commandLine = 0; @@ -1442,6 +1507,8 @@ void qt_init(QApplicationPrivate * /* priv */, int) S60->avkonComponentsSupportTransparency = (value==1) ? true : false; } } + delete repository; + repository = 0; #endif #ifdef QT_KEYPAD_NAVIGATION @@ -1483,6 +1550,10 @@ void qt_init(QApplicationPrivate * /* priv */, int) systemFont.setFamily(systemFont.defaultFamily()); QApplicationPrivate::setSystemFont(systemFont); +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + QObject::connect(qApp, SIGNAL(aboutToQuit()), qApp, SLOT(_q_aboutToQuit())); +#endif + /* ### Commented out for now as parameter handling not needed in SOS(yet). Code below will break testlib with -o flag int argc = priv->argc; @@ -1506,7 +1577,7 @@ void qt_init(QApplicationPrivate * /* priv */, int) */ // Register WId with the metatype system. This is to enable - // QWidgetPrivate::create_sys to used delayed slot invokation in order + // QWidgetPrivate::create_sys to used delayed slot invocation in order // to destroy WId objects during reparenting. qRegisterMetaType<WId>("WId"); } @@ -1572,6 +1643,9 @@ bool QApplicationPrivate::modalState() void QApplicationPrivate::enterModal_sys(QWidget *widget) { +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + S60->wsSession().SendEffectCommand(ETfxCmdAppModalModeEnter); +#endif if (widget) { static_cast<QSymbianControl *>(widget->effectiveWinId())->FadeBehindPopup(ETrue); // Modal partial screen dialogs (like queries) capture pointer events. @@ -1587,6 +1661,9 @@ void QApplicationPrivate::enterModal_sys(QWidget *widget) void QApplicationPrivate::leaveModal_sys(QWidget *widget) { +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + S60->wsSession().SendEffectCommand(ETfxCmdAppModalModeExit); +#endif if (widget) { static_cast<QSymbianControl *>(widget->effectiveWinId())->FadeBehindPopup(EFalse); // ### FixMe: Add specialized behaviour for fullscreen modal dialogs @@ -1877,29 +1954,10 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent if (callSymbianEventFilters(symbianEvent)) return 1; const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged(); - QWidget *w = QWidgetPrivate::mapper->value(control); - QWidget *const window = w->window(); - if (!window->d_func()->maybeTopData()) - break; - QRefCountedWidgetBackingStore &backingStore = window->d_func()->maybeTopData()->backingStore; - if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) { - // Decrement backing store reference count - backingStore.deref(); - // In order to ensure that any resources used by the window surface - // are immediately freed, we flush the WSERV command buffer. - S60->wsSession().Flush(); - } else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) { - if (backingStore.data()) { - // Increment backing store reference count - backingStore.ref(); - } else { - // Create backing store with an initial reference count of 1 - backingStore.create(window); - backingStore.ref(); - w->d_func()->invalidateBuffer(w->rect()); - w->repaint(); - } - } + if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) + S60->controlVisibilityChanged(control, false); + else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) + S60->controlVisibilityChanged(control, true); return 1; } break; @@ -1953,13 +2011,6 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent if (switchToSwRendering) { QRuntimeGraphicsSystem *gs = static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system); - - uint memoryUsage = gs->memoryUsage(); - uint memoryForFullscreen = ( S60->screenDepth / 8 ) - * S60->screenWidthInPixels - * S60->screenHeightInPixels; - - S60->memoryLimitForHwRendering = memoryUsage - memoryForFullscreen; gs->setGraphicsSystem(QLatin1String("raster")); } } @@ -1975,8 +2026,7 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent if(QApplicationPrivate::runtime_graphics_system) { QRuntimeGraphicsSystem *gs = static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system); - gs->setGraphicsSystem(QLatin1String("openvg"), S60->memoryLimitForHwRendering); - S60->memoryLimitForHwRendering = 0; + gs->setGraphicsSystem(QLatin1String("openvg")); } #endif break; @@ -2276,6 +2326,14 @@ void QApplication::restoreOverrideCursor() #endif // QT_NO_CURSOR +void QApplicationPrivate::_q_aboutToQuit() +{ +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + // Send the shutdown tfx command + S60->wsSession().SendEffectCommand(ETfxCmdAppShutDown); +#endif +} + QS60ThreadLocalData::QS60ThreadLocalData() { CCoeEnv *env = CCoeEnv::Static(); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index ec26e81..0c48bfd 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -716,8 +716,10 @@ static void qt_set_windows_updateScrollBar(QWidget *widget) if (QWidget *w = static_cast<QWidget *>(o)) qt_set_windows_updateScrollBar(w); } +#ifndef QT_NO_SCROLLBAR if (qobject_cast<QScrollBar*>(widget)) widget->updateGeometry(); +#endif } @@ -1499,6 +1501,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa switch (message) { #ifndef Q_WS_WINCE +#ifndef QT_NO_SESSIONMANAGER case WM_QUERYENDSESSION: { if (sm_smActive) // bogus message from windows RETURN(true); @@ -1531,6 +1534,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa RETURN(0); } +#endif case WM_DISPLAYCHANGE: if (QApplication::type() == QApplication::Tty) break; @@ -2236,6 +2240,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa } break; +#ifndef QT_NO_CONTEXTMENU case WM_CONTEXTMENU: { // it's not VK_APPS or Shift+F10, but a click in the NC area @@ -2264,6 +2269,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa } break; #endif +#endif case WM_IME_STARTCOMPOSITION: case WM_IME_ENDCOMPOSITION: diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm index 8d65aa1..8d38f45 100644 --- a/src/gui/kernel/qcocoamenuloader_mac.mm +++ b/src/gui/kernel/qcocoamenuloader_mac.mm @@ -255,5 +255,10 @@ QT_USE_NAMESPACE qApp->quit(); } } + + - (void)orderFrontCharacterPalette:(id)sender + { + [NSApp orderFrontCharacterPalette:sender]; + } @end #endif // QT_MAC_USE_COCOA diff --git a/src/gui/kernel/qcocoamenuloader_mac_p.h b/src/gui/kernel/qcocoamenuloader_mac_p.h index a75ad0a..edacfa5 100644 --- a/src/gui/kernel/qcocoamenuloader_mac_p.h +++ b/src/gui/kernel/qcocoamenuloader_mac_p.h @@ -88,6 +88,7 @@ - (IBAction)hide:(id)sender; - (IBAction)qtDispatcherToQAction:(id)sender; - (void)qtUpdateMenubar; +- (void)orderFrontCharacterPalette:(id)sender; @end #endif // QT_MAC_USE_COCOA diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index bbc9e0b..eade02e 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4281,6 +4281,11 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T QGestureEvent::accept() for each of them, or an event filter consumes the event. + \section1 Further Reading + + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + \sa QGesture, QGestureRecognizer, QWidget::grabGesture(), QGraphicsObject::grabGesture() */ diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index e26fbde..89f01d8 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -785,7 +785,7 @@ void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions() // the stacking order of the windows while doing so, we put // up a block that is used in QCocoaWindow and QCocoaPanel: int stackSize = cocoaModalSessionStack.size(); - for (int i=stackSize-1; i>=0; --i) { + for (int i=0; i<stackSize; ++i) { QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; if (info.session) { [NSApp endModalSession:info.session]; @@ -822,12 +822,12 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession() QBoolBlocker block1(blockSendPostedEvents, true); info.nswindow = window; [(NSWindow*) info.nswindow retain]; - // When creating a modal session cocoa will rearrange the windows. - // In order to avoid windows to be put behind another we need to - // keep the window level. - int level = [window level]; + int levelBeforeEnterModal = [window level]; info.session = [NSApp beginModalSessionForWindow:window]; - [window setLevel:level]; + // Make sure we don't stack the window lower that it was before + // entering modal, in case it e.g. had the stays-on-top flag set: + if (levelBeforeEnterModal > [window level]) + [window setLevel:levelBeforeEnterModal]; } currentModalSessionCached = info.session; } diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 4a4452a..13274c4 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -59,6 +59,9 @@ QT_BEGIN_NAMESPACE the QGestureRecognizer object that is registered with the application; see QGestureRecognizer::registerRecognizer(). + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + \section1 Gesture Properties The class has a list of properties that can be queried by the user to get @@ -219,7 +222,10 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const \image pangesture.png - \sa {Gestures Programming}, QPinchGesture, QSwipeGesture + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + + \sa QPinchGesture, QSwipeGesture */ /*! @@ -314,6 +320,9 @@ void QPanGesture::setAcceleration(qreal value) them closer together or further apart to change the scale factor, zoom, or level of detail of the user interface. + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + \image pinchgesture.png Instead of repeatedly applying the same pinching gesture, the user may @@ -322,7 +331,7 @@ void QPanGesture::setAcceleration(qreal value) will continue to be delivered to the target object, containing an instance of QPinchGesture in the Qt::GestureUpdated state. - \sa {Gestures Programming}, QPanGesture, QSwipeGesture + \sa QPanGesture, QSwipeGesture */ /*! @@ -572,7 +581,10 @@ void QPinchGesture::setRotationAngle(qreal value) \image swipegesture.png - \sa {Gestures Programming}, QPanGesture, QPinchGesture + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + + \sa QPanGesture, QPinchGesture */ /*! @@ -667,7 +679,10 @@ void QSwipeGesture::setSwipeAngle(qreal value) \brief The QTapGesture class describes a tap gesture made by the user. \ingroup gestures - \sa {Gestures Programming}, QPanGesture, QPinchGesture + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + + \sa QPanGesture, QPinchGesture */ /*! @@ -700,7 +715,10 @@ void QTapGesture::setPosition(const QPointF &value) gesture made by the user. \ingroup gestures - \sa {Gestures Programming}, QPanGesture, QPinchGesture + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + + \sa QPanGesture, QPinchGesture */ /*! diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index fe9dd8a..e768a21 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -129,7 +129,12 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type) { QList<QGestureRecognizer *> list = m_recognizers.values(type); - m_recognizers.remove(type); + while (QGestureRecognizer *recognizer = m_recognizers.take(type)) { + if (!m_obsoleteGestures.contains(recognizer)) { + // inserting even an empty QSet will cause the recognizer to be deleted on destruction of the manager + m_obsoleteGestures.insert(recognizer, QSet<QGesture *>()); + } + } foreach (QGesture *g, m_gestureToRecognizer.keys()) { QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g); if (list.contains(recognizer)) { diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp index 3e23bbf..e0e7784 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -62,6 +62,9 @@ QT_BEGIN_NAMESPACE need to use this class directly. Instances will be created behind the scenes by the framework. + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + \section1 Recognizing Gestures The process of recognizing gestures involves filtering input events sent to specific diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 38ec806..55d5727 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -872,7 +872,7 @@ void QPalette::detach() \note The current ColorGroup is not taken into account when comparing palettes - \sa operator== + \sa operator==() */ /*! @@ -882,7 +882,7 @@ void QPalette::detach() \note The current ColorGroup is not taken into account when comparing palettes - \sa operator!= + \sa operator!=() */ bool QPalette::operator==(const QPalette &p) const { diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 3fc27f4..7d23abf 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -685,9 +685,11 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve unsigned int info = 0; if ([event type] == NSKeyDown) { NSString *characters = [event characters]; - unichar value = [characters characterAtIndex:0]; - qt_keymapper_private()->updateKeyMap(0, key_event, (void *)&value); - info = value; + if ([characters length]) { + unichar value = [characters characterAtIndex:0]; + qt_keymapper_private()->updateKeyMap(0, key_event, (void *)&value); + info = value; + } } // Redirect keys to alien widgets. @@ -1527,6 +1529,22 @@ void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window) [theWindow display]; } } + +void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *childWidget) +{ + if (!childWidget) + return; + + QWidget *parent = childWidget->parentWidget(); + if (childWidget->isWindow() && parent) { + if ([[qt_mac_window_for(parent) childWindows] containsObject:qt_mac_window_for(childWidget)]) { + QWidgetPrivate *d = qt_widget_private(childWidget); + d->setSubWindowStacking(false); + d->setSubWindowStacking(true); + } + } +} + #endif // QT_MAC_USE_COCOA QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 44fb4f0..c6c2db2 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -148,6 +148,7 @@ void qt_cocoaChangeOverrideCursor(const QCursor &cursor); // These methods exists only for supporting unified mode. void macDrawRectOnTop(void * /*OSWindowRef */ window); void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window); +void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *widget); #endif void qt_mac_menu_collapseSeparators(void * /*NSMenu */ menu, bool collapse); bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 7f0c99e..ad6a99a 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -141,7 +141,6 @@ public: int supportsPremultipliedAlpha : 1; int avkonComponentsSupportTransparency : 1; int menuBeingConstructed : 1; - int memoryLimitForHwRendering; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type enum ScanCodeState { @@ -165,6 +164,7 @@ public: static inline CEikButtonGroupContainer* buttonGroupContainer(); static void setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible); #endif + static void controlVisibilityChanged(CCoeControl *control, bool visible); #ifdef Q_OS_SYMBIAN TTrapHandler *s60InstalledTrapHandler; @@ -291,7 +291,6 @@ inline QS60Data::QS60Data() supportsPremultipliedAlpha(0), avkonComponentsSupportTransparency(0), menuBeingConstructed(0), - memoryLimitForHwRendering(0), s60ApplicationFactory(0) #ifdef Q_OS_SYMBIAN ,s60InstalledTrapHandler(0) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 9946d5d..7ea81bb 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -165,47 +165,76 @@ static inline bool hasBackingStoreSupport() extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp +/*! + \internal + \class QWidgetBackingStoreTracker + \brief Class which allows tracking of which widgets are using a given backing store -QRefCountedWidgetBackingStore::QRefCountedWidgetBackingStore() + QWidgetBackingStoreTracker is a thin wrapper around a QWidgetBackingStore pointer, + which maintains a list of the QWidgets which are currently using the backing + store. This list is modified via the registerWidget and unregisterWidget functions. + */ + +QWidgetBackingStoreTracker::QWidgetBackingStoreTracker() : m_ptr(0) - , m_count(0) { } -QRefCountedWidgetBackingStore::~QRefCountedWidgetBackingStore() +QWidgetBackingStoreTracker::~QWidgetBackingStoreTracker() { delete m_ptr; } -void QRefCountedWidgetBackingStore::create(QWidget *widget) +/*! + \internal + Destroy the contained QWidgetBackingStore, if not null, and clear the list of + widgets using the backing store, then create a new QWidgetBackingStore, providing + the QWidget. + */ +void QWidgetBackingStoreTracker::create(QWidget *widget) { destroy(); m_ptr = new QWidgetBackingStore(widget); - m_count = 0; } -void QRefCountedWidgetBackingStore::destroy() +/*! + \internal + Destroy the contained QWidgetBackingStore, if not null, and clear the list of + widgets using the backing store. + */ +void QWidgetBackingStoreTracker::destroy() { delete m_ptr; m_ptr = 0; - m_count = 0; + m_widgets.clear(); } -void QRefCountedWidgetBackingStore::ref() +/*! + \internal + Add the widget to the list of widgets currently using the backing store. + If the widget was already in the list, this function is a no-op. + */ +void QWidgetBackingStoreTracker::registerWidget(QWidget *w) { Q_ASSERT(m_ptr); - ++m_count; + Q_ASSERT(w->internalWinId()); + Q_ASSERT(qt_widget_private(w)->maybeBackingStore() == m_ptr); + m_widgets.insert(w); } -void QRefCountedWidgetBackingStore::deref() +/*! + \internal + Remove the widget from the list of widgets currently using the backing store. + If the widget was in the list, and removing it causes the list to be empty, + the backing store is deleted. + If the widget was not in the list, this function is a no-op. + */ +void QWidgetBackingStoreTracker::unregisterWidget(QWidget *w) { - if (m_count) { - Q_ASSERT(m_ptr); - if (0 == --m_count) { - delete m_ptr; - m_ptr = 0; - } + if (m_widgets.remove(w) && m_widgets.isEmpty()) { + delete m_ptr; + m_ptr = 0; } } diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 8ae6a99..1979c84 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2796,10 +2796,14 @@ void QWidgetPrivate::setSubWindowStacking(bool set) if (QWidget *parent = q->parentWidget()) { if (parent->testAttribute(Qt::WA_WState_Created)) { - if (set) - [qt_mac_window_for(parent) addChildWindow:qt_mac_window_for(q) ordered:NSWindowAbove]; - else + if (set) { + if (parent->isVisible()) { + NSWindow *childwin = qt_mac_window_for(q); + [qt_mac_window_for(parent) addChildWindow:childwin ordered:NSWindowAbove]; + } + } else { [qt_mac_window_for(parent) removeChildWindow:qt_mac_window_for(q)]; + } } } @@ -2807,10 +2811,12 @@ void QWidgetPrivate::setSubWindowStacking(bool set) for (int i=0; i<widgets.size(); ++i) { QWidget *child = widgets.at(i); if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) { - if (set) - [qt_mac_window_for(q) addChildWindow:qt_mac_window_for(child) ordered:NSWindowAbove]; - else + if (set) { + NSWindow *childwin = qt_mac_window_for(child); + [qt_mac_window_for(q) addChildWindow:childwin ordered:NSWindowAbove]; + } else { [qt_mac_window_for(q) removeChildWindow:qt_mac_window_for(child)]; + } } } } diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 3903124..de0d5e0 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -113,17 +113,18 @@ class QWidgetItemV2; class QStyle; -class Q_AUTOTEST_EXPORT QRefCountedWidgetBackingStore +class Q_AUTOTEST_EXPORT QWidgetBackingStoreTracker { + public: - QRefCountedWidgetBackingStore(); - ~QRefCountedWidgetBackingStore(); + QWidgetBackingStoreTracker(); + ~QWidgetBackingStoreTracker(); void create(QWidget *tlw); void destroy(); - void ref(); - void deref(); + void registerWidget(QWidget *w); + void unregisterWidget(QWidget *w); inline QWidgetBackingStore* data() { @@ -146,11 +147,11 @@ public: } private: - Q_DISABLE_COPY(QRefCountedWidgetBackingStore) + Q_DISABLE_COPY(QWidgetBackingStoreTracker) private: QWidgetBackingStore* m_ptr; - int m_count; + QSet<QWidget *> m_widgets; }; struct QTLWExtra { @@ -159,7 +160,7 @@ struct QTLWExtra { // Regular pointers (keep them together to avoid gaps on 64 bits architectures). QIcon *icon; // widget icon QPixmap *iconPixmap; - QRefCountedWidgetBackingStore backingStore; + QWidgetBackingStoreTracker backingStore; QWindowSurface *windowSurface; QPainter *sharedPainter; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 56349ad..319f330 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -684,6 +684,12 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) QSymbianControl *old_winid = static_cast<QSymbianControl *>(wasCreated ? data.winid : 0); if ((q->windowType() == Qt::Desktop)) old_winid = 0; + + // old_winid may not have received a 'not visible' visibility + // changed event before being destroyed; make sure that it is + // removed from the backing store's list of visible windows. + S60->controlVisibilityChanged(old_winid, false); + setWinId(0); // hide and reparent our own window away. Otherwise we might get diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 23f57da..59035b1 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -166,7 +166,7 @@ static void qt_tablet_init() qt_tablet_widget = new QWidget(0); qt_tablet_widget->createWinId(); qt_tablet_widget->setObjectName(QLatin1String("Qt internal tablet widget")); - // We dont need this internal widget to appear in QApplication::topLevelWidgets() + // We don't need this internal widget to appear in QApplication::topLevelWidgets() if (QWidgetPrivate::allWidgets) QWidgetPrivate::allWidgets->remove(qt_tablet_widget); LOGCONTEXT lcMine; @@ -1547,7 +1547,7 @@ bool QWidgetPrivate::shouldShowMaximizeButton() { if (data.window_flags & Qt::MSWindowsFixedSizeDialogHint) return false; - // if the user explicitely asked for the maximize button, we try to add + // if the user explicitly asked for the maximize button, we try to add // it even if the window has fixed size. if (data.window_flags & Qt::CustomizeWindowHint && data.window_flags & Qt::WindowMaximizeButtonHint) diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 92c4e84..1f76b6f 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -225,6 +225,7 @@ if(mmx|3dnow|sse|sse2|iwmmxt) { SSE3DNOW_SOURCES += painting/qdrawhelper_sse3dnow.cpp SSE_SOURCES += painting/qdrawhelper_sse.cpp SSE2_SOURCES += painting/qdrawhelper_sse2.cpp + SSSE3_SOURCES += painting/qdrawhelper_ssse3.cpp IWMMXT_SOURCES += painting/qdrawhelper_iwmmxt.cpp } @@ -259,23 +260,8 @@ symbian { QMAKE_CXXFLAGS.ARMCC *= -O3 } -neon:*-g++* { - DEFINES += QT_HAVE_NEON - HEADERS += painting/qdrawhelper_neon_p.h - SOURCES += painting/qdrawhelper_neon.cpp - QMAKE_CXXFLAGS *= -mfpu=neon - - DRAWHELPER_NEON_ASM_FILES = ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S - - neon_compiler.commands = $$QMAKE_CXX -c - neon_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} - neon_compiler.dependency_type = TYPE_C - neon_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} - neon_compiler.input = DRAWHELPER_NEON_ASM_FILES - neon_compiler.variable_out = OBJECTS - neon_compiler.name = compiling[neon] ${QMAKE_FILE_IN} - silent:neon_compiler.commands = @echo compiling[neon] ${QMAKE_FILE_IN} && $$neon_compiler.commands - QMAKE_EXTRA_COMPILERS += neon_compiler -} +NEON_SOURCES += painting/qdrawhelper_neon.cpp +NEON_HEADERS += painting/qdrawhelper_neon_p.h +NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S include($$PWD/../../3rdparty/zlib_dependency.pri) diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index a73d63f..dc7b808 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -371,7 +371,7 @@ void QWidgetBackingStore::beginPaint(QRegion &toClean, QWidget *widget, QWindowS // Always flush repainted areas. dirtyOnScreen += toClean; -#ifdef Q_WS_QWS +#if defined(Q_WS_QWS) && !defined(Q_BACKINGSTORE_SUBSURFACES) toClean.translate(tlwOffset); #endif @@ -1329,7 +1329,12 @@ void QWidgetBackingStore::sync() #ifdef Q_BACKINGSTORE_SUBSURFACES QWindowSurface *subSurface = w->windowSurface(); BeginPaintInfo beginPaintInfo; - beginPaint(toBePainted, w, subSurface, &beginPaintInfo, false); + + QPoint off = w->mapTo(tlw, QPoint()); + toBePainted.translate(off); + beginPaint(toBePainted, w, subSurface, &beginPaintInfo, true); + toBePainted.translate(-off); + if (beginPaintInfo.nothingToPaint) continue; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 4ce2bee..276da93 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7820,8 +7820,10 @@ void qInitDrawhelperAsm() uint const_alpha); extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha); extern void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha); + extern void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, uint const_alpha); functionForModeAsm[0] = comp_func_SourceOver_sse2; + functionForModeAsm[QPainter::CompositionMode_Source] = comp_func_Source_sse2; functionForModeAsm[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2; functionForModeSolidAsm[0] = comp_func_solid_SourceOver_sse2; @@ -7838,6 +7840,17 @@ void qInitDrawhelperAsm() qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; + +#if defined(QT_HAVE_SSSE3) + if (features & SSSE3) { + extern void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha); + qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; + } +#endif // QT_HAVE_SSSE3 } else #endif { diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 1a87127..d04c70d 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -314,18 +314,61 @@ struct QSpanData void adjustSpanMethods(); }; +#if defined(Q_CC_RVCT) +# pragma push +# pragma arm +#endif +Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { + uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; + t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; + t &= 0xff00ff; -Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) { - a += 1; - uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0; - t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f; - return t; + x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; + x = (x + ((x >> 8) & 0xff00ff) + 0x800080); + x &= 0xff00ff00; + x |= t; + return x; } +#if defined(Q_CC_RVCT) +# pragma pop +#endif -Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) { - uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0; - t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f; - return t; +#if QT_POINTER_SIZE == 8 // 64-bit versions + +Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { + quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; + t += (((quint64(y)) | ((quint64(y)) << 24)) & 0x00ff00ff00ff00ff) * b; + t >>= 8; + t &= 0x00ff00ff00ff00ff; + return (uint(t)) | (uint(t >> 24)); +} + +Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) { + quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; + t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8; + t &= 0x00ff00ff00ff00ff; + return (uint(t)) | (uint(t >> 24)); +} + +Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) { + uint a = x >> 24; + quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; + t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8; + t &= 0x000000ff00ff00ff; + return (uint(t)) | (uint(t >> 24)) | (a << 24); +} + +#else // 32-bit versions + +Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { + uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; + t >>= 8; + t &= 0xff00ff; + + x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; + x &= 0xff00ff00; + x |= t; + return x; } #if defined(Q_CC_RVCT) @@ -359,6 +402,21 @@ Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) { x |= t | (a << 24); return x; } +#endif + + +Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) { + a += 1; + uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0; + t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f; + return t; +} + +Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) { + uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0; + t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f; + return t; +} #define INV_PREMUL(p) \ (qAlpha(p) == 0 ? 0 : \ @@ -1847,70 +1905,6 @@ inline int qBlue565(quint16 rgb) { return (b << 3) | (b >> 2); } -#if 1 -Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { - uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; - t >>= 8; - t &= 0xff00ff; - - x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; - x &= 0xff00ff00; - x |= t; - return x; -} - -#if defined(Q_CC_RVCT) -# pragma push -# pragma arm -#endif -Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { - uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; - t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; - t &= 0xff00ff; - - x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; - x = (x + ((x >> 8) & 0xff00ff) + 0x800080); - x &= 0xff00ff00; - x |= t; - return x; -} -#if defined(Q_CC_RVCT) -# pragma pop -#endif -#else -// possible implementation for 64 bit -Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { - ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; - t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b; - t >>= 8; - t &= 0x00ff00ff00ff00ff; - return (uint(t)) | (uint(t >> 24)); -} - -Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { - ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; - t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b; - t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080); - t &= 0x00ff00ff00ff00ff; - return (uint(t)) | (uint(t >> 24)); -} - -Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) { - ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; - t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080); - t &= 0x00ff00ff00ff00ff; - return (uint(t)) | (uint(t >> 24)); -} - -Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) { - uint a = x >> 24; - ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; - t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080); - t &= 0x00ff00ff00ff00ff; - return (uint(t)) | (uint(t >> 24)) | 0xff000000; -} -#endif - const uint qt_bayer_matrix[16][16] = { { 0x1, 0xc0, 0x30, 0xf0, 0xc, 0xcc, 0x3c, 0xfc, 0x3, 0xc3, 0x33, 0xf3, 0xf, 0xcf, 0x3f, 0xff}, diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index e090ae5..22c0384 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -112,9 +112,7 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, int x = 0; // First, align dest to 16 bytes: - const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3; - const int prologLength = qMin(w, offsetToAlignOn16Bytes); - for (; x < prologLength; ++x) { + ALIGNMENT_PROLOGUE_16BYTES(dst, x, w) { quint32 s = src[x]; s = BYTE_MUL(s, const_alpha); dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha); @@ -182,12 +180,10 @@ inline int comp_func_Plus_one_pixel(uint d, const uint s) void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha) { int x = 0; - const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3; - const int prologLength = qMin(length, offsetToAlignOn16Bytes); if (const_alpha == 255) { // 1) Prologue: align destination on 16 bytes - for (; x < prologLength; ++x) + ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]); // 2) composition with SSE2 @@ -208,7 +204,7 @@ void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uin const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha); // 1) Prologue: align destination on 16 bytes - for (; x < prologLength; ++x) + ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha); const __m128i half = _mm_set1_epi16(0x80); @@ -229,6 +225,37 @@ void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uin } } +void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, uint const_alpha) +{ + if (const_alpha == 255) { + ::memcpy(dst, src, length * sizeof(uint)); + } else { + const int ialpha = 255 - const_alpha; + + int x = 0; + + // 1) prologue, align on 16 bytes + ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) + dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha); + + // 2) interpolate pixels with SSE2 + const __m128i half = _mm_set1_epi16(0x80); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); + const __m128i oneMinusConstAlpha = _mm_set1_epi16(ialpha); + for (; x < length - 3; x += 4) { + const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); + __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); + INTERPOLATE_PIXEL_255_SSE2(dstVector, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half) + _mm_store_si128((__m128i *)&dst[x], dstVector); + } + + // 3) Epilogue + for (; x < length; ++x) + dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha); + } +} + void qt_memfill32_sse2(quint32 *dest, quint32 value, int count) { if (count < 7) { diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp new file mode 100644 index 0000000..9c02009 --- /dev/null +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -0,0 +1,253 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifdef QT_HAVE_SSSE3 + +#include <private/qsimd_p.h> +#include <private/qdrawhelper_x86_p.h> +#include <private/qdrawingprimitive_sse2_p.h> + +QT_BEGIN_NAMESPACE + +inline static void blend_pixel(quint32 &dst, const quint32 src) +{ + if (src >= 0xff000000) + dst = src; + else if (src != 0) + dst = src + BYTE_MUL(dst, qAlpha(~src)); +} + + +/* The instruction palignr uses direct arguments, so we have to generate the code fo the different + shift (4, 8, 12). Checking the alignment inside the loop is unfortunatelly way too slow. + */ +#define BLENDING_LOOP(palignrOffset, length)\ + for (; x < length-3; x += 4) { \ + const __m128i srcVectorLastLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes + 4]);\ + const __m128i srcVector = _mm_alignr_epi8(srcVectorLastLoaded, srcVectorPrevLoaded, palignrOffset); \ + const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ + if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \ + _mm_store_si128((__m128i *)&dst[x], srcVector); \ + } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \ + __m128i alphaChannel = _mm_shuffle_epi8(srcVector, alphaShuffleMask); \ + alphaChannel = _mm_sub_epi16(one, alphaChannel); \ + const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \ + __m128i destMultipliedByOneMinusAlpha; \ + BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ + const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ + _mm_store_si128((__m128i *)&dst[x], result); \ + } \ + srcVectorPrevLoaded = srcVectorLastLoaded;\ + } + + +#define BLEND_SOURCE_OVER_ARGB32_FIRST_ROW_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \ + int x = 0; \ +\ + /* First, get dst aligned. */ \ + const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;\ + const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ +\ + for (; x < prologLength; ++x) {\ + blend_pixel(dst[x], src[x]); \ + } \ +\ + const int minusOffsetToAlignSrcOn16Bytes = (reinterpret_cast<quintptr>(&(src[x])) >> 2) & 0x3;\ +\ + if (!minusOffsetToAlignSrcOn16Bytes) {\ + /* src is aligned, usual algorithm but with aligned operations.\ + See the SSE2 version for more documentation on the algorithm itself. */\ + const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\ + for (; x < length-3; x += 4) { \ + const __m128i srcVector = _mm_load_si128((__m128i *)&src[x]); \ + const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ + if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \ + _mm_store_si128((__m128i *)&dst[x], srcVector); \ + } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \ + __m128i alphaChannel = _mm_shuffle_epi8(srcVector, alphaShuffleMask); \ + alphaChannel = _mm_sub_epi16(one, alphaChannel); \ + const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \ + __m128i destMultipliedByOneMinusAlpha; \ + BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ + const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ + _mm_store_si128((__m128i *)&dst[x], result); \ + } \ + } /* end for() */\ + } else if ((length - x) >= 8) {\ + /* We are at the first line, so "x - minusOffsetToAlignSrcOn16Bytes" could go before src, and\ + generate an invalid access. */\ +\ + /* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */\ + __m128i srcVectorPrevLoaded;\ + if (minusOffsetToAlignSrcOn16Bytes > prologLength) {\ + /* We go forward 4 pixels to avoid reading before src. */\ + for (; x < prologLength + 4; ++x)\ + blend_pixel(dst[x], src[x]); \ + }\ + srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\ + const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\ +\ + const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\ + switch (palignrOffset) {\ + case 4:\ + BLENDING_LOOP(4, length)\ + break;\ + case 8:\ + BLENDING_LOOP(8, length)\ + break;\ + case 12:\ + BLENDING_LOOP(12, length)\ + break;\ + }\ + }\ + for (; x < length; ++x) \ + blend_pixel(dst[x], src[x]); \ +} + +// Basically blend src over dst with the const alpha defined as constAlphaVector. +// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as: +//const __m128i nullVector = _mm_set1_epi32(0); +//const __m128i half = _mm_set1_epi16(0x80); +//const __m128i one = _mm_set1_epi16(0xff); +//const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); +//const __m128i alphaMask = _mm_set1_epi32(0xff000000); +// +// The computation being done is: +// result = s + d * (1-alpha) +// with shortcuts if fully opaque or fully transparent. +#define BLEND_SOURCE_OVER_ARGB32_MAIN_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \ + int x = 0; \ +\ + /* First, get dst aligned. */ \ + ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \ + blend_pixel(dst[x], src[x]); \ + } \ +\ + const int minusOffsetToAlignSrcOn16Bytes = (reinterpret_cast<quintptr>(&(src[x])) >> 2) & 0x3;\ +\ + if (!minusOffsetToAlignSrcOn16Bytes) {\ + /* src is aligned, usual algorithm but with aligned operations.\ + See the SSE2 version for more documentation on the algorithm itself. */\ + const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\ + for (; x < length-3; x += 4) { \ + const __m128i srcVector = _mm_load_si128((__m128i *)&src[x]); \ + const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ + if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \ + _mm_store_si128((__m128i *)&dst[x], srcVector); \ + } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \ + __m128i alphaChannel = _mm_shuffle_epi8(srcVector, alphaShuffleMask); \ + alphaChannel = _mm_sub_epi16(one, alphaChannel); \ + const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \ + __m128i destMultipliedByOneMinusAlpha; \ + BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ + const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ + _mm_store_si128((__m128i *)&dst[x], result); \ + } \ + } /* end for() */\ + } else if ((length - x) >= 8) {\ + /* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */\ + __m128i srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\ + const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\ +\ + const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\ + switch (palignrOffset) {\ + case 4:\ + BLENDING_LOOP(4, length)\ + break;\ + case 8:\ + BLENDING_LOOP(8, length)\ + break;\ + case 12:\ + BLENDING_LOOP(12, length)\ + break;\ + }\ + }\ + for (; x < length; ++x) \ + blend_pixel(dst[x], src[x]); \ +} + +void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ + const quint32 *src = (const quint32 *) srcPixels; + quint32 *dst = (quint32 *) destPixels; + if (const_alpha == 256) { + const __m128i alphaMask = _mm_set1_epi32(0xff000000); + const __m128i nullVector = _mm_setzero_si128(); + const __m128i half = _mm_set1_epi16(0x80); + const __m128i one = _mm_set1_epi16(0xff); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + + // We have to unrol the first row in order to deal with the load on unaligned data + // prior to the src pointer. + BLEND_SOURCE_OVER_ARGB32_FIRST_ROW_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask); + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + + for (int y = 1; y < h; ++y) { + BLEND_SOURCE_OVER_ARGB32_MAIN_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask); + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else if (const_alpha != 0) { + // dest = (s + d * sia) * ca + d * cia + // = s * ca + d * (sia * ca + cia) + // = s * ca + d * (1 - sa*ca) + const_alpha = (const_alpha * 255) >> 8; + const __m128i nullVector = _mm_setzero_si128(); + const __m128i half = _mm_set1_epi16(0x80); + const __m128i one = _mm_set1_epi16(0xff); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); + for (int y = 0; y < h; ++y) { + BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, w, nullVector, half, one, colorMask, constAlphaVector) + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } +} + +QT_END_NAMESPACE + +#endif // QT_HAVE_SSSE3 diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h index 18355c2..d8f6bf5 100644 --- a/src/gui/painting/qdrawingprimitive_sse2_p.h +++ b/src/gui/painting/qdrawingprimitive_sse2_p.h @@ -143,9 +143,7 @@ QT_BEGIN_NAMESPACE int x = 0; \ \ /* First, get dst aligned. */ \ - const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;\ - const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ - for (; x < prologLength; ++x) { \ + ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \ uint s = src[x]; \ if (s >= 0xff000000) \ dst[x] = s; \ @@ -202,9 +200,7 @@ QT_BEGIN_NAMESPACE { \ int x = 0; \ \ - const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;\ - const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ - for (; x < prologLength; ++x) { \ + ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \ quint32 s = src[x]; \ if (s != 0) { \ s = BYTE_MUL(s, const_alpha); \ diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 3438137..2828e9d 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -53,10 +53,8 @@ QT_BEGIN_NAMESPACE static int qt_pixmap_serial = 0; #define READBACK(f) \ - m_graphicsSystem->decreaseMemoryUsage(memoryUsage()); \ f \ - readBackInfo(); \ - m_graphicsSystem->increaseMemoryUsage(memoryUsage()); \ + readBackInfo(); class QDeferredGraphicsSystemChange : public QObject @@ -252,16 +250,8 @@ QPixmapData* QRuntimePixmapData::runtimeData() const return m_data; } -uint QRuntimePixmapData::memoryUsage() const -{ - if(is_null || d == 0) - return 0; - return w * h * (d / 8); -} - - QRuntimeWindowSurface::QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, QWidget *window) - : QWindowSurface(window), m_windowSurface(0), m_pendingWindowSurface(0), m_graphicsSystem(gs) + : QWindowSurface(window), m_graphicsSystem(gs) { } @@ -269,7 +259,6 @@ QRuntimeWindowSurface::QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, Q QRuntimeWindowSurface::~QRuntimeWindowSurface() { m_graphicsSystem->removeWindowSurface(this); - delete m_windowSurface; } QPaintDevice *QRuntimeWindowSurface::paintDevice() @@ -288,16 +277,13 @@ void QRuntimeWindowSurface::flush(QWidget *widget, const QRegion ®ion, #ifdef QT_DEBUG qDebug() << "QRuntimeWindowSurface::flush() - destroy pending window surface"; #endif - delete m_pendingWindowSurface; - m_pendingWindowSurface = 0; + m_pendingWindowSurface.reset(); } } void QRuntimeWindowSurface::setGeometry(const QRect &rect) { - m_graphicsSystem->decreaseMemoryUsage(memoryUsage()); m_windowSurface->setGeometry(rect); - m_graphicsSystem->increaseMemoryUsage(memoryUsage()); } bool QRuntimeWindowSurface::scroll(const QRegion &area, int dx, int dy) @@ -330,27 +316,21 @@ QPoint QRuntimeWindowSurface::offset(const QWidget *widget) const return m_windowSurface->offset(widget); } -uint QRuntimeWindowSurface::memoryUsage() const -{ - QPaintDevice *pdev = m_windowSurface->paintDevice(); - if (pdev && pdev->depth() != 0) - return pdev->width() * pdev->height() * (pdev->depth()/8); - - return 0; -} - QRuntimeGraphicsSystem::QRuntimeGraphicsSystem() - : m_memoryUsage(0), m_windowSurfaceDestroyPolicy(DestroyImmediately), - m_graphicsSystem(0), m_graphicsSystemChangeMemoryLimit(0) + : m_windowSurfaceDestroyPolicy(DestroyImmediately), + m_graphicsSystem(0) { QApplicationPrivate::graphics_system_name = QLatin1String("runtime"); QApplicationPrivate::runtime_graphics_system = true; +#ifdef QT_DEFAULT_RUNTIME_SYSTEM + m_graphicsSystemName = QLatin1String(QT_DEFAULT_RUNTIME_SYSTEM); + if (m_graphicsSystemName.isNull()) +#endif + m_graphicsSystemName = QLatin1String("raster"); + #ifdef Q_OS_SYMBIAN - m_graphicsSystemName = QLatin1String("openvg"); m_windowSurfaceDestroyPolicy = DestroyAfterFirstFlush; -#else - m_graphicsSystemName = QLatin1String("raster"); #endif m_graphicsSystem = QGraphicsSystemFactory::create(m_graphicsSystemName); @@ -373,51 +353,30 @@ QWindowSurface *QRuntimeGraphicsSystem::createWindowSurface(QWidget *widget) con { Q_ASSERT(m_graphicsSystem); QRuntimeWindowSurface *rtSurface = new QRuntimeWindowSurface(this, widget); - rtSurface->m_windowSurface = m_graphicsSystem->createWindowSurface(widget); + rtSurface->m_windowSurface.reset(m_graphicsSystem->createWindowSurface(widget)); widget->setWindowSurface(rtSurface); m_windowSurfaces << rtSurface; - increaseMemoryUsage(rtSurface->memoryUsage()); return rtSurface; } -/*! - Sets graphics system when resource memory consumption is under /a memoryUsageLimit. -*/ -void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name, uint memoryUsageLimit) -{ -#ifdef QT_DEBUG - qDebug() << "QRuntimeGraphicsSystem::setGraphicsSystem( "<< name <<", " << memoryUsageLimit << ")"; - qDebug() << " current approximated graphics system memory usage " << memoryUsage() << " bytes"; -#endif - if (memoryUsage() >= memoryUsageLimit) { - m_graphicsSystemChangeMemoryLimit = memoryUsageLimit; - m_pendingGraphicsSystemName = name; - } else { - setGraphicsSystem(name); - } -} - void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name) { if (m_graphicsSystemName == name) return; #ifdef QT_DEBUG qDebug() << "QRuntimeGraphicsSystem::setGraphicsSystem( " << name << " )"; - qDebug() << " current approximated graphics system memory usage "<< memoryUsage() << " bytes"; #endif - delete m_graphicsSystem; + QGraphicsSystem *oldSystem = m_graphicsSystem; m_graphicsSystem = QGraphicsSystemFactory::create(name); m_graphicsSystemName = name; Q_ASSERT(m_graphicsSystem); - m_graphicsSystemChangeMemoryLimit = 0; m_pendingGraphicsSystemName = QString(); for (int i = 0; i < m_pixmapDatas.size(); ++i) { QRuntimePixmapData *proxy = m_pixmapDatas.at(i); QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data); - // ### TODO Optimize. Openvg and s60raster graphics systems could switch internal ARGB32_PRE QImage buffers. newData->fromImage(proxy->m_data->toImage(), Qt::NoOpaqueDetection); delete proxy->m_data; proxy->m_data = newData; @@ -428,58 +387,26 @@ void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name) QRuntimeWindowSurface *proxy = m_windowSurfaces.at(i); QWidget *widget = proxy->m_windowSurface->window(); - if(m_windowSurfaceDestroyPolicy == DestroyImmediately) { - delete proxy->m_windowSurface; - proxy->m_pendingWindowSurface = 0; - } else { - proxy->m_pendingWindowSurface = proxy->m_windowSurface; - } + if(m_windowSurfaceDestroyPolicy == DestroyAfterFirstFlush) + proxy->m_pendingWindowSurface.reset(proxy->m_windowSurface.take()); - proxy->m_windowSurface = m_graphicsSystem->createWindowSurface(widget); + proxy->m_windowSurface.reset(m_graphicsSystem->createWindowSurface(widget)); qt_widget_private(widget)->invalidateBuffer(widget->rect()); } + + delete oldSystem; } void QRuntimeGraphicsSystem::removePixmapData(QRuntimePixmapData *pixmapData) const { int index = m_pixmapDatas.lastIndexOf(pixmapData); m_pixmapDatas.removeAt(index); - decreaseMemoryUsage(pixmapData->memoryUsage(), true); } void QRuntimeGraphicsSystem::removeWindowSurface(QRuntimeWindowSurface *windowSurface) const { int index = m_windowSurfaces.lastIndexOf(windowSurface); m_windowSurfaces.removeAt(index); - decreaseMemoryUsage(windowSurface->memoryUsage(), true); -} - -void QRuntimeGraphicsSystem::increaseMemoryUsage(uint amount) const -{ - m_memoryUsage += amount; - - if (m_graphicsSystemChangeMemoryLimit && - m_memoryUsage < m_graphicsSystemChangeMemoryLimit) { - - QRuntimeGraphicsSystem *gs = const_cast<QRuntimeGraphicsSystem*>(this); - QDeferredGraphicsSystemChange *deferredChange = - new QDeferredGraphicsSystemChange(gs, m_pendingGraphicsSystemName); - deferredChange->launch(); - } -} - -void QRuntimeGraphicsSystem::decreaseMemoryUsage(uint amount, bool persistent) const -{ - m_memoryUsage -= amount; - - if (persistent && m_graphicsSystemChangeMemoryLimit && - m_memoryUsage < m_graphicsSystemChangeMemoryLimit) { - - QRuntimeGraphicsSystem *gs = const_cast<QRuntimeGraphicsSystem*>(this); - QDeferredGraphicsSystemChange *deferredChange = - new QDeferredGraphicsSystemChange(gs, m_pendingGraphicsSystemName); - deferredChange->launch(); - } } #include "qgraphicssystem_runtime.moc" diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h index 7aab89c..0232241 100644 --- a/src/gui/painting/qgraphicssystem_runtime_p.h +++ b/src/gui/painting/qgraphicssystem_runtime_p.h @@ -104,8 +104,6 @@ public: virtual QPixmapData *runtimeData() const; - virtual uint memoryUsage() const; - private: const QRuntimeGraphicsSystem *m_graphicsSystem; @@ -131,10 +129,8 @@ public: virtual QPoint offset(const QWidget *widget) const; - virtual uint memoryUsage() const; - - QWindowSurface *m_windowSurface; - QWindowSurface *m_pendingWindowSurface; + QScopedPointer<QWindowSurface> m_windowSurface; + QScopedPointer<QWindowSurface> m_pendingWindowSurface; private: const QRuntimeGraphicsSystem *m_graphicsSystem; @@ -159,7 +155,6 @@ public: void removePixmapData(QRuntimePixmapData *pixmapData) const; void removeWindowSurface(QRuntimeWindowSurface *windowSurface) const; - void setGraphicsSystem(const QString &name, uint memoryUsageLimit); void setGraphicsSystem(const QString &name); QString graphicsSystemName() const { return m_graphicsSystemName; } @@ -170,22 +165,14 @@ public: int windowSurfaceDestroyPolicy() const { return m_windowSurfaceDestroyPolicy; } - uint memoryUsage() const { return m_memoryUsage; } - -private: - - void increaseMemoryUsage(uint amount) const; - void decreaseMemoryUsage(uint amount, bool persistent = false) const; private: - mutable uint m_memoryUsage; int m_windowSurfaceDestroyPolicy; QGraphicsSystem *m_graphicsSystem; mutable QList<QRuntimePixmapData *> m_pixmapDatas; mutable QList<QRuntimeWindowSurface *> m_windowSurfaces; QString m_graphicsSystemName; - uint m_graphicsSystemChangeMemoryLimit; QString m_pendingGraphicsSystemName; friend class QRuntimePixmapData; diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 5e7c67a..94039fb 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -956,53 +956,49 @@ const QT_FT_Vector* control2, const QT_FT_Vector* to ) { - TPos dx, dy, da, db; int top, level; int* levels; QT_FT_Vector* arc; + int mid_x = ( DOWNSCALE( ras.x ) + to->x + + 3 * (control1->x + control2->x ) ) / 8; + int mid_y = ( DOWNSCALE( ras.y ) + to->y + + 3 * (control1->y + control2->y ) ) / 8; + TPos dx = DOWNSCALE( ras.x ) + to->x - ( mid_x << 1 ); + TPos dy = DOWNSCALE( ras.y ) + to->y - ( mid_y << 1 ); - dx = DOWNSCALE( ras.x ) + to->x - ( control1->x << 1 ); if ( dx < 0 ) dx = -dx; - dy = DOWNSCALE( ras.y ) + to->y - ( control1->y << 1 ); if ( dy < 0 ) dy = -dy; if ( dx < dy ) dx = dy; - da = dx; - - dx = DOWNSCALE( ras.x ) + to->x - 3 * ( control1->x + control2->x ); - if ( dx < 0 ) - dx = -dx; - dy = DOWNSCALE( ras.y ) + to->y - 3 * ( control1->x + control2->y ); - if ( dy < 0 ) - dy = -dy; - if ( dx < dy ) - dx = dy; - db = dx; level = 1; - da = da / ras.cubic_level; - db = db / ras.conic_level; - while ( da > 0 || db > 0 ) + dx /= ras.cubic_level; + while ( dx > 0 ) { - da >>= 2; - db >>= 3; + dx >>= 2; level++; } if ( level <= 1 ) { - TPos to_x, to_y, mid_x, mid_y; + TPos to_x, to_y; to_x = UPSCALE( to->x ); to_y = UPSCALE( to->y ); + + /* Recalculation of midpoint is needed only if */ + /* UPSCALE and DOWNSCALE have any effect. */ + +#if ( PIXEL_BITS != 6 ) mid_x = ( ras.x + to_x + 3 * UPSCALE( control1->x + control2->x ) ) / 8; mid_y = ( ras.y + to_y + 3 * UPSCALE( control1->y + control2->y ) ) / 8; +#endif gray_render_line( RAS_VAR_ mid_x, mid_y ); gray_render_line( RAS_VAR_ to_x, to_y ); @@ -1359,10 +1355,6 @@ /* <Input> */ /* outline :: A pointer to the source target. */ /* */ - /* func_interface :: A table of `emitters', i.e,. function pointers */ - /* called during decomposition to indicate path */ - /* operations. */ - /* */ /* user :: A typeless pointer which is passed to each */ /* emitter during the decomposition. It can be */ /* used to store the state during the */ @@ -1373,15 +1365,10 @@ /* */ static int QT_FT_Outline_Decompose( const QT_FT_Outline* outline, - const QT_FT_Outline_Funcs* func_interface, void* user ) { #undef SCALED -#if 0 -#define SCALED( x ) ( ( (x) << shift ) - delta ) -#else #define SCALED( x ) (x) -#endif QT_FT_Vector v_last; QT_FT_Vector v_control; @@ -1396,12 +1383,6 @@ int error; char tag; /* current point's state */ -#if 0 - int shift = func_interface->shift; - TPos delta = func_interface->delta; -#endif - - first = 0; for ( n = 0; n < outline->n_contours; n++ ) @@ -1455,7 +1436,7 @@ tags--; } - error = func_interface->move_to( &v_start, user ); + error = gray_move_to( &v_start, user ); if ( error ) goto Exit; @@ -1475,7 +1456,7 @@ vec.x = SCALED( point->x ); vec.y = SCALED( point->y ); - error = func_interface->line_to( &vec, user ); + error = gray_line_to( &vec, user ); if ( error ) goto Exit; continue; @@ -1502,7 +1483,7 @@ if ( tag == QT_FT_CURVE_TAG_ON ) { - error = func_interface->conic_to( &v_control, &vec, + error = gray_conic_to( &v_control, &vec, user ); if ( error ) goto Exit; @@ -1515,7 +1496,7 @@ v_middle.x = ( v_control.x + vec.x ) / 2; v_middle.y = ( v_control.y + vec.y ) / 2; - error = func_interface->conic_to( &v_control, &v_middle, + error = gray_conic_to( &v_control, &v_middle, user ); if ( error ) goto Exit; @@ -1524,7 +1505,7 @@ goto Do_Conic; } - error = func_interface->conic_to( &v_control, &v_start, + error = gray_conic_to( &v_control, &v_start, user ); goto Close; } @@ -1555,20 +1536,20 @@ vec.x = SCALED( point->x ); vec.y = SCALED( point->y ); - error = func_interface->cubic_to( &vec1, &vec2, &vec, user ); + error = gray_cubic_to( &vec1, &vec2, &vec, user ); if ( error ) goto Exit; continue; } - error = func_interface->cubic_to( &vec1, &vec2, &v_start, user ); + error = gray_cubic_to( &vec1, &vec2, &v_start, user ); goto Close; } } } /* close the contour with a line segment */ - error = func_interface->line_to( &v_start, user ); + error = gray_line_to( &v_start, user ); Close: if ( error ) @@ -1596,22 +1577,11 @@ static int gray_convert_glyph_inner( RAS_ARG ) { - static - const QT_FT_Outline_Funcs func_interface = - { - (QT_FT_Outline_MoveTo_Func) gray_move_to, - (QT_FT_Outline_LineTo_Func) gray_line_to, - (QT_FT_Outline_ConicTo_Func)gray_conic_to, - (QT_FT_Outline_CubicTo_Func)gray_cubic_to, - 0, - 0 - }; - volatile int error = 0; if ( qt_ft_setjmp( ras.jump_buffer ) == 0 ) { - error = QT_FT_Outline_Decompose( &ras.outline, &func_interface, &ras ); + error = QT_FT_Outline_Decompose( &ras.outline, &ras ); gray_record_cell( RAS_VAR ); } else diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index e521e01..fecf25f 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -696,10 +696,11 @@ void QX11PaintEngine::drawLines(const QLine *lines, int lineCount) linef = d->matrix.map(QLineF(lines[i])); } if (clipLine(&linef, d->polygonClipper.boundingRect())) { - int x1 = qFloor(linef.x1() + aliasedCoordinateDelta); - int y1 = qFloor(linef.y1() + aliasedCoordinateDelta); - int x2 = qFloor(linef.x2() + aliasedCoordinateDelta); - int y2 = qFloor(linef.y2() + aliasedCoordinateDelta); + int x1 = qRound(linef.x1() + aliasedCoordinateDelta); + int y1 = qRound(linef.y1() + aliasedCoordinateDelta); + int x2 = qRound(linef.x2() + aliasedCoordinateDelta); + int y2 = qRound(linef.y2() + aliasedCoordinateDelta); + XDrawLine(d->dpy, d->hd, d->gc, x1, y1, x2, y2); } } @@ -729,10 +730,11 @@ void QX11PaintEngine::drawLines(const QLineF *lines, int lineCount) for (int i = 0; i < lineCount; ++i) { QLineF linef = d->matrix.map(lines[i]); if (clipLine(&linef, d->polygonClipper.boundingRect())) { - int x1 = qFloor(linef.x1() + aliasedCoordinateDelta); - int y1 = qFloor(linef.y1() + aliasedCoordinateDelta); - int x2 = qFloor(linef.x2() + aliasedCoordinateDelta); - int y2 = qFloor(linef.y2() + aliasedCoordinateDelta); + int x1 = qRound(linef.x1() + aliasedCoordinateDelta); + int y1 = qRound(linef.y1() + aliasedCoordinateDelta); + int x2 = qRound(linef.x2() + aliasedCoordinateDelta); + int y2 = qRound(linef.y2() + aliasedCoordinateDelta); + XDrawLine(d->dpy, d->hd, d->gc, x1, y1, x2, y2); } } @@ -1688,8 +1690,8 @@ void QX11PaintEnginePrivate::strokePolygon_dev(const QPointF *polygonPoints, int if (clippedCount > 0) { QVarLengthArray<XPoint> xpoints(clippedCount); for (int i = 0; i < clippedCount; ++i) { - xpoints[i].x = qFloor(clippedPoints[i].x + aliasedCoordinateDelta); - xpoints[i].y = qFloor(clippedPoints[i].y + aliasedCoordinateDelta); + xpoints[i].x = qRound(clippedPoints[i].x + aliasedCoordinateDelta); + xpoints[i].y = qRound(clippedPoints[i].y + aliasedCoordinateDelta); } uint numberPoints = qMin(clippedCount, xlibMaxLinePoints); XPoint *pts = xpoints.data(); @@ -1914,6 +1916,8 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect int sh = qRound(sr.height()); QPixmap pixmap = qt_toX11Pixmap(px); + if(pixmap.isNull()) + return; if ((d->xinfo && d->xinfo->screen() != pixmap.x11Info().screen()) || (pixmap.x11Info().screen() != DefaultScreen(X11->display))) { diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index e0746fb..881bd6e 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -831,7 +831,7 @@ void QPaintEngineEx::drawEllipse(const QRectF &r) int point_count = 0; x.points[0] = qt_curves_for_arc(r, 0, -360, x.points + 1, &point_count); - QVectorPath vp((qreal *) pts, 13, qpaintengineex_ellipse_types, QVectorPath::EllipseHint); + QVectorPath vp((qreal *) pts, point_count, qpaintengineex_ellipse_types, QVectorPath::EllipseHint); draw(vp); } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 9dadbd5..b694d9c 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -90,6 +90,15 @@ void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QTextOption *option, const QString& str, QRectF *brect, int tabstops, int* tabarray, int tabarraylen, QPainter *painter); +static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QFontEngine *fe, + QTextCharFormat::UnderlineStyle underlineStyle, + const QTextItem::RenderFlags flags, qreal width, + const QTextCharFormat &charFormat); +// Helper function to calculate left most position, width and flags for decoration drawing +static void drawDecorationForGlyphs(QPainter *painter, const glyph_t *glyphArray, + const QFixedPoint *positions, int glyphCount, + QFontEngine *fontEngine, const QFont &font, + const QTextCharFormat &charFormat); static inline QGradient::CoordinateMode coordinateMode(const QBrush &brush) { @@ -5923,6 +5932,10 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText currentColor = item->color; } d->extended->drawStaticTextItem(item); + + drawDecorationForGlyphs(this, item->glyphs, item->glyphPositions, + item->numGlyphs, item->fontEngine, staticText_d->font, + QTextCharFormat()); } if (currentColor != oldPen.color()) setPen(oldPen); @@ -6290,15 +6303,15 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen) return pixmap; } -static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QTextItemInt &ti) +static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QFontEngine *fe, + QTextCharFormat::UnderlineStyle underlineStyle, + const QTextItem::RenderFlags flags, qreal width, + const QTextCharFormat &charFormat) { - QTextCharFormat::UnderlineStyle underlineStyle = ti.underlineStyle; if (underlineStyle == QTextCharFormat::NoUnderline - && !(ti.flags & (QTextItem::StrikeOut | QTextItem::Overline))) + && !(flags & (QTextItem::StrikeOut | QTextItem::Overline))) return; - QFontEngine *fe = ti.fontEngine; - const QPen oldPen = painter->pen(); const QBrush oldBrush = painter->brush(); painter->setBrush(Qt::NoBrush); @@ -6307,7 +6320,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const pen.setWidthF(fe->lineThickness().toReal()); pen.setCapStyle(Qt::FlatCap); - QLineF line(pos.x(), pos.y(), pos.x() + ti.width.toReal(), pos.y()); + QLineF line(pos.x(), pos.y(), pos.x() + width, pos.y()); const qreal underlineOffset = fe->underlinePosition().toReal(); // deliberately ceil the offset to avoid the underline coming too close to @@ -6322,21 +6335,21 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const painter->save(); painter->translate(0, pos.y() + 1); - QColor uc = ti.charFormat.underlineColor(); + QColor uc = charFormat.underlineColor(); if (uc.isValid()) pen.setColor(uc); // Adapt wave to underlineOffset or pen width, whatever is larger, to make it work on all platforms const QPixmap wave = generateWavyPixmap(qMax(underlineOffset, pen.widthF()), pen); - const int descent = (int) ti.descent.toReal(); + const int descent = (int) fe->descent().toReal(); painter->setBrushOrigin(painter->brushOrigin().x(), 0); - painter->fillRect(pos.x(), 0, qCeil(ti.width.toReal()), qMin(wave.height(), descent), wave); + painter->fillRect(pos.x(), 0, qCeil(width), qMin(wave.height(), descent), wave); painter->restore(); } else if (underlineStyle != QTextCharFormat::NoUnderline) { QLineF underLine(line.x1(), underlinePos, line.x2(), underlinePos); - QColor uc = ti.charFormat.underlineColor(); + QColor uc = charFormat.underlineColor(); if (uc.isValid()) pen.setColor(uc); @@ -6348,14 +6361,14 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const pen.setStyle(Qt::SolidLine); pen.setColor(oldPen.color()); - if (ti.flags & QTextItem::StrikeOut) { + if (flags & QTextItem::StrikeOut) { QLineF strikeOutLine = line; strikeOutLine.translate(0., - fe->ascent().toReal() / 3.); painter->setPen(pen); painter->drawLine(strikeOutLine); } - if (ti.flags & QTextItem::Overline) { + if (flags & QTextItem::Overline) { QLineF overLine = line; overLine.translate(0., - fe->ascent().toReal()); painter->setPen(pen); @@ -6366,6 +6379,50 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const painter->setBrush(oldBrush); } +static void drawDecorationForGlyphs(QPainter *painter, const glyph_t *glyphArray, + const QFixedPoint *positions, int glyphCount, + QFontEngine *fontEngine, const QFont &font, + const QTextCharFormat &charFormat) +{ + if (!(font.underline() || font.strikeOut() || font.overline())) + return; + + QFixed leftMost; + QFixed rightMost; + QFixed baseLine; + for (int i=0; i<glyphCount; ++i) { + glyph_metrics_t gm = fontEngine->boundingBox(glyphArray[i]); + if (i == 0 || leftMost > positions[i].x) + leftMost = positions[i].x; + + // We don't support glyphs that do not share a common baseline. If this turns out to + // be a relevant use case, then we need to find clusters of glyphs that share a baseline + // and do a drawTextItemDecorations call per cluster. + if (i == 0 || baseLine < positions[i].y) + baseLine = positions[i].y; + + // We use the advance rather than the actual bounds to match the algorithm in drawText() + if (i == 0 || rightMost < positions[i].x + gm.xoff) + rightMost = positions[i].x + gm.xoff; + } + + QFixed width = rightMost - leftMost; + QTextItem::RenderFlags flags = 0; + + if (font.underline()) + flags |= QTextItem::Underline; + if (font.overline()) + flags |= QTextItem::Overline; + if (font.strikeOut()) + flags |= QTextItem::StrikeOut; + + drawTextItemDecoration(painter, QPointF(leftMost.toReal(), baseLine.toReal()), + fontEngine, + font.underline() ? QTextCharFormat::SingleUnderline + : QTextCharFormat::NoUnderline, flags, + width.toReal(), charFormat); +} + void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti) { #ifdef QT_DEBUG_DRAW @@ -6496,7 +6553,8 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti) else d->engine->drawTextItem(p, ti); } - drawTextItemDecoration(this, p, ti); + drawTextItemDecoration(this, p, ti.fontEngine, ti.underlineStyle, ti.flags, ti.width.toReal(), + ti.charFormat); if (d->state->renderHints != oldRenderHints) { d->state->renderHints = oldRenderHints; diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index a816ed2..170668b 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -882,7 +882,11 @@ void QWSMemorySurface::beginPaint(const QRegion &rgn) const QVector<QRect> rects = rgn.rects(); const QColor blank = Qt::transparent; for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { - p.fillRect(*it, blank); + QRect r = *it; +#ifdef Q_BACKINGSTORE_SUBSURFACES + r.translate(painterOffset()); +#endif + p.fillRect(r, blank); } } QWSWindowSurface::beginPaint(rgn); diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 477bd93..8bac1f5 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -67,10 +67,14 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) TDisplayMode mode = S60->screenDevice()->DisplayMode(); bool isOpaque = qt_widget_private(widget)->isOpaque; - if (mode == EColor16MA && isOpaque) - mode = EColor16MU; // Faster since 16MU -> 16MA is typically accelerated - else if (mode == EColor16MU && !isOpaque) - mode = EColor16MA; // Try for transparency anyway + if (isOpaque) { + mode = EColor16MU; + } else { + if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_3) + mode = Q_SYMBIAN_ECOLOR16MAP; // Symbian^3 WServ has support for ARGB32_PRE + else + mode = EColor16MA; // Symbian prior to Symbian^3 sw accelerates EColor16MA + } // We create empty CFbsBitmap here -> it will be resized in setGeometry CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index 0f9367e..5d4c54e 100644 --- a/src/gui/s60framework/qs60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -136,16 +136,25 @@ TFileName QS60MainApplication::ResourceFileName() const return KNullDesC(); } +/*! + \internal +*/ void QS60MainApplication::PreDocConstructL() { QS60MainApplicationBase::PreDocConstructL(); } +/*! + \internal +*/ CDictionaryStore *QS60MainApplication::OpenIniFileLC(RFs &aFs) const { return QS60MainApplicationBase::OpenIniFileLC(aFs); } +/*! + \internal +*/ void QS60MainApplication::NewAppServerL(CApaAppServer *&aAppServer) { QS60MainApplicationBase::NewAppServerL(aAppServer); diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 40c2d03..ea9dbb3 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -281,76 +281,121 @@ void QS60MainAppUi::RestoreMenuL(CCoeControl *menuWindow, TInt resourceId, TMenu } } +/*! + \internal +*/ void QS60MainAppUi::Exit() { QS60MainAppUiBase::Exit(); } +/*! + \internal +*/ void QS60MainAppUi::SetFadedL(TBool aFaded) { QS60MainAppUiBase::SetFadedL(aFaded); } +/*! + \internal +*/ TRect QS60MainAppUi::ApplicationRect() const { return QS60MainAppUiBase::ApplicationRect(); } +/*! + \internal +*/ void QS60MainAppUi::HandleScreenDeviceChangedL() { QS60MainAppUiBase::HandleScreenDeviceChangedL(); } +/*! + \internal +*/ void QS60MainAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent) { QS60MainAppUiBase::HandleApplicationSpecificEventL(aType, aEvent); } +/*! + \internal +*/ TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(TTypeUid aId) { return QS60MainAppUiBase::MopSupplyObject(aId); } +/*! + \internal +*/ void QS60MainAppUi::ProcessCommandL(TInt aCommand) { QS60MainAppUiBase::ProcessCommandL(aCommand); } +/*! + \internal +*/ TErrorHandlerResponse QS60MainAppUi::HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText) { return QS60MainAppUiBase::HandleError(aError, aExtErr, aErrorText, aContextText); } +/*! + \internal +*/ void QS60MainAppUi::HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId) { QS60MainAppUiBase::HandleViewDeactivation(aViewIdToBeDeactivated, aNewlyActivatedViewId); } +/*! + \internal +*/ void QS60MainAppUi::PrepareToExit() { QS60MainAppUiBase::PrepareToExit(); } +/*! + \internal +*/ void QS60MainAppUi::HandleTouchPaneSizeChange() { QS60MainAppUiBase::HandleTouchPaneSizeChange(); } +/*! + \internal +*/ void QS60MainAppUi::HandleSystemEventL(const TWsEvent &aEvent) { QS60MainAppUiBase::HandleSystemEventL(aEvent); } +/*! + \internal +*/ void QS60MainAppUi::Reserved_MtsmPosition() { QS60MainAppUiBase::Reserved_MtsmPosition(); } +/*! + \internal +*/ void QS60MainAppUi::Reserved_MtsmObject() { QS60MainAppUiBase::Reserved_MtsmObject(); } +/*! + \internal +*/ void QS60MainAppUi::HandleForegroundEventL(TBool aForeground) { QS60MainAppUiBase::HandleForegroundEventL(aForeground); diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp index ed33a41..26e2d00 100644 --- a/src/gui/s60framework/qs60maindocument.cpp +++ b/src/gui/s60framework/qs60maindocument.cpp @@ -105,11 +105,17 @@ CEikAppUi *QS60MainDocument::CreateAppUiL() return (static_cast <CEikAppUi*>(new(ELeave)QS60MainAppUi)); } +/*! + \internal + */ CFileStore *QS60MainDocument::OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs) { return QS60MainDocumentBase::OpenFileL(aDoOpen, aFilename, aFs); } +/*! + \internal + */ void QS60MainDocument::OpenFileL(CFileStore *&aFileStore, RFile &aFile) { QS60MainDocumentBase::OpenFileL(aFileStore, aFile); diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h index 2f0564f..fc32d8b 100644 --- a/src/gui/s60framework/qs60maindocument.h +++ b/src/gui/s60framework/qs60maindocument.h @@ -47,7 +47,7 @@ #ifdef Q_OS_SYMBIAN #ifdef Q_WS_S60 -#include <akndoc.h> +#include <AknDoc.h> typedef CAknDocument QS60MainDocumentBase; #else #include <eikdoc.h> diff --git a/src/gui/styles/qmacstyle_mac.h b/src/gui/styles/qmacstyle_mac.h index bcebb1d..d5fcdae 100644 --- a/src/gui/styles/qmacstyle_mac.h +++ b/src/gui/styles/qmacstyle_mac.h @@ -60,6 +60,8 @@ class QPalette; #define Q_GUI_EXPORT_STYLE_MAC Q_GUI_EXPORT #endif +class QPushButton; +class QStyleOptionButton; class QMacStylePrivate; class Q_GUI_EXPORT_STYLE_MAC QMacStyle : public QWindowsStyle { @@ -133,6 +135,8 @@ private: Q_DISABLE_COPY(QMacStyle) QMacStylePrivate *d; + + friend bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); }; #endif // Q_WS_MAC diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index d18383c..671a888 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -1059,6 +1059,16 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn, } } +bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option) +{ + QMacStyle *macStyle = qobject_cast<QMacStyle *>(pushButton->style()); + if (!macStyle) + return false; + HIThemeButtonDrawInfo bdi; + macStyle->d->initHIThemePushButton(option, pushButton, kThemeStateActive, &bdi); + return bdi.kind == kThemeBevelButton; +} + /** Creates a HIThemeButtonDrawInfo structure that specifies the correct button kind and other details to use for drawing the given combobox. Which button @@ -1430,6 +1440,9 @@ QMacStylePrivate::QMacStylePrivate(QMacStyle *style) bool QMacStylePrivate::animatable(QMacStylePrivate::Animates as, const QWidget *w) const { + if (!w) + return false; + if (as == AquaPushButton) { QPushButton *pb = const_cast<QPushButton *>(static_cast<const QPushButton *>(w)); if (w->window()->isActiveWindow() && pb && !mouseDown) { diff --git a/src/gui/styles/qmacstyle_mac_p.h b/src/gui/styles/qmacstyle_mac_p.h index 5a0ba4c..f9b9d30 100644 --- a/src/gui/styles/qmacstyle_mac_p.h +++ b/src/gui/styles/qmacstyle_mac_p.h @@ -150,6 +150,8 @@ enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2 return sizes[controlSize]; \ } while (0) +bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); + class QMacStylePrivate : public QObject { Q_OBJECT diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 2527662..f44b85e 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -58,12 +58,12 @@ #include <AknsSkinInstance.h> #include <AknsBasicBackgroundControlContext.h> #include <avkon.mbg> -#include <aknfontaccess.h> -#include <aknlayoutfont.h> +#include <AknFontAccess.h> +#include <AknLayoutFont.h> #include <AknUtils.h> #include <aknnavi.h> #include <gulicon.h> -#include <aknbitmapanimation.h> +#include <AknBitmapAnimation.h> #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN) diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp index 687e587..0a75492 100644 --- a/src/gui/styles/qstyle.cpp +++ b/src/gui/styles/qstyle.cpp @@ -325,7 +325,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C control over size of header items and row and column sizes. \sa QStyleOption, QStylePainter, {Styles Example}, - {Styles & Style Aware Widgets}, QStyledItemDelegate + {Styles and Style Aware Widgets}, QStyledItemDelegate */ /*! diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index dff525e..92e2c81 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -4094,7 +4094,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q if (pe1 != PseudoElement_None) { QRenderRule subRule = renderRule(w, opt, pe1); if (subRule.bg != 0 || subRule.hasDrawable()) { - //We test subRule.bg dirrectly because hasBackground() would return false for background:none. + //We test subRule.bg directly because hasBackground() would return false for background:none. //But we still don't want the default drawning in that case (example for QScrollBar::add-page) (task 198926) subRule.drawRule(p, opt->rect); } else if (fallback) { diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index deaad57..91b6082 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -349,11 +349,32 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay int *nglyphs, QTextEngine::ShaperFlags flags) const { *nglyphs = len; + QCFType<CFStringRef> cfstring; + QVarLengthArray<CGGlyph> cgGlyphs(len); CTFontGetGlyphsForCharacters(ctfont, (const UniChar*)str, cgGlyphs.data(), len); - for (int i = 0; i < len; ++i) - glyphs->glyphs[i] = cgGlyphs[i]; + for (int i = 0; i < len; ++i) { + if (cgGlyphs[i]) { + glyphs->glyphs[i] = cgGlyphs[i]; + } else { + if (!cfstring) + cfstring = CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar *>(str), len, kCFAllocatorNull); + QCFType<CTFontRef> substituteFont = CTFontCreateForString(ctfont, cfstring, CFRangeMake(i, 1)); + CGGlyph substituteGlyph = 0; + CTFontGetGlyphsForCharacters(substituteFont, (const UniChar*)str + i, &substituteGlyph, 1); + if (substituteGlyph) { + const uint fontIndex = (fontIndexForFont(substituteFont) << 24); + glyphs->glyphs[i] = substituteGlyph | fontIndex; + if (!(flags & QTextEngine::GlyphIndicesOnly)) { + CGSize advance; + CTFontGetAdvancesForGlyphs(substituteFont, kCTFontHorizontalOrientation, &substituteGlyph, &advance, 1); + glyphs->advances_x[i] = QFixed::fromReal(advance.width); + glyphs->advances_y[i] = QFixed::fromReal(advance.height); + } + } + } + } if (flags & QTextEngine::GlyphIndicesOnly) return true; @@ -362,9 +383,14 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay CTFontGetAdvancesForGlyphs(ctfont, kCTFontHorizontalOrientation, cgGlyphs.data(), advances.data(), len); for (int i = 0; i < len; ++i) { + if (glyphs->glyphs[i] & 0xff000000) + continue; glyphs->advances_x[i] = QFixed::fromReal(advances[i].width); glyphs->advances_y[i] = QFixed::fromReal(advances[i].height); - if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) { + } + + if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) { + for (int i = 0; i < len; ++i) { glyphs->advances_x[i] = glyphs->advances_x[i].round(); glyphs->advances_y[i] = glyphs->advances_y[i].round(); } diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 7396bcd..21c2e02 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -109,10 +109,18 @@ QT_BEGIN_NAMESPACE QPainter::drawStaticText() and can change from call to call with a minimal impact on performance. - QStaticText will attempt to guess the format of the input text using Qt::mightBeRichText(). - To force QStaticText to display its contents as either plain text or rich text, use the - function QStaticText::setTextFormat() and pass in, respectively, Qt::PlainText and - Qt::RichText. + For extra convenience, it is possible to apply formatting to the text using the HTML subset + supported by QTextDocument. QStaticText will attempt to guess the format of the input text using + Qt::mightBeRichText(), and interpret it as rich text if this function returns true. To force + QStaticText to display its contents as either plain text or rich text, use the function + QStaticText::setTextFormat() and pass in, respectively, Qt::PlainText and Qt::RichText. + + QStaticText can only represent text, so only HTML tags which alter the layout or appearance of + the text will be respected. Adding an image to the input HTML, for instance, will cause the + image to be included as part of the layout, affecting the positions of the text glyphs, but it + will not be displayed. The result will be an empty area the size of the image in the output. + Similarly, using tables will cause the text to be laid out in table format, but the borders + will not be drawn. If it's the first time the static text is drawn, or if the static text, or the painter's font has been altered since the last time it was drawn, the text's layout has to be diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 439f2a4..5670e29 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -923,6 +923,13 @@ void QTextEngine::shapeText(int item) const si.width += glyphs.advances_x[i]; } +static inline bool hasCaseChange(const QScriptItem &si) +{ + return si.analysis.flags == QScriptAnalysis::SmallCaps || + si.analysis.flags == QScriptAnalysis::Uppercase || + si.analysis.flags == QScriptAnalysis::Lowercase; +} + #if defined(Q_WS_WINCE) //TODO // set the glyph attributes heuristically. Assumes a 1 to 1 relationship between chars and glyphs // and no reordering. @@ -1050,14 +1057,15 @@ void QTextEngine::shapeTextWithCE(int item) const if (option.useDesignMetrics()) flags |= DesignMetrics; - attributes(); // pre-initialize char attributes + // pre-initialize char attributes + if (! attributes()) + return; const int len = length(item); int num_glyphs = length(item); const QChar *str = layoutData->string.unicode() + si.position; ushort upperCased[256]; - if (si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase - || si.analysis.flags == QScriptAnalysis::Lowercase) { + if (hasCaseChange(si)) { ushort *uc = upperCased; if (len > 256) uc = new ushort[len]; @@ -1071,7 +1079,14 @@ void QTextEngine::shapeTextWithCE(int item) const } while (true) { - ensureSpace(num_glyphs); + if (! ensureSpace(num_glyphs)) { + // If str is converted to uppercase/lowercase form with a new buffer, + // we need to delete that buffer before return for error + const ushort *uc = reinterpret_cast<const ushort *>(str); + if (hasCaseChange(si) && uc != upperCased) + delete [] uc; + return; + } num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; QGlyphLayout g = availableGlyphs(&si); @@ -1092,9 +1107,7 @@ void QTextEngine::shapeTextWithCE(int item) const layoutData->used += si.num_glyphs; const ushort *uc = reinterpret_cast<const ushort *>(str); - if ((si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase - || si.analysis.flags == QScriptAnalysis::Lowercase) - && uc != upperCased) + if (hasCaseChange(si) && uc != upperCased) delete [] uc; } #endif @@ -1133,8 +1146,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const entire_shaper_item.item.bidiLevel = si.analysis.bidiLevel; HB_UChar16 upperCased[256]; // XXX what about making this 4096, so we don't have to extend it ever. - if (si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase - || si.analysis.flags == QScriptAnalysis::Lowercase) { + if (hasCaseChange(si)) { HB_UChar16 *uc = upperCased; if (entire_shaper_item.item.length > 256) uc = new HB_UChar16[entire_shaper_item.item.length]; @@ -1156,17 +1168,24 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const entire_shaper_item.shaperFlags |= HB_ShaperFlag_UseDesignMetrics; entire_shaper_item.num_glyphs = qMax(layoutData->glyphLayout.numGlyphs - layoutData->used, int(entire_shaper_item.item.length)); - ensureSpace(entire_shaper_item.num_glyphs); + if (! ensureSpace(entire_shaper_item.num_glyphs)) { + if (hasCaseChange(si)) + delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string); + return; + } QGlyphLayout initialGlyphs = availableGlyphs(&si).mid(0, entire_shaper_item.num_glyphs); if (!stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)) { - ensureSpace(entire_shaper_item.num_glyphs); + if (! ensureSpace(entire_shaper_item.num_glyphs)) { + if (hasCaseChange(si)) + delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string); + return; + } initialGlyphs = availableGlyphs(&si).mid(0, entire_shaper_item.num_glyphs); if (!stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)) { // ############ if this happens there's a bug in the fontengine - if ((si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase - || si.analysis.flags == QScriptAnalysis::Lowercase) && entire_shaper_item.string != upperCased) + if (hasCaseChange(si) && entire_shaper_item.string != upperCased) delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string); return; } @@ -1231,7 +1250,11 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const remaining_glyphs -= shaper_item.initialGlyphCount; do { - ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs); + if (! ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs)) { + if (hasCaseChange(si)) + delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string); + return; + } const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos); moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); @@ -1271,8 +1294,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const layoutData->used += si.num_glyphs; - if ((si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase) - && entire_shaper_item.string != upperCased) + if (hasCaseChange(si) && entire_shaper_item.string != upperCased) delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string); } @@ -1317,7 +1339,8 @@ const HB_CharAttributes *QTextEngine::attributes() const return (HB_CharAttributes *) layoutData->memory; itemize(); - ensureSpace(layoutData->string.length()); + if (! ensureSpace(layoutData->string.length())) + return NULL; QVarLengthArray<HB_ScriptItem> hbScriptItems(layoutData->items.size()); @@ -1864,7 +1887,10 @@ void QTextEngine::justify(const QScriptLine &line) // don't include trailing white spaces when doing justification int line_length = line.length; - const HB_CharAttributes *a = attributes()+line.from; + const HB_CharAttributes *a = attributes(); + if (! a) + return; + a += line.from; while (line_length && a[line_length-1].whiteSpace) --line_length; // subtract one char more, as we can't justfy after the last character @@ -2045,7 +2071,7 @@ QTextEngine::LayoutData::LayoutData() memory_on_stack = false; used = 0; hasBidi = false; - inLayout = false; + layoutState = LayoutEmpty; haveCharAttributes = false; logClustersPtr = 0; available_glyphs = 0; @@ -2079,7 +2105,7 @@ QTextEngine::LayoutData::LayoutData(const QString &str, void **stack_memory, int } used = 0; hasBidi = false; - inLayout = false; + layoutState = LayoutEmpty; haveCharAttributes = false; } @@ -2090,12 +2116,12 @@ QTextEngine::LayoutData::~LayoutData() memory = 0; } -void QTextEngine::LayoutData::reallocate(int totalGlyphs) +bool QTextEngine::LayoutData::reallocate(int totalGlyphs) { Q_ASSERT(totalGlyphs >= glyphLayout.numGlyphs); if (memory_on_stack && available_glyphs >= totalGlyphs) { glyphLayout.grow(glyphLayout.data(), totalGlyphs); - return; + return true; } int space_charAttributes = sizeof(HB_CharAttributes)*string.length()/sizeof(void*) + 1; @@ -2103,7 +2129,14 @@ void QTextEngine::LayoutData::reallocate(int totalGlyphs) int space_glyphs = QGlyphLayout::spaceNeededForGlyphLayout(totalGlyphs)/sizeof(void*) + 2; int newAllocated = space_charAttributes + space_glyphs + space_logClusters; - Q_ASSERT(newAllocated >= allocated); + // These values can be negative if the length of string/glyphs causes overflow, + // we can't layout such a long string all at once, so return false here to + // indicate there is a failure + if (space_charAttributes < 0 || space_logClusters < 0 || space_glyphs < 0 || newAllocated < allocated) { + layoutState = LayoutFailed; + return false; + } + void **newMem = memory; newMem = (void **)::realloc(memory_on_stack ? 0 : memory, newAllocated*sizeof(void *)); Q_CHECK_PTR(newMem); @@ -2124,6 +2157,7 @@ void QTextEngine::LayoutData::reallocate(int totalGlyphs) glyphLayout.grow(reinterpret_cast<char *>(m), totalGlyphs); allocated = newAllocated; + return true; } // grow to the new size, copying the existing data to the new layout @@ -2155,7 +2189,7 @@ void QTextEngine::freeMemory() } else { layoutData->used = 0; layoutData->hasBidi = false; - layoutData->inLayout = false; + layoutData->layoutState = LayoutEmpty; layoutData->haveCharAttributes = false; } for (int i = 0; i < lines.size(); ++i) { @@ -2314,6 +2348,9 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int shape(i); HB_CharAttributes *attributes = const_cast<HB_CharAttributes *>(this->attributes()); + if (!attributes) + return QString(); + unsigned short *logClusters = this->logClusters(&si); QGlyphLayout glyphs = shapedGlyphs(&si); @@ -2385,6 +2422,8 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int return QString(); const HB_CharAttributes *attributes = this->attributes(); + if (!attributes) + return QString(); if (mode == Qt::ElideRight) { QFixed currentWidth; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index e623fa5..4cbe81f 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -416,6 +416,11 @@ class QTextFormatCollection; class Q_GUI_EXPORT QTextEngine { public: + enum LayoutState { + LayoutEmpty, + InLayout, + LayoutFailed, + }; struct LayoutData { LayoutData(const QString &str, void **stack_memory, int mem_size); LayoutData(); @@ -428,11 +433,11 @@ public: QGlyphLayout glyphLayout; mutable int used; uint hasBidi : 1; - uint inLayout : 1; + uint layoutState : 2; uint memory_on_stack : 1; bool haveCharAttributes; QString string; - void reallocate(int totalGlyphs); + bool reallocate(int totalGlyphs); }; QTextEngine(LayoutData *data); @@ -520,9 +525,10 @@ public: return layoutData->glyphLayout.mid(si->glyph_data_offset, si->num_glyphs); } - inline void ensureSpace(int nGlyphs) const { + inline bool ensureSpace(int nGlyphs) const { if (layoutData->glyphLayout.numGlyphs - layoutData->used < nGlyphs) - layoutData->reallocate((((layoutData->used + nGlyphs)*3/2 + 15) >> 4) << 4); + return layoutData->reallocate((((layoutData->used + nGlyphs)*3/2 + 15) >> 4) << 4); + return true; } void freeMemory(); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 674064e..7d5fa43 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -74,6 +74,8 @@ static inline QFixed leadingSpaceWidth(QTextEngine *eng, const QScriptLine &line int pos = line.length; const HB_CharAttributes *attributes = eng->attributes(); + if (!attributes) + return QFixed(); while (pos > 0 && attributes[line.from + pos - 1].whiteSpace) --pos; return eng->width(line.from + pos, line.length - pos); @@ -601,7 +603,7 @@ bool QTextLayout::cacheEnabled() const void QTextLayout::beginLayout() { #ifndef QT_NO_DEBUG - if (d->layoutData && d->layoutData->inLayout) { + if (d->layoutData && d->layoutData->layoutState == QTextEngine::InLayout) { qWarning("QTextLayout::beginLayout: Called while already doing layout"); return; } @@ -609,7 +611,7 @@ void QTextLayout::beginLayout() d->invalidate(); d->clearLineData(); d->itemize(); - d->layoutData->inLayout = true; + d->layoutData->layoutState = QTextEngine::InLayout; } /*! @@ -618,7 +620,7 @@ void QTextLayout::beginLayout() void QTextLayout::endLayout() { #ifndef QT_NO_DEBUG - if (!d->layoutData || !d->layoutData->inLayout) { + if (!d->layoutData || d->layoutData->layoutState == QTextEngine::LayoutEmpty) { qWarning("QTextLayout::endLayout: Called without beginLayout()"); return; } @@ -627,7 +629,7 @@ void QTextLayout::endLayout() if (l && d->lines.at(l-1).length < 0) { QTextLine(l-1, d).setNumColumns(INT_MAX); } - d->layoutData->inLayout = false; + d->layoutData->layoutState = QTextEngine::LayoutEmpty; if (!d->cacheGlyphs) d->freeMemory(); } @@ -757,11 +759,14 @@ bool QTextLayout::isValidCursorPosition(int pos) const QTextLine QTextLayout::createLine() { #ifndef QT_NO_DEBUG - if (!d->layoutData || !d->layoutData->inLayout) { + if (!d->layoutData || d->layoutData->layoutState == QTextEngine::LayoutEmpty) { qWarning("QTextLayout::createLine: Called without layouting"); return QTextLine(); } #endif + if (d->layoutData->layoutState == QTextEngine::LayoutFailed) + return QTextLine(); + int l = d->lines.size(); if (l && d->lines.at(l-1).length < 0) { QTextLine(l-1, d).setNumColumns(INT_MAX); @@ -1704,14 +1709,18 @@ namespace { return glyphs.glyphs[logClusters[currentPosition - 1]]; } + inline void adjustRightBearing(glyph_t glyph) + { + qreal rb; + fontEngine->getGlyphBearings(glyph, 0, &rb); + rightBearing = qMin(QFixed(), QFixed::fromReal(rb)); + } + inline void adjustRightBearing() { if (currentPosition <= 0) return; - - qreal rb; - fontEngine->getGlyphBearings(currentGlyph(), 0, &rb); - rightBearing = qMin(QFixed(), QFixed::fromReal(rb)); + adjustRightBearing(currentGlyph()); } inline void resetRightBearing() @@ -1801,6 +1810,8 @@ void QTextLine::layout_helper(int maxGlyphs) Qt::Alignment alignment = eng->option.alignment(); const HB_CharAttributes *attributes = eng->attributes(); + if (!attributes) + return; lbh.currentPosition = line.from; int end = 0; lbh.logClusters = eng->layoutData->logClustersPtr; @@ -1814,6 +1825,8 @@ void QTextLine::layout_helper(int maxGlyphs) if (!current.num_glyphs) { eng->shape(item); attributes = eng->attributes(); + if (!attributes) + return; lbh.logClusters = eng->layoutData->logClustersPtr; } lbh.currentPosition = qMax(line.from, current.position); @@ -1892,6 +1905,9 @@ void QTextLine::layout_helper(int maxGlyphs) } else { lbh.whiteSpaceOrObject = false; bool sb_or_ws = false; + glyph_t previousGlyph = 0; + if (lbh.currentPosition > 0 && lbh.logClusters[lbh.currentPosition - 1] <lbh.glyphs.numGlyphs) + previousGlyph = lbh.currentGlyph(); // needed to calculate right bearing later do { addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, current, lbh.logClusters, lbh.glyphs); @@ -1935,9 +1951,17 @@ void QTextLine::layout_helper(int maxGlyphs) // We ignore the right bearing if the minimum negative bearing is too little to // expand the text beyond the edge. if (sb_or_ws|breakany) { + QFixed rightBearing = lbh.rightBearing; // store previous right bearing +#if !defined(Q_WS_MAC) if (lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width) +#endif lbh.adjustRightBearing(); if (lbh.checkFullOtherwiseExtend(line)) { + // we are too wide, fix right bearing + if (rightBearing <= 0) + lbh.rightBearing = rightBearing; // take from cache + else if (previousGlyph > 0) + lbh.adjustRightBearing(previousGlyph); if (!breakany) { line.textWidth += lbh.softHyphenWidth; } diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 5fb3384..d25fb05 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -1156,6 +1156,10 @@ Qt::LayoutDirection QTextBlock::textDirection() const if (dir != Qt::LayoutDirectionAuto) return dir; + dir = p->defaultTextOption.textDirection(); + if (dir != Qt::LayoutDirectionAuto) + return dir; + const QString buffer = p->buffer(); const int pos = position(); diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index 04d6de9..e718212 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -921,10 +921,12 @@ void QCompleterPrivate::showPopup(const QRect& rect) void QCompleterPrivate::_q_fileSystemModelDirectoryLoaded(const QString &path) { Q_Q(QCompleter); +#ifndef QT_NO_LINEEDIT QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget); //the path given by QFileSystemModel does not end with / if (lineEdit && !lineEdit->text().isEmpty() && !q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/')) q->complete(); +#endif } /*! diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm index ce85919..15fae23 100644 --- a/src/gui/widgets/qcocoamenu_mac.mm +++ b/src/gui/widgets/qcocoamenu_mac.mm @@ -188,6 +188,18 @@ QT_USE_NAMESPACE return NO; } +- (NSInteger)indexOfItemWithTarget:(id)anObject andAction:(SEL)actionSelector +{ + NSInteger index = [super indexOfItemWithTarget:anObject andAction:actionSelector]; + static SEL selForOFCP = NSSelectorFromString(@"orderFrontCharacterPalette:"); + if (index == -1 && selForOFCP == actionSelector) { + // Check if the 'orderFrontCharacterPalette' SEL exists for QCocoaMenuLoader object + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)]; + return [super indexOfItemWithTarget:loader andAction:actionSelector]; + } + return index; +} + @end QT_BEGIN_NAMESPACE diff --git a/src/gui/widgets/qcocoamenu_mac_p.h b/src/gui/widgets/qcocoamenu_mac_p.h index d6ac8c5..1a42642 100644 --- a/src/gui/widgets/qcocoamenu_mac_p.h +++ b/src/gui/widgets/qcocoamenu_mac_p.h @@ -76,6 +76,7 @@ QT_FORWARD_DECLARE_CLASS(QAction) } - (id)initWithQMenu:(QMenu*)menu; - (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action; +- (NSInteger)indexOfItemWithTarget:(id)anObject andAction:(SEL)actionSelector; @end #endif diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index dcc328f..917a325 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -910,7 +910,7 @@ QComboBox::QComboBox(bool rw, QWidget *parent, const char *name) interaction. The highlighted() signal is emitted when the user highlights an item in the combobox popup list. All three signals exist in two versions, one with a QString argument and one with an - \c int argument. If the user selectes or highlights a pixmap, only + \c int argument. If the user selects or highlights a pixmap, only the \c int signals are emitted. Whenever the text of an editable combobox is changed the editTextChanged() signal is emitted. diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp index d3b5869..a6f5f7d 100644 --- a/src/gui/widgets/qcommandlinkbutton.cpp +++ b/src/gui/widgets/qcommandlinkbutton.cpp @@ -349,7 +349,7 @@ void QCommandLinkButton::paintEvent(QPaintEvent *) QStyleOptionButton option; initStyleOption(&option); - //Enable command link appearence on Vista + //Enable command link appearance on Vista option.features |= QStyleOptionButton::CommandLinkButton; option.text = QString(); option.icon = QIcon(); //we draw this ourselves diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index 50fa9c9..7a61dc7 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -754,6 +754,7 @@ QCalendarWidget *QDateTimeEdit::calendarWidget() const Sets the given \a calendarWidget as the widget to be used for the calendar pop-up. The editor does not automatically take ownership of the calendar widget. + \note calendarPopup must be set to true before setting the calendar widget. \sa calendarPopup */ void QDateTimeEdit::setCalendarWidget(QCalendarWidget *calendarWidget) diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 593e391..62ee398 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -943,7 +943,7 @@ void QMainWindowLayout::toggleToolBarsVisible() #ifdef Q_WS_MAC if (layoutState.mainWindow->unifiedTitleAndToolBarOnMac()) { // If we hit this case, someone has pressed the "toolbar button" which will - // toggle the unified toolbar visiblity, because that's what the user wants. + // toggle the unified toolbar visibility, because that's what the user wants. // We might be in a situation where someone has hidden all the toolbars // beforehand (maybe in construction), but now they've hit this button and // and are expecting the items to show. What do we do? diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 7941c4e..4bea6de 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -262,7 +262,7 @@ void QMenuPrivate::updateActionRects() const const int deskFw = style->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, &opt, q); const int tearoffHeight = tearoff ? style->pixelMetric(QStyle::PM_MenuTearoffHeight, &opt, q) : 0; - //for compatability now - will have to refactor this away.. + //for compatibility now - will have to refactor this away tabWidth = 0; maxIconWidth = 0; hasCheckableItems = false; @@ -1154,7 +1154,7 @@ void QMenuPrivate::_q_actionHovered() bool QMenuPrivate::hasMouseMoved(const QPoint &globalPos) { - //determines if the mouse has moved (ie its intial position has + //determines if the mouse has moved (ie its initial position has //changed by more than QApplication::startDragDistance() //or if there were at least 6 mouse motions) return motions > 6 || diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index e8e80b7..df16f7f 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -102,7 +102,7 @@ void QMenuBarExtension::paintEvent(QPaintEvent *) QStylePainter p(this); QStyleOptionToolButton opt; initStyleOption(&opt); - // We do not need to draw both extention arrows + // We do not need to draw both extension arrows opt.features &= ~QStyleOptionToolButton::HasMenu; p.drawComplexControl(QStyle::CC_ToolButton, opt); } diff --git a/src/gui/widgets/qprintpreviewwidget.cpp b/src/gui/widgets/qprintpreviewwidget.cpp index 45b15ef..ea311d3 100644 --- a/src/gui/widgets/qprintpreviewwidget.cpp +++ b/src/gui/widgets/qprintpreviewwidget.cpp @@ -469,7 +469,7 @@ void QPrintPreviewWidgetPrivate::setZoomFactor(qreal _zoomFactor) \o Create the QPrintPreviewWidget Construct the QPrintPreviewWidget either by passing in an - exisiting QPrinter object, or have QPrintPreviewWidget create a + existing QPrinter object, or have QPrintPreviewWidget create a default constructed QPrinter object for you. \o Connect the paintRequested() signal to a slot. diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp index 8a18ed0..237c266 100644 --- a/src/gui/widgets/qpushbutton.cpp +++ b/src/gui/widgets/qpushbutton.cpp @@ -687,11 +687,11 @@ bool QPushButton::event(QEvent *e) /*! \reimp */ bool QPushButton::hitButton(const QPoint &pos) const { - // This is only required if we are using the native style, so check that first. - QMacStyle *macStyle = qobject_cast<QMacStyle *>(style()); - // If this is a flat button we just bail out. - if(isFlat() || (0 == macStyle)) + QStyleOptionButton opt; + initStyleOption(&opt); + if (qt_mac_buttonIsRenderedFlat(this, &opt)) return QAbstractButton::hitButton(pos); + // Now that we know we are using the native style, let's proceed. Q_D(const QPushButton); QPushButtonPrivate *nonConst = const_cast<QPushButtonPrivate *>(d); diff --git a/src/gui/widgets/qtoolbarextension.cpp b/src/gui/widgets/qtoolbarextension.cpp index 032c6f0..574a775 100644 --- a/src/gui/widgets/qtoolbarextension.cpp +++ b/src/gui/widgets/qtoolbarextension.cpp @@ -75,7 +75,7 @@ void QToolBarExtension::paintEvent(QPaintEvent *) QStylePainter p(this); QStyleOptionToolButton opt; initStyleOption(&opt); - // We do not need to draw both extention arrows + // We do not need to draw both extension arrows opt.features &= ~QStyleOptionToolButton::HasMenu; p.drawComplexControl(QStyle::CC_ToolButton, opt); } diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp index 2f4d1df..6c38911 100644 --- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp @@ -94,6 +94,7 @@ public: /*! \qmlclass FolderListModel QDeclarativeFolderListModel + \ingroup qml-working-with-data \brief The FolderListModel provides a model of the contents of a folder in a filesystem. FolderListModel provides access to the local filesystem. The \e folder property diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp index ed936d5..500c6bf 100644 --- a/src/imports/gestures/qdeclarativegesturearea.cpp +++ b/src/imports/gestures/qdeclarativegesturearea.cpp @@ -79,6 +79,8 @@ public: /*! \qmlclass GestureArea QDeclarativeGestureArea + \ingroup qml-basic-interaction-elements + \brief The GestureArea item enables simple gesture handling. \inherits Item diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp index b842109..5cd9c0c 100644 --- a/src/imports/particles/qdeclarativeparticles.cpp +++ b/src/imports/particles/qdeclarativeparticles.cpp @@ -154,6 +154,7 @@ void QDeclarativeParticleMotion::destroy(QDeclarativeParticle &particle) /*! \qmlclass ParticleMotionLinear QDeclarativeParticleMotionLinear + \ingroup qml-particle-elements \since 4.7 \brief The ParticleMotionLinear object moves particles linearly. @@ -180,6 +181,7 @@ void QDeclarativeParticleMotionLinear::advance(QDeclarativeParticle &p, int inte /*! \qmlclass ParticleMotionGravity QDeclarativeParticleMotionGravity + \ingroup qml-particle-elements \since 4.7 \brief The ParticleMotionGravity object moves particles towards a point. @@ -271,6 +273,7 @@ void QDeclarativeParticleMotionGravity::advance(QDeclarativeParticle &p, int int /*! \qmlclass ParticleMotionWander QDeclarativeParticleMotionWander + \ingroup qml-particle-elements \since 4.7 \brief The ParticleMotionWander object moves particles in a somewhat random fashion. @@ -634,6 +637,7 @@ void QDeclarativeParticlesPrivate::updateOpacity(QDeclarativeParticle &p, int ag /*! \qmlclass Particles QDeclarativeParticles + \ingroup qml-particle-elements \since 4.7 \brief The Particles object generates and moves particles. \inherits Item diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index f663dd2..633b309 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -431,21 +431,24 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) while (*n != NULL) { name = snd_device_name_get_hint(*n, "NAME"); - descr = snd_device_name_get_hint(*n, "DESC"); - io = snd_device_name_get_hint(*n, "IOID"); - if((name != NULL) && (descr != NULL) && ((io == NULL) || (io == filter))) { - QString deviceName = QLatin1String(name); - QString deviceDescription = QLatin1String(descr); - allDevices.append(deviceName.toLocal8Bit().constData()); - if(deviceDescription.contains(QLatin1String("Default Audio Device"))) - devices.append(deviceName.toLocal8Bit().constData()); - } - if(name != NULL) + if (name != 0 && qstrcmp(name, "null") != 0) { + descr = snd_device_name_get_hint(*n, "DESC"); + io = snd_device_name_get_hint(*n, "IOID"); + + if ((descr != NULL) && ((io == NULL) || (io == filter))) { + QString deviceName = QLatin1String(name); + QString deviceDescription = QLatin1String(descr); + allDevices.append(deviceName.toLocal8Bit().constData()); + if (deviceDescription.contains(QLatin1String("Default Audio Device"))) + devices.append(deviceName.toLocal8Bit().constData()); + } + free(name); - if(descr != NULL) - free(descr); - if(io != NULL) - free(io); + if (descr != NULL) + free(descr); + if (io != NULL) + free(io); + } ++n; } snd_device_name_free_hint(hints); diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 9e2b85e..ae4d257 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -653,6 +653,8 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) // is the reply associated the currently processing of this channel? if (channels[i].reply == reply) { channels[i].reply = 0; + channels[i].request = QHttpNetworkRequest(); + channels[i].resendCurrent = false; if (!reply->isFinished() && !channels[i].alreadyPipelinedRequests.isEmpty()) { // the reply had to be prematurely removed, e.g. it was not finished diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index d3576dd..6437f6f 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -647,8 +647,10 @@ void QHttpNetworkConnectionChannel::allDone() // finished request. // Note that this may trigger a segfault at some other point. But then we can fix the underlying // problem. - if (!resendCurrent) + if (!resendCurrent) { + request = QHttpNetworkRequest(); reply = 0; + } // move next from pipeline to current request if (!alreadyPipelinedRequests.isEmpty()) { diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index fa592c2..d3084cf 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -105,7 +105,8 @@ QT_BEGIN_NAMESPACE /*! \enum QNetworkRequest::Attribute - + \since 4.7 + Attribute codes for the QNetworkRequest and QNetworkReply. Attributes are extra meta-data that are used to control the @@ -174,21 +175,21 @@ QT_BEGIN_NAMESPACE When using this flag with sequential upload data, the ContentLengthHeader header must be set. - \value HttpPipeliningAllowedAttribute + \value HttpPipeliningAllowedAttribute Requests only, type: QVariant::Bool (default: false) Indicates whether the QNetworkAccessManager code is allowed to use HTTP pipelining with this request. - \value HttpPipeliningWasUsedAttribute + \value HttpPipeliningWasUsedAttribute Replies only, type: QVariant::Bool Indicates whether the HTTP pipelining was used for receiving this reply. \value CustomVerbAttribute Requests only, type: QVariant::ByteArray - Holds the value for the custom HTTP verb to send (destined for usage - of other verbs than GET, POST, PUT and DELETE). This verb is set - when calling QNetworkAccessManager::sendCustomRequest(). + Holds the value for the custom HTTP verb to send (destined for usage + of other verbs than GET, POST, PUT and DELETE). This verb is set + when calling QNetworkAccessManager::sendCustomRequest(). \value CookieLoadControlAttribute Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic) @@ -198,45 +199,42 @@ QT_BEGIN_NAMESPACE XMLHttpRequest where withCredentials has not been set explicitly to true by the Javascript that created the request. - See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information. + See \l{http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag}{here} for more information. + + (This value was introduced in 4.7.) - \since 4.7 - \value CookieSaveControlAttribute + \value CookieSaveControlAttribute Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic) Indicates whether to save 'Cookie' headers received from the server in reply to the request. - This attribute is set to false by QtWebKit when creating a cross-origin XMLHttpRequest where withCredentials has not been set explicitly to true by the Javascript that created the request. - See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information. + See \l{http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag} {here} for more information. - \since 4.7 + (This value was introduced in 4.7.) - \value AuthenticationReuseAttribute + \value AuthenticationReuseAttribute Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic) Indicates whether to use cached authorization credentials in the request, if available. If this is set to QNetworkRequest::Manual and the authentication mechanism is 'Basic' or 'Digest', Qt will not send an an 'Authorization' HTTP header with any cached credentials it may have for the request's URL. - This attribute is set to QNetworkRequest::Manual by QtWebKit when creating a cross-origin XMLHttpRequest where withCredentials has not been set explicitly to true by the Javascript that created the request. - See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information. + See \l{http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag} {here} for more information. - \since 4.7 + (This value was introduced in 4.7.) \omitvalue MaximumDownloadBufferSizeAttribute - \since 4.7 - \internal + (This value was introduced in 4.7.) \omitvalue DownloadBufferAttribute - \since 4.7 - \internal + (This value was introduced in 4.7.) \value User Special type. Additional information can be passed in diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 5d4274f..dd174bf 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -63,6 +63,7 @@ QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() : pollTimer(0), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true) { qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration"); + qRegisterMetaType<QNetworkConfigurationPrivatePointer>("QNetworkConfigurationPrivatePointer"); moveToThread(QCoreApplicationPrivate::mainThread()); updateConfigurations(); @@ -150,25 +151,29 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( end = engine->accessPointConfigurations.end(); it != end; ++it) { QNetworkConfigurationPrivatePointer ptr = it.value(); - const QString bearerName = ptr->bearerName(); QMutexLocker configLocker(&ptr->mutex); + QNetworkConfiguration::BearerType bearerType = ptr->bearerType; if ((ptr->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { if (!defaultConfiguration) { defaultConfiguration = ptr; } else { + QMutexLocker defaultConfigLocker(&defaultConfiguration->mutex); + if (defaultConfiguration->state == ptr->state) { - if (defaultConfiguration->bearerName() == QLatin1String("Ethernet")) { + switch (defaultConfiguration->bearerType) { + case QNetworkConfiguration::BearerEthernet: // do nothing - } else if (defaultConfiguration->bearerName() == QLatin1String("WLAN")) { - // ethernet beats wlan - if (bearerName == QLatin1String("Ethernet")) - defaultConfiguration = ptr; - } else { - // ethernet and wlan beats other - if (bearerName == QLatin1String("Ethernet") || - bearerName == QLatin1String("WLAN")) { + break; + case QNetworkConfiguration::BearerWLAN: + // Ethernet beats WLAN + defaultConfiguration = ptr; + break; + default: + // Ethernet and WLAN beats other + if (bearerType == QNetworkConfiguration::BearerEthernet || + bearerType == QNetworkConfiguration::BearerWLAN) { defaultConfiguration = ptr; } } diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index d7fceba..3190a30 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -183,6 +183,23 @@ QT_BEGIN_NAMESPACE */ /*! + \enum QNetworkConfiguration::BearerType + + Specifies the type of bearer used by a configuration. + + \value BearerUnknown The type of bearer is unknown or unspecified. The bearerTypeName() + function may return additional information. + \value BearerEthernet The configuration is for an Ethernet interfaces. + \value BearerWLAN The configuration is for a Wireless LAN interface. + \value Bearer2G The configuration is for a CSD, GPRS, HSCSD, EDGE or cdmaOne interface. + \value BearerCDMA2000 The configuration is for CDMA interface. + \value BearerWCDMA The configuration is for W-CDMA/UMTS interface. + \value BearerHSPA The configuration is for High Speed Packet Access (HSPA) interface. + \value BearerBluetooth The configuration is for a Bluetooth interface. + \value BearerWiMAX The configuration is for a WiMAX interface. +*/ + +/*! Constructs an invalid configuration object. \sa isValid() @@ -383,53 +400,113 @@ QList<QNetworkConfiguration> QNetworkConfiguration::children() const } /*! - Returns the type of bearer. The string is not translated and - therefore can not be shown to the user. The subsequent table presents the currently known - bearer types: + \fn QString QNetworkConfiguration::bearerName() const + \deprecated + + This function is deprecated. It is equivalent to calling bearerTypeName(), however + bearerType() should be used in preference. +*/ + +/*! + Returns the type of bearer used by this network configuration. + + If the bearer type is \l {QNetworkConfiguration::BearerUnknown}{unknown} the bearerTypeName() + function can be used to retrieve a textural type name for the bearer. + + An invalid network configuration always returns the BearerUnknown value. +*/ +QNetworkConfiguration::BearerType QNetworkConfiguration::bearerType() const +{ + if (!isValid()) + return BearerUnknown; + + QMutexLocker locker(&d->mutex); + + return d->bearerType; +} + +/*! + Returns the type of bearer used by this network configuration as a string. + + The string is not translated and therefore can not be shown to the user. The subsequent table + shows the fixed mappings between BearerType and the bearer type name for known types. If the + BearerType is unknown this function may return additional information if it is available; + otherwise an empty string will be returned. \table - \header + \header + \o BearerType \o Value - \o Description \row - \o Unknown - \o The session is based on an unknown or unspecified bearer type. + \o BearerUnknown + \o + \o The session is based on an unknown or unspecified bearer type. The value of the + string returned describes the bearer type. \row + \o BearerEthernet \o Ethernet - \o The session is based on Ethernet. \row + \o BearerWLAN \o WLAN - \o The session is based on Wireless LAN. \row + \o Bearer2G \o 2G - \o The session uses CSD, GPRS, HSCSD, EDGE or cdmaOne. - \row + \row + \o BearerCDMA2000 \o CDMA2000 - \o The session uses CDMA. \row + \o BearerWCDMA \o WCDMA - \o The session uses W-CDMA/UMTS. \row + \o BearerHSPA \o HSPA - \o The session uses High Speed Packet Access. \row + \o BearerBluetooth \o Bluetooth - \o The session uses Bluetooth. \row + \o BearerWiMAX \o WiMAX - \o The session uses WiMAX. \endtable - This function returns an empty string if this is an invalid configuration, - a network configuration of type \l QNetworkConfiguration::ServiceNetwork or + This function returns an empty string if this is an invalid configuration, a network + configuration of type \l QNetworkConfiguration::ServiceNetwork or \l QNetworkConfiguration::UserChoice. + + \sa bearerType() */ -QString QNetworkConfiguration::bearerName() const +QString QNetworkConfiguration::bearerTypeName() const { if (!isValid()) return QString(); - return d->bearerName(); + QMutexLocker locker(&d->mutex); + + if (d->type == QNetworkConfiguration::ServiceNetwork || + d->type == QNetworkConfiguration::UserChoice) + return QString(); + + switch (d->bearerType) { + case BearerUnknown: + return d->bearerTypeName(); + case BearerEthernet: + return QLatin1String("Ethernet"); + case BearerWLAN: + return QLatin1String("WLAN"); + case Bearer2G: + return QLatin1String("2G"); + case BearerCDMA2000: + return QLatin1String("CDMA2000"); + case BearerWCDMA: + return QLatin1String("WCDMA"); + case BearerHSPA: + return QLatin1String("HSPA"); + case BearerBluetooth: + return QLatin1String("Bluetooth"); + case BearerWiMAX: + return QLatin1String("WiMAX"); + } + + return QLatin1String("Unknown"); } QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index dce39eb..593dbbe 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -103,10 +103,35 @@ public: Q_DECLARE_FLAGS(StateFlags, StateFlag) +#ifndef QT_MOBILITY_BEARER + enum BearerType { + BearerUnknown, + BearerEthernet, + BearerWLAN, + Bearer2G, + BearerCDMA2000, + BearerWCDMA, + BearerHSPA, + BearerBluetooth, + BearerWiMAX + }; +#endif + StateFlags state() const; Type type() const; Purpose purpose() const; + +#ifndef QT_MOBILITY_BEARER +#ifdef QT_DEPRECATED + // Required to maintain source compatibility with Qt Mobility. + QT_DEPRECATED inline QString bearerName() const { return bearerTypeName(); } +#endif + BearerType bearerType() const; + QString bearerTypeName() const; +#else QString bearerName() const; +#endif + QString identifier() const; bool isRoamingAvailable() const; QList<QNetworkConfiguration> children() const; diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 966dfb2..2b0bbf6 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -68,6 +68,7 @@ public: QNetworkConfigurationPrivate () : mutex(QMutex::Recursive), type(QNetworkConfiguration::Invalid), purpose(QNetworkConfiguration::UnknownPurpose), + bearerType(QNetworkConfiguration::BearerUnknown), isValid(false), roamingSupported(false) { } @@ -78,24 +79,22 @@ public: serviceNetworkMembers.clear(); } - virtual QString bearerName() const + virtual QString bearerTypeName() const { - QMutexLocker locker(&mutex); - - return bearer; + return QLatin1String("Unknown"); } QMap<unsigned int, QNetworkConfigurationPrivatePointer> serviceNetworkMembers; mutable QMutex mutex; - QString bearer; QString name; QString id; QNetworkConfiguration::StateFlags state; QNetworkConfiguration::Type type; QNetworkConfiguration::Purpose purpose; + QNetworkConfiguration::BearerType bearerType; bool isValid; bool roamingSupported; diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index e7fffac..0b40147 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -89,11 +89,7 @@ public: OperationNotSupportedError, InvalidConfigurationError }; -#ifndef QT_MOBILITY_BEARER - QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); -#else explicit QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); -#endif virtual ~QNetworkSession(); bool isOpen() const; diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 8ae1305..348b0d2 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -647,7 +647,7 @@ void QHostInfoLookupManager::lookupFinished(QHostInfoRunnable *r) work(); } -// This function returns immediatly when we had a result in the cache, else it will later emit a signal +// This function returns immediately when we had a result in the cache, else it will later emit a signal QHostInfo qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char *member, bool *valid, int *id) { *valid = false; diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index b604e89..505db71 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1380,7 +1380,7 @@ void QAbstractSocket::connectToHostImplementation(const QString &hostName, quint #endif } else { if (d->threadData->eventDispatcher) { - // this internal API for QHostInfo either immediatly gives us the desired + // this internal API for QHostInfo either immediately gives us the desired // QHostInfo from cache or later calls the _q_startConnecting slot. bool immediateResultValid = false; QHostInfo hostInfo = qt_qhostinfo_lookup(hostName, diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 4907f2c..1e0bced 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -306,7 +306,7 @@ void QLocalSocketPrivate::startAsyncRead() /*! \internal Sets the correct size of the read buffer after a read operation. - Returns false, if an error occured or the connection dropped. + Returns false, if an error occurred or the connection dropped. */ bool QLocalSocketPrivate::completeAsyncRead() { diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index f91ce5f..fe28863 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -562,7 +562,7 @@ int QNativeSocketEnginePrivate::nativeAccept() #else int acceptedDescriptor = qt_safe_accept(socketDescriptor, 0, 0); #endif - //check if we have vaild descriptor at all + //check if we have valid descriptor at all if(acceptedDescriptor > 0) { // Ensure that the socket is closed on exec*() ::fcntl(acceptedDescriptor, F_SETFD, FD_CLOEXEC); diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index f73068e..91265f3 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -210,7 +210,7 @@ valid. On failure, QSslSocket will emit the QSslSocket::sslErrors() signal. This mode is the default for clients. - \value AutoVerifyPeer QSslSocket will automaticaly use QueryPeer for + \value AutoVerifyPeer QSslSocket will automatically use QueryPeer for server sockets and VerifyPeer for client sockets. \sa QSslSocket::peerVerifyMode() diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index b4d030c..94b1568 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -750,7 +750,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() ptrCertCloseStore(hSystemStore, 0); } } -#elif defined(Q_OS_UNIX) +#elif defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) systemCerts.append(QSslCertificate::fromPath(QLatin1String("/var/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // AIX systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // Solaris systemCerts.append(QSslCertificate::fromPath(QLatin1String("/opt/openssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // HP-UX @@ -1288,6 +1288,11 @@ bool QSslSocketBackendPrivate::isMatchingHostname(const QString &cn, const QStri if (hostname.midRef(hostname.indexOf(QLatin1Char('.'))) != cn.midRef(firstCnDot)) return false; + // Check if the hostname is an IP address, if so then wildcards are not allowed + QHostAddress addr(hostname); + if (!addr.isNull()) + return false; + // Ok, I guess this was a wildcard CN and the hostname matches. return true; } diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 09ecd4d..d1225c1 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -761,74 +761,95 @@ bool q_resolveOpenSslSymbols() //============================================================================== QDateTime q_getTimeFromASN1(const ASN1_TIME *aTime) { - char lBuffer[24]; - char *pBuffer = lBuffer; - size_t lTimeLength = aTime->length; char *pString = (char *) aTime->data; if (aTime->type == V_ASN1_UTCTIME) { + + char lBuffer[24]; + char *pBuffer = lBuffer; + if ((lTimeLength < 11) || (lTimeLength > 17)) return QDateTime(); memcpy(pBuffer, pString, 10); pBuffer += 10; pString += 10; - } else { - if (lTimeLength < 13) - return QDateTime(); - - memcpy(pBuffer, pString, 12); - pBuffer += 12; - pString += 12; - } - if ((*pString == 'Z') || (*pString == '-') || (*pString == '+')) { - *pBuffer++ = '0'; - *pBuffer++ = '0'; - } else { - *pBuffer++ = *pString++; - *pBuffer++ = *pString++; - // Skip any fractional seconds... - if (*pString == '.') { - pString++; - while ((*pString >= '0') && (*pString <= '9')) + if ((*pString == 'Z') || (*pString == '-') || (*pString == '+')) { + *pBuffer++ = '0'; + *pBuffer++ = '0'; + } else { + *pBuffer++ = *pString++; + *pBuffer++ = *pString++; + // Skip any fractional seconds... + if (*pString == '.') { pString++; + while ((*pString >= '0') && (*pString <= '9')) + pString++; + } } - } - *pBuffer++ = 'Z'; - *pBuffer++ = '\0'; + *pBuffer++ = 'Z'; + *pBuffer++ = '\0'; - time_t lSecondsFromUCT; - if (*pString == 'Z') { - lSecondsFromUCT = 0; - } else { - if ((*pString != '+') && (*pString != '-')) - return QDateTime(); + time_t lSecondsFromUCT; + if (*pString == 'Z') { + lSecondsFromUCT = 0; + } else { + if ((*pString != '+') && (*pString != '-')) + return QDateTime(); + + lSecondsFromUCT = ((pString[1] - '0') * 10 + (pString[2] - '0')) * 60; + lSecondsFromUCT += (pString[3] - '0') * 10 + (pString[4] - '0'); + lSecondsFromUCT *= 60; + if (*pString == '-') + lSecondsFromUCT = -lSecondsFromUCT; + } + + tm lTime; + lTime.tm_sec = ((lBuffer[10] - '0') * 10) + (lBuffer[11] - '0'); + lTime.tm_min = ((lBuffer[8] - '0') * 10) + (lBuffer[9] - '0'); + lTime.tm_hour = ((lBuffer[6] - '0') * 10) + (lBuffer[7] - '0'); + lTime.tm_mday = ((lBuffer[4] - '0') * 10) + (lBuffer[5] - '0'); + lTime.tm_mon = (((lBuffer[2] - '0') * 10) + (lBuffer[3] - '0')) - 1; + lTime.tm_year = ((lBuffer[0] - '0') * 10) + (lBuffer[1] - '0'); + if (lTime.tm_year < 50) + lTime.tm_year += 100; // RFC 2459 + + QDate resDate(lTime.tm_year + 1900, lTime.tm_mon + 1, lTime.tm_mday); + QTime resTime(lTime.tm_hour, lTime.tm_min, lTime.tm_sec); + + QDateTime result(resDate, resTime, Qt::UTC); + result = result.addSecs(lSecondsFromUCT); + return result; + + } else if (aTime->type == V_ASN1_GENERALIZEDTIME) { - lSecondsFromUCT = ((pString[1] - '0') * 10 + (pString[2] - '0')) * 60; - lSecondsFromUCT += (pString[3] - '0') * 10 + (pString[4] - '0'); - lSecondsFromUCT *= 60; - if (*pString == '-') - lSecondsFromUCT = -lSecondsFromUCT; + if (lTimeLength < 15) + return QDateTime(); // hopefully never triggered + + // generalized time is always YYYYMMDDHHMMSSZ (RFC 2459, section 4.1.2.5.2) + tm lTime; + lTime.tm_sec = ((pString[12] - '0') * 10) + (pString[13] - '0'); + lTime.tm_min = ((pString[10] - '0') * 10) + (pString[11] - '0'); + lTime.tm_hour = ((pString[8] - '0') * 10) + (pString[9] - '0'); + lTime.tm_mday = ((pString[6] - '0') * 10) + (pString[7] - '0'); + lTime.tm_mon = (((pString[4] - '0') * 10) + (pString[5] - '0')); + lTime.tm_year = ((pString[0] - '0') * 1000) + ((pString[1] - '0') * 100) + + ((pString[2] - '0') * 10) + (pString[3] - '0'); + + QDate resDate(lTime.tm_year, lTime.tm_mon, lTime.tm_mday); + QTime resTime(lTime.tm_hour, lTime.tm_min, lTime.tm_sec); + + QDateTime result(resDate, resTime, Qt::UTC); + return result; + + } else { + qWarning("unsupported date format detected"); + return QDateTime(); } - tm lTime; - lTime.tm_sec = ((lBuffer[10] - '0') * 10) + (lBuffer[11] - '0'); - lTime.tm_min = ((lBuffer[8] - '0') * 10) + (lBuffer[9] - '0'); - lTime.tm_hour = ((lBuffer[6] - '0') * 10) + (lBuffer[7] - '0'); - lTime.tm_mday = ((lBuffer[4] - '0') * 10) + (lBuffer[5] - '0'); - lTime.tm_mon = (((lBuffer[2] - '0') * 10) + (lBuffer[3] - '0')) - 1; - lTime.tm_year = ((lBuffer[0] - '0') * 10) + (lBuffer[1] - '0'); - if (lTime.tm_year < 50) - lTime.tm_year += 100; // RFC 2459 - - QDate resDate(lTime.tm_year + 1900, lTime.tm_mon + 1, lTime.tm_mday); - QTime resTime(lTime.tm_hour, lTime.tm_min, lTime.tm_sec); - QDateTime result(resDate, resTime, Qt::UTC); - result = result.addSecs(lSecondsFromUCT); - return result; } QT_END_NAMESPACE diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 0f171e4..3affca4 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1695,6 +1695,10 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) workaround_needsFullClearOnEveryFrame = false; workaround_brokenFBOReadBack = false; workaroundsCached = false; + + workaround_brokenTextureFromPixmap = false; + workaround_brokenTextureFromPixmap_init = false; + for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) vertexAttributeArraysEnabledState[i] = false; } @@ -1998,7 +2002,7 @@ struct DDSFormat { option helps preserve this default behavior. \omitvalue CanFlipNativePixmapBindOption Used by x11 from pixmap to choose - wether or not it can bind the pixmap upside down or not. + whether or not it can bind the pixmap upside down or not. \omitvalue MemoryManagedBindOption Used by paint engines to indicate that the pixmap should be memory managed along side with @@ -2577,11 +2581,27 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, && xinfo && xinfo->screen() == pixmap.x11Info().screen() && target == GL_TEXTURE_2D) { - texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options); - if (texture) { - texture->options |= QGLContext::MemoryManagedBindOption; - texture->boundPixmap = pd; - boundPixmaps.insert(pd, QPixmap(pixmap)); + if (!workaround_brokenTextureFromPixmap_init) { + workaround_brokenTextureFromPixmap_init = true; + + const QByteArray versionString(reinterpret_cast<const char*>(glGetString(GL_VERSION))); + const int pos = versionString.indexOf("NVIDIA "); + + if (pos >= 0) { + const QByteArray nvidiaVersionString = versionString.mid(pos + strlen("NVIDIA ")); + + if (nvidiaVersionString.startsWith("195") || nvidiaVersionString.startsWith("256")) + workaround_brokenTextureFromPixmap = true; + } + } + + if (!workaround_brokenTextureFromPixmap) { + texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options); + if (texture) { + texture->options |= QGLContext::MemoryManagedBindOption; + texture->boundPixmap = pd; + boundPixmaps.insert(pd, QPixmap(pixmap)); + } } } #endif diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 3763926..a154325 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -240,6 +240,7 @@ void QGLContextPrivate::destroyEglSurfaceForDevice() if (QGLWidget *wgl = qobject_cast<QGLWidget *>(w)) { if (wgl->d_func()->eglSurfaceWindowId != wgl->winId()) { qWarning("WARNING: Potential EGL surface leak! Not destroying surface."); + eglSurface = EGL_NO_SURFACE; return; } } diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm index 4d7532e..66fe7d3 100644 --- a/src/opengl/qgl_mac.mm +++ b/src/opengl/qgl_mac.mm @@ -804,17 +804,22 @@ void QGLContext::generateFontDisplayLists(const QFont & /* fnt */, int /* listBa static CFBundleRef qt_getOpenGLBundle() { CFBundleRef bundle = 0; + CFStringRef urlString = QCFString::toCFStringRef(QLatin1String("/System/Library/Frameworks/OpenGL.framework")); QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, - QCFString::toCFStringRef(QLatin1String("/System/Library/Frameworks/OpenGL.framework")), kCFURLPOSIXPathStyle, false); + urlString, kCFURLPOSIXPathStyle, false); if (url) bundle = CFBundleCreate(kCFAllocatorDefault, url); + CFRelease(urlString); return bundle; } void *QGLContext::getProcAddress(const QString &proc) const { - return CFBundleGetFunctionPointerForName(QCFType<CFBundleRef>(qt_getOpenGLBundle()), - QCFString(proc)); + CFStringRef procName = QCFString(proc).toCFStringRef(proc); + void *result = CFBundleGetFunctionPointerForName(QCFType<CFBundleRef>(qt_getOpenGLBundle()), + procName); + CFRelease(procName); + return result; } #ifndef QT_MAC_USE_COCOA /***************************************************************************** diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index e8c859a..0e52f22 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -400,6 +400,9 @@ public: uint workaround_brokenFBOReadBack : 1; uint workaroundsCached : 1; + uint workaround_brokenTextureFromPixmap : 1; + uint workaround_brokenTextureFromPixmap_init : 1; + #ifndef QT_NO_EGL uint ownsEglContext : 1; #endif diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp index 8e2bbd4..6aec8ae 100644 --- a/src/opengl/qglextensions.cpp +++ b/src/opengl/qglextensions.cpp @@ -255,6 +255,10 @@ bool qt_resolve_glsl_extensions(QGLContext *ctx) glFramebufferTextureLayerEXT = (_glFramebufferTextureLayerEXT) ctx->getProcAddress(QLatin1String("glFramebufferTextureLayerEXT")); glFramebufferTextureFaceEXT = (_glFramebufferTextureFaceEXT) ctx->getProcAddress(QLatin1String("glFramebufferTextureFaceEXT")); + // Must at least have the FragmentShader extension to continue. + if (!(QGLExtensions::glExtensions() & QGLExtensions::FragmentShader)) + return false; + glCreateShader = (_glCreateShader) ctx->getProcAddress(QLatin1String("glCreateShader")); if (glCreateShader) { glShaderSource = (_glShaderSource) ctx->getProcAddress(QLatin1String("glShaderSource")); diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index deffc20..9b8a3d1 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -445,11 +445,11 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, GLint maxSamples; glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples); - samples = qBound(1, int(samples), int(maxSamples)); + samples = qBound(0, int(samples), int(maxSamples)); glGenRenderbuffers(1, &color_buffer); glBindRenderbuffer(GL_RENDERBUFFER_EXT, color_buffer); - if (glRenderbufferStorageMultisampleEXT) { + if (glRenderbufferStorageMultisampleEXT && samples > 0) { glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, internal_format, size.width(), size.height()); } else { diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index c7689b8..74382b0 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -2121,7 +2121,7 @@ void QGLShaderProgram::setUniformValue(int location, const QSize& size) Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.width())}; + GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())}; glUniform2fv(location, 1, values); } } diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index b3c9df1..25c0501 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -199,6 +199,7 @@ public: return widget; } + // destroys the share widget and prevents recreation void cleanup() { QGLWidget *w = widget; cleanedUp = true; @@ -206,6 +207,20 @@ public: delete w; } + // destroys the share widget, but allows it to be recreated later on + void destroy() { + if (cleanedUp) + return; + + QGLWidget *w = widget; + + // prevent potential recursions + cleanedUp = true; + widget = 0; + delete w; + cleanedUp = false; + } + static bool cleanedUp; private: @@ -233,6 +248,10 @@ QGLWidget* qt_gl_share_widget() return _qt_gl_share_widget()->shareWidget(); } +void qt_destroy_gl_share_widget() +{ + _qt_gl_share_widget()->destroy(); +} struct QGLWindowSurfacePrivate { diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index eebc42f..ca73bad 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -67,6 +67,7 @@ class QWidget; struct QGLWindowSurfacePrivate; Q_OPENGL_EXPORT QGLWidget* qt_gl_share_widget(); +Q_OPENGL_EXPORT void qt_destroy_gl_share_widget(); class QGLWindowSurfaceGLPaintDevice : public QGLPaintDevice { diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 1d633ed..75e5a60 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -77,6 +77,9 @@ QT_BEGIN_NAMESPACE #if !defined(QVG_NO_DRAW_GLYPHS) +// use the same rounding as in qrasterizer.cpp (6 bit fixed point) +static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; + Q_DECL_IMPORT extern int qt_defaultDpiX(); Q_DECL_IMPORT extern int qt_defaultDpiY(); @@ -102,6 +105,7 @@ private: class QVGPaintEnginePrivate : public QPaintEngineExPrivate { + Q_DECLARE_PUBLIC(QVGPaintEngine) public: // Extra blending modes from VG_KHR_advanced_blending extension. // Use the QT_VG prefix to avoid conflicts with any definitions @@ -132,7 +136,7 @@ public: QT_VG_BLEND_XOR_KHR = 0x2026 }; - QVGPaintEnginePrivate(); + QVGPaintEnginePrivate(QVGPaintEngine *q_ptr); ~QVGPaintEnginePrivate(); void init(); @@ -153,6 +157,7 @@ public: void setBrushTransform(const QBrush& brush, VGMatrixMode mode); void setupColorRamp(const QGradient *grad, VGPaint paint); void setImageOptions(); + void systemStateChanged(); #if !defined(QVG_SCISSOR_CLIP) void ensureMask(QVGPaintEngine *engine, int width, int height); void modifyMask @@ -281,6 +286,9 @@ public: // Clear all lazily-set modes. void clearModes(); + +private: + QVGPaintEngine *q; }; inline void QVGPaintEnginePrivate::setImageMode(VGImageMode mode) @@ -332,7 +340,7 @@ void QVGPaintEnginePrivate::clearModes() imageQuality = (VGImageQuality)0; } -QVGPaintEnginePrivate::QVGPaintEnginePrivate() +QVGPaintEnginePrivate::QVGPaintEnginePrivate(QVGPaintEngine *q_ptr) : q(q_ptr) { init(); } @@ -1431,7 +1439,7 @@ QVGPainterState::~QVGPainterState() } QVGPaintEngine::QVGPaintEngine() - : QPaintEngineEx(*new QVGPaintEnginePrivate) + : QPaintEngineEx(*new QVGPaintEnginePrivate(this)) { } @@ -2974,6 +2982,11 @@ void QVGPaintEnginePrivate::setImageOptions() } } +void QVGPaintEnginePrivate::systemStateChanged() +{ + q->updateScissor(); +} + static void drawVGImage(QVGPaintEnginePrivate *d, const QRectF& r, VGImage vgImg, const QSize& imageSize, const QRectF& sr) @@ -3432,9 +3445,10 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) // Set the transformation to use for drawing the current glyphs. QTransform glyphTransform(d->pathTransform); if (d->transform.type() <= QTransform::TxTranslate) { - // Prevent blurriness of unscaled, unrotated text by using integer coordinates. - // Using ceil(x-0.5) instead of qRound() or int-cast, behave like other paint engines. - glyphTransform.translate(ceil(p.x() - 0.5), ceil(p.y() - 0.5)); + // Prevent blurriness of unscaled, unrotated text by forcing integer coordinates. + glyphTransform.translate( + floor(p.x() + glyphTransform.dx() + aliasedCoordinateDelta) - glyphTransform.dx(), + floor(p.y() - glyphTransform.dy() + aliasedCoordinateDelta) + glyphTransform.dy()); } else { glyphTransform.translate(p.x(), p.y()); } diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index 8775623..341f7cd 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -125,9 +125,10 @@ QList<QNetworkConfigurationPrivate *> QConnmanEngine::getConfigurations() config->type = cpPriv->type; config->roamingSupported = cpPriv->roamingSupported; config->purpose = cpPriv->purpose; - config->bearer = cpPriv->bearer; + config->bearerType = cpPriv->bearerType; fetchedConfigurations.append(config); + delete config; } return fetchedConfigurations; // return foundConfigurations; @@ -149,7 +150,6 @@ void QConnmanEngine::getNetworkListing() } - void QConnmanEngine::doRequestUpdate() { connmanManager->requestScan(""); @@ -169,30 +169,6 @@ bool QConnmanEngine::hasIdentifier(const QString &id) return accessPointConfigurations.contains(id); } -QString QConnmanEngine::bearerName(const QString &id) -{ - QMutexLocker locker(&mutex); - QConnmanServiceInterface serv(serviceFromId(id)); - QString connectionType = serv.getType(); - - if (connectionType == "ethernet") - return QLatin1String("Ethernet"); - else if (connectionType == "wifi") - return QLatin1String("WLAN"); - else if (connectionType == "cellular") { - QString mode = serv.getMode(); - if(mode == "gprs" || mode == "edge") { - return QLatin1String("2G"); - } else if(mode == "umts") { - return QLatin1String("WCDMA"); - } - } - else if (connectionType == "wimax") - return QLatin1String("WIMAX"); - - return QString(); -} - void QConnmanEngine::connectToId(const QString &id) { QMutexLocker locker(&mutex); @@ -336,6 +312,9 @@ QString QConnmanEngine::getServiceForNetwork(const QString &netPath) QMutexLocker locker(&mutex); QConnmanNetworkInterface network(netPath, this); foreach(QString service,connmanManager->getServices()) { + + QString devicePath = netPath.section("/",5,5); + QConnmanServiceInterface serv(service,this); if(serv.getName() == network.getName() && network.getSignalStrength() == serv.getSignalStrength()) { @@ -349,7 +328,6 @@ QString QConnmanEngine::getServiceForNetwork(const QString &netPath) void QConnmanEngine::propertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) { Q_UNUSED(path); -// qDebug() << __FUNCTION__ << path << item << value.variant(); QMutexLocker locker(&mutex); if(item == "Services") { @@ -378,17 +356,6 @@ void QConnmanEngine::propertyChangedContext(const QString &path,const QString &i technologies.insert(listPath, tech); } } - - foreach(const QString old, oldtech.keys()) { - if(!newlist.contains(old)) { - QConnmanTechnologyInterface *tech = oldtech.value(old); - disconnect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); - - technologies.remove(old); - getNetworkListing(); - } - } } } if(item == "State") { @@ -409,7 +376,7 @@ void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QSt } } -void QConnmanEngine::networkPropertyChangedContext(const QString &/*path*/,const QString &/*item*/, const QDBusVariant &/*value*/) +void QConnmanEngine::networkPropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) { QMutexLocker locker(&mutex); } @@ -418,6 +385,10 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const Q { QMutexLocker locker(&mutex); if(item == "Networks") { + + QConnmanNetworkInterface network(devpath, this); + + QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant()); QStringList remainingNetworks = qdbus_cast<QStringList>(arg); QString devicetype; @@ -476,6 +447,12 @@ void QConnmanEngine::technologyPropertyChangedContext(const QString & path, cons } if(value.variant().toString() == "offline") { deviceMap.remove(path); + QConnmanTechnologyInterface tech(path); + disconnect(&tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); + + technologies.remove(path); + getNetworkListing(); } } } @@ -538,25 +515,25 @@ QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QStri return flag; } -QString QConnmanEngine::typeToBearer(const QString &type) +QNetworkConfiguration::BearerType QConnmanEngine::typeToBearer(const QString &type) { - QMutexLocker locker(&mutex); - if(type == "wifi") - return "WLAN"; - if(type == "ethernet") - return "Ethernet"; - if(type == "bluetooth") - return "Bluetooth"; - if(type == "cellular") { - return "Cellular"; + if (type == "wifi") + return QNetworkConfiguration::BearerWLAN; + if (type == "ethernet") + return QNetworkConfiguration::BearerEthernet; + if (type == "bluetooth") + return QNetworkConfiguration::BearerBluetooth; + if (type == "cellular") { + return QNetworkConfiguration::Bearer2G; // not handled: CDMA2000 HSPA } - if(type == "wimax") - return "WiMax"; + if (type == "wimax") + return QNetworkConfiguration::BearerWiMAX; + // if(type == "gps") // if(type == "vpn") - return "Unknown"; + return QNetworkConfiguration::BearerUnknown; } void QConnmanEngine::removeConfiguration(const QString &id) @@ -612,15 +589,35 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath) QString networkName = serv->getName(); - if(serv->getType() == "Cellular") { + if(serv->getType() == "cellular") { networkName = serv->getAPN(); + if(networkName.isEmpty()) { + networkName = serv->getName(); + } } cpPriv->name = networkName; cpPriv->isValid = true; cpPriv->id = id; cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->bearer = bearerName(id); + + + const QString connectionType = serv->getType(); + if (connectionType == "ethernet") { + cpPriv->bearerType = QNetworkConfiguration::BearerEthernet; + } else if (connectionType == "wifi") { + cpPriv->bearerType = QNetworkConfiguration::BearerWLAN; + } else if (connectionType == "cellular") { + const QString mode = serv->getMode(); + if (mode == "gprs" || mode == "edge") + cpPriv->bearerType = QNetworkConfiguration::Bearer2G; + else if (mode == "umts") + cpPriv->bearerType = QNetworkConfiguration::BearerWCDMA; + } else if (connectionType == "wimax") { + cpPriv->bearerType = QNetworkConfiguration::BearerWiMAX; + } else { + cpPriv->bearerType = QNetworkConfiguration::BearerUnknown; + } if(serv->getSecurity() == "none") { cpPriv->purpose = QNetworkConfiguration::PublicPurpose; @@ -650,6 +647,9 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) { QMutexLocker locker(&mutex); + if(networkPath.isNull()) + return; + QConnmanNetworkInterface *network; network = new QConnmanNetworkInterface(networkPath, this); QString servicePath = getServiceForNetwork(networkPath); @@ -665,9 +665,10 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) serv = new QConnmanServiceInterface(servicePath,this); connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); + } - if (!accessPointConfigurations.contains(id)) { + if (!id.isEmpty() && !accessPointConfigurations.contains(id)) { knownNetworks[device.getType()].append(networkPath); @@ -683,31 +684,38 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) if(networkName.isEmpty()) networkName = "Hidden Network"; - QString bearerName; + + QNetworkConfiguration::BearerType bearerType; if(servicePath.isEmpty()) { QString devicePath = networkPath.section("/",0,5); + QConnmanDeviceInterface device(devicePath,this); - bearerName = typeToBearer(device.getType()); + bearerType = typeToBearer(device.getType()); } else { - bearerName = typeToBearer(serv->getType()); + bearerType = typeToBearer(serv->getType()); } - if(bearerName == "Cellular") { + if (bearerType == QNetworkConfiguration::Bearer2G) { QString mode = serv->getMode(); - if(mode == "gprs" || mode == "edge") { - bearerName = "2G"; - } else if(mode == "umts") { - bearerName = "WCDMA"; + if (mode == "gprs" || mode == "edge") { + bearerType = QNetworkConfiguration::Bearer2G; + } else if (mode == "umts") { + bearerType = QNetworkConfiguration::BearerWCDMA; + } + if(servicePath.isEmpty()) { + networkName = serv->getAPN(); + if(networkName.isEmpty()) { + networkName = serv->getName(); + } } - networkName = serv->getAPN(); } cpPriv->name = networkName; cpPriv->isValid = true; cpPriv->id = id; cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->bearer = bearerName; + cpPriv->bearerType = bearerType; if(network->getWifiSecurity() == "none") { cpPriv->purpose = QNetworkConfiguration::PublicPurpose; @@ -729,7 +737,9 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) emit configurationAdded(ptr); locker.relock(); emit updateCompleted(); - } + } /*else { + qDebug() << "Not added~~~~~~~~~~~"; + }*/ } bool QConnmanEngine::requiresPolling() const diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h index 0f6dc1c..2ee6da5 100644 --- a/src/plugins/bearer/connman/qconnmanengine.h +++ b/src/plugins/bearer/connman/qconnmanengine.h @@ -80,8 +80,6 @@ public: virtual QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - virtual QString bearerName(const QString &id); - virtual void connectToId(const QString &id); virtual void disconnectFromId(const QString &id); @@ -125,7 +123,7 @@ private: QString networkFromId(const QString &id); QNetworkConfiguration::StateFlags getStateForService(const QString &service); - QString typeToBearer(const QString &type); + QNetworkConfiguration::BearerType typeToBearer(const QString &type); void removeConfiguration(const QString &servicePath); void addServiceConfiguration(const QString &servicePath); diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index b20e7c1..3722c43 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -53,6 +53,8 @@ #include "qconnmanservice_linux_p.h" +#ifndef QT_NO_BEARERMANAGEMENT +#ifndef QT_NO_DBUS QT_BEGIN_NAMESPACE static QDBusConnection dbusConnection = QDBusConnection::systemBus(); @@ -129,8 +131,10 @@ QVariant QConnmanManagerInterface::getProperty(const QString &property) QVariantMap QConnmanManagerInterface::getProperties() { - QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties")); - return reply.value(); + if(this->isValid()) { + QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties")); + return reply.value(); + } else return QVariantMap(); } QString QConnmanManagerInterface::getState() @@ -477,9 +481,7 @@ QVariant QConnmanProfileInterface::getProperty(const QString &property) QVariantMap map = getProperties(); if (map.contains(property)) { var = map.value(property); - } else { - qDebug() <<__FUNCTION__<< "Could not find" << property; - } + } return var; } @@ -518,8 +520,6 @@ QConnmanServiceInterface::~QConnmanServiceInterface() void QConnmanServiceInterface::connectNotify(const char *signal) { -// qWarning() << __FUNCTION__ << signal << this->path(); - if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), this->path(), @@ -551,8 +551,12 @@ void QConnmanServiceInterface::disconnectNotify(const char *signal) QVariantMap QConnmanServiceInterface::getProperties() { - QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties")); - return reply.value(); + if(this->isValid()) { + QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties")); + return reply.value(); + } + else + return QVariantMap(); } QVariant QConnmanServiceInterface::getProperty(const QString &property) @@ -561,9 +565,7 @@ QVariant QConnmanServiceInterface::getProperty(const QString &property) QVariantMap map = getProperties(); if (map.contains(property)) { var = map.value(property); - } else { -// qDebug() <<__FUNCTION__<< "Could not find" << property; - } + } return var; } @@ -725,6 +727,99 @@ QVariantMap QConnmanServiceInterface::getEthernet() return qdbus_cast<QVariantMap >(var); } +QString QConnmanServiceInterface::getMethod() +{ + QVariant var; + QVariantMap map = getEthernet(); + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Method") { + return it.value().toString(); + } + } + return QString(); +} + +QString QConnmanServiceInterface::getInterface() +{ + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Interface") { + return it.value().toString(); + } + } + + return QString(); +} + +QString QConnmanServiceInterface::getMacAddress() +{ + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Address") { + return it.value().toString(); + } + } + return QString(); +} + +quint16 QConnmanServiceInterface::getMtu() +{ + quint16 mtu=0; + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "MTU") { + return it.value().toUInt(); + } + } + return mtu; +} + +quint16 QConnmanServiceInterface::getSpeed() +{ + quint16 speed=0; + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Speed") { + return it.value().toUInt(); + } + } + return speed; +} + +QString QConnmanServiceInterface::getDuplex() +{ + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Duplex") { + return it.value().toString(); + } + } + return QString(); +} + + bool QConnmanServiceInterface::isOfflineMode() { QVariant var = getProperty("OfflineMode"); @@ -950,15 +1045,7 @@ QVariantMap QConnmanDeviceInterface::getProperties() bool QConnmanDeviceInterface::setProperty(const QString &name, const QDBusVariant &value) { - -// QList<QVariant> args; - qWarning() << __FUNCTION__ << name << value.variant(); -// args << qVariantFromValue(name); -// args << qVariantFromValue(value); - QDBusMessage reply = this->call(QLatin1String("SetProperty"),name, qVariantFromValue(value)); -qWarning() << reply.errorMessage(); - return true; } @@ -1047,7 +1134,6 @@ bool QConnmanDeviceInterface::setEnabled(bool powered) << qVariantFromValue(QDBusVariant(powered)); QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,QLatin1String("SetProperty"),args); - qWarning() << reply.errorMessage() << reply.errorName(); return true; } @@ -1063,10 +1149,12 @@ QConnmanDBusHelper::~QConnmanDBusHelper() void QConnmanDBusHelper::propertyChanged(const QString &item, const QDBusVariant &var) { QDBusMessage msg = this->message(); -// qWarning() << sender(); - // qWarning() << msg.interface() << msg.path() << item << var.variant() <<"\n"; Q_EMIT propertyChangedContext(msg.path() ,item, var); } ///////////////// QT_END_NAMESPACE + +#endif // QT_NO_DBUS +#endif // QT_NO_BEARERMANAGEMENT + diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h index 35e3f3d..a2b1e73 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h +++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h @@ -65,6 +65,9 @@ #include <QtDBus/QDBusContext> #include <QMap> +#ifndef QT_NO_BEARERMANAGEMENT +#ifndef QT_NO_DBUS + #ifndef __CONNMAN_DBUS_H #define CONNMAN_SERVICE "org.moblin.connman" @@ -249,6 +252,13 @@ public: QVariantMap getProxy(); QVariantMap getEthernet(); + QString getMethod(); + QString getInterface(); + QString getMacAddress(); + quint16 getMtu(); + quint16 getSpeed(); + QString getDuplex(); + bool isOfflineMode(); QStringList getServices(); @@ -378,4 +388,7 @@ Q_SIGNALS: QT_END_NAMESPACE +#endif // QT_NO_DBUS +#endif // QT_NO_BEARERMANAGEMENT + #endif //QCONNMANSERVICE_H diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 4d90648..56da66a 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -68,8 +68,6 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); - void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 6ba9504..131f36d 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -264,7 +264,7 @@ QStringList QScanThread::foundNetwork(const QString &id, const QString &name, co ptr->id = id; ptr->state = state; ptr->type = QNetworkConfiguration::InternetAccessPoint; - ptr->bearer = QLatin1String("WLAN"); + ptr->bearerType = QNetworkConfiguration::BearerWLAN; ptr->purpose = purpose; fetchedConfigurations.append( ptr); @@ -789,8 +789,8 @@ void QCoreWlanEngine::networksChanged() changed = true; } - if (ptr->bearer != cpPriv->bearer) { - ptr->bearer = cpPriv->bearer; + if (ptr->bearerType != cpPriv->bearerType) { + ptr->bearerType = cpPriv->bearerType; changed = true; } diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 652fe4a..fad3ae8 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_NETWORKINTERFACE -static QString qGetInterfaceType(const QString &interface) +static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface) { #ifdef Q_OS_WIN32 unsigned long oid; @@ -78,10 +78,10 @@ static QString qGetInterfaceType(const QString &interface) NDIS_MEDIUM medium; NDIS_PHYSICAL_MEDIUM physicalMedium; - HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0, + HANDLE handle = CreateFile((TCHAR *)QString::fromLatin1("\\\\.\\%1").arg(interface).utf16(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (handle == INVALID_HANDLE_VALUE) - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; oid = OID_GEN_MEDIA_SUPPORTED; bytesWritten = 0; @@ -89,7 +89,7 @@ static QString qGetInterfaceType(const QString &interface) &medium, sizeof(medium), &bytesWritten, 0); if (!result) { CloseHandle(handle); - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } oid = OID_GEN_PHYSICAL_MEDIUM; @@ -100,9 +100,9 @@ static QString qGetInterfaceType(const QString &interface) CloseHandle(handle); if (medium == NdisMedium802_3) - return QLatin1String("Ethernet"); + return QNetworkConfiguration::BearerEthernet; else - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } CloseHandle(handle); @@ -110,16 +110,16 @@ static QString qGetInterfaceType(const QString &interface) if (medium == NdisMedium802_3) { switch (physicalMedium) { case NdisPhysicalMediumWirelessLan: - return QLatin1String("WLAN"); + return QNetworkConfiguration::BearerWLAN; case NdisPhysicalMediumBluetooth: - return QLatin1String("Bluetooth"); + return QNetworkConfiguration::BearerBluetooth; case NdisPhysicalMediumWiMax: - return QLatin1String("WiMAX"); + return QNetworkConfiguration::BearerWiMAX; default: #ifdef BEARER_MANAGEMENT_DEBUG qDebug() << "Physical Medium" << physicalMedium; #endif - return QLatin1String("Ethernet"); + return QNetworkConfiguration::BearerEthernet; } } @@ -135,12 +135,12 @@ static QString qGetInterfaceType(const QString &interface) close(sock); if (result >= 0 && request.ifr_hwaddr.sa_family == ARPHRD_ETHER) - return QLatin1String("Ethernet"); + return QNetworkConfiguration::BearerEthernet; #else Q_UNUSED(interface); #endif - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } #endif @@ -214,7 +214,7 @@ void QGenericEngine::doRequestUpdate() continue; // ignore WLAN interface handled in separate engine - if (qGetInterfaceType(interface.name()) == QLatin1String("WLAN")) + if (qGetInterfaceType(interface.name()) == QNetworkConfiguration::BearerWLAN) continue; uint identifier; @@ -277,7 +277,7 @@ void QGenericEngine::doRequestUpdate() ptr->id = id; ptr->state = state; ptr->type = QNetworkConfiguration::InternetAccessPoint; - ptr->bearer = qGetInterfaceType(interface.name()); + ptr->bearerType = qGetInterfaceType(interface.name()); accessPointConfigurations.insert(id, ptr); configurationInterface.insert(id, interface.name()); diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index cdbbc9d..021b35b 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -65,8 +65,6 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); - void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index 0083380..3264f15 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -60,16 +60,11 @@ IcdNetworkConfigurationPrivate::~IcdNetworkConfigurationPrivate() { } -QString IcdNetworkConfigurationPrivate::bearerName() const +QString IcdNetworkConfigurationPrivate::bearerTypeName() const { - if (iap_type == QLatin1String("WLAN_INFRA") || - iap_type == QLatin1String("WLAN_ADHOC")) { - return QLatin1String("WLAN"); - } else if (iap_type == QLatin1String("GPRS")) { - return QLatin1String("HSPA"); - } else { - return iap_type; - } + QMutexLocker locker(&mutex); + + return iap_type; } /* The IapAddTimer is a helper class that makes sure we update @@ -222,7 +217,7 @@ void IapMonitor::iapRemoved(const QString &iap_id) } QIcdEngine::QIcdEngine(QObject *parent) -: QBearerEngine(parent), iapMonitor(new IapMonitor), m_dbusInterface(0), +: QBearerEngine(parent), iapMonitor(0), m_dbusInterface(0), firstUpdate(true), m_scanGoingOn(false) { } @@ -263,6 +258,7 @@ void QIcdEngine::initialize() startListeningStateSignalsForAllConnections(); /* Turn on IAP add/remove monitoring */ + iapMonitor = new IapMonitor; iapMonitor->setup(this); /* We create a default configuration which is a pseudo config */ @@ -279,6 +275,8 @@ void QIcdEngine::initialize() userChoiceConfigurations.insert(cpPriv->id, ptr); doRequestUpdate(); + + getIcdInitialState(); } static inline QString network_attrs_to_security(uint network_attrs) @@ -400,6 +398,7 @@ void QIcdEngine::addConfiguration(QString& iap_id) ptr->mutex.lock(); ptr->id = iap_id; toIcdConfig(ptr)->iap_type = iap_type; + ptr->bearerType = bearerTypeFromIapType(iap_type); toIcdConfig(ptr)->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); toIcdConfig(ptr)->network_id = ssid; toIcdConfig(ptr)->service_id = saved_iap.value("service_id").toString(); @@ -424,6 +423,7 @@ void QIcdEngine::addConfiguration(QString& iap_id) cpPriv->isValid = true; cpPriv->id = iap_id; cpPriv->iap_type = iap_type; + cpPriv->bearerType = bearerTypeFromIapType(iap_type); cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); cpPriv->service_id = saved_iap.value("service_id").toString(); cpPriv->service_type = saved_iap.value("service_type").toString(); @@ -480,6 +480,7 @@ void QIcdEngine::addConfiguration(QString& iap_id) ptr->isValid = true; if (toIcdConfig(ptr)->iap_type != iap_type) { toIcdConfig(ptr)->iap_type = iap_type; + ptr->bearerType = bearerTypeFromIapType(iap_type); update_needed = true; } if (iap_type.startsWith(QLatin1String("WLAN"))) { @@ -522,8 +523,6 @@ void QIcdEngine::addConfiguration(QString& iap_id) void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned) { - QMutexLocker locker(&mutex); - /* Contains all known iap_ids from storage */ QList<QString> knownConfigs = accessPointConfigurations.keys(); @@ -580,6 +579,7 @@ void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned) cpPriv->network_id = ssid; cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); cpPriv->iap_type = iap_type; + cpPriv->bearerType = bearerTypeFromIapType(iap_type); cpPriv->service_id = saved_ap.value("service_id").toString(); cpPriv->service_type = saved_ap.value("service_type").toString(); cpPriv->type = QNetworkConfiguration::InternetAccessPoint; @@ -588,9 +588,9 @@ void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned) QNetworkConfigurationPrivatePointer ptr(cpPriv); accessPointConfigurations.insert(iap_id, ptr); - locker.unlock(); + mutex.unlock(); emit configurationAdded(ptr); - locker.relock(); + mutex.lock(); #ifdef BEARER_MANAGEMENT_DEBUG qDebug("IAP: %s, name: %s, ssid: %s, added to known list", @@ -625,7 +625,11 @@ void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned) changed = true; } - if (ptr->state != QNetworkConfiguration::Discovered) { + /* If this config is the current active one, we do not set it + * to discovered. + */ + if ((ptr->state != QNetworkConfiguration::Discovered) && + (ptr->state != QNetworkConfiguration::Active)) { ptr->state = QNetworkConfiguration::Discovered; changed = true; } @@ -643,9 +647,9 @@ void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned) ptr->mutex.unlock(); if (changed) { - locker.unlock(); + mutex.unlock(); emit configurationChanged(ptr); - locker.relock(); + mutex.lock(); } if (!ap.scan.network_type.startsWith(QLatin1String("WLAN"))) @@ -688,6 +692,7 @@ rescan_list: cpPriv->id = scanned_ssid.data(); // Note: id is now ssid, it should be set to IAP id if the IAP is saved cpPriv->network_id = scanned_ssid; cpPriv->iap_type = ap.scan.network_type; + cpPriv->bearerType = bearerTypeFromIapType(cpPriv->iap_type); cpPriv->network_attrs = ap.scan.network_attrs; cpPriv->service_id = ap.scan.service_id; cpPriv->service_type = ap.scan.service_type; @@ -703,9 +708,9 @@ rescan_list: QNetworkConfigurationPrivatePointer ptr(cpPriv); accessPointConfigurations.insert(ptr->id, ptr); - locker.unlock(); + mutex.unlock(); emit configurationAdded(ptr); - locker.relock(); + mutex.lock(); } else { knownConfigs.removeOne(scanned_ssid); } @@ -733,9 +738,9 @@ rescan_list: ptr->state = QNetworkConfiguration::Defined; configLocker.unlock(); - locker.unlock(); + mutex.unlock(); emit configurationChanged(ptr); - locker.relock(); + mutex.lock(); } } } @@ -744,9 +749,9 @@ rescan_list: foreach (const QString &oldIface, knownConfigs) { QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(oldIface); if (ptr) { - locker.unlock(); + mutex.unlock(); emit configurationRemoved(ptr); - locker.relock(); + mutex.lock(); //if we would have SNAP support we would have to remove the references //from existing ServiceNetworks to the removed access point configuration } @@ -762,9 +767,9 @@ rescan_list: } if (!firstUpdate) { - locker.unlock(); + mutex.unlock(); emit updateCompleted(); - locker.relock(); + mutex.lock(); } if (firstUpdate) @@ -781,18 +786,54 @@ QNetworkConfigurationPrivatePointer QIcdEngine::defaultConfiguration() void QIcdEngine::startListeningStateSignalsForAllConnections() { - QMutexLocker locker(&mutex); - // Start listening ICD_DBUS_API_STATE_SIG signals m_dbusInterface->connection().connect(ICD_DBUS_API_INTERFACE, ICD_DBUS_API_PATH, ICD_DBUS_API_INTERFACE, ICD_DBUS_API_STATE_SIG, this, SLOT(connectionStateSignalsSlot(QDBusMessage))); +} + +void QIcdEngine::getIcdInitialState() +{ + /* Instead of requesting ICD status asynchronously, we ask it synchronously. + * It ensures that we always get right icd status BEFORE initialize() ends. + * If not, initialize() might end before we got icd status and + * QNetworkConfigurationManager::updateConfigurations() + * call from user might also end before receiving icd status. + * In such case, we come up to a bug: + * QNetworkConfigurationManagerPrivate::isOnline() will be false even + * if we are connected. + */ + Maemo::Icd icd; + QList<Maemo::IcdStateResult> state_results; + QNetworkConfigurationPrivatePointer ptr; + + if (icd.state(state_results) && !state_results.isEmpty()) { - // Calling ICD_DBUS_API_STATE_REQ makes sure that initial state will be updated immediately - m_gettingInitialConnectionState = true; - m_dbusInterface->call(ICD_DBUS_API_STATE_REQ); + if (!(state_results.first().params.network_attrs == 0 && + state_results.first().params.network_id.isEmpty())) { + + switch (state_results.first().state) { + case ICD_STATE_CONNECTED: + m_onlineIapId = state_results.first().params.network_id; + + ptr = accessPointConfigurations.value(m_onlineIapId); + if (ptr) { + QMutexLocker configLocker(&ptr->mutex); + ptr->state = QNetworkConfiguration::Active; + configLocker.unlock(); + + mutex.unlock(); + emit configurationChanged(ptr); + mutex.lock(); + } + break; + default: + break; + } + } + } } void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg) @@ -817,12 +858,12 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg) ptr->type = QNetworkConfiguration::InternetAccessPoint; if (ptr->state != QNetworkConfiguration::Active) { ptr->state = QNetworkConfiguration::Active; - if (!m_gettingInitialConnectionState) { - configLocker.unlock(); - locker.unlock(); - emit configurationChanged(ptr); - locker.relock(); - } + + configLocker.unlock(); + locker.unlock(); + emit configurationChanged(ptr); + locker.relock(); + m_onlineIapId = iapid; } } else { @@ -843,22 +884,21 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg) ptr->type = QNetworkConfiguration::InternetAccessPoint; if (ptr->state == QNetworkConfiguration::Active) { ptr->state = QNetworkConfiguration::Discovered; - if (!m_gettingInitialConnectionState) { - configLocker.unlock(); - locker.unlock(); - emit configurationChanged(ptr); - locker.relock(); - // Note: If ICD switches used IAP from one to another: - // 1) new IAP is reported to be online first - // 2) old IAP is reported to be offline then - // => Device can be reported to be offline only - // if last known online IAP is reported to be disconnected - if (iapid == m_onlineIapId) { - // It's known that there is only one global ICD connection - // => Because ICD state was reported to be DISCONNECTED, Device is offline - m_onlineIapId.clear(); - } + configLocker.unlock(); + locker.unlock(); + emit configurationChanged(ptr); + locker.relock(); + + // Note: If ICD switches used IAP from one to another: + // 1) new IAP is reported to be online first + // 2) old IAP is reported to be offline then + // => Device can be reported to be offline only + // if last known online IAP is reported to be disconnected + if (iapid == m_onlineIapId) { + // It's known that there is only one global ICD connection + // => Because ICD state was reported to be DISCONNECTED, Device is offline + m_onlineIapId.clear(); } } } else { @@ -879,8 +919,6 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg) locker.unlock(); emit iapStateChanged(iapid, icd_connection_state); locker.relock(); - - m_gettingInitialConnectionState = false; } void QIcdEngine::requestUpdate() @@ -906,8 +944,6 @@ void QIcdEngine::requestUpdate() void QIcdEngine::cancelAsyncConfigurationUpdate() { - QMutexLocker locker(&mutex); - if (!m_scanGoingOn) { return; } @@ -947,7 +983,9 @@ void QIcdEngine::asyncUpdateConfigurationsSlot(QDBusMessage msg) if (icd_scan_status == ICD_SCAN_COMPLETE) { m_typesToBeScanned.removeOne(arguments[6].toString()); if (!m_typesToBeScanned.count()) { + locker.unlock(); finishAsyncConfigurationUpdate(); + locker.relock(); } } else { Maemo::IcdScanResult scanResult; @@ -977,7 +1015,8 @@ void QIcdEngine::cleanup() m_scanTimer.stop(); m_dbusInterface->call(ICD_DBUS_API_SCAN_CANCEL); } - iapMonitor->cleanup(); + if (iapMonitor) + iapMonitor->cleanup(); } bool QIcdEngine::hasIdentifier(const QString &id) diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h index 1b291eb..0d5ba27 100644 --- a/src/plugins/bearer/icd/qicdengine.h +++ b/src/plugins/bearer/icd/qicdengine.h @@ -54,13 +54,25 @@ class QNetworkConfigurationPrivate; class IapMonitor; class QDBusInterface; +inline QNetworkConfiguration::BearerType bearerTypeFromIapType(const QString &iapType) +{ + if (iapType == QLatin1String("WLAN_INFRA") || + iapType == QLatin1String("WLAN_ADHOC")) { + return QNetworkConfiguration::BearerWLAN; + } else if (iapType == QLatin1String("GPRS")) { + return QNetworkConfiguration::BearerHSPA; + } else { + return QNetworkConfiguration::BearerUnknown; + } +} + class IcdNetworkConfigurationPrivate : public QNetworkConfigurationPrivate { public: IcdNetworkConfigurationPrivate(); ~IcdNetworkConfigurationPrivate(); - QString bearerName() const; + virtual QString bearerTypeName() const; // In Maemo the id field (defined in QNetworkConfigurationPrivate) // is the IAP id (which typically is UUID) @@ -114,13 +126,13 @@ public: QMutexLocker locker(&mutex); accessPointConfigurations.insert(ptr->id, ptr); + + locker.unlock(); emit configurationAdded(ptr); } inline void changedSessionConfiguration(QNetworkConfigurationPrivatePointer ptr) { - QMutexLocker locker(&mutex); - emit configurationChanged(ptr); } @@ -132,14 +144,15 @@ Q_SIGNALS: void iapStateChanged(const QString& iapid, uint icd_connection_state); private Q_SLOTS: - void doRequestUpdate(QList<Maemo::IcdScanResult> scanned = QList<Maemo::IcdScanResult>()); - void cancelAsyncConfigurationUpdate(); void finishAsyncConfigurationUpdate(); void asyncUpdateConfigurationsSlot(QDBusMessage msg); void connectionStateSignalsSlot(QDBusMessage msg); private: void startListeningStateSignalsForAllConnections(); + void doRequestUpdate(QList<Maemo::IcdScanResult> scanned = QList<Maemo::IcdScanResult>()); + void cancelAsyncConfigurationUpdate(); + void getIcdInitialState(); private: IapMonitor *iapMonitor; @@ -150,7 +163,6 @@ private: QList<Maemo::IcdScanResult> m_scanResult; bool firstUpdate; - bool m_gettingInitialConnectionState; bool m_scanGoingOn; }; diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index e8e5183..3170bf6 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -318,6 +318,7 @@ QNetworkConfiguration& QNetworkSessionPrivateImpl::copyConfig(QNetworkConfigurat cpPriv->purpose = fromPriv->purpose; cpPriv->network_id = fromPriv->network_id; cpPriv->iap_type = fromPriv->iap_type; + cpPriv->bearerType = fromPriv->bearerType; cpPriv->network_attrs = fromPriv->network_attrs; cpPriv->service_type = fromPriv->service_type; cpPriv->service_id = fromPriv->service_id; @@ -338,8 +339,6 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() isOpen = false; opened = false; - connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); - connect(engine, SIGNAL(iapStateChanged(const QString&, uint)), this, SLOT(iapStateChanged(const QString&, uint))); @@ -443,6 +442,7 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() ptr->id = toIcdConfig(ptr)->network_id; toIcdConfig(ptr)->network_attrs = state_results.first().params.network_attrs; toIcdConfig(ptr)->iap_type = state_results.first().params.network_type; + ptr->bearerType = bearerTypeFromIapType(toIcdConfig(ptr)->iap_type); toIcdConfig(ptr)->service_type = state_results.first().params.service_type; toIcdConfig(ptr)->service_id = state_results.first().params.service_id; toIcdConfig(ptr)->service_attrs = state_results.first().params.service_attrs; @@ -458,14 +458,15 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() else ptr->name = ptr->id; + const QString identifier = ptr->id; + + configLocker.unlock(); + // Add the new active configuration to manager or update the old config - if (!engine->hasIdentifier(ptr->id)) { - configLocker.unlock(); + if (!engine->hasIdentifier(identifier)) engine->addSessionConfiguration(ptr); - } else { - configLocker.unlock(); + else engine->changedSessionConfiguration(ptr); - } } break; @@ -819,6 +820,7 @@ void QNetworkSessionPrivateImpl::stateChange(const QDBusMessage& rep) icdConfig->name = name; icdConfig->iap_type = rep.arguments().at(3).toString(); // connect_result.connect.network_type; + icdConfig->bearerType = bearerTypeFromIapType(icdConfig->iap_type); icdConfig->isValid = true; icdConfig->state = QNetworkConfiguration::Active; icdConfig->type = QNetworkConfiguration::InternetAccessPoint; diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 1a55402..ba8297e 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -206,7 +206,7 @@ void QNativeWifiEngine::scanComplete() ptr->id = id; ptr->state = state; ptr->type = QNetworkConfiguration::InternetAccessPoint; - ptr->bearer = QLatin1String("WLAN"); + ptr->bearerType = QNetworkConfiguration::BearerWLAN; accessPointConfigurations.insert(id, ptr); @@ -350,11 +350,6 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id) return false; } -/*QString QNativeWifiEngine::bearerName(const QString &) -{ - return QLatin1String("WLAN"); -}*/ - void QNativeWifiEngine::connectToId(const QString &id) { QMutexLocker locker(&mutex); diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 0e9576b..dccf2e2 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -75,8 +75,6 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - //QString bearerName(const QString &id); - void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 3ebc356..29445ce 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -104,14 +104,23 @@ void QNetworkManagerEngine::initialize() QMutexLocker locker(&mutex); // Get current list of access points. - foreach (const QDBusObjectPath &devicePath, interface->getDevices()) + foreach (const QDBusObjectPath &devicePath, interface->getDevices()) { + locker.unlock(); deviceAdded(devicePath); + locker.relock(); + } // Get connections. - foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) + foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) { + locker.unlock(); newConnection(settingsPath, systemSettings); - foreach (const QDBusObjectPath &settingsPath, userSettings->listConnections()) + locker.relock(); + } + foreach (const QDBusObjectPath &settingsPath, userSettings->listConnections()) { + locker.unlock(); newConnection(settingsPath, userSettings); + locker.relock(); + } // Get active connections. foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { @@ -132,11 +141,6 @@ bool QNetworkManagerEngine::networkManagerAvailable() const return interface->isValid(); } -void QNetworkManagerEngine::doRequestUpdate() -{ - emit updateCompleted(); -} - QString QNetworkManagerEngine::getInterfaceFromId(const QString &id) { QMutexLocker locker(&mutex); @@ -181,30 +185,6 @@ bool QNetworkManagerEngine::hasIdentifier(const QString &id) return false; } -QString QNetworkManagerEngine::bearerName(const QString &id) -{ - QMutexLocker locker(&mutex); - - QNetworkManagerSettingsConnection *connection = connectionFromId(id); - - if (!connection) - return QString(); - - QNmSettingsMap map = connection->getSettings(); - const QString connectionType = map.value("connection").value("type").toString(); - - if (connectionType == "802-3-ethernet") - return QLatin1String("Ethernet"); - else if (connectionType == "802-11-wireless") - return QLatin1String("WLAN"); - else if (connectionType == "gsm") - return QLatin1String("2G"); - else if (connectionType == "cdma") - return QLatin1String("CDMA2000"); - else - return QString(); -} - void QNetworkManagerEngine::connectToId(const QString &id) { QMutexLocker locker(&mutex); @@ -257,9 +237,7 @@ void QNetworkManagerEngine::disconnectFromId(const QString &id) void QNetworkManagerEngine::requestUpdate() { - QMutexLocker locker(&mutex); - - QTimer::singleShot(0, this, SLOT(doRequestUpdate())); + QMetaObject::invokeMethod(this, "updateCompleted", Qt::QueuedConnection); } void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, @@ -385,13 +363,10 @@ void QNetworkManagerEngine::devicePropertiesChanged(const QString &path, void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) { - QMutexLocker locker(&mutex); - QNetworkManagerInterfaceDevice device(path.path()); if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS) { QNetworkManagerInterfaceDeviceWireless *wirelessDevice = new QNetworkManagerInterfaceDeviceWireless(device.connectionInterface()->path()); - wirelessDevices.insert(path.path(), wirelessDevice); wirelessDevice->setConnections(); connect(wirelessDevice, SIGNAL(accessPointAdded(QString,QDBusObjectPath)), @@ -403,6 +378,10 @@ void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) foreach (const QDBusObjectPath &apPath, wirelessDevice->getAccessPoints()) newAccessPoint(QString(), apPath); + + mutex.lock(); + wirelessDevices.insert(path.path(), wirelessDevice); + mutex.unlock(); } } @@ -611,7 +590,7 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec ptr->purpose = QNetworkConfiguration::PublicPurpose; } ptr->state = QNetworkConfiguration::Undefined; - ptr->bearer = QLatin1String("WLAN"); + ptr->bearerType = QNetworkConfiguration::BearerWLAN; accessPointConfigurations.insert(ptr->id, ptr); @@ -709,8 +688,6 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri const QString &settingsPath, const QNmSettingsMap &map) { - QMutexLocker locker(&mutex); - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; cpPriv->name = map.value("connection").value("id").toString(); cpPriv->isValid = true; @@ -724,7 +701,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri const QString connectionType = map.value("connection").value("type").toString(); if (connectionType == QLatin1String("802-3-ethernet")) { - cpPriv->bearer = QLatin1String("Ethernet"); + cpPriv->bearerType = QNetworkConfiguration::BearerEthernet; cpPriv->purpose = QNetworkConfiguration::PublicPurpose; foreach (const QDBusObjectPath &devicePath, interface->getDevices()) { @@ -739,7 +716,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri } } } else if (connectionType == QLatin1String("802-11-wireless")) { - cpPriv->bearer = QLatin1String("WLAN"); + cpPriv->bearerType = QNetworkConfiguration::BearerWLAN; const QString connectionSsid = map.value("802-11-wireless").value("ssid").toString(); const QString connectionSecurity = map.value("802-11-wireless").value("security").toString(); @@ -759,17 +736,17 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(accessPointId); - locker.unlock(); + mutex.unlock(); emit configurationRemoved(ptr); - locker.relock(); + mutex.lock(); } break; } } } else if (connectionType == "gsm") { - cpPriv->bearer = QLatin1String("2G"); + cpPriv->bearerType = QNetworkConfiguration::Bearer2G; } else if (connectionType == "cdma") { - cpPriv->bearer = QLatin1String("CDMA2000"); + cpPriv->bearerType = QNetworkConfiguration::BearerCDMA2000; } return cpPriv; @@ -777,8 +754,6 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const QString &id) const { - QMutexLocker locker(&mutex); - for (int i = 0; i < connections.count(); ++i) { QNetworkManagerSettingsConnection *connection = connections.at(i); const QString service = connection->connectionInterface()->service(); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 8e95a2c..78ebb0a 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -78,8 +78,6 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); - void connectToId(const QString &id); void disconnectFromId(const QString &id); @@ -118,8 +116,6 @@ private Q_SLOTS: void removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath); void updateAccessPoint(const QMap<QString, QVariant> &map); - void doRequestUpdate(); - private: QNetworkConfigurationPrivate *parseConnection(const QString &service, const QString &settingsPath, diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 31a9aa1..f47c97c 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -718,146 +718,80 @@ QNmSettingsMap QNetworkManagerSettingsConnection::getSettings() NMDeviceType QNetworkManagerSettingsConnection::getType() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("type")); - while (ii != innerMap.end() && ii.key() == QLatin1String("type")) { - QString devType = ii.value().toString(); - if (devType == QLatin1String("802-3-ethernet")) { - return DEVICE_TYPE_802_3_ETHERNET; - } - if (devType == QLatin1String("802-11-wireless")) { - return DEVICE_TYPE_802_11_WIRELESS; - } - ii++; - } - i++; - } - return DEVICE_TYPE_UNKNOWN; + const QString devType = + d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("type")).toString(); + + if (devType == QLatin1String("802-3-ethernet")) + return DEVICE_TYPE_802_3_ETHERNET; + else if (devType == QLatin1String("802-11-wireless")) + return DEVICE_TYPE_802_11_WIRELESS; + else + return DEVICE_TYPE_UNKNOWN; } bool QNetworkManagerSettingsConnection::isAutoConnect() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("autoconnect")); - while (ii != innerMap.end() && ii.key() == QLatin1String("autoconnect")) { - return ii.value().toBool(); - ii++; - } - i++; - } - return true; //default networkmanager is autoconnect + const QVariant autoConnect = + d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("autoconnect")); + + // NetworkManager default is to auto connect + if (!autoConnect.isValid()) + return true; + + return autoConnect.toBool(); } quint64 QNetworkManagerSettingsConnection::getTimestamp() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("timestamp")); - while (ii != innerMap.end() && ii.key() == QLatin1String("timestamp")) { - return ii.value().toUInt(); - ii++; - } - i++; - } - return 0; + qDebug() << d->settingsMap.value(QLatin1String("connection")); + + return d->settingsMap.value(QLatin1String("connection")) + .value(QLatin1String("timestamp")).toUInt(); } QString QNetworkManagerSettingsConnection::getId() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("id")); - while (ii != innerMap.end() && ii.key() == QLatin1String("id")) { - return ii.value().toString(); - ii++; - } - i++; - } - return QString(); + return d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("id")).toString(); } QString QNetworkManagerSettingsConnection::getUuid() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("uuid")); - while (ii != innerMap.end() && ii.key() == QLatin1String("uuid")) { - return ii.value().toString(); - ii++; - } - i++; - } + const QString id = d->settingsMap.value(QLatin1String("connection")) + .value(QLatin1String("uuid")).toString(); + // is no uuid, return the connection path - return d->connectionInterface->path(); + return id.isEmpty() ? d->connectionInterface->path() : id; } QString QNetworkManagerSettingsConnection::getSsid() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("ssid")); - while (ii != innerMap.end() && ii.key() == QLatin1String("ssid")) { - return ii.value().toString(); - ii++; - } - i++; - } - return QString(); + return d->settingsMap.value(QLatin1String("802-11-wireless")) + .value(QLatin1String("ssid")).toString(); } QString QNetworkManagerSettingsConnection::getMacAddress() { - if(getType() == DEVICE_TYPE_802_3_ETHERNET) { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-3-ethernet")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("802-3-ethernet")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("mac-address")); - while (ii != innerMap.end() && ii.key() == QLatin1String("mac-address")) { - return ii.value().toString(); - ii++; - } - i++; - } - } + NMDeviceType type = getType(); - else if(getType() == DEVICE_TYPE_802_11_WIRELESS) { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("mac-address")); - while (ii != innerMap.end() && ii.key() == QLatin1String("mac-address")) { - return ii.value().toString(); - ii++; - } - i++; - } + if (type == DEVICE_TYPE_802_3_ETHERNET) { + return d->settingsMap.value(QLatin1String("802-3-ethernet")) + .value(QLatin1String("mac-address")).toString(); + } else if (type == DEVICE_TYPE_802_11_WIRELESS) { + return d->settingsMap.value(QLatin1String("802-11-wireless")) + .value(QLatin1String("mac-address")).toString(); + } else { + return QString(); } - return QString(); -} - -QStringList QNetworkManagerSettingsConnection::getSeenBssids() -{ - if(getType() == DEVICE_TYPE_802_11_WIRELESS) { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("seen-bssids")); - while (ii != innerMap.end() && ii.key() == QLatin1String("seen-bssids")) { - return ii.value().toStringList(); - ii++; - } - i++; - } +} + +QStringList QNetworkManagerSettingsConnection::getSeenBssids() +{ + if (getType() == DEVICE_TYPE_802_11_WIRELESS) { + return d->settingsMap.value(QLatin1String("802-11-wireless")) + .value(QLatin1String("seen-bssids")).toStringList(); + } else { + return QStringList(); } - return QStringList(); } class QNetworkManagerConnectionActivePrivate diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 9ab9924..fd50099 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -119,7 +119,7 @@ static void printBlob(NLA_BLOB *blob) } #endif -static QString qGetInterfaceType(const QString &interface) +static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface) { #ifdef Q_OS_WINCE Q_UNUSED(interface) @@ -130,10 +130,10 @@ static QString qGetInterfaceType(const QString &interface) NDIS_MEDIUM medium; NDIS_PHYSICAL_MEDIUM physicalMedium; - HANDLE handle = CreateFile((TCHAR *)QString(QLatin1String("\\\\.\\%1")).arg(interface).utf16(), - 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + HANDLE handle = CreateFile((TCHAR *)QString::fromLatin1("\\\\.\\%1").arg(interface).utf16(), 0, + FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (handle == INVALID_HANDLE_VALUE) - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; oid = OID_GEN_MEDIA_SUPPORTED; bytesWritten = 0; @@ -141,7 +141,7 @@ static QString qGetInterfaceType(const QString &interface) &medium, sizeof(medium), &bytesWritten, 0); if (!result) { CloseHandle(handle); - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } oid = OID_GEN_PHYSICAL_MEDIUM; @@ -152,9 +152,9 @@ static QString qGetInterfaceType(const QString &interface) CloseHandle(handle); if (medium == NdisMedium802_3) - return QLatin1String("Ethernet"); + return QNetworkConfiguration::BearerEthernet; else - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } CloseHandle(handle); @@ -162,16 +162,16 @@ static QString qGetInterfaceType(const QString &interface) if (medium == NdisMedium802_3) { switch (physicalMedium) { case NdisPhysicalMediumWirelessLan: - return QLatin1String("WLAN"); + return QNetworkConfiguration::BearerWLAN; case NdisPhysicalMediumBluetooth: - return QLatin1String("Bluetooth"); + return QNetworkConfiguration::BearerBluetooth; case NdisPhysicalMediumWiMax: - return QLatin1String("WiMAX"); + return QNetworkConfiguration::BearerWiMAX; default: #ifdef BEARER_MANAGEMENT_DEBUG qDebug() << "Physical Medium" << physicalMedium; #endif - return QLatin1String("Ethernet"); + return QNetworkConfiguration::BearerEthernet; } } @@ -181,7 +181,7 @@ static QString qGetInterfaceType(const QString &interface) #endif - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } class QNlaThread : public QThread @@ -374,10 +374,9 @@ DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv #endif break; case NLA_CONNECTIVITY: - if (blob->data.connectivity.internet == NLA_INTERNET_YES) - cpPriv->internet = true; - else - cpPriv->internet = false; +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: unhandled header type NLA_CONNECTIVITY", __FUNCTION__); +#endif break; case NLA_ICS: #ifdef BEARER_MANAGEMENT_DEBUG @@ -438,8 +437,10 @@ QNetworkConfigurationPrivate *QNlaThread::parseQuerySet(const WSAQUERYSET *query } while (offset != 0 && offset < querySet->lpBlob->cbSize); } - if (QNlaEngine *engine = qobject_cast<QNlaEngine *>(parent())) - cpPriv->bearer = engine->bearerName(cpPriv->id); + if (QNlaEngine *engine = qobject_cast<QNlaEngine *>(parent())) { + const QString interface = engine->getInterfaceFromId(cpPriv->id); + cpPriv->bearerType = qGetInterfaceType(interface); + } return cpPriv; } @@ -586,16 +587,6 @@ bool QNlaEngine::hasIdentifier(const QString &id) return configurationInterface.contains(id.toUInt()); } -QString QNlaEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - if (interface.isEmpty()) - return QString(); - - return qGetInterfaceType(interface); -} - void QNlaEngine::connectToId(const QString &id) { emit connectionError(id, OperationNotSupported); diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 1d49464..69f54c9 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -85,8 +85,6 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); - void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/plugins/bearer/symbian/3_1/3_1.pro b/src/plugins/bearer/symbian/3_1/3_1.pro index 2d721a8..b7c6aef 100644 --- a/src/plugins/bearer/symbian/3_1/3_1.pro +++ b/src/plugins/bearer/symbian/3_1/3_1.pro @@ -1,5 +1,9 @@ include(../symbian.pri) -LIBS += -lapengine +is_using_gnupoc { + LIBS += -lapengine +} else { + LIBS += -lAPEngine +} TARGET = $${TARGET}_3_1 TARGET.UID3 = 0x2002131C diff --git a/src/plugins/bearer/symbian/symbian.pri b/src/plugins/bearer/symbian/symbian.pri index afe84dc..9b3f50c 100644 --- a/src/plugins/bearer/symbian/symbian.pri +++ b/src/plugins/bearer/symbian/symbian.pri @@ -14,8 +14,6 @@ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE symbian-abld:INCLUDEPATH += $$QT_BUILD_TREE/include/QtNetwork/private LIBS += -lcommdb \ - -lapsettingshandlerui \ - -lconnmon \ -lcentralrepository \ -lesock \ -linsock \ @@ -23,6 +21,14 @@ LIBS += -lcommdb \ -lefsrv \ -lnetmeta +is_using_gnupoc { + LIBS += -lconnmon \ + -lapsettingshandlerui +} else { + LIBS += -lConnMon \ + -lApSettingsHandlerUI +} + QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer INSTALLS += target diff --git a/src/plugins/bearer/symbian/symbian_3/symbian_3.pro b/src/plugins/bearer/symbian/symbian_3/symbian_3.pro index ff0f11c..fd66198 100644 --- a/src/plugins/bearer/symbian/symbian_3/symbian_3.pro +++ b/src/plugins/bearer/symbian/symbian_3/symbian_3.pro @@ -12,7 +12,11 @@ symbian { } } else { # Fall back to 3_1 implementation on platforms that do not have cmmanager - LIBS += -lapengine + is_using_gnupoc { + LIBS += -lapengine + } else { + LIBS += -lAPEngine + } } } diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 4bd6d2f..9593461 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -63,9 +63,9 @@ #include <cmpluginpacketdatadef.h> #include <cmplugindialcommondefs.h> #else - #include <apaccesspointitem.h> - #include <apdatahandler.h> - #include <aputils.h> + #include <ApAccessPointItem.h> + #include <ApDataHandler.h> + #include <ApUtils.h> #endif #ifndef QT_NO_BEARERMANAGEMENT @@ -75,7 +75,7 @@ QT_BEGIN_NAMESPACE static const int KUserChoiceIAPId = 0; SymbianNetworkConfigurationPrivate::SymbianNetworkConfigurationPrivate() -: bearer(BearerUnknown), numericId(0), connectionId(0) +: numericId(0), connectionId(0) { } @@ -83,32 +83,6 @@ SymbianNetworkConfigurationPrivate::~SymbianNetworkConfigurationPrivate() { } -QString SymbianNetworkConfigurationPrivate::bearerName() const -{ - QMutexLocker locker(&mutex); - - switch (bearer) { - case BearerEthernet: - return QLatin1String("Ethernet"); - case BearerWLAN: - return QLatin1String("WLAN"); - case Bearer2G: - return QLatin1String("2G"); - case BearerCDMA2000: - return QLatin1String("CDMA2000"); - case BearerWCDMA: - return QLatin1String("WCDMA"); - case BearerHSPA: - return QLatin1String("HSPA"); - case BearerBluetooth: - return QLatin1String("Bluetooth"); - case BearerWiMAX: - return QLatin1String("WiMAX"); - default: - return QString(); - } -} - SymbianEngine::SymbianEngine(QObject *parent) : QBearerEngine(parent), CActive(CActive::EPriorityHigh), iFirstUpdate(true), iInitOk(true), iUpdatePending(false) @@ -146,7 +120,7 @@ void SymbianEngine::initialize() SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; cpPriv->name = "UserChoice"; - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + cpPriv->bearerType = QNetworkConfiguration::BearerUnknown; cpPriv->state = QNetworkConfiguration::Discovered; cpPriv->isValid = true; cpPriv->id = QString::number(qHash(KUserChoiceIAPId)); @@ -517,25 +491,25 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL( TUint32 bearerId = connectionMethod.GetIntAttributeL(CMManager::ECmCommsDBBearerType); switch (bearerId) { case KCommDbBearerCSD: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + cpPriv->bearerType = QNetworkConfiguration::Bearer2G; break; case KCommDbBearerWcdma: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA; + cpPriv->bearerType = QNetworkConfiguration::BearerWCDMA; break; case KCommDbBearerLAN: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + cpPriv->bearerType = QNetworkConfiguration::BearerEthernet; break; case KCommDbBearerVirtual: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + cpPriv->bearerType = QNetworkConfiguration::BearerUnknown; break; case KCommDbBearerPAN: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + cpPriv->bearerType = QNetworkConfiguration::BearerUnknown; break; case KCommDbBearerWLAN: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerWLAN; + cpPriv->bearerType = QNetworkConfiguration::BearerWLAN; break; default: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + cpPriv->bearerType = QNetworkConfiguration::BearerUnknown; break; } @@ -619,28 +593,28 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL( apNetworkConfiguration->roamingSupported = false; switch (pAPItem->BearerTypeL()) { case EApBearerTypeCSD: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + apNetworkConfiguration->bearerType = QNetworkConfiguration::Bearer2G; break; case EApBearerTypeGPRS: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + apNetworkConfiguration->bearerType = QNetworkConfiguration::Bearer2G; break; case EApBearerTypeHSCSD: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerHSPA; break; case EApBearerTypeCDMA: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerCDMA2000; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerCDMA2000; break; case EApBearerTypeWLAN: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerWLAN; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerWLAN; break; case EApBearerTypeLAN: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerEthernet; break; case EApBearerTypeLANModem: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerEthernet; break; default: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerUnknown; break; } @@ -870,38 +844,38 @@ void SymbianEngine::updateMobileBearerToConfigs(TConnMonBearerInfo bearerInfo) SymbianNetworkConfigurationPrivate *p = toSymbianConfig(ptr); - if (p->bearer >= SymbianNetworkConfigurationPrivate::Bearer2G && - p->bearer <= SymbianNetworkConfigurationPrivate::BearerHSPA) { + if (p->bearerType >= QNetworkConfiguration::Bearer2G && + p->bearerType <= QNetworkConfiguration::BearerHSPA) { switch (bearerInfo) { case EBearerInfoCSD: - p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + p->bearerType = QNetworkConfiguration::Bearer2G; break; case EBearerInfoWCDMA: - p->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA; + p->bearerType = QNetworkConfiguration::BearerWCDMA; break; case EBearerInfoCDMA2000: - p->bearer = SymbianNetworkConfigurationPrivate::BearerCDMA2000; + p->bearerType = QNetworkConfiguration::BearerCDMA2000; break; case EBearerInfoGPRS: - p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + p->bearerType = QNetworkConfiguration::Bearer2G; break; case EBearerInfoHSCSD: - p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + p->bearerType = QNetworkConfiguration::Bearer2G; break; case EBearerInfoEdgeGPRS: - p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + p->bearerType = QNetworkConfiguration::Bearer2G; break; case EBearerInfoWcdmaCSD: - p->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA; + p->bearerType = QNetworkConfiguration::BearerWCDMA; break; case EBearerInfoHSDPA: - p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + p->bearerType = QNetworkConfiguration::BearerHSPA; break; case EBearerInfoHSUPA: - p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + p->bearerType = QNetworkConfiguration::BearerHSPA; break; case EBearerInfoHSxPA: - p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + p->bearerType = QNetworkConfiguration::BearerHSPA; break; } } diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index ecd858d..1fe6395 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -73,23 +73,9 @@ class AccessPointsAvailabilityScanner; class SymbianNetworkConfigurationPrivate : public QNetworkConfigurationPrivate { public: - enum Bearer { - BearerEthernet, - BearerWLAN, - Bearer2G, - BearerCDMA2000, - BearerWCDMA, - BearerHSPA, - BearerBluetooth, - BearerWiMAX, - BearerUnknown = -1 - }; - SymbianNetworkConfigurationPrivate(); ~SymbianNetworkConfigurationPrivate(); - QString bearerName() const; - inline TUint32 numericIdentifier() const { QMutexLocker locker(&mutex); @@ -110,8 +96,6 @@ public: QString mappingName; - Bearer bearer; - // So called IAP id from the platform. Remains constant as long as the // platform is aware of the configuration ie. it is stored in the databases // --> does not depend on whether connections are currently open or not. diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index e4a0135..d5f0d42 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -167,7 +167,6 @@ struct CachedImage static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB #endif -#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS || defined QT_DEBUG #define VOID_ARG() static_cast<bool>(false) enum PaintOperation { DRAW_RECTS = 0x0001, DRAW_LINES = 0x0002, DRAW_IMAGE = 0x0004, @@ -178,88 +177,81 @@ enum PaintOperation { DRAW_STATICTEXT = 0x8000, ALL = 0xffff }; -#ifdef QT_DEBUG -static void initRasterFallbacksMasks(int *warningMask, int *disableMask) -{ - struct { - const char *name; - PaintOperation operation; - } const operations[] = { - { "DRAW_RECTS", DRAW_RECTS }, - { "DRAW_LINES", DRAW_LINES }, - { "DRAW_IMAGE", DRAW_IMAGE }, - { "DRAW_PIXMAP", DRAW_PIXMAP }, - { "DRAW_TILED_PIXMAP", DRAW_TILED_PIXMAP }, - { "STROKE_PATH", STROKE_PATH }, - { "DRAW_PATH", DRAW_PATH }, - { "DRAW_POINTS", DRAW_POINTS }, - { "DRAW_ELLIPSE", DRAW_ELLIPSE }, - { "DRAW_POLYGON", DRAW_POLYGON }, - { "DRAW_TEXT", DRAW_TEXT }, - { "FILL_PATH", FILL_PATH }, - { "FILL_RECT", FILL_RECT }, - { "DRAW_COLORSPANS", DRAW_COLORSPANS }, - { "DRAW_ROUNDED_RECT", DRAW_ROUNDED_RECT }, - { "ALL", ALL }, - { 0, ALL } - }; - - QStringList warning = QString::fromLatin1(qgetenv("QT_DIRECTFB_WARN_ON_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'), - QString::SkipEmptyParts); - QStringList disable = QString::fromLatin1(qgetenv("QT_DIRECTFB_DISABLE_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'), - QString::SkipEmptyParts); - *warningMask = 0; - *disableMask = 0; - if (!warning.isEmpty() || !disable.isEmpty()) { - for (int i=0; operations[i].name; ++i) { - const QString name = QString::fromLatin1(operations[i].name); - int idx = warning.indexOf(name); - if (idx != -1) { - *warningMask |= operations[i].operation; - warning.erase(warning.begin() + idx); - } - idx = disable.indexOf(name); - if (idx != -1) { - *disableMask |= operations[i].operation; - disable.erase(disable.begin() + idx); - } - } - } - if (!warning.isEmpty()) { - qWarning("QDirectFBPaintEngine QT_DIRECTFB_WARN_ON_RASTERFALLBACKS Unknown operation(s): %s", - qPrintable(warning.join(QLatin1String("|")))); - } - if (!disable.isEmpty()) { - qWarning("QDirectFBPaintEngine QT_DIRECTFB_DISABLE_RASTERFALLBACKS Unknown operation(s): %s", - qPrintable(disable.join(QLatin1String("|")))); - } - -} -#endif - -static inline int rasterFallbacksMask(bool warn) +enum { RasterWarn = 1, RasterDisable = 2 }; +static inline uint rasterFallbacksMask(PaintOperation op) { + uint ret = 0; #ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS - if (warn) - return QT_DIRECTFB_WARN_ON_RASTERFALLBACKS; + if (op & QT_DIRECTFB_WARN_ON_RASTERFALLBACKS) + ret |= RasterWarn; #endif #ifdef QT_DIRECTFB_DISABLE_RASTERFALLBACKS - if (!warn) - return QT_DIRECTFB_DISABLE_RASTERFALLBACKS; + if (op & QT_DIRECTFB_DISABLE_RASTERFALLBACKS) + ret |= RasterDisable; #endif -#ifndef QT_DEBUG - return 0; -#else - static int warnMask = -1; + static int warningMask = -1; static int disableMask = -1; - if (warnMask == -1) - initRasterFallbacksMasks(&warnMask, &disableMask); - return warn ? warnMask : disableMask; -#endif + if (warningMask < 0) { + struct { + const char *name; + PaintOperation operation; + } const operations[] = { + { "DRAW_RECTS", DRAW_RECTS }, + { "DRAW_LINES", DRAW_LINES }, + { "DRAW_IMAGE", DRAW_IMAGE }, + { "DRAW_PIXMAP", DRAW_PIXMAP }, + { "DRAW_TILED_PIXMAP", DRAW_TILED_PIXMAP }, + { "STROKE_PATH", STROKE_PATH }, + { "DRAW_PATH", DRAW_PATH }, + { "DRAW_POINTS", DRAW_POINTS }, + { "DRAW_ELLIPSE", DRAW_ELLIPSE }, + { "DRAW_POLYGON", DRAW_POLYGON }, + { "DRAW_TEXT", DRAW_TEXT }, + { "FILL_PATH", FILL_PATH }, + { "FILL_RECT", FILL_RECT }, + { "DRAW_COLORSPANS", DRAW_COLORSPANS }, + { "DRAW_ROUNDED_RECT", DRAW_ROUNDED_RECT }, + { "ALL", ALL }, + { 0, ALL } + }; + + QStringList warning = QString::fromLatin1(qgetenv("QT_DIRECTFB_WARN_ON_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'), + QString::SkipEmptyParts); + QStringList disable = QString::fromLatin1(qgetenv("QT_DIRECTFB_DISABLE_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'), + QString::SkipEmptyParts); + warningMask = 0; + disableMask = 0; + if (!warning.isEmpty() || !disable.isEmpty()) { + for (int i=0; operations[i].name; ++i) { + const QString name = QString::fromLatin1(operations[i].name); + int idx = warning.indexOf(name); + if (idx != -1) { + warningMask |= operations[i].operation; + warning.erase(warning.begin() + idx); + } + idx = disable.indexOf(name); + if (idx != -1) { + disableMask |= operations[i].operation; + disable.erase(disable.begin() + idx); + } + } + } + if (!warning.isEmpty()) { + qWarning("QDirectFBPaintEngine QT_DIRECTFB_WARN_ON_RASTERFALLBACKS Unknown operation(s): %s", + qPrintable(warning.join(QLatin1String("|")))); + } + if (!disable.isEmpty()) { + qWarning("QDirectFBPaintEngine QT_DIRECTFB_DISABLE_RASTERFALLBACKS Unknown operation(s): %s", + qPrintable(disable.join(QLatin1String("|")))); + } + } + if (op & warningMask) + ret |= RasterWarn; + if (op & disableMask) + ret |= RasterDisable; + return ret; } -#endif -#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DEBUG template <typename device, typename T1, typename T2, typename T3> static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, uint transformationType, bool simplePen, @@ -267,16 +259,14 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * const char *nameOne, const T1 &one, const char *nameTwo, const T2 &two, const char *nameThree, const T3 &three); -#endif -#if defined QT_DEBUG || (defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS) #define RASTERFALLBACK(op, one, two, three) \ { \ - const bool disable = op & rasterFallbacksMask(false); \ - if (op & rasterFallbacksMask(true)) \ - rasterFallbackWarn(disable \ - ? "Disabled raster engine operation" \ - : "Falling back to raster engine for", \ + static const uint rasterFallbacks = rasterFallbacksMask(op); \ + switch (rasterFallbacks) { \ + case 0: break; \ + case RasterWarn: \ + rasterFallbackWarn("Falling back to raster engine for", \ __FUNCTION__, \ state()->painter->device(), \ d_func()->transformationType, \ @@ -284,26 +274,20 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * d_func()->clipType, \ d_func()->compositionModeStatus, \ #one, one, #two, two, #three, three); \ - if (disable) \ + break; \ + case RasterDisable|RasterWarn: \ + rasterFallbackWarn("Disabled raster engine operation", \ + __FUNCTION__, \ + state()->painter->device(), \ + d_func()->transformationType, \ + d_func()->simplePen, \ + d_func()->clipType, \ + d_func()->compositionModeStatus, \ + #one, one, #two, two, #three, three); \ + case RasterDisable: \ return; \ + } \ } -#elif defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS -#define RASTERFALLBACK(op, one, two, three) \ - if (op & rasterFallbacksMask(false)) \ - return; -#elif defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS -#define RASTERFALLBACK(op, one, two, three) \ - if (op & rasterFallbacksMask(true)) \ - rasterFallbackWarn("Falling back to raster engine for", \ - __FUNCTION__, state()->painter->device(), \ - d_func()->transformationType, \ - d_func()->simplePen, \ - d_func()->clipType, \ - d_func()->compositionModeStatus, \ - #one, one, #two, two, #three, three); -#else -#define RASTERFALLBACK(op, one, two, three) -#endif template <class T> static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface); @@ -1362,7 +1346,6 @@ static inline void drawRects(const T *rects, int n, const QTransform &transform, } } -#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DEBUG template <typename T> inline const T *ptr(const T &t) { return &t; } template <> inline const bool* ptr<bool>(const bool &) { return 0; } template <typename device, typename T1, typename T2, typename T3> @@ -1403,8 +1386,6 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * qWarning("%s", qPrintable(out)); } -#endif // QT_DIRECTFB_WARN_ON_RASTERFALLBACKS - QT_END_NAMESPACE #endif // QT_NO_QWS_DIRECTFB diff --git a/src/qt3support/widgets/q3gridview.cpp b/src/qt3support/widgets/q3gridview.cpp index 343b49f..b270a38 100644 --- a/src/qt3support/widgets/q3gridview.cpp +++ b/src/qt3support/widgets/q3gridview.cpp @@ -84,7 +84,7 @@ using namespace Qt; size in a potentially scrollable canvas. If you need rows and columns with different sizes, use a Q3Table instead. If you need a simple list of items, use a Q3ListBox. If you need to present - hierachical data use a Q3ListView, and if you need random objects + hierarichal data use a Q3ListView, and if you need random objects at random positions, consider using either a Q3IconView or a Q3Canvas. */ diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index 480d9ff..bc6d0aa 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -1684,4 +1684,5 @@ EXPORTS ?rootContext@QDeclarativeView@@QBEPAVQDeclarativeContext@@XZ @ 1683 NONAME ; class QDeclarativeContext * QDeclarativeView::rootContext(void) const ?rootContext@QDeclarativeEngine@@QBEPAVQDeclarativeContext@@XZ @ 1684 NONAME ; class QDeclarativeContext * QDeclarativeEngine::rootContext(void) const ?qmlregister@QDeclarativePrivate@@YAHW4RegistrationType@1@PAX@Z @ 1685 NONAME ; int QDeclarativePrivate::qmlregister(enum QDeclarativePrivate::RegistrationType, void *) + ?hasValue@QDeclarativeOpenMetaObject@@QBE_NH@Z @ 1686 NONAME ; bool QDeclarativeOpenMetaObject::hasValue(int) const diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 7844688..21a2122 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -4148,7 +4148,7 @@ EXPORTS ?ensureSceneTransformRecursive@QGraphicsItemPrivate@@QAEXPAPAVQGraphicsItem@@@Z @ 4147 NONAME ; void QGraphicsItemPrivate::ensureSceneTransformRecursive(class QGraphicsItem * *) ?ensureSequentialSiblingIndex@QGraphicsItemPrivate@@QAEXXZ @ 4148 NONAME ; void QGraphicsItemPrivate::ensureSequentialSiblingIndex(void) ?ensureSortedChildren@QGraphicsItemPrivate@@QAEXXZ @ 4149 NONAME ; void QGraphicsItemPrivate::ensureSortedChildren(void) - ?ensureSpace@QTextEngine@@QBEXH@Z @ 4150 NONAME ; void QTextEngine::ensureSpace(int) const + ?ensureSpace@QTextEngine@@QBEXH@Z @ 4150 NONAME ABSENT ; void QTextEngine::ensureSpace(int) const ?ensureVisible@QGraphicsItem@@QAEXABVQRectF@@HH@Z @ 4151 NONAME ; void QGraphicsItem::ensureVisible(class QRectF const &, int, int) ?ensureVisible@QGraphicsItem@@QAEXMMMMHH@Z @ 4152 NONAME ; void QGraphicsItem::ensureVisible(float, float, float, float, int, int) ?ensureVisible@QGraphicsView@@QAEXABVQRectF@@HH@Z @ 4153 NONAME ; void QGraphicsView::ensureVisible(class QRectF const &, int, int) @@ -12832,7 +12832,7 @@ EXPORTS ?readBackInfo@QRuntimePixmapData@@QAEXXZ @ 12831 NONAME ; void QRuntimePixmapData::readBackInfo(void) ??_EQRuntimePixmapData@@UAE@I@Z @ 12832 NONAME ; QRuntimePixmapData::~QRuntimePixmapData(unsigned int) ?paintEngine@QRuntimePixmapData@@UBEPAVQPaintEngine@@XZ @ 12833 NONAME ; class QPaintEngine * QRuntimePixmapData::paintEngine(void) const - ?memoryUsage@QRuntimePixmapData@@UBEIXZ @ 12834 NONAME ; unsigned int QRuntimePixmapData::memoryUsage(void) const + ?memoryUsage@QRuntimePixmapData@@UBEIXZ @ 12834 NONAME ABSENT ; unsigned int QRuntimePixmapData::memoryUsage(void) const ?toImage@QRasterPixmapData@@UBE?AVQImage@@ABVQRect@@@Z @ 12835 NONAME ; class QImage QRasterPixmapData::toImage(class QRect const &) const ?fromImageReader@QRasterPixmapData@@UAEXPAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12836 NONAME ; void QRasterPixmapData::fromImageReader(class QImageReader *, class QFlags<enum Qt::ImageConversionFlag>) ?fill@QRuntimePixmapData@@UAEXABVQColor@@@Z @ 12837 NONAME ; void QRuntimePixmapData::fill(class QColor const &) @@ -12886,4 +12886,6 @@ EXPORTS ?zScaleChanged@QGraphicsScale@@IAEXXZ @ 12885 NONAME ; void QGraphicsScale::zScaleChanged(void) ?xScaleChanged@QGraphicsScale@@IAEXXZ @ 12886 NONAME ; void QGraphicsScale::xScaleChanged(void) ?yScaleChanged@QGraphicsScale@@IAEXXZ @ 12887 NONAME ; void QGraphicsScale::yScaleChanged(void) + ?_q_aboutToQuit@QApplicationPrivate@@QAEXXZ @ 12888 NONAME ; void QApplicationPrivate::_q_aboutToQuit(void) + ?ensureSpace@QTextEngine@@QBE_NH@Z @ 12889 NONAME ; bool QTextEngine::ensureSpace(int) const diff --git a/src/s60installs/bwins/QtNetworku.def b/src/s60installs/bwins/QtNetworku.def index 48af60c..2cf62a8 100644 --- a/src/s60installs/bwins/QtNetworku.def +++ b/src/s60installs/bwins/QtNetworku.def @@ -1143,4 +1143,6 @@ EXPORTS ?setNetworkAccessible@QNetworkAccessManager@@QAEXW4NetworkAccessibility@1@@Z @ 1142 NONAME ; void QNetworkAccessManager::setNetworkAccessible(enum QNetworkAccessManager::NetworkAccessibility) ??_EQBearerEngineFactoryInterface@@UAE@I@Z @ 1143 NONAME ; QBearerEngineFactoryInterface::~QBearerEngineFactoryInterface(unsigned int) ?enablePolling@QNetworkConfigurationManagerPrivate@@QAEXXZ @ 1144 NONAME ; void QNetworkConfigurationManagerPrivate::enablePolling(void) + ?bearerTypeName@QNetworkConfiguration@@QBE?AVQString@@XZ @ 1145 NONAME ; class QString QNetworkConfiguration::bearerTypeName(void) const + ?bearerType@QNetworkConfiguration@@QBE?AW4BearerType@1@XZ @ 1146 NONAME ; enum QNetworkConfiguration::BearerType QNetworkConfiguration::bearerType(void) const diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 9a3cefa..723f2ae 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -1714,4 +1714,5 @@ EXPORTS _ZNK16QDeclarativeView6engineEv @ 1713 NONAME _ZNK18QDeclarativeEngine11rootContextEv @ 1714 NONAME _ZN19QDeclarativePrivate11qmlregisterENS_16RegistrationTypeEPv @ 1715 NONAME + _ZNK26QDeclarativeOpenMetaObject8hasValueEi @ 1716 NONAME diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index a22b4d9..c4ad848 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12046,7 +12046,7 @@ EXPORTS _ZN18QRuntimePixmapDataD1Ev @ 12045 NONAME _ZN18QRuntimePixmapDataD2Ev @ 12046 NONAME _ZN7QPixmap15fromImageReaderEP12QImageReader6QFlagsIN2Qt19ImageConversionFlagEE @ 12047 NONAME - _ZNK18QRuntimePixmapData11memoryUsageEv @ 12048 NONAME + _ZNK18QRuntimePixmapData11memoryUsageEv @ 12048 NONAME ABSENT _ZNK18QRuntimePixmapData11paintEngineEv @ 12049 NONAME _ZNK18QRuntimePixmapData11runtimeDataEv @ 12050 NONAME _ZNK18QRuntimePixmapData11transformedERK10QTransformN2Qt18TransformationModeE @ 12051 NONAME @@ -12091,4 +12091,5 @@ EXPORTS _ZN14QGraphicsScale13xScaleChangedEv @ 12090 NONAME _ZN14QGraphicsScale13yScaleChangedEv @ 12091 NONAME _ZN14QGraphicsScale13zScaleChangedEv @ 12092 NONAME + _ZN19QApplicationPrivate14_q_aboutToQuitEv @ 12093 NONAME diff --git a/src/s60installs/eabi/QtNetworku.def b/src/s60installs/eabi/QtNetworku.def index eb30832..6b34a19 100644 --- a/src/s60installs/eabi/QtNetworku.def +++ b/src/s60installs/eabi/QtNetworku.def @@ -1131,7 +1131,7 @@ EXPORTS _ZNK21QNetworkAccessManager13configurationEv @ 1130 NONAME _ZNK21QNetworkAccessManager17networkAccessibleEv @ 1131 NONAME _ZNK21QNetworkAccessManager19activeConfigurationEv @ 1132 NONAME - _ZNK21QNetworkConfiguration10bearerNameEv @ 1133 NONAME + _ZNK21QNetworkConfiguration10bearerNameEv @ 1133 NONAME ABSENT _ZNK21QNetworkConfiguration10identifierEv @ 1134 NONAME _ZNK21QNetworkConfiguration18isRoamingAvailableEv @ 1135 NONAME _ZNK21QNetworkConfiguration4nameEv @ 1136 NONAME @@ -1167,4 +1167,6 @@ EXPORTS _ZN14QAuthenticator9setOptionERK7QStringRK8QVariant @ 1166 NONAME _ZNK14QAuthenticator6optionERK7QString @ 1167 NONAME _ZNK14QAuthenticator7optionsEv @ 1168 NONAME + _ZNK21QNetworkConfiguration10bearerTypeEv @ 1169 NONAME + _ZNK21QNetworkConfiguration14bearerTypeNameEv @ 1170 NONAME diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp index 1a11100..abaf5f9 100644 --- a/src/script/api/qscriptcontext.cpp +++ b/src/script/api/qscriptcontext.cpp @@ -324,7 +324,7 @@ QScriptValue QScriptContext::argumentsObject() const When a function is called as constructor, the thisObject() contains the newly constructed object to be initialized. - \note This function is only guarenteed to work for a context + \note This function is only guaranteed to work for a context corresponding to native functions. */ bool QScriptContext::isCalledAsConstructor() const diff --git a/src/script/bridge/qscriptactivationobject.cpp b/src/script/bridge/qscriptactivationobject.cpp index 6a8ae56..85224d1 100644 --- a/src/script/bridge/qscriptactivationobject.cpp +++ b/src/script/bridge/qscriptactivationobject.cpp @@ -53,7 +53,7 @@ QScriptActivationObject::QScriptActivationObject(JSC::ExecState *callFrame, JSC: QScriptActivationObject::~QScriptActivationObject() { - delete d; + delete d_ptr(); } bool QScriptActivationObject::getOwnPropertySlot(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertySlot& slot) diff --git a/src/script/bridge/qscriptstaticscopeobject.cpp b/src/script/bridge/qscriptstaticscopeobject.cpp index 44548a4..940c859 100644 --- a/src/script/bridge/qscriptstaticscopeobject.cpp +++ b/src/script/bridge/qscriptstaticscopeobject.cpp @@ -87,7 +87,7 @@ QScriptStaticScopeObject::QScriptStaticScopeObject(WTF::NonNullPassRefPtr<JSC::S QScriptStaticScopeObject::~QScriptStaticScopeObject() { - delete d; + delete d_ptr(); } bool QScriptStaticScopeObject::getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot& slot) diff --git a/src/sql/drivers/tds/qsql_tds.pri b/src/sql/drivers/tds/qsql_tds.pri index c552ead..037f793 100644 --- a/src/sql/drivers/tds/qsql_tds.pri +++ b/src/sql/drivers/tds/qsql_tds.pri @@ -1,8 +1,10 @@ HEADERS += $$PWD/qsql_tds.h SOURCES += $$PWD/qsql_tds.cpp -unix { +unix|win32-g++: { + !isEmpty(QT_LFLAGS_TDS):!static:LIBS *= $$QT_LFLAGS_TDS !contains(LIBS, .*sybdb.*):LIBS += -lsybdb + QMAKE_CXXFLAGS *= $$QT_CFLAGS_TDS } else:win32-borland { LIBS *= $(BCB)/lib/PSDK/NTWDBLIB.LIB } else { diff --git a/src/src.pro b/src/src.pro index 6118622..9712e09 100644 --- a/src/src.pro +++ b/src/src.pro @@ -114,6 +114,7 @@ src_webkit_declarative.target = sub-webkitdeclarative src_declarative.depends = src_gui src_script src_network src_plugins.depends = src_gui src_sql src_svg src_multimedia src_s60installs.depends = $$TOOLS_SUBDIRS $$SRC_SUBDIRS + src_s60installs.depends -= src_s60installs src_imports.depends = src_gui src_declarative contains(QT_CONFIG, webkit) { src_webkit.depends = src_gui src_sql src_network diff --git a/src/testlib/qtestfilelogger.cpp b/src/testlib/qtestfilelogger.cpp index a5cdc80..9d1ee6a 100644 --- a/src/testlib/qtestfilelogger.cpp +++ b/src/testlib/qtestfilelogger.cpp @@ -44,6 +44,8 @@ #include "QtTest/private/qtestlog_p.h" #include "QtTest/private/qtestresult_p.h" +#include <QtCore/qdir.h> + #include <stdlib.h> #include <stdio.h> @@ -69,11 +71,19 @@ QTestFileLogger::~QTestFileLogger() void QTestFileLogger::init() { char filename[100]; + int index = 0; +#if defined(Q_OS_SYMBIAN) + QByteArray ba(QDir::toNativeSeparators(QString(QDir::homePath()+QDir::separator())).toUtf8()); + index = ba.length(); + QTest::qt_snprintf(filename, sizeof(filename), "%s%s.log", + ba.constData(), QTestResult::currentTestObjectName()); +#else QTest::qt_snprintf(filename, sizeof(filename), "%s.log", QTestResult::currentTestObjectName()); - - // Keep filenames simple - for (uint i = 0; i < sizeof(filename) && filename[i]; ++i) { +#endif + + // Keep filenames simple + for (uint i = index; i < sizeof(filename) && filename[i]; ++i) { char& c = filename[i]; if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '.')) { diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 84d1567..ac49d65 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1211,7 +1211,7 @@ bool Moc::until(Token target) { //when searching commas within the default argument, we should take care of template depth (anglecount) // unfortunatelly, we do not have enough semantic information to know if '<' is the operator< or - // the begining of a template type. so we just use heuristics. + // the beginning of a template type. so we just use heuristics. int possible = -1; while (index < symbols.size()) { diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 1267e7e..662c796 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -7418,8 +7418,10 @@ bool QDomHandler::startElement(const QString& nsURI, const QString&, const QStri n = doc->createElement(qName); } - if (n) - n->setLocation(locator->lineNumber(), locator->columnNumber()); + if (!n) + return false; + + n->setLocation(locator->lineNumber(), locator->columnNumber()); node->appendChild(n); node = n; diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp index 7f2ad9f..0f9760d 100644 --- a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp +++ b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp @@ -1355,7 +1355,7 @@ bool QXmlItem::isNull() const QAbstractXmlNodeModel for its existence, the only way you can create an instance of QXmlNodeModelIndex is by asking the node model to create one for you with QAbstractXmlNodeModel::createIndex(). Since - that function is protected, it is usually a good ide to write a + that function is protected, it is usually a good idea to write a public function that creates a QXmlNodeModelIndex from arguments that are appropriate for your particular node model. diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp index e106d74..55af49b 100644 --- a/src/xmlpatterns/api/qxmlquery.cpp +++ b/src/xmlpatterns/api/qxmlquery.cpp @@ -151,8 +151,8 @@ QT_BEGIN_NAMESPACE \endcode \note For the current release, XSLT support should be considered - experimental. See section \l{Using XML technologies#XSLT - 2.0}{XSLT conformance} for details. + experimental. See section \l{XQuery#XSLT 2.0} {XSLT conformance} for + details. Stylesheet parameters are bound using bindVariable(). @@ -291,8 +291,7 @@ QXmlQuery::QXmlQuery(const QXmlNamePool &np) : d(new QXmlQueryPrivate(np)) create instances of QXmlQuery for running XQueries. \note The XSL-T support in this release is considered experimental. - See the \l{Using XML technologies#XSLT 2.0}{XSLT conformance} for - details. + See the \l{XQuery#XSLT 2.0} {XSLT conformance} for details. \since 4.5 \sa queryLanguage() diff --git a/src/xmlpatterns/data/qabstractdatetime.cpp b/src/xmlpatterns/data/qabstractdatetime.cpp index 6329fbe..a298698 100644 --- a/src/xmlpatterns/data/qabstractdatetime.cpp +++ b/src/xmlpatterns/data/qabstractdatetime.cpp @@ -163,7 +163,7 @@ QDateTime AbstractDateTime::create(AtomicValue::Ptr &errorMessage, QString msecondsStr(getSafeCapt(mseconds)); if(!msecondsStr.isEmpty()) - msecondsStr = msecondsStr.leftJustified(3, QLatin1Char('0')); + msecondsStr = msecondsStr.leftJustified(3, QLatin1Char('0'), true); const MSecondProperty msecs = msecondsStr.toInt(); if(hour == 24) |