Merge "Merge remote-tracking branch 'origin/5.4' into 5.4.0" into refs/staging/5.4.0

This commit is contained in:
Jani Heikkinen 2014-11-11 12:51:23 +01:00 committed by The Qt Project
commit 9d38dbde76
100 changed files with 2890 additions and 2200 deletions

View File

@ -483,3 +483,15 @@
\externalpage http://qt-project.org/doc/qtcreator/creator-developing-winrt.html
\title Qt Creator: Connecting Windows Runtime Devices
*/
/*!
\externalpage http://qt-project.org/doc/qtcreator/creator-clang-codemodel.html
\title Qt Creator: Parsing C++ Files
*/
/*!
\externalpage http://qt-project.org/doc/qtcreator/creator-quick-ui-forms.html
\title Qt Creator: Qt Quick UI Forms
*/
/*!
\externalpage http://qt-project.org/doc/qtcreator/creator-clang-static-analyzer.html
\title Qt Creator: Using Clang Static Analyzer
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -2,7 +2,6 @@ body {
font: normal 400 14px/1.2 Arial;
margin-top: 85px;
font-family: Arial, Helvetica;
color: #313131;
text-align: left;
margin-left: 5px;
margin-right: 5px;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 916 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 685 B

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 834 B

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -11,11 +11,15 @@
QMAKE_COMPILER = rim_qcc gcc # qcc is mostly gcc in disguise
QMAKE_CFLAGS_OPTIMIZE = -O2
QMAKE_CFLAGS_OPTIMIZE_FULL = -O3
QMAKE_CFLAGS += -Wno-psabi
QMAKE_CFLAGS_DEPS += -M
QMAKE_CFLAGS_WARN_ON += -Wall -W
QMAKE_CFLAGS_WARN_OFF += -w
QMAKE_CFLAGS_RELEASE += -O2
QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -g
QMAKE_CFLAGS_DEBUG += -g
QMAKE_CFLAGS_SHLIB += -fPIC -shared
QMAKE_CFLAGS_STATIC_LIB += -fPIC
@ -36,6 +40,7 @@ QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS
QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON
QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF
QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB
QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB

View File

@ -34,7 +34,7 @@
<m2:ShowOn Tile=\"square150x150Logo\" />
</m2:ShowNameOnTiles>
</m2:DefaultTile>
<m2:SplashScreen Image=\"$${WINRT_MANIFEST.logo_splash}\" />
<m2:SplashScreen Image=\"$${WINRT_MANIFEST.logo_splash}\" />$${WINRT_MANIFEST.rotation_preference}
</m2:VisualElements>
</Application>
</Applications>$${WINRT_MANIFEST.capabilities}$${WINRT_MANIFEST.dependencies}

View File

@ -37,7 +37,7 @@
<m3:ShowOn Tile=\"square150x150Logo\" />
</m3:ShowNameOnTiles>
</m3:DefaultTile>
<m3:SplashScreen Image=\"$${WINRT_MANIFEST.logo_480x800}\" />
<m3:SplashScreen Image=\"$${WINRT_MANIFEST.logo_480x800}\" />$${WINRT_MANIFEST.rotation_preference}
</m3:VisualElements>
</Application>
</Applications>$${WINRT_MANIFEST.capabilities}$${WINRT_MANIFEST.dependencies}

View File

@ -24,6 +24,7 @@
# WINRT_MANIFEST.logo_medium: Medium logo image file. Default provided by the mkspec.
# WINRT_MANIFEST.logo_large: Large logo image file. Default provided by the mkspec.
# WINRT_MANIFEST.splash_screen: Splash screen image file. Default provided by the mkspec.
# WINRT_MANIFEST.rotation_preference: Orientation specification. Default is empty. (portrait, landscape, landscapeFlipped)
# WINRT_MANIFEST.iconic_tile_icon: Image file for the "iconic" tile template icon. Default provided by the mkspec.
# WINRT_MANIFEST.iconic_tile_small: Image file for the small "iconic" tile template logo. Default provided by the mkspec.
# WINRT_MANIFEST.default_language: Specifies the default language of the application
@ -87,6 +88,20 @@
isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light
isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en
INDENT = "$$escape_expand(\\r\\n) "
VS_XML_NAMESPACE = "m2"
winphone: VS_XML_NAMESPACE = "m3"
WINRT_MANIFEST.rotation_preference = $$unique(WINRT_MANIFEST.rotation_preference)
!isEmpty(WINRT_MANIFEST.rotation_preference) {
MANIFEST_ROTATION += "<$${VS_XML_NAMESPACE}:InitialRotationPreference>"
for(ROTATION, WINRT_MANIFEST.rotation_preference): \
MANIFEST_ROTATION += " <$${VS_XML_NAMESPACE}:Rotation Preference=\"$$ROTATION\" />"
MANIFEST_ROTATION += "</$${VS_XML_NAMESPACE}:InitialRotationPreference>"
WINRT_MANIFEST.rotation_preference = $$join(MANIFEST_ROTATION, $$INDENT, $$INDENT)
}
INDENT = "$$escape_expand(\\r\\n) "
# Capabilities are given as a string list and may change with the configuration (network, sensors, etc.)

View File

@ -78,7 +78,7 @@
# define Q_NO_USING_KEYWORD
#elif defined(_MSC_VER)
# define Q_CC_MSVC
# define Q_CC_MSVC (_MSC_VER)
# define Q_CC_MSVC_NET
# define Q_OUTOFLINE_TEMPLATE inline
# if _MSC_VER < 1600
@ -137,14 +137,14 @@
# endif
#elif defined(__GNUC__)
# define Q_CC_GNU
# define Q_CC_GNU (__GNUC__ * 100 + __GNUC_MINOR__)
# define Q_C_CALLBACKS
# if defined(__MINGW32__)
# define Q_CC_MINGW
# endif
# if defined(__INTEL_COMPILER)
/* Intel C++ also masquerades as GCC */
# define Q_CC_INTEL
# define Q_CC_INTEL (__INTEL_COMPILER)
# define Q_ASSUME_IMPL(expr) __assume(expr)
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
# if __INTEL_COMPILER >= 1300 && !defined(__APPLE__)
@ -152,7 +152,26 @@
# endif
# elif defined(__clang__)
/* Clang also masquerades as GCC */
# define Q_CC_CLANG
# if defined(__apple_build_version__)
# /* http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions */
# if __apple_build_version__ >= 600051
# define Q_CC_CLANG 305
# elif __apple_build_version__ >= 503038
# define Q_CC_CLANG 304
# elif __apple_build_version__ >= 500275
# define Q_CC_CLANG 303
# elif __apple_build_version__ >= 425024
# define Q_CC_CLANG 302
# elif __apple_build_version__ >= 318045
# define Q_CC_CLANG 301
# elif __apple_build_version__ >= 211101
# define Q_CC_CLANG 300
# else
# error "Unknown Apple Clang version"
# endif
# else
# define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__)
# endif
# define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable()
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
# if !defined(__has_extension)
@ -168,7 +187,7 @@
# endif
# else
/* Plain GCC */
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
# if Q_CC_GNU >= 405
# define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable()
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text)))
@ -202,7 +221,7 @@
# define QT_NO_ARM_EABI
# endif
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403 && !defined(Q_CC_CLANG)
# if Q_CC_GNU >= 403 && !defined(Q_CC_CLANG)
# define Q_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# endif
@ -308,7 +327,7 @@
/* Using the `using' keyword avoids Intel C++ for Linux warnings */
# elif defined(__INTEL_COMPILER)
# define Q_CC_INTEL
# define Q_CC_INTEL (__INTEL_COMPILER)
/* Uses CFront, make sure to read the manual how to tweak templates. */
# elif defined(__ghs)
@ -566,7 +585,7 @@
# endif
// Variadic macros are supported for gnu++98, c++11, c99 ... since 2.9
# if ((__clang_major__ * 100) + __clang_minor__) >= 209
# if Q_CC_CLANG >= 209
# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \
|| (defined(__cplusplus) && (__cplusplus >= 201103L)) \
|| (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
@ -668,7 +687,7 @@
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
/* Features that have no __has_feature() check */
# if ((__clang_major__ * 100) + __clang_minor__) >= 209 /* since clang 2.9 */
# if Q_CC_CLANG >= 209 /* since clang 2.9 */
# define Q_COMPILER_EXTERN_TEMPLATES
# endif
# endif
@ -709,7 +728,7 @@
#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG)
# define Q_COMPILER_RESTRICTED_VLA
# define Q_COMPILER_THREADSAFE_STATICS
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
# if Q_CC_GNU >= 403
// GCC supports binary literals in C, C++98 and C++11 modes
# define Q_COMPILER_BINARY_LITERALS
# endif
@ -720,13 +739,13 @@
# define Q_COMPILER_VARIADIC_MACROS
# endif
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
# if Q_CC_GNU >= 403
/* C++11 features supported in GCC 4.3: */
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
# if Q_CC_GNU >= 404
/* C++11 features supported in GCC 4.4: */
# define Q_COMPILER_AUTO_FUNCTION
# define Q_COMPILER_AUTO_TYPE
@ -735,7 +754,7 @@
# define Q_COMPILER_UNICODE_STRINGS
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
# if Q_CC_GNU >= 405
/* C++11 features supported in GCC 4.5: */
# define Q_COMPILER_EXPLICIT_CONVERSIONS
/* GCC 4.4 implements initializer_list but does not define typedefs required
@ -745,7 +764,7 @@
# define Q_COMPILER_RAW_STRINGS
# define Q_COMPILER_CLASS_ENUM
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
# if Q_CC_GNU >= 406
/* Pre-4.6 compilers implement a non-final snapshot of N2346, hence default and delete
* functions are supported only if they are public. Starting from 4.6, GCC handles
* final version - the access modifier is not relevant. */
@ -757,7 +776,7 @@
# define Q_COMPILER_UNRESTRICTED_UNIONS
# define Q_COMPILER_RANGE_FOR
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407
# if Q_CC_GNU >= 407
/* GCC 4.4 implemented <atomic> and std::atomic using its old intrinsics.
* However, the implementation is incomplete for most platforms until GCC 4.7:
* instead, std::atomic would use an external lock. Since we need an std::atomic
@ -773,20 +792,20 @@
# define Q_COMPILER_TEMPLATE_ALIAS
# define Q_COMPILER_UDL
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408
# if Q_CC_GNU >= 408
# define Q_COMPILER_ATTRIBUTES
# define Q_COMPILER_ALIGNAS
# define Q_COMPILER_ALIGNOF
# define Q_COMPILER_INHERITING_CONSTRUCTORS
# define Q_COMPILER_THREAD_LOCAL
# if (__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ >= 1
# if Q_CC_GNU > 408 || __GNUC_PATCHLEVEL__ >= 1
# define Q_COMPILER_REF_QUALIFIERS
# endif
# endif
/* C++11 features are complete as of GCC 4.8.1 */
# endif
# if __cplusplus > 201103L
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409
# if Q_CC_GNU >= 409
/* C++1y features in GCC 4.9 - deprecated, do not update this list */
//# define Q_COMPILER_BINARY_LITERALS // already supported since GCC 4.3 as an extension
# define Q_COMPILER_LAMBDA_CAPTURES

View File

@ -877,7 +877,7 @@ public:
// (http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#382).
// GCC 4.3 and 4.4 have support for decltype, but are affected by DR 382.
# if defined(Q_COMPILER_DECLTYPE) && \
(defined(Q_CC_CLANG) || defined(Q_CC_INTEL) || !defined(Q_CC_GNU) || (__GNUC__ * 100 + __GNUC_MINOR__) >= 405)
(defined(Q_CC_CLANG) || defined(Q_CC_INTEL) || !defined(Q_CC_GNU) || Q_CC_GNU >= 405)
# define QT_FOREACH_DECLTYPE(x) typename QtPrivate::remove_reference<decltype(x)>::type
# else
# define QT_FOREACH_DECLTYPE(x) __typeof__((x))

View File

@ -84,14 +84,7 @@ class QLibraryInfoPrivate
{
public:
static QSettings *findConfiguration();
#ifndef QT_BOOTSTRAPPED
static void cleanup()
{
QLibrarySettings *ls = qt_library_settings();
if (ls)
ls->settings.reset(0);
}
#else
#ifdef QT_BOOTSTRAPPED
static bool haveGroup(QLibraryInfo::PathGroup group)
{
QLibrarySettings *ls = qt_library_settings();
@ -114,7 +107,6 @@ QLibrarySettings::QLibrarySettings()
: settings(QLibraryInfoPrivate::findConfiguration())
{
#ifndef QT_BOOTSTRAPPED
qAddPostRoutine(QLibraryInfoPrivate::cleanup);
bool haveEffectivePaths;
bool havePaths;
#endif

View File

@ -87,9 +87,9 @@
ARM is bi-endian, detect using __ARMEL__ or __ARMEB__, falling back to
auto-detection implemented below.
*/
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__arm64__)
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__)
# define Q_PROCESSOR_ARM
# if defined(__arm64__)
# if defined(__aarch64__)
# define Q_PROCESSOR_ARM_64
# else
# define Q_PROCESSOR_ARM_32

View File

@ -311,7 +311,7 @@ QJNIObjectPrivate::QJNIObjectPrivate(const char *className, const char *sig, ...
}
}
QJNIObjectPrivate::QJNIObjectPrivate(const char *className, const char *sig, va_list args)
QJNIObjectPrivate::QJNIObjectPrivate(const char *className, const char *sig, const QVaListPrivate &args)
: d(new QJNIObjectData())
{
QJNIEnvironmentPrivate env;
@ -369,7 +369,7 @@ QJNIObjectPrivate::QJNIObjectPrivate(jclass clazz, const char *sig, ...)
}
}
QJNIObjectPrivate::QJNIObjectPrivate(jclass clazz, const char *sig, va_list args)
QJNIObjectPrivate::QJNIObjectPrivate(jclass clazz, const char *sig, const QVaListPrivate &args)
: d(new QJNIObjectData())
{
QJNIEnvironmentPrivate env;
@ -402,7 +402,7 @@ QJNIObjectPrivate::QJNIObjectPrivate(jobject obj)
}
template <>
void QJNIObjectPrivate::callMethod<void>(const char *methodName, const char *sig, va_list args) const
void QJNIObjectPrivate::callMethodV<void>(const char *methodName, const char *sig, va_list args) const
{
QJNIEnvironmentPrivate env;
jmethodID id = getCachedMethodID(env, d->m_jclass, methodName, sig);
@ -416,12 +416,12 @@ void QJNIObjectPrivate::callMethod<void>(const char *methodName, const char *sig
{
va_list args;
va_start(args, sig);
callMethod<void>(methodName, sig, args);
callMethodV<void>(methodName, sig, args);
va_end(args);
}
template <>
jboolean QJNIObjectPrivate::callMethod<jboolean>(const char *methodName, const char *sig, va_list args) const
jboolean QJNIObjectPrivate::callMethodV<jboolean>(const char *methodName, const char *sig, va_list args) const
{
QJNIEnvironmentPrivate env;
jboolean res = 0;
@ -437,13 +437,13 @@ jboolean QJNIObjectPrivate::callMethod<jboolean>(const char *methodName, const c
{
va_list args;
va_start(args, sig);
jboolean res = callMethod<jboolean>(methodName, sig, args);
jboolean res = callMethodV<jboolean>(methodName, sig, args);
va_end(args);
return res;
}
template <>
jbyte QJNIObjectPrivate::callMethod<jbyte>(const char *methodName, const char *sig, va_list args) const
jbyte QJNIObjectPrivate::callMethodV<jbyte>(const char *methodName, const char *sig, va_list args) const
{
QJNIEnvironmentPrivate env;
jbyte res = 0;
@ -459,13 +459,13 @@ jbyte QJNIObjectPrivate::callMethod<jbyte>(const char *methodName, const char *s
{
va_list args;
va_start(args, sig);
jbyte res = callMethod<jbyte>(methodName, sig, args);
jbyte res = callMethodV<jbyte>(methodName, sig, args);
va_end(args);
return res;
}
template <>
jchar QJNIObjectPrivate::callMethod<jchar>(const char *methodName, const char *sig, va_list args) const
jchar QJNIObjectPrivate::callMethodV<jchar>(const char *methodName, const char *sig, va_list args) const
{
QJNIEnvironmentPrivate env;
jchar res = 0;
@ -481,13 +481,13 @@ jchar QJNIObjectPrivate::callMethod<jchar>(const char *methodName, const char *s
{
va_list args;
va_start(args, sig);
jchar res = callMethod<jchar>(methodName, sig, args);
jchar res = callMethodV<jchar>(methodName, sig, args);
va_end(args);
return res;
}
template <>
jshort QJNIObjectPrivate::callMethod<jshort>(const char *methodName, const char *sig, va_list args) const
jshort QJNIObjectPrivate::callMethodV<jshort>(const char *methodName, const char *sig, va_list args) const
{
QJNIEnvironmentPrivate env;
jshort res = 0;
@ -503,13 +503,13 @@ jshort QJNIObjectPrivate::callMethod<jshort>(const char *methodName, const char
{
va_list args;
va_start(args, sig);
jshort res = callMethod<jshort>(methodName, sig, args);
jshort res = callMethodV<jshort>(methodName, sig, args);
va_end(args);
return res;
}
template <>
jint QJNIObjectPrivate::callMethod<jint>(const char *methodName, const char *sig, va_list args) const
jint QJNIObjectPrivate::callMethodV<jint>(const char *methodName, const char *sig, va_list args) const
{
QJNIEnvironmentPrivate env;
jint res = 0;
@ -525,13 +525,13 @@ jint QJNIObjectPrivate::callMethod<jint>(const char *methodName, const char *sig
{
va_list args;
va_start(args, sig);
jint res = callMethod<jint>(methodName, sig, args);
jint res = callMethodV<jint>(methodName, sig, args);
va_end(args);
return res;
}
template <>
jlong QJNIObjectPrivate::callMethod<jlong>(const char *methodName, const char *sig, va_list args) const
jlong QJNIObjectPrivate::callMethodV<jlong>(const char *methodName, const char *sig, va_list args) const
{
QJNIEnvironmentPrivate env;
jlong res = 0;
@ -547,13 +547,13 @@ jlong QJNIObjectPrivate::callMethod<jlong>(const char *methodName, const char *s
{
va_list args;
va_start(args, sig);
jlong res = callMethod<jlong>(methodName, sig, args);
jlong res = callMethodV<jlong>(methodName, sig, args);
va_end(args);
return res;
}
template <>
jfloat QJNIObjectPrivate::callMethod<jfloat>(const char *methodName, const char *sig, va_list args) const
jfloat QJNIObjectPrivate::callMethodV<jfloat>(const char *methodName, const char *sig, va_list args) const
{
QJNIEnvironmentPrivate env;
jfloat res = 0.f;
@ -569,13 +569,13 @@ jfloat QJNIObjectPrivate::callMethod<jfloat>(const char *methodName, const char
{
va_list args;
va_start(args, sig);
jfloat res = callMethod<jfloat>(methodName, sig, args);
jfloat res = callMethodV<jfloat>(methodName, sig, args);
va_end(args);
return res;
}
template <>
jdouble QJNIObjectPrivate::callMethod<jdouble>(const char *methodName, const char *sig, va_list args) const
jdouble QJNIObjectPrivate::callMethodV<jdouble>(const char *methodName, const char *sig, va_list args) const
{
QJNIEnvironmentPrivate env;
jdouble res = 0.;
@ -591,7 +591,7 @@ jdouble QJNIObjectPrivate::callMethod<jdouble>(const char *methodName, const cha
{
va_list args;
va_start(args, sig);
jdouble res = callMethod<jdouble>(methodName, sig, args);
jdouble res = callMethodV<jdouble>(methodName, sig, args);
va_end(args);
return res;
}
@ -651,10 +651,10 @@ jdouble QJNIObjectPrivate::callMethod<jdouble>(const char *methodName) const
}
template <>
void QJNIObjectPrivate::callStaticMethod<void>(const char *className,
const char *methodName,
const char *sig,
va_list args)
void QJNIObjectPrivate::callStaticMethodV<void>(const char *className,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jclass clazz = loadClass(className, env);
@ -674,15 +674,15 @@ void QJNIObjectPrivate::callStaticMethod<void>(const char *className,
{
va_list args;
va_start(args, sig);
callStaticMethod<void>(className, methodName, sig, args);
callStaticMethodV<void>(className, methodName, sig, args);
va_end(args);
}
template <>
void QJNIObjectPrivate::callStaticMethod<void>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
void QJNIObjectPrivate::callStaticMethodV<void>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jmethodID id = getCachedMethodID(env, clazz, methodName, sig, true);
@ -699,15 +699,15 @@ void QJNIObjectPrivate::callStaticMethod<void>(jclass clazz,
{
va_list args;
va_start(args, sig);
callStaticMethod<void>(clazz, methodName, sig, args);
callStaticMethodV<void>(clazz, methodName, sig, args);
va_end(args);
}
template <>
jboolean QJNIObjectPrivate::callStaticMethod<jboolean>(const char *className,
const char *methodName,
const char *sig,
va_list args)
jboolean QJNIObjectPrivate::callStaticMethodV<jboolean>(const char *className,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jboolean res = 0;
@ -730,16 +730,16 @@ jboolean QJNIObjectPrivate::callStaticMethod<jboolean>(const char *className,
{
va_list args;
va_start(args, sig);
jboolean res = callStaticMethod<jboolean>(className, methodName, sig, args);
jboolean res = callStaticMethodV<jboolean>(className, methodName, sig, args);
va_end(args);
return res;
}
template <>
jboolean QJNIObjectPrivate::callStaticMethod<jboolean>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
jboolean QJNIObjectPrivate::callStaticMethodV<jboolean>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jboolean res = 0;
@ -759,16 +759,16 @@ jboolean QJNIObjectPrivate::callStaticMethod<jboolean>(jclass clazz,
{
va_list args;
va_start(args, sig);
jboolean res = callStaticMethod<jboolean>(clazz, methodName, sig, args);
jboolean res = callStaticMethodV<jboolean>(clazz, methodName, sig, args);
va_end(args);
return res;
}
template <>
jbyte QJNIObjectPrivate::callStaticMethod<jbyte>(const char *className,
const char *methodName,
const char *sig,
va_list args)
jbyte QJNIObjectPrivate::callStaticMethodV<jbyte>(const char *className,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jbyte res = 0;
@ -791,16 +791,16 @@ jbyte QJNIObjectPrivate::callStaticMethod<jbyte>(const char *className,
{
va_list args;
va_start(args, sig);
jbyte res = callStaticMethod<jbyte>(className, methodName, sig, args);
jbyte res = callStaticMethodV<jbyte>(className, methodName, sig, args);
va_end(args);
return res;
}
template <>
jbyte QJNIObjectPrivate::callStaticMethod<jbyte>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
jbyte QJNIObjectPrivate::callStaticMethodV<jbyte>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jbyte res = 0;
@ -820,16 +820,16 @@ jbyte QJNIObjectPrivate::callStaticMethod<jbyte>(jclass clazz,
{
va_list args;
va_start(args, sig);
jbyte res = callStaticMethod<jbyte>(clazz, methodName, sig, args);
jbyte res = callStaticMethodV<jbyte>(clazz, methodName, sig, args);
va_end(args);
return res;
}
template <>
jchar QJNIObjectPrivate::callStaticMethod<jchar>(const char *className,
const char *methodName,
const char *sig,
va_list args)
jchar QJNIObjectPrivate::callStaticMethodV<jchar>(const char *className,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jchar res = 0;
@ -852,16 +852,16 @@ jchar QJNIObjectPrivate::callStaticMethod<jchar>(const char *className,
{
va_list args;
va_start(args, sig);
jchar res = callStaticMethod<jchar>(className, methodName, sig, args);
jchar res = callStaticMethodV<jchar>(className, methodName, sig, args);
va_end(args);
return res;
}
template <>
jchar QJNIObjectPrivate::callStaticMethod<jchar>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
jchar QJNIObjectPrivate::callStaticMethodV<jchar>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jchar res = 0;
@ -881,16 +881,16 @@ jchar QJNIObjectPrivate::callStaticMethod<jchar>(jclass clazz,
{
va_list args;
va_start(args, sig);
jchar res = callStaticMethod<jchar>(clazz, methodName, sig, args);
jchar res = callStaticMethodV<jchar>(clazz, methodName, sig, args);
va_end(args);
return res;
}
template <>
jshort QJNIObjectPrivate::callStaticMethod<jshort>(const char *className,
const char *methodName,
const char *sig,
va_list args)
jshort QJNIObjectPrivate::callStaticMethodV<jshort>(const char *className,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jshort res = 0;
@ -913,16 +913,16 @@ jshort QJNIObjectPrivate::callStaticMethod<jshort>(const char *className,
{
va_list args;
va_start(args, sig);
jshort res = callStaticMethod<jshort>(className, methodName, sig, args);
jshort res = callStaticMethodV<jshort>(className, methodName, sig, args);
va_end(args);
return res;
}
template <>
jshort QJNIObjectPrivate::callStaticMethod<jshort>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
jshort QJNIObjectPrivate::callStaticMethodV<jshort>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jshort res = 0;
@ -942,16 +942,16 @@ jshort QJNIObjectPrivate::callStaticMethod<jshort>(jclass clazz,
{
va_list args;
va_start(args, sig);
jshort res = callStaticMethod<jshort>(clazz, methodName, sig, args);
jshort res = callStaticMethodV<jshort>(clazz, methodName, sig, args);
va_end(args);
return res;
}
template <>
jint QJNIObjectPrivate::callStaticMethod<jint>(const char *className,
const char *methodName,
const char *sig,
va_list args)
jint QJNIObjectPrivate::callStaticMethodV<jint>(const char *className,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jint res = 0;
@ -974,16 +974,16 @@ jint QJNIObjectPrivate::callStaticMethod<jint>(const char *className,
{
va_list args;
va_start(args, sig);
jint res = callStaticMethod<jint>(className, methodName, sig, args);
jint res = callStaticMethodV<jint>(className, methodName, sig, args);
va_end(args);
return res;
}
template <>
jint QJNIObjectPrivate::callStaticMethod<jint>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
jint QJNIObjectPrivate::callStaticMethodV<jint>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jint res = 0;
@ -1003,16 +1003,16 @@ jint QJNIObjectPrivate::callStaticMethod<jint>(jclass clazz,
{
va_list args;
va_start(args, sig);
jint res = callStaticMethod<jint>(clazz, methodName, sig, args);
jint res = callStaticMethodV<jint>(clazz, methodName, sig, args);
va_end(args);
return res;
}
template <>
jlong QJNIObjectPrivate::callStaticMethod<jlong>(const char *className,
const char *methodName,
const char *sig,
va_list args)
jlong QJNIObjectPrivate::callStaticMethodV<jlong>(const char *className,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jlong res = 0;
@ -1035,16 +1035,16 @@ jlong QJNIObjectPrivate::callStaticMethod<jlong>(const char *className,
{
va_list args;
va_start(args, sig);
jlong res = callStaticMethod<jlong>(className, methodName, sig, args);
jlong res = callStaticMethodV<jlong>(className, methodName, sig, args);
va_end(args);
return res;
}
template <>
jlong QJNIObjectPrivate::callStaticMethod<jlong>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
jlong QJNIObjectPrivate::callStaticMethodV<jlong>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jlong res = 0;
@ -1064,16 +1064,16 @@ jlong QJNIObjectPrivate::callStaticMethod<jlong>(jclass clazz,
{
va_list args;
va_start(args, sig);
jlong res = callStaticMethod<jlong>(clazz, methodName, sig, args);
jlong res = callStaticMethodV<jlong>(clazz, methodName, sig, args);
va_end(args);
return res;
}
template <>
jfloat QJNIObjectPrivate::callStaticMethod<jfloat>(const char *className,
const char *methodName,
const char *sig,
va_list args)
jfloat QJNIObjectPrivate::callStaticMethodV<jfloat>(const char *className,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jfloat res = 0.f;
@ -1096,16 +1096,16 @@ jfloat QJNIObjectPrivate::callStaticMethod<jfloat>(const char *className,
{
va_list args;
va_start(args, sig);
jfloat res = callStaticMethod<jfloat>(className, methodName, sig, args);
jfloat res = callStaticMethodV<jfloat>(className, methodName, sig, args);
va_end(args);
return res;
}
template <>
jfloat QJNIObjectPrivate::callStaticMethod<jfloat>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
jfloat QJNIObjectPrivate::callStaticMethodV<jfloat>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jfloat res = 0.f;
@ -1125,16 +1125,16 @@ jfloat QJNIObjectPrivate::callStaticMethod<jfloat>(jclass clazz,
{
va_list args;
va_start(args, sig);
jfloat res = callStaticMethod<jfloat>(clazz, methodName, sig, args);
jfloat res = callStaticMethodV<jfloat>(clazz, methodName, sig, args);
va_end(args);
return res;
}
template <>
jdouble QJNIObjectPrivate::callStaticMethod<jdouble>(const char *className,
const char *methodName,
const char *sig,
va_list args)
jdouble QJNIObjectPrivate::callStaticMethodV<jdouble>(const char *className,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jdouble res = 0.;
@ -1157,16 +1157,16 @@ jdouble QJNIObjectPrivate::callStaticMethod<jdouble>(const char *className,
{
va_list args;
va_start(args, sig);
jdouble res = callStaticMethod<jdouble>(className, methodName, sig, args);
jdouble res = callStaticMethodV<jdouble>(className, methodName, sig, args);
va_end(args);
return res;
}
template <>
jdouble QJNIObjectPrivate::callStaticMethod<jdouble>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
jdouble QJNIObjectPrivate::callStaticMethodV<jdouble>(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jdouble res = 0.;
@ -1186,7 +1186,7 @@ jdouble QJNIObjectPrivate::callStaticMethod<jdouble>(jclass clazz,
{
va_list args;
va_start(args, sig);
jdouble res = callStaticMethod<jdouble>(clazz, methodName, sig, args);
jdouble res = callStaticMethodV<jdouble>(clazz, methodName, sig, args);
va_end(args);
return res;
}
@ -1299,9 +1299,9 @@ jdouble QJNIObjectPrivate::callStaticMethod<jdouble>(jclass clazz, const char *m
return callStaticMethod<jdouble>(clazz, methodName, "()D");
}
QJNIObjectPrivate QJNIObjectPrivate::callObjectMethod(const char *methodName,
const char *sig,
va_list args) const
QJNIObjectPrivate QJNIObjectPrivate::callObjectMethodV(const char *methodName,
const char *sig,
va_list args) const
{
QJNIEnvironmentPrivate env;
jobject res = 0;
@ -1323,7 +1323,7 @@ QJNIObjectPrivate QJNIObjectPrivate::callObjectMethod(const char *methodName,
{
va_list args;
va_start(args, sig);
QJNIObjectPrivate res = callObjectMethod(methodName, sig, args);
QJNIObjectPrivate res = callObjectMethodV(methodName, sig, args);
va_end(args);
return res;
}
@ -1376,10 +1376,10 @@ QJNIObjectPrivate QJNIObjectPrivate::callObjectMethod<jdoubleArray>(const char *
return callObjectMethod(methodName, "()[D");
}
QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(const char *className,
const char *methodName,
const char *sig,
va_list args)
QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethodV(const char *className,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jobject res = 0;
@ -1405,15 +1405,15 @@ QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(const char *classNam
{
va_list args;
va_start(args, sig);
QJNIObjectPrivate res = callStaticObjectMethod(className, methodName, sig, args);
QJNIObjectPrivate res = callStaticObjectMethodV(className, methodName, sig, args);
va_end(args);
return res;
}
QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethodV(jclass clazz,
const char *methodName,
const char *sig,
va_list args)
{
QJNIEnvironmentPrivate env;
jobject res = 0;
@ -1436,7 +1436,7 @@ QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(jclass clazz,
{
va_list args;
va_start(args, sig);
QJNIObjectPrivate res = callStaticObjectMethod(clazz, methodName, sig, args);
QJNIObjectPrivate res = callStaticObjectMethodV(clazz, methodName, sig, args);
va_end(args);
return res;
}

View File

@ -186,31 +186,37 @@ public:
private:
friend class QAndroidJniObject;
QJNIObjectPrivate(const char *className, const char *sig, va_list args);
QJNIObjectPrivate(jclass clazz, const char *sig, va_list args);
struct QVaListPrivate { operator va_list &() const { return m_args; } va_list &m_args; };
QJNIObjectPrivate(const char *className, const char *sig, const QVaListPrivate &args);
QJNIObjectPrivate(jclass clazz, const char *sig, const QVaListPrivate &args);
template <typename T>
T callMethod(const char *methodName,
const char *sig,
va_list args) const;
QJNIObjectPrivate callObjectMethod(const char *methodName,
const char *sig,
va_list args) const;
T callMethodV(const char *methodName,
const char *sig,
va_list args) const;
QJNIObjectPrivate callObjectMethodV(const char *methodName,
const char *sig,
va_list args) const;
template <typename T>
static T callStaticMethod(const char *className,
const char *methodName,
const char *sig, va_list args);
static T callStaticMethodV(const char *className,
const char *methodName,
const char *sig,
va_list args);
template <typename T>
static T callStaticMethod(jclass clazz,
const char *methodName,
const char *sig, va_list args);
static QJNIObjectPrivate callStaticObjectMethod(const char *className,
const char *methodName,
const char *sig, va_list args);
static T callStaticMethodV(jclass clazz,
const char *methodName,
const char *sig,
va_list args);
static QJNIObjectPrivate callStaticObjectMethodV(const char *className,
const char *methodName,
const char *sig,
va_list args);
static QJNIObjectPrivate callStaticObjectMethod(jclass clazz,
const char *methodName,
const char *sig, va_list args);
static QJNIObjectPrivate callStaticObjectMethodV(jclass clazz,
const char *methodName,
const char *sig,
va_list args);
bool isSameObject(jobject obj) const;
bool isSameObject(const QJNIObjectPrivate &other) const;

View File

@ -426,9 +426,8 @@ QTranslator::~QTranslator()
directory. Returns \c true if the translation is successfully loaded;
otherwise returns \c false.
If \a directory is not specified, the directory of the
application's executable is used (i.e., as
\l{QCoreApplication::}{applicationDirPath()}).
If \a directory is not specified, the current directory is used
(i.e., as \l{QDir::}{currentPath()}).
The previous contents of this translator object are discarded.

View File

@ -71,7 +71,7 @@ Q_DECLARE_TYPEINFO(QStaticPlugin, Q_PRIMITIVE_TYPE);
void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
#if defined (Q_OF_ELF) && (defined (Q_CC_GNU) || defined(Q_CC_CLANG))
#if (defined(Q_OF_ELF) || defined(Q_OS_WIN)) && (defined (Q_CC_GNU) || defined(Q_CC_CLANG))
# define QT_PLUGIN_METADATA_SECTION \
__attribute__ ((section (".qtmetadata"))) __attribute__((used))
#elif defined(Q_OS_MAC)

View File

@ -84,13 +84,9 @@ QT_END_NAMESPACE
// New atomics
#if defined(Q_COMPILER_CONSTEXPR) && defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS)
# if defined(Q_CC_CLANG) && ((((__clang_major__ * 100) + __clang_minor__) < 303) \
|| defined(__apple_build_version__) \
)
/* Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for "stock" clang before version 3.3.
Apple's version has different (higher!) version numbers, so disable it for all of them for now.
(The only way to distinguish between them seems to be a check for __apple_build_version__ .)
# if defined(Q_CC_CLANG) && Q_CC_CLANG < 303
/*
Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for Clang before version 3.3.
For details about the bug: see http://llvm.org/bugs/show_bug.cgi?id=12670
*/
# else

View File

@ -35,8 +35,12 @@
#define _POSIX_C_SOURCE 200809L
#include "qelapsedtimer.h"
#ifdef Q_OS_VXWORKS
#if defined(Q_OS_VXWORKS)
#include "qfunctions_vxworks.h"
#elif defined(Q_OS_QNX)
#include <sys/neutrino.h>
#include <sys/syspage.h>
#include <inttypes.h>
#else
#include <sys/time.h>
#include <time.h>
@ -84,7 +88,18 @@ QT_BEGIN_NAMESPACE
* see http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
*/
#ifndef CLOCK_REALTIME
#if defined(Q_OS_QNX)
static inline void qt_clock_gettime(clockid_t clock, struct timespec *ts)
{
// The standard POSIX clock calls only have 1ms accuracy on QNX. To get
// higher accuracy, this platform-specific function must be used instead
quint64 cycles_per_sec = SYSPAGE_ENTRY(qtime)->cycles_per_sec;
quint64 cycles = ClockCycles();
ts->tv_sec = cycles / cycles_per_sec;
quint64 mod = cycles % cycles_per_sec;
ts->tv_nsec = mod * Q_INT64_C(1000000000) / cycles_per_sec;
}
#elif !defined(CLOCK_REALTIME)
# define CLOCK_REALTIME 0
static inline void qt_clock_gettime(int, struct timespec *ts)
{

View File

@ -519,7 +519,7 @@ QBasicAtomicInt qt_cpu_features = Q_BASIC_ATOMIC_INITIALIZER(0);
void qDetectCpuFeatures()
{
#if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
# if (__GNUC__ * 100 + __GNUC_MINOR__) < 403
# if Q_CC_GNU < 403
// GCC 4.2 (at least the one that comes with Apple's XCode, on Mac) is
// known to be broken beyond repair in dealing with the inline assembly
// above. It will generate bad code that could corrupt important registers

View File

@ -218,8 +218,8 @@
#endif
// other x86 intrinsics
#if defined(Q_PROCESSOR_X86) && ((defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 404)) \
|| (defined(Q_CC_CLANG) && (__clang_major__ * 100 + __clang_minor__ >= 208)) \
#if defined(Q_PROCESSOR_X86) && ((defined(Q_CC_GNU) && (Q_CC_GNU >= 404)) \
|| (defined(Q_CC_CLANG) && (Q_CC_CLANG >= 208)) \
|| defined(Q_CC_INTEL))
# define QT_COMPILER_SUPPORTS_X86INTRIN
# ifdef Q_CC_INTEL
@ -332,7 +332,7 @@ static __forceinline unsigned long _bit_scan_forward(uint val)
_BitScanForward(&result, val);
return result;
}
# elif (defined(Q_CC_CLANG) || (defined(Q_CC_GNU) && __GNUC__ * 100 + __GNUC_MINOR__ < 405)) \
# elif (defined(Q_CC_CLANG) || (defined(Q_CC_GNU) && Q_CC_GNU < 405)) \
&& !defined(Q_CC_INTEL)
// Clang is missing the intrinsic for _bit_scan_reverse
// GCC only added it in version 4.5

View File

@ -6336,8 +6336,7 @@ ushort QString::toUShort(bool *ok, int base) const
\snippet qstring/main.cpp 66
Various string formats for floating point numbers can be converted
to double values:
\warning The QString content may only contain valid numerical characters which includes the plus/minus sign, the characters g and e used in scientific notation, and the decimal point. Including the unit or additional characters leads to a conversion error.
\snippet qstring/main.cpp 67
@ -6346,7 +6345,7 @@ ushort QString::toUShort(bool *ok, int base) const
\snippet qstring/main.cpp 68
For historic reasons, this function does not handle
For historical reasons, this function does not handle
thousands group separators. If you need to convert such numbers,
use QLocale::toDouble().

View File

@ -1122,6 +1122,10 @@ Qt::WindowState QWindow::windowState() const
This is a hint to the window manager that this window is a dialog or pop-up
on behalf of the given window.
In order to cause the window to be centered above its transient parent by
default, depending on the window manager, it may also be necessary to call
setFlags() with a suitable \l Qt::WindowType (such as \c Qt::Dialog).
\sa transientParent(), parent()
*/
void QWindow::setTransientParent(QWindow *parent)

View File

@ -82,10 +82,12 @@ QOpenGLTextureGlyphCache::~QOpenGLTextureGlyphCache()
clear();
}
#if !defined(QT_OPENGL_ES_2)
static inline bool isCoreProfile()
{
return QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile;
}
#endif
void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
{

View File

@ -44,31 +44,49 @@
QT_BEGIN_NAMESPACE
static QString resolve2xFile(const QString &fileName, qreal targetDevicePixelRatio)
static QString resolveFileName(QString fileName, QUrl *url, qreal targetDevicePixelRatio)
{
// We might use the fileName for loading if url loading fails
// try to make sure it is a valid file path.
// Also, QFile{Info}::exists works only on filepaths (not urls)
if (url->isValid()) {
if (url->scheme() == QLatin1Literal("qrc")) {
fileName = fileName.right(fileName.length() - 3);
}
else if (url->scheme() == QLatin1Literal("file")) {
fileName = url->toLocalFile();
}
}
if (targetDevicePixelRatio <= 1.0)
return fileName;
int dotIndex = fileName.lastIndexOf(QLatin1Char('.'));
// try to find a 2x version
const int dotIndex = fileName.lastIndexOf(QLatin1Char('.'));
if (dotIndex != -1) {
QString at2xfileName = fileName;
at2xfileName.insert(dotIndex, QStringLiteral("@2x"));
if (QFile::exists(at2xfileName))
return at2xfileName;
if (QFile::exists(at2xfileName)) {
fileName = at2xfileName;
*url = QUrl(fileName);
}
}
return fileName;
}
static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format)
static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format, const qreal devicePixelRatio = 1.0)
{
QPixmap pm;
QString name = format.name();
if (name.startsWith(QLatin1String(":/"))) // auto-detect resources
if (name.startsWith(QLatin1String(":/"))) // auto-detect resources and convert them to url
name.prepend(QLatin1String("qrc"));
QPaintDevice *pdev = doc->documentLayout()->paintDevice();
name = resolve2xFile(name, pdev ? pdev->devicePixelRatio() : qApp->devicePixelRatio());
QUrl url = QUrl(name);
name = resolveFileName(name, &url, devicePixelRatio);
const QVariant data = doc->resource(QTextDocument::ImageResource, url);
if (data.type() == QVariant::Pixmap || data.type() == QVariant::Image) {
pm = qvariant_cast<QPixmap>(data);
@ -77,19 +95,18 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format)
}
if (pm.isNull()) {
QString context;
#if 0
QString context;
// ### Qt5
QTextBrowser *browser = qobject_cast<QTextBrowser *>(doc->parent());
if (browser)
context = browser->source().toString();
#endif
// try direct loading
QImage img;
if (img.isNull()) { // try direct loading
name = format.name(); // remove qrc:/ prefix again
if (name.isEmpty() || !img.load(name))
return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"));
}
if (name.isEmpty() || !img.load(name))
return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"));
pm = QPixmap::fromImage(img);
doc->addResource(QTextDocument::ImageResource, url, pm);
}
@ -142,16 +159,15 @@ static QSize getPixmapSize(QTextDocument *doc, const QTextImageFormat &format)
return size;
}
static QImage getImage(QTextDocument *doc, const QTextImageFormat &format)
static QImage getImage(QTextDocument *doc, const QTextImageFormat &format, const qreal devicePixelRatio = 1.0)
{
QImage image;
QString name = format.name();
if (name.startsWith(QLatin1String(":/"))) // auto-detect resources
name.prepend(QLatin1String("qrc"));
QPaintDevice *pdev = doc->documentLayout()->paintDevice();
name = resolve2xFile(name, pdev ? pdev->devicePixelRatio() : qApp->devicePixelRatio());
QUrl url = QUrl(name);
name = resolveFileName(name, &url, devicePixelRatio);
const QVariant data = doc->resource(QTextDocument::ImageResource, url);
if (data.type() == QVariant::Image) {
image = qvariant_cast<QImage>(data);
@ -160,19 +176,18 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format)
}
if (image.isNull()) {
QString context;
#if 0
QString context;
// ### Qt5
QTextBrowser *browser = qobject_cast<QTextBrowser *>(doc->parent());
if (browser)
context = browser->source().toString();
#endif
if (image.isNull()) { // try direct loading
name = format.name(); // remove qrc:/ prefix again
if (name.isEmpty() || !image.load(name))
return QImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"));
}
// try direct loading
if (name.isEmpty() || !image.load(name))
return QImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"));
doc->addResource(QTextDocument::ImageResource, url, image);
}
@ -241,10 +256,10 @@ void QTextImageHandler::drawObject(QPainter *p, const QRectF &rect, QTextDocumen
const QTextImageFormat imageFormat = format.toImageFormat();
if (QCoreApplication::instance()->thread() != QThread::currentThread()) {
const QImage image = getImage(doc, imageFormat);
const QImage image = getImage(doc, imageFormat, p->device()->devicePixelRatio());
p->drawImage(rect, image, image.rect());
} else {
const QPixmap pixmap = getPixmap(doc, imageFormat);
const QPixmap pixmap = getPixmap(doc, imageFormat, p->device()->devicePixelRatio());
p->drawPixmap(rect, pixmap, pixmap.rect());
}
}

View File

@ -1135,7 +1135,12 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
if (!d->networkSessionStrongRef && (d->initializeSession || !d->networkConfiguration.identifier().isEmpty())) {
QNetworkConfigurationManager manager;
if (!d->networkConfiguration.identifier().isEmpty()) {
d->createSession(d->networkConfiguration);
if ((d->networkConfiguration.state() & QNetworkConfiguration::Defined)
&& d->networkConfiguration != manager.defaultConfiguration())
d->createSession(manager.defaultConfiguration());
else
d->createSession(d->networkConfiguration);
} else {
if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)
d->createSession(manager.defaultConfiguration());
@ -1590,6 +1595,11 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
if (customNetworkConfiguration) {
online = (networkConfiguration.state() & QNetworkConfiguration::Active);
} else {
if (isOnline && online != isOnline) {
networkSessionStrongRef.clear();
networkSessionWeakRef.clear();
}
online = isOnline;
}
}

View File

@ -1908,18 +1908,14 @@ qint64 QSslSocket::readData(char *data, qint64 maxlen)
if (d->mode == UnencryptedMode && !d->autoStartHandshake) {
readBytes = d->plainSocket->read(data, maxlen);
} else {
int bytesToRead = qMin<int>(maxlen, d->buffer.size());
readBytes = d->buffer.read(data, bytesToRead);
}
#ifdef QSSLSOCKET_DEBUG
qDebug() << "QSslSocket::readData(" << (void *)data << ',' << maxlen << ") ==" << readBytes;
qDebug() << "QSslSocket::readData(" << (void *)data << ',' << maxlen << ") =="
<< readBytes;
#endif
// possibly trigger another transmit() to decrypt more data from the socket
if (d->buffer.isEmpty() && d->plainSocket->bytesAvailable()) {
QMetaObject::invokeMethod(this, "_q_flushReadBuffer", Qt::QueuedConnection);
} else {
// possibly trigger another transmit() to decrypt more data from the socket
if (d->plainSocket->bytesAvailable())
QMetaObject::invokeMethod(this, "_q_flushReadBuffer", Qt::QueuedConnection);
}
return readBytes;

View File

@ -8,14 +8,14 @@ QT = core network-private dbus
CONFIG += link_pkgconfig
HEADERS += qconnmanservice_linux_p.h \
qofonoservice_linux_p.h \
../linux_common/qofonoservice_linux_p.h \
qconnmanengine.h \
../qnetworksession_impl.h \
../qbearerengine_impl.h
SOURCES += main.cpp \
qconnmanservice_linux.cpp \
qofonoservice_linux.cpp \
../linux_common/qofonoservice_linux.cpp \
qconnmanengine.cpp \
../qnetworksession_impl.cpp

View File

@ -48,7 +48,7 @@
#include "../qbearerengine_impl.h"
#include "qconnmanservice_linux_p.h"
#include "qofonoservice_linux_p.h"
#include "../linux_common/qofonoservice_linux_p.h"
#include <QMap>
#include <QVariant>

View File

@ -95,14 +95,12 @@ QStringList QOfonoManagerInterface::getModems()
{
if (modemList.isEmpty()) {
QList<QVariant> argumentList;
QDBusPendingReply<PathPropertiesList> reply = asyncCallWithArgumentList(QLatin1String("GetModems"), argumentList);
QDBusPendingReply<PathPropertiesList> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetModems"), argumentList);
reply.waitForFinished();
if (!reply.isError()) {
foreach (ObjectPathProperties modem, reply.value()) {
modemList << modem.path.path();
}
} else {
qDebug() << reply.error().message();
}
}
@ -114,7 +112,8 @@ QString QOfonoManagerInterface::currentModem()
QStringList modems = getModems();
foreach (const QString &modem, modems) {
QOfonoModemInterface device(modem);
if (device.isPowered() && device.isOnline())
if (device.isPowered() && device.isOnline()
&& device.interfaces().contains(QStringLiteral("org.ofono.NetworkRegistration")))
return modem;
}
return QString();
@ -171,11 +170,17 @@ bool QOfonoModemInterface::isOnline()
return qdbus_cast<bool>(var);
}
QStringList QOfonoModemInterface::interfaces()
{
const QVariant var = getProperty(QStringLiteral("Interfaces"));
return var.toStringList();
}
QVariantMap QOfonoModemInterface::getProperties()
{
if (propertiesMap.isEmpty()) {
QList<QVariant> argumentList;
QDBusPendingReply<QVariantMap> reply = asyncCallWithArgumentList(QLatin1String("GetProperties"), argumentList);
QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
if (!reply.isError()) {
propertiesMap = reply.value();
}
@ -187,7 +192,8 @@ QVariant QOfonoModemInterface::getProperty(const QString &property)
{
QVariant var;
QVariantMap map = getProperties();
var = map.value(property);
if (map.contains(property))
var = map.value(property);
return var;
}
@ -214,7 +220,8 @@ QVariant QOfonoNetworkRegistrationInterface::getProperty(const QString &property
{
QVariant var;
QVariantMap map = getProperties();
var = map.value(property);
if (map.contains(property))
var = map.value(property);
return var;
}
@ -222,12 +229,10 @@ QVariantMap QOfonoNetworkRegistrationInterface::getProperties()
{
if (propertiesMap.isEmpty()) {
QList<QVariant> argumentList;
QDBusPendingReply<QVariantMap> reply = asyncCallWithArgumentList(QLatin1String("GetProperties"), argumentList);
QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
reply.waitForFinished();
if (!reply.isError()) {
propertiesMap = reply.value();
} else {
qDebug() << reply.error().message();
}
}
return propertiesMap;
@ -270,11 +275,18 @@ bool QOfonoDataConnectionManagerInterface::roamingAllowed()
return qdbus_cast<bool>(var);
}
QString QOfonoDataConnectionManagerInterface::bearer()
{
QVariant var = getProperty(QStringLiteral("Bearer"));
return qdbus_cast<QString>(var);
}
QVariant QOfonoDataConnectionManagerInterface::getProperty(const QString &property)
{
QVariant var;
QVariantMap map = getProperties();
var = map.value(property);
if (map.contains(property))
var = map.value(property);
return var;
}
@ -282,7 +294,7 @@ QVariantMap QOfonoDataConnectionManagerInterface::getProperties()
{
if (propertiesMap.isEmpty()) {
QList<QVariant> argumentList;
QDBusPendingReply<QVariantMap> reply = asyncCallWithArgumentList(QLatin1String("GetProperties"), argumentList);
QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
if (!reply.isError()) {
propertiesMap = reply.value();
}
@ -297,6 +309,68 @@ void QOfonoDataConnectionManagerInterface::propertyChanged(const QString &name,
Q_EMIT roamingAllowedChanged(value.variant().toBool());
}
QOfonoConnectionContextInterface::QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent)
: QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
dbusPathName,
OFONO_CONNECTION_CONTEXT_INTERFACE,
QDBusConnection::systemBus(), parent)
{
QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
path(),
QLatin1String(OFONO_MODEM_INTERFACE),
QLatin1String("PropertyChanged"),
this,SLOT(propertyChanged(QString,QDBusVariant)));
}
QOfonoConnectionContextInterface::~QOfonoConnectionContextInterface()
{
}
QVariantMap QOfonoConnectionContextInterface::getProperties()
{
if (propertiesMap.isEmpty()) {
QList<QVariant> argumentList;
QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
if (!reply.isError()) {
propertiesMap = reply.value();
}
}
return propertiesMap;
}
void QOfonoConnectionContextInterface::propertyChanged(const QString &name, const QDBusVariant &value)
{
propertiesMap[name] = value.variant();
}
QVariant QOfonoConnectionContextInterface::getProperty(const QString &property)
{
QVariant var;
QVariantMap map = getProperties();
if (map.contains(property))
var = map.value(property);
return var;
}
bool QOfonoConnectionContextInterface::active()
{
QVariant var = getProperty(QStringLiteral("Active"));
return qdbus_cast<bool>(var);
}
QString QOfonoConnectionContextInterface::accessPointName()
{
QVariant var = getProperty(QStringLiteral("AccessPointName"));
return qdbus_cast<QString>(var);
}
QString QOfonoConnectionContextInterface::name()
{
QVariant var = getProperty(QStringLiteral("Name"));
return qdbus_cast<QString>(var);
}
QT_END_NAMESPACE
#endif // QT_NO_DBUS

View File

@ -67,6 +67,7 @@
#define OFONO_MODEM_INTERFACE "org.ofono.Modem"
#define OFONO_NETWORK_REGISTRATION_INTERFACE "org.ofono.NetworkRegistration"
#define OFONO_DATA_CONNECTION_MANAGER_INTERFACE "org.ofono.ConnectionManager"
#define OFONO_CONNECTION_CONTEXT_INTERFACE "org.ofono.ConnectionContext"
QT_BEGIN_NAMESPACE
@ -114,6 +115,7 @@ public:
bool isPowered();
bool isOnline();
QStringList interfaces();
private:
QVariantMap getProperties();
QVariantMap propertiesMap;
@ -152,17 +154,39 @@ public:
QStringList contexts();
bool roamingAllowed();
QVariant getProperty(const QString &);
QString bearer();
Q_SIGNALS:
void roamingAllowedChanged(bool);
private:
QVariantMap getProperties();
QVariantMap propertiesMap;
QVariant getProperty(const QString &);
QStringList contextList;
private slots:
void propertyChanged(const QString &, const QDBusVariant &value);
};
class QOfonoConnectionContextInterface : public QDBusAbstractInterface
{
Q_OBJECT
public:
explicit QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent = 0);
~QOfonoConnectionContextInterface();
QVariant getProperty(const QString &);
bool active();
QString accessPointName();
QString name();
Q_SIGNALS:
private:
QVariantMap getProperties();
QVariantMap propertiesMap;
private slots:
void propertyChanged(const QString &, const QDBusVariant &value);
};
QT_END_NAMESPACE

View File

@ -6,16 +6,16 @@ load(qt_plugin)
QT = core network-private dbus
HEADERS += qnmdbushelper.h \
qnetworkmanagerservice.h \
HEADERS += qnetworkmanagerservice.h \
qnetworkmanagerengine.h \
../linux_common/qofonoservice_linux_p.h \
../qnetworksession_impl.h \
../qbearerengine_impl.h
SOURCES += main.cpp \
qnmdbushelper.cpp \
qnetworkmanagerservice.cpp \
qnetworkmanagerengine.cpp \
../linux_common/qofonoservice_linux.cpp \
../qnetworksession_impl.cpp
OTHER_FILES += networkmanager.json

View File

@ -47,6 +47,7 @@
#include <QDBusInterface>
#include <QDBusMessage>
#include <QDBusReply>
#include "../linux_common/qofonoservice_linux_p.h"
#ifndef QT_NO_BEARERMANAGEMENT
#ifndef QT_NO_DBUS
@ -57,45 +58,80 @@ QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent)
: QBearerEngineImpl(parent),
managerInterface(new QNetworkManagerInterface(this)),
systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE, this)),
userSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE, this))
ofonoManager(new QOfonoManagerInterface(this))
{
if (!managerInterface->isValid())
return;
managerInterface->setConnections();
qDBusRegisterMetaType<QNmSettingsMap>();
connect(managerInterface, SIGNAL(deviceAdded(QDBusObjectPath)),
this, SLOT(deviceAdded(QDBusObjectPath)));
connect(managerInterface, SIGNAL(deviceRemoved(QDBusObjectPath)),
this, SLOT(deviceRemoved(QDBusObjectPath)));
connect(managerInterface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)),
this, SLOT(activationFinished(QDBusPendingCallWatcher*)));
connect(managerInterface, SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)),
this, SLOT(interfacePropertiesChanged(QString,QMap<QString,QVariant>)));
connect(managerInterface, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
this, SLOT(interfacePropertiesChanged(QMap<QString,QVariant>)));
managerInterface->setConnections();
qDBusRegisterMetaType<QNmSettingsMap>();
systemSettings->setConnections();
connect(systemSettings, SIGNAL(newConnection(QDBusObjectPath)),
this, SLOT(newConnection(QDBusObjectPath)));
userSettings->setConnections();
connect(userSettings, SIGNAL(newConnection(QDBusObjectPath)),
this, SLOT(newConnection(QDBusObjectPath)));
systemSettings->setConnections();
}
QNetworkManagerEngine::~QNetworkManagerEngine()
{
qDeleteAll(connections);
connections.clear();
qDeleteAll(accessPoints);
accessPoints.clear();
qDeleteAll(wirelessDevices);
qDeleteAll(activeConnections);
wirelessDevices.clear();
qDeleteAll(activeConnectionsList);
activeConnectionsList.clear();
qDeleteAll(interfaceDevices);
interfaceDevices.clear();
connectionInterfaces.clear();
qDeleteAll(ofonoContextManagers);
ofonoContextManagers.clear();
qDeleteAll(wiredDevices);
wiredDevices.clear();
}
void QNetworkManagerEngine::initialize()
{
QMutexLocker locker(&mutex);
// Get current list of access points.
if (ofonoManager->isValid()) {
Q_FOREACH (const QString &modem, ofonoManager->getModems()) {
QOfonoDataConnectionManagerInterface *ofonoContextManager
= new QOfonoDataConnectionManagerInterface(modem,this);
ofonoContextManagers.insert(modem, ofonoContextManager);
}
}
// Get active connections.
foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
QNetworkManagerConnectionActive *activeConnection =
new QNetworkManagerConnectionActive(acPath.path(),this);
activeConnectionsList.insert(acPath.path(), activeConnection);
connect(activeConnection, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
this, SLOT(activeConnectionPropertiesChanged(QMap<QString,QVariant>)));
activeConnection->setConnections();
QStringList devices = activeConnection->devices();
if (!devices.isEmpty()) {
QNetworkManagerInterfaceDevice device(devices.at(0),this);
connectionInterfaces.insert(activeConnection->connection().path(),device.networkInterface());
}
}
// Get current list of access points.
foreach (const QDBusObjectPath &devicePath, managerInterface->getDevices()) {
locker.unlock();
deviceAdded(devicePath); //add all accesspoints
@ -103,7 +139,6 @@ void QNetworkManagerEngine::initialize()
}
// Get connections.
foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) {
locker.unlock();
if (!hasIdentifier(settingsPath.path()))
@ -111,57 +146,19 @@ void QNetworkManagerEngine::initialize()
locker.relock();
}
foreach (const QDBusObjectPath &settingsPath, userSettings->listConnections()) {
locker.unlock();
if (!hasIdentifier(settingsPath.path()))
newConnection(settingsPath, userSettings);
locker.relock();
}
// Get active connections.
foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
QNetworkManagerConnectionActive *activeConnection =
new QNetworkManagerConnectionActive(acPath.path(),this);
activeConnections.insert(acPath.path(), activeConnection);
activeConnection->setConnections();
connect(activeConnection, SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)),
this, SLOT(activeConnectionPropertiesChanged(QString,QMap<QString,QVariant>)));
}
Q_EMIT updateCompleted();
}
bool QNetworkManagerEngine::networkManagerAvailable() const
{
QMutexLocker locker(&mutex);
return managerInterface->isValid();
}
QString QNetworkManagerEngine::getInterfaceFromId(const QString &id)
QString QNetworkManagerEngine::getInterfaceFromId(const QString &settingsPath)
{
QMutexLocker locker(&mutex);
foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
QNetworkManagerConnectionActive activeConnection(acPath.path());
const QString identifier = activeConnection.connection().path();
if (id == identifier) {
QList<QDBusObjectPath> devices = activeConnection.devices();
if (devices.isEmpty())
continue;
QNetworkManagerInterfaceDevice device(devices.at(0).path());
return device.networkInterface();
}
}
return QString();
return connectionInterfaces.value(settingsPath);
}
bool QNetworkManagerEngine::hasIdentifier(const QString &id)
{
QMutexLocker locker(&mutex);
@ -177,35 +174,34 @@ void QNetworkManagerEngine::connectToId(const QString &id)
if (!connection)
return;
QNmSettingsMap map = connection->getSettings();
const QString connectionType = map.value("connection").value("type").toString();
NMDeviceType connectionType = connection->getType();
QString dbusDevicePath;
foreach (const QDBusObjectPath &devicePath, managerInterface->getDevices()) {
QNetworkManagerInterfaceDevice device(devicePath.path());
if (device.deviceType() == DEVICE_TYPE_ETHERNET &&
connectionType == QLatin1String("802-3-ethernet")) {
dbusDevicePath = devicePath.path();
const QString settingsPath = connection->connectionInterface()->path();
QString specificPath = configuredAccessPoints.key(settingsPath);
QHashIterator<QString, QNetworkManagerInterfaceDevice*> i(interfaceDevices);
while (i.hasNext()) {
i.next();
if (i.value()->deviceType() == DEVICE_TYPE_ETHERNET &&
connectionType == DEVICE_TYPE_ETHERNET) {
dbusDevicePath = i.key();
break;
} else if (device.deviceType() == DEVICE_TYPE_WIFI &&
connectionType == QLatin1String("802-11-wireless")) {
dbusDevicePath = devicePath.path();
} else if (i.value()->deviceType() == DEVICE_TYPE_WIFI &&
connectionType == DEVICE_TYPE_WIFI) {
dbusDevicePath = i.key();
break;
} else if (device.deviceType() == DEVICE_TYPE_MODEM &&
connectionType == QLatin1String("gsm")) {
dbusDevicePath = devicePath.path();
} else if (i.value()->deviceType() == DEVICE_TYPE_MODEM &&
connectionType == DEVICE_TYPE_MODEM) {
dbusDevicePath = i.key();
break;
}
}
const QString service = connection->connectionInterface()->service();
const QString settingsPath = connection->connectionInterface()->path();
QString specificPath = configuredAccessPoints.key(settingsPath);
if (specificPath.isEmpty())
specificPath = "/";
managerInterface->activateConnection(service, QDBusObjectPath(settingsPath),
managerInterface->activateConnection(QDBusObjectPath(settingsPath),
QDBusObjectPath(dbusDevicePath), QDBusObjectPath(specificPath));
}
@ -221,13 +217,11 @@ void QNetworkManagerEngine::disconnectFromId(const QString &id)
return;
}
foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
QNetworkManagerConnectionActive activeConnection(acPath.path());
const QString identifier = activeConnection.connection().path();
if (id == identifier && accessPointConfigurations.contains(id)) {
managerInterface->deactivateConnection(acPath);
QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
while (i.hasNext()) {
i.next();
if (id == i.value()->connection().path() && accessPointConfigurations.contains(id)) {
managerInterface->deactivateConnection(QDBusObjectPath(i.key()));
break;
}
}
@ -250,12 +244,9 @@ void QNetworkManagerEngine::scanFinished()
QMetaObject::invokeMethod(this, "updateCompleted", Qt::QueuedConnection);
}
void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path,
const QMap<QString, QVariant> &properties)
void QNetworkManagerEngine::interfacePropertiesChanged(const QMap<QString, QVariant> &properties)
{
Q_UNUSED(path)
QMutexLocker locker(&mutex);
QMapIterator<QString, QVariant> i(properties);
while (i.hasNext()) {
i.next();
@ -267,22 +258,20 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path,
qdbus_cast<QList<QDBusObjectPath> >(i.value().value<QDBusArgument>());
QStringList identifiers = accessPointConfigurations.keys();
foreach (const QString &id, identifiers)
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
QStringList priorActiveConnections = this->activeConnections.keys();
QStringList priorActiveConnections = activeConnectionsList.keys();
foreach (const QDBusObjectPath &acPath, activeConnections) {
priorActiveConnections.removeOne(acPath.path());
QNetworkManagerConnectionActive *activeConnection =
this->activeConnections.value(acPath.path());
activeConnectionsList.value(acPath.path());
if (!activeConnection) {
activeConnection = new QNetworkManagerConnectionActive(acPath.path(),this);
this->activeConnections.insert(acPath.path(), activeConnection);
activeConnectionsList.insert(acPath.path(), activeConnection);
connect(activeConnection, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
this, SLOT(activeConnectionPropertiesChanged(QMap<QString,QVariant>)));
activeConnection->setConnections();
connect(activeConnection, SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)),
this, SLOT(activeConnectionPropertiesChanged(QString,QMap<QString,QVariant>)));
}
const QString id = activeConnection->connection().path();
@ -295,6 +284,11 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path,
if (activeConnection->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED &&
ptr->state != QNetworkConfiguration::Active) {
ptr->state = QNetworkConfiguration::Active;
if (activeConnectionsList.value(id) && activeConnectionsList.value(id)->defaultRoute()
&& managerInterface->state() < QNetworkManagerInterface::NM_STATE_CONNECTED_GLOBAL) {
ptr->purpose = QNetworkConfiguration::PrivatePurpose;
}
ptr->mutex.unlock();
locker.unlock();
@ -307,7 +301,7 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path,
}
while (!priorActiveConnections.isEmpty())
delete this->activeConnections.take(priorActiveConnections.takeFirst());
delete activeConnectionsList.take(priorActiveConnections.takeFirst());
while (!identifiers.isEmpty()) {
QNetworkConfigurationPrivatePointer ptr =
@ -330,14 +324,13 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path,
}
}
void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &path,
const QMap<QString, QVariant> &properties)
void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QMap<QString, QVariant> &properties)
{
QMutexLocker locker(&mutex);
Q_UNUSED(properties)
QNetworkManagerConnectionActive *activeConnection = activeConnections.value(path);
QNetworkManagerConnectionActive *activeConnection = qobject_cast<QNetworkManagerConnectionActive *>(sender());
if (!activeConnection)
return;
@ -347,8 +340,13 @@ void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &pat
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (ptr) {
ptr->mutex.lock();
if (activeConnection->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED &&
ptr->state != QNetworkConfiguration::Active) {
if (properties.value("State").toUInt() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
QStringList devices = activeConnection->devices();
if (!devices.isEmpty()) {
QNetworkManagerInterfaceDevice device(devices.at(0),this);
connectionInterfaces.insert(id,device.networkInterface());
}
ptr->state |= QNetworkConfiguration::Active;
ptr->mutex.unlock();
@ -356,22 +354,17 @@ void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &pat
emit configurationChanged(ptr);
locker.relock();
} else {
connectionInterfaces.remove(id);
ptr->mutex.unlock();
}
}
}
void QNetworkManagerEngine::devicePropertiesChanged(const QString &/*path*/,quint32 /*state*/)
{
// Q_UNUSED(path);
// Q_UNUSED(state)
}
void QNetworkManagerEngine::deviceConnectionsChanged(const QStringList &activeConnectionsList)
void QNetworkManagerEngine::deviceConnectionsChanged(const QStringList &connectionsList)
{
QMutexLocker locker(&mutex);
for (int i = 0; i < connections.count(); ++i) {
if (activeConnectionsList.contains(connections.at(i)->connectionInterface()->path()))
if (connectionsList.contains(connections.at(i)->connectionInterface()->path()))
continue;
const QString settingsPath = connections.at(i)->connectionInterface()->path();
@ -392,33 +385,36 @@ void QNetworkManagerEngine::deviceConnectionsChanged(const QStringList &activeCo
void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path)
{
QMutexLocker locker(&mutex);
QNetworkManagerInterfaceDevice *iDevice;
iDevice = new QNetworkManagerInterfaceDevice(path.path(),this);
connect(iDevice,SIGNAL(connectionsChanged(QStringList)),
this,SLOT(deviceConnectionsChanged(QStringList)));
connect(iDevice,SIGNAL(stateChanged(QString,quint32)),
this,SLOT(devicePropertiesChanged(QString,quint32)));
iDevice->setConnections();
interfaceDevices.insert(path.path(),iDevice);
if (iDevice->deviceType() == DEVICE_TYPE_WIFI) {
QNetworkManagerInterfaceDeviceWireless *wirelessDevice =
new QNetworkManagerInterfaceDeviceWireless(iDevice->connectionInterface()->path(),this);
wirelessDevice->setConnections();
connect(wirelessDevice, SIGNAL(accessPointAdded(QString)),
this, SLOT(newAccessPoint(QString)));
connect(wirelessDevice, SIGNAL(accessPointRemoved(QString)),
this, SLOT(removeAccessPoint(QString)));
connect(wirelessDevice,SIGNAL(scanDone()),this,SLOT(scanFinished()));
wirelessDevice->setConnections();
foreach (const QDBusObjectPath &apPath, wirelessDevice->getAccessPoints())
newAccessPoint(apPath.path());
wirelessDevices.insert(path.path(), wirelessDevice);
}
if (iDevice->deviceType() == DEVICE_TYPE_ETHERNET) {
QNetworkManagerInterfaceDeviceWired *wiredDevice =
new QNetworkManagerInterfaceDeviceWired(iDevice->connectionInterface()->path(),this);
connect(wiredDevice,SIGNAL(carrierChanged(bool)),this,SLOT(wiredCarrierChanged(bool)));
wiredDevices.insert(iDevice->connectionInterface()->path(), wiredDevice);
}
}
void QNetworkManagerEngine::deviceRemoved(const QDBusObjectPath &path)
@ -435,6 +431,41 @@ void QNetworkManagerEngine::deviceRemoved(const QDBusObjectPath &path)
delete wirelessDevices.take(path.path());
locker.relock();
}
if (wiredDevices.contains(path.path())) {
locker.unlock();
delete wiredDevices.take(path.path());
locker.relock();
}
}
void QNetworkManagerEngine::wiredCarrierChanged(bool carrier)
{
QNetworkManagerInterfaceDeviceWired *deviceWired = qobject_cast<QNetworkManagerInterfaceDeviceWired *>(sender());
if (!deviceWired)
return;
QMutexLocker locker(&mutex);
foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) {
for (int i = 0; i < connections.count(); ++i) {
QNetworkManagerSettingsConnection *connection = connections.at(i);
if (connection->getType() == DEVICE_TYPE_ETHERNET
&& settingsPath.path() == connection->connectionInterface()->path()) {
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.value(settingsPath.path());
if (ptr) {
ptr->mutex.lock();
if (carrier)
ptr->state |= QNetworkConfiguration::Discovered;
else
ptr->state = QNetworkConfiguration::Defined;
ptr->mutex.unlock();
locker.unlock();
emit configurationChanged(ptr);
return;
}
}
}
}
}
void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
@ -444,57 +475,72 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
if (!settings)
settings = qobject_cast<QNetworkManagerSettings *>(sender());
if (!settings)
if (!settings) {
return;
}
settings->deleteLater();
QNetworkManagerSettingsConnection *connection =
new QNetworkManagerSettingsConnection(settings->connectionInterface()->service(),
path.path(),this);
QString apPath;
for (int i = 0; i < accessPoints.count(); ++i) {
if (connection->getSsid() == accessPoints.at(i)->ssid()) {
// remove the corresponding accesspoint from configurations
apPath = accessPoints.at(i)->connectionInterface()->path();
QNetworkConfigurationPrivatePointer ptr
= accessPointConfigurations.take(apPath);
if (ptr) {
locker.unlock();
emit configurationRemoved(ptr);
locker.relock();
}
}
const QString settingsPath = connection->connectionInterface()->path();
if (accessPointConfigurations.contains(settingsPath)) {
return;
}
connections.append(connection);
connect(connection,SIGNAL(removed(QString)),this,SLOT(removeConnection(QString)));
connect(connection,SIGNAL(updated()),this,SLOT(updateConnection()));
connection->setConnections();
const QString settingsPath = connection->connectionInterface()->path();
NMDeviceType deviceType = connection->getType();
if (connection->getType() == DEVICE_TYPE_WIFI
&& !configuredAccessPoints.contains(settingsPath))
configuredAccessPoints.insert(apPath,settingsPath);
if (deviceType == DEVICE_TYPE_WIFI) {
QString apPath;
for (int i = 0; i < accessPoints.count(); ++i) {
if (connection->getSsid() == accessPoints.at(i)->ssid()) {
// remove the corresponding accesspoint from configurations
apPath = accessPoints.at(i)->connectionInterface()->path();
QNetworkConfigurationPrivatePointer ptr
= accessPointConfigurations.take(apPath);
if (ptr) {
locker.unlock();
emit configurationRemoved(ptr);
locker.relock();
}
}
}
if (!configuredAccessPoints.contains(settingsPath))
configuredAccessPoints.insert(apPath,settingsPath);
}
QNetworkConfigurationPrivate *cpPriv =
parseConnection(settingsPath, connection->getSettings());
// Check if connection is active.
foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
QNetworkManagerConnectionActive activeConnection(acPath.path());
if (activeConnection.defaultRoute() &&
activeConnection.connection().path() == settingsPath &&
activeConnection.state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
while (i.hasNext()) {
i.next();
if (i.value()->connection().path() == settingsPath) {
cpPriv->state |= QNetworkConfiguration::Active;
break;
}
}
if (deviceType == DEVICE_TYPE_ETHERNET) {
QHashIterator<QString, QNetworkManagerInterfaceDevice*> i(interfaceDevices);
while (i.hasNext()) {
i.next();
if (i.value()->deviceType() == deviceType) {
QNetworkManagerInterfaceDeviceWired *wiredDevice
= wiredDevices.value(i.value()->connectionInterface()->path());
if (wiredDevice->carrier()) {
cpPriv->state |= QNetworkConfiguration::Discovered;
}
}
}
}
QNetworkConfigurationPrivatePointer ptr(cpPriv);
accessPointConfigurations.insert(ptr->id, ptr);
locker.unlock();
emit configurationAdded(ptr);
}
@ -505,6 +551,7 @@ void QNetworkManagerEngine::removeConnection(const QString &path)
QNetworkManagerSettingsConnection *connection =
qobject_cast<QNetworkManagerSettingsConnection *>(sender());
if (!connection)
return;
@ -525,6 +572,7 @@ void QNetworkManagerEngine::removeConnection(const QString &path)
while (i.hasNext()) {
i.next();
if (i.value() == path) {
configuredAccessPoints.remove(i.key());
newAccessPoint(i.key());
}
}
@ -538,8 +586,6 @@ void QNetworkManagerEngine::updateConnection()
qobject_cast<QNetworkManagerSettingsConnection *>(sender());
if (!connection)
return;
connection->deleteLater();
const QString settingsPath = connection->connectionInterface()->path();
QNetworkConfigurationPrivate *cpPriv = parseConnection(settingsPath, connection->getSettings());
@ -575,10 +621,9 @@ void QNetworkManagerEngine::updateConnection()
void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher)
{
QMutexLocker locker(&mutex);
QDBusPendingReply<QDBusObjectPath> reply(*watcher);
watcher->deleteLater();
QDBusPendingReply<QDBusObjectPath> reply(*watcher);
if (!reply.isError()) {
QDBusObjectPath result = reply.value();
@ -620,15 +665,14 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path)
if (okToAdd) {
accessPoints.append(accessPoint);
accessPoint->setConnections();
connect(accessPoint, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
this, SLOT(updateAccessPoint(QMap<QString,QVariant>)));
}
// Check if configuration exists for connection.
if (!accessPoint->ssid().isEmpty()) {
for (int i = 0; i < connections.count(); ++i) {
QNetworkManagerSettingsConnection *connection = connections.at(i);
const QString settingsPath = connection->connectionInterface()->path();
if (accessPoint->ssid() == connection->getSsid()) {
if (!configuredAccessPoints.contains(path)) {
configuredAccessPoints.insert(path,settingsPath);
@ -655,11 +699,7 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path)
ptr->isValid = true;
ptr->id = path;
ptr->type = QNetworkConfiguration::InternetAccessPoint;
if (accessPoint->flags() == NM_802_11_AP_FLAGS_PRIVACY) {
ptr->purpose = QNetworkConfiguration::PrivatePurpose;
} else {
ptr->purpose = QNetworkConfiguration::PublicPurpose;
}
ptr->purpose = QNetworkConfiguration::PublicPurpose;
ptr->state = QNetworkConfiguration::Undefined;
ptr->bearerType = QNetworkConfiguration::BearerWLAN;
@ -674,13 +714,13 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path)
QMutexLocker locker(&mutex);
for (int i = 0; i < accessPoints.count(); ++i) {
QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i);
if (accessPoint->connectionInterface()->path() == path) {
accessPoints.removeOne(accessPoint);
if (configuredAccessPoints.contains(accessPoint->connectionInterface()->path())) {
// find connection and change state to Defined
configuredAccessPoints.remove(accessPoint->connectionInterface()->path());
for (int i = 0; i < connections.count(); ++i) {
QNetworkManagerSettingsConnection *connection = connections.at(i);
@ -705,8 +745,6 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path)
accessPointConfigurations.take(path);
if (ptr) {
locker.unlock();
locker.unlock();
emit configurationRemoved(ptr);
locker.relock();
@ -718,42 +756,9 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path)
}
}
void QNetworkManagerEngine::updateAccessPoint(const QMap<QString, QVariant> &map)
{
QMutexLocker locker(&mutex);
Q_UNUSED(map)
QNetworkManagerInterfaceAccessPoint *accessPoint =
qobject_cast<QNetworkManagerInterfaceAccessPoint *>(sender());
if (!accessPoint)
return;
accessPoint->deleteLater();
for (int i = 0; i < connections.count(); ++i) {
QNetworkManagerSettingsConnection *connection = connections.at(i);
if (accessPoint->ssid() == connection->getSsid()) {
const QString settingsPath = connection->connectionInterface()->path();
const QString connectionId = settingsPath;
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.value(connectionId);
ptr->mutex.lock();
QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
ptr->state = (flag | QNetworkConfiguration::Discovered);
ptr->mutex.unlock();
locker.unlock();
emit configurationChanged(ptr);
return;
}
}
}
QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QString &settingsPath,
const QNmSettingsMap &map)
{
// Q_UNUSED(service);
QMutexLocker locker(&mutex);
QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate;
cpPriv->name = map.value("connection").value("id").toString();
@ -765,18 +770,16 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
cpPriv->state = QNetworkConfiguration::Defined;
const QString connectionType = map.value("connection").value("type").toString();
if (connectionType == QLatin1String("802-3-ethernet")) {
cpPriv->bearerType = QNetworkConfiguration::BearerEthernet;
cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
foreach (const QDBusObjectPath &devicePath, managerInterface->getDevices()) {
QNetworkManagerInterfaceDevice device(devicePath.path());
QNetworkManagerInterfaceDevice device(devicePath.path(),this);
if (device.deviceType() == DEVICE_TYPE_ETHERNET) {
QNetworkManagerInterfaceDeviceWired wiredDevice(device.connectionInterface()->path());
if (wiredDevice.carrier()) {
QNetworkManagerInterfaceDeviceWired *wiredDevice = wiredDevices.value(device.connectionInterface()->path());
if (wiredDevice->carrier()) {
cpPriv->state |= QNetworkConfiguration::Discovered;
break;
}
@ -786,12 +789,6 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
cpPriv->bearerType = QNetworkConfiguration::BearerWLAN;
const QString connectionSsid = map.value("802-11-wireless").value("ssid").toString();
const QString connectionSecurity = map.value("802-11-wireless").value("security").toString();
if (!connectionSecurity.isEmpty()) {
cpPriv->purpose = QNetworkConfiguration::PrivatePurpose;
} else {
cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
}
for (int i = 0; i < accessPoints.count(); ++i) {
if (connectionSsid == accessPoints.at(i)->ssid()
&& map.value("802-11-wireless").value("seen-bssids").toStringList().contains(accessPoints.at(i)->hwAddress())) {
@ -814,30 +811,13 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
}
} else if (connectionType == QLatin1String("gsm")) {
foreach (const QDBusObjectPath &devicePath, managerInterface->getDevices()) {
QNetworkManagerInterfaceDevice device(devicePath.path());
const QString contextPath = map.value("connection").value("id").toString();
cpPriv->name = contextName(contextPath);
cpPriv->bearerType = currentBearerType(contextPath);
if (device.deviceType() == DEVICE_TYPE_MODEM) {
QNetworkManagerInterfaceDeviceModem deviceModem(device.connectionInterface()->path(),this);
switch (deviceModem.currentCapabilities()) {
case 2:
cpPriv->bearerType = QNetworkConfiguration::Bearer2G;
break;
case 4:
cpPriv->bearerType = QNetworkConfiguration::Bearer3G;
break;
case 8:
cpPriv->bearerType = QNetworkConfiguration::Bearer4G;
break;
default:
cpPriv->bearerType = QNetworkConfiguration::BearerUnknown;
break;
};
}
if (map.value("connection").contains("timestamp")) {
cpPriv->state |= QNetworkConfiguration::Discovered;
}
cpPriv->purpose = QNetworkConfiguration::PrivatePurpose;
cpPriv->state |= QNetworkConfiguration::Discovered;
}
return cpPriv;
@ -857,7 +837,6 @@ QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const
QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &id)
{
QMutexLocker locker(&mutex);
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (!ptr)
@ -866,8 +845,8 @@ QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &i
if (!ptr->isValid)
return QNetworkSession::Invalid;
foreach (const QString &acPath, activeConnections.keys()) {
QNetworkManagerConnectionActive *activeConnection = activeConnections.value(acPath);
foreach (const QString &acPath, activeConnectionsList.keys()) {
QNetworkManagerConnectionActive *activeConnection = activeConnectionsList.value(acPath);
const QString identifier = activeConnection->connection().path();
@ -899,7 +878,7 @@ quint64 QNetworkManagerEngine::bytesWritten(const QString &id)
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
const QString networkInterface = getInterfaceFromId(id);
const QString networkInterface = connectionInterfaces.value(id);
if (!networkInterface.isEmpty()) {
const QString devFile = QLatin1String("/sys/class/net/") +
networkInterface +
@ -927,7 +906,7 @@ quint64 QNetworkManagerEngine::bytesReceived(const QString &id)
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
const QString networkInterface = getInterfaceFromId(id);
const QString networkInterface = connectionInterfaces.value(id);
if (!networkInterface.isEmpty()) {
const QString devFile = QLatin1String("/sys/class/net/") +
networkInterface +
@ -974,9 +953,67 @@ QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend()
QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration()
{
QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
while (i.hasNext()) {
i.next();
QNetworkManagerConnectionActive *activeConnection = i.value();
if ((activeConnection->defaultRoute() || activeConnection->default6Route())) {
return accessPointConfigurations.value(activeConnection->connection().path());
}
}
return QNetworkConfigurationPrivatePointer();
}
QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id)
{
if (ofonoManager->isValid()) {
QString contextPart = id.section('/', -1);
QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
while (i.hasNext()) {
i.next();
QString contextPath = i.key() +"/"+contextPart;
if (i.value()->contexts().contains(contextPath)) {
QString bearer = i.value()->bearer();
if (bearer == QStringLiteral("gsm")) {
return QNetworkConfiguration::Bearer2G;
} else if (bearer == QStringLiteral("edge")) {
return QNetworkConfiguration::Bearer2G;
} else if (bearer == QStringLiteral("umts")) {
return QNetworkConfiguration::BearerWCDMA;
} else if (bearer == QStringLiteral("hspa")
|| bearer == QStringLiteral("hsdpa")
|| bearer == QStringLiteral("hsupa")) {
return QNetworkConfiguration::BearerHSPA;
} else if (bearer == QStringLiteral("lte")) {
return QNetworkConfiguration::BearerLTE;
}
}
}
}
return QNetworkConfiguration::BearerUnknown;
}
QString QNetworkManagerEngine::contextName(const QString &path)
{
if (ofonoManager->isValid()) {
QString contextPart = path.section('/', -1);
QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
while (i.hasNext()) {
i.next();
Q_FOREACH (const QString &oContext, i.value()->contexts()) {
if (oContext.contains(contextPart)) {
QOfonoConnectionContextInterface contextInterface(oContext,this);
return contextInterface.name();
}
}
}
}
return path;
}
QT_END_NAMESPACE
#endif // QT_NO_DBUS

View File

@ -49,6 +49,8 @@
#include "qnetworkmanagerservice.h"
#include "../linux_common/qofonoservice_linux_p.h"
#include <QMap>
#include <QVariant>
@ -89,11 +91,8 @@ public:
QNetworkConfigurationPrivatePointer defaultConfiguration();
private Q_SLOTS:
void interfacePropertiesChanged(const QString &path,
const QMap<QString, QVariant> &properties);
void activeConnectionPropertiesChanged(const QString &path,
const QMap<QString, QVariant> &properties);
void devicePropertiesChanged(const QString &path, quint32);
void interfacePropertiesChanged(const QMap<QString, QVariant> &properties);
void activeConnectionPropertiesChanged(const QMap<QString, QVariant> &properties);
void deviceAdded(const QDBusObjectPath &path);
void deviceRemoved(const QDBusObjectPath &path);
@ -106,9 +105,10 @@ private Q_SLOTS:
void newAccessPoint(const QString &path);
void removeAccessPoint(const QString &path);
void updateAccessPoint(const QMap<QString, QVariant> &map);
void scanFinished();
void wiredCarrierChanged(bool);
private:
QNetworkConfigurationPrivate *parseConnection(const QString &settingsPath,
const QNmSettingsMap &map);
@ -116,14 +116,22 @@ private:
QNetworkManagerInterface *managerInterface;
QNetworkManagerSettings *systemSettings;
QNetworkManagerSettings *userSettings;
QHash<QString, QNetworkManagerInterfaceDeviceWired *> wiredDevices;
QHash<QString, QNetworkManagerInterfaceDeviceWireless *> wirelessDevices;
QHash<QString, QNetworkManagerConnectionActive *> activeConnections;
QHash<QString, QNetworkManagerConnectionActive *> activeConnectionsList;
QList<QNetworkManagerSettingsConnection *> connections;
QList<QNetworkManagerInterfaceAccessPoint *> accessPoints;
QHash<QString, QNetworkManagerInterfaceDevice *> interfaceDevices;
QMap<QString,QString> configuredAccessPoints; //ap, settings path
QHash<QString,QString> connectionInterfaces; // ac, interface
QOfonoManagerInterface *ofonoManager;
QHash <QString, QOfonoDataConnectionManagerInterface *> ofonoContextManagers;
QNetworkConfiguration::BearerType currentBearerType(const QString &id);
QString contextName(const QString &path);
};
QT_END_NAMESPACE

File diff suppressed because it is too large Load Diff

View File

@ -56,7 +56,6 @@
#include <QtDBus/QDBusObjectPath>
#include <QtDBus/QDBusContext>
#include <QMap>
#include "qnmdbushelper.h"
#ifndef QT_NO_DBUS
@ -89,7 +88,7 @@ typedef enum
NM_ACTIVE_CONNECTION_STATE_UNKNOWN = 0,
NM_ACTIVE_CONNECTION_STATE_ACTIVATING,
NM_ACTIVE_CONNECTION_STATE_ACTIVATED,
NM_ACTIVE_CONNECTION_STATE_DEACTIVATED
NM_ACTIVE_CONNECTION_STATE_DEACTIVATED = 4
} NMActiveConnectionState;
#define NM_DBUS_SERVICE "org.freedesktop.NetworkManager"
@ -135,12 +134,23 @@ class QNetworkManagerInterface : public QObject
Q_OBJECT
public:
typedef enum
{
NM_STATE_UNKNOWN = 0,
NM_STATE_ASLEEP = 10,
NM_STATE_DISCONNECTED = 20,
NM_STATE_DISCONNECTING = 30,
NM_STATE_CONNECTING = 40,
NM_STATE_CONNECTED_LOCAL = 50,
NM_STATE_CONNECTED_SITE = 60,
NM_STATE_CONNECTED_GLOBAL = 70
} NMState;
QNetworkManagerInterface(QObject *parent = 0);
~QNetworkManagerInterface();
QList <QDBusObjectPath> getDevices() const;
void activateConnection(const QString &serviceName, QDBusObjectPath connection, QDBusObjectPath device, QDBusObjectPath specificObject);
QList <QDBusObjectPath> getDevices();
void activateConnection(QDBusObjectPath connection,QDBusObjectPath device, QDBusObjectPath specificObject);
void deactivateConnection(QDBusObjectPath connectionPath) const;
QDBusObjectPath path() const;
@ -149,21 +159,28 @@ public:
bool wirelessEnabled() const;
bool wirelessHardwareEnabled() const;
QList <QDBusObjectPath> activeConnections() const;
quint32 state();
NMState state();
QString version() const;
bool setConnections();
bool isValid();
Q_SIGNALS:
void deviceAdded(QDBusObjectPath);
void deviceRemoved(QDBusObjectPath);
void propertiesChanged( const QString &, QMap<QString,QVariant>);
void stateChanged(const QString&, quint32);
void propertiesChanged(QMap<QString,QVariant>);
void stateChanged(quint32);
void activationFinished(QDBusPendingCallWatcher*);
void propertiesReady();
void devicesListReady();
private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
QNetworkManagerInterfacePrivate *d;
QNmDBusHelper *nmDBusHelper;
QVariantMap propertyMap;
QList<QDBusObjectPath> devicesPathList;
};
class QNetworkManagerInterfaceAccessPointPrivate;
@ -228,11 +245,14 @@ public:
Q_SIGNALS:
void propertiesChanged(QMap <QString,QVariant>);
void propertiesChanged( const QString &, QMap<QString,QVariant>);
void propertiesReady();
private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
QNetworkManagerInterfaceAccessPointPrivate *d;
QNmDBusHelper *nmDBusHelper;
QVariantMap propertyMap;
};
class QNetworkManagerInterfaceDevicePrivate;
@ -258,11 +278,14 @@ public:
Q_SIGNALS:
void stateChanged(const QString &, quint32);
void propertiesChanged(const QString &, QMap<QString,QVariant>);
void propertiesChanged(QMap<QString,QVariant>);
void connectionsChanged(QStringList);
void propertiesReady();
private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
QNetworkManagerInterfaceDevicePrivate *d;
QNmDBusHelper *nmDBusHelper;
QVariantMap propertyMap;
};
class QNetworkManagerInterfaceDeviceWiredPrivate;
@ -282,12 +305,19 @@ public:
bool carrier() const;
bool setConnections();
bool isValid();
QStringList availableConnections();
Q_SIGNALS:
void propertiesChanged( const QString &, QMap<QString,QVariant>);
void propertiesChanged(QMap<QString,QVariant>);
void propertiesReady();
void carrierChanged(bool);
private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
QNetworkManagerInterfaceDeviceWiredPrivate *d;
QNmDBusHelper *nmDBusHelper;
QVariantMap propertyMap;
};
class QNetworkManagerInterfaceDeviceWirelessPrivate;
@ -325,15 +355,24 @@ public:
void requestScan();
Q_SIGNALS:
void propertiesChanged( const QString &, QMap<QString,QVariant>);
void propertiesChanged(QMap<QString,QVariant>);
void accessPointAdded(const QString &);
void accessPointRemoved(const QString &);
void scanDone();
void propertiesReady();
void accessPointsReady();
private Q_SLOTS:
void scanIsDone();
void propertiesSwap(QMap<QString,QVariant>);
void slotAccessPointAdded(QDBusObjectPath);
void slotAccessPointRemoved(QDBusObjectPath);
private:
QNetworkManagerInterfaceDeviceWirelessPrivate *d;
QNmDBusHelper *nmDBusHelper;
QVariantMap propertyMap;
QList <QDBusObjectPath> accessPointsList;
};
class QNetworkManagerInterfaceDeviceModemPrivate;
@ -350,6 +389,7 @@ public:
Gsm_Umts = 0x4,
Lte = 0x08
};
Q_DECLARE_FLAGS(ModemCapabilities, ModemCapability)
explicit QNetworkManagerInterfaceDeviceModem(const QString &ifaceDevicePath,
QObject *parent = 0);
@ -361,16 +401,22 @@ public:
bool setConnections();
bool isValid();
quint32 modemCapabilities() const;
quint32 currentCapabilities() const;
ModemCapabilities modemCapabilities() const;
ModemCapabilities currentCapabilities() const;
Q_SIGNALS:
void propertiesChanged( const QString &, QMap<QString,QVariant>);
void propertiesChanged(QMap<QString,QVariant>);
void propertiesReady();
private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
QNetworkManagerInterfaceDeviceModemPrivate *d;
QNmDBusHelper *nmDBusHelper;
QVariantMap propertyMap;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkManagerInterfaceDeviceModem::ModemCapabilities)
class QNetworkManagerSettingsPrivate;
class QNetworkManagerSettings : public QObject
@ -390,8 +436,10 @@ public:
Q_SIGNALS:
void newConnection(QDBusObjectPath);
void connectionsListReady();
private:
QNetworkManagerSettingsPrivate *d;
QList <QDBusObjectPath> connectionsList;
};
class QNetworkManagerSettingsConnectionPrivate;
@ -418,12 +466,14 @@ public:
bool isValid();
Q_SIGNALS:
void updated();
void removed(const QString &path);
void settingsReady();
private Q_SLOTS:
void slotSettingsRemoved();
private:
QNmDBusHelper *nmDBusHelper;
QNetworkManagerSettingsConnectionPrivate *d;
};
@ -444,22 +494,26 @@ public:
~ QNetworkManagerConnectionActive();
QDBusInterface *connectionInterface() const;
QString serviceName() const;
QDBusObjectPath connection() const;
QDBusObjectPath specificObject() const;
QList<QDBusObjectPath> devices() const;
QStringList devices() const;
quint32 state() const;
bool defaultRoute() const;
bool default6Route() const;
bool setConnections();
bool isValid();
Q_SIGNALS:
void propertiesChanged(QList<QDBusObjectPath>);
void propertiesChanged( const QString &, QMap<QString,QVariant>);
void propertiesChanged(QMap<QString,QVariant>);
void propertiesReady();
private Q_SLOTS:
void propertiesSwap(QMap<QString,QVariant>);
private:
QNetworkManagerConnectionActivePrivate *d;
QNmDBusHelper *nmDBusHelper;
QVariantMap propertyMap;
};
class QNetworkManagerIp4ConfigPrivate;

View File

@ -1,140 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
// this class is for helping qdbus get stuff
#include "qnmdbushelper.h"
#include "qnetworkmanagerservice.h"
#include <QDBusError>
#include <QDBusInterface>
#include <QDBusMessage>
#include <QDBusReply>
#include <QDebug>
#ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE
QNmDBusHelper::QNmDBusHelper(QObject * parent)
: QObject(parent)
{
}
QNmDBusHelper::~QNmDBusHelper()
{
}
void QNmDBusHelper::deviceStateChanged(quint32 state)
{
QDBusMessage msg = this->message();
if (state == NM_DEVICE_STATE_ACTIVATED
|| state == NM_DEVICE_STATE_DISCONNECTED
|| state == NM_DEVICE_STATE_UNAVAILABLE
|| state == NM_DEVICE_STATE_FAILED) {
emit pathForStateChanged(msg.path(), state);
}
}
void QNmDBusHelper::slotAccessPointAdded(QDBusObjectPath path)
{
if (path.path().length() > 2)
emit pathForAccessPointAdded(path.path());
}
void QNmDBusHelper::slotAccessPointRemoved(QDBusObjectPath path)
{
if (path.path().length() > 2)
emit pathForAccessPointRemoved(path.path());
}
void QNmDBusHelper::slotPropertiesChanged(QMap<QString,QVariant> map)
{
QDBusMessage msg = this->message();
QMapIterator<QString, QVariant> i(map);
while (i.hasNext()) {
i.next();
if (i.key() == QStringLiteral("State")) {
quint32 state = i.value().toUInt();
if (state == NM_DEVICE_STATE_ACTIVATED
|| state == NM_DEVICE_STATE_DISCONNECTED
|| state == NM_DEVICE_STATE_UNAVAILABLE
|| state == NM_DEVICE_STATE_FAILED) {
emit pathForPropertiesChanged(msg.path(), map);
}
} else if (i.key() == QStringLiteral("ActiveAccessPoint")) {
emit pathForPropertiesChanged(msg.path(), map);
} else if (i.key() == QStringLiteral("ActiveConnections")) {
emit pathForPropertiesChanged(msg.path(), map);
} else if (i.key() == QStringLiteral("AvailableConnections")) {
const QDBusArgument &dbusArgs = i.value().value<QDBusArgument>();
QDBusObjectPath path;
QStringList paths;
dbusArgs.beginArray();
while (!dbusArgs.atEnd()) {
dbusArgs >> path;
paths << path.path();
}
dbusArgs.endArray();
emit pathForConnectionsChanged(paths);
}
}
}
void QNmDBusHelper::slotSettingsRemoved()
{
QDBusMessage msg = this->message();
emit pathForSettingsRemoved(msg.path());
}
void QNmDBusHelper::activeConnectionPropertiesChanged(QMap<QString,QVariant> map)
{
QDBusMessage msg = this->message();
QMapIterator<QString, QVariant> i(map);
while (i.hasNext()) {
i.next();
if (i.key() == QStringLiteral("State")) {
quint32 state = i.value().toUInt();
if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED
|| state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
emit pathForPropertiesChanged(msg.path(), map);
}
}
}
}
QT_END_NAMESPACE
#endif // QT_NO_DBUS

View File

@ -1,73 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QNMDBUSHELPERPRIVATE_H
#define QNMDBUSHELPERPRIVATE_H
#include <QDBusObjectPath>
#include <QDBusContext>
#include <QMap>
#ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE
class QNmDBusHelper: public QObject, protected QDBusContext
{
Q_OBJECT
public:
QNmDBusHelper(QObject *parent = 0);
~QNmDBusHelper();
public slots:
void deviceStateChanged(quint32);
void slotAccessPointAdded(QDBusObjectPath);
void slotAccessPointRemoved(QDBusObjectPath);
void slotPropertiesChanged(QMap<QString,QVariant>);
void slotSettingsRemoved();
void activeConnectionPropertiesChanged(QMap<QString,QVariant>);
Q_SIGNALS:
void pathForStateChanged(const QString &, quint32);
void pathForAccessPointAdded(const QString &);
void pathForAccessPointRemoved(const QString &);
void pathForPropertiesChanged(const QString &, QMap<QString,QVariant>);
void pathForSettingsRemoved(const QString &);
void pathForConnectionsChanged(const QStringList &pathsList);
};
QT_END_NAMESPACE
#endif // QT_NO_DBUS
#endif// QNMDBUSHELPERPRIVATE_H

View File

@ -366,7 +366,8 @@ void QNetworkSessionPrivateImpl::networkConfigurationsChanged()
else
updateStateFromActiveConfig();
startTime = engine->startTime(activeConfig.identifier());
if (engine)
startTime = engine->startTime(activeConfig.identifier());
}
void QNetworkSessionPrivateImpl::configurationChanged(QNetworkConfigurationPrivatePointer config)

View File

@ -32,7 +32,6 @@
****************************************************************************/
#include "qibustypes.h"
#include <qtextformat.h>
#include <QtDBus>
#include <QHash>
@ -134,7 +133,7 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttribute &a
return argument;
}
QTextFormat QIBusAttribute::format() const
QTextCharFormat QIBusAttribute::format() const
{
QTextCharFormat fmt;
switch (type) {
@ -225,11 +224,32 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, QIBusAttributeList &at
QList<QInputMethodEvent::Attribute> QIBusAttributeList::imAttributes() const
{
QList<QInputMethodEvent::Attribute> imAttrs;
QHash<QPair<int, int>, QTextCharFormat> rangeAttrs;
// Merge text fomats for identical ranges into a single QTextFormat.
for (int i = 0; i < attributes.size(); ++i) {
const QIBusAttribute &attr = attributes.at(i);
imAttrs += QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, attr.start, attr.end - attr.start, attr.format());
const QTextCharFormat &format = attr.format();
if (format.isValid()) {
const QPair<int, int> range(attr.start, attr.end);
rangeAttrs[range].merge(format);
}
}
// Assemble list in original attribute order.
QList<QInputMethodEvent::Attribute> imAttrs;
for (int i = 0; i < attributes.size(); ++i) {
const QIBusAttribute &attr = attributes.at(i);
const QTextFormat &format = attr.format();
imAttrs += QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,
attr.start,
attr.end - attr.start,
format.isValid() ? rangeAttrs[QPair<int, int>(attr.start, attr.end)] : format);
}
return imAttrs;
}

View File

@ -36,6 +36,7 @@
#include <qvector.h>
#include <qevent.h>
#include <QDBusArgument>
#include <QTextCharFormat>
QT_BEGIN_NAMESPACE
@ -70,7 +71,7 @@ public:
QIBusAttribute();
~QIBusAttribute();
QTextFormat format() const;
QTextCharFormat format() const;
Type type;
quint32 value;

View File

@ -268,6 +268,7 @@ public: // for QNSView
bool m_inConstructor;
bool m_inSetVisible;
bool m_inSetGeometry;
#ifndef QT_NO_OPENGL
QCocoaGLContext *m_glContext;
#endif

View File

@ -381,6 +381,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
, m_windowUnderMouse(false)
, m_inConstructor(true)
, m_inSetVisible(false)
, m_inSetGeometry(false)
#ifndef QT_NO_OPENGL
, m_glContext(0)
#endif
@ -470,6 +471,8 @@ QSurfaceFormat QCocoaWindow::format() const
void QCocoaWindow::setGeometry(const QRect &rectIn)
{
QBoolBlocker inSetGeometry(m_inSetGeometry, true);
QRect rect = rectIn;
// This means it is a call from QWindow::setFramePosition() and
// the coordinates include the frame (size is still the contents rectangle).
@ -1754,6 +1757,11 @@ void QCocoaWindow::updateExposedGeometry()
if (!m_geometryUpdateExposeAllowed)
return;
// Do not send incorrect exposes in case the window is not even visible yet.
// We might get here as a result of a resize() from QWidget's show(), for instance.
if (!window()->isVisible())
return;
if (!isWindowExposable())
return;

View File

@ -361,12 +361,11 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
// Send a geometry change event to Qt, if it's ready to handle events
if (!m_platformWindow->m_inConstructor) {
QWindowSystemInterface::handleGeometryChange(m_window, geometry);
// Do not send incorrect exposes in case the window is not even visible yet.
// We might get here as a result of a resize() from QWidget's show(), for instance.
if (m_platformWindow->window()->isVisible()) {
m_platformWindow->updateExposedGeometry();
m_platformWindow->updateExposedGeometry();
// Guard against processing window system events during QWindow::setGeometry
// calles, which Qt and Qt applications do not excpect.
if (!m_platformWindow->m_inSetGeometry)
QWindowSystemInterface::flushWindowSystemEvents();
}
}
}
@ -603,7 +602,8 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
{
if (m_window->flags() & Qt::WindowTransparentForInput)
return NO;
QWindowSystemInterface::handleWindowActivated([self topLevelWindow]);
if (!m_platformWindow->windowIsPopupType())
QWindowSystemInterface::handleWindowActivated([self topLevelWindow]);
return YES;
}
@ -662,6 +662,19 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
m_frameStrutButtons = Qt::NoButton;
}
- (NSPoint) screenMousePoint:(NSEvent *)theEvent
{
NSPoint screenPoint;
if (theEvent) {
NSPoint windowPoint = [theEvent locationInWindow];
NSRect screenRect = [[theEvent window] convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 1, 1)];
screenPoint = screenRect.origin;
} else {
screenPoint = [NSEvent mouseLocation];
}
return screenPoint;
}
- (void)handleMouseEvent:(NSEvent *)theEvent
{
[self handleTabletEvent: theEvent];
@ -676,23 +689,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
m_platformWindow->m_forwardWindow = 0;
}
NSPoint globalPos = [NSEvent mouseLocation];
if ([self.window parentWindow]
&& (theEvent.type == NSLeftMouseDragged || theEvent.type == NSLeftMouseUp)) {
// QToolBar can be implemented as a child window on top of its main window
// (with a borderless NSWindow). If an option "unified toolbar" set on the main window,
// it's possible to drag such a window using this toolbar.
// While handling mouse drag events, QToolBar moves the window (QWidget::move).
// In such a combination [NSEvent mouseLocation] is very different from the
// real event location and as a result a window will move chaotically.
NSPoint winPoint = [theEvent locationInWindow];
NSRect tmpRect = NSMakeRect(winPoint.x, winPoint.y, 1., 1.);
tmpRect = [[theEvent window] convertRectToScreen:tmpRect];
globalPos = tmpRect.origin;
}
[targetView convertFromScreen:globalPos toWindowPoint:&qtWindowPoint andScreenPoint:&qtScreenPoint];
[targetView convertFromScreen:[self screenMousePoint:theEvent] toWindowPoint:&qtWindowPoint andScreenPoint:&qtScreenPoint];
ulong timestamp = [theEvent timestamp] * 1000;
QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
@ -865,7 +862,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
QPointF windowPoint;
QPointF screenPoint;
[self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
[self convertFromScreen:[self screenMousePoint:theEvent] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindow *childWindow = m_platformWindow->childWindowAt(windowPoint.toPoint());
// Top-level windows generate enter-leave events for sub-windows.

View File

@ -63,11 +63,13 @@ QByteArray QEglFSHooks::fbDeviceName() const
int QEglFSHooks::framebufferIndex() const
{
int fbIndex = 0;
#ifndef QT_NO_REGULAREXPRESSION
QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)"));
QRegularExpressionMatch match = fbIndexRx.match(fbDeviceName());
if (match.hasMatch())
fbIndex = match.captured(1).toInt();
#endif
return fbIndex;
}

View File

@ -317,11 +317,16 @@ static bool rootLevelRunLoopIntegration()
}
#if defined(Q_PROCESSOR_X86)
# define SET_STACK_POINTER "mov %0, %%esp"
# define FUNCTION_CALL_ALIGNMENT 16
# if defined(Q_PROCESSOR_X86_32)
# define SET_STACK_POINTER "mov %0, %%esp"
# elif defined(Q_PROCESSOR_X86_64)
# define SET_STACK_POINTER "movq %0, %%rsp"
# endif
#elif defined(Q_PROCESSOR_ARM)
# define SET_STACK_POINTER "mov sp, %0"
# // Valid for both 32 and 64-bit ARM
# define FUNCTION_CALL_ALIGNMENT 4
# define SET_STACK_POINTER "mov sp, %0"
#else
# error "Unknown processor family"
#endif

View File

@ -62,7 +62,7 @@ QPointF fromCGPoint(const CGPoint &point);
Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation);
UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation);
QRect fromPortraitToPrimary(const QRect &rect, QPlatformScreen *screen);
int infoPlistValue(NSString* key, int defaultValue);
QT_END_NAMESPACE

View File

@ -127,15 +127,6 @@ UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation)
return uiOrientation;
}
QRect fromPortraitToPrimary(const QRect &rect, QPlatformScreen *screen)
{
// UIScreen is always in portrait. Use this function to convert CGRects
// aligned with UIScreen into whatever is the current orientation of QScreen.
QRect geometry = screen->geometry();
return geometry.width() < geometry.height() ? rect
: QRect(rect.y(), geometry.height() - rect.width() - rect.x(), rect.height(), rect.width());
}
int infoPlistValue(NSString* key, int defaultValue)
{
static NSBundle *bundle = [NSBundle mainBundle];

View File

@ -51,9 +51,10 @@ QT_BEGIN_NAMESPACE
struct ImeState
{
ImeState() : currentState(0) {}
ImeState() : currentState(0), focusObject(0) {}
Qt::InputMethodQueries update(Qt::InputMethodQueries properties);
QInputMethodQueryEvent currentState;
QObject *focusObject;
};
class QIOSInputContext : public QPlatformInputContext
@ -82,6 +83,7 @@ public:
void commit();
const ImeState &imeState() { return m_imeState; };
bool inputMethodAccepted() const;
bool isReloadingInputViewsFromUpdate() const { return m_isReloadingInputViewsFromUpdate; }

View File

@ -46,25 +46,28 @@
#include "qiosglobal.h"
#include "qiosintegration.h"
#include "qiostextresponder.h"
#include "qiosviewcontroller.h"
#include "qioswindow.h"
#include "quiview.h"
#include <QGuiApplication>
#include <QtGui/private/qwindow_p.h>
// -------------------------------------------------------------------------
static QUIView *focusView()
{
return qApp->focusWindow() ?
reinterpret_cast<QUIView *>(qApp->focusWindow()->winId()) : 0;
}
@interface QIOSKeyboardListener : UIGestureRecognizer {
// -------------------------------------------------------------------------
@interface QIOSKeyboardListener : UIGestureRecognizer <UIGestureRecognizerDelegate> {
@public
QIOSInputContext *m_context;
BOOL m_keyboardVisible;
BOOL m_keyboardVisibleAndDocked;
BOOL m_touchPressWhileKeyboardVisible;
BOOL m_keyboardHiddenByGesture;
QRectF m_keyboardRect;
CGRect m_keyboardEndRect;
NSTimeInterval m_duration;
@ -77,13 +80,11 @@ static QUIView *focusView()
- (id)initWithQIOSInputContext:(QIOSInputContext *)context
{
self = [super initWithTarget:self action:@selector(gestureTriggered)];
self = [super initWithTarget:self action:@selector(gestureStateChanged:)];
if (self) {
m_context = context;
m_keyboardVisible = NO;
m_keyboardVisibleAndDocked = NO;
m_touchPressWhileKeyboardVisible = NO;
m_keyboardHiddenByGesture = NO;
m_duration = 0;
m_curve = UIViewAnimationCurveEaseOut;
m_viewController = 0;
@ -99,10 +100,9 @@ static QUIView *focusView()
Q_ASSERT(m_viewController);
// Attach 'hide keyboard' gesture to the window, but keep it disabled when the
// keyboard is not visible. Note that we never trigger the gesture the way it is intended
// since we don't want to cancel touch events and interrupt flicking etc. Instead we use
// the gesture framework more as an event filter and hide the keyboard silently.
// keyboard is not visible.
self.enabled = NO;
self.cancelsTouchesInView = NO;
self.delaysTouchesEnded = NO;
[m_viewController.view.window addGestureRecognizer:self];
}
@ -156,11 +156,19 @@ static QUIView *focusView()
// Note that UIKeyboardWillShowNotification is only sendt when the keyboard is docked.
m_keyboardVisibleAndDocked = YES;
m_keyboardEndRect = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
self.enabled = YES;
if (!m_duration) {
m_duration = [[notification.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
m_curve = UIViewAnimationCurve([[notification.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] integerValue]);
}
UIResponder *firstResponder = [UIResponder currentFirstResponder];
if (![firstResponder isKindOfClass:[QIOSTextInputResponder class]])
return;
// Enable hide-keyboard gesture
self.enabled = YES;
m_context->scrollToCursor();
}
@ -169,7 +177,7 @@ static QUIView *focusView()
// Note that UIKeyboardWillHideNotification is also sendt when the keyboard is undocked.
m_keyboardVisibleAndDocked = NO;
m_keyboardEndRect = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
if (!m_keyboardHiddenByGesture) {
if (self.state != UIGestureRecognizerStateBegan) {
// Only disable the gesture if the hiding of the keyboard was not caused by it.
// Otherwise we need to await the final touchEnd callback for doing some clean-up.
self.enabled = NO;
@ -202,54 +210,81 @@ static QUIView *focusView()
}
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint p = [[touches anyObject] locationInView:m_viewController.view.window];
if (CGRectContainsPoint(m_keyboardEndRect, p)) {
m_keyboardHiddenByGesture = YES;
UIResponder *firstResponder = [UIResponder currentFirstResponder];
Q_ASSERT([firstResponder isKindOfClass:[QIOSTextInputResponder class]]);
[firstResponder resignFirstResponder];
}
[super touchesMoved:touches withEvent:event];
}
// -------------------------------------------------------------------------
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
Q_ASSERT(m_keyboardVisibleAndDocked);
m_touchPressWhileKeyboardVisible = YES;
[super touchesBegan:touches withEvent:event];
Q_ASSERT(m_keyboardVisibleAndDocked);
if ([touches count] != 1)
self.state = UIGestureRecognizerStateFailed;
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesMoved:touches withEvent:event];
if (self.state != UIGestureRecognizerStatePossible)
return;
CGPoint touchPoint = [[touches anyObject] locationInView:m_viewController.view.window];
if (CGRectContainsPoint(m_keyboardEndRect, touchPoint))
self.state = UIGestureRecognizerStateBegan;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
m_touchPressWhileKeyboardVisible = NO;
[self performSelectorOnMainThread:@selector(touchesEndedPostDelivery) withObject:nil waitUntilDone:NO];
[super touchesEnded:touches withEvent:event];
[self touchesEndedOrCancelled];
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
m_touchPressWhileKeyboardVisible = NO;
[self performSelectorOnMainThread:@selector(touchesEndedPostDelivery) withObject:nil waitUntilDone:NO];
[super touchesCancelled:touches withEvent:event];
[self touchesEndedOrCancelled];
}
- (void)touchesEndedPostDelivery
- (void)touchesEndedOrCancelled
{
// Do some clean-up _after_ touchEnd has been delivered to QUIView
m_keyboardHiddenByGesture = NO;
// Defer final state change until next runloop iteration, so that Qt
// has a chance to process the final touch events first, before we eg.
// scroll the view.
dispatch_async(dispatch_get_main_queue (), ^{
// iOS will transition from began to changed by itself
Q_ASSERT(self.state != UIGestureRecognizerStateBegan);
if (self.state == UIGestureRecognizerStateChanged)
self.state = UIGestureRecognizerStateEnded;
else
self.state = UIGestureRecognizerStateFailed;
});
}
- (void)gestureStateChanged:(id)sender
{
Q_UNUSED(sender);
if (self.state == UIGestureRecognizerStateBegan) {
qImDebug() << "hide keyboard gesture was triggered";
UIResponder *firstResponder = [UIResponder currentFirstResponder];
Q_ASSERT([firstResponder isKindOfClass:[QIOSTextInputResponder class]]);
[firstResponder resignFirstResponder];
}
}
- (void)reset
{
[super reset];
if (!m_keyboardVisibleAndDocked) {
qImDebug() << "keyboard was hidden, disabling hide-keyboard gesture";
self.enabled = NO;
if (qApp->focusObject()) {
// UI Controls are told to gain focus on touch release. So when the 'hide keyboard' gesture
// finishes, the final touch end can trigger a control to gain focus. This is in conflict with
// the gesture, so we clear focus once more as a work-around.
static_cast<QWindowPrivate *>(QObjectPrivate::get(qApp->focusWindow()))->clearFocusObject();
}
} else {
qImDebug() << "gesture completed without triggering, scrolling view to cursor";
m_context->scrollToCursor();
}
}
@ -265,8 +300,11 @@ Qt::InputMethodQueries ImeState::update(Qt::InputMethodQueries properties)
QInputMethodQueryEvent newState(properties);
if (qApp && qApp->focusObject())
QCoreApplication::sendEvent(qApp->focusObject(), &newState);
// Update the focus object that the new state is based on
focusObject = qApp ? qApp->focusObject() : 0;
if (focusObject)
QCoreApplication::sendEvent(focusObject, &newState);
Qt::InputMethodQueries updatedProperties;
for (uint i = 0; i < (sizeof(Qt::ImQueryAll) * CHAR_BIT); ++i) {
@ -313,11 +351,23 @@ QRectF QIOSInputContext::keyboardRect() const
void QIOSInputContext::showInputPanel()
{
// No-op, keyboard controlled fully by platform based on focus
qImDebug() << "can't show virtual keyboard without a focus object, ignoring";
}
void QIOSInputContext::hideInputPanel()
{
// No-op, keyboard controlled fully by platform based on focus
if (![m_textResponder isFirstResponder]) {
qImDebug() << "QIOSTextInputResponder is not first responder, ignoring";
return;
}
if (qGuiApp->focusObject() != m_imeState.focusObject) {
qImDebug() << "current focus object does not match IM state, likely hiding from focusOut event, so ignoring";
return;
}
qImDebug() << "hiding VKB as requested by QInputMethod::hide()";
[m_textResponder resignFirstResponder];
}
void QIOSInputContext::clearCurrentFocusObject()
@ -353,10 +403,10 @@ void QIOSInputContext::scrollToCursor()
if (!isQtApplication())
return;
if (m_keyboardListener->m_touchPressWhileKeyboardVisible) {
// Don't scroll to the cursor if the user is touching the screen. This
// interferes with selection and the 'hide keyboard' gesture. Instead
// we update scrolling upon touchEnd.
if (m_keyboardListener.state == UIGestureRecognizerStatePossible && m_keyboardListener.numberOfTouches == 1) {
// Don't scroll to the cursor if the user is touching the screen and possibly
// trying to trigger the hide-keyboard gesture.
qImDebug() << "preventing scrolling to cursor as we're still waiting for a possible gesture";
return;
}
@ -426,6 +476,18 @@ void QIOSInputContext::setFocusObject(QObject *focusObject)
{
Q_UNUSED(focusObject);
qImDebug() << "new focus object =" << focusObject;
if (m_keyboardListener.state == UIGestureRecognizerStateChanged) {
// A new focus object may be set as part of delivering touch events to
// application during the hide-keyboard gesture, but we don't want that
// to result in a new object getting focus and bringing the keyboard up
// again.
qImDebug() << "clearing focus object" << focusObject << "as hide-keyboard gesture is active";
clearCurrentFocusObject();
return;
}
reset();
if (m_keyboardListener->m_keyboardVisibleAndDocked)
@ -436,6 +498,8 @@ void QIOSInputContext::focusWindowChanged(QWindow *focusWindow)
{
Q_UNUSED(focusWindow);
qImDebug() << "new focus window =" << focusWindow;
reset();
[m_keyboardListener handleKeyboardRectChanged];
@ -486,6 +550,26 @@ void QIOSInputContext::update(Qt::InputMethodQueries updatedProperties)
}
}
bool QIOSInputContext::inputMethodAccepted() const
{
// The IM enablement state is based on the last call to update()
bool lastKnownImEnablementState = m_imeState.currentState.value(Qt::ImEnabled).toBool();
#if !defined(QT_NO_DEBUG)
// QPlatformInputContext keeps a cached value of the current IM enablement state that is
// updated by QGuiApplication when the current focus object changes, or by QInputMethod's
// update() function. If the focus object changes, but the change is not propagated as
// a signal to QGuiApplication due to bugs in the widget/graphicsview/qml stack, we'll
// end up with a stale value for QPlatformInputContext::inputMethodAccepted(). To be on
// the safe side we always use our own cached value to decide if IM is enabled, and try
// to detect the case where the two values are out of sync.
if (lastKnownImEnablementState != QPlatformInputContext::inputMethodAccepted())
qWarning("QPlatformInputContext::inputMethodAccepted() does not match actual focus object IM enablement!");
#endif
return lastKnownImEnablementState;
}
/*!
Called by the input item to reset the input method state.
*/

View File

@ -1224,16 +1224,21 @@ void QWindowsNativeFileDialogBase::setNameFilters(const QStringList &filters)
QScopedArrayPointer<WCHAR> buffer(new WCHAR[totalStringLength + 2 * size]);
QScopedArrayPointer<COMDLG_FILTERSPEC> comFilterSpec(new COMDLG_FILTERSPEC[size]);
const QString matchesAll = QStringLiteral(" (*)");
WCHAR *ptr = buffer.data();
// Split filter specification as 'Texts (*.txt[;] *.doc)'
// into description and filters specification as '*.txt;*.doc'
for (int i = 0; i < size; ++i) {
// Display glitch (CLSID only): 'All files (*)' shows up as 'All files (*) (*)'
// Display glitch (CLSID only): Any filter not filtering on suffix (such as
// '*', 'a.*') will be duplicated in combo: 'All files (*) (*)',
// 'AAA files (a.*) (a.*)'
QString description = specs[i].description;
if (!m_hideFiltersDetails && description.endsWith(matchesAll))
description.truncate(description.size() - matchesAll.size());
const QString &filter = specs[i].filter;
if (!m_hideFiltersDetails && !filter.startsWith(QLatin1String("*."))) {
const int pos = description.lastIndexOf(QLatin1Char('('));
if (pos > 0)
description.truncate(pos);
}
// Add to buffer.
comFilterSpec[i].pszName = ptr;
ptr += description.toWCharArray(ptr);

View File

@ -470,9 +470,10 @@ void QPpdPrintDevice::loadPrinter()
m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance);
if (m_cupsDest) {
const char *ppdFile = cupsGetPPD(m_cupsName);
if (ppdFile)
if (ppdFile) {
m_ppd = ppdOpenFile(ppdFile);
unlink(ppdFile);
unlink(ppdFile);
}
if (m_ppd) {
ppdMarkDefaults(m_ppd);
} else {

View File

@ -493,7 +493,7 @@ void Generator::generateCode()
for (int i = 0; i < extraList.count(); ++i) {
fprintf(out, " &%s::staticMetaObject,\n", extraList.at(i).constData());
}
fprintf(out, " 0\n};\n\n");
fprintf(out, " Q_NULLPTR\n};\n\n");
}
//
@ -505,24 +505,24 @@ void Generator::generateCode()
fprintf(out, "const QMetaObject %s::staticMetaObject = {\n", cdef->qualified.constData());
if (isQObject)
fprintf(out, " { 0, ");
fprintf(out, " { Q_NULLPTR, ");
else if (cdef->superclassList.size())
fprintf(out, " { &%s::staticMetaObject, ", purestSuperClass.constData());
else
fprintf(out, " { 0, ");
fprintf(out, " { Q_NULLPTR, ");
fprintf(out, "qt_meta_stringdata_%s.data,\n"
" qt_meta_data_%s, ", qualifiedClassNameIdentifier.constData(),
qualifiedClassNameIdentifier.constData());
if (cdef->hasQObject && !isQt)
fprintf(out, " qt_static_metacall, ");
else
fprintf(out, " 0, ");
fprintf(out, " Q_NULLPTR, ");
if (extraList.isEmpty())
fprintf(out, "0, ");
fprintf(out, "Q_NULLPTR, ");
else
fprintf(out, "qt_meta_extradata_%s, ", qualifiedClassNameIdentifier.constData());
fprintf(out, "0}\n};\n\n");
fprintf(out, "Q_NULLPTR}\n};\n\n");
if(isQt)
return;
@ -537,7 +537,7 @@ void Generator::generateCode()
// Generate smart cast function
//
fprintf(out, "\nvoid *%s::qt_metacast(const char *_clname)\n{\n", cdef->qualified.constData());
fprintf(out, " if (!_clname) return 0;\n");
fprintf(out, " if (!_clname) return Q_NULLPTR;\n");
fprintf(out, " if (!strcmp(_clname, qt_meta_stringdata_%s.stringdata))\n"
" return static_cast<void*>(const_cast< %s*>(this));\n",
qualifiedClassNameIdentifier.constData(), cdef->classname.constData());
@ -562,7 +562,7 @@ void Generator::generateCode()
QByteArray superClass = purestSuperClass;
fprintf(out, " return %s::qt_metacast(_clname);\n", superClass.constData());
} else {
fprintf(out, " return 0;\n");
fprintf(out, " return Q_NULLPTR;\n");
}
fprintf(out, "}\n");
@ -1416,7 +1416,7 @@ void Generator::generateSignal(FunctionDef *def,int index)
fprintf(out, "QPrivateSignal");
fprintf(out, ")%s\n{\n"
" QMetaObject::activate(%s, &staticMetaObject, %d, 0);\n"
" QMetaObject::activate(%s, &staticMetaObject, %d, Q_NULLPTR);\n"
"}\n", constQualifier, thisPtr.constData(), index);
return;
}
@ -1446,7 +1446,7 @@ void Generator::generateSignal(FunctionDef *def,int index)
fprintf(out, " void *_a[] = { ");
if (def->normalizedType == "void") {
fprintf(out, "0");
fprintf(out, "Q_NULLPTR");
} else {
if (def->returnTypeIsVolatile)
fprintf(out, "const_cast<void*>(reinterpret_cast<const volatile void*>(&_t0))");

View File

@ -243,6 +243,8 @@ static QString generateInterfaceXml(const ClassDef *mo)
foreach (const FunctionDef &mm, mo->signalList) {
if (mm.wasCloned)
continue;
if (!mm.isScriptable && !(flags & QDBusConnection::ExportNonScriptableSignals))
continue;
retval += addFunction(mm, true);
}
@ -250,10 +252,14 @@ static QString generateInterfaceXml(const ClassDef *mo)
if (flags & (QDBusConnection::ExportScriptableSlots | QDBusConnection::ExportNonScriptableSlots)) {
foreach (const FunctionDef &slot, mo->slotList) {
if (!slot.isScriptable && !(flags & QDBusConnection::ExportNonScriptableSlots))
continue;
if (slot.access == FunctionDef::Public)
retval += addFunction(slot);
}
foreach (const FunctionDef &method, mo->methodList) {
if (!method.isScriptable && !(flags & QDBusConnection::ExportNonScriptableSlots))
continue;
if (method.access == FunctionDef::Public)
retval += addFunction(method);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -4301,8 +4301,6 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element)
return;
QString fileName = manifest +"-manifest.xml";
QFile file(outputDir() + QLatin1Char('/') + fileName);
if (!file.open(QFile::WriteOnly | QFile::Text))
return ;
bool demos = false;
if (manifest == "demos")
demos = true;
@ -4323,7 +4321,7 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element)
}
++i;
}
if (!proceed)
if (!proceed || !file.open(QFile::WriteOnly | QFile::Text))
return;
QXmlStreamWriter writer(&file);

View File

@ -1,21 +1,31 @@
----------------------------------------------------------------------------
--
-- Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-- Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-- Contact: http://www.qt-project.org/legal
--
-- This file is part of the QtQml module of the Qt Toolkit.
--
-- $QT_BEGIN_LICENSE:LGPL-ONLY$
-- 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.
-- $QT_BEGIN_LICENSE:LGPL21$
-- Commercial License Usage
-- Licensees holding valid commercial Qt licenses may use this file in
-- accordance with the commercial license agreement provided with the
-- Software or, alternatively, in accordance with the terms contained in
-- a written agreement between you and Digia. For licensing terms and
-- conditions see http://qt.digia.com/licensing. For further information
-- use the contact form at http://qt.digia.com/contact-us.
--
-- If you have questions regarding the use of this file, please contact
-- us via http://www.qt-project.org/.
-- 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 or version 3 as published by the Free
-- Software Foundation and appearing in the file LICENSE.LGPLv21 and
-- LICENSE.LGPLv3 included in the packaging of this file. Please review the
-- following information to ensure the GNU Lesser General Public License
-- requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-- http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
--
-- In addition, as a special exception, Digia gives you certain additional
-- rights. These rights are described in the Digia Qt LGPL Exception
-- version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
--
-- $QT_END_LICENSE$
--
@ -89,41 +99,33 @@
/./****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtQml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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.
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** rights. These rights are described in the Digia 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.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
@ -142,41 +144,33 @@
/:/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtQml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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.
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** rights. These rights are described in the Digia 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.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
@ -1090,6 +1084,31 @@ case $rule_number: {
} break;
./
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON UiQualifiedId UiObjectInitializer ;
/.
case $rule_number: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4));
node->isReadonlyMember = true;
node->readonlyToken = loc(1);
node->propertyToken = loc(2);
node->typeToken = loc(3);
node->identifierToken = loc(4);
node->semicolonToken = loc(5); // insert a fake ';' before ':'
AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(4));
propertyName->identifierToken = loc(4);
propertyName->next = 0;
AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding(
propertyName, sym(6).UiQualifiedId, sym(7).UiObjectInitializer);
binding->colonToken = loc(5);
node->binding = binding;
sym(1).Node = node;
} break;
./
UiObjectMember: FunctionDeclaration ;
/.
case $rule_number: {

File diff suppressed because it is too large Load Diff

View File

@ -161,15 +161,15 @@ public:
T_XOR = 79,
T_XOR_EQ = 80,
ACCEPT_STATE = 663,
RULE_COUNT = 357,
STATE_COUNT = 664,
ACCEPT_STATE = 665,
RULE_COUNT = 358,
STATE_COUNT = 666,
TERMINAL_COUNT = 106,
NON_TERMINAL_COUNT = 111,
GOTO_INDEX_OFFSET = 664,
GOTO_INFO_OFFSET = 3104,
GOTO_CHECK_OFFSET = 3104
GOTO_INDEX_OFFSET = 666,
GOTO_INFO_OFFSET = 3018,
GOTO_CHECK_OFFSET = 3018
};
static const char *const spell [];

File diff suppressed because it is too large Load Diff

View File

@ -240,9 +240,9 @@ protected:
#define J_SCRIPT_REGEXPLITERAL_RULE1 87
#define J_SCRIPT_REGEXPLITERAL_RULE1 88
#define J_SCRIPT_REGEXPLITERAL_RULE2 88
#define J_SCRIPT_REGEXPLITERAL_RULE2 89
QT_QML_END_NAMESPACE

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 892 B

View File

@ -893,6 +893,8 @@ bool RCCResourceLibrary::writeDataBlobs()
if (m_format == C_Code)
writeString("\n};\n\n");
else if (m_format == Pass1) {
if (offset < 8)
offset = 8;
writeString("\nstatic const unsigned char qt_resource_data[");
writeByteArray(QByteArray::number(offset));
writeString("] = { 'Q', 'R', 'C', '_', 'D', 'A', 'T', 'A' };\n\n");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -2571,6 +2571,14 @@ void QWizard::setWizardStyle(WizardStyle style)
d->disableUpdates();
d->wizStyle = style;
d->updateButtonTexts();
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
if (aeroStyleChange) {
//Send a resizeevent since the antiflicker widget probably needs a new size
//because of the backbutton in the window title
QResizeEvent ev(geometry().size(), geometry().size());
QApplication::sendEvent(this, &ev);
}
#endif
d->updateLayout();
updateGeometry();
d->enableUpdates();

View File

@ -1968,8 +1968,10 @@ QGraphicsItem::CacheMode QGraphicsItem::cacheMode() const
Caching can speed up rendering if your item spends a significant time
redrawing itself. In some cases the cache can also slow down rendering, in
particular when the item spends less time redrawing than QGraphicsItem
spends redrawing from the cache. When enabled, the item's paint() function
will be called only once for each call to update(); for any subsequent
spends redrawing from the cache.
When caching is enabled, an item's paint() function will generally draw into an
offscreen pixmap cache; for any subsequent
repaint requests, the Graphics View framework will redraw from the
cache. This approach works particularly well with QGLWidget, which stores
all the cache as OpenGL textures.
@ -1980,6 +1982,12 @@ QGraphicsItem::CacheMode QGraphicsItem::cacheMode() const
You can read more about the different cache modes in the CacheMode
documentation.
\note Enabling caching does not imply that the item's paint() function will be
called only in response to an explicit update() call. For instance, under
memory pressure, Qt may decide to drop some of the cache information;
in such cases an item's paint() function will be called even if there
was no update() call (that is, exactly as if there were no caching enabled).
\sa CacheMode, QPixmapCache::setCacheLimit()
*/
void QGraphicsItem::setCacheMode(CacheMode mode, const QSize &logicalCacheSize)
@ -5337,6 +5345,16 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity)
All painting is done in local coordinates.
\note It is mandatory that an item will always redraw itself in the exact
same way, unless update() was called; otherwise visual artifacts may
occur. In other words, two subsequent calls to paint() must always produce
the same output, unless update() was called between them.
\note Enabling caching for an item does not guarantee that paint()
will be invoked only once by the Graphics View framework,
even without any explicit call to update(). See the documentation of
setCacheMode() for more details.
\sa setCacheMode(), QPen::width(), {Item Coordinates}, ItemUsesExtendedStyleOption
*/

View File

@ -7155,10 +7155,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
}
}
// generate a move event for QWidgets without window handles. QWidgets with native
// window handles already receive a move event from
// QGuiApplicationPrivate::processGeometryChangeEvent.
if (isMove && (!q->windowHandle() || q->testAttribute(Qt::WA_DontShowOnScreen))) {
if (isMove) {
QMoveEvent e(q->pos(), oldPos);
QApplication::sendEvent(q, &e);
}

View File

@ -543,14 +543,36 @@ void QWidgetWindow::handleKeyEvent(QKeyEvent *event)
QGuiApplication::sendSpontaneousEvent(receiver, event);
}
void QWidgetWindow::updateGeometry()
bool QWidgetWindow::updateSize()
{
bool changed = false;
if (m_widget->testAttribute(Qt::WA_OutsideWSRange))
return;
return changed;
if (m_widget->data->crect.size() != geometry().size()) {
changed = true;
m_widget->data->crect.setSize(geometry().size());
}
updateMargins();
return changed;
}
bool QWidgetWindow::updatePos()
{
bool changed = false;
if (m_widget->testAttribute(Qt::WA_OutsideWSRange))
return changed;
if (m_widget->data->crect.topLeft() != geometry().topLeft()) {
changed = true;
m_widget->data->crect.moveTopLeft(geometry().topLeft());
}
updateMargins();
return changed;
}
void QWidgetWindow::updateMargins()
{
const QMargins margins = frameMargins();
m_widget->data->crect = geometry();
QTLWExtra *te = m_widget->d_func()->topData();
te->posIncludesFrame= false;
te->frameStrut.setCoords(margins.left(), margins.top(), margins.right(), margins.bottom());
@ -609,24 +631,25 @@ void QWidgetWindow::updateNormalGeometry()
void QWidgetWindow::handleMoveEvent(QMoveEvent *event)
{
updateGeometry();
QGuiApplication::sendSpontaneousEvent(m_widget, event);
if (updatePos())
QGuiApplication::sendSpontaneousEvent(m_widget, event);
}
void QWidgetWindow::handleResizeEvent(QResizeEvent *event)
{
QSize oldSize = m_widget->data->crect.size();
updateGeometry();
QGuiApplication::sendSpontaneousEvent(m_widget, event);
if (updateSize()) {
QGuiApplication::sendSpontaneousEvent(m_widget, event);
if (m_widget->d_func()->paintOnScreen()) {
QRegion updateRegion(geometry());
if (m_widget->testAttribute(Qt::WA_StaticContents))
updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height());
m_widget->d_func()->syncBackingStore(updateRegion);
} else {
m_widget->d_func()->syncBackingStore();
if (m_widget->d_func()->paintOnScreen()) {
QRegion updateRegion(geometry());
if (m_widget->testAttribute(Qt::WA_StaticContents))
updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height());
m_widget->d_func()->syncBackingStore(updateRegion);
} else {
m_widget->d_func()->syncBackingStore();
}
}
}

View File

@ -108,7 +108,9 @@ private slots:
private:
void repaintWindow();
void updateGeometry();
bool updateSize();
bool updatePos();
void updateMargins();
void updateNormalGeometry();
enum FocusWidgets {

View File

@ -1114,7 +1114,7 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTabV3 *opt, const QWidget
(opt->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled,
(opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off );
// High-dpi icons do not need adjustmet; make sure tabIconSize is not larger than iconSize
tabIconSize = QSize(qMin(tabIconSize.width(), iconSize.width()), qMin(tabIconSize.height(), iconSize.width()));
tabIconSize = QSize(qMin(tabIconSize.width(), iconSize.width()), qMin(tabIconSize.height(), iconSize.height()));
*iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2,
tabIconSize.width(), tabIconSize .height());

View File

@ -1473,7 +1473,11 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
break;
}
#endif // QT_NO_ITEMVIEWS
#ifndef QT_NO_COMBOBOX
case CE_ComboBoxLabel:
QCommonStyle::drawControl(element, option, painter, widget);
break;
#endif // QT_NO_COMBOBOX
default:
QWindowsXPStyle::drawControl(element, option, painter, widget);
break;

View File

@ -68,7 +68,7 @@
QT_BEGIN_NAMESPACE
#ifndef QT_NO_DOCKWIDGET
#ifdef QT_NO_DOCKWIDGET
extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
#endif

View File

@ -3055,8 +3055,10 @@ void QMenu::actionEvent(QActionEvent *e)
delete menuItem;
} else if (e->type() == QEvent::ActionChanged) {
QPlatformMenuItem *menuItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->action()));
copyActionToPlatformItem(e->action(), menuItem);
d->platformMenu->syncMenuItem(menuItem);
if (menuItem) {
copyActionToPlatformItem(e->action(), menuItem);
d->platformMenu->syncMenuItem(menuItem);
}
}
d->platformMenu->syncSeparatorsCollapsible(d->collapsibleSeparators);

View File

@ -1564,7 +1564,7 @@ public slots:
void doAnotherThing(bool a = (1 < 3), bool b = (1 > 4)) { Q_UNUSED(a); Q_UNUSED(b); }
#if defined(Q_MOC_RUN) || (defined(Q_COMPILER_AUTO_TYPE) && !(defined(Q_CC_CLANG) && (__clang_major__ * 100) + __clang_minor__) < 304)
#if defined(Q_MOC_RUN) || (defined(Q_COMPILER_AUTO_TYPE) && !(defined(Q_CC_CLANG) && Q_CC_CLANG < 304))
// There is no Q_COMPILER_>> but if compiler support auto, it should also support >>
void performSomething(QVector<QList<QString>> e = QVector<QList<QString>>(8 < 1),
QHash<int, QVector<QString>> h = QHash<int, QVector<QString>>())

View File

@ -95,6 +95,8 @@ private slots:
void tst_updateWinId_QTBUG40681();
void tst_recreateWindow_QTBUG40817();
void tst_resize_count();
void tst_move_count();
};
void tst_QWidget_window::initTestCase()
@ -660,6 +662,105 @@ void tst_QWidget_window::tst_recreateWindow_QTBUG40817()
tab.setCurrentIndex(1);
}
class ResizeWidget : public QWidget
{
Q_OBJECT
public:
ResizeWidget(QWidget *parent = 0)
: QWidget(parent)
, resizeCount(0)
{ }
int resizeCount;
protected:
void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
{
resizeCount++;
}
};
void tst_QWidget_window::tst_resize_count()
{
{
ResizeWidget resize;
resize.show();
QVERIFY(QTest::qWaitForWindowExposed(&resize));
QCOMPARE(resize.resizeCount, 1);
resize.resizeCount = 0;
QSize size = resize.size();
size.rwidth() += 10;
resize.resize(size);
QGuiApplication::sync();
QTRY_COMPARE(resize.resizeCount, 1);
resize.resizeCount = 0;
ResizeWidget child(&resize);
child.resize(200,200);
child.winId();
child.show();
QVERIFY(QTest::qWaitForWindowExposed(&child));
QGuiApplication::sync();
QTRY_COMPARE(child.resizeCount, 1);
child.resizeCount = 0;
size = child.size();
size.rwidth() += 10;
child.resize(size);
QGuiApplication::sync();
QCOMPARE(resize.resizeCount, 0);
QCOMPARE(child.resizeCount, 1);
}
{
ResizeWidget parent;
ResizeWidget child(&parent);
child.resize(200,200);
child.winId();
parent.show();
QVERIFY(QTest::qWaitForWindowExposed(&parent));
parent.resizeCount = 0;
QGuiApplication::sync();
QTRY_COMPARE(child.resizeCount, 1);
child.resizeCount = 0;
QSize size = child.size();
size.rwidth() += 10;
child.resize(size);
QGuiApplication::sync();
QCOMPARE(parent.resizeCount, 0);
QCOMPARE(child.resizeCount, 1);
}
}
class MoveWidget : public QWidget
{
Q_OBJECT
public:
MoveWidget(QWidget *parent = 0)
: QWidget(parent)
, moveCount(0)
{ }
void moveEvent(QMoveEvent *) Q_DECL_OVERRIDE
{
moveCount++;
}
int moveCount;
};
void tst_QWidget_window::tst_move_count()
{
MoveWidget move;
move.move(500,500);
move.show();
QVERIFY(QTest::qWaitForWindowExposed(&move));
QTRY_VERIFY(move.moveCount >= 1);
move.moveCount = 0;
move.move(220,250);
QTRY_VERIFY(move.moveCount >= 1);
}
QTEST_MAIN(tst_QWidget_window)
#include "tst_qwidget_window.moc"