Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: src/corelib/global/global.pri src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.h src/corelib/tools/qdatetime.cpp src/plugins/platforms/xcb/qxcbscreen.h src/plugins/platforms/xcb/qxcbwindow.h src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qcolordialog_p.h tools/configure/configureapp.cpp Change-Id: Ie9d6e9df13e570da0a90a67745a0d05f46c532af
This commit is contained in:
commit
b6191b16d4
44
configure
vendored
44
configure
vendored
@ -660,7 +660,7 @@ CFG_TSLIB=auto
|
||||
CFG_NIS=auto
|
||||
CFG_CUPS=auto
|
||||
CFG_ICONV=auto
|
||||
CFG_DBUS=auto
|
||||
CFG_DBUS=runtime
|
||||
CFG_GLIB=auto
|
||||
CFG_QGTKSTYLE=auto
|
||||
CFG_LARGEFILE=auto
|
||||
@ -1913,10 +1913,10 @@ while [ "$#" -gt 0 ]; do
|
||||
fi
|
||||
;;
|
||||
dbus)
|
||||
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then
|
||||
if [ "$VAL" = "no" ] || [ "$VAL" = "linked" ] || [ "$VAL" = "runtime" ]; then
|
||||
CFG_DBUS="$VAL"
|
||||
elif [ "$VAL" = "runtime" ]; then
|
||||
CFG_DBUS="yes"
|
||||
elif [ "$VAL" = "yes" ]; then
|
||||
CFG_DBUS="runtime"
|
||||
else
|
||||
UNKNOWN_OPT=yes
|
||||
fi
|
||||
@ -3978,13 +3978,16 @@ fi
|
||||
if [ -z "$PKG_CONFIG" ]; then
|
||||
# See if PKG_CONFIG is set in the mkspec:
|
||||
PKG_CONFIG="`"$outpath/bin/qmake" -E -nocache -spec "$XQMAKESPEC" "CONFIG=" $DEV_NULL 2>&1 | sed -n -e 's,^PKG_CONFIG = \(.*\),\1,p'`"
|
||||
[ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from mkspec: $PKG_CONFIG"
|
||||
fi
|
||||
if [ -z "$PKG_CONFIG" ]; then
|
||||
PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
|
||||
[ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from \$PATH: $PKG_CONFIG"
|
||||
fi
|
||||
|
||||
if [ "$CFG_PKGCONFIG" = "no" ]; then
|
||||
PKG_CONFIG=
|
||||
[ "$OPT_VERBOSE" = "yes" ] && echo "pkg-config support disabled."
|
||||
elif [ "$CFG_PKGCONFIG" = "force" ]; then
|
||||
echo >&2 ""
|
||||
echo >&2 "You have asked to use pkg-config. Please make sure you have"
|
||||
@ -4049,7 +4052,13 @@ compileTest()
|
||||
path=config.tests/$1
|
||||
name=$2
|
||||
shift 2
|
||||
"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@"
|
||||
# allow config tests which behave differently depending on the type of
|
||||
# library being built (shared/static) e.g. see config.tests/unix/icu
|
||||
test_config="$QMAKE_CONFIG shared"
|
||||
if [ "$CFG_SHARED" = "no" ]; then
|
||||
test_config="$QMAKE_CONFIG static"
|
||||
fi
|
||||
"$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@"
|
||||
}
|
||||
|
||||
compileTestWithPkgConfig()
|
||||
@ -4779,7 +4788,7 @@ if [ "$CFG_ICONV" != "no" ]; then
|
||||
fi
|
||||
|
||||
# auto-detect libdbus-1 support
|
||||
if [ "$CFG_DBUS" != "no" ]; then
|
||||
if [ "$CFG_DBUS" = "linked" ]; then
|
||||
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
|
||||
QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
|
||||
QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
|
||||
@ -4787,7 +4796,6 @@ if [ "$CFG_DBUS" != "no" ]; then
|
||||
QT_LIBS_DBUS="-ldbus-1"
|
||||
fi
|
||||
if compileTest unix/dbus "D-Bus" $QT_CFLAGS_DBUS $QT_LIBS_DBUS; then
|
||||
[ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
|
||||
QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
|
||||
QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
|
||||
# Try find correct host configuration for dbus tools when cross-compiling
|
||||
@ -4797,12 +4805,9 @@ if [ "$CFG_DBUS" != "no" ]; then
|
||||
fi
|
||||
QMakeVar set QT_HOST_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
|
||||
else
|
||||
if [ "$CFG_DBUS" != "linked" ]; then
|
||||
CFG_DBUS=runtime
|
||||
elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
|
||||
# CFG_DBUS is "yes" or "linked" here
|
||||
|
||||
if [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
|
||||
echo "The Qt D-Bus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
|
||||
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
|
||||
echo " Turn on verbose messaging (-v) to $0 to see the final report."
|
||||
echo " If you believe this message is in error you may use the continue"
|
||||
echo " switch (-continue) to $0 to continue."
|
||||
@ -4824,6 +4829,7 @@ if [ "$CFG_GLIB" != "no" ]; then
|
||||
else
|
||||
if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
|
||||
echo "Glib support cannot be enabled due to functionality tests!"
|
||||
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
|
||||
echo " Turn on verbose messaging (-v) to $0 to see the final report."
|
||||
echo " If you believe this message is in error you may use the continue"
|
||||
echo " switch (-continue) to $0 to continue."
|
||||
@ -4851,6 +4857,7 @@ if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
|
||||
else
|
||||
if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
|
||||
echo "GTK theme support cannot be enabled due to functionality tests!"
|
||||
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
|
||||
echo " Turn on verbose messaging (-v) to $0 to see the fin al report."
|
||||
echo " If you believe this message is in error you may use the continue"
|
||||
echo " switch (-continue) to $0 to continue."
|
||||
@ -4895,6 +4902,7 @@ if [ "$CFG_PULSEAUDIO" != "no" ]; then
|
||||
else
|
||||
if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
|
||||
echo "PulseAudio support cannot be enabled due to functionality tests!"
|
||||
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
|
||||
echo " Turn on verbose messaging (-v) to $0 to see the final report."
|
||||
echo " If you believe this message is in error you may use the continue"
|
||||
echo " switch (-continue) to $0 to continue."
|
||||
@ -5012,6 +5020,7 @@ elif [ "$CFG_OPENGL" = "es2" ]; then
|
||||
compileTestWithPkgConfig glesv2 unix/opengles2 "OpenGL ES 2.0" OPENGL_ES2
|
||||
if [ $? != "0" ]; then
|
||||
echo "The OpenGL ES 2.0 functionality test failed!"
|
||||
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
|
||||
echo " You might need to modify the include and library search paths by editing"
|
||||
echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
|
||||
echo " ${XQMAKESPEC}."
|
||||
@ -5085,6 +5094,7 @@ if [ "$CFG_LIBUDEV" != "no" ]; then
|
||||
QT_CONFIG="$QT_CONFIG libudev"
|
||||
elif [ "$CFG_LIBUDEV" = "yes" ]; then
|
||||
echo "The libudev functionality test failed!"
|
||||
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
|
||||
exit 1
|
||||
else
|
||||
CFG_LIBUDEV=no
|
||||
@ -5280,6 +5290,7 @@ if [ "$CFG_XCB" != "no" ]; then
|
||||
else
|
||||
if [ "$CFG_XCB" != "auto" ]; then
|
||||
echo "The test for linking against libxcb failed!"
|
||||
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
|
||||
echo " You might need to install dependency packages for libxcb."
|
||||
echo " See src/plugins/platforms/xcb/README."
|
||||
exit 1
|
||||
@ -5296,6 +5307,7 @@ if [ "$CFG_DIRECTFB" != "no" ]; then
|
||||
CFG_DIRECTFB=yes
|
||||
elif [ "$CFG_DIRECTFB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
|
||||
echo " DirectFB support cannot be enabled due to functionality tests!"
|
||||
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
|
||||
echo " Turn on verbose messaging (-v) to $0 to see the final report."
|
||||
echo " If you believe this message is in error you may use the continue"
|
||||
echo " switch (-continue) to $0 to continue."
|
||||
@ -5352,6 +5364,7 @@ if [ "$CFG_XCB" != "no" ]; then
|
||||
elif [ "$CFG_XKBCOMMON" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
|
||||
echo " xkbcommon support cannot be enabled because either xkbcommon or "
|
||||
echo " xkbcommon-x11 >= $MIN_REQ_XKBCOMMON was not found via pkg-config!"
|
||||
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
|
||||
echo " Turn on verbose messaging (-v) to $0 to see the final report."
|
||||
echo " If you believe this message is in error you may use the continue"
|
||||
echo " switch (-continue) to $0 to continue."
|
||||
@ -5412,6 +5425,7 @@ if [ "$CFG_EGL" != "no" ]; then
|
||||
fi
|
||||
elif [ "$CFG_EGL" = "yes" ]; then
|
||||
echo " The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces."
|
||||
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?"
|
||||
echo " You might need to modify the include and library search paths by editing"
|
||||
echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in ${XQMAKESPEC}."
|
||||
exit 1
|
||||
@ -5962,8 +5976,8 @@ fi
|
||||
[ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
|
||||
[ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
|
||||
[ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
|
||||
[ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
|
||||
[ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
|
||||
[ "$CFG_DBUS" != "no" ] && QT_CONFIG="$QT_CONFIG dbus"
|
||||
[ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus-linked"
|
||||
[ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
|
||||
[ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
|
||||
[ "$CFG_XCB" != "no" ] && QT_CONFIG="$QT_CONFIG xcb"
|
||||
@ -6764,7 +6778,7 @@ fi
|
||||
# Qt modules
|
||||
echo
|
||||
echo "Qt modules and options:"
|
||||
report_support " Qt D-Bus ..............." "$CFG_DBUS" yes "loading dbus-1 at runtime" linked "linked to dbus-1"
|
||||
report_support " Qt D-Bus ..............." "$CFG_DBUS" runtime "loading dbus-1 at runtime" linked "linked to dbus-1"
|
||||
report_support " Qt Concurrent .........." "$CFG_CONCURRENT"
|
||||
report_support " Qt GUI ................." "$CFG_GUI"
|
||||
report_support " Qt Widgets ............." "$CFG_WIDGETS"
|
||||
|
@ -1,95 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** 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 Free Documentation License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of
|
||||
** this file. Please review the following information to ensure
|
||||
** the GNU Free Documentation License version 1.3 requirements
|
||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\externalpage http://doc.qt.digia.com/qtcreator/creator-qml-application.html
|
||||
\title external: Developing Qt Quick Applications with Creator
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.digia.com/qtcreator/creator-visual-editor.html
|
||||
\title external: Developing Qt Quick Applications
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.digia.com/qtcreator/creator-publish-ovi.html
|
||||
\title external: Publishing Applications to Ovi Store
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator
|
||||
\title external: Qt Creator Manual
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.digia.com/qtmobility/index.html
|
||||
\title external: Qt Mobility Manual
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.digia.com/qtmobility/qml-plugins.html
|
||||
\title external: Qt Mobility QML Plugins
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-project-managing.html
|
||||
\title external: Creating Qt Projects in Creator
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-building-running.html
|
||||
\title external: Building and Running Applications in Creator
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-running-targets.html
|
||||
\title external: Set Compiler Targets in Creator
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-build-settings.html
|
||||
\title external: Build Settings in Creator
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-run-settings.html
|
||||
\title external: Run Settings in Creator
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-using-qt-designer.html
|
||||
\title external: Designer in Creator
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-debugging.html
|
||||
\title external: Debugging Applications in Creator
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.digia.com/qtmobility/multimedia.html
|
||||
\title external: Mobility Multimedia
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.digia.com/qtmobility/location-overview.html
|
||||
\title external: Mobility Location
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.digia.com/qtmobility/all-examples.html
|
||||
\title external: Qt Mobility Examples
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-overview.html
|
||||
\title external: Qt Creator Overview
|
||||
*/
|
@ -391,6 +391,14 @@
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-project-wizards.html
|
||||
\title Qt Creator: Adding New Custom Wizards
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-project-wizards-json.html
|
||||
\title Qt Creator: Adding JSON-Based Wizards
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-project-wizards-xml.html
|
||||
\title Qt Creator: Adding XML-Based Wizards
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://doc.qt.io/qtcreator/creator-projects-autotools.html
|
||||
\title Qt Creator: Setting Up an Autotools Project
|
||||
|
@ -136,7 +136,7 @@
|
||||
byte in the buffer, \c numUsedBytes is \c BufferSize - 1 and the
|
||||
\c bufferNotEmpty condition is signalled. At that point, two
|
||||
things can happen: Either the consumer thread takes over and
|
||||
reads that byte, or the consumer gets to produce a second byte.
|
||||
reads that byte, or the producer gets to produce a second byte.
|
||||
|
||||
The producer-consumer model presented in this example makes it
|
||||
possible to write highly concurrent multithreaded applications.
|
||||
|
@ -14,8 +14,6 @@ QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -gdwarf-2
|
||||
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -gdwarf-2
|
||||
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += -g -gdwarf-2
|
||||
|
||||
QMAKE_LFLAGS_STATIC_LIB += -all_load
|
||||
|
||||
QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvmgcc42
|
||||
|
||||
QMAKE_OBJCFLAGS_PRECOMPILE = -x objective-c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
|
||||
|
@ -179,7 +179,7 @@ CMAKE_MODULE_DEPS = $$cmakeModuleList($$sort_depends(QT.$${MODULE}.depends, QT.)
|
||||
CMAKE_PARTIAL_MODULE_DEPS = $$replace(CMAKE_MODULE_DEPS, ";", ";Qt5::")
|
||||
!isEmpty(CMAKE_PARTIAL_MODULE_DEPS):CMAKE_QT5_MODULE_DEPS = "Qt5::$${CMAKE_PARTIAL_MODULE_DEPS}"
|
||||
|
||||
CMAKE_QT_STEM = Qt$$eval(QT.$${MODULE}.MAJOR_VERSION)$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}
|
||||
CMAKE_QT_STEM = Qt$$QT_MAJOR_VERSION$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}
|
||||
|
||||
mac {
|
||||
!isEmpty(CMAKE_STATIC_TYPE) {
|
||||
|
@ -15,5 +15,6 @@ build_pass {
|
||||
QMAKE_DISTCLEAN += $$WINDEPLOYQT_OUTPUT
|
||||
} else {
|
||||
windeployqt.CONFIG += recursive
|
||||
windeployqt_clean.CONFIG += recursive
|
||||
}
|
||||
QMAKE_EXTRA_TARGETS += windeployqt
|
||||
QMAKE_EXTRA_TARGETS += windeployqt windeployqt_clean
|
||||
|
@ -17,6 +17,7 @@ QMAKE_LFLAGS_THREAD = -pthread
|
||||
|
||||
QMAKE_LIBS =
|
||||
QMAKE_LIBS_DYNLOAD =
|
||||
QMAKE_LIBS_EXECINFO = -lexecinfo
|
||||
QMAKE_LIBS_X11 = -lXext -lX11 -lm
|
||||
QMAKE_LIBS_OPENGL = -lGL
|
||||
QMAKE_LIBS_THREAD =
|
||||
|
@ -17,6 +17,7 @@ QMAKE_LFLAGS_THREAD = -pthread
|
||||
|
||||
QMAKE_LIBS =
|
||||
QMAKE_LIBS_DYNLOAD =
|
||||
QMAKE_LIBS_EXECINFO = -lexecinfo
|
||||
QMAKE_LIBS_X11 = -lXext -lX11 -lm
|
||||
QMAKE_LIBS_OPENGL = -lGL
|
||||
QMAKE_LIBS_THREAD =
|
||||
|
@ -174,6 +174,21 @@ macx-xcode {
|
||||
ios_device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY
|
||||
QMAKE_MAC_XCODE_SETTINGS += ios_device_family
|
||||
|
||||
# If QMAKE_BUNDLE_DATA contains an asset catalog that includes an
|
||||
# AppIcon.appiconset, we configure Xcode to use it for app icons.
|
||||
for(bundle_data, QMAKE_BUNDLE_DATA) {
|
||||
for(bundle_file, $${bundle_data}.files) {
|
||||
!contains(bundle_file, .*\.xcassets$): next()
|
||||
!exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next()
|
||||
|
||||
asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME"
|
||||
asset_catalog_appicon.value = "AppIcon"
|
||||
QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon
|
||||
break()
|
||||
}
|
||||
!isEmpty(asset_catalog_appicon.name): break()
|
||||
}
|
||||
|
||||
# Set up default 4-inch iPhone/iPod launch image so that our apps
|
||||
# support the full screen resolution of those devices.
|
||||
launch_image = Default-568h@2x.png
|
||||
|
@ -7,7 +7,7 @@ CONFIG += app_bundle reduce_exports incremental global_init_link
|
||||
QMAKE_INCREMENTAL_STYLE = sublib
|
||||
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET =
|
||||
QMAKE_IOS_DEPLOYMENT_TARGET = 5.0
|
||||
QMAKE_IOS_DEPLOYMENT_TARGET = 5.1.1
|
||||
|
||||
INCLUDEPATH += $$PWD/ios
|
||||
DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG
|
||||
|
@ -18,6 +18,7 @@ QMAKE_LFLAGS_THREAD = -pthread
|
||||
|
||||
QMAKE_LIBS =
|
||||
QMAKE_LIBS_DYNLOAD =
|
||||
QMAKE_LIBS_EXECINFO = -lexecinfo
|
||||
QMAKE_LIBS_X11 = -lXext -lX11 -lm
|
||||
QMAKE_LIBS_OPENGL = -lGL
|
||||
QMAKE_LIBS_THREAD =
|
||||
|
@ -40,7 +40,7 @@ CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \
|
||||
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \
|
||||
-DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \
|
||||
-DUNICODE -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS
|
||||
CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) $(EXTRA_CPPFLAGS)
|
||||
CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS)
|
||||
|
||||
CXXFLAGS_BARE = $(CFLAGS_BARE)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
@ -122,10 +122,10 @@
|
||||
configuration options to fine tune the build process. For more information,
|
||||
see \l{Building Common Project Types}.
|
||||
|
||||
You can use the \l{external: Qt Creator Manual}{Qt Creator} new project
|
||||
wizard to create the project file. You choose the project template, and Qt
|
||||
Creator creates a project file with default values that enable you to build
|
||||
and run the project. You can modify the project file to suit your purposes.
|
||||
You can use the \l{Qt Creator: Creating Projects}{Qt Creator new project wizard} to create the project file.
|
||||
You choose the project template, and Qt Creator creates a project file with
|
||||
default values that enable you to build and run the project. You can modify
|
||||
the project file to suit your purposes.
|
||||
|
||||
You can also use qmake to generate project files. For a full description of
|
||||
qmake command line options, see \l{Running qmake}.
|
||||
@ -1464,6 +1464,15 @@
|
||||
executable needs to be specified as long as it is on a path contained
|
||||
in the \c PATH variable when the Makefile is processed.
|
||||
|
||||
\section1 QMAKE_CFLAGS
|
||||
|
||||
Specifies the C compiler flags for building
|
||||
a project. The value of this variable is typically handled by
|
||||
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
|
||||
needs to be modified. The flags specific to debug and release modes can be
|
||||
adjusted by modifying the \c QMAKE_CFLAGS_DEBUG and
|
||||
\c QMAKE_CFLAGS_RELEASE variables, respectively.
|
||||
|
||||
\target QMAKE_CFLAGS_DEBUG
|
||||
\section1 QMAKE_CFLAGS_DEBUG
|
||||
|
||||
|
@ -739,13 +739,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
mkt << "DEFINES = "
|
||||
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
|
||||
<< varGlue("DEFINES","-D"," -D","") << endl;
|
||||
mkt << "INCPATH = -I" << specdir();
|
||||
if(!project->isActiveConfig("no_include_pwd")) {
|
||||
QString pwd = escapeFilePath(fileFixify(qmake_getpwd()));
|
||||
if(pwd.isEmpty())
|
||||
pwd = ".";
|
||||
mkt << " -I" << pwd;
|
||||
}
|
||||
mkt << "INCPATH =";
|
||||
{
|
||||
const ProStringList &incs = project->values("INCLUDEPATH");
|
||||
for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit)
|
||||
@ -1497,7 +1491,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
t << "\t\t\t\t" << writeSettings("GCC_PRECOMPILE_PREFIX_HEADER", "YES") << ";\n"
|
||||
<< "\t\t\t\t" << writeSettings("GCC_PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) << ";\n";
|
||||
}
|
||||
t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH") + ProStringList(fixForOutput(specdir())), SettingsAsList, 5) << ";\n"
|
||||
t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH"), SettingsAsList, 5) << ";\n"
|
||||
<< "\t\t\t\t" << writeSettings("LIBRARY_SEARCH_PATHS", fixListForOutput("QMAKE_PBX_LIBPATHS"), SettingsAsList, 5) << ";\n"
|
||||
<< "\t\t\t\t" << writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"),
|
||||
!project->values("QMAKE_FRAMEWORKPATH").isEmpty() ? SettingsAsList : 0, 5) << ";\n";
|
||||
|
@ -444,6 +444,25 @@ MakefileGenerator::init()
|
||||
|
||||
setSystemIncludes(v["QMAKE_DEFAULT_INCDIRS"]);
|
||||
|
||||
ProStringList &incs = project->values("INCLUDEPATH");
|
||||
if (!project->isActiveConfig("no_include_pwd")) {
|
||||
if (Option::output_dir != qmake_getpwd()) {
|
||||
// Pretend that the build dir is the source dir for #include purposes,
|
||||
// consistently with the "transparent shadow builds" strategy. This is
|
||||
// also consistent with #include "foo.h" falling back to #include <foo.h>
|
||||
// behavior if it doesn't find the file in the source dir.
|
||||
incs.prepend(Option::output_dir);
|
||||
}
|
||||
// This makes #include <foo.h> work if the header lives in the source dir.
|
||||
// The benefit of that is questionable, as generally the user should use the
|
||||
// correct include style, and extra compilers that put stuff in the source dir
|
||||
// should add the dir themselves.
|
||||
// More importantly, it makes #include "foo.h" work with MSVC when shadow-building,
|
||||
// as this compiler looks files up relative to %CD%, not the source file's parent.
|
||||
incs.prepend(qmake_getpwd());
|
||||
}
|
||||
incs.append(project->specDir());
|
||||
|
||||
const char * const cacheKeys[] = { "_QMAKE_STASH_", "_QMAKE_SUPER_CACHE_", 0 };
|
||||
for (int i = 0; cacheKeys[i]; ++i) {
|
||||
if (v[cacheKeys[i]].isEmpty())
|
||||
@ -793,12 +812,6 @@ MakefileGenerator::init()
|
||||
ProStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"];
|
||||
if(project->isActiveConfig("depend_includepath"))
|
||||
incDirs += v["INCLUDEPATH"];
|
||||
if(!project->isActiveConfig("no_include_pwd")) {
|
||||
QString pwd = qmake_getpwd();
|
||||
if(pwd.isEmpty())
|
||||
pwd = ".";
|
||||
incDirs += pwd;
|
||||
}
|
||||
QList<QMakeLocalFileName> deplist;
|
||||
for (ProStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it)
|
||||
deplist.append(QMakeLocalFileName(unescapeFilePath((*it).toQString())));
|
||||
@ -850,11 +863,6 @@ MakefileGenerator::init()
|
||||
(*it) = Option::fixPathToLocalOS((*it).toQString());
|
||||
}
|
||||
|
||||
if(!project->isActiveConfig("no_include_pwd")) { //get the output_dir into the pwd
|
||||
if(Option::output_dir != qmake_getpwd())
|
||||
project->values("INCLUDEPATH").append(".");
|
||||
}
|
||||
|
||||
//fix up the target deps
|
||||
static const char * const fixpaths[] = { "PRE_TARGETDEPS", "POST_TARGETDEPS", 0 };
|
||||
for (int path = 0; fixpaths[path]; path++) {
|
||||
|
@ -184,13 +184,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
<< varGlue("DEFINES","-D"," -D","") << endl;
|
||||
t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n";
|
||||
t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n";
|
||||
t << "INCPATH = -I" << specdir();
|
||||
if(!project->isActiveConfig("no_include_pwd")) {
|
||||
QString pwd = escapeFilePath(fileFixify(qmake_getpwd()));
|
||||
if(pwd.isEmpty())
|
||||
pwd = ".";
|
||||
t << " -I" << pwd;
|
||||
}
|
||||
t << "INCPATH =";
|
||||
{
|
||||
QString isystem = var("QMAKE_CFLAGS_ISYSTEM");
|
||||
const ProStringList &incs = project->values("INCLUDEPATH");
|
||||
@ -1019,8 +1013,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
t << "\t-$(DEL_FILE) -r " << bundlePath << endl;
|
||||
} else if(project->isActiveConfig("compile_libtool")) {
|
||||
t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) $(TARGET)\n";
|
||||
} else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty() &&
|
||||
!project->isActiveConfig("plugin")) {
|
||||
} else if (project->isActiveConfig("staticlib")) {
|
||||
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n";
|
||||
} else if (project->values("QMAKE_APP_FLAG").isEmpty() && !project->isActiveConfig("plugin")) {
|
||||
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n";
|
||||
if (!project->isActiveConfig("unversioned_libname")) {
|
||||
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) "
|
||||
@ -1029,7 +1024,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
t << "\t-$(DEL_FILE) $(TARGETA)\n";
|
||||
}
|
||||
} else {
|
||||
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n";
|
||||
t << "\t-$(DEL_FILE) $(TARGET) \n";
|
||||
}
|
||||
t << varGlue("QMAKE_DISTCLEAN","\t-$(DEL_FILE) "," ","\n");
|
||||
{
|
||||
|
@ -311,13 +311,6 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t)
|
||||
{
|
||||
t << "INCPATH = ";
|
||||
|
||||
if (!project->isActiveConfig("no_include_pwd")) {
|
||||
QString pwd = escapeFilePath(fileFixify(qmake_getpwd()));
|
||||
if (pwd.isEmpty())
|
||||
pwd = ".";
|
||||
t << "-I" << pwd << " ";
|
||||
}
|
||||
|
||||
QString isystem = var("QMAKE_CFLAGS_ISYSTEM");
|
||||
const ProStringList &incs = project->values("INCLUDEPATH");
|
||||
for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) {
|
||||
@ -331,8 +324,7 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t)
|
||||
t << "-I";
|
||||
t << quote << inc << quote << " ";
|
||||
}
|
||||
t << "-I" << quote << specdir() << quote
|
||||
<< endl;
|
||||
t << endl;
|
||||
}
|
||||
|
||||
void MingwMakefileGenerator::writeLibsPart(QTextStream &t)
|
||||
|
@ -1620,7 +1620,6 @@ void VcprojGenerator::initOld()
|
||||
inc = QString("\"%1\"").arg(inc); // Quote all paths if not quoted already
|
||||
project->values("MSVCPROJ_INCPATH").append("-I" + inc);
|
||||
}
|
||||
project->values("MSVCPROJ_INCPATH").append("-I" + specdir());
|
||||
|
||||
QString dest = Option::fixPathToTargetOS(project->first("TARGET").toQString()) + project->first("TARGET_EXT");
|
||||
project->values("MSVCPROJ_TARGET") = ProStringList(dest);
|
||||
|
@ -546,12 +546,13 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
|
||||
const QString del_statement("-$(DEL_FILE)");
|
||||
if(project->isActiveConfig("no_delete_multiple_files")) {
|
||||
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
|
||||
t << "\n\t" << del_statement << " " << escapeFilePath((*it));
|
||||
t << "\n\t" << del_statement
|
||||
<< ' ' << escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
|
||||
} else {
|
||||
QString files, file;
|
||||
const int commandlineLimit = 2047; // NT limit, expanded
|
||||
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
|
||||
file = " " + escapeFilePath((*it));
|
||||
file = ' ' + escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
|
||||
if(del_statement.length() + files.length() +
|
||||
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
|
||||
t << "\n\t" << del_statement << files;
|
||||
@ -614,8 +615,7 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t)
|
||||
if(!inc.isEmpty())
|
||||
t << "-I\"" << inc << "\" ";
|
||||
}
|
||||
t << "-I\"" << specdir() << "\""
|
||||
<< endl;
|
||||
t << endl;
|
||||
}
|
||||
|
||||
void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
|
||||
|
@ -980,6 +980,45 @@ void QMakeEvaluator::setTemplate()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(Q_CC_MSVC)
|
||||
static ProString msvcBinDirToQMakeArch(QString subdir)
|
||||
{
|
||||
int idx = subdir.indexOf(QLatin1Char('\\'));
|
||||
if (idx == -1)
|
||||
return ProString("x86");
|
||||
subdir.remove(0, idx + 1);
|
||||
idx = subdir.indexOf(QLatin1Char('_'));
|
||||
if (idx >= 0)
|
||||
subdir.remove(0, idx + 1);
|
||||
subdir = subdir.toLower();
|
||||
if (subdir == QStringLiteral("amd64"))
|
||||
return ProString("x86_64");
|
||||
return ProString(subdir);
|
||||
}
|
||||
|
||||
static ProString defaultMsvcArchitecture()
|
||||
{
|
||||
return ProString("x86");
|
||||
}
|
||||
|
||||
static ProString msvcArchitecture(const QString &vcInstallDir, const QString &pathVar)
|
||||
{
|
||||
if (vcInstallDir.isEmpty())
|
||||
return defaultMsvcArchitecture();
|
||||
QString vcBinDir = vcInstallDir;
|
||||
if (vcBinDir.endsWith(QLatin1Char('\\')))
|
||||
vcBinDir.chop(1);
|
||||
foreach (const QString &dir, pathVar.split(QLatin1Char(';'))) {
|
||||
if (!dir.startsWith(vcBinDir, Qt::CaseInsensitive))
|
||||
continue;
|
||||
const ProString arch = msvcBinDirToQMakeArch(dir.mid(vcBinDir.length() + 1));
|
||||
if (!arch.isEmpty())
|
||||
return arch;
|
||||
}
|
||||
return defaultMsvcArchitecture();
|
||||
}
|
||||
#endif // defined(Q_CC_MSVC)
|
||||
|
||||
void QMakeEvaluator::loadDefaults()
|
||||
{
|
||||
ProValueMap &vars = m_valuemapStack.top();
|
||||
@ -1041,21 +1080,9 @@ void QMakeEvaluator::loadDefaults()
|
||||
vars[ProKey("QMAKE_HOST.arch")] << archStr;
|
||||
|
||||
# if defined(Q_CC_MSVC) // ### bogus condition, but nobody x-builds for msvc with a different qmake
|
||||
QLatin1Char backslash('\\');
|
||||
QString paths = m_option->getEnv(QLatin1String("PATH"));
|
||||
QString vcBin64 = m_option->getEnv(QLatin1String("VCINSTALLDIR"));
|
||||
if (!vcBin64.endsWith(backslash))
|
||||
vcBin64.append(backslash);
|
||||
vcBin64.append(QLatin1String("bin\\amd64"));
|
||||
QString vcBinX86_64 = m_option->getEnv(QLatin1String("VCINSTALLDIR"));
|
||||
if (!vcBinX86_64.endsWith(backslash))
|
||||
vcBinX86_64.append(backslash);
|
||||
vcBinX86_64.append(QLatin1String("bin\\x86_amd64"));
|
||||
if (paths.contains(vcBin64, Qt::CaseInsensitive)
|
||||
|| paths.contains(vcBinX86_64, Qt::CaseInsensitive))
|
||||
vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86_64");
|
||||
else
|
||||
vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86");
|
||||
vars[ProKey("QMAKE_TARGET.arch")] = msvcArchitecture(
|
||||
m_option->getEnv(QLatin1String("VCINSTALLDIR")),
|
||||
m_option->getEnv(QLatin1String("PATH")));
|
||||
# endif
|
||||
#elif defined(Q_OS_UNIX)
|
||||
struct utsname name;
|
||||
|
2
src/3rdparty/zlib.pri
vendored
2
src/3rdparty/zlib.pri
vendored
@ -1,5 +1,5 @@
|
||||
wince*: DEFINES += NO_ERRNO_H
|
||||
INCLUDEPATH += $$PWD/zlib
|
||||
INCLUDEPATH = $$PWD/zlib $$INCLUDEPATH
|
||||
SOURCES+= \
|
||||
$$PWD/zlib/adler32.c \
|
||||
$$PWD/zlib/compress.c \
|
||||
|
@ -45,7 +45,6 @@ package org.qtproject.qt5.android;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
@ -87,7 +86,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback
|
||||
@Override
|
||||
public void surfaceCreated(SurfaceHolder holder)
|
||||
{
|
||||
QtNative.setSurface(getId(), holder.getSurface(), getWidth(), getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,3 +55,14 @@
|
||||
\externalpage http://www.iana.org/assignments/character-sets/character-sets.xml
|
||||
\title IANA character-sets encoding file
|
||||
*/
|
||||
|
||||
/*!
|
||||
\externalpage http://doc-snapshot.qt-project.org/qt5-5.4/qtdesigner-manual.html
|
||||
\title Using a Designer UI File in Your Application
|
||||
*/
|
||||
|
||||
/*!
|
||||
\externalpage http://doc-snapshot.qt-project.org/qt5-5.4/designer-widget-mode.html#the-property-editor
|
||||
\title Qt Designer's Widget Editing Mode#The Property Editor
|
||||
*/
|
||||
*/
|
||||
|
@ -35,6 +35,8 @@ INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global
|
||||
# Only used on platforms with CONFIG += precompile_header
|
||||
PRECOMPILED_HEADER = global/qt_pch.h
|
||||
|
||||
# qlogging.cpp uses backtrace(3), which is in a separate library on the BSDs.
|
||||
|
||||
if(linux*|hurd*):!cross_compile:!static:!*-armcc* {
|
||||
QMAKE_LFLAGS += -Wl,-e,qt_core_boilerplate
|
||||
prog=$$quote(if (/program interpreter: (.*)]/) { print $1; })
|
||||
|
@ -142,6 +142,10 @@
|
||||
# if defined(__INTEL_COMPILER)
|
||||
/* Intel C++ also masquerades as GCC */
|
||||
# define Q_CC_INTEL (__INTEL_COMPILER)
|
||||
# ifdef __clang__
|
||||
/* Intel C++ masquerades as Clang masquerading as GCC */
|
||||
# define Q_CC_CLANG 305
|
||||
# endif
|
||||
# define Q_ASSUME_IMPL(expr) __assume(expr)
|
||||
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
|
||||
# if __INTEL_COMPILER >= 1300 && !defined(__APPLE__)
|
||||
@ -537,9 +541,11 @@
|
||||
# define Q_COMPILER_RANGE_FOR
|
||||
# define Q_COMPILER_RAW_STRINGS
|
||||
# define Q_COMPILER_REF_QUALIFIERS
|
||||
# define Q_COMPILER_UNICODE_STRINGS
|
||||
# define Q_COMPILER_UNRESTRICTED_UNIONS
|
||||
# endif
|
||||
# if __INTEL_COMPILER >= 1500
|
||||
# define Q_COMPILER_CONSTEXPR
|
||||
# define Q_COMPILER_ALIGNAS
|
||||
# define Q_COMPILER_ALIGNOF
|
||||
# define Q_COMPILER_INHERITING_CONSTRUCTORS
|
||||
|
@ -272,9 +272,15 @@ template <> inline qint8 qFromBigEndian<qint8>(const uchar *src)
|
||||
*/
|
||||
template <typename T> T qbswap(T source);
|
||||
|
||||
#ifdef __has_builtin
|
||||
# define QT_HAS_BUILTIN(x) __has_builtin(x)
|
||||
#else
|
||||
# define QT_HAS_BUILTIN(x) 0
|
||||
#endif
|
||||
|
||||
// GCC 4.3 implemented all the intrinsics, but the 16-bit one only got implemented in 4.8;
|
||||
// Clang 2.6 implemented the 32- and 64-bit but waited until 3.2 to implement the 16-bit one
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 206)
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || QT_HAS_BUILTIN(__builtin_bswap32)
|
||||
template <> inline quint64 qbswap<quint64>(quint64 source)
|
||||
{
|
||||
return __builtin_bswap64(source);
|
||||
@ -306,7 +312,7 @@ template <> inline quint32 qbswap<quint32>(quint32 source)
|
||||
| ((source & 0xff000000) >> 24);
|
||||
}
|
||||
#endif // GCC & Clang intrinsics
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 302)
|
||||
#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || QT_HAS_BUILTIN(__builtin_bswap16)
|
||||
template <> inline quint16 qbswap<quint16>(quint16 source)
|
||||
{
|
||||
return __builtin_bswap16(source);
|
||||
@ -320,6 +326,8 @@ template <> inline quint16 qbswap<quint16>(quint16 source)
|
||||
}
|
||||
#endif // GCC & Clang intrinsics
|
||||
|
||||
#undef QT_HAS_BUILTIN
|
||||
|
||||
// signed specializations
|
||||
template <> inline qint64 qbswap<qint64>(qint64 source)
|
||||
{
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "qdatetime.h"
|
||||
#include <private/qlocale_tools_p.h>
|
||||
|
||||
#include <private/qsystemlibrary_p.h>
|
||||
|
||||
#ifndef QT_NO_QOBJECT
|
||||
#include <private/qthread_p.h>
|
||||
#endif
|
||||
@ -1876,6 +1878,70 @@ QT_BEGIN_INCLUDE_NAMESPACE
|
||||
QT_END_INCLUDE_NAMESPACE
|
||||
|
||||
#ifndef Q_OS_WINRT
|
||||
|
||||
# ifndef Q_OS_WINCE
|
||||
|
||||
// Determine Windows versions >= 8 by querying the version of kernel32.dll.
|
||||
static inline bool determineWinOsVersionPost8(OSVERSIONINFO *result)
|
||||
{
|
||||
typedef WORD (WINAPI* PtrGetFileVersionInfoSizeW)(LPCWSTR, LPDWORD);
|
||||
typedef BOOL (WINAPI* PtrVerQueryValueW)(LPCVOID, LPCWSTR, LPVOID, PUINT);
|
||||
typedef BOOL (WINAPI* PtrGetFileVersionInfoW)(LPCWSTR, DWORD, DWORD, LPVOID);
|
||||
|
||||
QSystemLibrary versionLib(QStringLiteral("version"));
|
||||
if (!versionLib.load())
|
||||
return false;
|
||||
PtrGetFileVersionInfoSizeW getFileVersionInfoSizeW = (PtrGetFileVersionInfoSizeW)versionLib.resolve("GetFileVersionInfoSizeW");
|
||||
PtrVerQueryValueW verQueryValueW = (PtrVerQueryValueW)versionLib.resolve("VerQueryValueW");
|
||||
PtrGetFileVersionInfoW getFileVersionInfoW = (PtrGetFileVersionInfoW)versionLib.resolve("GetFileVersionInfoW");
|
||||
if (!getFileVersionInfoSizeW || !verQueryValueW || !getFileVersionInfoW)
|
||||
return false;
|
||||
|
||||
const wchar_t kernel32Dll[] = L"kernel32.dll";
|
||||
DWORD handle;
|
||||
const DWORD size = getFileVersionInfoSizeW(kernel32Dll, &handle);
|
||||
if (!size)
|
||||
return false;
|
||||
QScopedArrayPointer<BYTE> versionInfo(new BYTE[size]);
|
||||
if (!getFileVersionInfoW(kernel32Dll, handle, size, versionInfo.data()))
|
||||
return false;
|
||||
UINT uLen;
|
||||
VS_FIXEDFILEINFO *fileInfo = Q_NULLPTR;
|
||||
if (!verQueryValueW(versionInfo.data(), L"\\", (LPVOID *)&fileInfo, &uLen))
|
||||
return false;
|
||||
const DWORD fileVersionMS = fileInfo->dwFileVersionMS;
|
||||
const DWORD fileVersionLS = fileInfo->dwFileVersionLS;
|
||||
result->dwMajorVersion = HIWORD(fileVersionMS);
|
||||
result->dwMinorVersion = LOWORD(fileVersionMS);
|
||||
result->dwBuildNumber = HIWORD(fileVersionLS);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fallback for determining Windows versions >= 8 by looping using the
|
||||
// version check macros. Note that it will return build number=0 to avoid
|
||||
// inefficient looping.
|
||||
static inline void determineWinOsVersionFallbackPost8(OSVERSIONINFO *result)
|
||||
{
|
||||
result->dwBuildNumber = 0;
|
||||
DWORDLONG conditionMask = 0;
|
||||
VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
||||
VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
|
||||
OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result->dwMajorVersion, 0,
|
||||
result->dwBuildNumber, result->dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 };
|
||||
for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMajorVersion)
|
||||
result->dwMajorVersion = checkVersion.dwMajorVersion;
|
||||
conditionMask = 0;
|
||||
checkVersion.dwMajorVersion = result->dwMajorVersion;
|
||||
checkVersion.dwMinorVersion = 0;
|
||||
VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_EQUAL);
|
||||
VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||
VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
|
||||
for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion)
|
||||
result->dwMinorVersion = checkVersion.dwMinorVersion;
|
||||
}
|
||||
|
||||
# endif // !Q_OS_WINCE
|
||||
|
||||
static inline OSVERSIONINFO winOsVersion()
|
||||
{
|
||||
OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}};
|
||||
@ -1891,16 +1957,8 @@ static inline OSVERSIONINFO winOsVersion()
|
||||
# endif
|
||||
# ifndef Q_OS_WINCE
|
||||
if (result.dwMajorVersion == 6 && result.dwMinorVersion == 2) {
|
||||
// This could be Windows 8.1 or higher. Note that as of Windows 9,
|
||||
// the major version needs to be checked as well.
|
||||
DWORDLONG conditionMask = 0;
|
||||
VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
||||
VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||
VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
|
||||
OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result.dwMajorVersion, result.dwMinorVersion,
|
||||
result.dwBuildNumber, result.dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 };
|
||||
for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion)
|
||||
result.dwMinorVersion = checkVersion.dwMinorVersion;
|
||||
if (!determineWinOsVersionPost8(&result))
|
||||
determineWinOsVersionFallbackPost8(&result);
|
||||
}
|
||||
# endif // !Q_OS_WINCE
|
||||
return result;
|
||||
|
@ -116,10 +116,11 @@ QLibrarySettings::QLibrarySettings()
|
||||
QStringList children = settings->childGroups();
|
||||
#ifdef QT_BOOTSTRAPPED
|
||||
haveEffectiveSourcePaths = children.contains(QLatin1String("EffectiveSourcePaths"));
|
||||
haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths"));
|
||||
#else
|
||||
haveEffectivePaths = children.contains(QLatin1String("EffectivePaths"));
|
||||
// EffectiveSourcePaths is for the Qt build only, so needs no backwards compat trickery.
|
||||
bool haveEffectiveSourcePaths = false;
|
||||
#endif
|
||||
haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths"));
|
||||
// Backwards compat: an existing but empty file is claimed to contain the Paths section.
|
||||
havePaths = (!haveEffectivePaths && !children.contains(QLatin1String(platformsSection)))
|
||||
|| children.contains(QLatin1String("Paths"));
|
||||
@ -128,9 +129,7 @@ QLibrarySettings::QLibrarySettings()
|
||||
settings.reset(0);
|
||||
#else
|
||||
} else {
|
||||
#ifdef QT_BOOTSTRAPPED
|
||||
haveEffectiveSourcePaths = false;
|
||||
#endif
|
||||
haveEffectivePaths = false;
|
||||
havePaths = false;
|
||||
#endif
|
||||
|
@ -592,7 +592,7 @@
|
||||
string, "ddd MMM d yyyy". See QDate::toString() for more information.
|
||||
|
||||
\value ISODate \l{ISO 8601} extended format: either \c{YYYY-MM-DD} for dates or
|
||||
\c{YYYY-MM-DDTHH:MM:SS}, \c{YYYY-MM-DDTHH:MM:SSTZD} (e.g., 1997-07-16T19:20:30+01:00)
|
||||
\c{YYYY-MM-DDTHH:mm:ss}, \c{YYYY-MM-DDTHH:mm:ssTZD} (e.g., 1997-07-16T19:20:30+01:00)
|
||||
for combined dates and times.
|
||||
|
||||
\value SystemLocaleShortDate The \l{QLocale::ShortFormat}{short format} used
|
||||
|
@ -173,6 +173,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
|
||||
case TempLocation:
|
||||
return QDir::tempPath();
|
||||
case GenericDataLocation:
|
||||
case AppDataLocation:
|
||||
case AppLocalDataLocation:
|
||||
case GenericCacheLocation:
|
||||
case CacheLocation:
|
||||
|
@ -45,7 +45,7 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <qdatetime.h>
|
||||
#include <qelapsedtimer.h>
|
||||
#include <qthread.h>
|
||||
#include <qmutex.h>
|
||||
#include <qwaitcondition.h>
|
||||
@ -83,7 +83,7 @@ public:
|
||||
{
|
||||
if (totalTimeOut == -1)
|
||||
return SLEEPMAX;
|
||||
return qMax(totalTimeOut - timer.elapsed(), 0);
|
||||
return qMax(int(totalTimeOut - timer.elapsed()), 0);
|
||||
}
|
||||
|
||||
bool hasTimedOut() const
|
||||
@ -99,7 +99,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
QTime timer;
|
||||
QElapsedTimer timer;
|
||||
int totalTimeOut;
|
||||
int nextSleep;
|
||||
};
|
||||
|
@ -2741,9 +2741,9 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
|
||||
You can check if the QMetaObject::Connection is valid by casting it to a bool.
|
||||
|
||||
This function works in the same way as
|
||||
connect(const QObject *sender, const char *signal,
|
||||
\c {connect(const QObject *sender, const char *signal,
|
||||
const QObject *receiver, const char *method,
|
||||
Qt::ConnectionType type)
|
||||
Qt::ConnectionType type)}
|
||||
but it uses QMetaMethod to specify signal and method.
|
||||
|
||||
\sa connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
|
||||
@ -2996,7 +2996,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal,
|
||||
otherwise returns \c false.
|
||||
|
||||
This function provides the same possibilities like
|
||||
disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
|
||||
\c {disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) }
|
||||
but uses QMetaMethod to represent the signal and the method to be disconnected.
|
||||
|
||||
Additionally this function returnsfalse and no signals and slots disconnected
|
||||
@ -4112,7 +4112,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
|
||||
|
||||
This macro associates extra information to the class, which is available
|
||||
using QObject::metaObject(). Qt makes only limited use of this feature, in
|
||||
the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML} modules.
|
||||
the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML module}{Qt QML}.
|
||||
|
||||
The extra information takes the form of a \a Name string and a \a Value
|
||||
literal string.
|
||||
@ -4124,7 +4124,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
|
||||
\sa QMetaObject::classInfo()
|
||||
\sa QAxFactory
|
||||
\sa {Using Qt D-Bus Adaptors}
|
||||
\sa {Extending QML - Default Property Example}
|
||||
\sa {Extending QML}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -4001,6 +4001,13 @@ void QAssociativeIterable::const_iterator::end()
|
||||
m_impl.end();
|
||||
}
|
||||
|
||||
void find(QAssociativeIterable::const_iterator &it, const QVariant &key)
|
||||
{
|
||||
Q_ASSERT(key.userType() == it.m_impl._metaType_id_key);
|
||||
const QtMetaTypePrivate::VariantData dkey(key.userType(), key.constData(), 0 /*key.flags()*/);
|
||||
it.m_impl.find(dkey);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a QAssociativeIterable::const_iterator for the beginning of the container. This
|
||||
can be used in stl-style iteration.
|
||||
@ -4027,28 +4034,38 @@ QAssociativeIterable::const_iterator QAssociativeIterable::end() const
|
||||
return it;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Returns a QAssociativeIterable::const_iterator for the given key \a key
|
||||
in the container, if the types are convertible.
|
||||
|
||||
If the key is not found, returns end().
|
||||
|
||||
This can be used in stl-style iteration.
|
||||
|
||||
\sa begin(), end(), value()
|
||||
*/
|
||||
QAssociativeIterable::const_iterator find(const QAssociativeIterable &iterable, const QVariant &key)
|
||||
{
|
||||
QAssociativeIterable::const_iterator it(iterable, new QAtomicInt(0));
|
||||
QVariant key_ = key;
|
||||
if (key_.canConvert(iterable.m_impl._metaType_id_key) && key_.convert(iterable.m_impl._metaType_id_key))
|
||||
find(it, key_);
|
||||
else
|
||||
it.end();
|
||||
return it;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the value for the given \a key in the container, if the types are convertible.
|
||||
*/
|
||||
QVariant QAssociativeIterable::value(const QVariant &key) const
|
||||
{
|
||||
QVariant key_ = key;
|
||||
if (!key_.canConvert(m_impl._metaType_id_key))
|
||||
const const_iterator it = find(*this, key);
|
||||
if (it == end())
|
||||
return QVariant();
|
||||
if (!key_.convert(m_impl._metaType_id_key))
|
||||
return QVariant();
|
||||
const QtMetaTypePrivate::VariantData dkey(key_.userType(), key_.constData(), 0 /*key.flags()*/);
|
||||
QtMetaTypePrivate::QAssociativeIterableImpl impl = m_impl;
|
||||
impl.find(dkey);
|
||||
QtMetaTypePrivate::QAssociativeIterableImpl endIt = m_impl;
|
||||
endIt.end();
|
||||
if (impl.equal(endIt))
|
||||
return QVariant();
|
||||
const QtMetaTypePrivate::VariantData d = impl.getCurrentValue();
|
||||
QVariant v(d.metaTypeId, d.data, d.flags);
|
||||
if (d.metaTypeId == qMetaTypeId<QVariant>())
|
||||
return *reinterpret_cast<const QVariant*>(d.data);
|
||||
return v;
|
||||
return *it;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -633,6 +633,9 @@ public:
|
||||
|
||||
void begin();
|
||||
void end();
|
||||
// ### Qt 5.5: make find() (1st one) a member function
|
||||
friend void find(const_iterator &it, const QVariant &key);
|
||||
friend const_iterator find(const QAssociativeIterable &iterable, const QVariant &key);
|
||||
public:
|
||||
~const_iterator();
|
||||
const_iterator(const const_iterator &other);
|
||||
@ -662,6 +665,9 @@ public:
|
||||
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
private: // ### Qt 5.5: make it a public find() member function:
|
||||
friend const_iterator find(const QAssociativeIterable &iterable, const QVariant &key);
|
||||
public:
|
||||
|
||||
QVariant value(const QVariant &key) const;
|
||||
|
||||
|
@ -250,7 +250,7 @@
|
||||
|
||||
|
||||
/*!
|
||||
\fn int QAtomicInteger::load() const
|
||||
\fn T QAtomicInteger::load() const
|
||||
|
||||
Atomically loads the value of this QAtomicInteger using relaxed memory
|
||||
ordering. The value is not modified in any way, but note that there's no
|
||||
@ -260,7 +260,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QAtomicInteger::loadAcquire() const
|
||||
\fn T QAtomicInteger::loadAcquire() const
|
||||
|
||||
Atomically loads the value of this QAtomicInteger using the "Acquire" memory
|
||||
ordering. The value is not modified in any way, but note that there's no
|
||||
@ -270,7 +270,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QAtomicInteger::store(int newValue)
|
||||
\fn void QAtomicInteger::store(T newValue)
|
||||
|
||||
Atomically stores the \a newValue value into this atomic type, using
|
||||
relaxed memory ordering.
|
||||
@ -279,7 +279,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QAtomicInteger::storeRelease(int newValue)
|
||||
\fn void QAtomicInteger::storeRelease(T newValue)
|
||||
|
||||
Atomically stores the \a newValue value into this atomic type, using
|
||||
the "Release" memory ordering.
|
||||
@ -288,7 +288,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QAtomicInteger::operator int() const
|
||||
\fn QAtomicInteger::operator T() const
|
||||
\since 5.3
|
||||
|
||||
Atomically loads the value of this QAtomicInteger using a sequentially
|
||||
@ -300,7 +300,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QAtomicInteger &QAtomicInteger::operator=(int newValue)
|
||||
\fn QAtomicInteger &QAtomicInteger::operator=(T newValue)
|
||||
\since 5.3
|
||||
|
||||
Atomically stores the \a newValue value into this atomic type using a
|
||||
@ -335,7 +335,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QAtomicInteger::operator++()
|
||||
\fn T QAtomicInteger::operator++()
|
||||
\since 5.3
|
||||
|
||||
Atomically pre-increments the value of this QAtomicInteger. Returns the new
|
||||
@ -348,7 +348,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QAtomicInteger::operator++(int)
|
||||
\fn T QAtomicInteger::operator++(int)
|
||||
\since 5.3
|
||||
|
||||
Atomically post-increments the value of this QAtomicInteger. Returns the old
|
||||
@ -373,7 +373,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QAtomicInteger::operator--()
|
||||
\fn T QAtomicInteger::operator--()
|
||||
\since 5.3
|
||||
|
||||
Atomically pre-decrements the value of this QAtomicInteger. Returns the new
|
||||
@ -386,7 +386,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QAtomicInteger::operator--(int)
|
||||
\fn T QAtomicInteger::operator--(int)
|
||||
\since 5.3
|
||||
|
||||
Atomically post-decrements the value of this QAtomicInteger. Returns the old
|
||||
@ -409,7 +409,7 @@
|
||||
Returns \c true if atomic test-and-set is wait-free, false otherwise.
|
||||
*/
|
||||
|
||||
/*! \fn bool QAtomicInteger::testAndSetRelaxed(int expectedValue, int newValue)
|
||||
/*! \fn bool QAtomicInteger::testAndSetRelaxed(T expectedValue, T newValue)
|
||||
|
||||
Atomic test-and-set.
|
||||
|
||||
@ -423,7 +423,7 @@
|
||||
processor to freely reorder memory accesses.
|
||||
*/
|
||||
|
||||
/*! \fn bool QAtomicInteger::testAndSetAcquire(int expectedValue, int newValue)
|
||||
/*! \fn bool QAtomicInteger::testAndSetAcquire(T expectedValue, T newValue)
|
||||
|
||||
Atomic test-and-set.
|
||||
|
||||
@ -438,7 +438,7 @@
|
||||
be re-ordered before the atomic operation.
|
||||
*/
|
||||
|
||||
/*! \fn bool QAtomicInteger::testAndSetRelease(int expectedValue, int newValue)
|
||||
/*! \fn bool QAtomicInteger::testAndSetRelease(T expectedValue, T newValue)
|
||||
|
||||
Atomic test-and-set.
|
||||
|
||||
@ -453,7 +453,7 @@
|
||||
re-ordered after the atomic operation.
|
||||
*/
|
||||
|
||||
/*! \fn bool QAtomicInteger::testAndSetOrdered(int expectedValue, int newValue)
|
||||
/*! \fn bool QAtomicInteger::testAndSetOrdered(T expectedValue, T newValue)
|
||||
|
||||
Atomic test-and-set.
|
||||
|
||||
@ -480,7 +480,7 @@
|
||||
otherwise.
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndStoreRelaxed(int newValue)
|
||||
/*! \fn T QAtomicInteger::fetchAndStoreRelaxed(T newValue)
|
||||
|
||||
Atomic fetch-and-store.
|
||||
|
||||
@ -492,7 +492,7 @@
|
||||
processor to freely reorder memory accesses.
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndStoreAcquire(int newValue)
|
||||
/*! \fn T QAtomicInteger::fetchAndStoreAcquire(T newValue)
|
||||
|
||||
Atomic fetch-and-store.
|
||||
|
||||
@ -505,7 +505,7 @@
|
||||
be re-ordered before the atomic operation.
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndStoreRelease(int newValue)
|
||||
/*! \fn T QAtomicInteger::fetchAndStoreRelease(T newValue)
|
||||
|
||||
Atomic fetch-and-store.
|
||||
|
||||
@ -518,7 +518,7 @@
|
||||
re-ordered after the atomic operation.
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndStoreOrdered(int newValue)
|
||||
/*! \fn T QAtomicInteger::fetchAndStoreOrdered(T newValue)
|
||||
|
||||
Atomic fetch-and-store.
|
||||
|
||||
@ -543,7 +543,7 @@
|
||||
otherwise.
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndAddRelaxed(int valueToAdd)
|
||||
/*! \fn T QAtomicInteger::fetchAndAddRelaxed(T valueToAdd)
|
||||
|
||||
Atomic fetch-and-add.
|
||||
|
||||
@ -557,7 +557,7 @@
|
||||
\sa operator+=(), fetchAndSubRelaxed()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndAddAcquire(int valueToAdd)
|
||||
/*! \fn T QAtomicInteger::fetchAndAddAcquire(T valueToAdd)
|
||||
|
||||
Atomic fetch-and-add.
|
||||
|
||||
@ -572,7 +572,7 @@
|
||||
\sa operator+=(), fetchAndSubAcquire()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndAddRelease(int valueToAdd)
|
||||
/*! \fn T QAtomicInteger::fetchAndAddRelease(T valueToAdd)
|
||||
|
||||
Atomic fetch-and-add.
|
||||
|
||||
@ -587,7 +587,7 @@
|
||||
\sa operator+=(), fetchAndSubRelease()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndAddOrdered(int valueToAdd)
|
||||
/*! \fn T QAtomicInteger::fetchAndAddOrdered(T valueToAdd)
|
||||
|
||||
Atomic fetch-and-add.
|
||||
|
||||
@ -602,7 +602,7 @@
|
||||
\sa operator+=(), fetchAndSubOrdered()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::operator+=(int valueToAdd)
|
||||
/*! \fn T QAtomicInteger::operator+=(T valueToAdd)
|
||||
\since 5.3
|
||||
|
||||
Atomic add-and-fetch.
|
||||
@ -616,7 +616,7 @@
|
||||
\sa fetchAndAddOrdered(), operator-=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndSubRelaxed(int valueToSub)
|
||||
/*! \fn T QAtomicInteger::fetchAndSubRelaxed(T valueToSub)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-sub.
|
||||
@ -631,7 +631,7 @@
|
||||
\sa operator-=(), fetchAndAddRelaxed()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndSubAcquire(int valueToSub)
|
||||
/*! \fn T QAtomicInteger::fetchAndSubAcquire(T valueToSub)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-sub.
|
||||
@ -647,7 +647,7 @@
|
||||
\sa operator-=(), fetchAndAddAcquire()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndSubRelease(int valueToSub)
|
||||
/*! \fn T QAtomicInteger::fetchAndSubRelease(T valueToSub)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-sub.
|
||||
@ -663,7 +663,7 @@
|
||||
\sa operator-=(), fetchAndAddRelease()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndSubOrdered(int valueToSub)
|
||||
/*! \fn T QAtomicInteger::fetchAndSubOrdered(T valueToSub)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-sub.
|
||||
@ -679,7 +679,7 @@
|
||||
\sa operator-=(), fetchAndAddOrdered()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::operator-=(int valueToSub)
|
||||
/*! \fn T QAtomicInteger::operator-=(T valueToSub)
|
||||
\since 5.3
|
||||
|
||||
Atomic sub-and-fetch.
|
||||
@ -693,7 +693,7 @@
|
||||
\sa fetchAndSubOrdered(), operator+=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndOrRelaxed(int valueToOr)
|
||||
/*! \fn T QAtomicInteger::fetchAndOrRelaxed(T valueToOr)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-or.
|
||||
@ -708,7 +708,7 @@
|
||||
\sa operator|=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndOrAcquire(int valueToOr)
|
||||
/*! \fn T QAtomicInteger::fetchAndOrAcquire(T valueToOr)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-or.
|
||||
@ -724,7 +724,7 @@
|
||||
\sa operator|=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndOrRelease(int valueToOr)
|
||||
/*! \fn T QAtomicInteger::fetchAndOrRelease(T valueToOr)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-or.
|
||||
@ -740,7 +740,7 @@
|
||||
\sa operator|=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndOrOrdered(int valueToOr)
|
||||
/*! \fn T QAtomicInteger::fetchAndOrOrdered(T valueToOr)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-or.
|
||||
@ -756,7 +756,7 @@
|
||||
\sa operator|=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::operator|=(int valueToOr)
|
||||
/*! \fn T QAtomicInteger::operator|=(T valueToOr)
|
||||
\since 5.3
|
||||
|
||||
Atomic or-and-fetch.
|
||||
@ -770,7 +770,7 @@
|
||||
\sa fetchAndOrOrdered()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndXorRelaxed(int valueToXor)
|
||||
/*! \fn T QAtomicInteger::fetchAndXorRelaxed(T valueToXor)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-xor.
|
||||
@ -785,7 +785,7 @@
|
||||
\sa operator^=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndXorAcquire(int valueToXor)
|
||||
/*! \fn T QAtomicInteger::fetchAndXorAcquire(T valueToXor)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-xor.
|
||||
@ -801,7 +801,7 @@
|
||||
\sa operator^=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndXorRelease(int valueToXor)
|
||||
/*! \fn T QAtomicInteger::fetchAndXorRelease(T valueToXor)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-xor.
|
||||
@ -817,7 +817,7 @@
|
||||
\sa operator^=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndXorOrdered(int valueToXor)
|
||||
/*! \fn T QAtomicInteger::fetchAndXorOrdered(T valueToXor)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-xor.
|
||||
@ -833,7 +833,7 @@
|
||||
\sa operator^=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::operator^=(int valueToXor)
|
||||
/*! \fn T QAtomicInteger::operator^=(T valueToXor)
|
||||
\since 5.3
|
||||
|
||||
Atomic xor-and-fetch.
|
||||
@ -847,7 +847,7 @@
|
||||
\sa fetchAndXorOrdered()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndAndRelaxed(int valueToAnd)
|
||||
/*! \fn T QAtomicInteger::fetchAndAndRelaxed(T valueToAnd)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-and.
|
||||
@ -862,7 +862,7 @@
|
||||
\sa operator&=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndAndAcquire(int valueToAnd)
|
||||
/*! \fn T QAtomicInteger::fetchAndAndAcquire(T valueToAnd)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-and.
|
||||
@ -878,7 +878,7 @@
|
||||
\sa operator&=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndAndRelease(int valueToAnd)
|
||||
/*! \fn T QAtomicInteger::fetchAndAndRelease(T valueToAnd)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-and.
|
||||
@ -894,7 +894,7 @@
|
||||
\sa operator&=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::fetchAndAndOrdered(int valueToAnd)
|
||||
/*! \fn T QAtomicInteger::fetchAndAndOrdered(T valueToAnd)
|
||||
\since 5.3
|
||||
|
||||
Atomic fetch-and-and.
|
||||
@ -910,7 +910,7 @@
|
||||
\sa operator&=()
|
||||
*/
|
||||
|
||||
/*! \fn int QAtomicInteger::operator&=(int valueToAnd)
|
||||
/*! \fn T QAtomicInteger::operator&=(T valueToAnd)
|
||||
\since 5.3
|
||||
|
||||
Atomic add-and-fetch.
|
||||
|
@ -73,13 +73,13 @@ public:
|
||||
}
|
||||
|
||||
#ifdef Q_QDOC
|
||||
int load() const;
|
||||
int loadAcquire() const;
|
||||
void store(int newValue);
|
||||
void storeRelease(int newValue);
|
||||
T load() const;
|
||||
T loadAcquire() const;
|
||||
void store(T newValue);
|
||||
void storeRelease(T newValue);
|
||||
|
||||
operator int() const;
|
||||
QAtomicInteger &operator=(int);
|
||||
operator T() const;
|
||||
QAtomicInteger &operator=(T);
|
||||
|
||||
static Q_DECL_CONSTEXPR bool isReferenceCountingNative();
|
||||
static Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree();
|
||||
@ -90,56 +90,56 @@ public:
|
||||
static Q_DECL_CONSTEXPR bool isTestAndSetNative();
|
||||
static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree();
|
||||
|
||||
bool testAndSetRelaxed(int expectedValue, int newValue);
|
||||
bool testAndSetAcquire(int expectedValue, int newValue);
|
||||
bool testAndSetRelease(int expectedValue, int newValue);
|
||||
bool testAndSetOrdered(int expectedValue, int newValue);
|
||||
bool testAndSetRelaxed(T expectedValue, T newValue);
|
||||
bool testAndSetAcquire(T expectedValue, T newValue);
|
||||
bool testAndSetRelease(T expectedValue, T newValue);
|
||||
bool testAndSetOrdered(T expectedValue, T newValue);
|
||||
|
||||
static Q_DECL_CONSTEXPR bool isFetchAndStoreNative();
|
||||
static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree();
|
||||
|
||||
int fetchAndStoreRelaxed(int newValue);
|
||||
int fetchAndStoreAcquire(int newValue);
|
||||
int fetchAndStoreRelease(int newValue);
|
||||
int fetchAndStoreOrdered(int newValue);
|
||||
T fetchAndStoreRelaxed(T newValue);
|
||||
T fetchAndStoreAcquire(T newValue);
|
||||
T fetchAndStoreRelease(T newValue);
|
||||
T fetchAndStoreOrdered(T newValue);
|
||||
|
||||
static Q_DECL_CONSTEXPR bool isFetchAndAddNative();
|
||||
static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree();
|
||||
|
||||
int fetchAndAddRelaxed(int valueToAdd);
|
||||
int fetchAndAddAcquire(int valueToAdd);
|
||||
int fetchAndAddRelease(int valueToAdd);
|
||||
int fetchAndAddOrdered(int valueToAdd);
|
||||
T fetchAndAddRelaxed(T valueToAdd);
|
||||
T fetchAndAddAcquire(T valueToAdd);
|
||||
T fetchAndAddRelease(T valueToAdd);
|
||||
T fetchAndAddOrdered(T valueToAdd);
|
||||
|
||||
int fetchAndSubRelaxed(int valueToSub);
|
||||
int fetchAndSubAcquire(int valueToSub);
|
||||
int fetchAndSubRelease(int valueToSub);
|
||||
int fetchAndSubOrdered(int valueToSub);
|
||||
T fetchAndSubRelaxed(T valueToSub);
|
||||
T fetchAndSubAcquire(T valueToSub);
|
||||
T fetchAndSubRelease(T valueToSub);
|
||||
T fetchAndSubOrdered(T valueToSub);
|
||||
|
||||
int fetchAndOrRelaxed(int valueToOr);
|
||||
int fetchAndOrAcquire(int valueToOr);
|
||||
int fetchAndOrRelease(int valueToOr);
|
||||
int fetchAndOrOrdered(int valueToOr);
|
||||
T fetchAndOrRelaxed(T valueToOr);
|
||||
T fetchAndOrAcquire(T valueToOr);
|
||||
T fetchAndOrRelease(T valueToOr);
|
||||
T fetchAndOrOrdered(T valueToOr);
|
||||
|
||||
int fetchAndAndRelaxed(int valueToAnd);
|
||||
int fetchAndAndAcquire(int valueToAnd);
|
||||
int fetchAndAndRelease(int valueToAnd);
|
||||
int fetchAndAndOrdered(int valueToAnd);
|
||||
T fetchAndAndRelaxed(T valueToAnd);
|
||||
T fetchAndAndAcquire(T valueToAnd);
|
||||
T fetchAndAndRelease(T valueToAnd);
|
||||
T fetchAndAndOrdered(T valueToAnd);
|
||||
|
||||
int fetchAndXorRelaxed(int valueToXor);
|
||||
int fetchAndXorAcquire(int valueToXor);
|
||||
int fetchAndXorRelease(int valueToXor);
|
||||
int fetchAndXorOrdered(int valueToXor);
|
||||
T fetchAndXorRelaxed(T valueToXor);
|
||||
T fetchAndXorAcquire(T valueToXor);
|
||||
T fetchAndXorRelease(T valueToXor);
|
||||
T fetchAndXorOrdered(T valueToXor);
|
||||
|
||||
int operator++();
|
||||
int operator++(int);
|
||||
int operator--();
|
||||
int operator--(int);
|
||||
int operator+=(int value);
|
||||
int operator-=(int value);
|
||||
int operator|=(int value);
|
||||
int operator&=(int value);
|
||||
int operator^=(int value);
|
||||
T operator++();
|
||||
T operator++(int);
|
||||
T operator--();
|
||||
T operator--(int);
|
||||
T operator+=(T value);
|
||||
T operator-=(T value);
|
||||
T operator|=(T value);
|
||||
T operator&=(T value);
|
||||
T operator^=(T value);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -178,7 +178,7 @@ QThreadPrivate::~QThreadPrivate()
|
||||
event loop by calling exec() and runs a Qt event loop inside the thread.
|
||||
|
||||
You can use worker objects by moving them to the thread using
|
||||
QObject::moveToThread.
|
||||
QObject::moveToThread().
|
||||
|
||||
\snippet code/src_corelib_thread_qthread.cpp worker
|
||||
|
||||
@ -256,7 +256,7 @@ QThreadPrivate::~QThreadPrivate()
|
||||
\l{Mandelbrot Example}, as that is the name of the QThread subclass).
|
||||
Note that this is currently not available with release builds on Windows.
|
||||
|
||||
\sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads}
|
||||
\sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads},
|
||||
{Mandelbrot Example}, {Semaphores Example}, {Wait Conditions Example}
|
||||
*/
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <qmath.h>
|
||||
|
||||
#ifndef QT_NO_COMPRESS
|
||||
#include <zconf.h>
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
@ -4017,7 +4018,7 @@ QByteArray QByteArray::fromRawData(const char *data, int size)
|
||||
copies of it exist that have not been modified.
|
||||
|
||||
This function can be used instead of fromRawData() to re-use
|
||||
existings QByteArray objects to save memory re-allocations.
|
||||
existing QByteArray objects to save memory re-allocations.
|
||||
|
||||
\sa fromRawData(), data(), constData()
|
||||
*/
|
||||
|
@ -256,7 +256,7 @@ static int qFindByteArrayBoyerMoore(
|
||||
|
||||
#define REHASH(a) \
|
||||
if (sl_minus_1 < sizeof(uint) * CHAR_BIT) \
|
||||
hashHaystack -= (a) << sl_minus_1; \
|
||||
hashHaystack -= uint(a) << sl_minus_1; \
|
||||
hashHaystack <<= 1
|
||||
|
||||
/*!
|
||||
|
@ -182,7 +182,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc
|
||||
int minOffset = 0;
|
||||
bool positiveOffset = false;
|
||||
|
||||
// Matches "Wdy, DD Mon YYYY HH:MM:SS ±hhmm" (Wdy, being optional)
|
||||
// Matches "Wdy, DD Mon YYYY HH:mm:ss ±hhmm" (Wdy, being optional)
|
||||
QRegExp rex(QStringLiteral("^(?:[A-Z][a-z]+,)?[ \\t]*(\\d{1,2})[ \\t]+([A-Z][a-z]+)[ \\t]+(\\d\\d\\d\\d)(?:[ \\t]+(\\d\\d):(\\d\\d)(?::(\\d\\d))?)?[ \\t]*(?:([+-])(\\d\\d)(\\d\\d))?"));
|
||||
if (s.indexOf(rex) == 0) {
|
||||
if (dd) {
|
||||
@ -203,7 +203,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc
|
||||
if (utcOffset)
|
||||
*utcOffset = ((hourOffset * 60 + minOffset) * (positiveOffset ? 60 : -60));
|
||||
} else {
|
||||
// Matches "Wdy Mon DD HH:MM:SS YYYY"
|
||||
// Matches "Wdy Mon DD HH:mm:ss YYYY"
|
||||
QRegExp rex(QStringLiteral("^[A-Z][a-z]+[ \\t]+([A-Z][a-z]+)[ \\t]+(\\d\\d)(?:[ \\t]+(\\d\\d):(\\d\\d):(\\d\\d))?[ \\t]+(\\d\\d\\d\\d)[ \\t]*(?:([+-])(\\d\\d)(\\d\\d))?"));
|
||||
if (s.indexOf(rex) == 0) {
|
||||
if (dd) {
|
||||
@ -233,7 +233,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc
|
||||
}
|
||||
#endif // QT_NO_DATESTRING
|
||||
|
||||
// Return offset in [+-]HH:MM format
|
||||
// Return offset in [+-]HH:mm format
|
||||
// Qt::ISODate puts : between the hours and minutes, but Qt:TextDate does not
|
||||
static QString toOffsetString(Qt::DateFormat format, int offset)
|
||||
{
|
||||
@ -248,7 +248,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset)
|
||||
.arg((qAbs(offset) / 60) % 60, 2, 10, QLatin1Char('0'));
|
||||
}
|
||||
|
||||
// Parse offset in [+-]HH[:]MM format
|
||||
// Parse offset in [+-]HH[[:]mm] format
|
||||
static int fromOffsetString(const QStringRef &offsetString, bool *valid)
|
||||
{
|
||||
*valid = false;
|
||||
@ -272,7 +272,7 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid)
|
||||
// Split the hour and minute parts
|
||||
QVector<QStringRef> parts = offsetString.mid(1).split(QLatin1Char(':'));
|
||||
if (parts.count() == 1) {
|
||||
// [+-]HHMM format
|
||||
// [+-]HHmm or [+-]HH format
|
||||
parts.append(parts.first().mid(2));
|
||||
parts[0] = parts.first().left(2);
|
||||
}
|
||||
@ -282,7 +282,7 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid)
|
||||
if (!ok)
|
||||
return 0;
|
||||
|
||||
const int minute = parts.at(1).toInt(&ok);
|
||||
const int minute = (parts.at(1).isEmpty()) ? 0 : parts.at(1).toInt(&ok);
|
||||
if (!ok || minute < 0 || minute > 59)
|
||||
return 0;
|
||||
|
||||
@ -1598,12 +1598,12 @@ int QTime::msec() const
|
||||
Returns the time as a string. The \a format parameter determines
|
||||
the format of the string.
|
||||
|
||||
If \a format is Qt::TextDate, the string format is HH:MM:SS;
|
||||
If \a format is Qt::TextDate, the string format is HH:mm:ss;
|
||||
e.g. 1 second before midnight would be "23:59:59".
|
||||
|
||||
If \a format is Qt::ISODate, the string format corresponds to the
|
||||
ISO 8601 extended specification for representations of dates,
|
||||
which is also HH:MM:SS.
|
||||
which is also HH:mm:ss.
|
||||
|
||||
If the \a format is Qt::SystemLocaleShortDate or
|
||||
Qt::SystemLocaleLongDate, the string format depends on the locale
|
||||
@ -1925,13 +1925,13 @@ static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format,
|
||||
int msec = 0;
|
||||
|
||||
if (size == 5) {
|
||||
// HH:MM format
|
||||
// HH:mm format
|
||||
second = 0;
|
||||
msec = 0;
|
||||
} else if (string.at(5) == QLatin1Char(',') || string.at(5) == QLatin1Char('.')) {
|
||||
if (format == Qt::TextDate)
|
||||
return QTime();
|
||||
// ISODate HH:MM.SSSSSS format
|
||||
// ISODate HH:mm.ssssss format
|
||||
// We only want 5 digits worth of fraction of minute. This follows the existing
|
||||
// behavior that determines how milliseconds are read; 4 millisecond digits are
|
||||
// read and then rounded to 3. If we read at most 5 digits for fraction of minute,
|
||||
@ -1951,7 +1951,7 @@ static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format,
|
||||
second = secondNoMs;
|
||||
msec = qMin(qRound(secondFraction * 1000.0), 999);
|
||||
} else {
|
||||
// HH:MM:SS or HH:MM:SS.sssss
|
||||
// HH:mm:ss or HH:mm:ss.zzz
|
||||
second = string.mid(6, 2).toInt(&ok);
|
||||
if (!ok)
|
||||
return QTime();
|
||||
@ -3294,8 +3294,8 @@ bool QDateTime::isDaylightTime() const
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the date part of this datetime to \a date.
|
||||
If no time is set, it is set to midnight.
|
||||
Sets the date part of this datetime to \a date. If no time is set yet, it
|
||||
is set to midnight. If \a date is invalid, this QDateTime becomes invalid.
|
||||
|
||||
\sa date(), setTime(), setTimeSpec()
|
||||
*/
|
||||
@ -3307,7 +3307,14 @@ void QDateTime::setDate(const QDate &date)
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the time part of this datetime to \a time.
|
||||
Sets the time part of this datetime to \a time. If \a time is not valid,
|
||||
this function sets it to midnight. Therefore, it's possible to clear any
|
||||
set time in a QDateTime by setting it to a default QTime:
|
||||
|
||||
\code
|
||||
QDateTime dt = QDateTime::currentDateTime();
|
||||
dt.setTime(QTime());
|
||||
\endcode
|
||||
|
||||
\sa time(), setDate(), setTimeSpec()
|
||||
*/
|
||||
@ -3533,7 +3540,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
|
||||
|
||||
If the \a format is Qt::ISODate, the string format corresponds
|
||||
to the ISO 8601 extended specification for representations of
|
||||
dates and times, taking the form YYYY-MM-DDTHH:MM:SS[Z|[+|-]HH:MM],
|
||||
dates and times, taking the form YYYY-MM-DDTHH:mm:ss[Z|[+|-]HH:mm],
|
||||
depending on the timeSpec() of the QDateTime. If the timeSpec()
|
||||
is Qt::UTC, Z will be appended to the string; if the timeSpec() is
|
||||
Qt::OffsetFromUTC, the offset in hours and minutes from UTC will
|
||||
@ -4452,15 +4459,14 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
|
||||
|
||||
isoString = isoString.right(isoString.length() - 11);
|
||||
int offset = 0;
|
||||
// Check end of string for Time Zone definition, either Z for UTC or [+-]HH:MM for Offset
|
||||
// Check end of string for Time Zone definition, either Z for UTC or [+-]HH:mm for Offset
|
||||
if (isoString.endsWith(QLatin1Char('Z'))) {
|
||||
spec = Qt::UTC;
|
||||
isoString = isoString.left(isoString.size() - 1);
|
||||
} else {
|
||||
// the loop below is faster but functionally equal to:
|
||||
// const int signIndex = isoString.indexOf(QRegExp(QStringLiteral("[+-]")));
|
||||
const int sizeOfTimeZoneString = 4;
|
||||
int signIndex = isoString.size() - sizeOfTimeZoneString - 1;
|
||||
int signIndex = isoString.size() - 1;
|
||||
bool found = false;
|
||||
{
|
||||
const QChar plus = QLatin1Char('+');
|
||||
|
@ -171,7 +171,7 @@ class QFreeList
|
||||
// take the current serial number from \a o, increment it, and store it in \a n
|
||||
static inline int incrementserial(int o, int n)
|
||||
{
|
||||
return (n & ConstantsType::IndexMask) | ((o + ConstantsType::SerialCounter) & ConstantsType::SerialMask);
|
||||
return int((uint(n) & ConstantsType::IndexMask) | ((uint(o) + ConstantsType::SerialCounter) & ConstantsType::SerialMask));
|
||||
}
|
||||
|
||||
// the blocks
|
||||
|
@ -418,9 +418,9 @@ Q_STATIC_ASSERT(!ascii_isspace('\0'));
|
||||
Q_STATIC_ASSERT(!ascii_isspace('\a'));
|
||||
Q_STATIC_ASSERT(!ascii_isspace('a'));
|
||||
Q_STATIC_ASSERT(!ascii_isspace('\177'));
|
||||
Q_STATIC_ASSERT(!ascii_isspace('\200'));
|
||||
Q_STATIC_ASSERT(!ascii_isspace('\xA0'));
|
||||
Q_STATIC_ASSERT(!ascii_isspace('\377'));
|
||||
Q_STATIC_ASSERT(!ascii_isspace(uchar('\200')));
|
||||
Q_STATIC_ASSERT(!ascii_isspace(uchar('\xA0')));
|
||||
Q_STATIC_ASSERT(!ascii_isspace(uchar('\377')));
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -484,7 +484,7 @@ QDebug operator<<(QDebug dbg, const QMargins &m) {
|
||||
/*!
|
||||
\fn bool QMarginsF::isNull() const
|
||||
|
||||
Returns \c true if all margins are is 0; otherwise returns
|
||||
Returns \c true if all margins are 0; otherwise returns
|
||||
false.
|
||||
*/
|
||||
|
||||
|
@ -97,6 +97,7 @@ int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap)
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\target bytearray-qsnprintf
|
||||
\relates QByteArray
|
||||
|
||||
A portable snprintf() function, calls qvsnprintf.
|
||||
|
@ -726,7 +726,7 @@ static const short QXmlStreamReader_tokenTypeString_indices[] = {
|
||||
|
||||
/*!
|
||||
\property QXmlStreamReader::namespaceProcessing
|
||||
the namespace-processing flag of the stream reader
|
||||
The namespace-processing flag of the stream reader
|
||||
|
||||
This property controls whether or not the stream reader processes
|
||||
namespaces. If enabled, the reader processes namespaces, otherwise
|
||||
@ -3306,7 +3306,7 @@ QTextCodec *QXmlStreamWriter::codec() const
|
||||
/*!
|
||||
\property QXmlStreamWriter::autoFormatting
|
||||
\since 4.4
|
||||
the auto-formatting flag of the stream writer
|
||||
The auto-formatting flag of the stream writer
|
||||
|
||||
This property controls whether or not the stream writer
|
||||
automatically formats the generated XML data. If enabled, the
|
||||
|
@ -212,5 +212,22 @@
|
||||
\li \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
|
||||
\li \l{Qt D-Bus C++ Classes}
|
||||
\li \l{Qt D-Bus Examples}
|
||||
\li \l{D-Bus Viewer}
|
||||
\endlist
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page qdbusviewer.html
|
||||
\title D-Bus Viewer
|
||||
\keyword qdbusviewer
|
||||
|
||||
The Qt D-Bus Viewer is a tool that lets you introspect D-Bus objects and messages. You can
|
||||
choose between the system bus and the session bus. Click on any service on the list
|
||||
on the left side to see all the exported objects.
|
||||
|
||||
You can invoke methods by double-clicking on them. If a method takes one or more IN parameters,
|
||||
a property editor opens.
|
||||
|
||||
Right-click on a signal to connect to it. All emitted signals including their parameters
|
||||
are output in the message view on the lower side of the window.
|
||||
*/
|
||||
|
@ -86,9 +86,9 @@ bool qdbus_loadLibDBus()
|
||||
static int majorversions[] = { 3, 2, -1 };
|
||||
const QString baseNames[] = {
|
||||
#ifdef Q_OS_WIN
|
||||
QStringLiteral("dbus-1"),
|
||||
QLatin1String("dbus-1"),
|
||||
#endif
|
||||
QStringLiteral("libdbus-1")
|
||||
QLatin1String("libdbus-1")
|
||||
};
|
||||
|
||||
lib->unload();
|
||||
|
@ -183,6 +183,9 @@ DEFINEFUNC(dbus_bool_t , dbus_connection_add_filter, (DBusConnection
|
||||
void *user_data,
|
||||
DBusFreeFunction free_data_function),
|
||||
(connection, function, user_data, free_data_function), return)
|
||||
DEFINEFUNC(dbus_bool_t , dbus_connection_can_send_type, (DBusConnection *connection,
|
||||
int type),
|
||||
(connection, type), return)
|
||||
DEFINEFUNC(void , dbus_connection_close, (DBusConnection *connection),
|
||||
(connection), return)
|
||||
DEFINEFUNC(DBusDispatchStatus , dbus_connection_dispatch, (DBusConnection *connection),
|
||||
@ -396,6 +399,8 @@ DEFINEFUNC(void , dbus_pending_call_unref, (DBusPendingCall
|
||||
/* dbus-server.h */
|
||||
DEFINEFUNC(dbus_bool_t , dbus_server_allocate_data_slot, (dbus_int32_t *slot_p),
|
||||
(slot_p), return)
|
||||
DEFINEFUNC(void , dbus_server_free_data_slot, (dbus_int32_t *slot_p),
|
||||
(slot_p), return)
|
||||
DEFINEFUNC(void , dbus_server_disconnect, (DBusServer *server),
|
||||
(server), )
|
||||
DEFINEFUNC(char* , dbus_server_get_address, (DBusServer *server),
|
||||
|
@ -947,7 +947,7 @@ bool QDBusConnection::isConnected() const
|
||||
*/
|
||||
QDBusError QDBusConnection::lastError() const
|
||||
{
|
||||
return d ? d->lastError : QDBusError();
|
||||
return d ? d->lastError : QDBusError(QDBusError::Disconnected, QStringLiteral("Not connected."));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -66,6 +66,9 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// used with dbus_server_allocate_data_slot
|
||||
static dbus_int32_t server_slot = -1;
|
||||
|
||||
static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1);
|
||||
#define qDBusDebug if (::isDebugging == 0); else qDebug
|
||||
|
||||
@ -1084,8 +1087,10 @@ void QDBusConnectionPrivate::closeConnection()
|
||||
mode = InvalidMode; // prevent reentrancy
|
||||
baseService.clear();
|
||||
|
||||
if (server)
|
||||
if (server) {
|
||||
q_dbus_server_disconnect(server);
|
||||
q_dbus_server_free_data_slot(&server_slot);
|
||||
}
|
||||
|
||||
if (oldMode == ClientMode || oldMode == PeerMode) {
|
||||
if (connection) {
|
||||
@ -1651,8 +1656,6 @@ void QDBusConnectionPrivate::handleSignal(const QDBusMessage& msg)
|
||||
handleSignal(key, msg); // third try
|
||||
}
|
||||
|
||||
static dbus_int32_t server_slot = -1;
|
||||
|
||||
void QDBusConnectionPrivate::setServer(DBusServer *s, const QDBusErrorInternal &error)
|
||||
{
|
||||
mode = ServerMode;
|
||||
|
@ -110,6 +110,7 @@ QDBusServer::~QDBusServer()
|
||||
}
|
||||
d->serverConnectionNames.clear();
|
||||
}
|
||||
d->deleteLater();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -129,7 +130,7 @@ bool QDBusServer::isConnected() const
|
||||
*/
|
||||
QDBusError QDBusServer::lastError() const
|
||||
{
|
||||
return d->lastError;
|
||||
return d ? d->lastError : QDBusError(QDBusError::Disconnected, QStringLiteral("Not connected."));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -48,7 +48,7 @@ static const char * const start_xpm[]={
|
||||
|
||||
//! [1]
|
||||
QPixmap myPixmap;
|
||||
myPixmap->setMask(myPixmap->createHeuristicMask());
|
||||
myPixmap.setMask(myPixmap.createHeuristicMask());
|
||||
//! [1]
|
||||
|
||||
//! [2]
|
||||
|
@ -825,10 +825,10 @@ static int getExifOrientation(QByteArray &exifData)
|
||||
quint16 tag;
|
||||
quint16 type;
|
||||
quint32 components;
|
||||
quint32 value;
|
||||
|
||||
stream >> tag >> type >> components >> value;
|
||||
quint16 value;
|
||||
quint16 dummy;
|
||||
|
||||
stream >> tag >> type >> components >> value >> dummy;
|
||||
if (tag == 0x0112) { // Tag Exif.Image.Orientation
|
||||
if (components !=1)
|
||||
return -1;
|
||||
|
@ -518,8 +518,9 @@ void QOpenGLContext::setScreen(QScreen *screen)
|
||||
in addition. Therefore \a handle is variant containing a platform-specific
|
||||
value type. These classes can be found in the QtPlatformHeaders module.
|
||||
|
||||
When create() is called with native handles set, the handles' ownership are
|
||||
not taken, meaning that \c destroy() will not destroy the native context.
|
||||
When create() is called with native handles set, QOpenGLContext does not
|
||||
take ownership of the handles, so destroying the QOpenGLContext does not
|
||||
destroy the native context.
|
||||
|
||||
\note Some frameworks track the current context and surfaces internally.
|
||||
Making the adopted QOpenGLContext current via Qt will have no effect on such
|
||||
@ -582,8 +583,8 @@ QVariant QOpenGLContext::nativeHandle() const
|
||||
Returns \c true if the native context was successfully created and is ready to
|
||||
be used with makeCurrent(), swapBuffers(), etc.
|
||||
|
||||
\note If the context is already created, this function will first call
|
||||
\c destroy(), and then create a new OpenGL context.
|
||||
\note If the context already exists, this function destroys the existing
|
||||
context first, and then creates a new one.
|
||||
|
||||
\sa makeCurrent(), format()
|
||||
*/
|
||||
@ -606,6 +607,8 @@ bool QOpenGLContext::create()
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Destroy the underlying platform context associated with this context.
|
||||
|
||||
If any other context is directly or indirectly sharing resources with this
|
||||
@ -659,8 +662,7 @@ void QOpenGLContext::destroy()
|
||||
/*!
|
||||
Destroys the QOpenGLContext object.
|
||||
|
||||
This implicitly calls \c destroy(), so if this is the current context for the
|
||||
thread, doneCurrent() is also called.
|
||||
If this is the current context for the thread, doneCurrent() is also called.
|
||||
*/
|
||||
QOpenGLContext::~QOpenGLContext()
|
||||
{
|
||||
|
@ -49,6 +49,9 @@ QT_BEGIN_NAMESPACE
|
||||
\brief The QPlatformServices provides the backend for desktop-related functionality.
|
||||
*/
|
||||
|
||||
QPlatformServices::QPlatformServices()
|
||||
{ }
|
||||
|
||||
bool QPlatformServices::openUrl(const QUrl &url)
|
||||
{
|
||||
qWarning("This plugin does not support QPlatformServices::openUrl() for '%s'.",
|
||||
|
@ -52,6 +52,7 @@ class QUrl;
|
||||
class Q_GUI_EXPORT QPlatformServices
|
||||
{
|
||||
public:
|
||||
QPlatformServices();
|
||||
virtual ~QPlatformServices() { }
|
||||
|
||||
virtual bool openUrl(const QUrl &url);
|
||||
|
@ -1075,9 +1075,9 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem)
|
||||
}
|
||||
}
|
||||
|
||||
bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &t) const
|
||||
bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const
|
||||
{
|
||||
return t.type() >= QTransform::TxProject;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const
|
||||
|
@ -414,22 +414,6 @@ inline void QPathSegments::addIntersection(int index, const Intersection &inters
|
||||
}
|
||||
}
|
||||
|
||||
inline void QWingedEdge::TraversalStatus::flipDirection()
|
||||
{
|
||||
direction = QWingedEdge::flip(direction);
|
||||
}
|
||||
|
||||
inline void QWingedEdge::TraversalStatus::flipTraversal()
|
||||
{
|
||||
traversal = QWingedEdge::flip(traversal);
|
||||
}
|
||||
|
||||
inline void QWingedEdge::TraversalStatus::flip()
|
||||
{
|
||||
flipDirection();
|
||||
flipTraversal();
|
||||
}
|
||||
|
||||
inline int QWingedEdge::edgeCount() const
|
||||
{
|
||||
return m_edges.size();
|
||||
@ -471,11 +455,27 @@ inline QPathEdge::Traversal QWingedEdge::flip(QPathEdge::Traversal traversal)
|
||||
return traversal == QPathEdge::RightTraversal ? QPathEdge::LeftTraversal : QPathEdge::RightTraversal;
|
||||
}
|
||||
|
||||
inline void QWingedEdge::TraversalStatus::flipTraversal()
|
||||
{
|
||||
traversal = QWingedEdge::flip(traversal);
|
||||
}
|
||||
|
||||
inline QPathEdge::Direction QWingedEdge::flip(QPathEdge::Direction direction)
|
||||
{
|
||||
return direction == QPathEdge::Forward ? QPathEdge::Backward : QPathEdge::Forward;
|
||||
}
|
||||
|
||||
inline void QWingedEdge::TraversalStatus::flipDirection()
|
||||
{
|
||||
direction = QWingedEdge::flip(direction);
|
||||
}
|
||||
|
||||
inline void QWingedEdge::TraversalStatus::flip()
|
||||
{
|
||||
flipDirection();
|
||||
flipTraversal();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QPATHCLIPPER_P_H
|
||||
|
@ -647,7 +647,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
|
||||
e.g. for italicized fonts, and that the width of the returned
|
||||
rectangle might be different than what the width() method returns.
|
||||
|
||||
If you want to know the advance width of the string (to layout
|
||||
If you want to know the advance width of the string (to lay out
|
||||
a set of strings next to each other), use width() instead.
|
||||
|
||||
Newline characters are processed as normal characters, \e not as
|
||||
@ -817,7 +817,7 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA
|
||||
e.g. for italicized fonts, and that the width of the returned
|
||||
rectangle might be different than what the width() method returns.
|
||||
|
||||
If you want to know the advance width of the string (to layout
|
||||
If you want to know the advance width of the string (to lay out
|
||||
a set of strings next to each other), use width() instead.
|
||||
|
||||
Newline characters are processed as normal characters, \e not as
|
||||
@ -1432,7 +1432,7 @@ qreal QFontMetricsF::width(QChar ch) const
|
||||
e.g. for italicized fonts, and that the width of the returned
|
||||
rectangle might be different than what the width() method returns.
|
||||
|
||||
If you want to know the advance width of the string (to layout
|
||||
If you want to know the advance width of the string (to lay out
|
||||
a set of strings next to each other), use width() instead.
|
||||
|
||||
Newline characters are processed as normal characters, \e not as
|
||||
@ -1606,7 +1606,7 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta
|
||||
e.g. for italicized fonts, and that the width of the returned
|
||||
rectangle might be different than what the width() method returns.
|
||||
|
||||
If you want to know the advance width of the string (to layout
|
||||
If you want to know the advance width of the string (to lay out
|
||||
a set of strings next to each other), use width() instead.
|
||||
|
||||
Newline characters are processed as normal characters, \e not as
|
||||
|
@ -305,7 +305,7 @@ uint QTextFormatPrivate::recalcHash() const
|
||||
{
|
||||
hashValue = 0;
|
||||
for (QVector<Property>::ConstIterator it = props.constBegin(); it != props.constEnd(); ++it)
|
||||
hashValue += (it->key << 16) + variantHash(it->value);
|
||||
hashValue += (static_cast<quint32>(it->key) << 16) + variantHash(it->value);
|
||||
|
||||
hashDirty = false;
|
||||
|
||||
|
@ -606,7 +606,7 @@ QList<QByteArray> QNetworkReply::rawHeaderList() const
|
||||
|
||||
/*!
|
||||
Returns the attribute associated with the code \a code. If the
|
||||
attribute has not been set, it returns an invalid QVariant (type QMetaType::Unknown).
|
||||
attribute has not been set, it returns an invalid QVariant (type QMetaType::UnknownType).
|
||||
|
||||
You can expect the default values listed in
|
||||
QNetworkRequest::Attribute to be applied to the values returned by
|
||||
|
@ -778,18 +778,34 @@ bool QHostAddress::operator==(const QHostAddress &other) const
|
||||
bool QHostAddress::operator ==(SpecialAddress other) const
|
||||
{
|
||||
QT_ENSURE_PARSED(this);
|
||||
QHostAddress otherAddress(other);
|
||||
QT_ENSURE_PARSED(&otherAddress);
|
||||
switch (other) {
|
||||
case Null:
|
||||
return d->protocol == QAbstractSocket::UnknownNetworkLayerProtocol;
|
||||
|
||||
if (d->protocol == QAbstractSocket::IPv4Protocol)
|
||||
return otherAddress.d->protocol == QAbstractSocket::IPv4Protocol && d->a == otherAddress.d->a;
|
||||
if (d->protocol == QAbstractSocket::IPv6Protocol) {
|
||||
return otherAddress.d->protocol == QAbstractSocket::IPv6Protocol
|
||||
&& memcmp(&d->a6, &otherAddress.d->a6, sizeof(Q_IPV6ADDR)) == 0;
|
||||
case Broadcast:
|
||||
return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_BROADCAST;
|
||||
|
||||
case LocalHost:
|
||||
return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_LOOPBACK;
|
||||
|
||||
case Any:
|
||||
return d->protocol == QAbstractSocket::AnyIPProtocol;
|
||||
|
||||
case AnyIPv4:
|
||||
return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_ANY;
|
||||
|
||||
case LocalHostIPv6:
|
||||
case AnyIPv6:
|
||||
if (d->protocol == QAbstractSocket::IPv6Protocol) {
|
||||
Q_IPV6ADDR ip6 = { { 0 } };
|
||||
ip6[15] = quint8(other == LocalHostIPv6); // 1 for localhost, 0 for any
|
||||
return memcmp(&d->a6, &ip6, sizeof ip6) == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (d->protocol == QAbstractSocket::AnyIPProtocol)
|
||||
return other == QHostAddress::Any;
|
||||
return int(other) == int(Null);
|
||||
|
||||
Q_UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -221,18 +221,29 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
|
||||
int enabled;
|
||||
if (CFNumberGetValue(pacEnabled, kCFNumberIntType, &enabled) && enabled) {
|
||||
// PAC is enabled
|
||||
CFStringRef cfPacLocation = (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString);
|
||||
// kSCPropNetProxiesProxyAutoConfigURLString returns the URL string
|
||||
// as entered in the system proxy configuration dialog
|
||||
CFStringRef pacLocationSetting = (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString);
|
||||
QCFType<CFStringRef> cfPacLocation = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, pacLocationSetting, NULL, NULL,
|
||||
kCFStringEncodingUTF8);
|
||||
|
||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
|
||||
QCFType<CFDataRef> pacData;
|
||||
QCFType<CFURLRef> pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL);
|
||||
if (!pacUrl) {
|
||||
qWarning("Invalid PAC URL \"%s\"", qPrintable(QCFString::toQString(cfPacLocation)));
|
||||
return result;
|
||||
}
|
||||
SInt32 errorCode;
|
||||
if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, pacUrl, &pacData, NULL, NULL, &errorCode)) {
|
||||
QString pacLocation = QCFString::toQString(cfPacLocation);
|
||||
qWarning("Unable to get the PAC script at \"%s\" (%s)", qPrintable(pacLocation), cfurlErrorDescription(errorCode));
|
||||
return result;
|
||||
}
|
||||
|
||||
if (!pacData) {
|
||||
qWarning("\"%s\" returned an empty PAC script", qPrintable(QCFString::toQString(cfPacLocation)));
|
||||
return result;
|
||||
}
|
||||
QCFType<CFStringRef> pacScript = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, pacData, kCFStringEncodingISOLatin1);
|
||||
if (!pacScript) {
|
||||
// This should never happen, but the documentation says it may return NULL if there was a problem creating the object.
|
||||
|
@ -567,9 +567,6 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16
|
||||
return false;
|
||||
}
|
||||
|
||||
localPort = port;
|
||||
localAddress = address;
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true",
|
||||
address.toString().toLatin1().constData(), port);
|
||||
|
@ -852,9 +852,6 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &a, quint16 port)
|
||||
return false;
|
||||
}
|
||||
|
||||
localPort = port;
|
||||
localAddress = address;
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true",
|
||||
address.toString().toLatin1().constData(), port);
|
||||
|
@ -530,6 +530,11 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin
|
||||
break;
|
||||
}
|
||||
|
||||
if (QGuiApplication::platformNativeInterface()->nativeResourceForScreen("nofonthinting",
|
||||
QGuiApplication::primaryScreen())) {
|
||||
return QFontEngine::HintNone;
|
||||
}
|
||||
|
||||
if (useXftConf) {
|
||||
void *hintStyleResource =
|
||||
QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle",
|
||||
|
@ -177,6 +177,8 @@ QCoreTextFontDatabase::QCoreTextFontDatabase()
|
||||
|
||||
QCoreTextFontDatabase::~QCoreTextFontDatabase()
|
||||
{
|
||||
foreach (CTFontDescriptorRef ref, m_systemFontDescriptors)
|
||||
CFRelease(ref);
|
||||
}
|
||||
|
||||
static CFArrayRef availableFamilyNames()
|
||||
@ -810,7 +812,11 @@ QFont *QCoreTextFontDatabase::themeFont(QPlatformTheme::Font f) const
|
||||
CTFontDescriptorRef fontDesc = fontDescriptorFromTheme(f);
|
||||
FontDescription fd;
|
||||
getFontDescription(fontDesc, &fd);
|
||||
m_systemFontDescriptors.insert(fontDesc);
|
||||
|
||||
if (!m_systemFontDescriptors.contains(fontDesc))
|
||||
m_systemFontDescriptors.insert(fontDesc);
|
||||
else
|
||||
CFRelease(fontDesc);
|
||||
|
||||
QFont *font = new QFont(fd.familyName, fd.pixelSize, fd.weight, fd.style == QFont::StyleItalic);
|
||||
return font;
|
||||
|
@ -125,7 +125,6 @@ void QNetworkManagerEngine::setupConfigurations()
|
||||
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()) {
|
||||
@ -180,7 +179,7 @@ void QNetworkManagerEngine::connectToId(const QString &id)
|
||||
NMDeviceType connectionType = connection->getType();
|
||||
|
||||
QString dbusDevicePath;
|
||||
const QString settingsPath = connection->connectionInterface()->path();
|
||||
const QString settingsPath = connection->path();
|
||||
QString specificPath = configuredAccessPoints.key(settingsPath);
|
||||
|
||||
if (isConnectionActive(settingsPath))
|
||||
@ -277,7 +276,6 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QMap<QString, QVari
|
||||
|
||||
connect(activeConnection, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
|
||||
this, SLOT(activeConnectionPropertiesChanged(QMap<QString,QVariant>)));
|
||||
activeConnection->setConnections();
|
||||
}
|
||||
|
||||
const QString id = activeConnection->connection().path();
|
||||
@ -373,10 +371,10 @@ void QNetworkManagerEngine::deviceConnectionsChanged(const QStringList &connecti
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
for (int i = 0; i < connections.count(); ++i) {
|
||||
if (connectionsList.contains(connections.at(i)->connectionInterface()->path()))
|
||||
if (connectionsList.contains(connections.at(i)->path()))
|
||||
continue;
|
||||
|
||||
const QString settingsPath = connections.at(i)->connectionInterface()->path();
|
||||
const QString settingsPath = connections.at(i)->path();
|
||||
|
||||
QNetworkConfigurationPrivatePointer ptr =
|
||||
accessPointConfigurations.value(settingsPath);
|
||||
@ -399,11 +397,10 @@ void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path)
|
||||
connect(iDevice,SIGNAL(connectionsChanged(QStringList)),
|
||||
this,SLOT(deviceConnectionsChanged(QStringList)));
|
||||
|
||||
iDevice->setConnections();
|
||||
interfaceDevices.insert(path.path(),iDevice);
|
||||
if (iDevice->deviceType() == DEVICE_TYPE_WIFI) {
|
||||
QNetworkManagerInterfaceDeviceWireless *wirelessDevice =
|
||||
new QNetworkManagerInterfaceDeviceWireless(iDevice->connectionInterface()->path(),this);
|
||||
new QNetworkManagerInterfaceDeviceWireless(iDevice->path(),this);
|
||||
|
||||
connect(wirelessDevice, SIGNAL(accessPointAdded(QString)),
|
||||
this, SLOT(newAccessPoint(QString)));
|
||||
@ -417,9 +414,9 @@ void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path)
|
||||
|
||||
if (iDevice->deviceType() == DEVICE_TYPE_ETHERNET) {
|
||||
QNetworkManagerInterfaceDeviceWired *wiredDevice =
|
||||
new QNetworkManagerInterfaceDeviceWired(iDevice->connectionInterface()->path(),this);
|
||||
new QNetworkManagerInterfaceDeviceWired(iDevice->path(),this);
|
||||
connect(wiredDevice,SIGNAL(carrierChanged(bool)),this,SLOT(wiredCarrierChanged(bool)));
|
||||
wiredDevices.insert(iDevice->connectionInterface()->path(), wiredDevice);
|
||||
wiredDevices.insert(iDevice->path(), wiredDevice);
|
||||
}
|
||||
}
|
||||
|
||||
@ -454,7 +451,7 @@ void QNetworkManagerEngine::wiredCarrierChanged(bool carrier)
|
||||
for (int i = 0; i < connections.count(); ++i) {
|
||||
QNetworkManagerSettingsConnection *connection = connections.at(i);
|
||||
if (connection->getType() == DEVICE_TYPE_ETHERNET
|
||||
&& settingsPath.path() == connection->connectionInterface()->path()) {
|
||||
&& settingsPath.path() == connection->path()) {
|
||||
QNetworkConfigurationPrivatePointer ptr =
|
||||
accessPointConfigurations.value(settingsPath.path());
|
||||
|
||||
@ -486,9 +483,9 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
|
||||
}
|
||||
|
||||
QNetworkManagerSettingsConnection *connection =
|
||||
new QNetworkManagerSettingsConnection(settings->connectionInterface()->service(),
|
||||
new QNetworkManagerSettingsConnection(settings->service(),
|
||||
path.path(),this);
|
||||
const QString settingsPath = connection->connectionInterface()->path();
|
||||
const QString settingsPath = connection->path();
|
||||
if (accessPointConfigurations.contains(settingsPath)) {
|
||||
return;
|
||||
}
|
||||
@ -506,7 +503,7 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
|
||||
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();
|
||||
apPath = accessPoints.at(i)->path();
|
||||
QNetworkConfigurationPrivatePointer ptr
|
||||
= accessPointConfigurations.take(apPath);
|
||||
if (ptr) {
|
||||
@ -533,7 +530,7 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
|
||||
i.next();
|
||||
if (i.value()->deviceType() == deviceType) {
|
||||
QNetworkManagerInterfaceDeviceWired *wiredDevice
|
||||
= wiredDevices.value(i.value()->connectionInterface()->path());
|
||||
= wiredDevices.value(i.value()->path());
|
||||
if (wiredDevice->carrier()) {
|
||||
cpPriv->state |= QNetworkConfiguration::Discovered;
|
||||
}
|
||||
@ -564,7 +561,7 @@ bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath)
|
||||
|
||||
QNetworkManagerSettingsConnection *settingsConnection = connectionFromId(settingsPath);
|
||||
if (settingsConnection->getType() == DEVICE_TYPE_MODEM) {
|
||||
return isActiveContext(settingsConnection->connectionInterface()->path());
|
||||
return isActiveContext(settingsConnection->path());
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -611,7 +608,7 @@ void QNetworkManagerEngine::updateConnection()
|
||||
qobject_cast<QNetworkManagerSettingsConnection *>(sender());
|
||||
if (!connection)
|
||||
return;
|
||||
const QString settingsPath = connection->connectionInterface()->path();
|
||||
const QString settingsPath = connection->path();
|
||||
|
||||
QNetworkConfigurationPrivate *cpPriv = parseConnection(settingsPath, connection->getSettings());
|
||||
|
||||
@ -682,20 +679,19 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path)
|
||||
|
||||
bool okToAdd = true;
|
||||
for (int i = 0; i < accessPoints.count(); ++i) {
|
||||
if (accessPoints.at(i)->connectionInterface()->path() == path) {
|
||||
if (accessPoints.at(i)->path() == path) {
|
||||
okToAdd = false;
|
||||
}
|
||||
}
|
||||
if (okToAdd) {
|
||||
accessPoints.append(accessPoint);
|
||||
accessPoint->setConnections();
|
||||
}
|
||||
// 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();
|
||||
const QString settingsPath = connection->path();
|
||||
|
||||
if (accessPoint->ssid() == connection->getSsid()) {
|
||||
if (!configuredAccessPoints.contains(path)) {
|
||||
@ -741,18 +737,18 @@ 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) {
|
||||
if (accessPoint->path() == path) {
|
||||
accessPoints.removeOne(accessPoint);
|
||||
|
||||
if (configuredAccessPoints.contains(accessPoint->connectionInterface()->path())) {
|
||||
if (configuredAccessPoints.contains(accessPoint->path())) {
|
||||
// find connection and change state to Defined
|
||||
configuredAccessPoints.remove(accessPoint->connectionInterface()->path());
|
||||
configuredAccessPoints.remove(accessPoint->path());
|
||||
|
||||
for (int i = 0; i < connections.count(); ++i) {
|
||||
QNetworkManagerSettingsConnection *connection = connections.at(i);
|
||||
|
||||
if (accessPoint->ssid() == connection->getSsid()) {//might not have bssid yet
|
||||
const QString settingsPath = connection->connectionInterface()->path();
|
||||
const QString settingsPath = connection->path();
|
||||
const QString connectionId = settingsPath;
|
||||
|
||||
QNetworkConfigurationPrivatePointer ptr =
|
||||
@ -804,7 +800,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
|
||||
foreach (const QDBusObjectPath &devicePath, managerInterface->getDevices()) {
|
||||
QNetworkManagerInterfaceDevice device(devicePath.path(),this);
|
||||
if (device.deviceType() == DEVICE_TYPE_ETHERNET) {
|
||||
QNetworkManagerInterfaceDeviceWired *wiredDevice = wiredDevices.value(device.connectionInterface()->path());
|
||||
QNetworkManagerInterfaceDeviceWired *wiredDevice = wiredDevices.value(device.path());
|
||||
if (wiredDevice->carrier()) {
|
||||
cpPriv->state |= QNetworkConfiguration::Discovered;
|
||||
break;
|
||||
@ -819,10 +815,10 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
|
||||
if (connectionSsid == accessPoints.at(i)->ssid()
|
||||
&& map.value("802-11-wireless").value("seen-bssids").toStringList().contains(accessPoints.at(i)->hwAddress())) {
|
||||
cpPriv->state |= QNetworkConfiguration::Discovered;
|
||||
if (!configuredAccessPoints.contains(accessPoints.at(i)->connectionInterface()->path())) {
|
||||
configuredAccessPoints.insert(accessPoints.at(i)->connectionInterface()->path(),settingsPath);
|
||||
if (!configuredAccessPoints.contains(accessPoints.at(i)->path())) {
|
||||
configuredAccessPoints.insert(accessPoints.at(i)->path(),settingsPath);
|
||||
|
||||
const QString accessPointId = accessPoints.at(i)->connectionInterface()->path();
|
||||
const QString accessPointId = accessPoints.at(i)->path();
|
||||
QNetworkConfigurationPrivatePointer ptr =
|
||||
accessPointConfigurations.take(accessPointId);
|
||||
|
||||
@ -881,7 +877,7 @@ QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const
|
||||
{
|
||||
for (int i = 0; i < connections.count(); ++i) {
|
||||
QNetworkManagerSettingsConnection *connection = connections.at(i);
|
||||
if (id == connection->connectionInterface()->path())
|
||||
if (id == connection->path())
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
@ -47,32 +47,24 @@
|
||||
|
||||
#ifndef QT_NO_DBUS
|
||||
|
||||
#define DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QNetworkManagerInterfacePrivate
|
||||
{
|
||||
public:
|
||||
QDBusInterface *connectionInterface;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
|
||||
: QObject(parent)
|
||||
: QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
QLatin1String(NM_DBUS_PATH),
|
||||
NM_DBUS_INTERFACE,
|
||||
QDBusConnection::systemBus(),parent)
|
||||
{
|
||||
d = new QNetworkManagerInterfacePrivate();
|
||||
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
QLatin1String(NM_DBUS_PATH),
|
||||
QLatin1String(NM_DBUS_INTERFACE),
|
||||
QDBusConnection::systemBus(),parent);
|
||||
if (!d->connectionInterface->isValid()) {
|
||||
d->valid = false;
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
d->valid = true;
|
||||
|
||||
QDBusInterface managerPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
PropertiesDBusInterface managerPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
QLatin1String(NM_DBUS_PATH),
|
||||
QLatin1String("org.freedesktop.DBus.Properties"),
|
||||
DBUS_PROPERTIES_INTERFACE,
|
||||
QDBusConnection::systemBus());
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QLatin1String(NM_DBUS_INTERFACE);
|
||||
@ -81,13 +73,17 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
|
||||
argumentList);
|
||||
if (!propsReply.isError()) {
|
||||
propertyMap = propsReply.value();
|
||||
} else {
|
||||
qWarning() << Q_FUNC_INFO << "propsReply"<<propsReply.error().message();
|
||||
}
|
||||
|
||||
QDBusPendingReply<QList <QDBusObjectPath> > nmReply
|
||||
= d->connectionInterface->call(QLatin1String("GetDevices"));
|
||||
= call(QLatin1String("GetDevices"));
|
||||
nmReply.waitForFinished();
|
||||
if (!nmReply.isError()) {
|
||||
devicesPathList = nmReply.value();
|
||||
} else {
|
||||
qWarning() << Q_FUNC_INFO <<"nmReply"<<nmReply.error().message();
|
||||
}
|
||||
|
||||
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
|
||||
@ -99,13 +95,6 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
|
||||
|
||||
QNetworkManagerInterface::~QNetworkManagerInterface()
|
||||
{
|
||||
delete d->connectionInterface;
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterface::isValid()
|
||||
{
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterface::setConnections()
|
||||
@ -138,16 +127,11 @@ bool QNetworkManagerInterface::setConnections()
|
||||
return allOk;
|
||||
}
|
||||
|
||||
QDBusInterface *QNetworkManagerInterface::connectionInterface() const
|
||||
{
|
||||
return d->connectionInterface;
|
||||
}
|
||||
|
||||
QList <QDBusObjectPath> QNetworkManagerInterface::getDevices()
|
||||
{
|
||||
if (devicesPathList.isEmpty()) {
|
||||
//qWarning() << "using blocking call!";
|
||||
QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("GetDevices"));
|
||||
QDBusReply<QList<QDBusObjectPath> > reply = call(QLatin1String("GetDevices"));
|
||||
devicesPathList = reply.value();
|
||||
}
|
||||
return devicesPathList;
|
||||
@ -157,7 +141,7 @@ void QNetworkManagerInterface::activateConnection(QDBusObjectPath connectionPath
|
||||
QDBusObjectPath devicePath,
|
||||
QDBusObjectPath specificObject)
|
||||
{
|
||||
QDBusPendingCall pendingCall = d->connectionInterface->asyncCall(QLatin1String("ActivateConnection"),
|
||||
QDBusPendingCall pendingCall = asyncCall(QLatin1String("ActivateConnection"),
|
||||
QVariant::fromValue(connectionPath),
|
||||
QVariant::fromValue(devicePath),
|
||||
QVariant::fromValue(specificObject));
|
||||
@ -167,9 +151,9 @@ void QNetworkManagerInterface::activateConnection(QDBusObjectPath connectionPath
|
||||
this, SIGNAL(activationFinished(QDBusPendingCallWatcher*)));
|
||||
}
|
||||
|
||||
void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath) const
|
||||
void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath)
|
||||
{
|
||||
d->connectionInterface->asyncCall(QLatin1String("DeactivateConnection"), QVariant::fromValue(connectionPath));
|
||||
asyncCall(QLatin1String("DeactivateConnection"), QVariant::fromValue(connectionPath));
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterface::wirelessEnabled() const
|
||||
@ -245,73 +229,38 @@ void QNetworkManagerInterface::propertiesSwap(QMap<QString,QVariant> map)
|
||||
}
|
||||
}
|
||||
|
||||
class QNetworkManagerInterfaceAccessPointPrivate
|
||||
{
|
||||
public:
|
||||
QDBusInterface *connectionInterface;
|
||||
QString path;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent)
|
||||
: QObject(parent)
|
||||
: QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
dbusPathName,
|
||||
NM_DBUS_INTERFACE_ACCESS_POINT,
|
||||
QDBusConnection::systemBus(),parent)
|
||||
{
|
||||
d = new QNetworkManagerInterfaceAccessPointPrivate();
|
||||
d->path = dbusPathName;
|
||||
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
|
||||
QDBusConnection::systemBus(),parent);
|
||||
if (!d->connectionInterface->isValid()) {
|
||||
d->valid = false;
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
QDBusInterface accessPointPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String("org.freedesktop.DBus.Properties"),
|
||||
PropertiesDBusInterface *accessPointPropertiesInterface = new PropertiesDBusInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
dbusPathName,
|
||||
DBUS_PROPERTIES_INTERFACE,
|
||||
QDBusConnection::systemBus());
|
||||
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT);
|
||||
QDBusPendingReply<QVariantMap> propsReply
|
||||
= accessPointPropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
|
||||
= accessPointPropertiesInterface->callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
|
||||
argumentList);
|
||||
if (!propsReply.isError()) {
|
||||
propertyMap = propsReply.value();
|
||||
}
|
||||
|
||||
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
dbusPathName,
|
||||
QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
|
||||
QLatin1String("PropertiesChanged"),
|
||||
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
|
||||
|
||||
d->valid = true;
|
||||
|
||||
}
|
||||
|
||||
QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint()
|
||||
{
|
||||
delete d->connectionInterface;
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterfaceAccessPoint::isValid()
|
||||
{
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterfaceAccessPoint::setConnections()
|
||||
{
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QDBusInterface *QNetworkManagerInterfaceAccessPoint::connectionInterface() const
|
||||
{
|
||||
return d->connectionInterface;
|
||||
}
|
||||
|
||||
quint32 QNetworkManagerInterfaceAccessPoint::flags() const
|
||||
@ -386,31 +335,19 @@ void QNetworkManagerInterfaceAccessPoint::propertiesSwap(QMap<QString,QVariant>
|
||||
}
|
||||
}
|
||||
|
||||
class QNetworkManagerInterfaceDevicePrivate
|
||||
{
|
||||
public:
|
||||
QDBusInterface *connectionInterface;
|
||||
QString path;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent)
|
||||
: QObject(parent)
|
||||
: QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
deviceObjectPath,
|
||||
NM_DBUS_INTERFACE_DEVICE,
|
||||
QDBusConnection::systemBus(),parent)
|
||||
{
|
||||
|
||||
d = new QNetworkManagerInterfaceDevicePrivate();
|
||||
d->path = deviceObjectPath;
|
||||
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE),
|
||||
QDBusConnection::systemBus(),parent);
|
||||
if (!d->connectionInterface->isValid()) {
|
||||
d->valid = false;
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
QDBusInterface devicePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String("org.freedesktop.DBus.Properties"),
|
||||
PropertiesDBusInterface devicePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
deviceObjectPath,
|
||||
DBUS_PROPERTIES_INTERFACE,
|
||||
QDBusConnection::systemBus(),parent);
|
||||
|
||||
QList<QVariant> argumentList;
|
||||
@ -424,35 +361,14 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de
|
||||
}
|
||||
|
||||
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
deviceObjectPath,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE),
|
||||
QLatin1String("PropertiesChanged"),
|
||||
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
|
||||
d->valid = true;
|
||||
}
|
||||
|
||||
QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice()
|
||||
{
|
||||
delete d->connectionInterface;
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterfaceDevice::isValid()
|
||||
{
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterfaceDevice::setConnections()
|
||||
{
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QDBusInterface *QNetworkManagerInterfaceDevice::connectionInterface() const
|
||||
{
|
||||
return d->connectionInterface;
|
||||
}
|
||||
|
||||
QString QNetworkManagerInterfaceDevice::udi() const
|
||||
@ -519,31 +435,19 @@ void QNetworkManagerInterfaceDevice::propertiesSwap(QMap<QString,QVariant> map)
|
||||
Q_EMIT propertiesChanged(map);
|
||||
}
|
||||
|
||||
class QNetworkManagerInterfaceDeviceWiredPrivate
|
||||
{
|
||||
public:
|
||||
QDBusInterface *connectionInterface;
|
||||
QString path;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent)
|
||||
: QObject(parent)
|
||||
: QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
ifaceDevicePath,
|
||||
NM_DBUS_INTERFACE_DEVICE_WIRED,
|
||||
QDBusConnection::systemBus(), parent)
|
||||
{
|
||||
d = new QNetworkManagerInterfaceDeviceWiredPrivate();
|
||||
d->path = ifaceDevicePath;
|
||||
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
|
||||
QDBusConnection::systemBus(), parent);
|
||||
if (!d->connectionInterface->isValid()) {
|
||||
d->valid = false;
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
QDBusInterface deviceWiredPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String("org.freedesktop.DBus.Properties"),
|
||||
QDBusConnection::systemBus(),parent);
|
||||
PropertiesDBusInterface deviceWiredPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
ifaceDevicePath,
|
||||
DBUS_PROPERTIES_INTERFACE,
|
||||
QDBusConnection::systemBus(),parent);
|
||||
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED);
|
||||
@ -556,36 +460,14 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q
|
||||
}
|
||||
|
||||
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
ifaceDevicePath,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
|
||||
QLatin1String("PropertiesChanged"),
|
||||
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
|
||||
|
||||
d->valid = true;
|
||||
}
|
||||
|
||||
QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired()
|
||||
{
|
||||
delete d->connectionInterface;
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterfaceDeviceWired::isValid()
|
||||
{
|
||||
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterfaceDeviceWired::setConnections()
|
||||
{
|
||||
if (!isValid())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
QDBusInterface *QNetworkManagerInterfaceDeviceWired::connectionInterface() const
|
||||
{
|
||||
return d->connectionInterface;
|
||||
}
|
||||
|
||||
QString QNetworkManagerInterfaceDeviceWired::hwAddress() const
|
||||
@ -639,39 +521,27 @@ void QNetworkManagerInterfaceDeviceWired::propertiesSwap(QMap<QString,QVariant>
|
||||
Q_EMIT propertiesChanged(map);
|
||||
}
|
||||
|
||||
class QNetworkManagerInterfaceDeviceWirelessPrivate
|
||||
{
|
||||
public:
|
||||
QDBusInterface *connectionInterface;
|
||||
QString path;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent)
|
||||
: QObject(parent)
|
||||
: QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
ifaceDevicePath,
|
||||
NM_DBUS_INTERFACE_DEVICE_WIRELESS,
|
||||
QDBusConnection::systemBus(), parent)
|
||||
{
|
||||
d = new QNetworkManagerInterfaceDeviceWirelessPrivate();
|
||||
d->path = ifaceDevicePath;
|
||||
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
|
||||
QDBusConnection::systemBus(), parent);
|
||||
if (!d->connectionInterface->isValid()) {
|
||||
d->valid = false;
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
interfacePath = ifaceDevicePath;
|
||||
QDBusPendingReply<QList <QDBusObjectPath> > nmReply
|
||||
= d->connectionInterface->call(QLatin1String("GetAccessPoints"));
|
||||
= call(QLatin1String("GetAccessPoints"));
|
||||
|
||||
if (!nmReply.isError()) {
|
||||
accessPointsList = nmReply.value();
|
||||
}
|
||||
|
||||
QDBusInterface deviceWirelessPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String("org.freedesktop.DBus.Properties"),
|
||||
PropertiesDBusInterface deviceWirelessPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
interfacePath,
|
||||
DBUS_PROPERTIES_INTERFACE,
|
||||
QDBusConnection::systemBus(),parent);
|
||||
|
||||
QList<QVariant> argumentList;
|
||||
@ -684,31 +554,21 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c
|
||||
}
|
||||
|
||||
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
interfacePath,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
|
||||
QLatin1String("PropertiesChanged"),
|
||||
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
|
||||
|
||||
QDBusPendingReply<QList<QDBusObjectPath> > reply
|
||||
= d->connectionInterface->asyncCall(QLatin1String("GetAccessPoints"));
|
||||
= asyncCall(QLatin1String("GetAccessPoints"));
|
||||
|
||||
QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(reply);
|
||||
connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
|
||||
this, SLOT(accessPointsFinished(QDBusPendingCallWatcher*)));
|
||||
|
||||
|
||||
d->valid = true;
|
||||
}
|
||||
|
||||
QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless()
|
||||
{
|
||||
delete d->connectionInterface;
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterfaceDeviceWireless::isValid()
|
||||
{
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
void QNetworkManagerInterfaceDeviceWireless::slotAccessPointAdded(QDBusObjectPath path)
|
||||
@ -732,16 +592,16 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections()
|
||||
bool allOk = true;
|
||||
|
||||
if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
|
||||
QLatin1String("AccessPointAdded"),
|
||||
this, SLOT(slotAccessPointAdded(QDBusObjectPath)))) {
|
||||
interfacePath,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
|
||||
QLatin1String("AccessPointAdded"),
|
||||
this, SLOT(slotAccessPointAdded(QDBusObjectPath)))) {
|
||||
allOk = false;
|
||||
}
|
||||
|
||||
|
||||
if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
interfacePath,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
|
||||
QLatin1String("AccessPointRemoved"),
|
||||
this, SLOT(slotAccessPointRemoved(QDBusObjectPath)))) {
|
||||
@ -749,7 +609,7 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections()
|
||||
}
|
||||
|
||||
if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
interfacePath,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
|
||||
QLatin1String("ScanDone"),
|
||||
this, SLOT(scanIsDone()))) {
|
||||
@ -771,17 +631,12 @@ void QNetworkManagerInterfaceDeviceWireless::accessPointsFinished(QDBusPendingCa
|
||||
}
|
||||
}
|
||||
|
||||
QDBusInterface *QNetworkManagerInterfaceDeviceWireless::connectionInterface() const
|
||||
{
|
||||
return d->connectionInterface;
|
||||
}
|
||||
|
||||
QList <QDBusObjectPath> QNetworkManagerInterfaceDeviceWireless::getAccessPoints()
|
||||
{
|
||||
if (accessPointsList.isEmpty()) {
|
||||
//qWarning() << "Using blocking call!";
|
||||
QDBusReply<QList<QDBusObjectPath> > reply
|
||||
= d->connectionInterface->call(QLatin1String("GetAccessPoints"));
|
||||
= call(QLatin1String("GetAccessPoints"));
|
||||
accessPointsList = reply.value();
|
||||
}
|
||||
return accessPointsList;
|
||||
@ -829,7 +684,7 @@ void QNetworkManagerInterfaceDeviceWireless::scanIsDone()
|
||||
|
||||
void QNetworkManagerInterfaceDeviceWireless::requestScan()
|
||||
{
|
||||
d->connectionInterface->asyncCall(QLatin1String("RequestScan"));
|
||||
asyncCall(QLatin1String("RequestScan"));
|
||||
}
|
||||
|
||||
void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap<QString,QVariant> map)
|
||||
@ -844,29 +699,17 @@ void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap<QString,QVarian
|
||||
}
|
||||
}
|
||||
|
||||
class QNetworkManagerInterfaceDeviceModemPrivate
|
||||
{
|
||||
public:
|
||||
QDBusInterface *connectionInterface;
|
||||
QString path;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
QNetworkManagerInterfaceDeviceModem::QNetworkManagerInterfaceDeviceModem(const QString &ifaceDevicePath, QObject *parent)
|
||||
: QObject(parent)
|
||||
: QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
ifaceDevicePath,
|
||||
NM_DBUS_INTERFACE_DEVICE_MODEM,
|
||||
QDBusConnection::systemBus(), parent)
|
||||
{
|
||||
d = new QNetworkManagerInterfaceDeviceModemPrivate();
|
||||
d->path = ifaceDevicePath;
|
||||
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM),
|
||||
QDBusConnection::systemBus(), parent);
|
||||
if (!d->connectionInterface->isValid()) {
|
||||
d->valid = false;
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
QDBusInterface deviceModemPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
PropertiesDBusInterface deviceModemPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
ifaceDevicePath,
|
||||
QLatin1String("org.freedesktop.DBus.Properties"),
|
||||
QDBusConnection::systemBus(),parent);
|
||||
|
||||
@ -880,36 +723,14 @@ QNetworkManagerInterfaceDeviceModem::QNetworkManagerInterfaceDeviceModem(const Q
|
||||
}
|
||||
|
||||
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
ifaceDevicePath,
|
||||
QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM),
|
||||
QLatin1String("PropertiesChanged"),
|
||||
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
|
||||
d->valid = true;
|
||||
}
|
||||
|
||||
QNetworkManagerInterfaceDeviceModem::~QNetworkManagerInterfaceDeviceModem()
|
||||
{
|
||||
delete d->connectionInterface;
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterfaceDeviceModem::isValid()
|
||||
{
|
||||
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
bool QNetworkManagerInterfaceDeviceModem::setConnections()
|
||||
{
|
||||
if (!isValid() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QDBusInterface *QNetworkManagerInterfaceDeviceModem::connectionInterface() const
|
||||
{
|
||||
return d->connectionInterface;
|
||||
}
|
||||
|
||||
QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceDeviceModem::modemCapabilities() const
|
||||
@ -936,59 +757,39 @@ void QNetworkManagerInterfaceDeviceModem::propertiesSwap(QMap<QString,QVariant>
|
||||
Q_EMIT propertiesChanged(map);
|
||||
}
|
||||
|
||||
class QNetworkManagerSettingsPrivate
|
||||
{
|
||||
public:
|
||||
QDBusInterface *connectionInterface;
|
||||
QString path;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, QObject *parent)
|
||||
: QObject(parent)
|
||||
: QDBusAbstractInterface(settingsService,
|
||||
NM_DBUS_PATH_SETTINGS,
|
||||
NM_DBUS_IFACE_SETTINGS,
|
||||
QDBusConnection::systemBus(), parent)
|
||||
{
|
||||
d = new QNetworkManagerSettingsPrivate();
|
||||
d->path = settingsService;
|
||||
d->connectionInterface = new QDBusInterface(settingsService,
|
||||
QLatin1String(NM_DBUS_PATH_SETTINGS),
|
||||
QLatin1String(NM_DBUS_IFACE_SETTINGS),
|
||||
QDBusConnection::systemBus());
|
||||
if (!d->connectionInterface->isValid()) {
|
||||
d->valid = false;
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
interfacePath = settingsService;
|
||||
QDBusPendingReply<QList <QDBusObjectPath> > nmReply
|
||||
= d->connectionInterface->call(QLatin1String("ListConnections"));
|
||||
= call(QLatin1String("ListConnections"));
|
||||
|
||||
if (!nmReply.isError()) {
|
||||
connectionsList = nmReply.value();
|
||||
}
|
||||
|
||||
d->valid = true;
|
||||
}
|
||||
|
||||
QNetworkManagerSettings::~QNetworkManagerSettings()
|
||||
{
|
||||
delete d->connectionInterface;
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QNetworkManagerSettings::isValid()
|
||||
{
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
bool QNetworkManagerSettings::setConnections()
|
||||
{
|
||||
bool allOk = true;
|
||||
|
||||
if (!QDBusConnection::systemBus().connect(d->path,
|
||||
if (!QDBusConnection::systemBus().connect(interfacePath,
|
||||
QLatin1String(NM_DBUS_PATH_SETTINGS),
|
||||
QLatin1String(NM_DBUS_IFACE_SETTINGS),
|
||||
QLatin1String("NewConnection"),
|
||||
this, SIGNAL(newConnection(QDBusObjectPath)))) {
|
||||
allOk = false;
|
||||
qWarning() << Q_FUNC_INFO << "NewConnection could not be connected";
|
||||
}
|
||||
|
||||
return allOk;
|
||||
@ -999,7 +800,7 @@ QList <QDBusObjectPath> QNetworkManagerSettings::listConnections()
|
||||
if (connectionsList.isEmpty()) {
|
||||
//qWarning() << "Using blocking call!";
|
||||
QDBusReply<QList<QDBusObjectPath> > reply
|
||||
= d->connectionInterface->call(QLatin1String("ListConnections"));
|
||||
= call(QLatin1String("ListConnections"));
|
||||
connectionsList = reply.value();
|
||||
}
|
||||
return connectionsList;
|
||||
@ -1010,59 +811,30 @@ QString QNetworkManagerSettings::getConnectionByUuid(const QString &uuid)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(uuid);
|
||||
QDBusReply<QDBusObjectPath > reply = d->connectionInterface->callWithArgumentList(QDBus::Block,QLatin1String("GetConnectionByUuid"), argumentList);
|
||||
QDBusReply<QDBusObjectPath > reply = callWithArgumentList(QDBus::Block,QLatin1String("GetConnectionByUuid"), argumentList);
|
||||
return reply.value().path();
|
||||
}
|
||||
|
||||
QDBusInterface *QNetworkManagerSettings::connectionInterface() const
|
||||
{
|
||||
return d->connectionInterface;
|
||||
}
|
||||
|
||||
|
||||
class QNetworkManagerSettingsConnectionPrivate
|
||||
{
|
||||
public:
|
||||
QDBusInterface *connectionInterface;
|
||||
QString path;
|
||||
QString service;
|
||||
QNmSettingsMap settingsMap;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent)
|
||||
: QObject(parent)
|
||||
: QDBusAbstractInterface(settingsService,
|
||||
connectionObjectPath,
|
||||
NM_DBUS_IFACE_SETTINGS_CONNECTION,
|
||||
QDBusConnection::systemBus(), parent)
|
||||
{
|
||||
qDBusRegisterMetaType<QNmSettingsMap>();
|
||||
d = new QNetworkManagerSettingsConnectionPrivate();
|
||||
d->path = connectionObjectPath;
|
||||
d->service = settingsService;
|
||||
d->connectionInterface = new QDBusInterface(settingsService,
|
||||
d->path,
|
||||
QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
|
||||
QDBusConnection::systemBus(), parent);
|
||||
if (!d->connectionInterface->isValid()) {
|
||||
d->valid = false;
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
d->valid = true;
|
||||
|
||||
interfacepath = connectionObjectPath;
|
||||
QDBusPendingReply<QNmSettingsMap> nmReply
|
||||
= d->connectionInterface->call(QLatin1String("GetSettings"));
|
||||
= call(QLatin1String("GetSettings"));
|
||||
if (!nmReply.isError()) {
|
||||
d->settingsMap = nmReply.value();
|
||||
settingsMap = nmReply.value();
|
||||
}
|
||||
}
|
||||
|
||||
QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection()
|
||||
{
|
||||
delete d->connectionInterface;
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QNetworkManagerSettingsConnection::isValid()
|
||||
{
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
bool QNetworkManagerSettingsConnection::setConnections()
|
||||
@ -1072,16 +844,16 @@ bool QNetworkManagerSettingsConnection::setConnections()
|
||||
|
||||
QDBusConnection dbusConnection = QDBusConnection::systemBus();
|
||||
bool allOk = true;
|
||||
if (!dbusConnection.connect(d->service,
|
||||
d->path,
|
||||
if (!dbusConnection.connect(service(),
|
||||
interfacepath,
|
||||
QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
|
||||
QLatin1String("Updated"),
|
||||
this, SIGNAL(updated()))) {
|
||||
allOk = false;
|
||||
}
|
||||
|
||||
if (!dbusConnection.connect(d->service,
|
||||
d->path,
|
||||
if (!dbusConnection.connect(service(),
|
||||
interfacepath,
|
||||
QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
|
||||
QLatin1String("Removed"),
|
||||
this, SIGNAL(slotSettingsRemoved()))) {
|
||||
@ -1092,28 +864,23 @@ bool QNetworkManagerSettingsConnection::setConnections()
|
||||
|
||||
void QNetworkManagerSettingsConnection::slotSettingsRemoved()
|
||||
{
|
||||
Q_EMIT removed(d->path);
|
||||
}
|
||||
|
||||
QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const
|
||||
{
|
||||
return d->connectionInterface;
|
||||
Q_EMIT removed(interfacepath);
|
||||
}
|
||||
|
||||
QNmSettingsMap QNetworkManagerSettingsConnection::getSettings()
|
||||
{
|
||||
if (d->settingsMap.isEmpty()) {
|
||||
if (settingsMap.isEmpty()) {
|
||||
//qWarning() << "Using blocking call!";
|
||||
QDBusReply<QNmSettingsMap> reply = d->connectionInterface->call(QLatin1String("GetSettings"));
|
||||
d->settingsMap = reply.value();
|
||||
QDBusReply<QNmSettingsMap> reply = call(QLatin1String("GetSettings"));
|
||||
settingsMap = reply.value();
|
||||
}
|
||||
return d->settingsMap;
|
||||
return settingsMap;
|
||||
}
|
||||
|
||||
NMDeviceType QNetworkManagerSettingsConnection::getType()
|
||||
{
|
||||
const QString devType =
|
||||
d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("type")).toString();
|
||||
settingsMap.value(QLatin1String("connection")).value(QLatin1String("type")).toString();
|
||||
|
||||
if (devType == QLatin1String("802-3-ethernet"))
|
||||
return DEVICE_TYPE_ETHERNET;
|
||||
@ -1128,7 +895,7 @@ NMDeviceType QNetworkManagerSettingsConnection::getType()
|
||||
bool QNetworkManagerSettingsConnection::isAutoConnect()
|
||||
{
|
||||
const QVariant autoConnect =
|
||||
d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("autoconnect"));
|
||||
settingsMap.value(QLatin1String("connection")).value(QLatin1String("autoconnect"));
|
||||
|
||||
// NetworkManager default is to auto connect
|
||||
if (!autoConnect.isValid())
|
||||
@ -1139,27 +906,27 @@ bool QNetworkManagerSettingsConnection::isAutoConnect()
|
||||
|
||||
quint64 QNetworkManagerSettingsConnection::getTimestamp()
|
||||
{
|
||||
return d->settingsMap.value(QLatin1String("connection"))
|
||||
return settingsMap.value(QLatin1String("connection"))
|
||||
.value(QLatin1String("timestamp")).toUInt();
|
||||
}
|
||||
|
||||
QString QNetworkManagerSettingsConnection::getId()
|
||||
{
|
||||
return d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("id")).toString();
|
||||
return settingsMap.value(QLatin1String("connection")).value(QLatin1String("id")).toString();
|
||||
}
|
||||
|
||||
QString QNetworkManagerSettingsConnection::getUuid()
|
||||
{
|
||||
const QString id = d->settingsMap.value(QLatin1String("connection"))
|
||||
const QString id = settingsMap.value(QLatin1String("connection"))
|
||||
.value(QLatin1String("uuid")).toString();
|
||||
|
||||
// is no uuid, return the connection path
|
||||
return id.isEmpty() ? d->connectionInterface->path() : id;
|
||||
return id.isEmpty() ? path() : id;
|
||||
}
|
||||
|
||||
QString QNetworkManagerSettingsConnection::getSsid()
|
||||
{
|
||||
return d->settingsMap.value(QLatin1String("802-11-wireless"))
|
||||
return settingsMap.value(QLatin1String("802-11-wireless"))
|
||||
.value(QLatin1String("ssid")).toString();
|
||||
}
|
||||
|
||||
@ -1168,10 +935,10 @@ QString QNetworkManagerSettingsConnection::getMacAddress()
|
||||
NMDeviceType type = getType();
|
||||
|
||||
if (type == DEVICE_TYPE_ETHERNET) {
|
||||
return d->settingsMap.value(QLatin1String("802-3-ethernet"))
|
||||
return settingsMap.value(QLatin1String("802-3-ethernet"))
|
||||
.value(QLatin1String("mac-address")).toString();
|
||||
} else if (type == DEVICE_TYPE_WIFI) {
|
||||
return d->settingsMap.value(QLatin1String("802-11-wireless"))
|
||||
return settingsMap.value(QLatin1String("802-11-wireless"))
|
||||
.value(QLatin1String("mac-address")).toString();
|
||||
} else {
|
||||
return QString();
|
||||
@ -1181,36 +948,24 @@ QString QNetworkManagerSettingsConnection::getMacAddress()
|
||||
QStringList QNetworkManagerSettingsConnection::getSeenBssids()
|
||||
{
|
||||
if (getType() == DEVICE_TYPE_WIFI) {
|
||||
return d->settingsMap.value(QLatin1String("802-11-wireless"))
|
||||
return settingsMap.value(QLatin1String("802-11-wireless"))
|
||||
.value(QLatin1String("seen-bssids")).toStringList();
|
||||
} else {
|
||||
return QStringList();
|
||||
}
|
||||
}
|
||||
|
||||
class QNetworkManagerConnectionActivePrivate
|
||||
{
|
||||
public:
|
||||
QDBusInterface *connectionInterface;
|
||||
QString path;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
QNetworkManagerConnectionActive::QNetworkManagerConnectionActive(const QString &activeConnectionObjectPath, QObject *parent)
|
||||
: QObject(parent)
|
||||
: QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
activeConnectionObjectPath,
|
||||
NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
|
||||
QDBusConnection::systemBus(), parent)
|
||||
{
|
||||
d = new QNetworkManagerConnectionActivePrivate();
|
||||
d->path = activeConnectionObjectPath;
|
||||
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
|
||||
QDBusConnection::systemBus(), parent);
|
||||
if (!d->connectionInterface->isValid()) {
|
||||
d->valid = false;
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
QDBusInterface connectionActivePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
PropertiesDBusInterface connectionActivePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
activeConnectionObjectPath,
|
||||
QLatin1String("org.freedesktop.DBus.Properties"),
|
||||
QDBusConnection::systemBus());
|
||||
|
||||
@ -1228,35 +983,14 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive(const QString &
|
||||
}
|
||||
|
||||
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
activeConnectionObjectPath,
|
||||
QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
|
||||
QLatin1String("PropertiesChanged"),
|
||||
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
|
||||
d->valid = true;
|
||||
}
|
||||
|
||||
QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive()
|
||||
{
|
||||
delete d->connectionInterface;
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QNetworkManagerConnectionActive::isValid()
|
||||
{
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
bool QNetworkManagerConnectionActive::setConnections()
|
||||
{
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QDBusInterface *QNetworkManagerConnectionActive::connectionInterface() const
|
||||
{
|
||||
return d->connectionInterface;
|
||||
}
|
||||
|
||||
QDBusObjectPath QNetworkManagerConnectionActive::connection() const
|
||||
@ -1327,44 +1061,24 @@ void QNetworkManagerConnectionActive::propertiesSwap(QMap<QString,QVariant> map)
|
||||
}
|
||||
}
|
||||
|
||||
class QNetworkManagerIp4ConfigPrivate
|
||||
{
|
||||
public:
|
||||
QDBusInterface *connectionInterface;
|
||||
QString path;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectPath, QObject *parent)
|
||||
: QObject(parent)
|
||||
: QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
deviceObjectPath,
|
||||
NM_DBUS_INTERFACE_IP4_CONFIG,
|
||||
QDBusConnection::systemBus(), parent)
|
||||
{
|
||||
d = new QNetworkManagerIp4ConfigPrivate();
|
||||
d->path = deviceObjectPath;
|
||||
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
|
||||
d->path,
|
||||
QLatin1String(NM_DBUS_INTERFACE_IP4_CONFIG),
|
||||
QDBusConnection::systemBus(), parent);
|
||||
if (!d->connectionInterface->isValid()) {
|
||||
d->valid = false;
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
d->valid = true;
|
||||
}
|
||||
|
||||
QNetworkManagerIp4Config::~QNetworkManagerIp4Config()
|
||||
{
|
||||
delete d->connectionInterface;
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QNetworkManagerIp4Config::isValid()
|
||||
{
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
QStringList QNetworkManagerIp4Config::domains() const
|
||||
{
|
||||
return d->connectionInterface->property("Domains").toStringList();
|
||||
return property("Domains").toStringList();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include <QtDBus/QDBusPendingCallWatcher>
|
||||
#include <QtDBus/QDBusObjectPath>
|
||||
#include <QtDBus/QDBusContext>
|
||||
#include <QtDBus/QDBusAbstractInterface>
|
||||
#include <QMap>
|
||||
|
||||
#ifndef QT_NO_DBUS
|
||||
@ -128,8 +129,7 @@ Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ServerThing))
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QNetworkManagerInterfacePrivate;
|
||||
class QNetworkManagerInterface : public QObject
|
||||
class QNetworkManagerInterface : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -151,10 +151,9 @@ public:
|
||||
|
||||
QList <QDBusObjectPath> getDevices();
|
||||
void activateConnection(QDBusObjectPath connection,QDBusObjectPath device, QDBusObjectPath specificObject);
|
||||
void deactivateConnection(QDBusObjectPath connectionPath) const;
|
||||
void deactivateConnection(QDBusObjectPath connectionPath);
|
||||
|
||||
QDBusObjectPath path() const;
|
||||
QDBusInterface *connectionInterface() const;
|
||||
|
||||
bool wirelessEnabled() const;
|
||||
bool wirelessHardwareEnabled() const;
|
||||
@ -162,7 +161,6 @@ public:
|
||||
NMState state();
|
||||
QString version() const;
|
||||
bool setConnections();
|
||||
bool isValid();
|
||||
|
||||
Q_SIGNALS:
|
||||
void deviceAdded(QDBusObjectPath);
|
||||
@ -177,14 +175,12 @@ private Q_SLOTS:
|
||||
void propertiesSwap(QMap<QString,QVariant>);
|
||||
|
||||
private:
|
||||
QNetworkManagerInterfacePrivate *d;
|
||||
QVariantMap propertyMap;
|
||||
QList<QDBusObjectPath> devicesPathList;
|
||||
|
||||
};
|
||||
|
||||
class QNetworkManagerInterfaceAccessPointPrivate;
|
||||
class QNetworkManagerInterfaceAccessPoint : public QObject
|
||||
class QNetworkManagerInterfaceAccessPoint : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -229,8 +225,6 @@ public:
|
||||
explicit QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0);
|
||||
~QNetworkManagerInterfaceAccessPoint();
|
||||
|
||||
QDBusInterface *connectionInterface() const;
|
||||
|
||||
quint32 flags() const;
|
||||
quint32 wpaFlags() const;
|
||||
quint32 rsnFlags() const;
|
||||
@ -240,8 +234,7 @@ public:
|
||||
quint32 mode() const;
|
||||
quint32 maxBitrate() const;
|
||||
quint32 strength() const;
|
||||
bool setConnections();
|
||||
bool isValid();
|
||||
// bool setConnections();
|
||||
|
||||
Q_SIGNALS:
|
||||
void propertiesChanged(QMap <QString,QVariant>);
|
||||
@ -251,12 +244,10 @@ private Q_SLOTS:
|
||||
void propertiesSwap(QMap<QString,QVariant>);
|
||||
|
||||
private:
|
||||
QNetworkManagerInterfaceAccessPointPrivate *d;
|
||||
QVariantMap propertyMap;
|
||||
};
|
||||
|
||||
class QNetworkManagerInterfaceDevicePrivate;
|
||||
class QNetworkManagerInterfaceDevice : public QObject
|
||||
class QNetworkManagerInterfaceDevice : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -267,14 +258,11 @@ public:
|
||||
|
||||
QString udi() const;
|
||||
QString networkInterface() const;
|
||||
QDBusInterface *connectionInterface() const;
|
||||
quint32 ip4Address() const;
|
||||
quint32 state() const;
|
||||
quint32 deviceType() const;
|
||||
|
||||
QDBusObjectPath ip4config() const;
|
||||
bool setConnections();
|
||||
bool isValid();
|
||||
|
||||
Q_SIGNALS:
|
||||
void stateChanged(const QString &, quint32);
|
||||
@ -284,12 +272,10 @@ Q_SIGNALS:
|
||||
private Q_SLOTS:
|
||||
void propertiesSwap(QMap<QString,QVariant>);
|
||||
private:
|
||||
QNetworkManagerInterfaceDevicePrivate *d;
|
||||
QVariantMap propertyMap;
|
||||
};
|
||||
|
||||
class QNetworkManagerInterfaceDeviceWiredPrivate;
|
||||
class QNetworkManagerInterfaceDeviceWired : public QObject
|
||||
class QNetworkManagerInterfaceDeviceWired : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -299,12 +285,9 @@ public:
|
||||
QObject *parent = 0);
|
||||
~QNetworkManagerInterfaceDeviceWired();
|
||||
|
||||
QDBusInterface *connectionInterface() const;
|
||||
QString hwAddress() const;
|
||||
quint32 speed() const;
|
||||
bool carrier() const;
|
||||
bool setConnections();
|
||||
bool isValid();
|
||||
QStringList availableConnections();
|
||||
|
||||
Q_SIGNALS:
|
||||
@ -316,12 +299,10 @@ private Q_SLOTS:
|
||||
void propertiesSwap(QMap<QString,QVariant>);
|
||||
|
||||
private:
|
||||
QNetworkManagerInterfaceDeviceWiredPrivate *d;
|
||||
QVariantMap propertyMap;
|
||||
};
|
||||
|
||||
class QNetworkManagerInterfaceDeviceWirelessPrivate;
|
||||
class QNetworkManagerInterfaceDeviceWireless : public QObject
|
||||
class QNetworkManagerInterfaceDeviceWireless : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -343,7 +324,6 @@ public:
|
||||
|
||||
QDBusObjectPath path() const;
|
||||
QList <QDBusObjectPath> getAccessPoints();
|
||||
QDBusInterface *connectionInterface() const;
|
||||
|
||||
QString hwAddress() const;
|
||||
quint32 mode() const;
|
||||
@ -351,7 +331,6 @@ public:
|
||||
QDBusObjectPath activeAccessPoint() const;
|
||||
quint32 wirelessCapabilities() const;
|
||||
bool setConnections();
|
||||
bool isValid();
|
||||
|
||||
void requestScan();
|
||||
Q_SIGNALS:
|
||||
@ -372,13 +351,12 @@ private Q_SLOTS:
|
||||
void accessPointsFinished(QDBusPendingCallWatcher *watcher);
|
||||
|
||||
private:
|
||||
QNetworkManagerInterfaceDeviceWirelessPrivate *d;
|
||||
QVariantMap propertyMap;
|
||||
QList <QDBusObjectPath> accessPointsList;
|
||||
QString interfacePath;
|
||||
};
|
||||
|
||||
class QNetworkManagerInterfaceDeviceModemPrivate;
|
||||
class QNetworkManagerInterfaceDeviceModem : public QObject
|
||||
class QNetworkManagerInterfaceDeviceModem : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -397,12 +375,6 @@ public:
|
||||
QObject *parent = 0);
|
||||
~QNetworkManagerInterfaceDeviceModem();
|
||||
|
||||
QDBusObjectPath path() const;
|
||||
QDBusInterface *connectionInterface() const;
|
||||
|
||||
bool setConnections();
|
||||
bool isValid();
|
||||
|
||||
ModemCapabilities modemCapabilities() const;
|
||||
ModemCapabilities currentCapabilities() const;
|
||||
|
||||
@ -414,14 +386,12 @@ private Q_SLOTS:
|
||||
void propertiesSwap(QMap<QString,QVariant>);
|
||||
|
||||
private:
|
||||
QNetworkManagerInterfaceDeviceModemPrivate *d;
|
||||
QVariantMap propertyMap;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkManagerInterfaceDeviceModem::ModemCapabilities)
|
||||
|
||||
class QNetworkManagerSettingsPrivate;
|
||||
class QNetworkManagerSettings : public QObject
|
||||
class QNetworkManagerSettings : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -430,22 +400,19 @@ public:
|
||||
explicit QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0);
|
||||
~QNetworkManagerSettings();
|
||||
|
||||
QDBusInterface *connectionInterface() const;
|
||||
QList <QDBusObjectPath> listConnections();
|
||||
QString getConnectionByUuid(const QString &uuid);
|
||||
bool setConnections();
|
||||
bool isValid();
|
||||
|
||||
Q_SIGNALS:
|
||||
void newConnection(QDBusObjectPath);
|
||||
void connectionsListReady();
|
||||
private:
|
||||
QNetworkManagerSettingsPrivate *d;
|
||||
QList <QDBusObjectPath> connectionsList;
|
||||
QString interfacePath;
|
||||
};
|
||||
|
||||
class QNetworkManagerSettingsConnectionPrivate;
|
||||
class QNetworkManagerSettingsConnection : public QObject
|
||||
class QNetworkManagerSettingsConnection : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -454,7 +421,6 @@ public:
|
||||
QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent = 0);
|
||||
~QNetworkManagerSettingsConnection();
|
||||
|
||||
QDBusInterface *connectionInterface() const;
|
||||
QNmSettingsMap getSettings();
|
||||
bool setConnections();
|
||||
NMDeviceType getType();
|
||||
@ -465,7 +431,6 @@ public:
|
||||
QString getSsid();
|
||||
QString getMacAddress();
|
||||
QStringList getSeenBssids();
|
||||
bool isValid();
|
||||
|
||||
Q_SIGNALS:
|
||||
void updated();
|
||||
@ -474,13 +439,12 @@ Q_SIGNALS:
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotSettingsRemoved();
|
||||
|
||||
private:
|
||||
QNetworkManagerSettingsConnectionPrivate *d;
|
||||
QNmSettingsMap settingsMap;
|
||||
QString interfacepath;
|
||||
};
|
||||
|
||||
class QNetworkManagerConnectionActivePrivate;
|
||||
class QNetworkManagerConnectionActive : public QObject
|
||||
class QNetworkManagerConnectionActive : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -495,15 +459,12 @@ public:
|
||||
explicit QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0);
|
||||
~ QNetworkManagerConnectionActive();
|
||||
|
||||
QDBusInterface *connectionInterface() const;
|
||||
QDBusObjectPath connection() const;
|
||||
QDBusObjectPath specificObject() const;
|
||||
QStringList devices() const;
|
||||
quint32 state() const;
|
||||
bool defaultRoute() const;
|
||||
bool default6Route() const;
|
||||
bool setConnections();
|
||||
bool isValid();
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
@ -514,12 +475,10 @@ private Q_SLOTS:
|
||||
void propertiesSwap(QMap<QString,QVariant>);
|
||||
|
||||
private:
|
||||
QNetworkManagerConnectionActivePrivate *d;
|
||||
QVariantMap propertyMap;
|
||||
};
|
||||
|
||||
class QNetworkManagerIp4ConfigPrivate;
|
||||
class QNetworkManagerIp4Config : public QObject
|
||||
class QNetworkManagerIp4Config : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -528,10 +487,17 @@ public:
|
||||
~QNetworkManagerIp4Config();
|
||||
|
||||
QStringList domains() const;
|
||||
bool isValid();
|
||||
};
|
||||
|
||||
private:
|
||||
QNetworkManagerIp4ConfigPrivate *d;
|
||||
class PropertiesDBusInterface : public QDBusAbstractInterface
|
||||
{
|
||||
public:
|
||||
PropertiesDBusInterface(const QString &service, const QString &path,
|
||||
const QString &interface, const QDBusConnection &connection,
|
||||
QObject *parent = 0)
|
||||
: QDBusAbstractInterface(service, path, interface.toLatin1().data(), connection, parent)
|
||||
{}
|
||||
~PropertiesDBusInterface() = default;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -376,8 +376,6 @@ namespace QtAndroid
|
||||
const auto &it = m_surfaces.find(surfaceId);
|
||||
if (it != m_surfaces.end())
|
||||
m_surfaces.remove(surfaceId);
|
||||
if (m_surfaces.isEmpty())
|
||||
m_surfaceId = 1;
|
||||
|
||||
QJNIEnvironmentPrivate env;
|
||||
if (!env)
|
||||
|
@ -50,8 +50,10 @@ QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceForma
|
||||
|
||||
void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface)
|
||||
{
|
||||
if (surface->surface()->surfaceClass() == QSurface::Window)
|
||||
static_cast<QAndroidPlatformOpenGLWindow *>(surface)->checkNativeSurface(eglConfig());
|
||||
if (surface->surface()->surfaceClass() == QSurface::Window &&
|
||||
static_cast<QAndroidPlatformOpenGLWindow *>(surface)->checkNativeSurface(eglConfig())) {
|
||||
QEGLPlatformContext::makeCurrent(surface);
|
||||
}
|
||||
|
||||
QEGLPlatformContext::swapBuffers(surface);
|
||||
}
|
||||
|
@ -138,19 +138,19 @@ EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config)
|
||||
return m_eglSurface;
|
||||
}
|
||||
|
||||
void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config)
|
||||
bool QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config)
|
||||
{
|
||||
QMutexLocker lock(&m_surfaceMutex);
|
||||
if (m_nativeSurfaceId == -1 || !m_androidSurfaceObject.isValid())
|
||||
return;
|
||||
return false; // makeCurrent is NOT needed.
|
||||
|
||||
createEgl(config);
|
||||
|
||||
|
||||
// we've create another surface, the window should be repainted
|
||||
QRect availableGeometry = screen()->availableGeometry();
|
||||
if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
|
||||
QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size())));
|
||||
return true; // makeCurrent is needed!
|
||||
}
|
||||
|
||||
void QAndroidPlatformOpenGLWindow::applicationStateChanged(Qt::ApplicationState state)
|
||||
@ -209,15 +209,19 @@ void QAndroidPlatformOpenGLWindow::surfaceChanged(JNIEnv *jniEnv, jobject surfac
|
||||
Q_UNUSED(jniEnv);
|
||||
Q_UNUSED(w);
|
||||
Q_UNUSED(h);
|
||||
|
||||
lockSurface();
|
||||
m_androidSurfaceObject = surface;
|
||||
m_surfaceWaitCondition.wakeOne();
|
||||
if (surface) // wait until we have a valid surface to draw into
|
||||
m_surfaceWaitCondition.wakeOne();
|
||||
unlockSurface();
|
||||
|
||||
// repaint the window
|
||||
QRect availableGeometry = screen()->availableGeometry();
|
||||
if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
|
||||
QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size())));
|
||||
if (surface) {
|
||||
// repaint the window, when we have a valid surface
|
||||
QRect availableGeometry = screen()->availableGeometry();
|
||||
if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
|
||||
QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size())));
|
||||
}
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
EGLSurface eglSurface(EGLConfig config);
|
||||
QSurfaceFormat format() const;
|
||||
|
||||
void checkNativeSurface(EGLConfig config);
|
||||
bool checkNativeSurface(EGLConfig config);
|
||||
|
||||
void applicationStateChanged(Qt::ApplicationState);
|
||||
|
||||
@ -66,7 +66,7 @@ protected:
|
||||
void clearEgl();
|
||||
|
||||
private:
|
||||
EGLDisplay m_eglDisplay;
|
||||
EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
|
||||
EGLSurface m_eglSurface = EGL_NO_SURFACE;
|
||||
EGLNativeWindowType m_nativeWindow = nullptr;
|
||||
|
||||
|
@ -391,7 +391,7 @@ Qt::ScreenOrientation QAndroidPlatformScreen::nativeOrientation() const
|
||||
void QAndroidPlatformScreen::surfaceChanged(JNIEnv *env, jobject surface, int w, int h)
|
||||
{
|
||||
lockSurface();
|
||||
if (surface && w && h) {
|
||||
if (surface && w > 0 && h > 0) {
|
||||
releaseSurface();
|
||||
m_nativeSurface = ANativeWindow_fromSurface(env, surface);
|
||||
QMetaObject::invokeMethod(this, "setDirty", Qt::QueuedConnection, Q_ARG(QRect, QRect(0, 0, w, h)));
|
||||
|
@ -48,7 +48,7 @@ class QCocoaBackingStore;
|
||||
class QCocoaGLContext;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper);
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
|
||||
|
||||
@interface QT_MANGLE_NAMESPACE(QNSView) : NSView <NSTextInputClient> {
|
||||
QImage m_backingStore;
|
||||
@ -72,7 +72,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper);
|
||||
bool m_shouldSetGLContextinDrawRect;
|
||||
#endif
|
||||
NSString *m_inputSource;
|
||||
QNSViewMouseMoveHelper *m_mouseMoveHelper;
|
||||
QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper;
|
||||
bool m_resendKeyEvent;
|
||||
bool m_scrolling;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
|
||||
- (CGFloat)deviceDeltaZ;
|
||||
@end
|
||||
|
||||
@interface QNSViewMouseMoveHelper : NSObject
|
||||
@interface QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) : NSObject
|
||||
{
|
||||
QNSView *view;
|
||||
}
|
||||
@ -97,7 +97,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
|
||||
|
||||
@end
|
||||
|
||||
@implementation QNSViewMouseMoveHelper
|
||||
@implementation QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)
|
||||
|
||||
- (id)initWithView:(QNSView *)theView
|
||||
{
|
||||
@ -158,7 +158,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
|
||||
currentCustomDragTypes = 0;
|
||||
m_sendUpAsRightButton = false;
|
||||
m_inputSource = 0;
|
||||
m_mouseMoveHelper = [[QNSViewMouseMoveHelper alloc] initWithView:self];
|
||||
m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self];
|
||||
m_resendKeyEvent = false;
|
||||
m_scrolling = false;
|
||||
|
||||
|
@ -75,9 +75,7 @@ static QUIView *focusView()
|
||||
|
||||
- (id)initWithQIOSInputContext:(QIOSInputContext *)context
|
||||
{
|
||||
id originalSelf = self;
|
||||
if (self = [super initWithTarget:self action:@selector(gestureStateChanged:)]) {
|
||||
Q_ASSERT(self == originalSelf);
|
||||
|
||||
m_context = context;
|
||||
|
||||
@ -505,7 +503,22 @@ void QIOSInputContext::scroll(int y)
|
||||
[rootView.layer addAnimation:animation forKey:@"AnimateSubLayerTransform"];
|
||||
rootView.layer.sublayerTransform = translationTransform;
|
||||
|
||||
[rootView.qtViewController updateProperties];
|
||||
bool keyboardScrollIsActive = y != 0;
|
||||
|
||||
// Raise all known windows to above the status-bar if we're scrolling the screen,
|
||||
// while keeping the relative window level between the windows the same.
|
||||
NSArray *applicationWindows = [[UIApplication sharedApplication] windows];
|
||||
static QHash<UIWindow *, UIWindowLevel> originalWindowLevels;
|
||||
for (UIWindow *window in applicationWindows) {
|
||||
if (keyboardScrollIsActive && !originalWindowLevels.contains(window))
|
||||
originalWindowLevels.insert(window, window.windowLevel);
|
||||
|
||||
UIWindowLevel windowLevelAdjustment = keyboardScrollIsActive ? UIWindowLevelStatusBar : 0;
|
||||
window.windowLevel = originalWindowLevels.value(window) + windowLevelAdjustment;
|
||||
|
||||
if (!keyboardScrollIsActive)
|
||||
originalWindowLevels.remove(window);
|
||||
}
|
||||
}
|
||||
completion:^(BOOL){
|
||||
if (self) {
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include "qiosapplicationdelegate.h"
|
||||
#include "qiosviewcontroller.h"
|
||||
#include "quiview.h"
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
@ -244,6 +245,22 @@ void QIOSScreen::updateProperties()
|
||||
m_geometry = fromCGRect([rootView convertRect:m_uiScreen.bounds fromView:m_uiWindow]).toRect();
|
||||
m_availableGeometry = fromCGRect([rootView convertRect:m_uiScreen.applicationFrame fromView:m_uiWindow]).toRect();
|
||||
|
||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 && ![m_uiWindow.rootViewController shouldAutorotate]) {
|
||||
// Setting the statusbar orientation (content orientation) on iOS8+ will result in the UIScreen
|
||||
// updating its geometry and available geometry, which in the case of content orientation is not
|
||||
// what we want. We want to reflect the screen geometry based on the locked orientation, and
|
||||
// adjust the available geometry based on the repositioned status bar for the current status
|
||||
// bar orientation.
|
||||
|
||||
Qt::ScreenOrientation lockedOrientation = toQtScreenOrientation(UIDeviceOrientation(rootView.qtViewController.lockedOrientation));
|
||||
Qt::ScreenOrientation contenOrientation = toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation));
|
||||
|
||||
QTransform transform = screen()->transformBetween(lockedOrientation, contenOrientation, m_geometry).inverted();
|
||||
|
||||
m_geometry = transform.mapRect(m_geometry);
|
||||
m_availableGeometry = transform.mapRect(m_availableGeometry);
|
||||
}
|
||||
|
||||
if (m_geometry != previousGeometry || m_availableGeometry != previousAvailableGeometry) {
|
||||
const qreal millimetersPerInch = 25.4;
|
||||
m_physicalSize = QSizeF(m_geometry.size()) / m_unscaledDpi * millimetersPerInch;
|
||||
|
@ -51,6 +51,7 @@ class QIOSInputContext;
|
||||
QIOSInputContext *m_inputContext;
|
||||
QString m_markedText;
|
||||
BOOL m_inSendEventToFocusObject;
|
||||
BOOL m_inSelectionChange;
|
||||
}
|
||||
|
||||
- (id)initWithInputContext:(QIOSInputContext *)context;
|
||||
|
@ -171,6 +171,7 @@
|
||||
return self;
|
||||
|
||||
m_inSendEventToFocusObject = NO;
|
||||
m_inSelectionChange = NO;
|
||||
m_inputContext = inputContext;
|
||||
|
||||
QVariantMap platformData = [self imValue:Qt::ImPlatformData].toMap();
|
||||
@ -302,6 +303,7 @@
|
||||
return;
|
||||
|
||||
if (updatedProperties & (Qt::ImCursorPosition | Qt::ImAnchorPosition)) {
|
||||
QScopedValueRollback<BOOL> rollback(m_inSelectionChange, true);
|
||||
[self.inputDelegate selectionWillChange:self];
|
||||
[self.inputDelegate selectionDidChange:self];
|
||||
}
|
||||
@ -349,6 +351,15 @@
|
||||
|
||||
- (void)setSelectedTextRange:(UITextRange *)range
|
||||
{
|
||||
if (m_inSelectionChange) {
|
||||
// After [UITextInputDelegate selectionWillChange], UIKit will cancel
|
||||
// any ongoing auto correction (if enabled) and ask us to set an empty selection.
|
||||
// This is contradictory to our current attempt to set a selection, so we ignore
|
||||
// the callback. UIKit will be re-notified of the new selection after
|
||||
// [UITextInputDelegate selectionDidChange].
|
||||
return;
|
||||
}
|
||||
|
||||
QUITextRange *r = static_cast<QUITextRange *>(range);
|
||||
QList<QInputMethodEvent::Attribute> attrs;
|
||||
attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, r.range.location, r.range.length, 0);
|
||||
|
@ -35,15 +35,17 @@
|
||||
|
||||
class QIOSScreen;
|
||||
|
||||
@interface QIOSViewController : UIViewController {
|
||||
QIOSScreen *m_screen;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) BOOL changingOrientation;
|
||||
@property (nonatomic, assign) BOOL prefersStatusBarHidden;
|
||||
@property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation;
|
||||
@interface QIOSViewController : UIViewController
|
||||
|
||||
- (id)initWithQIOSScreen:(QIOSScreen *)screen;
|
||||
- (void)updateProperties;
|
||||
|
||||
@property (nonatomic, assign) UIInterfaceOrientation lockedOrientation;
|
||||
|
||||
// UIViewController
|
||||
@property (nonatomic, assign) BOOL shouldAutorotate;
|
||||
@property (nonatomic, assign) BOOL prefersStatusBarHidden;
|
||||
@property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -41,6 +41,8 @@
|
||||
|
||||
#import "qiosviewcontroller.h"
|
||||
|
||||
#include <QtCore/qscopedvaluerollback.h>
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QWindow>
|
||||
#include <QtGui/QScreen>
|
||||
@ -119,6 +121,13 @@
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@interface QIOSViewController () {
|
||||
QIOSScreen *m_screen;
|
||||
BOOL m_updatingProperties;
|
||||
}
|
||||
@property (nonatomic, assign) BOOL changingOrientation;
|
||||
@end
|
||||
|
||||
@implementation QIOSViewController
|
||||
|
||||
- (id)initWithQIOSScreen:(QIOSScreen *)screen
|
||||
@ -147,6 +156,7 @@
|
||||
#endif
|
||||
|
||||
self.changingOrientation = NO;
|
||||
self.shouldAutorotate = [super shouldAutorotate];
|
||||
|
||||
// Status bar may be initially hidden at startup through Info.plist
|
||||
self.prefersStatusBarHidden = infoPlistValue(@"UIStatusBarHidden", false);
|
||||
@ -173,6 +183,10 @@
|
||||
[center addObserver:self selector:@selector(willChangeStatusBarFrame:)
|
||||
name:UIApplicationWillChangeStatusBarFrameNotification
|
||||
object:[UIApplication sharedApplication]];
|
||||
|
||||
[center addObserver:self selector:@selector(didChangeStatusBarOrientation:)
|
||||
name:UIApplicationDidChangeStatusBarOrientationNotification
|
||||
object:[UIApplication sharedApplication]];
|
||||
}
|
||||
|
||||
- (void)viewDidUnload
|
||||
@ -183,19 +197,16 @@
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
-(BOOL)shouldAutorotate
|
||||
{
|
||||
// Until a proper orientation and rotation API is in place, we always auto rotate.
|
||||
// If auto rotation is not wanted, you would need to switch it off manually from Info.plist.
|
||||
return YES;
|
||||
}
|
||||
|
||||
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0)
|
||||
-(NSUInteger)supportedInterfaceOrientations
|
||||
{
|
||||
// We need to tell iOS that we support all orientations in order to set
|
||||
// status bar orientation when application content orientation changes.
|
||||
return UIInterfaceOrientationMaskAll;
|
||||
// As documented by Apple in the iOS 6.0 release notes, setStatusBarOrientation:animated:
|
||||
// only works if the supportedInterfaceOrientations of the view controller is 0, making
|
||||
// us responsible for ensuring that the status bar orientation is consistent. We enter
|
||||
// this mode when auto-rotation is disabled due to an explicit content orientation being
|
||||
// set on the focus window. Note that this is counter to what the documentation for
|
||||
// supportedInterfaceOrientations says, which states that the method should not return 0.
|
||||
return [self shouldAutorotate] ? UIInterfaceOrientationMaskAll : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -203,7 +214,7 @@
|
||||
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
||||
{
|
||||
Q_UNUSED(interfaceOrientation);
|
||||
return YES;
|
||||
return [self shouldAutorotate];
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -250,6 +261,22 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)didChangeStatusBarOrientation:(NSNotification *)notification
|
||||
{
|
||||
Q_UNUSED(notification);
|
||||
|
||||
if (self.view.window.screen != [UIScreen mainScreen])
|
||||
return;
|
||||
|
||||
// If the statusbar changes orientation due to auto-rotation we don't care,
|
||||
// there will be re-layout anyways. Only if the statusbar changes due to
|
||||
// reportContentOrientation, we need to update the window layout.
|
||||
if (self.changingOrientation)
|
||||
return;
|
||||
|
||||
[self.view setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)viewWillLayoutSubviews
|
||||
{
|
||||
if (!QCoreApplication::instance())
|
||||
@ -265,6 +292,15 @@
|
||||
if (!isQtApplication())
|
||||
return;
|
||||
|
||||
// Prevent recursion caused by updating the status bar appearance (position
|
||||
// or visibility), which in turn may cause a layout of our subviews, and
|
||||
// a reset of window-states, which themselves affect the view controller
|
||||
// properties such as the statusbar visibilty.
|
||||
if (m_updatingProperties)
|
||||
return;
|
||||
|
||||
QScopedValueRollback<BOOL> updateRollback(m_updatingProperties, YES);
|
||||
|
||||
QWindow *focusWindow = QGuiApplication::focusWindow();
|
||||
|
||||
// If we don't have a focus window we leave the statusbar
|
||||
@ -281,14 +317,10 @@
|
||||
// All decisions are based on the the top level window
|
||||
focusWindow = qt_window_private(focusWindow)->topLevelWindow();
|
||||
|
||||
bool hasScrolledRootViewDueToVirtualKeyboard =
|
||||
!CATransform3DIsIdentity(self.view.layer.sublayerTransform);
|
||||
UIApplication *uiApplication = [UIApplication sharedApplication];
|
||||
|
||||
bool currentStatusBarVisibility = self.prefersStatusBarHidden;
|
||||
self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen
|
||||
|| hasScrolledRootViewDueToVirtualKeyboard;
|
||||
self.preferredStatusBarUpdateAnimation = hasScrolledRootViewDueToVirtualKeyboard ?
|
||||
UIStatusBarAnimationFade : UIStatusBarAnimationNone;
|
||||
self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen;
|
||||
|
||||
if (self.prefersStatusBarHidden != currentStatusBarVisibility) {
|
||||
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
|
||||
@ -297,13 +329,60 @@
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
[[UIApplication sharedApplication]
|
||||
setStatusBarHidden:self.prefersStatusBarHidden
|
||||
[uiApplication setStatusBarHidden:self.prefersStatusBarHidden
|
||||
withAnimation:self.preferredStatusBarUpdateAnimation];
|
||||
}
|
||||
|
||||
[self.view setNeedsLayout];
|
||||
}
|
||||
|
||||
|
||||
// -------------- Content orientation ---------------
|
||||
|
||||
static BOOL kAnimateContentOrientationChanges = YES;
|
||||
|
||||
Qt::ScreenOrientation contentOrientation = focusWindow->contentOrientation();
|
||||
if (contentOrientation != Qt::PrimaryOrientation) {
|
||||
// An explicit content orientation has been reported for the focus window,
|
||||
// so we keep the status bar in sync with content orientation. This will ensure
|
||||
// that the task bar (and associated gestures) are also rotated accordingly.
|
||||
|
||||
if (self.shouldAutorotate) {
|
||||
// We are moving from Qt::PrimaryOrientation to an explicit orientation,
|
||||
// so we need to store the current statusbar orientation, as we need it
|
||||
// later when mapping screen coordinates for QScreen and for returning
|
||||
// to Qt::PrimaryOrientation.
|
||||
self.lockedOrientation = uiApplication.statusBarOrientation;
|
||||
|
||||
// Calling setStatusBarOrientation only has an effect when auto-rotation is
|
||||
// disabled, which makes sense when there's an explicit content orientation.
|
||||
self.shouldAutorotate = NO;
|
||||
}
|
||||
|
||||
[uiApplication setStatusBarOrientation:
|
||||
UIInterfaceOrientation(fromQtScreenOrientation(contentOrientation))
|
||||
animated:kAnimateContentOrientationChanges];
|
||||
|
||||
} else {
|
||||
// The content orientation is set to Qt::PrimaryOrientation, meaning
|
||||
// that auto-rotation should be enabled. But we may be coming out of
|
||||
// a state of locked orientation, which needs some cleanup before we
|
||||
// can enable auto-rotation again.
|
||||
if (!self.shouldAutorotate) {
|
||||
// First we need to restore the statusbar to what it was at the
|
||||
// time of locking the orientation, otherwise iOS will be very
|
||||
// confused when it starts doing auto-rotation again.
|
||||
[uiApplication setStatusBarOrientation:
|
||||
UIInterfaceOrientation(self.lockedOrientation)
|
||||
animated:kAnimateContentOrientationChanges];
|
||||
|
||||
// Then we can re-enable auto-rotation
|
||||
self.shouldAutorotate = YES;
|
||||
|
||||
// And finally let iOS rotate the root view to match the device orientation
|
||||
[UIViewController attemptRotationToDeviceOrientation];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
|
||||
|
@ -75,6 +75,15 @@ QIOSWindow::QIOSWindow(QWindow *window)
|
||||
|
||||
setWindowState(window->windowState());
|
||||
setOpacity(window->opacity());
|
||||
|
||||
Qt::ScreenOrientation initialOrientation = window->contentOrientation();
|
||||
if (initialOrientation != Qt::PrimaryOrientation) {
|
||||
// Start up in portrait, then apply possible content orientation,
|
||||
// as per Apple's documentation.
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
handleContentOrientationChange(initialOrientation);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
QIOSWindow::~QIOSWindow()
|
||||
@ -322,10 +331,12 @@ void QIOSWindow::updateWindowLevel()
|
||||
|
||||
void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
|
||||
{
|
||||
// Keep the status bar in sync with content orientation. This will ensure
|
||||
// that the task bar (and associated gestures) are aligned correctly:
|
||||
UIInterfaceOrientation uiOrientation = UIInterfaceOrientation(fromQtScreenOrientation(orientation));
|
||||
[[UIApplication sharedApplication] setStatusBarOrientation:uiOrientation animated:NO];
|
||||
// Update the QWindow representation straight away, so that
|
||||
// we can update the statusbar orientation based on the new
|
||||
// content orientation.
|
||||
qt_window_private(window())->contentOrientation = orientation;
|
||||
|
||||
[m_view.qtViewController updateProperties];
|
||||
}
|
||||
|
||||
void QIOSWindow::applicationStateChanged(Qt::ApplicationState)
|
||||
|
@ -126,13 +126,15 @@ HCURSOR QWindowsCursor::createPixmapCursor(const QPixmap &pixmap, const QPoint &
|
||||
|
||||
// Create a cursor from image and mask of the format QImage::Format_Mono.
|
||||
static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits,
|
||||
QPoint hotSpot = QPoint(),
|
||||
QPoint hotSpot = QPoint(-1, -1),
|
||||
bool invb = false, bool invm = false)
|
||||
{
|
||||
const int width = bbits.width();
|
||||
const int height = bbits.height();
|
||||
if (hotSpot.isNull())
|
||||
hotSpot = QPoint(width / 2, height / 2);
|
||||
if (hotSpot.x() < 0)
|
||||
hotSpot.setX(width / 2);
|
||||
if (hotSpot.y() < 0)
|
||||
hotSpot.setY(height / 2);
|
||||
const int n = qMax(1, width / 8);
|
||||
#if !defined(Q_OS_WINCE)
|
||||
QScopedArrayPointer<uchar> xBits(new uchar[height * n]);
|
||||
|
@ -626,7 +626,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
|
||||
const QPlatformDropQtResponse response =
|
||||
QWindowSystemInterface::handleDrop(m_window, windowsDrag->dropData(),
|
||||
m_lastPoint / QWindowsScaling::factor(),
|
||||
translateToQDragDropActions(*pdwEffect));
|
||||
translateToQDragDropActions(m_chosenEffect));
|
||||
|
||||
if (response.isAccepted()) {
|
||||
const Qt::DropAction action = response.acceptedAction();
|
||||
|
@ -511,8 +511,9 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
|
||||
const QTransform &xform)
|
||||
{
|
||||
glyph_metrics_t metrics = QFontEngine::boundingBox(t, xform);
|
||||
int width = (metrics.width + margin * 2 + 4).ceil().toInt() ;
|
||||
int height = (metrics.height + margin * 2 + 4).ceil().toInt();
|
||||
// This needs to be kept in sync with alphaMapBoundingBox
|
||||
int width = (metrics.width + margin * 2).ceil().toInt() ;
|
||||
int height = (metrics.height + margin * 2).ceil().toInt();
|
||||
|
||||
UINT16 glyphIndex = t;
|
||||
FLOAT glyphAdvance = metrics.xoff.toReal();
|
||||
@ -695,6 +696,18 @@ QString QWindowsFontEngineDirectWrite::fontNameSubstitute(const QString &familyN
|
||||
return QSettings(QLatin1String(keyC), QSettings::NativeFormat).value(familyName, familyName).toString();
|
||||
}
|
||||
|
||||
glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph, QFixed pos, const QTransform &matrix, GlyphFormat format)
|
||||
{
|
||||
Q_UNUSED(pos);
|
||||
int margin = 0;
|
||||
if (format == QFontEngine::Format_A32 || format == QFontEngine::Format_ARGB)
|
||||
margin = glyphMargin(QFontEngine::Format_A32);
|
||||
glyph_metrics_t gm = QFontEngine::boundingBox(glyph, matrix);
|
||||
gm.width += margin * 2;
|
||||
gm.height += margin * 2;
|
||||
return gm;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_DIRECTWRITE
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
|
||||
glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
|
||||
glyph_metrics_t boundingBox(glyph_t g);
|
||||
glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat);
|
||||
|
||||
QFixed ascent() const;
|
||||
QFixed descent() const;
|
||||
|
@ -1298,21 +1298,7 @@ void QWindowsWindow::setGeometryDp(const QRect &rectIn)
|
||||
const QMargins margins = frameMarginsDp();
|
||||
rect.moveTopLeft(rect.topLeft() + QPoint(margins.left(), margins.top()));
|
||||
}
|
||||
const QSize oldSize = m_data.geometry.size();
|
||||
m_data.geometry = rect;
|
||||
const QSize newSize = rect.size();
|
||||
// Check on hint.
|
||||
if (newSize != oldSize) {
|
||||
const QWindowsGeometryHint hint(window(), m_data.customMargins);
|
||||
if (!hint.validSize(newSize)) {
|
||||
qWarning("%s: Attempt to set a size (%dx%d) violating the constraints"
|
||||
"(%dx%d - %dx%d) on window %s/'%s'.", __FUNCTION__,
|
||||
newSize.width(), newSize.height(),
|
||||
hint.minimumSize.width(), hint.minimumSize.height(),
|
||||
hint.maximumSize.width(), hint.maximumSize.height(),
|
||||
window()->metaObject()->className(), qPrintable(window()->objectName()));
|
||||
}
|
||||
}
|
||||
if (m_data.hwnd) {
|
||||
// A ResizeEvent with resulting geometry will be sent. If we cannot
|
||||
// achieve that size (for example, window title minimal constraint),
|
||||
@ -1625,17 +1611,6 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
|
||||
|
||||
setFlag(FrameDirty);
|
||||
|
||||
if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) {
|
||||
if (visible && !(newState == Qt::WindowMinimized)) {
|
||||
setFlag(WithinMaximize);
|
||||
if (newState == Qt::WindowFullScreen)
|
||||
setFlag(MaximizeToFullScreen);
|
||||
ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
|
||||
clearFlag(WithinMaximize);
|
||||
clearFlag(MaximizeToFullScreen);
|
||||
}
|
||||
}
|
||||
|
||||
if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) {
|
||||
#ifdef Q_OS_WINCE
|
||||
HWND handle = FindWindow(L"HHTaskBar", L"");
|
||||
@ -1715,6 +1690,15 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
|
||||
m_savedStyle = 0;
|
||||
m_savedFrameGeometry = QRect();
|
||||
}
|
||||
} else if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) {
|
||||
if (visible && !(newState == Qt::WindowMinimized)) {
|
||||
setFlag(WithinMaximize);
|
||||
if (newState == Qt::WindowFullScreen)
|
||||
setFlag(MaximizeToFullScreen);
|
||||
ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
|
||||
clearFlag(WithinMaximize);
|
||||
clearFlag(MaximizeToFullScreen);
|
||||
}
|
||||
}
|
||||
|
||||
if ((oldState == Qt::WindowMinimized) != (newState == Qt::WindowMinimized)) {
|
||||
@ -1761,6 +1745,8 @@ void QWindowsWindow::windowEvent(QEvent *event)
|
||||
case QEvent::WindowBlocked: // Blocked by another modal window.
|
||||
setEnabled(false);
|
||||
setFlag(BlockedByModal);
|
||||
if (hasMouseCapture())
|
||||
ReleaseCapture();
|
||||
break;
|
||||
case QEvent::WindowUnblocked:
|
||||
setEnabled(true);
|
||||
|
@ -181,8 +181,6 @@ void QXcbShmImage::destroy()
|
||||
if (segmentSize && m_shm_info.shmaddr)
|
||||
Q_XCB_CALL(xcb_shm_detach(xcb_connection(), m_shm_info.shmseg));
|
||||
|
||||
xcb_image_destroy(m_xcb_image);
|
||||
|
||||
if (segmentSize) {
|
||||
if (m_shm_info.shmaddr) {
|
||||
shmdt(m_shm_info.shmaddr);
|
||||
@ -192,6 +190,8 @@ void QXcbShmImage::destroy()
|
||||
}
|
||||
}
|
||||
|
||||
xcb_image_destroy(m_xcb_image);
|
||||
|
||||
if (m_gc)
|
||||
Q_XCB_CALL(xcb_free_gc(xcb_connection(), m_gc));
|
||||
delete m_graphics_buffer;
|
||||
|
@ -71,7 +71,8 @@ static int resourceType(const QByteArray &key)
|
||||
QByteArrayLiteral("startupid"), QByteArrayLiteral("traywindow"),
|
||||
QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen"),
|
||||
QByteArrayLiteral("rootwindow"),
|
||||
QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingEnabled")
|
||||
QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingEnabled"),
|
||||
QByteArrayLiteral("nofonthinting")
|
||||
};
|
||||
const QByteArray *end = names + sizeof(names) / sizeof(names[0]);
|
||||
const QByteArray *result = std::find(names, end, key);
|
||||
@ -281,6 +282,9 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr
|
||||
case GetTimestamp:
|
||||
result = getTimestamp(xcbScreen);
|
||||
break;
|
||||
case NoFontHinting:
|
||||
result = xcbScreen->noFontHinting() ? this : 0; //qboolptr...
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -65,7 +65,8 @@ public:
|
||||
X11Screen,
|
||||
RootWindow,
|
||||
ScreenSubpixelType,
|
||||
ScreenAntialiasingEnabled
|
||||
ScreenAntialiasingEnabled,
|
||||
NoFontHinting
|
||||
};
|
||||
|
||||
QXcbNativeInterface();
|
||||
|
@ -53,7 +53,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
|
||||
, m_screen(scr)
|
||||
, m_crtc(output ? output->crtc : 0)
|
||||
, m_outputName(outputName)
|
||||
, m_sizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize())
|
||||
, m_outputSizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize())
|
||||
, m_virtualSize(scr->width_in_pixels, scr->height_in_pixels)
|
||||
, m_virtualSizeMillimeters(scr->width_in_millimeters, scr->height_in_millimeters)
|
||||
, m_orientation(Qt::PrimaryOrientation)
|
||||
@ -62,6 +62,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
|
||||
, m_forcedDpi(-1)
|
||||
, m_devicePixelRatio(1)
|
||||
, m_hintStyle(QFontEngine::HintStyle(-1))
|
||||
, m_noFontHinting(false)
|
||||
, m_subpixelType(QFontEngine::SubpixelAntialiasingType(-1))
|
||||
, m_antialiasingEnabled(-1)
|
||||
, m_xSettings(0)
|
||||
@ -71,18 +72,27 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
|
||||
|
||||
updateGeometry(output ? output->timestamp : 0);
|
||||
updateRefreshRate();
|
||||
|
||||
const int dpr = int(devicePixelRatio());
|
||||
// On VNC, it can be that physical size is unknown while
|
||||
// virtual size is known (probably back-calculated from DPI and resolution)
|
||||
if (m_sizeMillimeters.isEmpty())
|
||||
m_sizeMillimeters = m_virtualSizeMillimeters;
|
||||
if (m_geometry.isEmpty())
|
||||
if (m_geometry.isEmpty()) {
|
||||
m_geometry = QRect(QPoint(), m_virtualSize/dpr);
|
||||
m_nativeGeometry = QRect(QPoint(), m_virtualSize);
|
||||
}
|
||||
if (m_availableGeometry.isEmpty())
|
||||
m_availableGeometry = m_geometry;
|
||||
|
||||
readXResources();
|
||||
|
||||
// disable font hinting when we do UI scaling
|
||||
static bool dpr_scaling_enabled = (qgetenv("QT_DEVICE_PIXEL_RATIO").toInt() > 1
|
||||
|| qgetenv("QT_DEVICE_PIXEL_RATIO").toLower() == "auto");
|
||||
if (dpr_scaling_enabled)
|
||||
m_noFontHinting = true;
|
||||
|
||||
#ifdef Q_XCB_DEBUG
|
||||
qDebug();
|
||||
qDebug("Screen output %s of xcb screen %d:", m_outputName.toUtf8().constData(), m_number);
|
||||
@ -93,6 +103,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
|
||||
qDebug(" virtual height.: %lf", m_virtualSizeMillimeters.height());
|
||||
qDebug(" virtual geom...: %d x %d", m_virtualSize.width(), m_virtualSize.height());
|
||||
qDebug(" avail virt geom: %d x %d +%d +%d", m_availableGeometry.width(), m_availableGeometry.height(), m_availableGeometry.x(), m_availableGeometry.y());
|
||||
qDebug(" orientation....: %d", m_orientation);
|
||||
qDebug(" pixel ratio....: %d", m_devicePixelRatio);
|
||||
qDebug(" depth..........: %d", screen()->root_depth);
|
||||
qDebug(" white pixel....: %x", screen()->white_pixel);
|
||||
@ -313,8 +324,14 @@ QDpi QXcbScreen::logicalDpi() const
|
||||
if (m_forcedDpi > 0)
|
||||
return QDpi(m_forcedDpi/dpr, m_forcedDpi/dpr);
|
||||
|
||||
return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width() / dpr,
|
||||
Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height() / dpr);
|
||||
static const bool auto_dpr = qgetenv("QT_DEVICE_PIXEL_RATIO").toLower() == "auto";
|
||||
if (auto_dpr) {
|
||||
return QDpi(Q_MM_PER_INCH * m_geometry.width() / m_sizeMillimeters.width(),
|
||||
Q_MM_PER_INCH * m_geometry.height() / m_sizeMillimeters.height());
|
||||
} else {
|
||||
return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width() / dpr,
|
||||
Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height() / dpr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -413,6 +430,24 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp)
|
||||
if (crtc) {
|
||||
xGeometry = QRect(crtc->x, crtc->y, crtc->width, crtc->height);
|
||||
xAvailableGeometry = xGeometry;
|
||||
switch (crtc->rotation) {
|
||||
case XCB_RANDR_ROTATION_ROTATE_0: // xrandr --rotate normal
|
||||
m_orientation = Qt::LandscapeOrientation;
|
||||
m_sizeMillimeters = m_outputSizeMillimeters;
|
||||
break;
|
||||
case XCB_RANDR_ROTATION_ROTATE_90: // xrandr --rotate left
|
||||
m_orientation = Qt::PortraitOrientation;
|
||||
m_sizeMillimeters = m_outputSizeMillimeters.transposed();
|
||||
break;
|
||||
case XCB_RANDR_ROTATION_ROTATE_180: // xrandr --rotate inverted
|
||||
m_orientation = Qt::InvertedLandscapeOrientation;
|
||||
m_sizeMillimeters = m_outputSizeMillimeters;
|
||||
break;
|
||||
case XCB_RANDR_ROTATION_ROTATE_270: // xrandr --rotate right
|
||||
m_orientation = Qt::InvertedPortraitOrientation;
|
||||
m_sizeMillimeters = m_outputSizeMillimeters.transposed();
|
||||
break;
|
||||
}
|
||||
free(crtc);
|
||||
}
|
||||
}
|
||||
@ -441,6 +476,7 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp)
|
||||
m_devicePixelRatio = qRound(dpi/96);
|
||||
const int dpr = int(devicePixelRatio()); // we may override m_devicePixelRatio
|
||||
m_geometry = QRect(xGeometry.topLeft()/dpr, xGeometry.size()/dpr);
|
||||
m_nativeGeometry = QRect(xGeometry.topLeft(), xGeometry.size());
|
||||
m_availableGeometry = QRect(xAvailableGeometry.topLeft()/dpr, xAvailableGeometry.size()/dpr);
|
||||
|
||||
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry);
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
QWindow *topLevelAt(const QPoint &point) const Q_DECL_OVERRIDE;
|
||||
|
||||
QRect geometry() const Q_DECL_OVERRIDE { return m_geometry; }
|
||||
QRect nativeGeometry() const { return m_nativeGeometry; }
|
||||
QRect availableGeometry() const Q_DECL_OVERRIDE {return m_availableGeometry;}
|
||||
int depth() const Q_DECL_OVERRIDE { return m_screen->root_depth; }
|
||||
QImage::Format format() const Q_DECL_OVERRIDE;
|
||||
@ -98,6 +99,7 @@ public:
|
||||
void readXResources();
|
||||
|
||||
QFontEngine::HintStyle hintStyle() const { return m_hintStyle; }
|
||||
bool noFontHinting() const { return m_noFontHinting; }
|
||||
QFontEngine::SubpixelAntialiasingType subpixelType() const { return m_subpixelType; }
|
||||
int antialiasingEnabled() const { return m_antialiasingEnabled; }
|
||||
|
||||
@ -112,8 +114,10 @@ private:
|
||||
xcb_screen_t *m_screen;
|
||||
xcb_randr_crtc_t m_crtc;
|
||||
QString m_outputName;
|
||||
QSizeF m_outputSizeMillimeters;
|
||||
QSizeF m_sizeMillimeters;
|
||||
QRect m_geometry;
|
||||
QRect m_nativeGeometry;
|
||||
QRect m_availableGeometry;
|
||||
QSize m_virtualSize;
|
||||
QSizeF m_virtualSizeMillimeters;
|
||||
@ -130,6 +134,7 @@ private:
|
||||
int m_forcedDpi;
|
||||
int m_devicePixelRatio;
|
||||
QFontEngine::HintStyle m_hintStyle;
|
||||
bool m_noFontHinting;
|
||||
QFontEngine::SubpixelAntialiasingType m_subpixelType;
|
||||
int m_antialiasingEnabled;
|
||||
QXcbXSettings *m_xSettings;
|
||||
|
@ -142,7 +142,7 @@ static inline QRect mapToNative(const QRect &qtRect, int dpr)
|
||||
return QRect(qtRect.x() * dpr, qtRect.y() * dpr, qtRect.width() * dpr, qtRect.height() * dpr);
|
||||
}
|
||||
|
||||
// When converting native rects to Qt rects: round top/left towards the origin and
|
||||
// When mapping expose events to Qt rects: round top/left towards the origin and
|
||||
// bottom/right away from the origin, making sure that we cover the whole widget
|
||||
|
||||
static inline QPoint dpr_floor(const QPoint &p, int dpr)
|
||||
@ -155,11 +155,15 @@ static inline QPoint dpr_ceil(const QPoint &p, int dpr)
|
||||
return QPoint((p.x() + dpr - 1) / dpr, (p.y() + dpr - 1) / dpr);
|
||||
}
|
||||
|
||||
static inline QRect mapFromNative(const QRect &xRect, int dpr)
|
||||
static inline QRect mapExposeFromNative(const QRect &xRect, int dpr)
|
||||
{
|
||||
return QRect(dpr_floor(xRect.topLeft(), dpr), dpr_ceil(xRect.bottomRight(), dpr));
|
||||
}
|
||||
|
||||
static inline QRect mapGeometryFromNative(const QRect &xRect, int dpr)
|
||||
{
|
||||
return QRect(xRect.topLeft() / dpr, xRect.bottomRight() / dpr);
|
||||
}
|
||||
|
||||
// Returns \c true if we should set WM_TRANSIENT_FOR on \a w
|
||||
static inline bool isTransient(const QWindow *w)
|
||||
@ -1670,7 +1674,7 @@ public:
|
||||
return false;
|
||||
if (expose->count == 0)
|
||||
m_pending = false;
|
||||
*m_region |= mapFromNative(QRect(expose->x, expose->y, expose->width, expose->height), m_dpr);
|
||||
*m_region |= mapExposeFromNative(QRect(expose->x, expose->y, expose->width, expose->height), m_dpr);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1698,7 +1702,7 @@ void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event)
|
||||
{
|
||||
const int dpr = int(devicePixelRatio());
|
||||
QRect x_rect(event->x, event->y, event->width, event->height);
|
||||
QRect rect = mapFromNative(x_rect, dpr);
|
||||
QRect rect = mapExposeFromNative(x_rect, dpr);
|
||||
|
||||
if (m_exposeRegion.isEmpty())
|
||||
m_exposeRegion = rect;
|
||||
@ -1783,6 +1787,23 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
|
||||
}
|
||||
}
|
||||
|
||||
// Temporary workaround for bug in QPlatformScreen::screenForNativeGeometry
|
||||
// we need the native geometries to detect our screen, but that's not
|
||||
// available in cross-platform code. Will be fixed properly when highDPI
|
||||
// support is refactored to expose the native coordinate system.
|
||||
|
||||
QPlatformScreen *QXcbWindow::screenForNativeGeometry(const QRect &newGeometry) const
|
||||
{
|
||||
QXcbScreen *currentScreen = static_cast<QXcbScreen*>(screen());
|
||||
if (!parent() && !currentScreen->nativeGeometry().intersects(newGeometry)) {
|
||||
Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) {
|
||||
if (static_cast<QXcbScreen*>(screen)->nativeGeometry().intersects(newGeometry))
|
||||
return screen;
|
||||
}
|
||||
}
|
||||
return currentScreen;
|
||||
}
|
||||
|
||||
void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event)
|
||||
{
|
||||
bool fromSendEvent = (event->response_type & 0x80);
|
||||
@ -1799,15 +1820,23 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
|
||||
}
|
||||
}
|
||||
|
||||
QRect rect = mapFromNative(QRect(pos, QSize(event->width, event->height)), int(devicePixelRatio()));
|
||||
const int dpr = devicePixelRatio();
|
||||
const QRect nativeRect = QRect(pos, QSize(event->width, event->height));
|
||||
const QRect rect = mapGeometryFromNative(nativeRect, dpr);
|
||||
|
||||
QPlatformWindow::setGeometry(rect);
|
||||
QWindowSystemInterface::handleGeometryChange(window(), rect);
|
||||
|
||||
QPlatformScreen *newScreen = screenForGeometry(rect);
|
||||
QPlatformScreen *newScreen = screenForNativeGeometry(nativeRect);
|
||||
if (newScreen != m_screen) {
|
||||
m_screen = static_cast<QXcbScreen*>(newScreen);
|
||||
QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
|
||||
int newDpr = devicePixelRatio();
|
||||
if (newDpr != dpr) {
|
||||
QRect newRect = mapGeometryFromNative(nativeRect, newDpr);
|
||||
QPlatformWindow::setGeometry(newRect);
|
||||
QWindowSystemInterface::handleGeometryChange(window(), newRect);
|
||||
}
|
||||
}
|
||||
|
||||
m_configureNotifyPending = false;
|
||||
|
@ -151,6 +151,8 @@ public:
|
||||
|
||||
virtual void create();
|
||||
virtual void destroy();
|
||||
QPlatformScreen *screenForNativeGeometry(const QRect &newGeometry) const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateSyncRequestCounter();
|
||||
|
||||
|
@ -36,7 +36,9 @@
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QtEndian>
|
||||
|
||||
#ifdef XCB_USE_XLIB
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#endif //XCB_USE_XLIB
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
/* Implementation of http://standards.freedesktop.org/xsettings-spec/xsettings-0.5.html */
|
||||
@ -138,6 +140,7 @@ public:
|
||||
return value + 4 - remainder;
|
||||
}
|
||||
|
||||
#ifdef XCB_USE_XLIB
|
||||
void populateSettings(const QByteArray &xSettings)
|
||||
{
|
||||
if (xSettings.length() < 12)
|
||||
@ -212,6 +215,7 @@ public:
|
||||
}
|
||||
|
||||
}
|
||||
#endif //XCB_USE_XLIB
|
||||
|
||||
QXcbScreen *screen;
|
||||
xcb_window_t x_settings_window;
|
||||
@ -258,8 +262,10 @@ QXcbXSettings::QXcbXSettings(QXcbScreen *screen)
|
||||
const uint32_t event_mask[] = { XCB_EVENT_MASK_STRUCTURE_NOTIFY|XCB_EVENT_MASK_PROPERTY_CHANGE };
|
||||
xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,event,event_mask);
|
||||
|
||||
#ifdef XCB_USE_XLIB
|
||||
d_ptr->populateSettings(d_ptr->getSettings());
|
||||
d_ptr->initialized = true;
|
||||
#endif //XCB_USE_XLIB
|
||||
}
|
||||
|
||||
QXcbXSettings::~QXcbXSettings()
|
||||
@ -279,7 +285,9 @@ void QXcbXSettings::handlePropertyNotifyEvent(const xcb_property_notify_event_t
|
||||
Q_D(QXcbXSettings);
|
||||
if (event->window != d->x_settings_window)
|
||||
return;
|
||||
#ifdef XCB_USE_XLIB
|
||||
d->populateSettings(d->getSettings());
|
||||
#endif //XCB_USE_XLIB
|
||||
}
|
||||
|
||||
void QXcbXSettings::registerCallbackForProperty(const QByteArray &property, QXcbXSettings::PropertyChangeFunc func, void *handle)
|
||||
|
@ -143,7 +143,7 @@ namespace QPrint {
|
||||
QPrint::OutputBinId id;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
struct InputSlotMap {
|
||||
QPrint::InputSlotId id;
|
||||
|
@ -931,6 +931,8 @@ void QWin32PrintEnginePrivate::initHDC()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
updateMetrics();
|
||||
}
|
||||
|
||||
void QWin32PrintEnginePrivate::release()
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user