diff options
author | Liang Qi <liang.qi@nokia.com> | 2011-05-27 13:25:50 (GMT) |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2011-05-27 13:25:50 (GMT) |
commit | 9e4ded47bc9e3fed3ee2a15e572603bb3f7b48fc (patch) | |
tree | 09a609ee6f560390d7385e524421d16d6d43f083 | |
parent | c09b481edd82942cdc85d138c2160004bd71a54e (diff) | |
parent | 271a96f201ebcd346bb532e207c1d0e465f89584 (diff) | |
download | Qt-9e4ded47bc9e3fed3ee2a15e572603bb3f7b48fc.zip Qt-9e4ded47bc9e3fed3ee2a15e572603bb3f7b48fc.tar.gz Qt-9e4ded47bc9e3fed3ee2a15e572603bb3f7b48fc.tar.bz2 |
Merge branch '4.8' into qt-4.8-from-4.7
Conflicts:
src/s60installs/bwins/QtGuiu.def
src/s60installs/bwins/QtOpenGLu.def
77 files changed, 1560 insertions, 1133 deletions
diff --git a/dist/changes-4.8.0 b/dist/changes-4.8.0 index b8cc626..1703633 100644 --- a/dist/changes-4.8.0 +++ b/dist/changes-4.8.0 @@ -39,12 +39,29 @@ QtCore - Removed support for QT_NO_THREAD define for QHostInfo. - Optimized plugin loading on ELF platforms. Print failure reason at runtime with QT_DEBUG_PLUGINS=1 in environment. + - QMutexLocker: improved performence of the non contended case by inlining some function + - QThreadStorage: Added possibility to store object by value instead of by pointer [QTBUG-15033] + - QThread: fixed few race conditions [QTBUG-17257, QTBUG-15030] + - QtConcurrent: added support for c++0x lambda in few functions + - QObject: Improved performence of the signal activation + - QObject: added ways to connect signals using QMetaMethod + - QObject: deprecated qFindChild and qFindChildren + - QObject: optimize constructions and destruction of objects + - QObject: Qt::BlockingQueuedConnection can handle the return value [QTBUG-10440] + - QList/QVector/QStringList: added C++0x initilizer lists constructors. + - QVarLenghtArray: added method for consistency with QVector + - QStringBuilder: added support for QByteArray + - qSwap now uses std::swap, specialized std::swap for our container to work better with stl algoritms + - QVariant: deprecated global function qVariantSetValue, qVariantValue, qVariantCanConvert, qVariantFromValue QtGui ----- - QTabBar: reduced minimumSizeHint if ElideMode is set. - QComboBox: Fixed a color propagation issue with the lineedit. [QTBUG-5950] + - Deprecate qGenericMatrixFromMatrix4x4 and qGenericMatrixToMatrix4x4 + - QListView diverses optimisations [QTBUG-11438] + - QTreeWidget/QListWidget: use localeAwareCompare for string comparisons [QTBUG-10839] QtOpenGL -------- @@ -54,6 +71,10 @@ QtGui - Including <QtOpenGL> will not work in combination with GLEW, as QGLFunctions will undefine GLEW's defines. +QtScript +-------- + - Deprecated qScriptValueFromQMetaObject, qScriptValueToValue, qScriptValueFromValue + **************************************************************************** * Database Drivers * @@ -136,6 +157,7 @@ Qt for Windows CE - qtconfig + * removed Qt3support dependency - qt3to4 diff --git a/examples/declarative/keyinteraction/focus/Core/GridMenu.qml b/examples/declarative/keyinteraction/focus/Core/GridMenu.qml index f3894fb..224d38b 100644 --- a/examples/declarative/keyinteraction/focus/Core/GridMenu.qml +++ b/examples/declarative/keyinteraction/focus/Core/GridMenu.qml @@ -86,7 +86,7 @@ FocusScope { hoverEnabled: true onClicked: { - GridView.view.currentIndex = index + container.GridView.view.currentIndex = index container.forceActiveFocus() } } diff --git a/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml b/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml index 88c3624..8f9d022 100644 --- a/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml +++ b/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml @@ -68,7 +68,7 @@ Item { hoverEnabled: true onClicked: { - ListView.view.currentIndex = index + container.ListView.view.currentIndex = index container.forceActiveFocus() } } diff --git a/src/corelib/concurrent/qtconcurrentcompilertest.h b/src/corelib/concurrent/qtconcurrentcompilertest.h index 884badb..c139c7a 100644 --- a/src/corelib/concurrent/qtconcurrentcompilertest.h +++ b/src/corelib/concurrent/qtconcurrentcompilertest.h @@ -57,6 +57,20 @@ QT_MODULE(Core) # define QT_TYPENAME typename #endif +namespace QtPrivate { + +template<class T> +class HasResultType { + typedef char Yes; + typedef void *No; + template<typename U> static Yes test(int, const typename U::result_type * = 0); + template<typename U> static No test(double); +public: + enum { Value = (sizeof(test<T>(0)) == sizeof(Yes)) }; +}; + +} + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h index a79ad1c..4bf2736 100644 --- a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h +++ b/src/corelib/concurrent/qtconcurrentfunctionwrappers.h @@ -195,17 +195,10 @@ QtConcurrent::ConstMemberFunctionWrapper<T, C> createFunctionWrapper(T (C::*func return QtConcurrent::ConstMemberFunctionWrapper<T, C>(func); } - -template<typename T> -void *lazyResultType_helper(int, typename T::result_type * = 0); -template<typename T> -char lazyResultType_helper(double); - -template <typename Functor, bool foo = sizeof(lazyResultType_helper<Functor>(0)) != sizeof(void*)> +template <typename Functor, bool foo = HasResultType<Functor>::Value> struct LazyResultType { typedef typename Functor::result_type Type; }; template <typename Functor> -struct LazyResultType<Functor, true> { typedef void Type; }; - +struct LazyResultType<Functor, false> { typedef void Type; }; template <class T> struct ReduceResultType; diff --git a/src/corelib/concurrent/qtconcurrentrun.h b/src/corelib/concurrent/qtconcurrentrun.h index 8611fba..ef51b2a 100644 --- a/src/corelib/concurrent/qtconcurrentrun.h +++ b/src/corelib/concurrent/qtconcurrentrun.h @@ -71,63 +71,114 @@ namespace QtConcurrent { template <typename T> QFuture<T> run(T (*functionPointer)()) { - return (new QT_TYPENAME SelectStoredFunctorCall0<T, T (*)()>::type(functionPointer))->start(); + return (new StoredFunctorCall0<T, T (*)()>(functionPointer))->start(); } template <typename T, typename Param1, typename Arg1> QFuture<T> run(T (*functionPointer)(Param1), const Arg1 &arg1) { - return (new QT_TYPENAME SelectStoredFunctorCall1<T, T (*)(Param1), Arg1>::type(functionPointer, arg1))->start(); + return (new StoredFunctorCall1<T, T (*)(Param1), Arg1>(functionPointer, arg1))->start(); } template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2> QFuture<T> run(T (*functionPointer)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2) { - return (new QT_TYPENAME SelectStoredFunctorCall2<T, T (*)(Param1, Param2), Arg1, Arg2>::type(functionPointer, arg1, arg2))->start(); + return (new StoredFunctorCall2<T, T (*)(Param1, Param2), Arg1, Arg2>(functionPointer, arg1, arg2))->start(); } template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3> QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) { - return (new QT_TYPENAME SelectStoredFunctorCall3<T, T (*)(Param1, Param2, Param3), Arg1, Arg2, Arg3>::type(functionPointer, arg1, arg2, arg3))->start(); + return (new StoredFunctorCall3<T, T (*)(Param1, Param2, Param3), Arg1, Arg2, Arg3>(functionPointer, arg1, arg2, arg3))->start(); } template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4> QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) { - return (new QT_TYPENAME SelectStoredFunctorCall4<T, T (*)(Param1, Param2, Param3, Param4), Arg1, Arg2, Arg3, Arg4>::type(functionPointer, arg1, arg2, arg3, arg4))->start(); + return (new StoredFunctorCall4<T, T (*)(Param1, Param2, Param3, Param4), Arg1, Arg2, Arg3, Arg4>(functionPointer, arg1, arg2, arg3, arg4))->start(); } template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5> QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3, Param4, Param5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) { - return (new QT_TYPENAME SelectStoredFunctorCall5<T, T (*)(Param1, Param2, Param3, Param4, Param5), Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionPointer, arg1, arg2, arg3, arg4, arg5))->start(); + return (new StoredFunctorCall5<T, T (*)(Param1, Param2, Param3, Param4, Param5), Arg1, Arg2, Arg3, Arg4, Arg5>(functionPointer, arg1, arg2, arg3, arg4, arg5))->start(); } +#ifdef Q_COMPILER_DECLTYPE + +template <typename Functor> +auto run(Functor functor) -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor())> >::Type +{ + typedef decltype(functor()) result_type; + return (new StoredFunctorCall0<result_type, Functor>(functor))->start(); +} + +template <typename Functor, typename Arg1> +auto run(Functor functor, const Arg1 &arg1) + -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1))> >::Type +{ + typedef decltype(functor(arg1)) result_type; + return (new StoredFunctorCall1<result_type, Functor, Arg1>(functor, arg1))->start(); +} + +template <typename Functor, typename Arg1, typename Arg2> +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2) + -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2))> >::Type +{ + typedef decltype(functor(arg1, arg2)) result_type; + return (new StoredFunctorCall2<result_type, Functor, Arg1, Arg2>(functor, arg1, arg2))->start(); +} + +template <typename Functor, typename Arg1, typename Arg2, typename Arg3> +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) + -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3))> >::Type +{ + typedef decltype(functor(arg1, arg2, arg3)) result_type; + return (new StoredFunctorCall3<result_type, Functor, Arg1, Arg2, Arg3>(functor, arg1, arg2, arg3))->start(); +} + +template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) + -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4))> >::Type +{ + typedef decltype(functor(arg1, arg2, arg3, arg4)) result_type; + return (new StoredFunctorCall4<result_type, Functor, Arg1, Arg2, Arg3, Arg4>(functor, arg1, arg2, arg3, arg4))->start(); +} + +template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) + -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4, arg5))> >::Type +{ + typedef decltype(functor(arg1, arg2, arg3, arg4, arg5)) result_type; + return (new StoredFunctorCall5<result_type, Functor, Arg1, Arg2, Arg3, Arg4, Arg5>(functor, arg1, arg2, arg3, arg4, arg5))->start(); +} + +#endif + template <typename FunctionObject> QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject) { - return (new QT_TYPENAME SelectStoredFunctorCall0<QT_TYPENAME FunctionObject::result_type, FunctionObject>::type(functionObject))->start(); + return (new StoredFunctorCall0<QT_TYPENAME FunctionObject::result_type, FunctionObject>(functionObject))->start(); } template <typename FunctionObject, typename Arg1> QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1) { - return (new QT_TYPENAME SelectStoredFunctorCall1<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1>::type(functionObject, arg1))->start(); + return (new StoredFunctorCall1<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1>(functionObject, arg1))->start(); } template <typename FunctionObject, typename Arg1, typename Arg2> QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2) { - return (new QT_TYPENAME SelectStoredFunctorCall2<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2>::type(functionObject, arg1, arg2))->start(); + return (new StoredFunctorCall2<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2>(functionObject, arg1, arg2))->start(); } template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3> QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) { - return (new QT_TYPENAME SelectStoredFunctorCall3<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>::type(functionObject, arg1, arg2, arg3))->start(); + return (new StoredFunctorCall3<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>(functionObject, arg1, arg2, arg3))->start(); } template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4> QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) { - return (new QT_TYPENAME SelectStoredFunctorCall4<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>::type(functionObject, arg1, arg2, arg3, arg4))->start(); + return (new StoredFunctorCall4<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>(functionObject, arg1, arg2, arg3, arg4))->start(); } template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) { - return (new QT_TYPENAME SelectStoredFunctorCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionObject, arg1, arg2, arg3, arg4, arg5))->start(); + return (new StoredFunctorCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>(functionObject, arg1, arg2, arg3, arg4, arg5))->start(); } template <typename FunctionObject> diff --git a/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h b/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h index c61f9b8..9beb0b9 100644 --- a/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h +++ b/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h @@ -66,10 +66,10 @@ struct StoredFunctorCall0: public RunFunctionTask<T> }; -template <typename T, typename FunctionPointer> -struct VoidStoredFunctorCall0: public RunFunctionTask<T> +template <typename FunctionPointer> +struct StoredFunctorCall0<void, FunctionPointer>: public RunFunctionTask<void> { - inline VoidStoredFunctorCall0(FunctionPointer _function) + inline StoredFunctorCall0(FunctionPointer _function) : function(_function) {} void runFunctor() { function(); } FunctionPointer function; @@ -77,13 +77,6 @@ struct VoidStoredFunctorCall0: public RunFunctionTask<T> }; template <typename T, typename FunctionPointer> -struct SelectStoredFunctorCall0 -{ - typedef typename SelectSpecialization<T>::template - Type<StoredFunctorCall0 <T, FunctionPointer>, - VoidStoredFunctorCall0<T, FunctionPointer> >::type type; -}; -template <typename T, typename FunctionPointer> struct StoredFunctorPointerCall0: public RunFunctionTask<T> { inline StoredFunctorPointerCall0(FunctionPointer * _function) @@ -276,10 +269,10 @@ struct StoredFunctorCall1: public RunFunctionTask<T> Arg1 arg1; }; -template <typename T, typename FunctionPointer, typename Arg1> -struct VoidStoredFunctorCall1: public RunFunctionTask<T> +template <typename FunctionPointer, typename Arg1> +struct StoredFunctorCall1<void, FunctionPointer, Arg1>: public RunFunctionTask<void> { - inline VoidStoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1) + inline StoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1) : function(_function), arg1(_arg1) {} void runFunctor() { function(arg1); } FunctionPointer function; @@ -287,13 +280,6 @@ struct VoidStoredFunctorCall1: public RunFunctionTask<T> }; template <typename T, typename FunctionPointer, typename Arg1> -struct SelectStoredFunctorCall1 -{ - typedef typename SelectSpecialization<T>::template - Type<StoredFunctorCall1 <T, FunctionPointer, Arg1>, - VoidStoredFunctorCall1<T, FunctionPointer, Arg1> >::type type; -}; -template <typename T, typename FunctionPointer, typename Arg1> struct StoredFunctorPointerCall1: public RunFunctionTask<T> { inline StoredFunctorPointerCall1(FunctionPointer * _function, const Arg1 &_arg1) @@ -486,10 +472,10 @@ struct StoredFunctorCall2: public RunFunctionTask<T> Arg1 arg1; Arg2 arg2; }; -template <typename T, typename FunctionPointer, typename Arg1, typename Arg2> -struct VoidStoredFunctorCall2: public RunFunctionTask<T> +template <typename FunctionPointer, typename Arg1, typename Arg2> +struct StoredFunctorCall2<void, FunctionPointer, Arg1, Arg2>: public RunFunctionTask<void> { - inline VoidStoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2) + inline StoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2) : function(_function), arg1(_arg1), arg2(_arg2) {} void runFunctor() { function(arg1, arg2); } FunctionPointer function; @@ -497,13 +483,6 @@ struct VoidStoredFunctorCall2: public RunFunctionTask<T> }; template <typename T, typename FunctionPointer, typename Arg1, typename Arg2> -struct SelectStoredFunctorCall2 -{ - typedef typename SelectSpecialization<T>::template - Type<StoredFunctorCall2 <T, FunctionPointer, Arg1, Arg2>, - VoidStoredFunctorCall2<T, FunctionPointer, Arg1, Arg2> >::type type; -}; -template <typename T, typename FunctionPointer, typename Arg1, typename Arg2> struct StoredFunctorPointerCall2: public RunFunctionTask<T> { inline StoredFunctorPointerCall2(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2) @@ -696,10 +675,10 @@ struct StoredFunctorCall3: public RunFunctionTask<T> Arg1 arg1; Arg2 arg2; Arg3 arg3; }; -template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3> -struct VoidStoredFunctorCall3: public RunFunctionTask<T> +template <typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3> +struct StoredFunctorCall3<void, FunctionPointer, Arg1, Arg2, Arg3>: public RunFunctionTask<void> { - inline VoidStoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) + inline StoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {} void runFunctor() { function(arg1, arg2, arg3); } FunctionPointer function; @@ -707,13 +686,6 @@ struct VoidStoredFunctorCall3: public RunFunctionTask<T> }; template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3> -struct SelectStoredFunctorCall3 -{ - typedef typename SelectSpecialization<T>::template - Type<StoredFunctorCall3 <T, FunctionPointer, Arg1, Arg2, Arg3>, - VoidStoredFunctorCall3<T, FunctionPointer, Arg1, Arg2, Arg3> >::type type; -}; -template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3> struct StoredFunctorPointerCall3: public RunFunctionTask<T> { inline StoredFunctorPointerCall3(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3) @@ -906,10 +878,10 @@ struct StoredFunctorCall4: public RunFunctionTask<T> Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; }; -template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4> -struct VoidStoredFunctorCall4: public RunFunctionTask<T> +template <typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +struct StoredFunctorCall4<void, FunctionPointer, Arg1, Arg2, Arg3, Arg4>: public RunFunctionTask<void> { - inline VoidStoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) + inline StoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {} void runFunctor() { function(arg1, arg2, arg3, arg4); } FunctionPointer function; @@ -917,13 +889,6 @@ struct VoidStoredFunctorCall4: public RunFunctionTask<T> }; template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4> -struct SelectStoredFunctorCall4 -{ - typedef typename SelectSpecialization<T>::template - Type<StoredFunctorCall4 <T, FunctionPointer, Arg1, Arg2, Arg3, Arg4>, - VoidStoredFunctorCall4<T, FunctionPointer, Arg1, Arg2, Arg3, Arg4> >::type type; -}; -template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4> struct StoredFunctorPointerCall4: public RunFunctionTask<T> { inline StoredFunctorPointerCall4(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4) @@ -1116,10 +1081,10 @@ struct StoredFunctorCall5: public RunFunctionTask<T> Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5; }; -template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> -struct VoidStoredFunctorCall5: public RunFunctionTask<T> +template <typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +struct StoredFunctorCall5<void, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5>: public RunFunctionTask<void> { - inline VoidStoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) + inline StoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) : function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {} void runFunctor() { function(arg1, arg2, arg3, arg4, arg5); } FunctionPointer function; @@ -1127,13 +1092,6 @@ struct VoidStoredFunctorCall5: public RunFunctionTask<T> }; template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> -struct SelectStoredFunctorCall5 -{ - typedef typename SelectSpecialization<T>::template - Type<StoredFunctorCall5 <T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5>, - VoidStoredFunctorCall5<T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5> >::type type; -}; -template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> struct StoredFunctorPointerCall5: public RunFunctionTask<T> { inline StoredFunctorPointerCall5(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5) @@ -1316,6 +1274,33 @@ struct SelectStoredConstMemberFunctionPointerCall5 Type<StoredConstMemberFunctionPointerCall5 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>, VoidStoredConstMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5> >::type type; }; + +template <typename T, typename Functor> +class StoredFunctorCall : public RunFunctionTask<T> +{ +public: + StoredFunctorCall(const Functor &f) : functor(f) { } + void runFunctor() + { + this->result = functor(); + } +private: + Functor functor; +}; +template <typename Functor> +class StoredFunctorCall<void, Functor> : public RunFunctionTask<void> +{ +public: + StoredFunctorCall(const Functor &f) : functor(f) { } + void runFunctor() + { + functor(); + } +private: + Functor functor; +}; + + } //namespace QtConcurrent #endif // qdoc diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 4e3f4e3..8a17af5 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -363,6 +363,11 @@ template <typename T> inline void qToLittleEndian(T src, uchar *dest) #endif // Q_BYTE_ORDER == Q_BIG_ENDIAN +template <> inline quint8 qbswap<quint8>(quint8 source) +{ + return source; +} + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 78b8443..1454cb3 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -425,14 +425,11 @@ namespace QT_NAMESPACE {} #if defined(Q_CC_MSVC) && _MSC_VER >= 1600 # define Q_COMPILER_RVALUE_REFS -# define Q_COMPILER_INITIALIZER_LISTS # define Q_COMPILER_AUTO_TYPE # define Q_COMPILER_LAMBDA -//# define Q_COMPILER_VARIADIC_TEMPLATES -//# define Q_COMPILER_CLASS_ENUM -//# define Q_COMPILER_DEFAULT_DELETE_MEMBERS -//# define Q_COMPILER_UNICODE_STRINGS -//# define Q_COMPILER_EXTERN_TEMPLATES +# define Q_COMPILER_DECLTYPE +// MSCV has std::initilizer_list, but do not support the braces initialization +//# define Q_COMPILER_INITIALIZER_LISTS # endif @@ -524,6 +521,7 @@ namespace QT_NAMESPACE {} # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403 /* C++0x features supported in GCC 4.3: */ # define Q_COMPILER_RVALUE_REFS +# define Q_COMPILER_DECLTYPE # endif # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 /* C++0x features supported in GCC 4.4: */ @@ -791,6 +789,7 @@ namespace QT_NAMESPACE {} # if __INTEL_COMPILER >= 1100 # define Q_COMPILER_RVALUE_REFS # define Q_COMPILER_EXTERN_TEMPLATES +# define Q_COMPILER_DECLTYPE # elif __INTEL_COMPILER >= 1200 # define Q_COMPILER_VARIADIC_TEMPLATES # define Q_COMPILER_AUTO_TYPE @@ -2770,6 +2769,12 @@ QT_LICENSED_MODULE(DBus) # define QT_NO_RAWFONT #endif +namespace QtPrivate { +//like std::enable_if +template <bool B, typename T = void> struct QEnableIf; +template <typename T> struct QEnableIf<true, T> { typedef T Type; }; +} + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index f67600d..e411f8f 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -24,6 +24,8 @@ HEADERS += \ io/qresource_p.h \ io/qresource_iterator_p.h \ io/qurl.h \ + io/qurltlds_p.h \ + io/qtldurl_p.h \ io/qsettings.h \ io/qsettings_p.h \ io/qfsfileengine.h \ @@ -41,6 +43,7 @@ SOURCES += \ io/qbuffer.cpp \ io/qdatastream.cpp \ io/qdataurl.cpp \ + io/qtldurl.cpp \ io/qdebug.cpp \ io/qdir.cpp \ io/qdiriterator.cpp \ diff --git a/src/corelib/io/qtldurl.cpp b/src/corelib/io/qtldurl.cpp new file mode 100644 index 0000000..7db4bbd --- /dev/null +++ b/src/corelib/io/qtldurl.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformdefs.h" +#include "qurl.h" +#include "private/qurltlds_p.h" +#include "private/qtldurl_p.h" +#include "QtCore/qstringlist.h" + +QT_BEGIN_NAMESPACE + +static bool containsTLDEntry(const QString &entry) +{ + int index = qHash(entry) % tldCount; + int currentDomainIndex = tldIndices[index]; + while (currentDomainIndex < tldIndices[index+1]) { + QString currentEntry = QString::fromUtf8(tldData + currentDomainIndex); + if (currentEntry == entry) + return true; + currentDomainIndex += qstrlen(tldData + currentDomainIndex) + 1; // +1 for the ending \0 + } + return false; +} + +/*! + \internal + + Return the top-level-domain per Qt's copy of the Mozilla public suffix list of + \a domain. +*/ + +Q_CORE_EXPORT QString qTopLevelDomain(const QString &domain) +{ + QStringList sections = domain.toLower().split(QLatin1Char('.'), QString::SkipEmptyParts); + if (sections.isEmpty()) + return QString(); + + QString level, tld; + for (int j = sections.count() - 1; j >= 0; --j) { + level.prepend(QLatin1Char('.') + sections.at(j)); + if (qIsEffectiveTLD(level.right(level.size() - 1))) + tld = level; + } + return tld; +} + +/*! + \internal + + Return true if \a domain is a top-level-domain per Qt's copy of the Mozilla public suffix list. +*/ + +Q_CORE_EXPORT bool qIsEffectiveTLD(const QString &domain) +{ + // for domain 'foo.bar.com': + // 1. return if TLD table contains 'foo.bar.com' + if (containsTLDEntry(domain)) + return true; + + if (domain.contains(QLatin1Char('.'))) { + int count = domain.size() - domain.indexOf(QLatin1Char('.')); + QString wildCardDomain; + wildCardDomain.reserve(count + 1); + wildCardDomain.append(QLatin1Char('*')); + wildCardDomain.append(domain.right(count)); + // 2. if table contains '*.bar.com', + // test if table contains '!foo.bar.com' + if (containsTLDEntry(wildCardDomain)) { + QString exceptionDomain; + exceptionDomain.reserve(domain.size() + 1); + exceptionDomain.append(QLatin1Char('!')); + exceptionDomain.append(domain); + return (! containsTLDEntry(exceptionDomain)); + } + } + return false; +} + +QT_END_NAMESPACE diff --git a/src/corelib/io/qtldurl_p.h b/src/corelib/io/qtldurl_p.h new file mode 100644 index 0000000..152ffa0 --- /dev/null +++ b/src/corelib/io/qtldurl_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTLDURL_P_H +#define QTLDURL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of qDecodeDataUrl. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "QtCore/qurl.h" +#include "QtCore/qstring.h" + +QT_BEGIN_NAMESPACE + +Q_CORE_EXPORT QString qTopLevelDomain(const QString &domain); +Q_CORE_EXPORT bool qIsEffectiveTLD(const QString &domain); + +QT_END_NAMESPACE + +#endif // QDATAURL_P_H diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index c00fc68..83b49ce 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -192,7 +192,9 @@ #if defined QT3_SUPPORT #include "qfileinfo.h" #endif - +#ifndef QT_BOOTSTRAPPED +#include "qtldurl_p.h" +#endif #if defined(Q_OS_WINCE_WM) #pragma optimize("g", off) #endif @@ -5593,6 +5595,21 @@ bool QUrl::hasFragment() const } /*! + \since 4.8 + + Returns the TLD (Top-Level Domain) of the URL, (e.g. .co.uk, .net). + Note that the return value is prefixed with a '.' unless the + URL does not contain a valid TLD, in which case the function returns + an empty string. +*/ +#ifndef QT_BOOTSTRAPPED +QString QUrl::topLevelDomain() const +{ + return qTopLevelDomain(host()); +} +#endif + +/*! Returns the result of the merge of this URL with \a relative. This URL is used as a base to convert \a relative to an absolute URL. diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 96b23d1..d57a0c7 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -181,6 +181,9 @@ public: void setEncodedFragment(const QByteArray &fragment); QByteArray encodedFragment() const; bool hasFragment() const; +#ifndef QT_BOOTSTRAPPED + QString topLevelDomain() const; +#endif QUrl resolved(const QUrl &relative) const; diff --git a/src/network/access/qnetworkcookiejartlds_p.h b/src/corelib/io/qurltlds_p.h index b06d881..f4f525c 100644 --- a/src/network/access/qnetworkcookiejartlds_p.h +++ b/src/corelib/io/qurltlds_p.h @@ -38,15 +38,15 @@ // the terms of any one of the MPL, the GPL or the LGPL. // -#ifndef QNETWORKCOOKIEJARTLD_P_H -#define QNETWORKCOOKIEJARTLD_P_H +#ifndef QURLTLD_P_H +#define QURLTLD_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of the Network Access framework. This header file may change from +// of the Network Access and Core framework. This header file may change from // version to version without notice, or even be removed. // // We mean it. @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE // note to maintainer: // this file should be updated before each release -> // for instructions see the program at -// util/network/cookiejar-generateTLDs +// util/corelib/qurl-generateTLDs static const quint16 tldCount = 3949; static const quint16 tldIndices[] = { @@ -6478,4 +6478,4 @@ static const char tldData[] = { QT_END_NAMESPACE -#endif // QNETWORKCOOKIEJARTLD_P_H +#endif // QURLTLD_P_H diff --git a/src/network/access/qnetworkcookiejartlds_p.h.INFO b/src/corelib/io/qurltlds_p.h.INFO index 57a8d0e..5781c2c 100644 --- a/src/network/access/qnetworkcookiejartlds_p.h.INFO +++ b/src/corelib/io/qurltlds_p.h.INFO @@ -1,15 +1,15 @@ -The file qnetworkcookiejartlds_p.h is generated from the Public Suffix +The file qurltlds_p.h is generated from the Public Suffix List (see [1] and [2]), by the program residing at -util/network/cookiejar-generateTLDs in the Qt source tree. +util/corelib/qurl-generateTLDs in the Qt source tree. That program generates a character array and an index array from the list to provide fast lookups of elements within C++. -Those arrays in qnetworkcookiejartlds_p.h are derived from the Public +Those arrays in qurltlds_p.h are derived from the Public Suffix List ([2]), which was originally provided by Jo Hermans <jo.hermans@gmail.com>. -The file qnetworkcookiejartlds_p.h was last generated Friday, +The file qurltlds_p.h was last generated Friday, November 19th 15:24 2010. ---- diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 9cd353a..eb29e6e 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -42,9 +42,96 @@ #include "quuid.h" #include "qdatastream.h" +#include "qendian.h" QT_BEGIN_NAMESPACE +#ifndef QT_NO_QUUID_STRING +template <class Char, class Integral> +void _q_toHex(Char *&dst, Integral value) +{ + static const char digits[] = "0123456789abcdef"; + + value = qToBigEndian(value); + + const char* p = reinterpret_cast<const char*>(&value); + + for (uint i = 0; i < sizeof(Integral); ++i, dst += 2) { + uint j = (p[i] >> 4) & 0xf; + dst[0] = Char(digits[j]); + j = p[i] & 0xf; + dst[1] = Char(digits[j]); + } +} + +template <class Char, class Integral> +bool _q_fromHex(const Char *&src, Integral &value) +{ + value = 0; + + for (uint i = 0; i < sizeof(Integral) * 2; ++i) { + int ch = *src++; + int tmp; + if (ch >= '0' && ch <= '9') + tmp = ch - '0'; + else if (ch >= 'a' && ch <= 'f') + tmp = ch - 'a' + 10; + else if (ch >= 'A' && ch <= 'F') + tmp = ch - 'A' + 10; + else + return false; + + value = value * 16 + tmp; + } + + return true; +} + +template <class Char> +void _q_uuidToHex(Char *&dst, const uint &d1, const ushort &d2, const ushort &d3, const uchar (&d4)[8]) +{ + *dst++ = Char('{'); + _q_toHex(dst, d1); + *dst++ = Char('-'); + _q_toHex(dst, d2); + *dst++ = Char('-'); + _q_toHex(dst, d3); + *dst++ = Char('-'); + for (int i = 0; i < 2; i++) + _q_toHex(dst, d4[i]); + *dst++ = Char('-'); + for (int i = 2; i < 8; i++) + _q_toHex(dst, d4[i]); + *dst = Char('}'); +} + +template <class Char> +bool _q_uuidFromHex(const Char *&src, uint &d1, ushort &d2, ushort &d3, uchar (&d4)[8]) +{ + if (*src == Char('{')) + src++; + if (!_q_fromHex(src, d1) + || *src++ != Char('-') + || !_q_fromHex(src, d2) + || *src++ != Char('-') + || !_q_fromHex(src, d3) + || *src++ != Char('-') + || !_q_fromHex(src, d4[0]) + || !_q_fromHex(src, d4[1]) + || *src++ != Char('-') + || !_q_fromHex(src, d4[2]) + || !_q_fromHex(src, d4[3]) + || !_q_fromHex(src, d4[4]) + || !_q_fromHex(src, d4[5]) + || !_q_fromHex(src, d4[6]) + || !_q_fromHex(src, d4[7])) { + return false; + } + + return true; +} +#endif + /*! \class QUuid \brief The QUuid class stores a Universally Unique Identifier (UUID). @@ -231,60 +318,112 @@ QT_BEGIN_NAMESPACE */ QUuid::QUuid(const QString &text) { - bool ok; - if (text.isEmpty()) { + if (text.length() < 36) { *this = QUuid(); return; } - QString temp = text.toUpper(); - if (temp[0] != QLatin1Char('{')) - temp = QLatin1Char('{') + text; - if (text[(int)text.length()-1] != QLatin1Char('}')) - temp += QLatin1Char('}'); - - data1 = temp.mid(1, 8).toULongLong(&ok, 16); - if (!ok) { + + const ushort *data = reinterpret_cast<const ushort *>(text.unicode()); + + if (*data == '{' && text.length() < 37) { *this = QUuid(); return; } - data2 = temp.mid(10, 4).toUInt(&ok, 16); - if (!ok) { + if (!_q_uuidFromHex(data, data1, data2, data3, data4)) { *this = QUuid(); return; } - data3 = temp.mid(15, 4).toUInt(&ok, 16); - if (!ok) { +} + +/*! + \internal +*/ +QUuid::QUuid(const char *text) +{ + if (!text) { *this = QUuid(); return; } - data4[0] = temp.mid(20, 2).toUInt(&ok, 16); - if (!ok) { + + if (!_q_uuidFromHex(text, data1, data2, data3, data4)) { *this = QUuid(); return; } - data4[1] = temp.mid(22, 2).toUInt(&ok, 16); - if (!ok) { +} + +/*! + Creates a QUuid object from the QByteArray \a text, which must be + formatted as five hex fields separated by '-', e.g., + "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex + digit. The curly braces shown here are optional, but it is normal to + include them. If the conversion fails, a null UUID is created. See + toByteArray() for an explanation of how the five hex fields map to the + public data members in QUuid. + + \since 4.8 + + \sa toByteArray(), QUuid() +*/ +QUuid::QUuid(const QByteArray &text) +{ + if (text.length() < 36) { *this = QUuid(); return; } - for (int i = 2; i<8; i++) { - data4[i] = temp.mid(25 + (i-2)*2, 2).toUShort(&ok, 16); - if (!ok) { - *this = QUuid(); - return; - } + + const char *data = text.constData(); + + if (*data == '{' && text.length() < 37) { + *this = QUuid(); + return; + } + + if (!_q_uuidFromHex(data, data1, data2, data3, data4)) { + *this = QUuid(); + return; } } +#endif /*! - \internal + Creates a QUuid object from the binary representation of the UUID, as + specified by RFC 4122 section 4.1.2. See toRfc4122() for a further + explanation of the order of bytes required. + + The byte array accepted is NOT a human readable format. + + If the conversion fails, a null UUID is created. + + \since 4.8 + + \sa toRfc4122(), QUuid() */ -QUuid::QUuid(const char *text) +QUuid QUuid::fromRfc4122(const QByteArray &bytes) { - *this = QUuid(QString::fromLatin1(text)); + if (bytes.isEmpty() || bytes.length() != 16) + return QUuid(); + + uint d1; + ushort d2, d3; + uchar d4[8]; + + const uchar *data = reinterpret_cast<const uchar *>(bytes.constData()); + + d1 = qFromBigEndian<quint32>(data); + data += sizeof(quint32); + d2 = qFromBigEndian<quint16>(data); + data += sizeof(quint16); + d3 = qFromBigEndian<quint16>(data); + data += sizeof(quint16); + + for (int i = 0; i < 8; ++i) { + d4[i] = *(data); + data++; + } + + return QUuid(d1, d2, d3, d4[0], d4[1], d4[2], d4[3], d4[4], d4[5], d4[6], d4[7]); } -#endif /*! \fn bool QUuid::operator==(const QUuid &other) const @@ -308,11 +447,6 @@ QUuid::QUuid(const char *text) \sa toString() */ -static QString uuidhex(uint data, int digits) -{ - return QString::number(data, 16).rightJustified(digits, QLatin1Char('0')); -} - /*! Returns the string representation of this QUuid. The string is formatted as five hex fields separated by '-' and enclosed in @@ -349,25 +483,114 @@ static QString uuidhex(uint data, int digits) */ QString QUuid::toString() const { - QString result; - - QChar dash = QLatin1Char('-'); - result = QLatin1Char('{') + uuidhex(data1,8); - result += dash; - result += uuidhex(data2,4); - result += dash; - result += uuidhex(data3,4); - result += dash; - result += uuidhex(data4[0],2); - result += uuidhex(data4[1],2); - result += dash; - for (int i = 2; i < 8; i++) - result += uuidhex(data4[i],2); + QString result(38, Qt::Uninitialized); + ushort *data = (ushort *)result.unicode(); + + _q_uuidToHex(data, data1, data2, data3, data4); - return result + QLatin1Char('}'); + return result; +} + +/*! + Returns the binary representation of this QUuid. The byte array is + formatted as five hex fields separated by '-' and enclosed in + curly braces, i.e., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where + 'x' is a hex digit. From left to right, the five hex fields are + obtained from the four public data members in QUuid as follows: + + \table + \header + \o Field # + \o Source + + \row + \o 1 + \o data1 + + \row + \o 2 + \o data2 + + \row + \o 3 + \o data3 + + \row + \o 4 + \o data4[0] .. data4[1] + + \row + \o 5 + \o data4[2] .. data4[7] + + \endtable + + \since 4.8 +*/ +QByteArray QUuid::toByteArray() const +{ + QByteArray result(38, Qt::Uninitialized); + char *data = result.data(); + + _q_uuidToHex(data, data1, data2, data3, data4); + + return result; } #endif +/*! + Returns the binary representation of this QUuid. The byte array is in big + endian format, and formatted according to RFC 4122, section 4.1.2 - + "Layout and byte order". + + The order is as follows: + + \table + \header + \o Field # + \o Source + + \row + \o 1 + \o data1 + + \row + \o 2 + \o data2 + + \row + \o 3 + \o data3 + + \row + \o 4 + \o data4[0] .. data4[7] + + \endtable + + \since 4.8 +*/ +QByteArray QUuid::toRfc4122() const +{ + // we know how many bytes a UUID has, I hope :) + QByteArray bytes(16, Qt::Uninitialized); + uchar *data = reinterpret_cast<uchar*>(bytes.data()); + + qToBigEndian(data1, data); + data += sizeof(quint32); + qToBigEndian(data2, data); + data += sizeof(quint16); + qToBigEndian(data3, data); + data += sizeof(quint16); + + for (int i = 0; i < 8; ++i) { + *(data) = data4[i]; + data++; + } + + return bytes; +} + #ifndef QT_NO_DATASTREAM /*! \relates QUuid @@ -375,11 +598,30 @@ QString QUuid::toString() const */ QDataStream &operator<<(QDataStream &s, const QUuid &id) { - s << (quint32)id.data1; - s << (quint16)id.data2; - s << (quint16)id.data3; - for (int i = 0; i < 8; i++) - s << (quint8)id.data4[i]; + QByteArray bytes; + if (s.byteOrder() == QDataStream::BigEndian) { + bytes = id.toRfc4122(); + } else { + // we know how many bytes a UUID has, I hope :) + bytes = QByteArray(16, Qt::Uninitialized); + uchar *data = reinterpret_cast<uchar*>(bytes.data()); + + qToLittleEndian(id.data1, data); + data += sizeof(quint32); + qToLittleEndian(id.data2, data); + data += sizeof(quint16); + qToLittleEndian(id.data3, data); + data += sizeof(quint16); + + for (int i = 0; i < 8; ++i) { + *(data) = id.data4[i]; + data++; + } + } + + if (s.writeRawData(bytes.data(), 16) != 16) { + s.setStatus(QDataStream::WriteFailed); + } return s; } @@ -389,19 +631,30 @@ QDataStream &operator<<(QDataStream &s, const QUuid &id) */ QDataStream &operator>>(QDataStream &s, QUuid &id) { - quint32 u32; - quint16 u16; - quint8 u8; - s >> u32; - id.data1 = u32; - s >> u16; - id.data2 = u16; - s >> u16; - id.data3 = u16; - for (int i = 0; i < 8; i++) { - s >> u8; - id.data4[i] = u8; + QByteArray bytes(16, Qt::Uninitialized); + if (s.readRawData(bytes.data(), 16) != 16) { + s.setStatus(QDataStream::ReadPastEnd); + return s; } + + if (s.byteOrder() == QDataStream::BigEndian) { + id = QUuid::fromRfc4122(bytes); + } else { + const uchar *data = reinterpret_cast<const uchar *>(bytes.constData()); + + id.data1 = qFromLittleEndian<quint32>(data); + data += sizeof(quint32); + id.data2 = qFromLittleEndian<quint16>(data); + data += sizeof(quint16); + id.data3 = qFromLittleEndian<quint16>(data); + data += sizeof(quint16); + + for (int i = 0; i < 8; ++i) { + id.data4[i] = *(data); + data++; + } + } + return s; } #endif // QT_NO_DATASTREAM diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index f42ca91..832d5bc 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -108,8 +108,12 @@ struct Q_CORE_EXPORT QUuid QUuid(const QString &); QUuid(const char *); QString toString() const; - operator QString() const { return toString(); } + operator QString() const { return toString(); } // ### Qt5 remove + QUuid(const QByteArray &); + QByteArray toByteArray() const; #endif + QByteArray toRfc4122() const; + static QUuid fromRfc4122(const QByteArray &); bool isNull() const; bool operator==(const QUuid &orig) const diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index ef49906..cde93d6 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -942,19 +942,32 @@ QLocale::Country QLocale::country() const QString QLocale::name() const { - Language l = language(); + const QLocalePrivate *dd = d(); - QString result = d()->languageCode(); + if (dd->m_language_id == QLocale::AnyLanguage) + return QString(); + if (dd->m_language_id == QLocale::C) + return QLatin1String("C"); - if (l == C) - return result; + const unsigned char *c = language_code_list + 3*(uint(dd->m_language_id)); - Country c = country(); - if (c == AnyCountry) - return result; + QString result(7, Qt::Uninitialized); + ushort *data = (ushort *)result.unicode(); + const ushort *begin = data; - result.append(QLatin1Char('_')); - result.append(d()->countryCode()); + *data++ = ushort(c[0]); + *data++ = ushort(c[1]); + if (c[2] != 0) + *data++ = ushort(c[2]); + if (dd->m_country_id != AnyCountry) { + *data++ = '_'; + const unsigned char *c = country_code_list + 3*(uint(dd->m_country_id)); + *data++ = ushort(c[0]); + *data++ = ushort(c[1]); + if (c[2] != 0) + *data++ = ushort(c[2]); + } + result.resize(data - begin); return result; } diff --git a/src/declarative/qml/qdeclarativedirparser.cpp b/src/declarative/qml/qdeclarativedirparser.cpp index d4abbee..1d4db40 100644 --- a/src/declarative/qml/qdeclarativedirparser.cpp +++ b/src/declarative/qml/qdeclarativedirparser.cpp @@ -240,7 +240,7 @@ QList<QDeclarativeDirParser::Component> QDeclarativeDirParser::components() cons } #ifdef QT_CREATOR -QList<TypeInfo> QDeclarativeDirParser::typeInfos() const +QList<QDeclarativeDirParser::TypeInfo> QDeclarativeDirParser::typeInfos() const { return _typeInfos; } diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index e806dbf..ae28049 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -183,6 +183,9 @@ QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name) /*! Creates a QDeclarativeProperty for the property \a name of \a obj using the \l{QDeclarativeContext} {context} \a ctxt. + + Creating a QDeclarativeProperty without a context will render some + properties - like attached properties - inaccessible. */ QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QDeclarativeContext *ctxt) : d(new QDeclarativePropertyPrivate) diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 750ddf8..0c683b4 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -1166,12 +1166,20 @@ void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive) // some XEMBEDding, so try to find the real QMimeData used // based on the timestamp for this drop. QMimeData *dropData = 0; - int at = findXdndDropTransactionByTime(qt_xdnd_target_current_time); - if (at != -1) + const int at = findXdndDropTransactionByTime(qt_xdnd_target_current_time); + if (at != -1) { dropData = QDragManager::dragPrivate(X11->dndDropTransactions.at(at).object)->data; + // Can't use the source QMimeData if we need the image conversion code from xdndObtainData + if (dropData && dropData->hasImage()) + dropData = 0; + } // if we can't find it, then use the data in the drag manager - if (!dropData) - dropData = (manager->object) ? manager->dragPrivate()->data : manager->dropData; + if (!dropData) { + if (manager->object && !manager->dragPrivate()->data->hasImage()) + dropData = manager->dragPrivate()->data; + else + dropData = manager->dropData; + } // Drop coming from another app? Update keyboard modifiers. if (!qt_xdnd_dragging) { @@ -1855,8 +1863,16 @@ static QVariant xdndObtainData(const char *format, QVariant::Type requestedType) && (!(w->windowType() == Qt::Desktop) || w->acceptDrops())) { QDragPrivate * o = QDragManager::self()->dragPrivate(); - if (o->data->hasFormat(QLatin1String(format))) - result = o->data->data(QLatin1String(format)); + const QString mimeType = QString::fromLatin1(format); + if (o->data->hasFormat(mimeType)) { + result = o->data->data(mimeType); + } else if (mimeType.startsWith(QLatin1String("image/")) && o->data->hasImage()) { + // ### duplicated from QInternalMimeData::renderDataHelper + QImage image = qvariant_cast<QImage>(o->data->imageData()); + QBuffer buf(&result); + buf.open(QBuffer::WriteOnly); + image.save(&buf, mimeType.mid(mimeType.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper()); + } return result; } diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 5ead3ad..99e861e 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -22,7 +22,6 @@ HEADERS += \ access/qnetworkcookie_p.h \ access/qnetworkcookiejar.h \ access/qnetworkcookiejar_p.h \ - access/qnetworkcookiejartlds_p.h \ access/qnetworkrequest.h \ access/qnetworkrequest_p.h \ access/qnetworkreply.h \ diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 33124fd..6101eea 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -261,7 +261,17 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) // set the host value = request.headerField("host"); if (value.isEmpty()) { - QByteArray host = QUrl::toAce(hostName); + QHostAddress add; + QByteArray host; + if(add.setAddress(hostName)) { + if(add.protocol() == QAbstractSocket::IPv6Protocol) { + host = "[" + hostName.toAscii() + "]";//format the ipv6 in the standard way + } else { + host = QUrl::toAce(hostName); + } + } else { + host = QUrl::toAce(hostName); + } int port = request.url().port(); if (port != -1) { diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 291bdec..a2fa689 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -40,12 +40,12 @@ ****************************************************************************/ #include "qnetworkcookiejar.h" -#include "qnetworkcookiejartlds_p.h" #include "qnetworkcookiejar_p.h" #include "QtNetwork/qnetworkcookie.h" #include "QtCore/qurl.h" #include "QtCore/qdatetime.h" +#include "private/qtldurl_p.h" QT_BEGIN_NAMESPACE @@ -216,7 +216,7 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieLis // the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2 // redundant; the "leading dot" rule has been relaxed anyway, see above // we remove the leading dot for this check - if (QNetworkCookieJarPrivate::isEffectiveTLD(domain.remove(0, 1))) + if (qIsEffectiveTLD(domain.remove(0, 1))) continue; // not accepted } @@ -304,43 +304,4 @@ QList<QNetworkCookie> QNetworkCookieJar::cookiesForUrl(const QUrl &url) const return result; } -bool QNetworkCookieJarPrivate::isEffectiveTLD(const QString &domain) -{ - // for domain 'foo.bar.com': - // 1. return if TLD table contains 'foo.bar.com' - if (containsTLDEntry(domain)) - return true; - - if (domain.contains(QLatin1Char('.'))) { - int count = domain.size() - domain.indexOf(QLatin1Char('.')); - QString wildCardDomain; - wildCardDomain.reserve(count + 1); - wildCardDomain.append(QLatin1Char('*')); - wildCardDomain.append(domain.right(count)); - // 2. if table contains '*.bar.com', - // test if table contains '!foo.bar.com' - if (containsTLDEntry(wildCardDomain)) { - QString exceptionDomain; - exceptionDomain.reserve(domain.size() + 1); - exceptionDomain.append(QLatin1Char('!')); - exceptionDomain.append(domain); - return (! containsTLDEntry(exceptionDomain)); - } - } - return false; -} - -bool QNetworkCookieJarPrivate::containsTLDEntry(const QString &entry) -{ - int index = qHash(entry) % tldCount; - int currentDomainIndex = tldIndices[index]; - while (currentDomainIndex < tldIndices[index+1]) { - QString currentEntry = QString::fromUtf8(tldData + currentDomainIndex); - if (currentEntry == entry) - return true; - currentDomainIndex += qstrlen(tldData + currentDomainIndex) + 1; // +1 for the ending \0 - } - return false; -} - QT_END_NAMESPACE diff --git a/src/network/access/qnetworkcookiejar_p.h b/src/network/access/qnetworkcookiejar_p.h index 912847b..34858d9 100644 --- a/src/network/access/qnetworkcookiejar_p.h +++ b/src/network/access/qnetworkcookiejar_p.h @@ -63,9 +63,6 @@ class QNetworkCookieJarPrivate: public QObjectPrivate public: QList<QNetworkCookie> allCookies; - static bool Q_AUTOTEST_EXPORT isEffectiveTLD(const QString &domain); - static bool containsTLDEntry(const QString &entry); - Q_DECLARE_PUBLIC(QNetworkCookieJar) }; diff --git a/src/network/kernel/qhostaddress_p.h b/src/network/kernel/qhostaddress_p.h index 255d706..0349ff3 100644 --- a/src/network/kernel/qhostaddress_p.h +++ b/src/network/kernel/qhostaddress_p.h @@ -71,6 +71,11 @@ public: void setPrefixLength(QAbstractSocket::NetworkLayerProtocol proto, int len); }; +#ifdef Q_OS_SYMBIAN +class TInetAddr; +QHostAddress qt_QHostAddressFromTInetAddr(const TInetAddr& addr); +#endif + QT_END_NAMESPACE #endif diff --git a/src/network/kernel/qhostinfo_symbian.cpp b/src/network/kernel/qhostinfo_symbian.cpp index 042899d..86c157c 100644 --- a/src/network/kernel/qhostinfo_symbian.cpp +++ b/src/network/kernel/qhostinfo_symbian.cpp @@ -52,6 +52,7 @@ #include <private/qcore_symbian_p.h> #include <private/qsystemerror_p.h> #include <private/qnetworksession_p.h> +#include <private/qhostaddress_p.h> // Header does not exist in the S60 5.0 SDK //#include <networking/dnd_err.h> @@ -152,23 +153,17 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName, QSharedPointer<QNetw QList<QHostAddress> hostAddresses; TInetAddr hostAdd = nameResult().iAddr; - // 39 is the maximum length of an IPv6 address. - TBuf<39> ipAddr; - // Fill ipAddr with the IP address from hostAdd - hostAdd.Output(ipAddr); - if (ipAddr.Length() > 0) - hostAddresses.append(QHostAddress(qt_TDesC2QString(ipAddr))); + if (!(nameResult().iFlags & TNameRecord::EAlias) && !(hostAdd.IsUnspecified())) + hostAddresses.append(qt_QHostAddressFromTInetAddr(hostAdd)); // Check if there's more than one IP address linkd to this name while (hostResolver.Next(nameResult) == KErrNone) { hostAdd = nameResult().iAddr; - hostAdd.Output(ipAddr); // Ensure that record is valid (not an alias and with length greater than 0) - if (!(nameResult().iFlags & TNameRecord::EAlias) && !(hostAdd.IsUnspecified())) { - hostAddresses.append(QHostAddress(qt_TDesC2QString(ipAddr))); - } + if (!(nameResult().iFlags & TNameRecord::EAlias) && !(hostAdd.IsUnspecified())) + hostAddresses.append(qt_QHostAddressFromTInetAddr(hostAdd)); } hostResolver.Close(); @@ -414,14 +409,10 @@ void QSymbianHostResolver::processNameResult() { if (iStatus.Int() == KErrNone) { TInetAddr hostAdd = iNameResult().iAddr; - // 39 is the maximum length of an IPv6 address. - TBuf<39> ipAddr; - - hostAdd.Output(ipAddr); // Ensure that record is valid (not an alias and with length greater than 0) if (!(iNameResult().iFlags & TNameRecord::EAlias) && !(hostAdd.IsUnspecified())) { - iHostAddresses.append(QHostAddress(qt_TDesC2QString(ipAddr))); + iHostAddresses.append(qt_QHostAddressFromTInetAddr(hostAdd)); } iState = EGetByName; diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp index e7d3ca9..dca6cf4 100644 --- a/src/network/kernel/qnetworkinterface_symbian.cpp +++ b/src/network/kernel/qnetworkinterface_symbian.cpp @@ -67,10 +67,8 @@ static QNetworkInterface::InterfaceFlags convertFlags(const TSoInetInterfaceInfo return flags; } -//TODO: share this, at least QHostInfo needs to do the same thing -static QHostAddress qt_QHostAddressFromTInetAddr(const TInetAddr& addr) +QHostAddress qt_QHostAddressFromTInetAddr(const TInetAddr& addr) { - //TODO: do we want to call v4 mapped addresses v4 or v6 outside of this file? if (addr.IsV4Mapped() || addr.Family() == KAfInet) { //convert v4 host address return QHostAddress(addr.Address()); diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 328c5c2..76b7d41 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -127,7 +127,7 @@ QT_BEGIN_NAMESPACE // forward declaration -static QMap<QString, QString> _q_mapFromOnelineName(char *name); +static QMap<QString, QString> _q_mapFromX509Name(X509_NAME *name); /*! Constructs a QSslCertificate by reading \a format encoded data @@ -324,7 +324,7 @@ QString QSslCertificate::issuerInfo(SubjectInfo info) const // lazy init if (d->issuerInfo.isEmpty() && d->x509) d->issuerInfo = - _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0)); + _q_mapFromX509Name(q_X509_get_issuer_name(d->x509)); return d->issuerInfo.value(_q_SubjectInfoToString(info)); } @@ -341,7 +341,7 @@ QString QSslCertificate::issuerInfo(const QByteArray &tag) const // lazy init if (d->issuerInfo.isEmpty() && d->x509) d->issuerInfo = - _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0)); + _q_mapFromX509Name(q_X509_get_issuer_name(d->x509)); return d->issuerInfo.value(QString::fromLatin1(tag)); } @@ -360,7 +360,7 @@ QString QSslCertificate::subjectInfo(SubjectInfo info) const // lazy init if (d->subjectInfo.isEmpty() && d->x509) d->subjectInfo = - _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0)); + _q_mapFromX509Name(q_X509_get_subject_name(d->x509)); return d->subjectInfo.value(_q_SubjectInfoToString(info)); } @@ -376,7 +376,7 @@ QString QSslCertificate::subjectInfo(const QByteArray &tag) const // lazy init if (d->subjectInfo.isEmpty() && d->x509) d->subjectInfo = - _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0)); + _q_mapFromX509Name(q_X509_get_subject_name(d->x509)); return d->subjectInfo.value(QString::fromLatin1(tag)); } @@ -666,37 +666,17 @@ QByteArray QSslCertificatePrivate::QByteArray_from_X509(X509 *x509, QSsl::Encodi return BEGINCERTSTRING "\n" + tmp + ENDCERTSTRING "\n"; } -static QMap<QString, QString> _q_mapFromOnelineName(char *name) +static QMap<QString, QString> _q_mapFromX509Name(X509_NAME *name) { QMap<QString, QString> info; - QString infoStr = QString::fromLocal8Bit(name); - q_CRYPTO_free(name); - - // ### The right-hand encoding seems to allow hex (Regulierungsbeh\xC8orde) - //entry.replace(QLatin1String("\\x"), QLatin1String("%")); - //entry = QUrl::fromPercentEncoding(entry.toLatin1()); - // ### See RFC-4630 for more details! - - QRegExp rx(QLatin1String("/([A-Za-z]+)=(.+)")); - - int pos = 0; - while ((pos = rx.indexIn(infoStr, pos)) != -1) { - const QString name = rx.cap(1); - - QString value = rx.cap(2); - const int valuePos = rx.pos(2); - - const int next = rx.indexIn(value); - if (next == -1) { - info.insert(name, value); - break; - } - - value = value.left(next); - info.insert(name, value); - pos = valuePos + value.length(); + for (int i = 0; i < q_X509_NAME_entry_count(name); ++i) { + X509_NAME_ENTRY *e = q_X509_NAME_get_entry(name, i); + const char *obj = q_OBJ_nid2sn(q_OBJ_obj2nid(q_X509_NAME_ENTRY_get_object(e))); + unsigned char *data = 0; + int size = q_ASN1_STRING_to_UTF8(&data, q_X509_NAME_ENTRY_get_data(e)); + info[QString::fromUtf8(obj)] = QString::fromUtf8((char*)data, size); + q_CRYPTO_free(data); } - return info; } diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index a730eb2..a4cc3c4 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -101,6 +101,7 @@ DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return) DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return) DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return) +DEFINEFUNC2(int, ASN1_STRING_to_UTF8, unsigned char **a, a, ASN1_STRING *b, b, return 0, return); DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return) DEFINEFUNC(int, BIO_free, BIO *a, a, return 0, return) DEFINEFUNC(BIO *, BIO_new, BIO_METHOD *a, a, return 0, return) @@ -248,7 +249,10 @@ DEFINEFUNC4(void *, X509_get_ext_d2i, X509 *a, a, int b, b, int *c, c, int *d, d DEFINEFUNC(X509_NAME *, X509_get_issuer_name, X509 *a, a, return 0, return) DEFINEFUNC(X509_NAME *, X509_get_subject_name, X509 *a, a, return 0, return) DEFINEFUNC(int, X509_verify_cert, X509_STORE_CTX *a, a, return -1, return) -DEFINEFUNC3(char *, X509_NAME_oneline, X509_NAME *a, a, char *b, b, int c, c, return 0, return) +DEFINEFUNC(int, X509_NAME_entry_count, X509_NAME *a, a, return 0, return) +DEFINEFUNC2(X509_NAME_ENTRY *, X509_NAME_get_entry, X509_NAME *a, a, int b, b, return 0, return) +DEFINEFUNC(ASN1_STRING *, X509_NAME_ENTRY_get_data, X509_NAME_ENTRY *a, a, return 0, return) +DEFINEFUNC(ASN1_OBJECT *, X509_NAME_ENTRY_get_object, X509_NAME_ENTRY *a, a, return 0, return) DEFINEFUNC(EVP_PKEY *, X509_PUBKEY_get, X509_PUBKEY *a, a, return 0, return) DEFINEFUNC(void, X509_STORE_free, X509_STORE *a, a, return, DUMMYARG) DEFINEFUNC(X509_STORE *, X509_STORE_new, DUMMYARG, DUMMYARG, return 0, return) @@ -518,6 +522,7 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(ASN1_INTEGER_get, 48, libs.second ) RESOLVEFUNC(ASN1_STRING_data, 71, libs.second ) RESOLVEFUNC(ASN1_STRING_length, 76, libs.second ) + RESOLVEFUNC(ASN1_STRING_to_UTF8, 86, libs.second ) RESOLVEFUNC(BIO_ctrl, 184, libs.second ) RESOLVEFUNC(BIO_free, 209, libs.second ) RESOLVEFUNC(BIO_new, 222, libs.second ) @@ -608,7 +613,10 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(SSLv23_server_method, 191, libs.first ) RESOLVEFUNC(TLSv1_server_method, 200, libs.first ) RESOLVEFUNC(SSL_CTX_load_verify_locations, 34, libs.first ) - RESOLVEFUNC(X509_NAME_oneline, 1830, libs.second ) + RESOLVEFUNC(X509_NAME_entry_count, 1821, libs.second ) + RESOLVEFUNC(X509_NAME_get_entry, 1823, libs.second ) + RESOLVEFUNC(X509_NAME_ENTRY_get_data, 1808, libs.second ) + RESOLVEFUNC(X509_NAME_ENTRY_get_object, 1809, libs.second ) RESOLVEFUNC(X509_PUBKEY_get, 1844, libs.second ) RESOLVEFUNC(X509_STORE_free, 1939, libs.second ) RESOLVEFUNC(X509_STORE_new, 1942, libs.second ) @@ -647,6 +655,7 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(ASN1_INTEGER_get) RESOLVEFUNC(ASN1_STRING_data) RESOLVEFUNC(ASN1_STRING_length) + RESOLVEFUNC(ASN1_STRING_to_UTF8) RESOLVEFUNC(BIO_ctrl) RESOLVEFUNC(BIO_free) RESOLVEFUNC(BIO_new) @@ -736,7 +745,10 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(SSLv3_server_method) RESOLVEFUNC(SSLv23_server_method) RESOLVEFUNC(TLSv1_server_method) - RESOLVEFUNC(X509_NAME_oneline) + RESOLVEFUNC(X509_NAME_entry_count) + RESOLVEFUNC(X509_NAME_get_entry) + RESOLVEFUNC(X509_NAME_ENTRY_get_data) + RESOLVEFUNC(X509_NAME_ENTRY_get_object) RESOLVEFUNC(X509_PUBKEY_get) RESOLVEFUNC(X509_STORE_free) RESOLVEFUNC(X509_STORE_new) diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index e20deb8..c0a3b4d 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -204,6 +204,7 @@ bool q_resolveOpenSslSymbols(); long q_ASN1_INTEGER_get(ASN1_INTEGER *a); unsigned char * q_ASN1_STRING_data(ASN1_STRING *a); int q_ASN1_STRING_length(ASN1_STRING *a); +int q_ASN1_STRING_to_UTF8(unsigned char **a, ASN1_STRING *b); long q_BIO_ctrl(BIO *a, int b, long c, void *d); int q_BIO_free(BIO *a); BIO *q_BIO_new(BIO_METHOD *a); @@ -360,7 +361,10 @@ void *q_X509_get_ext_d2i(X509 *a, int b, int *c, int *d); X509_NAME *q_X509_get_issuer_name(X509 *a); X509_NAME *q_X509_get_subject_name(X509 *a); int q_X509_verify_cert(X509_STORE_CTX *ctx); -char *q_X509_NAME_oneline(X509_NAME *a, char *b, int c); +int q_X509_NAME_entry_count(X509_NAME *a); +X509_NAME_ENTRY *q_X509_NAME_get_entry(X509_NAME *a,int b); +ASN1_STRING *q_X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *a); +ASN1_OBJECT *q_X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *a); EVP_PKEY *q_X509_PUBKEY_get(X509_PUBKEY *a); void q_X509_STORE_free(X509_STORE *store); X509_STORE *q_X509_STORE_new(); diff --git a/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro b/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro index bccabcb..e7a69f2 100644 --- a/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro +++ b/src/plugins/qmltooling/declarativeobserver/declarativeobserver.pro @@ -17,7 +17,6 @@ SOURCES += \ editor/liveselectionrectangle.cpp \ editor/liveselectionindicator.cpp \ editor/boundingrecthighlighter.cpp \ - editor/subcomponenteditortool.cpp \ editor/subcomponentmasklayeritem.cpp \ editor/zoomtool.cpp \ editor/colorpickertool.cpp \ @@ -38,7 +37,6 @@ HEADERS += \ editor/liveselectionrectangle_p.h \ editor/liveselectionindicator_p.h \ editor/boundingrecthighlighter_p.h \ - editor/subcomponenteditortool_p.h \ editor/subcomponentmasklayeritem_p.h \ editor/zoomtool_p.h \ editor/colorpickertool_p.h \ diff --git a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp b/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp index c2ea17c..a97a537 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp +++ b/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool.cpp @@ -85,11 +85,6 @@ QList<QGraphicsItem*> AbstractLiveEditTool::items() const return observer()->selectedItems(); } -void AbstractLiveEditTool::enterContext(QGraphicsItem *itemToEnter) -{ - observer()->data->enterContext(itemToEnter); -} - bool AbstractLiveEditTool::topItemIsMovable(const QList<QGraphicsItem*> & itemList) { QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList); diff --git a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h b/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h index 7d46db6..97aac35 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h +++ b/src/plugins/qmltooling/declarativeobserver/editor/abstractliveedittool_p.h @@ -89,8 +89,6 @@ public: void updateSelectedItems(); QList<QGraphicsItem*> items() const; - void enterContext(QGraphicsItem *itemToEnter); - bool topItemIsMovable(const QList<QGraphicsItem*> &itemList); bool topItemIsResizeHandle(const QList<QGraphicsItem*> &itemList); bool topSelectedItemIsMovable(const QList<QGraphicsItem*> &itemList); diff --git a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp b/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp index 068f6de..e9594d5 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp +++ b/src/plugins/qmltooling/declarativeobserver/editor/boundingrecthighlighter.cpp @@ -253,12 +253,10 @@ void BoundingRectHighlighter::highlightAll(bool animate) return; } QGraphicsObject *item = box->highlightedObject.data(); - QRectF itemAndChildRect = item->boundingRect() | item->childrenBoundingRect(); - QPolygonF boundingRectInSceneSpace(item->mapToScene(itemAndChildRect)); - QPolygonF boundingRectInLayerItemSpace = mapFromScene(boundingRectInSceneSpace); - QRectF bboxRect - = m_view->adjustToScreenBoundaries(boundingRectInLayerItemSpace.boundingRect()); + QRectF boundingRectInSceneSpace(item->mapToScene(item->boundingRect()).boundingRect()); + QRectF boundingRectInLayerItemSpace = mapRectFromScene(boundingRectInSceneSpace); + QRectF bboxRect = m_view->adjustToScreenBoundaries(boundingRectInLayerItemSpace); QRectF edgeRect = bboxRect; edgeRect.adjust(-1, -1, 1, 1); diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator.cpp b/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator.cpp index 44167e3..2752957 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator.cpp +++ b/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator.cpp @@ -44,20 +44,17 @@ #include "../qdeclarativeviewobserver_p_p.h" #include "../qmlobserverconstants_p.h" -#include <QtCore/QDebug> - -#include <QtGui/QGraphicsPolygonItem> +#include <QtGui/QGraphicsRectItem> #include <QtGui/QGraphicsObject> #include <QtGui/QGraphicsScene> #include <QtGui/QPen> -#include <cmath> - QT_BEGIN_NAMESPACE -LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewObserver *editorView, - QGraphicsObject *layerItem) - : m_layerItem(layerItem), m_view(editorView) +LiveSelectionIndicator::LiveSelectionIndicator(QDeclarativeViewObserver *viewObserver, + QGraphicsObject *layerItem) + : m_layerItem(layerItem) + , m_view(viewObserver) { } @@ -68,24 +65,23 @@ LiveSelectionIndicator::~LiveSelectionIndicator() void LiveSelectionIndicator::show() { - foreach (QGraphicsPolygonItem *item, m_indicatorShapeHash.values()) + foreach (QGraphicsRectItem *item, m_indicatorShapeHash) item->show(); } void LiveSelectionIndicator::hide() { - foreach (QGraphicsPolygonItem *item, m_indicatorShapeHash.values()) + foreach (QGraphicsRectItem *item, m_indicatorShapeHash) item->hide(); } void LiveSelectionIndicator::clear() { if (!m_layerItem.isNull()) { - QHashIterator<QGraphicsItem*, QGraphicsPolygonItem *> iter(m_indicatorShapeHash); - while (iter.hasNext()) { - iter.next(); - m_layerItem.data()->scene()->removeItem(iter.value()); - delete iter.value(); + QGraphicsScene *scene = m_layerItem.data()->scene(); + foreach (QGraphicsRectItem *item, m_indicatorShapeHash) { + scene->removeItem(item); + delete item; } } @@ -93,56 +89,29 @@ void LiveSelectionIndicator::clear() } -QPolygonF LiveSelectionIndicator::addBoundingRectToPolygon(QGraphicsItem *item, QPolygonF &polygon) -{ - // ### remove this if statement when QTBUG-12172 gets fixed - if (item->boundingRect() != QRectF(0,0,0,0)) { - QPolygonF bounding = item->mapToScene(item->boundingRect()); - if (bounding.isClosed()) //avoid crashes if there is an infinite scale. - polygon = polygon.united(bounding); - } - - foreach (QGraphicsItem *child, item->childItems()) { - if (!QDeclarativeViewObserverPrivate::get(m_view)->isEditorItem(child)) - addBoundingRectToPolygon(child, polygon); - } - return polygon; -} - void LiveSelectionIndicator::setItems(const QList<QWeakPointer<QGraphicsObject> > &itemList) { clear(); - // set selections to also all children if they are not editor items - foreach (const QWeakPointer<QGraphicsObject> &object, itemList) { if (object.isNull()) continue; QGraphicsItem *item = object.data(); - QGraphicsPolygonItem *newSelectionIndicatorGraphicsItem - = new QGraphicsPolygonItem(m_layerItem.data()); if (!m_indicatorShapeHash.contains(item)) { - m_indicatorShapeHash.insert(item, newSelectionIndicatorGraphicsItem); - - QPolygonF boundingShapeInSceneSpace; - addBoundingRectToPolygon(item, boundingShapeInSceneSpace); - - QRectF boundingRect - = m_view->adjustToScreenBoundaries(boundingShapeInSceneSpace.boundingRect()); - QPolygonF boundingRectInLayerItemSpace = m_layerItem.data()->mapFromScene(boundingRect); - - QPen pen; - pen.setColor(QColor(108, 141, 221)); - newSelectionIndicatorGraphicsItem->setData(Constants::EditorItemDataKey, - QVariant(true)); - newSelectionIndicatorGraphicsItem->setFlag(QGraphicsItem::ItemIsSelectable, false); - newSelectionIndicatorGraphicsItem->setPolygon(boundingRectInLayerItemSpace); - newSelectionIndicatorGraphicsItem->setPen(pen); + QGraphicsRectItem *selectionIndicator = new QGraphicsRectItem(m_layerItem.data()); + m_indicatorShapeHash.insert(item, selectionIndicator); + + const QRectF boundingRect = m_view->adjustToScreenBoundaries(item->mapRectToScene(item->boundingRect())); + const QRectF boundingRectInLayerItemSpace = m_layerItem.data()->mapRectFromScene(boundingRect); + + selectionIndicator->setData(Constants::EditorItemDataKey, true); + selectionIndicator->setFlag(QGraphicsItem::ItemIsSelectable, false); + selectionIndicator->setRect(boundingRectInLayerItemSpace); + selectionIndicator->setPen(QColor(108, 141, 221)); } } } QT_END_NAMESPACE - diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator_p.h b/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator_p.h index 6d2b545..efd2c5f 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator_p.h +++ b/src/plugins/qmltooling/declarativeobserver/editor/liveselectionindicator_p.h @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QGraphicsObject; -class QGraphicsPolygonItem; +class QGraphicsRectItem; class QGraphicsItem; class QPolygonF; QT_END_NAMESPACE @@ -63,7 +63,7 @@ class QDeclarativeViewObserver; class LiveSelectionIndicator { public: - LiveSelectionIndicator(QDeclarativeViewObserver* editorView, QGraphicsObject *layerItem); + LiveSelectionIndicator(QDeclarativeViewObserver *viewObserver, QGraphicsObject *layerItem); ~LiveSelectionIndicator(); void show(); @@ -74,13 +74,9 @@ public: void setItems(const QList<QWeakPointer<QGraphicsObject> > &itemList); private: - QPolygonF addBoundingRectToPolygon(QGraphicsItem *item, QPolygonF &polygon); - -private: - QHash<QGraphicsItem*, QGraphicsPolygonItem *> m_indicatorShapeHash; + QHash<QGraphicsItem*, QGraphicsRectItem *> m_indicatorShapeHash; QWeakPointer<QGraphicsObject> m_layerItem; QDeclarativeViewObserver *m_view; - }; QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp b/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp index 62b6e01..872832c 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp +++ b/src/plugins/qmltooling/declarativeobserver/editor/liveselectiontool.cpp @@ -134,9 +134,6 @@ void LiveSelectionTool::mousePressEvent(QMouseEvent *event) void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos) { - if (!QDeclarativeViewObserverPrivate::get(observer())->mouseInsideContextItem()) - return; - QMenu contextMenu; connect(&contextMenu, SIGNAL(hovered(QAction*)), this, SLOT(contextMenuElementHovered(QAction*))); @@ -192,7 +189,6 @@ void LiveSelectionTool::contextMenuElementSelected() QList<QGraphicsItem*>() << item, false); m_singleSelectionManipulator.end(updatePt); - enterContext(item); } } diff --git a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool.cpp b/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool.cpp deleted file mode 100644 index c3790e4..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool.cpp +++ /dev/null @@ -1,364 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "subcomponenteditortool_p.h" -#include "subcomponentmasklayeritem_p.h" -#include "livelayeritem_p.h" - -#include "../qdeclarativeviewobserver_p_p.h" - -#include <QtGui/QGraphicsItem> -#include <QtGui/QGraphicsObject> -#include <QtGui/QMouseEvent> -#include <QtGui/QKeyEvent> - -#include <QtCore/QTimer> -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -const qreal MaxOpacity = 0.5f; - -SubcomponentEditorTool::SubcomponentEditorTool(QDeclarativeViewObserver *view) - : AbstractLiveEditTool(view), - m_animIncrement(0.05f), - m_animTimer(new QTimer(this)) -{ - QDeclarativeViewObserverPrivate *observerPrivate = - QDeclarativeViewObserverPrivate::get(view); - m_mask = new SubcomponentMaskLayerItem(view, observerPrivate->manipulatorLayer); - connect(m_animTimer, SIGNAL(timeout()), SLOT(animate())); - m_animTimer->setInterval(20); -} - -SubcomponentEditorTool::~SubcomponentEditorTool() -{ - -} - -void SubcomponentEditorTool::mousePressEvent(QMouseEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::mouseMoveEvent(QMouseEvent * /*event*/) -{ - -} - -bool SubcomponentEditorTool::containsCursor(const QPoint &mousePos) const -{ - if (!m_currentContext.size()) - return false; - - QPointF scenePos = view()->mapToScene(mousePos); - QRectF itemRect = m_currentContext.top()->boundingRect() - | m_currentContext.top()->childrenBoundingRect(); - QRectF polyRect = m_currentContext.top()->mapToScene(itemRect).boundingRect(); - - return polyRect.contains(scenePos); -} - -void SubcomponentEditorTool::mouseReleaseEvent(QMouseEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::mouseDoubleClickEvent(QMouseEvent *event) -{ - if (event->buttons() & Qt::LeftButton - && !containsCursor(event->pos()) - && m_currentContext.size() > 1) - { - aboutToPopContext(); - } -} - -void SubcomponentEditorTool::hoverMoveEvent(QMouseEvent *event) -{ - if (!containsCursor(event->pos()) && m_currentContext.size() > 1) { - QDeclarativeViewObserverPrivate::get(observer())->clearHighlight(); - } -} - -void SubcomponentEditorTool::wheelEvent(QWheelEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::keyPressEvent(QKeyEvent * /*event*/) -{ - -} - -void SubcomponentEditorTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/) -{ - -} - -void SubcomponentEditorTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/) -{ - -} - -void SubcomponentEditorTool::animate() -{ - if (m_animIncrement > 0) { - if (m_mask->opacity() + m_animIncrement < MaxOpacity) { - m_mask->setOpacity(m_mask->opacity() + m_animIncrement); - } else { - m_animTimer->stop(); - m_mask->setOpacity(MaxOpacity); - } - } else { - if (m_mask->opacity() + m_animIncrement > 0) { - m_mask->setOpacity(m_mask->opacity() + m_animIncrement); - } else { - m_animTimer->stop(); - m_mask->setOpacity(0); - popContext(); - emit contextPathChanged(m_path); - } - } - -} - -void SubcomponentEditorTool::clear() -{ - m_currentContext.clear(); - m_mask->setCurrentItem(0); - m_animTimer->stop(); - m_mask->hide(); - m_path.clear(); - - emit contextPathChanged(m_path); - emit cleared(); -} - -void SubcomponentEditorTool::selectedItemsChanged(const QList<QGraphicsItem*> &/*itemList*/) -{ - -} - -void SubcomponentEditorTool::setCurrentItem(QGraphicsItem* contextItem) -{ - if (!contextItem) - return; - - QGraphicsObject *gfxObject = contextItem->toGraphicsObject(); - if (!gfxObject) - return; - - //QString parentClassName = gfxObject->metaObject()->className(); - //if (parentClassName.contains(QRegExp("_QMLTYPE_\\d+"))) - - bool containsSelectableItems = false; - foreach (QGraphicsItem *item, gfxObject->childItems()) { - if (item->type() == Constants::EditorItemType - || item->type() == Constants::ResizeHandleItemType) - { - continue; - } - containsSelectableItems = true; - break; - } - - if (containsSelectableItems) { - m_mask->setCurrentItem(gfxObject); - m_mask->setOpacity(0); - m_mask->show(); - m_animIncrement = 0.05f; - m_animTimer->start(); - - QDeclarativeViewObserverPrivate::get(observer())->clearHighlight(); - observer()->setSelectedItems(QList<QGraphicsItem*>()); - - pushContext(gfxObject); - } -} - -QGraphicsItem *SubcomponentEditorTool::firstChildOfContext(QGraphicsItem *item) const -{ - if (!item) - return 0; - - if (isDirectChildOfContext(item)) - return item; - - QGraphicsItem *parent = item->parentItem(); - while (parent) { - if (isDirectChildOfContext(parent)) - return parent; - parent = parent->parentItem(); - } - - return 0; -} - -bool SubcomponentEditorTool::isChildOfContext(QGraphicsItem *item) const -{ - return (firstChildOfContext(item) != 0); -} - -bool SubcomponentEditorTool::isDirectChildOfContext(QGraphicsItem *item) const -{ - return (item->parentItem() == m_currentContext.top()); -} - -bool SubcomponentEditorTool::itemIsChildOfQmlSubComponent(QGraphicsItem *item) const -{ - if (item->parentItem() && item->parentItem() != m_currentContext.top()) { - QGraphicsObject *parent = item->parentItem()->toGraphicsObject(); - QString parentClassName = QLatin1String(parent->metaObject()->className()); - - if (parentClassName.contains(QRegExp(QLatin1String("_QMLTYPE_\\d+")))) { - return true; - } else { - return itemIsChildOfQmlSubComponent(parent); - } - } - - return false; -} - -void SubcomponentEditorTool::pushContext(QGraphicsObject *contextItem) -{ - connect(contextItem, SIGNAL(destroyed(QObject*)), this, SLOT(contextDestroyed(QObject*))); - connect(contextItem, SIGNAL(xChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(yChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(widthChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(heightChanged()), this, SLOT(resizeMask())); - connect(contextItem, SIGNAL(rotationChanged()), this, SLOT(resizeMask())); - - m_currentContext.push(contextItem); - QString title = titleForItem(contextItem); - emit contextPushed(title); - - m_path << title; - emit contextPathChanged(m_path); -} - -void SubcomponentEditorTool::aboutToPopContext() -{ - if (m_currentContext.size() > 2) { - popContext(); - emit contextPathChanged(m_path); - } else { - m_animIncrement = -0.05f; - m_animTimer->start(); - } -} - -QGraphicsObject *SubcomponentEditorTool::popContext() -{ - QGraphicsObject *popped = m_currentContext.pop(); - m_path.removeLast(); - - emit contextPopped(); - - disconnect(popped, SIGNAL(xChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(yChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(scaleChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(widthChanged()), this, SLOT(resizeMask())); - disconnect(popped, SIGNAL(heightChanged()), this, SLOT(resizeMask())); - - if (m_currentContext.size() > 1) { - QGraphicsObject *item = m_currentContext.top(); - m_mask->setCurrentItem(item); - m_mask->setOpacity(MaxOpacity); - m_mask->setVisible(true); - } else { - m_mask->setVisible(false); - } - - return popped; -} - -void SubcomponentEditorTool::resizeMask() -{ - QGraphicsObject *item = m_currentContext.top(); - m_mask->setCurrentItem(item); -} - -QGraphicsObject *SubcomponentEditorTool::currentRootItem() const -{ - return m_currentContext.top(); -} - -void SubcomponentEditorTool::contextDestroyed(QObject *contextToDestroy) -{ - disconnect(contextToDestroy, SIGNAL(destroyed(QObject*)), - this, SLOT(contextDestroyed(QObject*))); - - // pop out the whole context - it might not be safe anymore. - while (m_currentContext.size() > 1) { - m_currentContext.pop(); - m_path.removeLast(); - emit contextPopped(); - } - m_mask->setVisible(false); - - emit contextPathChanged(m_path); -} - -QGraphicsObject *SubcomponentEditorTool::setContext(int contextIndex) -{ - Q_ASSERT(contextIndex >= 0); - - // sometimes we have to delete the context while user was still clicking around, - // so just bail out. - if (contextIndex >= m_currentContext.size() -1) - return 0; - - while (m_currentContext.size() - 1 > contextIndex) { - popContext(); - } - emit contextPathChanged(m_path); - - return m_currentContext.top(); -} - -int SubcomponentEditorTool::contextIndex() const -{ - return m_currentContext.size() - 1; -} - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool_p.h b/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool_p.h deleted file mode 100644 index 29b2956..0000000 --- a/src/plugins/qmltooling/declarativeobserver/editor/subcomponenteditortool_p.h +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SUBCOMPONENTEDITORTOOL_H -#define SUBCOMPONENTEDITORTOOL_H - -#include "abstractliveedittool_p.h" - -#include <QtCore/QStack> -#include <QtCore/QStringList> - -QT_FORWARD_DECLARE_CLASS(QGraphicsObject) -QT_FORWARD_DECLARE_CLASS(QPoint) -QT_FORWARD_DECLARE_CLASS(QTimer) - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class SubcomponentMaskLayerItem; - -class SubcomponentEditorTool : public AbstractLiveEditTool -{ - Q_OBJECT - -public: - SubcomponentEditorTool(QDeclarativeViewObserver *view); - ~SubcomponentEditorTool(); - - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - - void hoverMoveEvent(QMouseEvent *event); - void wheelEvent(QWheelEvent *event); - - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *keyEvent); - void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList); - - void clear(); - - bool containsCursor(const QPoint &mousePos) const; - bool itemIsChildOfQmlSubComponent(QGraphicsItem *item) const; - - bool isChildOfContext(QGraphicsItem *item) const; - bool isDirectChildOfContext(QGraphicsItem *item) const; - QGraphicsItem *firstChildOfContext(QGraphicsItem *item) const; - - void setCurrentItem(QGraphicsItem *contextObject); - - void pushContext(QGraphicsObject *contextItem); - - QGraphicsObject *currentRootItem() const; - QGraphicsObject *setContext(int contextIndex); - int contextIndex() const; - -signals: - void exitContextRequested(); - void cleared(); - void contextPushed(const QString &contextTitle); - void contextPopped(); - void contextPathChanged(const QStringList &path); - -protected: - void selectedItemsChanged(const QList<QGraphicsItem*> &itemList); - -private slots: - void animate(); - void contextDestroyed(QObject *context); - void resizeMask(); - -private: - QGraphicsObject *popContext(); - void aboutToPopContext(); - -private: - QStack<QGraphicsObject *> m_currentContext; - QStringList m_path; - - qreal m_animIncrement; - SubcomponentMaskLayerItem *m_mask; - QTimer *m_animTimer; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // SUBCOMPONENTEDITORTOOL_H diff --git a/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem.cpp b/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem.cpp index da6e82b..27e2079 100644 --- a/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem.cpp +++ b/src/plugins/qmltooling/declarativeobserver/editor/subcomponentmasklayeritem.cpp @@ -86,6 +86,13 @@ static QRectF resizeRect(const QRectF &newRect, const QRectF &oldRect) return result; } +static QPolygonF regionToPolygon(const QRegion ®ion) +{ + QPainterPath path; + foreach (const QRect &rect, region.rects()) + path.addRect(rect); + return path.toFillPolygon(); +} void SubcomponentMaskLayerItem::setCurrentItem(QGraphicsItem *item) { @@ -95,25 +102,24 @@ void SubcomponentMaskLayerItem::setCurrentItem(QGraphicsItem *item) if (!m_currentItem) return; - QPolygonF viewPoly(QRectF(m_observer->declarativeView()->rect())); - viewPoly = m_observer->declarativeView()->mapToScene(viewPoly.toPolygon()); + QRect viewRect = m_observer->declarativeView()->rect(); + viewRect = m_observer->declarativeView()->mapToScene(viewRect).boundingRect().toRect(); QRectF itemRect = item->boundingRect() | item->childrenBoundingRect(); - QPolygonF itemPoly(itemRect); - itemPoly = item->mapToScene(itemPoly); + itemRect = item->mapRectToScene(itemRect); // if updating the same item as before, resize the rectangle only bigger, not smaller. if (prevItem == item && prevItem != 0) { - m_itemPolyRect = resizeRect(itemPoly.boundingRect(), m_itemPolyRect); + m_itemPolyRect = resizeRect(itemRect, m_itemPolyRect); } else { - m_itemPolyRect = itemPoly.boundingRect(); + m_itemPolyRect = itemRect; } QRectF borderRect = m_itemPolyRect; borderRect.adjust(-1, -1, 1, 1); m_borderRect->setRect(borderRect); - itemPoly = viewPoly.subtracted(QPolygonF(m_itemPolyRect)); - setPolygon(itemPoly); + const QRegion externalRegion = QRegion(viewRect).subtracted(m_itemPolyRect.toRect()); + setPolygon(regionToPolygon(externalRegion)); } QGraphicsItem *SubcomponentMaskLayerItem::currentItem() const diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h index 836163e..62722acc 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeobserverprotocol.h @@ -65,7 +65,6 @@ public: ChangeTool = 1, ClearComponentCache = 2, ColorChanged = 3, - ContextPathUpdated = 4, CreateObject = 5, CurrentObjectsChanged = 6, DestroyObject = 7, @@ -75,7 +74,6 @@ public: Reloaded = 11, SetAnimationSpeed = 12, SetAnimationPaused = 18, - SetContextPathIdx = 13, SetCurrentObjects = 14, SetDesignMode = 15, ShowAppOnTop = 16, diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp index 41346ff..a49a758 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver.cpp @@ -51,7 +51,6 @@ #include "editor/colorpickertool_p.h" #include "editor/livelayeritem_p.h" #include "editor/boundingrecthighlighter_p.h" -#include "editor/subcomponenteditortool_p.h" #include "editor/qmltoolbar_p.h" #include <QtDeclarative/QDeclarativeItem> @@ -138,7 +137,6 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, data->zoomTool = new ZoomTool(this); data->colorPickerTool = new ColorPickerTool(this); data->boundingRectHighlighter = new BoundingRectHighlighter(this); - data->subcomponentEditorTool = new SubcomponentEditorTool(this); data->currentTool = data->selectionTool; // to capture ChildRemoved event when viewport changes @@ -158,14 +156,6 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)), this, SLOT(sendColorChanged(QColor))); - connect(data->subcomponentEditorTool, SIGNAL(cleared()), SIGNAL(inspectorContextCleared())); - connect(data->subcomponentEditorTool, SIGNAL(contextPushed(QString)), - SIGNAL(inspectorContextPushed(QString))); - connect(data->subcomponentEditorTool, SIGNAL(contextPopped()), - SIGNAL(inspectorContextPopped())); - connect(data->subcomponentEditorTool, SIGNAL(contextPathChanged(QStringList)), - this, SLOT(sendContextPathUpdated(QStringList))); - data->_q_changeToSingleSelectTool(); } @@ -173,15 +163,6 @@ QDeclarativeViewObserver::~QDeclarativeViewObserver() { } -void QDeclarativeViewObserver::setObserverContext(int contextIndex) -{ - if (data->subcomponentEditorTool->contextIndex() != contextIndex) { - QGraphicsObject *object = data->subcomponentEditorTool->setContext(contextIndex); - if (object) - setSelectedItems(QList<QGraphicsItem*>() << object); - } -} - void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible) { #if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR) @@ -196,7 +177,6 @@ void QDeclarativeViewObserverPrivate::_q_setToolBoxVisible(bool visible) void QDeclarativeViewObserverPrivate::_q_reloadView() { - subcomponentEditorTool->clear(); clearHighlight(); emit q->reloadRequested(); } @@ -318,10 +298,8 @@ bool QDeclarativeViewObserver::mouseMoveEvent(QMouseEvent *event) declarativeView()->setToolTip(QString()); } if (event->buttons()) { - data->subcomponentEditorTool->mouseMoveEvent(event); data->currentTool->mouseMoveEvent(event); } else { - data->subcomponentEditorTool->hoverMoveEvent(event); data->currentTool->hoverMoveEvent(event); } return true; @@ -331,7 +309,6 @@ bool QDeclarativeViewObserver::mouseReleaseEvent(QMouseEvent *event) { if (!data->designModeBehavior) return false; - data->subcomponentEditorTool->mouseReleaseEvent(event); data->cursorPos = event->pos(); data->currentTool->mouseReleaseEvent(event); @@ -366,11 +343,6 @@ bool QDeclarativeViewObserver::keyReleaseEvent(QKeyEvent *event) case Qt::Key_Z: data->_q_changeToZoomTool(); break; - case Qt::Key_Enter: - case Qt::Key_Return: - if (!data->selectedItems().isEmpty()) - data->subcomponentEditorTool->setCurrentItem(data->selectedItems().first()); - break; case Qt::Key_Space: setAnimationPaused(!data->animationPaused); break; @@ -435,41 +407,11 @@ void QDeclarativeViewObserverPrivate::_q_removeFromSelection(QObject *obj) setSelectedItems(items); } -QGraphicsItem *QDeclarativeViewObserverPrivate::currentRootItem() const -{ - return subcomponentEditorTool->currentRootItem(); -} - -bool QDeclarativeViewObserver::mouseDoubleClickEvent(QMouseEvent *event) +bool QDeclarativeViewObserver::mouseDoubleClickEvent(QMouseEvent * /*event*/) { if (!data->designModeBehavior) return false; - if (data->currentToolMode != Constants::SelectionToolMode - && data->currentToolMode != Constants::MarqueeSelectionToolMode) - return true; - - QGraphicsItem *itemToEnter = 0; - QList<QGraphicsItem*> itemList = data->view->items(event->pos()); - data->filterForSelection(itemList); - - if (data->selectedItems().isEmpty() && !itemList.isEmpty()) { - itemToEnter = itemList.first(); - } else if (!data->selectedItems().isEmpty() && !itemList.isEmpty()) { - itemToEnter = itemList.first(); - } - - if (itemToEnter) - itemToEnter = data->subcomponentEditorTool->firstChildOfContext(itemToEnter); - - data->subcomponentEditorTool->setCurrentItem(itemToEnter); - data->subcomponentEditorTool->mouseDoubleClickEvent(event); - - if ((event->buttons() & Qt::LeftButton) && itemToEnter) { - if (QGraphicsObject *objectToEnter = itemToEnter->toGraphicsObject()) - setSelectedItems(QList<QGraphicsItem*>() << objectToEnter); - } - return true; } @@ -481,16 +423,6 @@ bool QDeclarativeViewObserver::wheelEvent(QWheelEvent *event) return true; } -void QDeclarativeViewObserverPrivate::enterContext(QGraphicsItem *itemToEnter) -{ - QGraphicsItem *itemUnderCurrentContext = itemToEnter; - if (itemUnderCurrentContext) - itemUnderCurrentContext = subcomponentEditorTool->firstChildOfContext(itemToEnter); - - if (itemUnderCurrentContext) - subcomponentEditorTool->setCurrentItem(itemToEnter); -} - void QDeclarativeViewObserver::setDesignModeBehavior(bool value) { emit designModeBehaviorChanged(value); @@ -500,14 +432,6 @@ void QDeclarativeViewObserver::setDesignModeBehavior(bool value) sendDesignModeBehavior(value); data->designModeBehavior = value; - if (data->subcomponentEditorTool) { - data->subcomponentEditorTool->clear(); - data->clearHighlight(); - data->setSelectedItems(QList<QGraphicsItem*>()); - - if (data->view->rootObject()) - data->subcomponentEditorTool->pushContext(data->view->rootObject()); - } if (!data->designModeBehavior) data->clearEditorItems(); @@ -557,7 +481,7 @@ void QDeclarativeViewObserverPrivate::changeTool(Constants::DesignTool tool, } } -void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(QList<QGraphicsItem *> items) +void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(const QList<QGraphicsItem *> &items) { foreach (const QWeakPointer<QGraphicsObject> &obj, currentSelection) { if (QGraphicsItem *item = obj.data()) { @@ -582,7 +506,7 @@ void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(QList<QGraphicsIt currentTool->updateSelectedItems(); } -void QDeclarativeViewObserverPrivate::setSelectedItems(QList<QGraphicsItem *> items) +void QDeclarativeViewObserverPrivate::setSelectedItems(const QList<QGraphicsItem *> &items) { QList<QWeakPointer<QGraphicsObject> > oldList = currentSelection; setSelectedItemsForTools(items); @@ -628,12 +552,7 @@ void QDeclarativeViewObserverPrivate::clearHighlight() boundingRectHighlighter->clear(); } -void QDeclarativeViewObserverPrivate::highlight(QGraphicsObject * item, ContextFlags flags) -{ - highlight(QList<QGraphicsObject*>() << item, flags); -} - -void QDeclarativeViewObserverPrivate::highlight(QList<QGraphicsObject *> items, ContextFlags flags) +void QDeclarativeViewObserverPrivate::highlight(const QList<QGraphicsObject *> &items) { if (items.isEmpty()) return; @@ -641,8 +560,6 @@ void QDeclarativeViewObserverPrivate::highlight(QList<QGraphicsObject *> items, QList<QGraphicsObject*> objectList; foreach (QGraphicsItem *item, items) { QGraphicsItem *child = item; - if (flags & ContextSensitive) - child = subcomponentEditorTool->firstChildOfContext(item); if (child) { QGraphicsObject *childObject = child->toGraphicsObject(); @@ -654,30 +571,24 @@ void QDeclarativeViewObserverPrivate::highlight(QList<QGraphicsObject *> items, boundingRectHighlighter->highlight(objectList); } -bool QDeclarativeViewObserverPrivate::mouseInsideContextItem() const -{ - return subcomponentEditorTool->containsCursor(cursorPos.toPoint()); -} - QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::selectableItems( const QPointF &scenePos) const { QList<QGraphicsItem*> itemlist = view->scene()->items(scenePos); - return filterForCurrentContext(itemlist); + return filterForSelection(itemlist); } QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::selectableItems(const QPoint &pos) const { QList<QGraphicsItem*> itemlist = view->items(pos); - return filterForCurrentContext(itemlist); + return filterForSelection(itemlist); } QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::selectableItems( const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const { QList<QGraphicsItem*> itemlist = view->scene()->items(sceneRect, selectionMode); - - return filterForCurrentContext(itemlist); + return filterForSelection(itemlist); } void QDeclarativeViewObserverPrivate::_q_changeToSingleSelectTool() @@ -737,11 +648,6 @@ void QDeclarativeViewObserverPrivate::_q_changeToColorPickerTool() q->sendCurrentTool(Constants::ColorPickerMode); } -void QDeclarativeViewObserverPrivate::_q_changeContextPathIndex(int index) -{ - subcomponentEditorTool->setContext(index); -} - void QDeclarativeViewObserver::setAnimationSpeed(qreal slowDownFactor) { Q_ASSERT(slowDownFactor > 0); @@ -793,38 +699,13 @@ QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::filterForSelection( QList<QGraphicsItem*> &itemlist) const { foreach (QGraphicsItem *item, itemlist) { - if (isEditorItem(item) || !subcomponentEditorTool->isChildOfContext(item)) + if (isEditorItem(item)) itemlist.removeOne(item); } return itemlist; } -QList<QGraphicsItem*> QDeclarativeViewObserverPrivate::filterForCurrentContext( - QList<QGraphicsItem*> &itemlist) const -{ - foreach (QGraphicsItem *item, itemlist) { - - if (isEditorItem(item) || !subcomponentEditorTool->isDirectChildOfContext(item)) { - - // if we're a child, but not directly, replace with the parent that is directly in context. - if (QGraphicsItem *contextParent = subcomponentEditorTool->firstChildOfContext(item)) { - if (contextParent != item) { - if (itemlist.contains(contextParent)) { - itemlist.removeOne(item); - } else { - itemlist.replace(itemlist.indexOf(item), contextParent); - } - } - } else { - itemlist.removeOne(item); - } - } - } - - return itemlist; -} - bool QDeclarativeViewObserverPrivate::isEditorItem(QGraphicsItem *item) const { return (item->type() == Constants::EditorItemType @@ -834,14 +715,8 @@ bool QDeclarativeViewObserverPrivate::isEditorItem(QGraphicsItem *item) const void QDeclarativeViewObserverPrivate::_q_onStatusChanged(QDeclarativeView::Status status) { - if (status == QDeclarativeView::Ready) { - if (view->rootObject()) { - if (subcomponentEditorTool->contextIndex() != -1) - subcomponentEditorTool->clear(); - subcomponentEditorTool->pushContext(view->rootObject()); - } + if (status == QDeclarativeView::Ready) q->sendReloaded(); - } } void QDeclarativeViewObserverPrivate::_q_onCurrentObjectsChanged(QList<QObject*> objects) @@ -849,17 +724,15 @@ void QDeclarativeViewObserverPrivate::_q_onCurrentObjectsChanged(QList<QObject*> QList<QGraphicsItem*> items; QList<QGraphicsObject*> gfxObjects; foreach (QObject *obj, objects) { - QDeclarativeItem* declarativeItem = qobject_cast<QDeclarativeItem*>(obj); - if (declarativeItem) { + if (QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(obj)) { items << declarativeItem; - if (QGraphicsObject *gfxObj = declarativeItem->toGraphicsObject()) - gfxObjects << gfxObj; + gfxObjects << declarativeItem; } } if (designModeBehavior) { setSelectedItemsForTools(items); clearHighlight(); - highlight(gfxObjects, QDeclarativeViewObserverPrivate::IgnoreContext); + highlight(gfxObjects); } } @@ -942,9 +815,7 @@ void QDeclarativeViewObserver::handleMessage(const QByteArray &message) for (int i = 0; i < itemCount; ++i) { int debugId = -1; ds >> debugId; - QObject *obj = QDeclarativeDebugService::objectForId(debugId); - - if (obj) + if (QObject *obj = QDeclarativeDebugService::objectForId(debugId)) selectedObjects << obj; } @@ -1038,12 +909,6 @@ void QDeclarativeViewObserver::handleMessage(const QByteArray &message) } break; } - case ObserverProtocol::SetContextPathIdx: { - int contextPathIndex; - ds >> contextPathIndex; - data->_q_changeContextPathIndex(contextPathIndex); - break; - } case ObserverProtocol::ClearComponentCache: { data->_q_clearComponentCache(); break; @@ -1064,7 +929,7 @@ void QDeclarativeViewObserver::sendDesignModeBehavior(bool inDesignMode) data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendCurrentObjects(QList<QObject*> objects) +void QDeclarativeViewObserver::sendCurrentObjects(const QList<QObject*> &objects) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); @@ -1144,17 +1009,6 @@ void QDeclarativeViewObserver::sendColorChanged(const QColor &color) data->debugService->sendMessage(message); } -void QDeclarativeViewObserver::sendContextPathUpdated(const QStringList &contextPath) -{ - QByteArray message; - QDataStream ds(&message, QIODevice::WriteOnly); - - ds << ObserverProtocol::ContextPathUpdated - << contextPath; - - data->debugService->sendMessage(message); -} - QString QDeclarativeViewObserver::idStringForObject(QObject *obj) const { int id = QDeclarativeDebugService::idForObject(obj); diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h index 4d66cae..5c70c98 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p.h @@ -78,7 +78,7 @@ public: bool showAppOnTop() const; void sendDesignModeBehavior(bool inDesignMode); - void sendCurrentObjects(QList<QObject*> items); + void sendCurrentObjects(const QList<QObject*> &); void sendAnimationSpeed(qreal slowDownFactor); void sendAnimationPaused(bool paused); void sendCurrentTool(Constants::DesignTool toolId); @@ -89,7 +89,6 @@ public: public Q_SLOTS: void sendColorChanged(const QColor &color); - void sendContextPathUpdated(const QStringList &contextPath); void setDesignModeBehavior(bool value); bool designModeBehavior(); @@ -99,8 +98,6 @@ public Q_SLOTS: void setAnimationSpeed(qreal factor); void setAnimationPaused(bool paused); - void setObserverContext(int contextIndex); - Q_SIGNALS: void designModeBehaviorChanged(bool inDesignMode); void showAppOnTopChanged(bool showAppOnTop); @@ -114,10 +111,6 @@ Q_SIGNALS: void animationSpeedChanged(qreal factor); void animationPausedChanged(bool paused); - void inspectorContextCleared(); - void inspectorContextPushed(const QString &contextTitle); - void inspectorContextPopped(); - protected: bool eventFilter(QObject *obj, QEvent *event); diff --git a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h index 57dae45..19e4898 100644 --- a/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h +++ b/src/plugins/qmltooling/declarativeobserver/qdeclarativeviewobserver_p_p.h @@ -61,7 +61,6 @@ class ZoomTool; class ColorPickerTool; class LiveLayerItem; class BoundingRectHighlighter; -class SubcomponentEditorTool; class ToolBox; class AbstractLiveEditTool; @@ -69,11 +68,6 @@ class QDeclarativeViewObserverPrivate : public QObject { Q_OBJECT public: - enum ContextFlags { - IgnoreContext, - ContextSensitive - }; - QDeclarativeViewObserverPrivate(QDeclarativeViewObserver *); ~QDeclarativeViewObserverPrivate(); @@ -92,7 +86,6 @@ public: LiveSelectionTool *selectionTool; ZoomTool *zoomTool; ColorPickerTool *colorPickerTool; - SubcomponentEditorTool *subcomponentEditorTool; LiveLayerItem *manipulatorLayer; BoundingRectHighlighter *boundingRectHighlighter; @@ -110,31 +103,26 @@ public: void clearEditorItems(); void createToolBox(); void changeToSelectTool(); - QList<QGraphicsItem*> filterForCurrentContext(QList<QGraphicsItem*> &itemlist) const; QList<QGraphicsItem*> filterForSelection(QList<QGraphicsItem*> &itemlist) const; QList<QGraphicsItem*> selectableItems(const QPoint &pos) const; QList<QGraphicsItem*> selectableItems(const QPointF &scenePos) const; QList<QGraphicsItem*> selectableItems(const QRectF &sceneRect, Qt::ItemSelectionMode selectionMode) const; - void setSelectedItemsForTools(QList<QGraphicsItem *> items); - void setSelectedItems(QList<QGraphicsItem *> items); + void setSelectedItemsForTools(const QList<QGraphicsItem *> &items); + void setSelectedItems(const QList<QGraphicsItem *> &items); QList<QGraphicsItem *> selectedItems() const; void changeTool(Constants::DesignTool tool, Constants::ToolFlags flags = Constants::NoToolFlags); void clearHighlight(); - void highlight(QList<QGraphicsObject *> item, ContextFlags flags = ContextSensitive); - void highlight(QGraphicsObject *item, ContextFlags flags = ContextSensitive); + void highlight(const QList<QGraphicsObject *> &item); + inline void highlight(QGraphicsObject *item) + { highlight(QList<QGraphicsObject*>() << item); } - bool mouseInsideContextItem() const; bool isEditorItem(QGraphicsItem *item) const; - QGraphicsItem *currentRootItem() const; - - void enterContext(QGraphicsItem *itemToEnter); - public slots: void _q_setToolBoxVisible(bool visible); @@ -150,7 +138,6 @@ public slots: void _q_changeToMarqueeSelectTool(); void _q_changeToZoomTool(); void _q_changeToColorPickerTool(); - void _q_changeContextPathIndex(int index); void _q_clearComponentCache(); void _q_removeFromSelection(QObject *); diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index 17fa4db..2cfdd22 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -1716,7 +1716,7 @@ EXPORTS ?inWorkerThread@QDeclarativeListModel@@ABE_NXZ @ 1715 NONAME ABSENT ; bool QDeclarativeListModel::inWorkerThread(void) const ?canMove@QDeclarativeListModel@@ABE_NHHH@Z @ 1716 NONAME ABSENT ; bool QDeclarativeListModel::canMove(int, int, int) const ?getScriptEngine@QDeclarativeDebugHelper@@SAPAVQScriptEngine@@PAVQDeclarativeEngine@@@Z @ 1717 NONAME ABSENT ; class QScriptEngine * QDeclarativeDebugHelper::getScriptEngine(class QDeclarativeEngine *) - ?setAnimationSlowDownFactor@QDeclarativeDebugHelper@@SAXM@Z @ 1718 NONAME ABSENT ; void QDeclarativeDebugHelper::setAnimationSlowDownFactor(float) + ?setAnimationSlowDownFactor@QDeclarativeDebugHelper@@SAXM@Z @ 1718 NONAME ; void QDeclarativeDebugHelper::setAnimationSlowDownFactor(float) ?add@QDeclarativeBasePositioner@@QBEPAVQDeclarativeTransition@@XZ @ 1719 NONAME ABSENT ; class QDeclarativeTransition * QDeclarativeBasePositioner::add(void) const ?setLoops@QDeclarativeAbstractAnimation@@QAEXH@Z @ 1720 NONAME ABSENT ; void QDeclarativeAbstractAnimation::setLoops(int) ?trUtf8@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0@Z @ 1721 NONAME ABSENT ; class QString QDeclarativeAbstractAnimation::trUtf8(char const *, char const *) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 813bbf8..f4a3481 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12979,7 +12979,7 @@ EXPORTS ?byteCount@QVolatileImage@@QBEHXZ @ 12978 NONAME ; int QVolatileImage::byteCount(void) const ??0QVolatileImage@@QAE@ABV0@@Z @ 12979 NONAME ; QVolatileImage::QVolatileImage(class QVolatileImage const &) ?depth@QVolatileImage@@QBEHXZ @ 12980 NONAME ; int QVolatileImage::depth(void) const - ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12981 NONAME ; void QGraphicsSystem::releaseCachedResources(void) + ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12981 NONAME ABSENT ; void QGraphicsSystem::releaseCachedResources(void) ?qt_s60_setPartialScreenInputMode@@YAX_N@Z @ 12982 NONAME ; void qt_s60_setPartialScreenInputMode(bool) png_access_version_number @ 12983 NONAME png_benign_error @ 12984 NONAME @@ -13953,4 +13953,84 @@ EXPORTS ?staticMetaObjectExtraData@QWorkspace@@0UQMetaObjectExtraData@@B @ 13952 NONAME ; struct QMetaObjectExtraData const QWorkspace::staticMetaObjectExtraData ?staticMetaObjectExtraData@QSessionManager@@0UQMetaObjectExtraData@@B @ 13953 NONAME ; struct QMetaObjectExtraData const QSessionManager::staticMetaObjectExtraData ?qt_static_metacall@QGraphicsItemAnimation@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13954 NONAME ; void QGraphicsItemAnimation::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) - + ?setCursorMoveStyle@QLineControl@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13955 NONAME ABSENT ; void QLineControl::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?staticMetaObjectExtraData@QIdentityProxyModel@@0UQMetaObjectExtraData@@B @ 13956 NONAME ; struct QMetaObjectExtraData const QIdentityProxyModel::staticMetaObjectExtraData + ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13957 NONAME ABSENT ; enum QTextCursor::MoveStyle QTextDocument::defaultCursorMoveStyle(void) const + ?offsetInLigature@QTextEngine@@QAE?AUQFixed@@PBUQScriptItem@@HHH@Z @ 13958 NONAME ; struct QFixed QTextEngine::offsetInLigature(struct QScriptItem const *, int, int, int) + ?qt_metacall@QIdentityProxyModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13959 NONAME ; int QIdentityProxyModel::qt_metacall(enum QMetaObject::Call, int, void * *) + ?mapSelectionFromSource@QIdentityProxyModel@@UBE?AVQItemSelection@@ABV2@@Z @ 13960 NONAME ; class QItemSelection QIdentityProxyModel::mapSelectionFromSource(class QItemSelection const &) const + ?qt_static_metacall@QIdentityProxyModel@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13961 NONAME ; void QIdentityProxyModel::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?mapSelectionToSource@QIdentityProxyModel@@UBE?AVQItemSelection@@ABV2@@Z @ 13962 NONAME ; class QItemSelection QIdentityProxyModel::mapSelectionToSource(class QItemSelection const &) const + ??1QIdentityProxyModel@@UAE@XZ @ 13963 NONAME ; QIdentityProxyModel::~QIdentityProxyModel(void) + ??_EQIdentityProxyModel@@UAE@I@Z @ 13964 NONAME ; QIdentityProxyModel::~QIdentityProxyModel(unsigned int) + ?removeRows@QIdentityProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 13965 NONAME ; bool QIdentityProxyModel::removeRows(int, int, class QModelIndex const &) + ?previousLogicalPosition@QTextEngine@@QBEHH@Z @ 13966 NONAME ; int QTextEngine::previousLogicalPosition(int) const + ?metaObject@QIdentityProxyModel@@UBEPBUQMetaObject@@XZ @ 13967 NONAME ; struct QMetaObject const * QIdentityProxyModel::metaObject(void) const + ?cursorMoveStyle@QLineControl@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13968 NONAME ABSENT ; enum QTextCursor::MoveStyle QLineControl::cursorMoveStyle(void) const + ?removeColumns@QIdentityProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 13969 NONAME ; bool QIdentityProxyModel::removeColumns(int, int, class QModelIndex const &) + ?alignLine@QTextEngine@@QAE?AUQFixed@@ABUQScriptLine@@@Z @ 13970 NONAME ; struct QFixed QTextEngine::alignLine(struct QScriptLine const &) + ?qt_s60_setPartialScreenAutomaticTranslation@@YAX_N@Z @ 13971 NONAME ; void qt_s60_setPartialScreenAutomaticTranslation(bool) + ?parent@QIdentityProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 13972 NONAME ; class QModelIndex QIdentityProxyModel::parent(class QModelIndex const &) const + ?insertColumns@QIdentityProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 13973 NONAME ; bool QIdentityProxyModel::insertColumns(int, int, class QModelIndex const &) + ?dropMimeData@QIdentityProxyModel@@UAE_NPBVQMimeData@@W4DropAction@Qt@@HHABVQModelIndex@@@Z @ 13974 NONAME ; bool QIdentityProxyModel::dropMimeData(class QMimeData const *, enum Qt::DropAction, int, int, class QModelIndex const &) + ?visualCursorMovement@QTextEngine@@QBE_NXZ @ 13975 NONAME ; bool QTextEngine::visualCursorMovement(void) const + ??0QRadialGradient@@QAE@MMMMMM@Z @ 13976 NONAME ; QRadialGradient::QRadialGradient(float, float, float, float, float, float) + ?setSourceModel@QIdentityProxyModel@@UAEXPAVQAbstractItemModel@@@Z @ 13977 NONAME ; void QIdentityProxyModel::setSourceModel(class QAbstractItemModel *) + ?getStaticMetaObject@QIdentityProxyModel@@SAABUQMetaObject@@XZ @ 13978 NONAME ; struct QMetaObject const & QIdentityProxyModel::getStaticMetaObject(void) + ?index@QIdentityProxyModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 13979 NONAME ; class QModelIndex QIdentityProxyModel::index(int, int, class QModelIndex const &) const + ?setInstantInvalidatePropagation@QGraphicsLayout@@SAX_N@Z @ 13980 NONAME ; void QGraphicsLayout::setInstantInvalidatePropagation(bool) + ?paintingActive@QVolatileImage@@QBE_NXZ @ 13981 NONAME ; bool QVolatileImage::paintingActive(void) const + ?insertRows@QIdentityProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 13982 NONAME ; bool QIdentityProxyModel::insertRows(int, int, class QModelIndex const &) + ?positionAfterVisualMovement@QTextEngine@@QAEHHW4MoveOperation@QTextCursor@@@Z @ 13983 NONAME ; int QTextEngine::positionAfterVisualMovement(int, enum QTextCursor::MoveOperation) + ?setCenterRadius@QRadialGradient@@QAEXM@Z @ 13984 NONAME ; void QRadialGradient::setCenterRadius(float) + ?leftCursorPosition@QTextLayout@@QBEHH@Z @ 13985 NONAME ; int QTextLayout::leftCursorPosition(int) const + ?focalRadius@QRadialGradient@@QBEMXZ @ 13986 NONAME ; float QRadialGradient::focalRadius(void) const + ?qt_metacast@QIdentityProxyModel@@UAEPAXPBD@Z @ 13987 NONAME ; void * QIdentityProxyModel::qt_metacast(char const *) + ?qt_draw_decoration_for_glyphs@@YAXPAVQPainter@@PBIPBUQFixedPoint@@HPAVQFontEngine@@ABVQFont@@ABVQTextCharFormat@@@Z @ 13988 NONAME ; void qt_draw_decoration_for_glyphs(class QPainter *, unsigned int const *, struct QFixedPoint const *, int, class QFontEngine *, class QFont const &, class QTextCharFormat const &) + ??0QRadialGradient@@QAE@ABVQPointF@@M0M@Z @ 13989 NONAME ; QRadialGradient::QRadialGradient(class QPointF const &, float, class QPointF const &, float) + ?centerRadius@QRadialGradient@@QBEMXZ @ 13990 NONAME ; float QRadialGradient::centerRadius(void) const + ?qt_isExtendedRadialGradient@@YA_NABVQBrush@@@Z @ 13991 NONAME ; bool qt_isExtendedRadialGradient(class QBrush const &) + ?mapToSource@QIdentityProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 13992 NONAME ; class QModelIndex QIdentityProxyModel::mapToSource(class QModelIndex const &) const + ?d_func@QIdentityProxyModel@@AAEPAVQIdentityProxyModelPrivate@@XZ @ 13993 NONAME ; class QIdentityProxyModelPrivate * QIdentityProxyModel::d_func(void) + ?insertionPointsForLine@QTextEngine@@QAEXHAAV?$QVector@H@@@Z @ 13994 NONAME ; void QTextEngine::insertionPointsForLine(int, class QVector<int> &) + ?cloneWithSize@QFontEngine@@UBEPAV1@M@Z @ 13995 NONAME ; class QFontEngine * QFontEngine::cloneWithSize(float) const + ?setCursorMoveStyle@QLineEdit@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13996 NONAME ABSENT ; void QLineEdit::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ??0QIdentityProxyModel@@IAE@AAVQIdentityProxyModelPrivate@@PAVQObject@@@Z @ 13997 NONAME ; QIdentityProxyModel::QIdentityProxyModel(class QIdentityProxyModelPrivate &, class QObject *) + ?lineNumberForTextPosition@QTextEngine@@QAEHH@Z @ 13998 NONAME ; int QTextEngine::lineNumberForTextPosition(int) + ?instantInvalidatePropagation@QGraphicsLayout@@SA_NXZ @ 13999 NONAME ; bool QGraphicsLayout::instantInvalidatePropagation(void) + ?beginningOfLine@QTextEngine@@AAEHH@Z @ 14000 NONAME ; int QTextEngine::beginningOfLine(int) + ??0QIdentityProxyModel@@QAE@PAVQObject@@@Z @ 14001 NONAME ; QIdentityProxyModel::QIdentityProxyModel(class QObject *) + ?rightCursorPosition@QTextLayout@@QBEHH@Z @ 14002 NONAME ; int QTextLayout::rightCursorPosition(int) const + ?d_func@QIdentityProxyModel@@ABEPBVQIdentityProxyModelPrivate@@XZ @ 14003 NONAME ; class QIdentityProxyModelPrivate const * QIdentityProxyModel::d_func(void) const + ?columnCount@QIdentityProxyModel@@UBEHABVQModelIndex@@@Z @ 14004 NONAME ; int QIdentityProxyModel::columnCount(class QModelIndex const &) const + ?cursorMoveStyle@QLineEdit@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 14005 NONAME ABSENT ; enum QTextCursor::MoveStyle QLineEdit::cursorMoveStyle(void) const + ?trUtf8@QIdentityProxyModel@@SA?AVQString@@PBD0H@Z @ 14006 NONAME ; class QString QIdentityProxyModel::trUtf8(char const *, char const *, int) + ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4MoveStyle@QTextCursor@@@Z @ 14007 NONAME ABSENT ; void QTextDocument::setDefaultCursorMoveStyle(enum QTextCursor::MoveStyle) + ?actionText@QUndoCommand@@QBE?AVQString@@XZ @ 14008 NONAME ; class QString QUndoCommand::actionText(void) const + ?tr@QIdentityProxyModel@@SA?AVQString@@PBD0H@Z @ 14009 NONAME ; class QString QIdentityProxyModel::tr(char const *, char const *, int) + ?mapFromSource@QIdentityProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 14010 NONAME ; class QModelIndex QIdentityProxyModel::mapFromSource(class QModelIndex const &) const + ?nextLogicalPosition@QTextEngine@@QBEHH@Z @ 14011 NONAME ; int QTextEngine::nextLogicalPosition(int) const + ?setCursorMoveStyle@QTextLayout@@QAEXW4MoveStyle@QTextCursor@@@Z @ 14012 NONAME ABSENT ; void QTextLayout::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?doItemsLayout@QTableView@@UAEXXZ @ 14013 NONAME ; void QTableView::doItemsLayout(void) + ?setFocalRadius@QRadialGradient@@QAEXM@Z @ 14014 NONAME ; void QRadialGradient::setFocalRadius(float) + ?qt_painterPathFromVectorPath@@YA?AVQPainterPath@@ABVQVectorPath@@@Z @ 14015 NONAME ; class QPainterPath qt_painterPathFromVectorPath(class QVectorPath const &) + ?tr@QIdentityProxyModel@@SA?AVQString@@PBD0@Z @ 14016 NONAME ; class QString QIdentityProxyModel::tr(char const *, char const *) + ?match@QIdentityProxyModel@@UBE?AV?$QList@VQModelIndex@@@@ABVQModelIndex@@HABVQVariant@@HV?$QFlags@W4MatchFlag@Qt@@@@@Z @ 14017 NONAME ; class QList<class QModelIndex> QIdentityProxyModel::match(class QModelIndex const &, int, class QVariant const &, int, class QFlags<enum Qt::MatchFlag>) const + ?staticMetaObject@QIdentityProxyModel@@2UQMetaObject@@B @ 14018 NONAME ; struct QMetaObject const QIdentityProxyModel::staticMetaObject + ?rowCount@QIdentityProxyModel@@UBEHABVQModelIndex@@@Z @ 14019 NONAME ; int QIdentityProxyModel::rowCount(class QModelIndex const &) const + ?trUtf8@QIdentityProxyModel@@SA?AVQString@@PBD0@Z @ 14020 NONAME ; class QString QIdentityProxyModel::trUtf8(char const *, char const *) + ?cursorMoveStyle@QTextLayout@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 14021 NONAME ABSENT ; enum QTextCursor::MoveStyle QTextLayout::cursorMoveStyle(void) const + ?endOfLine@QTextEngine@@AAEHH@Z @ 14022 NONAME ; int QTextEngine::endOfLine(int) + ?setCursorMoveStyle@QTextLayout@@QAEXW4CursorMoveStyle@Qt@@@Z @ 14023 NONAME ; void QTextLayout::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 14024 NONAME ; enum Qt::CursorMoveStyle QTextDocument::defaultCursorMoveStyle(void) const + ?cursorMoveStyle@QTextLayout@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 14025 NONAME ; enum Qt::CursorMoveStyle QTextLayout::cursorMoveStyle(void) const + ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4CursorMoveStyle@Qt@@@Z @ 14026 NONAME ; void QTextDocument::setDefaultCursorMoveStyle(enum Qt::CursorMoveStyle) + ?setCursorMoveStyle@QLineControl@@QAEXW4CursorMoveStyle@Qt@@@Z @ 14027 NONAME ; void QLineControl::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?cursorMoveStyle@QLineEdit@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 14028 NONAME ; enum Qt::CursorMoveStyle QLineEdit::cursorMoveStyle(void) const + ?forceToRaster@QSymbianGraphicsSystemEx@@UAEXPAVQWidget@@@Z @ 14029 NONAME ; void QSymbianGraphicsSystemEx::forceToRaster(class QWidget *) + ?releaseCachedGpuResources@QSymbianGraphicsSystemEx@@UAEXXZ @ 14030 NONAME ; void QSymbianGraphicsSystemEx::releaseCachedGpuResources(void) + ?setCursorMoveStyle@QLineEdit@@QAEXW4CursorMoveStyle@Qt@@@Z @ 14031 NONAME ; void QLineEdit::setCursorMoveStyle(enum Qt::CursorMoveStyle) + ?platformExtension@QGraphicsSystem@@UAEPAVQGraphicsSystemEx@@XZ @ 14032 NONAME ; class QGraphicsSystemEx * QGraphicsSystem::platformExtension(void) + ?releaseAllGpuResources@QSymbianGraphicsSystemEx@@UAEXXZ @ 14033 NONAME ; void QSymbianGraphicsSystemEx::releaseAllGpuResources(void) + ?cursorMoveStyle@QLineControl@@QBE?AW4CursorMoveStyle@Qt@@XZ @ 14034 NONAME ; enum Qt::CursorMoveStyle QLineControl::cursorMoveStyle(void) const + ?hasBCM2727@QSymbianGraphicsSystemEx@@UAE_NXZ @ 14035 NONAME ; bool QSymbianGraphicsSystemEx::hasBCM2727(void) diff --git a/src/s60installs/bwins/QtOpenGLu.def b/src/s60installs/bwins/QtOpenGLu.def index f1db022..f1edc23 100644 --- a/src/s60installs/bwins/QtOpenGLu.def +++ b/src/s60installs/bwins/QtOpenGLu.def @@ -715,7 +715,7 @@ EXPORTS ?detachTextureFromPool@QGLPixmapData@@QAEXXZ @ 714 NONAME ; void QGLPixmapData::detachTextureFromPool(void) ?reclaimTexture@QGLPixmapData@@QAEXXZ @ 715 NONAME ; void QGLPixmapData::reclaimTexture(void) ?destroyTexture@QGLPixmapData@@QAEXXZ @ 716 NONAME ; void QGLPixmapData::destroyTexture(void) - ?releaseCachedResources@QGLGraphicsSystem@@UAEXXZ @ 717 NONAME ; void QGLGraphicsSystem::releaseCachedResources(void) + ?releaseCachedResources@QGLGraphicsSystem@@UAEXXZ @ 717 NONAME ABSENT ; void QGLGraphicsSystem::releaseCachedResources(void) ?serialNumber@QGLTextureGlyphCache@@QBEHXZ @ 718 NONAME ; int QGLTextureGlyphCache::serialNumber(void) const ?forceToImage@QGLPixmapData@@QAEXXZ @ 719 NONAME ; void QGLPixmapData::forceToImage(void) ?idealFormat@QGLPixmapData@@QAE?AW4Format@QImage@@AAV3@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 720 NONAME ; enum QImage::Format QGLPixmapData::idealFormat(class QImage &, class QFlags<enum Qt::ImageConversionFlag>) @@ -860,4 +860,19 @@ EXPORTS ?glShaderSource@QGLFunctions@@QAEXIHPAPBDPBH@Z @ 859 NONAME ; void QGLFunctions::glShaderSource(unsigned int, int, char const * *, int const *) ?glGetShaderPrecisionFormat@QGLFunctions@@QAEXIIPAH0@Z @ 860 NONAME ; void QGLFunctions::glGetShaderPrecisionFormat(unsigned int, unsigned int, int *, int *) ?insert@QGLContextGroupResourceBase@@QAEXPBVQGLContext@@PAX@Z @ 861 NONAME ; void QGLContextGroupResourceBase::insert(class QGLContext const *, void *) - + ?staticMetaObjectExtraData@QGLWindowSurface@@0UQMetaObjectExtraData@@B @ 862 NONAME ; struct QMetaObjectExtraData const QGLWindowSurface::staticMetaObjectExtraData + ?qt_static_metacall@QGLSignalProxy@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 863 NONAME ; void QGLSignalProxy::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?staticMetaObjectExtraData@QGLSignalProxy@@0UQMetaObjectExtraData@@B @ 864 NONAME ; struct QMetaObjectExtraData const QGLSignalProxy::staticMetaObjectExtraData + ?qt_static_metacall@QGLWindowSurface@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 865 NONAME ; void QGLWindowSurface::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?staticMetaObjectExtraData@QGLWidget@@0UQMetaObjectExtraData@@B @ 866 NONAME ; struct QMetaObjectExtraData const QGLWidget::staticMetaObjectExtraData + ?qt_static_metacall@QGraphicsShaderEffect@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 867 NONAME ; void QGraphicsShaderEffect::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?qt_static_metacall@QGLEngineShaderManager@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 868 NONAME ; void QGLEngineShaderManager::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?staticMetaObjectExtraData@QGLShader@@0UQMetaObjectExtraData@@B @ 869 NONAME ; struct QMetaObjectExtraData const QGLShader::staticMetaObjectExtraData + ?staticMetaObjectExtraData@QGLShaderProgram@@0UQMetaObjectExtraData@@B @ 870 NONAME ; struct QMetaObjectExtraData const QGLShaderProgram::staticMetaObjectExtraData + ?qt_static_metacall@QGLWidget@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 871 NONAME ; void QGLWidget::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?qt_static_metacall@QGLShader@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 872 NONAME ; void QGLShader::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?staticMetaObjectExtraData@QGraphicsShaderEffect@@0UQMetaObjectExtraData@@B @ 873 NONAME ; struct QMetaObjectExtraData const QGraphicsShaderEffect::staticMetaObjectExtraData + ?staticMetaObjectExtraData@QGLEngineShaderManager@@0UQMetaObjectExtraData@@B @ 874 NONAME ; struct QMetaObjectExtraData const QGLEngineShaderManager::staticMetaObjectExtraData + ?qt_static_metacall@QGLShaderProgram@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 875 NONAME ; void QGLShaderProgram::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?platformExtension@QGLGraphicsSystem@@UAEPAVQGraphicsSystemEx@@XZ @ 876 NONAME ; class QGraphicsSystemEx * QGLGraphicsSystem::platformExtension(void) + ?releaseCachedGpuResources@QGLGraphicsSystem@@UAEXXZ @ 877 NONAME ; void QGLGraphicsSystem::releaseCachedGpuResources(void) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 8cd3dd4..ecdec9d 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12180,7 +12180,7 @@ EXPORTS _ZNK14QVolatileImage7toImageEv @ 12179 NONAME _ZNK14QVolatileImage9byteCountEv @ 12180 NONAME _ZNK14QVolatileImage9constBitsEv @ 12181 NONAME - _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME + _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME ABSENT _Z32qt_s60_setPartialScreenInputModeb @ 12183 NONAME _Z18qt_addBitmapToPathffPKhiiiP12QPainterPath @ 12184 NONAME _Z22qt_fontdata_from_indexi @ 12185 NONAME @@ -12288,7 +12288,7 @@ EXPORTS _ZN11QTextEngine27positionAfterVisualMovementEiN11QTextCursor13MoveOperationE @ 12287 NONAME _ZN11QTextEngine9alignLineERK11QScriptLine @ 12288 NONAME _ZN11QTextEngine9endOfLineEi @ 12289 NONAME - _ZN11QTextLayout18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12290 NONAME + _ZN11QTextLayout18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12290 NONAME ABSENT _ZN11QTextObject18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12291 NONAME _ZN11QTextObject25staticMetaObjectExtraDataE @ 12292 NONAME DATA 8 _ZN11QToolButton18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12293 NONAME @@ -12352,7 +12352,7 @@ EXPORTS _ZN13QSwipeGesture18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12351 NONAME _ZN13QSwipeGesture25staticMetaObjectExtraDataE @ 12352 NONAME DATA 8 _ZN13QTextDocument18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12353 NONAME - _ZN13QTextDocument25setDefaultCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12354 NONAME + _ZN13QTextDocument25setDefaultCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12354 NONAME ABSENT _ZN13QTextDocument25staticMetaObjectExtraDataE @ 12355 NONAME DATA 8 _ZN13QWidgetAction18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12356 NONAME _ZN13QWidgetAction25staticMetaObjectExtraDataE @ 12357 NONAME DATA 8 @@ -12641,7 +12641,7 @@ EXPORTS _ZN9QGroupBox18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12640 NONAME _ZN9QGroupBox25staticMetaObjectExtraDataE @ 12641 NONAME DATA 8 _ZN9QLineEdit18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12642 NONAME - _ZN9QLineEdit18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12643 NONAME + _ZN9QLineEdit18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12643 NONAME ABSENT _ZN9QLineEdit25staticMetaObjectExtraDataE @ 12644 NONAME DATA 8 _ZN9QListView18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12645 NONAME _ZN9QListView25staticMetaObjectExtraDataE @ 12646 NONAME DATA 8 @@ -12666,7 +12666,7 @@ EXPORTS _ZNK10QBlittable12capabilitiesEv @ 12665 NONAME _ZNK10QBlittable4sizeEv @ 12666 NONAME _ZNK10QTabWidget14heightForWidthEi @ 12667 NONAME - _ZNK10QTextBlock7isValidEv @ 12668 NONAME + _ZNK10QTextBlock7isValidEv @ 12668 NONAME ABSENT _ZNK10QZipWriter10isWritableEv @ 12669 NONAME _ZNK10QZipWriter17compressionPolicyEv @ 12670 NONAME _ZNK10QZipWriter19creationPermissionsEv @ 12671 NONAME @@ -12738,4 +12738,15 @@ EXPORTS _ZTV19QIdentityProxyModel @ 12737 NONAME _ZTV20QBlittablePixmapData @ 12738 NONAME _Zls6QDebugPK13QSymbianEvent @ 12739 NONAME + _ZN11QTextLayout18setCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12740 NONAME + _ZN13QTextDocument25setDefaultCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12741 NONAME + _ZN15QGraphicsSystem17platformExtensionEv @ 12742 NONAME + _ZN24QSymbianGraphicsSystemEx10hasBCM2727Ev @ 12743 NONAME + _ZN24QSymbianGraphicsSystemEx13forceToRasterEP7QWidget @ 12744 NONAME + _ZN24QSymbianGraphicsSystemEx22releaseAllGpuResourcesEv @ 12745 NONAME + _ZN24QSymbianGraphicsSystemEx25releaseCachedGpuResourcesEv @ 12746 NONAME + _ZN9QLineEdit18setCursorMoveStyleEN2Qt15CursorMoveStyleE @ 12747 NONAME + _ZTI17QGraphicsSystemEx @ 12748 NONAME + _ZTI24QSymbianGraphicsSystemEx @ 12749 NONAME + _ZTV24QSymbianGraphicsSystemEx @ 12750 NONAME diff --git a/src/s60installs/eabi/QtOpenGLu.def b/src/s60installs/eabi/QtOpenGLu.def index c252484..2b67d2c 100644 --- a/src/s60installs/eabi/QtOpenGLu.def +++ b/src/s60installs/eabi/QtOpenGLu.def @@ -719,7 +719,7 @@ EXPORTS _ZN13QGLPixmapData14reclaimTextureEv @ 718 NONAME _ZN13QGLPixmapData21detachTextureFromPoolEv @ 719 NONAME _ZN13QGLPixmapData9hibernateEv @ 720 NONAME - _ZN17QGLGraphicsSystem22releaseCachedResourcesEv @ 721 NONAME + _ZN17QGLGraphicsSystem22releaseCachedResourcesEv @ 721 NONAME ABSENT _ZN13QGLPixmapData11idealFormatER6QImage6QFlagsIN2Qt19ImageConversionFlagEE @ 722 NONAME _ZN13QGLPixmapData24releaseNativeImageHandleEv @ 723 NONAME _ZN13QGLPixmapData25initFromNativeImageHandleEPvRK7QString @ 724 NONAME @@ -780,4 +780,7 @@ EXPORTS _ZN9QGLShader25staticMetaObjectExtraDataE @ 779 NONAME DATA 8 _ZN9QGLWidget18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 780 NONAME _ZN9QGLWidget25staticMetaObjectExtraDataE @ 781 NONAME DATA 8 + _ZN17QGLGraphicsSystem17platformExtensionEv @ 782 NONAME + _ZN17QGLGraphicsSystem25releaseCachedGpuResourcesEv @ 783 NONAME + _ZThn4_N17QGLGraphicsSystem25releaseCachedGpuResourcesEv @ 784 NONAME diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index 748d918..0be3385 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -82,7 +82,7 @@ static inline QString moduleHeader(const QString &module, const QString &header) namespace CPP { WriteIncludes::WriteIncludes(Uic *uic) - : m_uic(uic), m_output(uic->output()), m_scriptsActivated(false) + : m_uic(uic), m_output(uic->output()), m_scriptsActivated(false), m_laidOut(false) { // When possible (no namespace) use the "QtModule/QClass" convention // and create a re-mapping of the old header "qclass.h" to it. Do not do this @@ -106,6 +106,7 @@ WriteIncludes::WriteIncludes(Uic *uic) void WriteIncludes::acceptUI(DomUI *node) { m_scriptsActivated = false; + m_laidOut = false; m_localIncludes.clear(); m_globalIncludes.clear(); m_knownClasses.clear(); @@ -160,6 +161,7 @@ void WriteIncludes::acceptWidget(DomWidget *node) void WriteIncludes::acceptLayout(DomLayout *node) { add(node->attributeClass()); + m_laidOut = true; TreeWalker::acceptLayout(node); } @@ -236,6 +238,9 @@ void WriteIncludes::add(const QString &className, bool determineHeader, const QS m_knownClasses.insert(className); + if (!m_laidOut && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QToolBox"))) + add(QLatin1String("QLayout")); // spacing property of QToolBox) + if (className == QLatin1String("Line")) { // ### hmm, deprecate me! add(QLatin1String("QFrame")); return; diff --git a/src/tools/uic/cpp/cppwriteincludes.h b/src/tools/uic/cpp/cppwriteincludes.h index 39b1ddf..e821536 100644 --- a/src/tools/uic/cpp/cppwriteincludes.h +++ b/src/tools/uic/cpp/cppwriteincludes.h @@ -107,6 +107,7 @@ private: StringMap m_oldHeaderToNewHeader; bool m_scriptsActivated; + bool m_laidOut; }; } // namespace CPP diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 06d054b..cd8c96c 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1527,7 +1527,7 @@ void WriteInitialization::writeProperties(const QString &varName, case DomProperty::Url: { const DomUrl* u = p->elementUrl(); - propertyValue = QString::fromLatin1("QUrl(%1)") + propertyValue = QString::fromLatin1("QUrl(QString::fromUtf8(%1))") .arg(fixString(u->elementString()->text(), m_dindent)); break; } diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index 361d7f3..9c20bd6 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -224,7 +224,7 @@ void tst_QDeclarativeDebug::recursiveObjectTest(QObject *o, const QDeclarativeDe QCOMPARE(p.name(), QString::fromUtf8(pmeta.name())); - if (pmeta.type() < QVariant::UserType) // TODO test complex types + if (pmeta.type() > 0 && pmeta.type() < QVariant::UserType) // TODO test complex types QCOMPARE(p.value(), pmeta.read(o)); if (p.name() == "parent") @@ -1027,7 +1027,7 @@ void tst_QDeclarativeDebug::setBindingForObject() // set handler // rootObject = findRootObject(); - QCOMPARE(rootObject.children().size(), 4); // Rectangle, Text, MouseArea, QDeclarativeComponentAttached + QCOMPARE(rootObject.children().size(), 5); // Rectangle, Text, MouseArea, Component.onCompleted, NonScriptPropertyElement QDeclarativeDebugObjectReference mouseAreaObject = rootObject.children().at(2); QDeclarativeDebugObjectQuery *q_obj = m_dbg->queryObjectRecursive(mouseAreaObject, this); waitForQuery(q_obj); diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp index 2686a00..335e832 100644 --- a/tests/auto/headers/tst_headers.cpp +++ b/tests/auto/headers/tst_headers.cpp @@ -177,7 +177,7 @@ void tst_Headers::allSourceFilesData() || sourceFile.endsWith("/src/corelib/global/qconfig.h") || sourceFile.endsWith("/src/corelib/global/qconfig.cpp") || sourceFile.endsWith("/src/tools/uic/qclass_lib_map.h") - || sourceFile.endsWith("src/network/access/qnetworkcookiejartlds_p.h") + || sourceFile.endsWith("src/corelib/io/qurltlds_p.h") ) continue; diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index c21fd03..b2ce5ca 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -371,11 +371,18 @@ void tst_NetworkSelfTest::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession.reset(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession.reset(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif } diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index e4372c5..aefe0b9 100644 --- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -141,11 +141,18 @@ void tst_QAbstractNetworkCache::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession.reset(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession.reset(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif } diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp index 1fa0787..7e431cf 100644 --- a/tests/auto/qftp/tst_qftp.cpp +++ b/tests/auto/qftp/tst_qftp.cpp @@ -155,6 +155,7 @@ private: QFtp *ftp; #ifndef QT_NO_BEARERMANAGEMENT + QNetworkConfigurationManager *netConfMan; QSharedPointer<QNetworkSession> networkSessionExplicit; QSharedPointer<QNetworkSession> networkSessionImplicit; #endif @@ -225,10 +226,20 @@ void tst_QFtp::initTestCase_data() void tst_QFtp::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT - QNetworkConfigurationManager manager; - networkSessionImplicit = QSharedPointer<QNetworkSession>(new QNetworkSession(manager.defaultConfiguration())); - networkSessionImplicit->open(); - QVERIFY(networkSessionImplicit->waitForOpened(60000)); //there may be user prompt on 1st connect + netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QNetworkConfiguration networkConfiguration = netConfMan->defaultConfiguration(); + if (networkConfiguration.isValid()) { + networkSessionImplicit = QSharedPointer<QNetworkSession>(new QNetworkSession(networkConfiguration)); + if (!networkSessionImplicit->isOpen()) { + networkSessionImplicit->open(); + QVERIFY(networkSessionImplicit->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); + } #endif } @@ -254,6 +265,8 @@ void tst_QFtp::init() } #ifndef QT_NO_BEARERMANAGEMENT if (setSession) { + if (!networkSessionImplicit) + QSKIP("test requires a valid default network configuration", SkipSingle); networkSessionExplicit = networkSessionImplicit; if (!networkSessionExplicit->isOpen()) { networkSessionExplicit->open(); diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp index c528a5c..2fa5e76 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp @@ -197,13 +197,19 @@ tst_QHostInfo::~tst_QHostInfo() void tst_QHostInfo::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT - //start the default network netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession.reset(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession.reset(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif @@ -213,6 +219,13 @@ void tst_QHostInfo::initTestCase() #else ipv6Available = false; ipv6LookupsAvailable = false; + + QTcpServer server; + if (server.listen(QHostAddress("::1"))) { + // We have IPv6 support + ipv6Available = true; + } + #if !defined(QT_NO_GETADDRINFO) // check if the system getaddrinfo can do IPv6 lookups struct addrinfo hint, *result = 0; @@ -235,13 +248,6 @@ void tst_QHostInfo::initTestCase() #endif #endif - QTcpServer server; - if (server.listen(QHostAddress("::1"))) { - // We have IPv6 support - ipv6Available = true; - } - - // run each testcase with and without test enabled QTest::addColumn<bool>("cache"); QTest::newRow("WithCache") << true; diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index d59a510..1b4256b 100644 --- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -42,7 +42,7 @@ #include <QtTest/QtTest> #include <QtNetwork/QNetworkCookieJar> -#include "private/qnetworkcookiejar_p.h" +#include "private/qtldurl_p.h" class tst_QNetworkCookieJar: public QObject { @@ -438,7 +438,7 @@ void tst_QNetworkCookieJar::effectiveTLDs() #endif QFETCH(QString, domain); QFETCH(bool, isTLD); - QCOMPARE(QNetworkCookieJarPrivate::isEffectiveTLD(domain), isTLD); + QCOMPARE(qIsEffectiveTLD(domain), isTLD); } QTEST_MAIN(tst_QNetworkCookieJar) diff --git a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp index ae3436d..2077717 100644 --- a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp +++ b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp @@ -89,11 +89,18 @@ void tst_QNetworkInterface::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession.reset(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession.reset(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif } diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index c70075f..25925bd 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -219,6 +219,8 @@ private Q_SLOTS: void putGetDeleteGetFromHttp(); void sendCustomRequestToHttp_data(); void sendCustomRequestToHttp(); + void connectToIPv6Address_data(); + void connectToIPv6Address(); void ioGetFromData_data(); void ioGetFromData(); @@ -447,14 +449,19 @@ public: QSemaphore ready; bool doClose; bool doSsl; + bool ipv6; bool multiple; int totalConnections; - MiniHttpServer(const QByteArray &data, bool ssl = false, QThread *thread = 0) - : client(0), dataToTransmit(data), doClose(true), doSsl(ssl), + MiniHttpServer(const QByteArray &data, bool ssl = false, QThread *thread = 0, bool useipv6 = false) + : client(0), dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6), multiple(false), totalConnections(0) { - listen(); + if(useipv6) { + listen(QHostAddress::AnyIPv6); + } else { + listen(); + } if (thread) { connect(thread, SIGNAL(started()), this, SLOT(threadStartedSlot())); moveToThread(thread); @@ -466,7 +473,7 @@ public: protected: void incomingConnection(int socketDescriptor) { - //qDebug() << "incomingConnection" << socketDescriptor; + //qDebug() << "incomingConnection" << socketDescriptor << "doSsl:" << doSsl << "ipv6:" << ipv6; if (!doSsl) { client = new QTcpSocket; client->setSocketDescriptor(socketDescriptor); @@ -1283,11 +1290,18 @@ void tst_QNetworkReply::initTestCase() #endif #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession.reset(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession.reset(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif } @@ -2326,6 +2340,49 @@ void tst_QNetworkReply::putGetDeleteGetFromHttp() } +void tst_QNetworkReply::connectToIPv6Address_data() +{ + QTest::addColumn<QUrl>("url"); + QTest::addColumn<QNetworkReply::NetworkError>("error"); + QTest::addColumn<QByteArray>("dataToSend"); + QTest::addColumn<QByteArray>("hostfield"); + QTest::newRow("localhost") << QUrl(QByteArray("http://[::1]")) << QNetworkReply::NoError<< QByteArray("localhost") << QByteArray("[::1]"); + //QTest::newRow("ipv4localhost") << QUrl(QByteArray("http://127.0.0.1")) << QNetworkReply::NoError<< QByteArray("ipv4localhost") << QByteArray("127.0.0.1"); + //to add more test data here +} + +void tst_QNetworkReply::connectToIPv6Address() +{ + QFETCH(QUrl, url); + QFETCH(QNetworkReply::NetworkError, error); + QFETCH(QByteArray, dataToSend); + QFETCH(QByteArray, hostfield); + + QByteArray httpResponse = QByteArray("HTTP/1.0 200 OK\r\nContent-Length: "); + httpResponse += QByteArray::number(dataToSend.size()); + httpResponse += "\r\n\r\n"; + httpResponse += dataToSend; + + MiniHttpServer server(httpResponse, false, NULL/*thread*/, true/*useipv6*/); + server.doClose = true; + + url.setPort(server.serverPort()); + QNetworkRequest request(url); + + QNetworkReplyPtr reply = manager.get(request); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QByteArray content = reply->readAll(); + //qDebug() << server.receivedData; + QByteArray hostinfo = "\r\nHost: " + hostfield + ":" + QByteArray::number(server.serverPort()) + "\r\n"; + QSKIP("Fix this -- Host Info verification failed on Windows XP", SkipAll); + QVERIFY(server.receivedData.contains(hostinfo)); + QVERIFY(content == dataToSend); + QCOMPARE(reply->url(), request.url()); + QVERIFY(reply->error() == error); +} + void tst_QNetworkReply::sendCustomRequestToHttp_data() { QTest::addColumn<QUrl>("url"); diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem new file mode 100644 index 0000000..e1b731d --- /dev/null +++ b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICkTCCAfqgAwIBAgIJAL1nF+PLAF2KMA0GCSqGSIb3DQEBBQUAMGkxKzApBgNV +BAoMIkjElcSCxrLDvyDKjeG6v8qI4bq34bi7IFLDqWPDtnJkxZ0xFTATBgNVBAsM +DOOIp0HjiYHvvatCQzEWMBQGA1UEAwwNSm9obm55IEd1aXRhcjELMAkGA1UEBhMC +Tk8wHhcNMTEwNTA1MDgxMzEwWhcNMTEwNjA0MDgxMzEwWjBpMSswKQYDVQQKDCJI +xJXEgsayw78gyo3hur/KiOG6t+G4uyBSw6ljw7ZyZMWdMRUwEwYDVQQLDAzjiKdB +44mB772rQkMxFjAUBgNVBAMMDUpvaG5ueSBHdWl0YXIxCzAJBgNVBAYTAk5PMIGf +MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2zSxS17I6596dJE/VAmGz+06D9S8n +3C0hnIGNVu+LwbgDJTvOw0SzNj4UP72UGgd3UI1KLBg5XWIsRNmE3COJMMh6syjI +L1Ept+tVXxGL6n4gl+0nZ7dkUyxJmeFtigYrL+qCH1yd5rmf3sC3jO4IosuAiG66 +IDkJEVo64NT8ZQIDAQABo0EwPzA9BgNVHREENjA0gQ9hcm5lQGZvb2Jhci5vcmeC +Dnd3dy5mb29iYXIub3JngRFiamFybmVAZm9vYmFyLm9yZzANBgkqhkiG9w0BAQUF +AAOBgQAqVhbC0/EUFdnKlYV3PrknwGX1dPEPGJuIQHa0KpoicvNiOhs1HxBDYbzc +F6wcAMEynq4YwGKhcQLZOs2mo0LreAjA9rU/yBnqrnUW/4gxtUUvmJKK+62IjfLp +eO1L+1NcEMJiaZf8fip4VXhXdOYUhgE8WUZ1UJRC6w3T/yAgcQ== +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san new file mode 100644 index 0000000..f46a637 --- /dev/null +++ b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san @@ -0,0 +1,5 @@ +[subj_alt_name] +subjectAltName=\ + email:arne@foobar.org,\ + DNS:www.foobar.org,\ + email:bjarne@foobar.org diff --git a/tests/auto/qsslcertificate/certificates/gencertificates.sh b/tests/auto/qsslcertificate/certificates/gencertificates.sh index 9f873d9..0bac191 100755 --- a/tests/auto/qsslcertificate/certificates/gencertificates.sh +++ b/tests/auto/qsslcertificate/certificates/gencertificates.sh @@ -90,5 +90,15 @@ openssl req -x509 -in req-san.pem -out $outname -key rsa-pri-1024.pem \ -config san.cnf -extensions subj_alt_name /bin/cp san.cnf $outname.san +#--- Non-ASCII Subject --------------------------------------------------------------------- +echo -e "\n generating self signed root cert. with Subject containing UTF-8 characters ..." +outname=cert-ss-san-utf8.pem +#subject="/O=HĕĂƲÿ ʍếʈặḻ Récördŝ/OU=㈧A㉁ォBC/CN=Johnny Guitar/C=NO" +subject=$'/O=H\xc4\x95\xc4\x82\xc6\xb2\xc3\xbf \xca\x8d\xe1\xba\xbf\xca\x88\xe1\xba\xb7\xe1\xb8\xbb R\xc3\xa9c\xc3\xb6rd\xc5\x9d/OU=\xe3\x88\xa7A\xe3\x89\x81\xef\xbd\xabBC/CN=Johnny Guitar/C=NO' +openssl req -out req-san.pem -new -key rsa-pri-1024.pem -utf8 -subj "$subject" +openssl req -x509 -in req-san.pem -out $outname -key rsa-pri-1024.pem \ + -config san.cnf -extensions subj_alt_name -nameopt multiline,utf8,-esc_msb +/bin/cp san.cnf $outname.san + echo -e "\n cleaning up ..." /bin/rm rsa-pri-1024.pem rsa-pub-1024.* req*.pem diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index c38147d..9276685 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -96,6 +96,7 @@ private slots: void digest_data(); void digest(); void alternateSubjectNames_data(); + void utf8SubjectNames(); void alternateSubjectNames(); void publicKey_data(); void publicKey(); @@ -407,6 +408,27 @@ void tst_QSslCertificate::alternateSubjectNames() } } +void tst_QSslCertificate::utf8SubjectNames() +{ + QSslCertificate cert = QSslCertificate::fromPath("certificates/cert-ss-san-utf8.pem", QSsl::Pem, + QRegExp::FixedString).first(); + QVERIFY(!cert.isNull()); + + // O is "Heavy Metal Records" with heavy use of "decorations" like accents, umlauts etc., + // OU uses arabian / asian script letters near codepoint 64K. + // strings split where the compiler would otherwise find three-digit hex numbers + static const char *o = "H\xc4\x95\xc4\x82\xc6\xb2\xc3\xbf \xca\x8d\xe1\xba\xbf\xca\x88\xe1\xba" + "\xb7\xe1\xb8\xbb R\xc3\xa9" "c" "\xc3\xb6rd\xc5\x9d"; + static const char *ou = "\xe3\x88\xa7" "A" "\xe3\x89\x81\xef\xbd\xab" "BC"; + + // the following two tests should help find "\x"-literal encoding bugs in the test itself + QCOMPARE(cert.subjectInfo("O").length(), QString::fromUtf8(o).length()); + QCOMPARE (cert.subjectInfo("O").toUtf8().toHex(), QByteArray(o).toHex()); + + QCOMPARE(cert.subjectInfo("O"), QString::fromUtf8(o)); + QCOMPARE(cert.subjectInfo("OU"), QString::fromUtf8(ou)); +} + void tst_QSslCertificate::publicKey_data() { QTest::addColumn<QString>("certFilePath"); @@ -519,13 +541,13 @@ void tst_QSslCertificate::fromPath_data() QTest::newRow("\"certificates/*\" fixed der") << QString("certificates/*") << int(QRegExp::FixedString) << false << 0; QTest::newRow("\"certificates/*\" regexp pem") << QString("certificates/*") << int(QRegExp::RegExp) << true << 0; QTest::newRow("\"certificates/*\" regexp der") << QString("certificates/*") << int(QRegExp::RegExp) << false << 0; - QTest::newRow("\"certificates/*\" wildcard pem") << QString("certificates/*") << int(QRegExp::Wildcard) << true << 4; + QTest::newRow("\"certificates/*\" wildcard pem") << QString("certificates/*") << int(QRegExp::Wildcard) << true << 5; QTest::newRow("\"certificates/*\" wildcard der") << QString("certificates/*") << int(QRegExp::Wildcard) << false << 0; QTest::newRow("\"c*/c*.pem\" fixed pem") << QString("c*/c*.pem") << int(QRegExp::FixedString) << true << 0; QTest::newRow("\"c*/c*.pem\" fixed der") << QString("c*/c*.pem") << int(QRegExp::FixedString) << false << 0; QTest::newRow("\"c*/c*.pem\" regexp pem") << QString("c*/c*.pem") << int(QRegExp::RegExp) << true << 0; QTest::newRow("\"c*/c*.pem\" regexp der") << QString("c*/c*.pem") << int(QRegExp::RegExp) << false << 0; - QTest::newRow("\"c*/c*.pem\" wildcard pem") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << true << 4; + QTest::newRow("\"c*/c*.pem\" wildcard pem") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << true << 5; QTest::newRow("\"c*/c*.pem\" wildcard der") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << false << 0; QTest::newRow("\"d*/c*.pem\" fixed pem") << QString("d*/c*.pem") << int(QRegExp::FixedString) << true << 0; QTest::newRow("\"d*/c*.pem\" fixed der") << QString("d*/c*.pem") << int(QRegExp::FixedString) << false << 0; @@ -535,7 +557,7 @@ void tst_QSslCertificate::fromPath_data() QTest::newRow("\"d*/c*.pem\" wildcard der") << QString("d*/c*.pem") << int(QRegExp::Wildcard) << false << 0; QTest::newRow("\"c.*/c.*.pem\" fixed pem") << QString("c.*/c.*.pem") << int(QRegExp::FixedString) << true << 0; QTest::newRow("\"c.*/c.*.pem\" fixed der") << QString("c.*/c.*.pem") << int(QRegExp::FixedString) << false << 0; - QTest::newRow("\"c.*/c.*.pem\" regexp pem") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << true << 4; + QTest::newRow("\"c.*/c.*.pem\" regexp pem") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << true << 5; QTest::newRow("\"c.*/c.*.pem\" regexp der") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << false << 0; QTest::newRow("\"c.*/c.*.pem\" wildcard pem") << QString("c.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0; QTest::newRow("\"c.*/c.*.pem\" wildcard der") << QString("c.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0; @@ -546,7 +568,7 @@ void tst_QSslCertificate::fromPath_data() QTest::newRow("\"d.*/c.*.pem\" wildcard pem") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0; QTest::newRow("\"d.*/c.*.pem\" wildcard der") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0; #ifdef Q_OS_LINUX - QTest::newRow("absolute path wildcard pem") << QString(QDir::currentPath() + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 4; + QTest::newRow("absolute path wildcard pem") << QString(QDir::currentPath() + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 5; #endif QTest::newRow("trailing-whitespace") << QString("more-certificates/trailing-whitespace.pem") << int(QRegExp::FixedString) << true << 1; @@ -769,7 +791,7 @@ void tst_QSslCertificate::nulInCN() QString cn = cert.subjectInfo(QSslCertificate::CommonName); QVERIFY(cn != "www.bank.com"); - static const char realCN[] = "www.bank.com\\x00.badguy.com"; + static const char realCN[] = "www.bank.com\0.badguy.com"; QCOMPARE(cn, QString::fromLatin1(realCN, sizeof realCN - 1)); } diff --git a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp index 22a90cf..f4249ab 100644 --- a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -146,6 +146,15 @@ void tst_QtConcurrentMap::map() QCOMPARE(numberList, QList<Number>() << 2 << 4 << 6); QtConcurrent::map(numberList.begin(), numberList.end(), &Number::multiplyBy2).waitForFinished(); QCOMPARE(numberList, QList<Number>() << 4 << 8 << 12); + +#ifdef Q_COMPILER_LAMBDA + // lambda + QtConcurrent::map(list, [](int &x){x *= 2;}).waitForFinished(); + QCOMPARE(list, QList<int>() << 128 << 256 << 384); + QtConcurrent::map(list.begin(), list.end(), [](int &x){x *= 2;}).waitForFinished(); + QCOMPARE(list, QList<int>() << 256 << 512 << 768); +#endif + } // functors don't take arguments by reference, making these no-ops @@ -170,6 +179,14 @@ void tst_QtConcurrentMap::map() QCOMPARE(list, QList<int>() << 1 << 2 << 3); QtConcurrent::map(list.begin(), list.end(), multiplyBy2Immutable).waitForFinished(); QCOMPARE(list, QList<int>() << 1 << 2 << 3); + +#ifdef Q_COMPILER_LAMBDA + // lambda + QtConcurrent::map(list, [](int x){x *= 2;}).waitForFinished(); + QCOMPARE(list, QList<int>() << 1 << 2 << 3); + QtConcurrent::map(list.begin(), list.end(), [](int x){x *= 2;}).waitForFinished(); + QCOMPARE(list, QList<int>() << 1 << 2 << 3); +#endif } // Linked lists and forward iterators @@ -2303,6 +2320,10 @@ void tst_QtConcurrentMap::stlContainers() { #ifdef QT_NO_STL QSKIP("Qt compiled without STL support", SkipAll); +#elif defined(Q_COMPILER_RVALUE_REFS) + //mapped uses &Container::push_back, but in c++0x, std::vector has two overload of it + // meaning it is not possible to take the address of that function anymore. + QSKIP("mapped do not work with c++0x stl vector", SkipAll); #else std::vector<int> vector; vector.push_back(1); diff --git a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp index e4e9479..cacb09a 100644 --- a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp +++ b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp @@ -67,6 +67,8 @@ private slots: #if 0 void createFunctor(); #endif + void functor(); + void lambda(); }; #if 0 @@ -444,6 +446,71 @@ void tst_QtConcurrentRun::createFunctor() } #endif +struct Functor { + int operator()() { return 42; } + double operator()(double a, double b) { return a/b; } + int operator()(int a, int b) { return a/b; } + void operator()(int) { } + void operator()(int, int, int) { } + void operator()(int, int, int, int) { } + void operator()(int, int, int, int, int) { } + void operator()(int, int, int, int, int, int) { } +}; + +void tst_QtConcurrentRun::functor() +{ + //this test functor without result_type, decltype need to be supported by the compiler +#ifndef Q_COMPILER_DECLTYPE + QSKIP("Compiler do not suport decltype", SkipAll); +#else + Functor f; + { + QFuture<int> fut = QtConcurrent::run(f); + QCOMPARE(fut.result(), 42); + } + { + QFuture<double> fut = QtConcurrent::run(f, 8.5, 1.8); + QCOMPARE(fut.result(), (8.5/1.8)); + } + { + QFuture<int> fut = QtConcurrent::run(f, 19, 3); + QCOMPARE(fut.result(), int(19/3)); + } + { + QtConcurrent::run(f, 1).waitForFinished(); + QtConcurrent::run(f, 1,2).waitForFinished(); + QtConcurrent::run(f, 1,2,3).waitForFinished(); + QtConcurrent::run(f, 1,2,3,4).waitForFinished(); + QtConcurrent::run(f, 1,2,3,4,5).waitForFinished(); + } +#endif +} + + +void tst_QtConcurrentRun::lambda() +{ +#ifndef Q_COMPILER_LAMBDA + QSKIP("Compiler do not suport lambda", SkipAll); +#else + + QCOMPARE(QtConcurrent::run([](){ return 45; }).result(), 45); + QCOMPARE(QtConcurrent::run([](int a){ return a+15; }, 12).result(), 12+15); + QCOMPARE(QtConcurrent::run([](int a, double b){ return a + b; }, 12, 15).result(), double(12+15)); + QCOMPARE(QtConcurrent::run([](int a , int, int, int, int b){ return a + b; }, 1, 2, 3, 4, 5).result(), 1 + 5); + +#ifdef Q_COMPILER_INITIALIZER_LISTS + { + QString str { "Hello World Foo" }; + QFuture<QStringList> f1 = QtConcurrent::run([&](){ return str.split(' '); }); + auto r = f1.result(); + QCOMPARE(r, QStringList({"Hello", "World", "Foo"})); + } +#endif + +#endif +} + + #include "tst_qtconcurrentrun.moc" #else diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp index 3416a7c..a7c2604 100644 --- a/tests/auto/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp @@ -116,6 +116,7 @@ private slots: private: #ifndef QT_NO_BEARERMANAGEMENT QNetworkSession *networkSession; + QNetworkConfigurationManager *netConfMan; #endif }; @@ -154,10 +155,20 @@ void tst_QTcpServer::initTestCase_data() void tst_QTcpServer::initTestCase() { #ifndef QT_NO_BEARERMANAGEMENT - QNetworkConfigurationManager man; - networkSession = new QNetworkSession(man.defaultConfiguration(), this); - networkSession->open(); - QVERIFY(networkSession->waitForOpened()); + netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QNetworkConfiguration networkConfiguration = netConfMan->defaultConfiguration(); + if (networkConfiguration.isValid()) { + networkSession = new QNetworkSession(networkConfiguration); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); + } #endif } diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp index 9ca049b..a38082e 100644 --- a/tests/auto/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp @@ -148,11 +148,18 @@ void tst_QUdpSocket::initTestCase_data() #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); + netConfMan->updateConfigurations(); + connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); networkConfiguration = netConfMan->defaultConfiguration(); - networkSession = QSharedPointer<QNetworkSession>(new QNetworkSession(networkConfiguration)); - if (!networkSession->isOpen()) { - networkSession->open(); - QVERIFY(networkSession->waitForOpened(30000)); + if (networkConfiguration.isValid()) { + networkSession = QSharedPointer<QNetworkSession>(new QNetworkSession(networkConfiguration)); + if (!networkSession->isOpen()) { + networkSession->open(); + QVERIFY(networkSession->waitForOpened(30000)); + } + } else { + QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)); } #endif } diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 613053b..ae27c4a 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -49,6 +49,7 @@ #include <qurl.h> #include <qtextcodec.h> #include <qmap.h> +#include "private/qtldurl_p.h" // For testsuites #define IDNA_ACE_PREFIX "xn--" @@ -88,6 +89,8 @@ public slots: void init(); void cleanup(); private slots: + void effectiveTLDs_data(); + void effectiveTLDs(); void getSetCheck(); void constructing(); void assignment(); @@ -4005,5 +4008,28 @@ void tst_QUrl::taskQTBUG_8701() QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar, QUrl::StrictMode).toString()); } +void tst_QUrl::effectiveTLDs_data() +{ + QTest::addColumn<QUrl>("domain"); + QTest::addColumn<QString>("TLD"); + + QTest::newRow("yes0") << QUrl::fromEncoded("http://test.co.uk") << ".co.uk"; + QTest::newRow("yes1") << QUrl::fromEncoded("http://test.com") << ".com"; + QTest::newRow("yes2") << QUrl::fromEncoded("http://www.test.de") << ".de"; + QTest::newRow("yes3") << QUrl::fromEncoded("http://test.ulm.museum") << ".ulm.museum"; + QTest::newRow("yes4") << QUrl::fromEncoded("http://www.com.krodsherad.no") << ".krodsherad.no"; + QTest::newRow("yes5") << QUrl::fromEncoded("http://www.co.uk.1.bg") << ".1.bg"; + QTest::newRow("yes6") << QUrl::fromEncoded("http://www.com.com.cn") << ".com.cn"; + QTest::newRow("yes7") << QUrl::fromEncoded("http://www.test.org.ws") << ".org.ws"; + QTest::newRow("yes9") << QUrl::fromEncoded("http://www.com.co.uk.wallonie.museum") << ".wallonie.museum"; +} + +void tst_QUrl::effectiveTLDs() +{ + QFETCH(QUrl, domain); + QFETCH(QString, TLD); + QCOMPARE(domain.topLevelDomain(), TLD); +} + QTEST_MAIN(tst_QUrl) #include "tst_qurl.moc" diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/quuid/tst_quuid.cpp index 6333e83..4948312 100644 --- a/tests/auto/quuid/tst_quuid.cpp +++ b/tests/auto/quuid/tst_quuid.cpp @@ -60,7 +60,14 @@ public: tst_QUuid(); private slots: + void fromChar(); void toString(); + void fromString(); + void toByteArray(); + void fromByteArray(); + void toRfc4122(); + void fromRfc4122(); + void check_QDataStream(); void isNull(); void equal(); void notEqual(); @@ -83,16 +90,106 @@ public: tst_QUuid::tst_QUuid() { - uuidA = "{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"; - uuidB = "{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"; + //"{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"; + uuidA = QUuid(0xfc69b59e, 0xcc34 ,0x4436 ,0xa4 ,0x3c ,0xee ,0x95 ,0xd1 ,0x28 ,0xb8 ,0xc5); + + //"{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"; + uuidB = QUuid(0x1ab6e93a ,0xb1cb ,0x4a87 ,0xba ,0x47 ,0xec ,0x7e ,0x99 ,0x03 ,0x9a ,0x7b); } +void tst_QUuid::fromChar() +{ + QCOMPARE(uuidA, QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")); + QCOMPARE(uuidA, QUuid("fc69b59e-cc34-4436-a43c-ee95d128b8c5}")); + QCOMPARE(uuidA, QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c5")); + QCOMPARE(uuidA, QUuid("fc69b59e-cc34-4436-a43c-ee95d128b8c5")); + QCOMPARE(QUuid(), QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c")); + QCOMPARE(QUuid(), QUuid("{fc69b59e-cc34")); + QCOMPARE(QUuid(), QUuid("fc69b59e-cc34-")); + QCOMPARE(QUuid(), QUuid("fc69b59e-cc34")); + QCOMPARE(QUuid(), QUuid("cc34")); + QCOMPARE(QUuid(), QUuid(NULL)); + + QCOMPARE(uuidB, QUuid(QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"))); +} void tst_QUuid::toString() { QCOMPARE(uuidA.toString(), QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")); + + QCOMPARE(uuidB.toString(), QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")); +} + +void tst_QUuid::fromString() +{ + QCOMPARE(uuidA, QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"))); + QCOMPARE(uuidA, QUuid(QString("fc69b59e-cc34-4436-a43c-ee95d128b8c5}"))); + QCOMPARE(uuidA, QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5"))); + QCOMPARE(uuidA, QUuid(QString("fc69b59e-cc34-4436-a43c-ee95d128b8c5"))); + QCOMPARE(QUuid(), QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c"))); + + QCOMPARE(uuidB, QUuid(QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"))); +} + +void tst_QUuid::toByteArray() +{ + QCOMPARE(uuidA.toByteArray(), QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")); + + QCOMPARE(uuidB.toByteArray(), QByteArray("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")); +} + +void tst_QUuid::fromByteArray() +{ + QCOMPARE(uuidA, QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"))); + QCOMPARE(uuidA, QUuid(QByteArray("fc69b59e-cc34-4436-a43c-ee95d128b8c5}"))); + QCOMPARE(uuidA, QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5"))); + QCOMPARE(uuidA, QUuid(QByteArray("fc69b59e-cc34-4436-a43c-ee95d128b8c5"))); + QCOMPARE(QUuid(), QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c"))); + + QCOMPARE(uuidB, QUuid(QByteArray("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"))); +} + +void tst_QUuid::toRfc4122() +{ + QCOMPARE(uuidA.toRfc4122(), QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5")); + + QCOMPARE(uuidB.toRfc4122(), QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b")); } +void tst_QUuid::fromRfc4122() +{ + QCOMPARE(uuidA, QUuid::fromRfc4122(QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5"))); + + QCOMPARE(uuidB, QUuid::fromRfc4122(QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b"))); +} + +void tst_QUuid::check_QDataStream() +{ + QUuid tmp; + QByteArray ar; + { + QDataStream out(&ar,QIODevice::WriteOnly); + out.setByteOrder(QDataStream::BigEndian); + out << uuidA; + } + { + QDataStream in(&ar,QIODevice::ReadOnly); + in.setByteOrder(QDataStream::BigEndian); + in >> tmp; + QCOMPARE(uuidA, tmp); + } + { + QDataStream out(&ar,QIODevice::WriteOnly); + out.setByteOrder(QDataStream::LittleEndian); + out << uuidA; + } + { + QDataStream in(&ar,QIODevice::ReadOnly); + in.setByteOrder(QDataStream::LittleEndian); + in >> tmp; + QCOMPARE(uuidA, tmp); + } +} void tst_QUuid::isNull() { diff --git a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp index dbec65c..a035cf3 100644 --- a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp @@ -53,6 +53,18 @@ public: private slots: void createUuid(); + void fromChar(); + void toString(); + void fromString(); + void toByteArray(); + void fromByteArray(); + void toRfc4122(); + void fromRfc4122(); + void toDataStream(); + void fromDataStream(); + void isNull(); + void operatorLess(); + void operatorMore(); }; void tst_bench_QUuid::createUuid() @@ -62,5 +74,118 @@ void tst_bench_QUuid::createUuid() } } +void tst_bench_QUuid::fromChar() +{ + QBENCHMARK { + QUuid uuid("{67C8770B-44F1-410A-AB9A-F9B5446F13EE}"); + } +} + +void tst_bench_QUuid::toString() +{ + QUuid uuid = QUuid::createUuid(); + QBENCHMARK { + uuid.toString(); + } +} + +void tst_bench_QUuid::fromString() +{ + QString string = "{67C8770B-44F1-410A-AB9A-F9B5446F13EE}"; + QBENCHMARK { + QUuid uuid(string); + } +} + +void tst_bench_QUuid::toByteArray() +{ + QUuid uuid = QUuid::createUuid(); + QBENCHMARK { + uuid.toByteArray(); + } +} + +void tst_bench_QUuid::fromByteArray() +{ + QByteArray string = "{67C8770B-44F1-410A-AB9A-F9B5446F13EE}"; + QBENCHMARK { + QUuid uuid(string); + } +} + +void tst_bench_QUuid::toRfc4122() +{ + QUuid uuid = QUuid::createUuid(); + QBENCHMARK { + uuid.toRfc4122(); + } +} + +void tst_bench_QUuid::fromRfc4122() +{ + QByteArray string = QByteArray::fromHex("67C8770B44F1410AAB9AF9B5446F13EE"); + QBENCHMARK { + QUuid uuid = QUuid::fromRfc4122(string); + } +} + +void tst_bench_QUuid::toDataStream() +{ + QUuid uuid1, uuid2; + uuid1 = QUuid::createUuid(); + QByteArray ar; + { + QDataStream out(&ar,QIODevice::WriteOnly); + QBENCHMARK { + out << uuid1; + } + } +} + +void tst_bench_QUuid::fromDataStream() +{ + QUuid uuid1, uuid2; + uuid1 = QUuid::createUuid(); + QByteArray ar; + { + QDataStream out(&ar,QIODevice::WriteOnly); + out << uuid1; + } + { + QDataStream in(&ar,QIODevice::ReadOnly); + QBENCHMARK { + in >> uuid2; + } + } +} + +void tst_bench_QUuid::isNull() +{ + QUuid uuid = QUuid(); + QBENCHMARK { + uuid.isNull(); + } +} + +void tst_bench_QUuid::operatorLess() +{ + QUuid uuid1, uuid2; + uuid1 = QUuid::createUuid(); + uuid2 = QUuid::createUuid(); + QBENCHMARK { + uuid1 < uuid2; + } +} + +void tst_bench_QUuid::operatorMore() +{ + QUuid uuid1, uuid2; + uuid1 = QUuid::createUuid(); + uuid2 = QUuid::createUuid(); + QBENCHMARK { + uuid1 > uuid2; + } +} + QTEST_MAIN(tst_bench_QUuid); #include "tst_quuid.moc" diff --git a/translations/qt_gl.ts b/translations/qt_gl.ts index 2431a5d..a77bcc7 100644 --- a/translations/qt_gl.ts +++ b/translations/qt_gl.ts @@ -3728,18 +3728,6 @@ ou comercial onde non é preciso compartir ningún código fonte con terceiras p <p>Qt é un produto de Nokia. Consulte <a href="http://qt.nokia.com/">qt.nokia.com</a> para máis información.</p></translation> </message> <message> - <source><p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p></source> - <translation type="obsolete"><p>Qt é un toolkit de C++ para o desenvolvemento de programas multiplataforma.</p> <p>Qt fornece portabilidade entre MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux e as principais variantes comerciais de Unix cun único código fonte. Qt tamén está dispoñíbel para dispositivos incrustados como Qt para Embedded Linux e Qt para Windows CE.</p> -<p>Qt está dispoñíbel en tres opcións de licenzas diferentes deseñadas para adaptarse ás necesidades dos diferentes usuarios.</p> -</p>Qt distribuída sob o acordo de licenza comercial é adecuado para o desenvolvemento de software propietario -ou comercial onde non é preciso compartir ningún código fonte con terceiras partes ou que non poden cumprir os termos das licenzas GNU LGPL versión 2.1 nin da versión 3.0.</p> -<p>Qt sob a licenza GNU General Public License versión 2.1 é apropiada para o desenvolvemento de programas Qt (propietario ou de fontes abertas) supoñendo que poda cumprir cos termos e condicións da licenza GNU GPL versión 2.1.</p> -<p>Qt sob a licenza GNU General Public License versión 3.0 é apropiada para o desenvolvemento de programas Qt onde desexe empregar tales programas en combinación con software suxeito aos termos da GNU GPL versión 3.0 ou onde desexe cumprir cos termos da GNU GPL versión 3.0.</p> -<p>Consulte <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> para ler un resumo das licenzas de Qt.</p> -<p>Copyright (C) 2011 Nokia Corporation ou as súas subsidiarias.</p> -<p>Qt é un produto de Nokia. Consulte <a href="http://qt.nokia.com/">qt.nokia.com</a> para máis información.</p></translation> - </message> - <message> <source>About Qt</source> <translation>Acerca de Qt</translation> </message> diff --git a/util/network/cookiejar-generateTLDs/main.cpp b/util/corelib/qurl-generateTLDs/main.cpp index b369ece..861546c 100644 --- a/util/network/cookiejar-generateTLDs/main.cpp +++ b/util/corelib/qurl-generateTLDs/main.cpp @@ -77,7 +77,7 @@ int main(int argc, char **argv) { printf(" wget http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 -O effective_tld_names.dat\n"); printf(" grep '^[^\\/\\/]' effective_tld_names.dat > effective_tld_names.dat.trimmed\n"); printf(" %s effective_tld_names.dat.trimmed effective_tld_names.dat.qt\n\n", argv[0]); - printf("Now copy the data from effective_tld_names.dat.qt to the file src/network/access/qnetworkcookiejartlds_p.h in your Qt repo\n\n"); + printf("Now copy the data from effective_tld_names.dat.qt to the file src/corelib/io/qurltlds_p.h in your Qt repo\n\n"); exit(1); } QFile file(argv[1]); @@ -156,6 +156,6 @@ int main(int argc, char **argv) { outFile.write(outDataBufferBA); outFile.write("};\n"); outFile.close(); - printf("data generated to %s . Now copy the data from this file to src/network/access/qnetworkcookiejartlds_p.h in your Qt repo\n", argv[2]); + printf("data generated to %s . Now copy the data from this file to src/corelib/io/qurltlds_p.h in your Qt repo\n", argv[2]); exit(0); } diff --git a/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro b/util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro index 9d5f1cf..9d5f1cf 100644 --- a/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro +++ b/util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro |