Merge remote-tracking branch 'origin/master' into api_changes

Conflicts:
	tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp

Change-Id: I884afc3b6d65c6411733a897a1949e19393573a7
This commit is contained in:
Lars Knoll 2012-03-12 21:03:49 +01:00
commit d5098f2802
528 changed files with 71667 additions and 5193 deletions

View File

@ -268,17 +268,19 @@ sub executeTest {
unlink $testOutFile1, $testOutFile2;
# Run qmake && make
executeLoggedCommand($QMAKE, @QMAKEARGS);
my ($makeExitCode, $makeOutput) = executeLoggedCommand($MAKE);
my ($qmakeExitCode, $qmakeOutput) = executeLoggedCommand($QMAKE, @QMAKEARGS);
if ($qmakeExitCode == 0) {
my ($makeExitCode, $makeOutput) = executeLoggedCommand($MAKE);
# If make prints "blah blah blah\nSkipped." we consider this a skipped test
if ($makeOutput !~ qr(^Skipped\.$)ms) {
# Check the test exists (can't reliably execute, especially for cross compilation)
if (-e $testOutFile1 or -e $testOutFile2) {
$ret = 1;
# If make prints "blah blah blah\nSkipped." we consider this a skipped test
if ($makeOutput !~ qr(^Skipped\.$)ms) {
# Check the test exists (can't reliably execute, especially for cross compilation)
if ($makeExitCode == 0 and (-e $testOutFile1 or -e $testOutFile2)) {
$ret = 1;
}
} else {
$ret = 2;
}
} else {
$ret = 2;
}
my $fh;

View File

@ -1,12 +0,0 @@
SOURCES = wayland.cpp
CONFIG -= qt
for(d, QMAKE_INCDIR_WAYLAND) {
exists($$d):INCLUDEPATH += $$d
}
for(p, QMAKE_LIBDIR_WAYLAND) {
exists($$p):LIBS += -L$$p
}
LIBS += $$QMAKE_LIBS_WAYLAND

282
configure vendored
View File

@ -639,17 +639,6 @@ rm -f "$outpath/config.tests/.qmake.cache"
cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
QMakeVar add styles "cde mac motif plastique cleanlooks windows"
QMakeVar add decorations "default windows styled"
QMakeVar add mouse-drivers "pc"
if [ "$UNAME_SYSTEM" = "Linux" ] ; then
QMakeVar add gfx-drivers "linuxfb"
QMakeVar add mouse-drivers "linuxtp"
fi
QMakeVar add kbd-drivers "tty"
if [ "$CFG_DEV" = "yes" ]; then
QMakeVar add kbd-drivers "um"
fi
# QTDIR may be set and point to an old or system-wide Qt installation
unset QTDIR
@ -662,7 +651,6 @@ CFG_CONFIGURE_EXIT_ON_ERROR=yes
CFG_PROFILE=no
CFG_EXCEPTIONS=unspecified
CFG_GUI=auto # (yes|no|auto)
CFG_INCREMENTAL=auto
CFG_QCONFIG=full
CFG_DEBUG=auto
CFG_MYSQL_CONFIG=
@ -705,37 +693,17 @@ CFG_V8SNAPSHOT=auto
CFG_DECLARATIVE_DEBUG=yes
CFG_JAVASCRIPTCORE_JIT=auto
CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen directfb"
CFG_GFX_ON="linuxfb multiscreen"
CFG_GFX_PLUGIN_AVAILABLE=
CFG_GFX_PLUGIN=
CFG_GFX_OFF=
CFG_KBD_AVAILABLE="tty linuxinput qvfb"
CFG_KBD_ON="tty" #default, see QMakeVar above
CFG_MOUSE_AVAILABLE="pc linuxtp linuxinput tslib qvfb"
CFG_MOUSE_ON="pc linuxtp" #default, see QMakeVar above
CFG_ARCH=
CFG_HOST_ARCH=
CFG_KBD_PLUGIN_AVAILABLE=
CFG_KBD_PLUGIN=
CFG_KBD_OFF=
CFG_MOUSE_PLUGIN_AVAILABLE=
CFG_MOUSE_PLUGIN=
CFG_MOUSE_OFF=
CFG_USE_GNUMAKE=no
CFG_IM=yes
CFG_DECORATION_AVAILABLE="styled windows default"
CFG_DECORATION_ON="${CFG_DECORATION_AVAILABLE}" # all on by default
CFG_DECORATION_PLUGIN_AVAILABLE=
CFG_DECORATION_PLUGIN=
CFG_XINPUT2=auto
CFG_XINPUT=runtime
CFG_XKB=auto
CFG_XCB=auto
CFG_XCB_LIMITED=yes
CFG_WAYLAND=auto
CFG_LIBUDEV=auto
CFG_OBSOLETE_WAYLAND=no
CFG_EVDEV=auto
CFG_NIS=auto
CFG_CUPS=auto
@ -849,7 +817,7 @@ QT_CFLAGS_GSTREAMER=
QT_LIBS_GSTREAMER=
#-------------------------------------------------------------------------------
# check SQL drivers, mouse drivers and decorations available in this package
# check SQL drivers available in this package
#-------------------------------------------------------------------------------
# opensource version removes some drivers, so force them to be off
@ -868,47 +836,6 @@ if [ -d "$relpath/src/plugins/sqldrivers" ]; then
done
fi
CFG_DECORATION_PLUGIN_AVAILABLE=
if [ -d "$relpath/src/plugins/decorations" ]; then
for a in "$relpath/src/plugins/decorations/"*; do
if [ -d "$a" ]; then
base_a=`basename "$a"`
CFG_DECORATION_PLUGIN_AVAILABLE="${CFG_DECORATION_PLUGIN_AVAILABLE} ${base_a}"
fi
done
fi
CFG_KBD_PLUGIN_AVAILABLE=
if [ -d "$relpath/src/plugins/kbddrivers" ]; then
for a in "$relpath/src/plugins/kbddrivers/"*; do
if [ -d "$a" ]; then
base_a=`basename "$a"`
CFG_KBD_PLUGIN_AVAILABLE="${CFG_KBD_PLUGIN_AVAILABLE} ${base_a}"
fi
done
fi
CFG_MOUSE_PLUGIN_AVAILABLE=
if [ -d "$relpath/src/plugins/mousedrivers" ]; then
for a in "$relpath/src/plugins/mousedrivers/"*; do
if [ -d "$a" ]; then
base_a=`basename "$a"`
CFG_MOUSE_PLUGIN_AVAILABLE="${CFG_MOUSE_PLUGIN_AVAILABLE} ${base_a}"
fi
done
fi
CFG_GFX_PLUGIN_AVAILABLE=
if [ -d "$relpath/src/plugins/gfxdrivers" ]; then
for a in "$relpath/src/plugins/gfxdrivers/"*; do
if [ -d "$a" ]; then
base_a=`basename "$a"`
CFG_GFX_PLUGIN_AVAILABLE="${CFG_GFX_PLUGIN_AVAILABLE} ${base_a}"
fi
done
CFG_GFX_OFF="$CFG_GFX_AVAILABLE" # assume all off
fi
CFG_IMAGEFORMAT_PLUGIN_AVAILABLE=
if [ -d "$relpath/src/plugins/imageformats" ]; then
for a in "$relpath/src/plugins/imageformats/"*; do
@ -960,7 +887,7 @@ while [ "$#" -gt 0 ]; do
VAL=no
;;
#Qt style yes options
-incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-wayland|-nis|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-debug-and-release|-exceptions|-harfbuzz|-prefix-install|-silent|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-phonon-backend|-audio-backend|-declarative-debug|-javascript-jit|-rpath|-force-pkg-config|-icu|-force-asserts|-testcocoon)
-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-nis|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-debug-and-release|-exceptions|-harfbuzz|-prefix-install|-silent|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-phonon-backend|-audio-backend|-declarative-debug|-javascript-jit|-rpath|-force-pkg-config|-icu|-force-asserts|-testcocoon)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
VAL=yes
;;
@ -1249,20 +1176,6 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
qvfb) # left for commandline compatibility, not documented
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
if [ "$VAL" = "yes" ]; then
QMakeVar add gfx-drivers qvfb
QMakeVar add kbd-drivers qvfb
QMakeVar add mouse-drivers qvfb
CFG_GFX_ON="$CFG_GFX_ON qvfb"
CFG_KBD_ON="$CFG_KBD_ON qvfb"
CFG_MOUSE_ON="$CFG_MOUSE_ON qvfb"
fi
else
UNKNOWN_OPT=yes
fi
;;
nomake)
CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL"
;;
@ -1446,13 +1359,6 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
incremental)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_INCREMENTAL="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
fatal_error)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_CONFIGURE_EXIT_ON_ERROR="$VAL"
@ -1749,11 +1655,7 @@ while [ "$#" -gt 0 ]; do
fi
;;
wayland)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_WAYLAND="$VAL"
else
UNKNOWN_OPT=yes
fi
CFG_OBSOLETE_WAYLAND=yes
;;
libudev)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
@ -1891,7 +1793,7 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
sql-*|gfx-*|decoration-*|kbd-*|mouse-*|imageformat-*)
sql-*|imageformat-*)
# if Qt style options were used, $VAL can be "no", "qt", or "plugin"
# if autoconf style options were used, $VAL can be "yes" or "no"
[ "$VAL" = "yes" ] && VAL=qt
@ -1909,30 +1811,6 @@ while [ "$#" -gt 0 ]; do
sql)
avail="$CFG_SQL_AVAILABLE"
;;
gfx)
avail="$CFG_GFX_AVAILABLE"
if [ "$OPT" = "plugin" ]; then
avail="$CFG_GFX_PLUGIN_AVAILABLE"
fi
;;
decoration)
avail="$CFG_DECORATION_AVAILABLE"
if [ "$OPT" = "plugin" ]; then
avail="$CFG_DECORATION_PLUGIN_AVAILABLE"
fi
;;
kbd)
avail="$CFG_KBD_AVAILABLE"
if [ "$OPT" = "plugin" ]; then
avail="$CFG_KBD_PLUGIN_AVAILABLE"
fi
;;
mouse)
avail="$CFG_MOUSE_AVAILABLE"
if [ "$OPT" = "plugin" ]; then
avail="$CFG_MOUSE_PLUGIN_AVAILABLE"
fi
;;
imageformat)
avail="$CFG_IMAGEFORMAT_PLUGIN_AVAILABLE"
if [ "$OPT" != "plugin" ]; then
@ -1969,36 +1847,12 @@ while [ "$#" -gt 0 ]; do
if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then
if [ "$OPT" = "plugin" ]; then
[ "$VAR" = "decoration" ] && QMakeVar del "${VAR}s" "$VAL"
[ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"` && CFG_DECORATION_PLUGIN="$CFG_DECORATION_PLUGIN ${VAL}"
[ "$VAR" = "kbd" ] && QMakeVar del "${VAR}s" "$VAL"
[ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"` && CFG_KBD_PLUGIN="$CFG_KBD_PLUGIN ${VAL}"
[ "$VAR" = "mouse" ] && QMakeVar del "${VAR}s" "$VAL"
[ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_MOUSE_PLUGIN="$CFG_MOUSE_PLUGIN ${VAL}"
[ "$VAR" = "gfx" ] && QMakeVar del "${VAR}s" "$VAL"
[ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"` && CFG_GFX_PLUGIN="${CFG_GFX_PLUGIN} ${VAL}"
VAR="${VAR}-${OPT}"
else
if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "decoration" ] || [ "$VAR" = "mouse" ]; then
[ "$VAR" = "gfx" ] && CFG_GFX_ON="$CFG_GFX_ON $VAL"
[ "$VAR" = "kbd" ] && CFG_KBD_ON="$CFG_KBD_ON $VAL"
[ "$VAR" = "decoration" ] && CFG_DECORATION_ON="$CFG_DECORATION_ON $VAL"
[ "$VAR" = "mouse" ] && CFG_MOUSE_ON="$CFG_MOUSE_ON $VAL"
VAR="${VAR}-driver"
fi
fi
QMakeVar add "${VAR}s" "${VAL}"
elif [ "$OPT" = "no" ]; then
PLUG_VAR="${VAR}-plugin"
if [ "$VAR" = "gfx" ] || [ "$VAR" = "kbd" ] || [ "$VAR" = "mouse" ]; then
IN_VAR="${VAR}-driver"
else
IN_VAR="${VAR}"
fi
[ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"`
[ "$VAR" = "gfx" ] && CFG_GFX_ON=`echo "${CFG_GFX_ON} " | sed "s,${VAL} ,,g"`
[ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"`
[ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"`
IN_VAR="${VAR}"
QMakeVar del "${IN_VAR}s" "$VAL"
QMakeVar del "${PLUG_VAR}s" "$VAL"
fi
@ -2221,29 +2075,6 @@ if [ "$OPT_SHADOW" = "yes" ]; then
[ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
# symlink the qmake directory
find "$relpath/qmake" | while read a; do
my_a=`echo "$a" | sed "s,^${relpath}/,${outpath}/,"`
if [ '!' -f "$my_a" ]; then
if [ -d "$a" ]; then
# directories are created...
mkdir -p "$my_a"
else
a_dir=`dirname "$my_a"`
[ -d "$a_dir" ] || mkdir -p "$a_dir"
# ... and files are symlinked
case `basename "$a"` in
*.o|*.d|GNUmakefile*|qmake)
;;
*)
rm -f "$my_a"
ln -s "$a" "$my_a"
;;
esac
fi
fi
done
# make a syncqt script that can be used in the shadow
rm -f "$outpath/bin/syncqt"
if [ -x "$relpath/bin/syncqt" ]; then
@ -2528,6 +2359,7 @@ fi
if [ "$PLATFORM" != "$XPLATFORM" ]; then
QT_CROSS_COMPILE=yes
QMAKE_CONFIG="$QMAKE_CONFIG cross_compile"
QTCONFIG_CONFIG="$QTCONFIG_CONFIG cross_compile"
fi
if [ "$BUILD_ON_MAC" = "yes" ]; then
@ -3178,13 +3010,6 @@ if [ "$OPT_HELP" = "yes" ]; then
XCBN=" "
fi
if [ "$CFG_WAYLAND" = "no" ]; then
XWY=" "
XWN="*"
else
XWY="*"
XWN=" "
fi
if [ "$CFG_XINPUT2" = "no" ]; then
X2Y=" "
X2N="*"
@ -3507,9 +3332,6 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
$XCBN -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support.
$XCBY -xcb ............... Compile Xcb support.
$XWN -no-wayland......... Do not compile Wayland support.
$XWY -wayland .......... Compile Wayland support.
EOF
fi # X11
@ -4097,6 +3919,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
#mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
rm -rf mkspecs/default
ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default
mkdir -p "$outpath/qmake" || exit
# fix makefiles
for mkfile in GNUmakefile Makefile; do
EXTRA_LFLAGS=
@ -5271,28 +5094,8 @@ if [ "$PLATFORM_QPA" = "yes" ]; then
fi
# Save these for a check later
ORIG_CFG_WAYLAND="$CFG_WAYLAND"
ORIG_CFG_XCB="$CFG_XCB"
if [ "$CFG_WAYLAND" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client 2>/dev/null; then
QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client 2>/dev/null`
QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client 2>/dev/null`
QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --cflags-only-I wayland-client 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
QMAKE_LIBDIR_WAYLAND=`$PKG_CONFIG --libs-only-L wayland-client 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'`
fi
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/wayland "Wayland" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_WAYLAND $QMAKE_LIBS_WAYLAND; then
CFG_WAYLAND=yes
QT_CONFIG="$QT_CONFIG wayland"
elif [ "$CFG_WAYLAND" = "yes" ]; then
echo "The Wayland functionality test failed!"
exit 1
else
CFG_WAYLAND=no
QMakeVar add DEFINES QT_NO_WAYLAND
fi
fi
if [ "$CFG_LIBUDEV" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists libudev 2>/dev/null; then
QMAKE_INCDIR_LIBUDEV=`$PKG_CONFIG --cflags-only-I libudev 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
@ -5403,46 +5206,32 @@ if [ "$PLATFORM_QPA" = "yes" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then
QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
if [ "$CFG_WAYLAND" = "yes" ]; then
QMAKE_CFLAGS_WAYLAND="$QMAKE_CFLAGS_WAYLAND $QMAKE_CFLAGS_XKBCOMMON"
QMAKE_LIBS_WAYLAND="$QMAKE_LIBS_WAYLAND $QMAKE_LIBS_XKBCOMMON"
fi
QMAKE_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON"
QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON"
else
if [ "$CFG_WAYLAND" = "yes" ]; then
QMAKE_DEFINES_WAYLAND=QT_NO_WAYLAND_XKB
fi
QMAKE_DEFINES_XCB=QT_NO_XCB_XKB
fi
# QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero.
if [ -n "$QMAKE_CFLAGS_WAYLAND" ] || [ -n "$QMAKE_LIBS_WAYLAND" ]; then
QMakeVar set QMAKE_CFLAGS_WAYLAND "$QMAKE_CFLAGS_WAYLAND"
QMakeVar set QMAKE_INCDIR_WAYLAND "$QMAKE_INCDIR_WAYLAND"
QMakeVar set QMAKE_LIBS_WAYLAND "$QMAKE_LIBS_WAYLAND"
QMakeVar set QMAKE_LIBDIR_WAYLAND "$QMAKE_LIBDIR_WAYLAND"
QMakeVar set QMAKE_DEFINES_WAYLAND " $QMAKE_DEFINES_WAYLAND"
fi
if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB"
fi
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/coreservices "CoreServices" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
QT_CONFIG="$QT_CONFIG coreservices"
else
QMakeVar add DEFINES QT_NO_CORESERVICES
if [ "$BUILD_ON_MAC" = "yes" ]; then
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/coreservices "CoreServices" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
QT_CONFIG="$QT_CONFIG coreservices"
else
QMakeVar add DEFINES QT_NO_CORESERVICES
fi
fi
if [ "$PLATFORM_QPA" = "yes" ] && [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ]; then
if [ "$CFG_XCB" = "no" ] && [ "$CFG_WAYLAND" = "no" ]; then
if [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_WAYLAND" = "auto" ]; then
if [ "$CFG_XCB" = "no" ]; then
if [ "$ORIG_CFG_XCB" = "auto" ]; then
echo "No QPA platform plugin enabled!"
echo " If you really want to build without a QPA platform plugin you must pass"
echo " -no-xcb and -no-wayland to configure. Doing this will produce a Qt that"
echo " -no-xcb. Doing this will produce a Qt that"
echo " cannot run GUI applications."
echo " The dependencies needed for xcb to build are listed in"
echo " src/plugins/platforms/xcb/README"
@ -5948,8 +5737,6 @@ if [ "$CFG_GUI" = "auto" ]; then
fi
if [ "$CFG_GUI" = "no" ]; then
QT_CONFIG="$QT_CONFIG no-gui"
else
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GUI"
fi
@ -6722,16 +6509,11 @@ QT_BUILD_TREE = \$\$quote($outpath)
QT_BUILD_PARTS = $CFG_BUILD_PARTS
#local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
QMAKE_MOC = \$\$QT_BUILD_TREE/bin/moc
QMAKE_UIC = \$\$QT_BUILD_TREE/bin/uic
QMAKE_RCC = \$\$QT_BUILD_TREE/bin/rcc
QMAKE_INCDIR_QT = \$\$QT_BUILD_TREE/include
QMAKE_LIBDIR_QT = \$\$QT_BUILD_TREE/lib
include(\$\$PWD/mkspecs/qmodule.pri)
CONFIG += $QMAKE_CONFIG dylib depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
QMAKE_ABSOLUTE_SOURCE_ROOT = \$\$QT_SOURCE_TREE
QMAKE_MOC_SRC = \$\$QT_BUILD_TREE/src/moc
EOF
@ -6742,21 +6524,6 @@ else
echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
fi
# incrementals
INCREMENTAL=""
[ "$CFG_INCREMENTAL" = "auto" ] && "$WHICH" p4 >/dev/null 2>&1 && [ "$CFG_DEV" = "yes" ] && CFG_INCREMENTAL="yes"
if [ "$CFG_INCREMENTAL" = "yes" ]; then
find "$relpath" -perm u+w -mtime -3 | grep 'cpp$' | while read f; do
# don't need to worry about generated files
[ -r `echo $f | sed "s,cpp$,ui,"` ] && continue
basename "$f" | grep '^moc_' >/dev/null 2>&1 && continue
# done
INCREMENTAL="$INCREMENTAL `basename \"$f\" | sed 's,.cpp,.o,'`"
done
[ '!' -z "$INCREMENTAL" ] && echo "QMAKE_INCREMENTAL += $INCREMENTAL" >> "$CACHEFILE.tmp"
[ -r "$outpath/.qmake.incremental" ] && echo "include($outpath/.qmake.incremental)" >> "$CACHEFILE.tmp"
fi
# replace .qmake.cache if it differs from the newly created temp file
if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then
rm -f "$CACHEFILE.tmp"
@ -6839,7 +6606,6 @@ if [ "$OPT_VERBOSE" = "yes" ]; then
echo "qmake switches ......... $QMAKE_SWITCHES"
fi
[ "$CFG_INCREMENTAL" = "yes" ] && [ '!' -z "$INCREMENTAL" ] && echo "Incremental ............ $INCREMENTAL"
echo "Build .................. $CFG_BUILD_PARTS"
echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG"
if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
@ -7169,7 +6935,7 @@ for file in .projects .projects.3; do
fi
SPEC=$XQMAKESPEC ;;
*/qmake/qmake.pro) continue ;;
*tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*) SPEC=$QMAKESPEC ;;
*tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*tools/qdoc*) SPEC=$QMAKESPEC ;;
*) if [ "$CFG_NOPROCESS" = "yes" ]; then
continue
else
@ -7264,6 +7030,18 @@ cat <<EOF
EOF
fi
#-------------------------------------------------------------------------------
# check if the user passed the obsoleted -wayland or -no-wayland flag
#-------------------------------------------------------------------------------
if [ "$CFG_OBSOLETE_WAYLAND" = "yes" ]; then
cat <<EOF
NOTICE: The -wayland and -no-wayland flags are now obsolete
All configuring of QtWayland plugin and QtCompositor happens in the module
EOF
fi
#-------------------------------------------------------------------------------
# finally save the executed command to another script
#-------------------------------------------------------------------------------

View File

@ -118,7 +118,7 @@ Optimizations
SystemGc from the CCoeControl we are currently painting on instead.
- qeventdispatcher_s60.cpp
* Stopped using Active Objects to recieve events, we get them from
* Stopped using Active Objects to receive events, we get them from
C*AppUi and CCoeControl instead.
- QWidget

5
dist/changes-5.0.0 vendored
View File

@ -219,7 +219,7 @@ information about a particular change.
an entirely pristine context.
* Configure's -sysroot and -hostprefix are now handled slightly differently.
The QT_INSTALL_... properties are now automatically prefixed with the sysroot;
the raw values are available as QT_RAW_INSTALL_... and the sysroot as QT_SYSROOT.
the raw values are available as QT_INSTALL_.../raw and the sysroot as QT_SYSROOT.
The new QT_HOST_... properties can be used to refer to the Qt host tools.
* Several functions and built-in variables were modified to return normalized paths.
@ -334,6 +334,9 @@ QtCore
QRegularExpressionMatchIterator. They aim to replace QRegExp with a more
powerful and flexible regular expression engine.
* QEvent::AccessibilityPrepare, AccessibilityHelp and AccessibilityDescription removed:
* The enum values simply didn't make sense in the first place and should simply be dropped.
QtGui
-----
* Accessibility has been refactored. The hierachy of accessible objects is implemented via

View File

@ -41,6 +41,7 @@
#include "animation.h"
#include <QPointF>
#include <QVector>
#include <QIODevice>
#include <QDataStream>
@ -57,11 +58,7 @@ public:
void setNodeCount(int nodeCount)
{
while (nodeCount > m_nodePositions.size())
m_nodePositions.append(QPointF());
while (nodeCount < m_nodePositions.size())
m_nodePositions.removeLast();
m_nodePositions.resize(nodeCount);
}
QPointF nodePos(int idx) const
@ -75,7 +72,7 @@ public:
}
private:
QList<QPointF> m_nodePositions;
QVector<QPointF> m_nodePositions;
};
Animation::Animation()

View File

@ -1,6 +1,6 @@
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = screenshot
SUBDIRS = screenshot systray
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/desktop

View File

@ -102,7 +102,7 @@ void Screenshot::saveScreenshot()
.arg(format.toUpper())
.arg(format));
if (!fileName.isEmpty())
originalPixmap.save(fileName, format.toAscii());
originalPixmap.save(fileName, format.toAscii().constData());
}
//! [3]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,63 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QApplication>
#include <QMessageBox>
#include "window.h"
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(systray);
QApplication app(argc, argv);
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
QMessageBox::critical(0, QObject::tr("Systray"),
QObject::tr("I couldn't detect any system tray "
"on this system."));
return 1;
}
QApplication::setQuitOnLastWindowClosed(false);
Window window;
window.show();
return app.exec();
}

View File

@ -0,0 +1,14 @@
HEADERS = window.h
SOURCES = main.cpp \
window.cpp
RESOURCES = systray.qrc
QT += widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/desktop/systray
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS systray.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/desktop/systray
INSTALLS += target sources
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -0,0 +1,7 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>images/bad.png</file>
<file>images/heart.png</file>
<file>images/trash.png</file>
</qresource>
</RCC>

View File

@ -0,0 +1,270 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "window.h"
#include <QtGui>
#include <QAction>
#include <QCheckBox>
#include <QComboBox>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QMenu>
#include <QPushButton>
#include <QSpinBox>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QMessageBox>
//! [0]
Window::Window()
{
createIconGroupBox();
createMessageGroupBox();
iconLabel->setMinimumWidth(durationLabel->sizeHint().width());
createActions();
createTrayIcon();
connect(showMessageButton, SIGNAL(clicked()), this, SLOT(showMessage()));
connect(showIconCheckBox, SIGNAL(toggled(bool)),
trayIcon, SLOT(setVisible(bool)));
connect(iconComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(setIcon(int)));
connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(iconGroupBox);
mainLayout->addWidget(messageGroupBox);
setLayout(mainLayout);
iconComboBox->setCurrentIndex(1);
trayIcon->show();
setWindowTitle(tr("Systray"));
resize(400, 300);
}
//! [0]
//! [1]
void Window::setVisible(bool visible)
{
minimizeAction->setEnabled(visible);
maximizeAction->setEnabled(!isMaximized());
restoreAction->setEnabled(isMaximized() || !visible);
QDialog::setVisible(visible);
}
//! [1]
//! [2]
void Window::closeEvent(QCloseEvent *event)
{
if (trayIcon->isVisible()) {
QMessageBox::information(this, tr("Systray"),
tr("The program will keep running in the "
"system tray. To terminate the program, "
"choose <b>Quit</b> in the context menu "
"of the system tray entry."));
hide();
event->ignore();
}
}
//! [2]
//! [3]
void Window::setIcon(int index)
{
QIcon icon = iconComboBox->itemIcon(index);
trayIcon->setIcon(icon);
setWindowIcon(icon);
trayIcon->setToolTip(iconComboBox->itemText(index));
}
//! [3]
//! [4]
void Window::iconActivated(QSystemTrayIcon::ActivationReason reason)
{
switch (reason) {
case QSystemTrayIcon::Trigger:
case QSystemTrayIcon::DoubleClick:
iconComboBox->setCurrentIndex((iconComboBox->currentIndex() + 1)
% iconComboBox->count());
break;
case QSystemTrayIcon::MiddleClick:
showMessage();
break;
default:
;
}
}
//! [4]
//! [5]
void Window::showMessage()
{
QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::MessageIcon(
typeComboBox->itemData(typeComboBox->currentIndex()).toInt());
trayIcon->showMessage(titleEdit->text(), bodyEdit->toPlainText(), icon,
durationSpinBox->value() * 1000);
}
//! [5]
//! [6]
void Window::messageClicked()
{
QMessageBox::information(0, tr("Systray"),
tr("Sorry, I already gave what help I could.\n"
"Maybe you should try asking a human?"));
}
//! [6]
void Window::createIconGroupBox()
{
iconGroupBox = new QGroupBox(tr("Tray Icon"));
iconLabel = new QLabel("Icon:");
iconComboBox = new QComboBox;
iconComboBox->addItem(QIcon(":/images/bad.svg"), tr("Bad"));
iconComboBox->addItem(QIcon(":/images/heart.svg"), tr("Heart"));
iconComboBox->addItem(QIcon(":/images/trash.svg"), tr("Trash"));
showIconCheckBox = new QCheckBox(tr("Show icon"));
showIconCheckBox->setChecked(true);
QHBoxLayout *iconLayout = new QHBoxLayout;
iconLayout->addWidget(iconLabel);
iconLayout->addWidget(iconComboBox);
iconLayout->addStretch();
iconLayout->addWidget(showIconCheckBox);
iconGroupBox->setLayout(iconLayout);
}
void Window::createMessageGroupBox()
{
messageGroupBox = new QGroupBox(tr("Balloon Message"));
typeLabel = new QLabel(tr("Type:"));
typeComboBox = new QComboBox;
typeComboBox->addItem(tr("None"), QSystemTrayIcon::NoIcon);
typeComboBox->addItem(style()->standardIcon(
QStyle::SP_MessageBoxInformation), tr("Information"),
QSystemTrayIcon::Information);
typeComboBox->addItem(style()->standardIcon(
QStyle::SP_MessageBoxWarning), tr("Warning"),
QSystemTrayIcon::Warning);
typeComboBox->addItem(style()->standardIcon(
QStyle::SP_MessageBoxCritical), tr("Critical"),
QSystemTrayIcon::Critical);
typeComboBox->setCurrentIndex(1);
durationLabel = new QLabel(tr("Duration:"));
durationSpinBox = new QSpinBox;
durationSpinBox->setRange(5, 60);
durationSpinBox->setSuffix(" s");
durationSpinBox->setValue(15);
durationWarningLabel = new QLabel(tr("(some systems might ignore this "
"hint)"));
durationWarningLabel->setIndent(10);
titleLabel = new QLabel(tr("Title:"));
titleEdit = new QLineEdit(tr("Cannot connect to network"));
bodyLabel = new QLabel(tr("Body:"));
bodyEdit = new QTextEdit;
bodyEdit->setPlainText(tr("Don't believe me. Honestly, I don't have a "
"clue.\nClick this balloon for details."));
showMessageButton = new QPushButton(tr("Show Message"));
showMessageButton->setDefault(true);
QGridLayout *messageLayout = new QGridLayout;
messageLayout->addWidget(typeLabel, 0, 0);
messageLayout->addWidget(typeComboBox, 0, 1, 1, 2);
messageLayout->addWidget(durationLabel, 1, 0);
messageLayout->addWidget(durationSpinBox, 1, 1);
messageLayout->addWidget(durationWarningLabel, 1, 2, 1, 3);
messageLayout->addWidget(titleLabel, 2, 0);
messageLayout->addWidget(titleEdit, 2, 1, 1, 4);
messageLayout->addWidget(bodyLabel, 3, 0);
messageLayout->addWidget(bodyEdit, 3, 1, 2, 4);
messageLayout->addWidget(showMessageButton, 5, 4);
messageLayout->setColumnStretch(3, 1);
messageLayout->setRowStretch(4, 1);
messageGroupBox->setLayout(messageLayout);
}
void Window::createActions()
{
minimizeAction = new QAction(tr("Mi&nimize"), this);
connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide()));
maximizeAction = new QAction(tr("Ma&ximize"), this);
connect(maximizeAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
restoreAction = new QAction(tr("&Restore"), this);
connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal()));
quitAction = new QAction(tr("&Quit"), this);
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
}
void Window::createTrayIcon()
{
trayIconMenu = new QMenu(this);
trayIconMenu->addAction(minimizeAction);
trayIconMenu->addAction(maximizeAction);
trayIconMenu->addAction(restoreAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(quitAction);
trayIcon = new QSystemTrayIcon(this);
trayIcon->setContextMenu(trayIconMenu);
}

View File

@ -0,0 +1,112 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef WINDOW_H
#define WINDOW_H
#include <QSystemTrayIcon>
#include <QDialog>
QT_BEGIN_NAMESPACE
class QAction;
class QCheckBox;
class QComboBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QMenu;
class QPushButton;
class QSpinBox;
class QTextEdit;
QT_END_NAMESPACE
//! [0]
class Window : public QDialog
{
Q_OBJECT
public:
Window();
void setVisible(bool visible);
protected:
void closeEvent(QCloseEvent *event);
private slots:
void setIcon(int index);
void iconActivated(QSystemTrayIcon::ActivationReason reason);
void showMessage();
void messageClicked();
private:
void createIconGroupBox();
void createMessageGroupBox();
void createActions();
void createTrayIcon();
QGroupBox *iconGroupBox;
QLabel *iconLabel;
QComboBox *iconComboBox;
QCheckBox *showIconCheckBox;
QGroupBox *messageGroupBox;
QLabel *typeLabel;
QLabel *durationLabel;
QLabel *durationWarningLabel;
QLabel *titleLabel;
QLabel *bodyLabel;
QComboBox *typeComboBox;
QSpinBox *durationSpinBox;
QLineEdit *titleEdit;
QTextEdit *bodyEdit;
QPushButton *showMessageButton;
QAction *minimizeAction;
QAction *maximizeAction;
QAction *restoreAction;
QAction *quitAction;
QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
};
//! [0]
#endif

View File

@ -62,7 +62,7 @@ protected:
private:
int x, y;
QColor color;
QList<QPointF> stuff;
QVector<QPointF> stuff;
};
#endif

View File

@ -99,7 +99,7 @@ void MainWindow::save()
QByteArray codecName = action->data().toByteArray();
QTextStream out(&file);
out.setCodec(codecName);
out.setCodec(codecName.constData());
out << textEdit->toPlainText();
}
}

View File

@ -206,12 +206,12 @@ bool MainWindow::saveFile(const QByteArray &fileFormat)
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"),
initialPath,
tr("%1 Files (*.%2);;All Files (*)")
.arg(QString(fileFormat.toUpper()))
.arg(QString(fileFormat)));
.arg(QString::fromLatin1(fileFormat.toUpper()))
.arg(QString::fromLatin1(fileFormat)));
if (fileName.isEmpty()) {
return false;
} else {
return scribbleArea->saveImage(fileName, fileFormat);
return scribbleArea->saveImage(fileName, fileFormat.constData());
}
}
//! [20]

View File

@ -239,12 +239,12 @@ bool MainWindow::saveFile(const QByteArray &fileFormat)
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"),
initialPath,
tr("%1 Files (*.%2);;All Files (*)")
.arg(QString(fileFormat.toUpper()))
.arg(QString(fileFormat)));
.arg(QString::fromLatin1(fileFormat.toUpper()))
.arg(QString::fromLatin1(fileFormat)));
if (fileName.isEmpty()) {
return false;
} else {
return scribbleArea->saveImage(fileName, fileFormat);
return scribbleArea->saveImage(fileName, fileFormat.constData());
}
}
//! [20]

View File

@ -85,7 +85,7 @@ void StyleSheetEditor::loadStyleSheet(const QString &sheetName)
{
QFile file(":/qss/" + sheetName.toLower() + ".qss");
file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll());
QString styleSheet = QString::fromLatin1(file.readAll());
ui.styleTextEdit->setPlainText(styleSheet);
qApp->setStyleSheet(styleSheet);

View File

@ -38,7 +38,8 @@ QMAKE_LIBS_LIBUDEV = -ludev
QMAKE_CFLAGS_WAYLAND =
QMAKE_INCDIR_WAYLAND =
QMAKE_LIBS_WAYLAND =
QMAKE_LIBS_WAYLAND_CLIENT = -lwayland-client
QMAKE_LIBS_WAYLAND_SERVER = -lwayland-server
QMAKE_LIBDIR_WAYLAND =
QMAKE_DEFINES_WAYLAND =
QMAKE_WAYLAND_SCANNER = wayland-scanner

View File

@ -41,9 +41,6 @@ QMAKE_LFLAGS = -Wl,-rpath-link,$${QNX_DIR}/$${QNX_CPUDIR}/lib -Wl,-rp
QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
QMAKE_RCC = $$[QT_INSTALL_BINS]/rcc
QMAKE_CXX = $$QMAKE_CC -lang-c++

View File

@ -70,10 +70,6 @@ QMAKE_LIBS_OPENGL_ES2 = libGLESv2.lib
QMAKE_LIBS_QT_ENTRY = -lqtmain
QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe
QMAKE_IDL = midl
QMAKE_LIB = lib
QMAKE_RC = rc

View File

@ -48,7 +48,7 @@ CONFIG = lex yacc warn_on debug uic resources $$CONFIG
}
# Let qmake know about the unexpectedly appearing cache file.
contains(QTFWD, -cache-module-fwd):_QMAKE_CACHE_ = $$QMAKE_SYNCQT_OUTDIR/.qmake.cache
exists($$QMAKE_SYNCQT_OUTDIR/.qmake.cache):_QMAKE_CACHE_ = $$QMAKE_SYNCQT_OUTDIR/.qmake.cache
unset(QTFWD)
unset(PRO_BASENAME)

View File

@ -97,12 +97,6 @@ equals(MOC_DIR, .) {
unix:!no_mocdepend {
moc_source.depends += $$first(QMAKE_MOC)
moc_header.depends += $$first(QMAKE_MOC)
!contains(TARGET, moc) { #auto build moc
isEmpty(QMAKE_MOC_SRC):QMAKE_MOC_SRC = "$(QTDIR)/src/tools/moc"
make_moc.target = $$first(QMAKE_MOC)
make_moc.commands = (cd $$QMAKE_MOC_SRC && $(MAKE))
QMAKE_EXTRA_TARGETS += make_moc
}
}
#generate a mocclean

View File

@ -168,12 +168,13 @@ for(QTLIB, QT) {
QT = $$resolve_depends(NEWQT, "QT.")
# Finally actually add the modules
for(QTLIB, QT) {
isEmpty(QT.$${QTLIB}.name) {
QTLIBNAME = $$eval(QT.$${QTLIB}.name)
isEmpty(QTLIBNAME) {
message("Warning: unknown QT module: $$QTLIB")
next()
}
target_qt:isEqual(TARGET, QTLIB) {
target_qt:isEqual(TARGET, $$QTLIBNAME) {
warning($$TARGET cannot have a QT of $$QTLIB)
next()
}
@ -189,7 +190,7 @@ for(QTLIB, QT) {
qt_compat {
!qt_compat_no_warning:QTDIR_build:warning(***USE of COMPAT inside of QTDIR!**) #just for us
INCLUDEPATH *= $$QMAKE_INCDIR_QT/Qt
INCLUDEPATH *= $$QT.core.includes
DEFINES *= QT_COMPAT
}

View File

@ -132,9 +132,11 @@ defineTest(qtAddModule) {
isEmpty(LINKAGE) {
# Make sure we can link to uninstalled libraries
!isEqual(MODULE_LIBS, $$[QT_INSTALL_LIBS]) { ### XXX
QMAKE_LIBDIR *= $$MODULE_LIBS
unix:!mac:QMAKE_LFLAGS *= "-Wl,-rpath-link,$$MODULE_LIBS"
!isEmpty(MODULE_LIBS) {
!isEqual(MODULE_LIBS, $$[QT_INSTALL_LIBS]) { ### XXX
QMAKE_LIBDIR *= $$MODULE_LIBS
unix:!mac:QMAKE_LFLAGS *= "-Wl,-rpath-link,$$MODULE_LIBS"
}
}
if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
win32:LINKAGE = -l$${MODULE_NAME}$${QT_LIBINFIX}d
@ -146,7 +148,7 @@ defineTest(qtAddModule) {
# to give access to sources or include files, and not for linking.
!isEmpty(MODULE_LIBS) {
!isEmpty(QMAKE_LSB) {
QMAKE_LFLAGS *= --lsb-libpath=$$$$QMAKE_LIBDIR_QT
QMAKE_LFLAGS *= --lsb-libpath=$$MODULE_LIBS
QMAKE_LFLAGS *= -L/opt/lsb/lib
QMAKE_LFLAGS *= --lsb-shared-libs=$${MODULE_NAME}$${QT_LIBINFIX}
}

View File

@ -118,24 +118,24 @@ load(qt_installs)
unix|win32-g++* {
CONFIG += create_pc
QMAKE_PKGCONFIG_LIBDIR = $$[QT_RAW_INSTALL_LIBS]
QMAKE_PKGCONFIG_INCDIR = $$[QT_RAW_INSTALL_HEADERS]/$$TARGET
QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_RAW_INSTALL_HEADERS]
QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS/raw]
QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS/raw]/$$TARGET
QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS/raw]
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
include_replace.match = $$QMAKE_INCDIR_QT
include_replace.replace = $$[QT_RAW_INSTALL_HEADERS]
include_replace.replace = $$[QT_INSTALL_HEADERS/raw]
lib_replace.match = $$QMAKE_LIBDIR_QT
lib_replace.replace = $$[QT_RAW_INSTALL_LIBS]
lib_replace.replace = $$[QT_INSTALL_LIBS/raw]
prefix_replace.match = $$QT_BUILD_TREE
prefix_replace.replace = $$[QT_RAW_INSTALL_PREFIX]
prefix_replace.replace = $$[QT_INSTALL_PREFIX/raw]
QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace prefix_replace
}
unix {
CONFIG += create_libtool explicitlib
QMAKE_PRL_LIBDIR = $$[QT_RAW_INSTALL_LIBS] ### XXX
QMAKE_PRL_LIBDIR = $$[QT_INSTALL_LIBS/raw] ### XXX
QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace
QMAKE_LIBTOOL_LIBDIR = $$[QT_RAW_INSTALL_LIBS]
QMAKE_LIBTOOL_LIBDIR = $$[QT_INSTALL_LIBS/raw]
QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace
}

View File

@ -97,7 +97,11 @@ contains(INSTALLS, target) {
# ...
#
for(file, TESTDATA) {
tdi = testdata_install_$${file}
tnam = $$file
tnam ~= s,\\.\\.,dotdot,
tnam ~= s,[?*],wildcard,
tnam ~= s,[^A-Za-z0-9],_,
tdi = testdata_$$tnam
tdif = $${tdi}.files
tdip = $${tdi}.path

View File

@ -1,11 +0,0 @@
isEmpty(QMAKE_DUMPCPP_NAME) {
QMAKE_DUMPCPP_NAME = make_dumpcpp
}
# auto depend on dumpcpp
!contains(TARGET, dumpcpp) {
isEmpty(QMAKE_DUMPCPP_SRC): QMAKE_DUMPCPP_SRC = "$(QTDIR)/tools/activeqt/dumpcpp"
make_dumpcpp.commands = (cd $$QMAKE_DUMPCPP_SRC && $(QMAKE) && $(MAKE))
QMAKE_EXTRA_TARGETS += $$QMAKE_DUMPCPP_NAME
}

View File

@ -75,9 +75,6 @@ QMAKE_LIBS_DYNLOAD =
QMAKE_LIBS_THREAD =
QMAKE_LIBS_NETWORK += -lsocket
QMAKE_LIBS_GUI += -lsocket
QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc.exe
QMAKE_AR = ntox86-ar cqs
QMAKE_RANLIB =

View File

@ -78,9 +78,6 @@ QMAKE_LIBS_THREAD =
QMAKE_LIBS_NETWORK += -lsocket
QMAKE_LIBS_GUI += -lsocket
QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
QMAKE_AR = ar cqs
QMAKE_RANLIB =

View File

@ -74,9 +74,6 @@ QMAKE_LIBS_THREAD =
QMAKE_LIBS_NETWORK += -lsocket
QMAKE_LIBS_GUI += -lsocket
QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
QMAKE_AR = ar cqs
QMAKE_RANLIB =

View File

@ -74,9 +74,6 @@ QMAKE_LIBS_THREAD =
QMAKE_LIBS_NETWORK += -lsocket
QMAKE_LIBS_GUI += -lsocket
QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
QMAKE_AR = ar cqs
QMAKE_RANLIB =

View File

@ -69,10 +69,6 @@ QMAKE_LIBS_QT_ENTRY = -lqtmain
#QMAKE_LIBS_OPENGL =
#QMAKE_LFLAGS_OPENGL = /dopengl32.dll
QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe
QMAKE_IDL = midl
QMAKE_LIB = tlib /C /P256
QMAKE_RC = brcc32 -dQ_CC_BOR

View File

@ -65,7 +65,6 @@ QMAKE_LINK_OBJECT_SCRIPT= object_script
QMAKE_PREFIX_STATICLIB = lib
QMAKE_EXTENSION_STATICLIB = a
QMAKE_LIBS =
QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32
@ -88,12 +87,6 @@ QMAKE_DEL_DIR = rmdir
QMAKE_SYMBOLIC_LINK = ln -s
QMAKE_CHK_DIR_EXISTS = test -d
#QMAKE_IDC = i686-pc-mingw32-idc
QMAKE_MOC = i686-pc-mingw32-moc
QMAKE_RCC = i686-pc-mingw32-rcc
QMAKE_UIC = i686-pc-mingw32-uic
#QMAKE_IDL = midl
QMAKE_LIB = i686-pc-mingw32-ar -ru
QMAKE_RC = i686-pc-mingw32-windres
QMAKE_ZIP = zip -r -9

View File

@ -67,10 +67,6 @@ QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32
QMAKE_LIBS_QT_ENTRY = -lqtmain
QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe
QMAKE_IDL = midl
QMAKE_LIB = lib /NOLOGO
QMAKE_RC = rc

View File

@ -65,7 +65,6 @@ QMAKE_LINK_OBJECT_SCRIPT= object_script
QMAKE_PREFIX_STATICLIB = lib
QMAKE_EXTENSION_STATICLIB = a
QMAKE_LIBS =
QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32
@ -96,10 +95,6 @@ QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqtmain
QMAKE_CHK_DIR_EXISTS = if not exist
}
QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc.exe
QMAKE_IDL = midl
QMAKE_LIB = ar -ru
QMAKE_RC = windres

View File

@ -67,10 +67,6 @@ QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib delayimp.l
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
QMAKE_LIBS_QT_ENTRY = -lqtmain
QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe
QMAKE_IDL = midl
QMAKE_LIB = xilib /NOLOGO
QMAKE_RC = rc

View File

@ -71,10 +71,6 @@ QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32
QMAKE_LIBS_QT_ENTRY = -lqtmain
QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe
QMAKE_IDL = midl
QMAKE_LIB = lib /NOLOGO
QMAKE_RC = rc

View File

@ -73,10 +73,6 @@ QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32
QMAKE_LIBS_QT_ENTRY = -lqtmain
QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe
QMAKE_IDL = midl
QMAKE_LIB = lib /NOLOGO
QMAKE_RC = rc

View File

@ -73,10 +73,6 @@ QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32
QMAKE_LIBS_QT_ENTRY = -lqtmain
QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe
QMAKE_IDL = midl
QMAKE_LIB = lib /NOLOGO
QMAKE_RC = rc

View File

@ -6,6 +6,8 @@ QTSRCS = @QMAKE_QTSRCS@
QMAKESPEC = @QMAKESPEC@
LFLAGS = @QMAKE_LFLAGS@
QMKSRC = $(SOURCE_PATH)/qmake
#qmake code
OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \
mingw_make.o option.o winmakefile.o projectgenerator.o \
@ -70,8 +72,8 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge
$(SOURCE_PATH)/src/corelib/global/qlogging.cpp \
$(QTSRCS)
CPPFLAGS = -g -I. -Igenerators -Igenerators/unix -Igenerators/win32 \
-Igenerators/mac -Igenerators/integrity \
CPPFLAGS = -g -I$(QMKSRC) -I$(QMKSRC)/generators -I$(QMKSRC)/generators/unix -I$(QMKSRC)/generators/win32 \
-I$(QMKSRC)/generators/mac -I$(QMKSRC)/generators/integrity \
-I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \
-I$(BUILD_PATH)/include/QtCore/$(QT_VERSION) -I$(BUILD_PATH)/include/QtCore/$(QT_VERSION)/QtCore \
-I$(BUILD_PATH)/src/corelib/global \
@ -98,7 +100,74 @@ distclean:: clean
depend:
makedepend -D__MAKEDEPEND__ $(CPPFLAGS) $(DEPEND_SRC)
# don't use optimization for these
project.o: $(QMKSRC)/project.cpp $(QMKSRC)/project.h $(QMKSRC)/option.h
$(CXX) -c -o $@ $(CXXFLAGS) $<
property.o: $(QMKSRC)/property.cpp $(QMKSRC)/project.h $(QMKSRC)/option.h
$(CXX) -c -o $@ $(CXXFLAGS) $<
meta.o: $(QMKSRC)/meta.cpp $(QMKSRC)/project.h $(QMKSRC)/option.h
$(CXX) -c -o $@ $(CXXFLAGS) $<
main.o: $(QMKSRC)/main.cpp $(QMKSRC)/project.h
$(CXX) -c -o $@ $(CXXFLAGS) $<
option.o: $(QMKSRC)/option.cpp $(QMKSRC)/option.h
$(CXX) -c -o $@ $(CXXFLAGS) $<
metamakefile.o: $(QMKSRC)/generators/metamakefile.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
xmloutput.o: $(QMKSRC)/generators/xmloutput.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
makefiledeps.o: $(QMKSRC)/generators/makefiledeps.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
makefile.o: $(QMKSRC)/generators/makefile.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
unixmake.o: $(QMKSRC)/generators/unix/unixmake.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
unixmake2.o: $(QMKSRC)/generators/unix/unixmake2.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
winmakefile.o: $(QMKSRC)/generators/win32/winmakefile.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
borland_bmake.o: $(QMKSRC)/generators/win32/borland_bmake.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
mingw_make.o: $(QMKSRC)/generators/win32/mingw_make.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
msvc_objectmodel.o: $(QMKSRC)/generators/win32/msvc_objectmodel.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
msvc_vcproj.o: $(QMKSRC)/generators/win32/msvc_vcproj.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
msbuild_objectmodel.o: $(QMKSRC)/generators/win32/msbuild_objectmodel.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
msvc_vcxproj.o: $(QMKSRC)/generators/win32/msvc_vcxproj.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
msvc_nmake.o: $(QMKSRC)/generators/win32/msvc_nmake.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
pbuilder_pbx.o: $(QMKSRC)/generators/mac/pbuilder_pbx.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
gbuild.o: $(QMKSRC)/generators/integrity/gbuild.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
projectgenerator.o: $(QMKSRC)/generators/projectgenerator.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qtextstream.o: $(SOURCE_PATH)/src/corelib/io/qtextstream.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qtextstream.cpp
@ -246,75 +315,9 @@ qhash.o: $(SOURCE_PATH)/src/corelib/tools/qhash.cpp
qlinkedlist.o: $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp
winmakefile.o: generators/win32/winmakefile.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/win32/winmakefile.cpp
project.o: project.cpp project.h option.h
$(CXX) -c -o $@ $(CXXFLAGS) project.cpp
property.o: property.cpp project.h option.h
$(CXX) -c -o $@ $(CXXFLAGS) property.cpp
meta.o: meta.cpp project.h option.h
$(CXX) -c -o $@ $(CXXFLAGS) meta.cpp
main.o: main.cpp project.h
$(CXX) -c -o $@ $(CXXFLAGS) main.cpp
option.o: option.cpp option.h $(BUILD_PATH)/src/corelib/global/qconfig.cpp
$(CXX) -c -o $@ $(CXXFLAGS) option.cpp
qcryptographichash.o: $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp
metamakefile.o: generators/metamakefile.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/metamakefile.cpp
xmloutput.o: generators/xmloutput.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/xmloutput.cpp
makefiledeps.o: generators/makefiledeps.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/makefiledeps.cpp
makefile.o: generators/makefile.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/makefile.cpp
unixmake.o: generators/unix/unixmake.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/unix/unixmake.cpp
unixmake2.o: generators/unix/unixmake2.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/unix/unixmake2.cpp
borland_bmake.o: generators/win32/borland_bmake.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/win32/borland_bmake.cpp
mingw_make.o: generators/win32/mingw_make.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/win32/mingw_make.cpp
msvc_objectmodel.o: generators/win32/msvc_objectmodel.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_objectmodel.cpp
msvc_vcproj.o: generators/win32/msvc_vcproj.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_vcproj.cpp
msbuild_objectmodel.o: generators/win32/msbuild_objectmodel.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msbuild_objectmodel.cpp
msvc_vcxproj.o: generators/win32/msvc_vcxproj.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_vcxproj.cpp
msvc_nmake.o: generators/win32/msvc_nmake.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_nmake.cpp
pbuilder_pbx.o: generators/mac/pbuilder_pbx.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/mac/pbuilder_pbx.cpp
gbuild.o: generators/integrity/gbuild.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/integrity/gbuild.cpp
projectgenerator.o: generators/projectgenerator.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/projectgenerator.cpp
qxmlstream.o: $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp
@ -324,8 +327,4 @@ qxmlutils.o: $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp
qlogging.o: $(SOURCE_PATH)/src/corelib/global/qlogging.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/global/qlogging.cpp
#default rules
.cpp.o:
$(CXX) -c -o $@ $(CXXFLAGS) $<
# DO NOT DELETE THIS LINE -- make depend depends on it

View File

@ -7,6 +7,8 @@ SOURCE_PATH = ..
BUILD_PATH = ..
!endif
QMKSRC = $(SOURCE_PATH)\qmake
#
# specific stuff for NMake and ICC
#
@ -31,7 +33,7 @@ CFLAGS_EXTRA = /MP
CFLAGS_BARE = -c -Fo./ \
-W3 -nologo -O1 \
$(CFLAGS_EXTRA) \
-I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac -Igenerators\integrity \
-I$(QMKSRC) -I$(QMKSRC)\generators -I$(QMKSRC)\generators\unix -I$(QMKSRC)\generators\win32 -I$(QMKSRC)\generators\mac -I$(QMKSRC)\generators\integrity \
-I$(BUILD_PATH)\include -I$(BUILD_PATH)\include\QtCore -I$(BUILD_PATH)\include\QtCore\$(QT_VERSION) -I$(BUILD_PATH)\include\QtCore\$(QT_VERSION)\QtCore \
-I$(BUILD_PATH)\src\corelib\global \
-I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \

View File

@ -43,9 +43,7 @@ endif
#
CXX = g++
CFLAGS = -c -o$@ -O \
-I. -Igenerators -Igenerators/unix \
-Igenerators/win32 -Igenerators/mac \
-Igenerators/integrity \
-I$(QMKSRC) -I$(QMKSRC)/generators -I$(QMKSRC)/generators/unix -I$(QMKSRC)/generators/win32 -I$(QMKSRC)/generators/mac -I$(QMKSRC)/generators/integrity \
-I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore -I$(BUILD_PATH)/include/QtCore/$(QT_VERSION) -I$(BUILD_PATH)/include/QtCore/$(QT_VERSION)/QtCore \
-I$(BUILD_PATH)/src/corelib/global \
-I$(SOURCE_PATH)/mkspecs/win32-g++ \
@ -132,7 +130,7 @@ qmake.exe: $(OBJS) $(QTOBJS)
$(LINKQMAKE)
-$(COPY) qmake.exe $(BUILD_PATH)\bin\qmake.exe
Makefile: Makefile.win32-g++
Makefile: $(SOURCE_PATH)/qmake/Makefile.win32-g++
@echo "Out of date, please rerun configure"
clean::

View File

@ -306,7 +306,6 @@ MakefileGenerator::setProjectFile(QMakeProject *p)
return;
project = p;
init();
usePlatformDir();
findLibraries();
if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE &&
project->isActiveConfig("link_prl")) //load up prl's'
@ -1028,7 +1027,6 @@ MakefileGenerator::writePrlFile(QTextStream &t)
bool
MakefileGenerator::writeProjectMakefile()
{
usePlatformDir();
QTextStream t(&Option::output);
//header
@ -1146,36 +1144,6 @@ MakefileGenerator::writePrlFile()
}
}
// Manipulate directories, so it's possible to build
// several cross-platform targets concurrently
void
MakefileGenerator::usePlatformDir()
{
QString pltDir(project->first("QMAKE_PLATFORM_DIR"));
if(pltDir.isEmpty())
return;
QChar sep = QDir::separator();
QString slashPltDir = sep + pltDir;
QString dirs[] = { QString("OBJECTS_DIR"), QString("DESTDIR"), QString("QMAKE_PKGCONFIG_DESTDIR"),
QString("SUBLIBS_DIR"), QString("DLLDESTDIR"), QString("QMAKE_LIBTOOL_DESTDIR"),
QString("PRECOMPILED_DIR"), QString("QMAKE_LIBDIR_QT"), QString() };
for(int i = 0; !dirs[i].isEmpty(); ++i) {
QString filePath = project->first(dirs[i]);
project->values(dirs[i]) = QStringList(filePath + (filePath.isEmpty() ? pltDir : slashPltDir));
}
QString libs[] = { QString("QMAKE_LIBS_QT"), QString("QMAKE_LIBS_QT_THREAD"), QString("QMAKE_LIBS_QT_ENTRY"), QString() };
for(int i = 0; !libs[i].isEmpty(); ++i) {
QString filePath = project->first(libs[i]);
int fpi = filePath.lastIndexOf(sep);
if(fpi == -1)
project->values(libs[i]).prepend(pltDir + sep);
else
project->values(libs[i]) = QStringList(filePath.left(fpi) + slashPltDir + filePath.mid(fpi));
}
}
void
MakefileGenerator::writeObj(QTextStream &t, const QString &src)
{

View File

@ -198,9 +198,6 @@ protected:
filterIncludedFiles("GENERATED_SOURCES");
}
//for cross-platform dependent directories
virtual void usePlatformDir();
//for installs
virtual QString defaultInstall(const QString &);

View File

@ -247,7 +247,6 @@ bool VcprojGenerator::writeMakefile(QTextStream &t)
bool VcprojGenerator::writeProjectMakefile()
{
usePlatformDir();
QTextStream t(&Option::output);
// Check if all requirements are fulfilled

View File

@ -579,14 +579,19 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0)
// The spec is already platform-dependent, so no subdirs here.
feature_roots << Option::mkfile::qmakespec + base_concat;
// Also check directly under the root directory of the mkspecs collection
QFileInfo specfi(Option::mkfile::qmakespec);
if (!specfi.isRoot()) {
QDir specdir(specfi.absolutePath());
if (specdir.exists(QLatin1String("features"))) {
for(QStringList::Iterator concat_it = concat.begin();
concat_it != concat.end(); ++concat_it)
feature_roots << (specdir.path() + (*concat_it));
QDir specrootdir(specfi.absolutePath());
while (!specrootdir.isRoot()) {
const QString specrootpath = specrootdir.path();
if (specrootpath.endsWith(mkspecs_concat)) {
if (QFile::exists(specrootpath + base_concat))
for (QStringList::Iterator concat_it = concat.begin();
concat_it != concat.end(); ++concat_it)
feature_roots << (specrootpath + (*concat_it));
break;
}
specrootdir.cdUp();
}
}
for(QStringList::Iterator concat_it = concat.begin();
@ -2782,7 +2787,7 @@ QMakeProject::doVariableReplaceExpand(const QString &str, QHash<QString, QString
unicode != DOT && unicode != UNDERSCORE &&
//unicode != SINGLEQUOTE && unicode != DOUBLEQUOTE &&
(unicode < 'a' || unicode > 'z') && (unicode < 'A' || unicode > 'Z') &&
(unicode < '0' || unicode > '9'))
(unicode < '0' || unicode > '9') && (!term || unicode != '/'))
break;
var.append(QChar(unicode));
if(++i == str_len)

View File

@ -68,18 +68,6 @@ static const struct {
{ "QT_INSTALL_CONFIGURATION", QLibraryInfo::SettingsPath, false },
{ "QT_INSTALL_EXAMPLES", QLibraryInfo::ExamplesPath, false },
{ "QT_INSTALL_DEMOS", QLibraryInfo::ExamplesPath, false }, // Just backwards compat
{ "QT_RAW_INSTALL_PREFIX", QLibraryInfo::PrefixPath, true },
{ "QT_RAW_INSTALL_DATA", QLibraryInfo::DataPath, true },
{ "QT_RAW_INSTALL_DOCS", QLibraryInfo::DocumentationPath, true },
{ "QT_RAW_INSTALL_HEADERS", QLibraryInfo::HeadersPath, true },
{ "QT_RAW_INSTALL_LIBS", QLibraryInfo::LibrariesPath, true },
{ "QT_RAW_INSTALL_BINS", QLibraryInfo::BinariesPath, true },
{ "QT_RAW_INSTALL_TESTS", QLibraryInfo::TestsPath, true },
{ "QT_RAW_INSTALL_PLUGINS", QLibraryInfo::PluginsPath, true },
{ "QT_RAW_INSTALL_IMPORTS", QLibraryInfo::ImportsPath, true },
{ "QT_RAW_INSTALL_TRANSLATIONS", QLibraryInfo::TranslationsPath, true },
{ "QT_RAW_INSTALL_CONFIGURATION", QLibraryInfo::SettingsPath, true },
{ "QT_RAW_INSTALL_EXAMPLES", QLibraryInfo::ExamplesPath, true },
{ "QT_HOST_PREFIX", QLibraryInfo::HostPrefixPath, true },
{ "QT_HOST_DATA", QLibraryInfo::HostDataPath, true },
{ "QT_HOST_BINS", QLibraryInfo::HostBinariesPath, true },
@ -87,10 +75,15 @@ static const struct {
QMakeProperty::QMakeProperty() : settings(0)
{
for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++)
m_values[QString::fromLatin1(propList[i].name)] = propList[i].raw
? QLibraryInfo::rawLocation(propList[i].loc)
: QLibraryInfo::location(propList[i].loc);
for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) {
QString name = QString::fromLatin1(propList[i].name);
QString val = QLibraryInfo::rawLocation(propList[i].loc);
if (!propList[i].raw) {
m_values[name] = QLibraryInfo::location(propList[i].loc);
name += "/raw";
}
m_values[name] = val;
}
}
QMakeProperty::~QMakeProperty()
@ -216,8 +209,13 @@ QMakeProperty::exec()
#ifdef QT_VERSION_STR
specialProps.append("QT_VERSION");
#endif
foreach (QString prop, specialProps)
fprintf(stdout, "%s:%s\n", prop.toLatin1().constData(), value(prop).toLatin1().constData());
foreach (QString prop, specialProps) {
QString val = value(prop);
QString pval = value(prop + "/raw");
fprintf(stdout, "%s:%s\n", prop.toLatin1().constData(), val.toLatin1().constData());
if (!pval.isEmpty() && pval != val)
fprintf(stdout, "%s/raw:%s\n", prop.toLatin1().constData(), pval.toLatin1().constData());
}
return true;
}
for(QStringList::ConstIterator it = Option::prop::properties.begin();

View File

@ -1,6 +1,5 @@
CONFIG += depend_includepath
QMAKE_INCREMENTAL =
SKIP_DEPENDS += qconfig.h qmodules.h
DEFINES += QT_NO_TEXTCODEC QT_NO_LIBRARY QT_NO_STL QT_NO_COMPRESS QT_NO_UNICODETABLES \
QT_NO_GEOM_VARIANT QT_NO_DATASTREAM

View File

@ -96,36 +96,36 @@ CONFIG -= qt
#qmake
qmake.path = $$[QT_HOST_BINS]
win32 {
qmake.files=$$QT_BUILD_TREE/bin/qmake.exe
qmake.files = $$OUT_PWD/bin/qmake.exe
} else {
qmake.files=$$QT_BUILD_TREE/bin/qmake
qmake.files = $$OUT_PWD/bin/qmake
}
INSTALLS += qmake
#syncqt
syncqt.path = $$[QT_HOST_BINS]
syncqt.files=$$QT_BUILD_TREE/bin/syncqt
win32:syncqt.files=$$QT_BUILD_TREE/bin/syncqt.bat
syncqt.files = $$OUT_PWD/bin/syncqt
win32:syncqt.files = $$OUT_PWD/bin/syncqt.bat
INSTALLS += syncqt
#qtmodule-configtests
configtests.path = $$[QT_HOST_BINS]
configtests.files=$$QT_BUILD_TREE/bin/qtmodule-configtests
configtests.files = $$PWD/bin/qtmodule-configtests
INSTALLS += configtests
#mkspecs
mkspecs.path = $$[QT_HOST_DATA]/mkspecs
mkspecs.files=$$QT_BUILD_TREE/mkspecs/qconfig.pri $$QT_BUILD_TREE/mkspecs/qmodule.pri $$files($$QT_SOURCE_TREE/mkspecs/*)
mkspecs.files -= $$QT_SOURCE_TREE/mkspecs/modules
mkspecs.files = $$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$files($$PWD/mkspecs/*)
mkspecs.files -= $$PWD/mkspecs/modules
unix {
DEFAULT_QMAKESPEC = $$QMAKESPEC
DEFAULT_QMAKESPEC ~= s,^.*mkspecs/,,g
mkspecs.commands += $(DEL_FILE) $(INSTALL_ROOT)$$mkspecs.path/default; $(SYMLINK) $$DEFAULT_QMAKESPEC $(INSTALL_ROOT)$$mkspecs.path/default
mkspecs.files -= $$QT_SOURCE_TREE/mkspecs/default
mkspecs.files -= $$PWD/mkspecs/default
}
win32:!equals(QT_BUILD_TREE, $$QT_SOURCE_TREE) {
win32:!equals(OUT_PWD, $$PWD) {
# When shadow building on Windows, the default mkspec only exists in the build tree.
mkspecs.files += $$QT_BUILD_TREE/mkspecs/default
mkspecs.files += $$OUT_PWD/mkspecs/default
}
INSTALLS += mkspecs

View File

@ -1595,6 +1595,9 @@ static HB_Error Lookup_PairPos1( GPOS_Instance* gpi,
if ( index >= ppf1->PairSetCount )
return ERR(HB_Err_Invalid_SubTable);
if (!ppf1->PairSet[index].PairValueCount)
return HB_Err_Not_Covered;
pvr = ppf1->PairSet[index].PairValueRecord;
if ( !pvr )
return ERR(HB_Err_Invalid_SubTable);

View File

@ -233,7 +233,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_w SLJIT_CALL sljit_stack_resize(struct sljit_stac
aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align;
aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align;
if (aligned_new_limit < aligned_old_limit)
#ifdef __QNXNTO__
posix_madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, POSIX_MADV_DONTNEED);
#else
madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, MADV_DONTNEED);
#endif
stack->limit = new_limit;
return 0;
#endif

View File

@ -68,17 +68,4 @@
# endif
#endif
// gcc 3 version has problems with some of the
// map/filter overloads.
#if defined(Q_CC_GNU) && (__GNUC__ < 4)
# define QT_NO_CONCURRENT_MAP
# define QT_NO_CONCURRENT_FILTER
#endif
#if defined (Q_CC_MSVC) && (_MSC_VER < 1300)
# define QT_TYPENAME
#else
# define QT_TYPENAME typename
#endif
#endif // include guard

View File

@ -152,187 +152,187 @@ auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3,
template <typename FunctionObject>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject)
{
return (new StoredFunctorCall0<QT_TYPENAME FunctionObject::result_type, FunctionObject>(functionObject))->start();
return (new StoredFunctorCall0<typename FunctionObject::result_type, FunctionObject>(functionObject))->start();
}
template <typename FunctionObject, typename Arg1>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1)
{
return (new StoredFunctorCall1<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1>(functionObject, arg1))->start();
return (new StoredFunctorCall1<typename FunctionObject::result_type, FunctionObject, Arg1>(functionObject, arg1))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2)
{
return (new StoredFunctorCall2<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2>(functionObject, arg1, arg2))->start();
return (new StoredFunctorCall2<typename FunctionObject::result_type, FunctionObject, Arg1, Arg2>(functionObject, arg1, arg2))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
{
return (new StoredFunctorCall3<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>(functionObject, arg1, arg2, arg3))->start();
return (new StoredFunctorCall3<typename FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>(functionObject, arg1, arg2, arg3))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
{
return (new StoredFunctorCall4<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>(functionObject, arg1, arg2, arg3, arg4))->start();
return (new StoredFunctorCall4<typename FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>(functionObject, arg1, arg2, arg3, arg4))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
{
return (new StoredFunctorCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>(functionObject, arg1, arg2, arg3, arg4, arg5))->start();
return (new StoredFunctorCall5<typename FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>(functionObject, arg1, arg2, arg3, arg4, arg5))->start();
}
template <typename FunctionObject>
QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject)
{
return (new QT_TYPENAME SelectStoredFunctorPointerCall0<QT_TYPENAME FunctionObject::result_type, FunctionObject>::type(functionObject))->start();
return (new typename SelectStoredFunctorPointerCall0<typename FunctionObject::result_type, FunctionObject>::type(functionObject))->start();
}
template <typename FunctionObject, typename Arg1>
QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject, const Arg1 &arg1)
{
return (new QT_TYPENAME SelectStoredFunctorPointerCall1<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1>::type(functionObject, arg1))->start();
return (new typename SelectStoredFunctorPointerCall1<typename FunctionObject::result_type, FunctionObject, Arg1>::type(functionObject, arg1))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2>
QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2)
{
return (new QT_TYPENAME SelectStoredFunctorPointerCall2<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2>::type(functionObject, arg1, arg2))->start();
return (new typename SelectStoredFunctorPointerCall2<typename FunctionObject::result_type, FunctionObject, Arg1, Arg2>::type(functionObject, arg1, arg2))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3>
QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
{
return (new QT_TYPENAME SelectStoredFunctorPointerCall3<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>::type(functionObject, arg1, arg2, arg3))->start();
return (new typename SelectStoredFunctorPointerCall3<typename FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>::type(functionObject, arg1, arg2, arg3))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
{
return (new QT_TYPENAME SelectStoredFunctorPointerCall4<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>::type(functionObject, arg1, arg2, arg3, arg4))->start();
return (new typename SelectStoredFunctorPointerCall4<typename FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>::type(functionObject, arg1, arg2, arg3, arg4))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
QFuture<typename FunctionObject::result_type> run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
{
return (new QT_TYPENAME SelectStoredFunctorPointerCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionObject, arg1, arg2, arg3, arg4, arg5))->start();
return (new typename SelectStoredFunctorPointerCall5<typename FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionObject, arg1, arg2, arg3, arg4, arg5))->start();
}
template <typename T, typename Class>
QFuture<T> run(const Class &object, T (Class::*fn)())
{
return (new QT_TYPENAME SelectStoredMemberFunctionCall0<T, Class>::type(fn, object))->start();
return (new typename SelectStoredMemberFunctionCall0<T, Class>::type(fn, object))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1>
QFuture<T> run(const Class &object, T (Class::*fn)(Param1), const Arg1 &arg1)
{
return (new QT_TYPENAME SelectStoredMemberFunctionCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start();
return (new typename SelectStoredMemberFunctionCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2>
QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2)
{
return (new QT_TYPENAME SelectStoredMemberFunctionCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start();
return (new typename SelectStoredMemberFunctionCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3>
QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
{
return (new QT_TYPENAME SelectStoredMemberFunctionCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start();
return (new typename SelectStoredMemberFunctionCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4>
QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
{
return (new QT_TYPENAME SelectStoredMemberFunctionCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start();
return (new typename SelectStoredMemberFunctionCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5>
QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
{
return (new QT_TYPENAME SelectStoredMemberFunctionCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start();
return (new typename SelectStoredMemberFunctionCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start();
}
template <typename T, typename Class>
QFuture<T> run(const Class &object, T (Class::*fn)() const)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionCall0<T, Class>::type(fn, object))->start();
return (new typename SelectStoredConstMemberFunctionCall0<T, Class>::type(fn, object))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1>
QFuture<T> run(const Class &object, T (Class::*fn)(Param1) const, const Arg1 &arg1)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start();
return (new typename SelectStoredConstMemberFunctionCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2>
QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2) const, const Arg1 &arg1, const Arg2 &arg2)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start();
return (new typename SelectStoredConstMemberFunctionCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3>
QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start();
return (new typename SelectStoredConstMemberFunctionCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4>
QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3, Param4) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start();
return (new typename SelectStoredConstMemberFunctionCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5>
QFuture<T> run(const Class &object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start();
return (new typename SelectStoredConstMemberFunctionCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start();
}
template <typename T, typename Class>
QFuture<T> run(Class *object, T (Class::*fn)())
{
return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall0<T, Class>::type(fn, object))->start();
return (new typename SelectStoredMemberFunctionPointerCall0<T, Class>::type(fn, object))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1>
QFuture<T> run(Class *object, T (Class::*fn)(Param1), const Arg1 &arg1)
{
return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start();
return (new typename SelectStoredMemberFunctionPointerCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2>
QFuture<T> run(Class *object, T (Class::*fn)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2)
{
return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start();
return (new typename SelectStoredMemberFunctionPointerCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3>
QFuture<T> run(Class *object, T (Class::*fn)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
{
return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start();
return (new typename SelectStoredMemberFunctionPointerCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4>
QFuture<T> run(Class *object, T (Class::*fn)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
{
return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start();
return (new typename SelectStoredMemberFunctionPointerCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5>
QFuture<T> run(Class *object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
{
return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start();
return (new typename SelectStoredMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start();
}
template <typename T, typename Class>
QFuture<T> run(const Class *object, T (Class::*fn)() const)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall0<T, Class>::type(fn, object))->start();
return (new typename SelectStoredConstMemberFunctionPointerCall0<T, Class>::type(fn, object))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1>
QFuture<T> run(const Class *object, T (Class::*fn)(Param1) const, const Arg1 &arg1)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start();
return (new typename SelectStoredConstMemberFunctionPointerCall1<T, Class, Param1, Arg1>::type(fn, object, arg1))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2>
QFuture<T> run(const Class *object, T (Class::*fn)(Param1, Param2) const, const Arg1 &arg1, const Arg2 &arg2)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start();
return (new typename SelectStoredConstMemberFunctionPointerCall2<T, Class, Param1, Arg1, Param2, Arg2>::type(fn, object, arg1, arg2))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3>
QFuture<T> run(const Class *object, T (Class::*fn)(Param1, Param2, Param3) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start();
return (new typename SelectStoredConstMemberFunctionPointerCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn, object, arg1, arg2, arg3))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4>
QFuture<T> run(const Class *object, T (Class::*fn)(Param1, Param2, Param3, Param4) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start();
return (new typename SelectStoredConstMemberFunctionPointerCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn, object, arg1, arg2, arg3, arg4))->start();
}
template <typename T, typename Class, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5>
QFuture<T> run(const Class *object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
{
return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start();
return (new typename SelectStoredConstMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start();
}
} //namespace QtConcurrent

View File

@ -38,7 +38,7 @@ unix {
contains(QT_CONFIG,iconv) {
HEADERS += codecs/qiconvcodec_p.h
SOURCES += codecs/qiconvcodec.cpp
blackberry-*-qcc:LIBS_PRIVATE *= -liconv
qnx-*-qcc:LIBS_PRIVATE *= -liconv
} else:contains(QT_CONFIG,gnu-libiconv) {
HEADERS += codecs/qiconvcodec_p.h
SOURCES += codecs/qiconvcodec.cpp

View File

@ -465,7 +465,7 @@ iconv_t QIconvCodec::createIconv_t(const char *to, const char *from)
Q_ASSERT((to == 0 && from != 0) || (to != 0 && from == 0));
iconv_t cd = (iconv_t) -1;
#if defined(__GLIBC__) || defined(GNU_LIBICONV)
#if defined(__GLIBC__) || defined(GNU_LIBICONV) || defined(Q_OS_QNX)
#if defined(Q_OS_QNX)
// on QNX the default locale is UTF-8, and an empty string will cause iconv_open to fail
static const char empty_codeset[] = "UTF-8";

View File

@ -48,6 +48,7 @@
#include "qlist.h"
#include "qfile.h"
#include "qstringlist.h"
#include "qvarlengtharray.h"
#ifdef Q_OS_UNIX
# include "qiconvcodec_p.h"
@ -220,10 +221,7 @@ QString QWindowsLocalCodec::convertToUnicode(const char *chars, int length, Conv
if (!mb || !mblen)
return QString();
const int wclen_auto = 4096;
wchar_t wc_auto[wclen_auto];
int wclen = wclen_auto;
wchar_t *wc = wc_auto;
QVarLengthArray<wchar_t, 4096> wc(4096);
int len;
QString sp;
bool prepend = false;
@ -243,7 +241,7 @@ QString QWindowsLocalCodec::convertToUnicode(const char *chars, int length, Conv
prev[1] = mb[0];
remainingChars = 0;
len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
prev, 2, wc, wclen);
prev, 2, wc.data(), wc.length());
if (len) {
prepend = true;
sp.append(QChar(wc[0]));
@ -254,18 +252,12 @@ QString QWindowsLocalCodec::convertToUnicode(const char *chars, int length, Conv
}
while (!(len=MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
mb, mblen, wc, wclen))) {
mb, mblen, wc.data(), wc.length()))) {
int r = GetLastError();
if (r == ERROR_INSUFFICIENT_BUFFER) {
if (wc != wc_auto) {
qWarning("MultiByteToWideChar: Size changed");
break;
} else {
wclen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
const int wclen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
mb, mblen, 0, 0);
wc = new wchar_t[wclen];
// and try again...
}
wc.resize(wclen);
} else if (r == ERROR_NO_UNICODE_TRANSLATION) {
//find the last non NULL character
while (mblen > 1 && !(mb[mblen-1]))
@ -283,8 +275,10 @@ QString QWindowsLocalCodec::convertToUnicode(const char *chars, int length, Conv
break;
}
}
if (len <= 0)
return QString();
if (wc[len-1] == 0) // len - 1: we don't want terminator
--len;
@ -293,9 +287,7 @@ QString QWindowsLocalCodec::convertToUnicode(const char *chars, int length, Conv
state->state_data[0] = (char)state_data;
state->remainingChars = remainingChars;
}
QString s((QChar*)wc, len);
if (wc != wc_auto)
delete [] wc;
QString s((QChar*)wc.data(), len);
if (prepend) {
return sp+s;
}
@ -359,7 +351,7 @@ QString QWindowsLocalCodec::convertToUnicodeCharByChar(const char *chars, int le
s.append(QChar(ws[i]));
delete [] ws;
#endif
delete mbcs;
delete [] mbcs;
return s;
}

View File

@ -72,6 +72,10 @@ public:
static QTextCodec* codecForLocale();
static void setCodecForLocale(QTextCodec *c);
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED static QTextCodec *codecForTr() { return codecForMib(4); /* Latin1 */ }
#endif
static QTextCodec *codecForHtml(const QByteArray &ba);
static QTextCodec *codecForHtml(const QByteArray &ba, QTextCodec *defaultCodec);

View File

@ -11,7 +11,9 @@ HEADERS += \
global/qnumeric.h \
global/qlogging.h \
global/qtypeinfo.h \
global/qsysinfo.h
global/qsysinfo.h \
global/qisenum.h \
global/qtypetraits.h
SOURCES += \
global/qglobal.cpp \

View File

@ -0,0 +1,64 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qglobal.h>
#ifndef QISENUM_H
#define QISENUM_H
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
#ifndef Q_IS_ENUM
# if defined(Q_CC_GNU) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define Q_IS_ENUM(x) __is_enum(x)
# elif defined(Q_CC_MSVC) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >=140050215)
# define Q_IS_ENUM(x) __is_enum(x)
# else
# include <QtCore/qtypetraits.h>
# define Q_IS_ENUM(x) QtPrivate::is_enum<x>::value
# endif
#endif
QT_END_HEADER
QT_END_NAMESPACE
#endif // QISENUM_H

View File

@ -75,7 +75,7 @@
/*
Alpha family, no revisions or variants
Alpha is bi-endian, use endianness auto-detection described above.
Alpha is bi-endian, use endianness auto-detection implemented below.
*/
// #elif defined(__alpha__) || defined(_M_ALPHA)
// # define Q_PROCESSOR_ALPHA
@ -85,7 +85,7 @@
ARM family, known revisions: V5, V6, and V7
ARM is bi-endian, detect using __ARMEL__ or __ARMEB__, falling back to
auto-detection described above.
auto-detection implemented below.
*/
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
# define Q_PROCESSOR_ARM
@ -154,7 +154,7 @@
/*
Itanium (IA-64) family, no revisions or variants
Itanium is bi-endian, use endianness auto-detection described above.
Itanium is bi-endian, use endianness auto-detection implemented below.
*/
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
# define Q_PROCESSOR_IA64
@ -163,7 +163,7 @@
/*
MIPS family, known revisions: I, II, III, IV, 32, 64
MIPS is bi-endian, use endianness auto-detection described above.
MIPS is bi-endian, use endianness auto-detection implemented below.
*/
#elif defined(__mips) || defined(__mips__) || defined(_M_MRX000)
# define Q_PROCESSOR_MIPS
@ -188,7 +188,13 @@
# if defined(_MIPS_ARCH_MIPS64) || defined(__mips64)
# define Q_PROCESSOR_MIPS_64
# endif
# if defined(__MIPSEL__)
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# elif defined(__MIPSEB__)
# define Q_BYTE_ORDER Q_BIG_ENDIAN
# else
// Q_BYTE_ORDER not defined, use endianness auto-detection
# endif
/*
Power family, known variants: 32- and 64-bit
@ -197,7 +203,7 @@
See http://en.wikipedia.org/wiki/Power_Architecture
and http://en.wikipedia.org/wiki/File:PowerISA-evolution.svg
Power is bi-endian, use endianness auto-detection described above.
Power is bi-endian, use endianness auto-detection implemented below.
*/
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \
@ -225,7 +231,7 @@
/*
SuperH family, optional revision: SH-4A
SuperH is bi-endian, use endianness auto-detection descrived above.
SuperH is bi-endian, use endianness auto-detection implemented below.
*/
// #elif defined(__sh__)
// # define Q_PROCESSOR_SH
@ -249,6 +255,14 @@
#endif
/*
NOTE:
GCC 4.6 added __BYTE_ORDER__, __ORDER_BIG_ENDIAN__, __ORDER_LITTLE_ENDIAN__
and __ORDER_PDP_ENDIAN__ in SVN r165881. If you are using GCC 4.6 or newer,
this code will properly detect your target byte order; if you are not, and
the __LITTLE_ENDIAN__ or __BIG_ENDIAN__ macros are not defined, then this
code will fail to detect the target byte order.
*/
// Some processors support either endian format, try to detect which we are using.
#if !defined(Q_BYTE_ORDER)
# if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == Q_BIG_ENDIAN || __BYTE_ORDER__ == Q_LITTLE_ENDIAN)

View File

@ -80,8 +80,6 @@ public:
# error "Undefined byte order"
# endif
};
#else
# error "Qt not configured correctly, please run configure"
#endif
#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN)
enum WinVersion {

View File

@ -0,0 +1,420 @@
// Copyright (c) 2006, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ----
//
// This code is compiled directly on many platforms, including client
// platforms like Windows, Mac, and embedded systems. Before making
// any changes here, make sure that you're not breaking any platforms.
//
// Define a small subset of tr1 type traits. The traits we define are:
// is_integral
// is_floating_point
// is_pointer
// is_enum
// is_reference
// is_pod
// has_trivial_constructor
// has_trivial_copy
// has_trivial_assign
// has_trivial_destructor
// remove_const
// remove_volatile
// remove_cv
// remove_reference
// add_reference
// remove_pointer
// is_same
// is_convertible
// We can add more type traits as required.
// Changes from the original implementation:
// - Move base types from template_util.h directly into this header.
// - Use Qt macros for long long type differences on Windows.
// - Enclose in QtPrivate namespace.
#ifndef QTYPETRAITS_H
#define QTYPETRAITS_H
#include <utility> // For pair
#include "QtCore/qglobal.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
namespace QtPrivate {
// Types small_ and big_ are guaranteed such that sizeof(small_) <
// sizeof(big_)
typedef char small_;
struct big_ {
char dummy[2];
};
// Identity metafunction.
template <class T>
struct identity_ {
typedef T type;
};
// integral_constant, defined in tr1, is a wrapper for an integer
// value. We don't really need this generality; we could get away
// with hardcoding the integer type to bool. We use the fully
// general integer_constant for compatibility with tr1.
template<class T, T v>
struct integral_constant {
static const T value = v;
typedef T value_type;
typedef integral_constant<T, v> type;
};
template <class T, T v> const T integral_constant<T, v>::value;
// Abbreviations: true_type and false_type are structs that represent boolean
// true and false values. Also define the boost::mpl versions of those names,
// true_ and false_.
typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type;
typedef true_type true_;
typedef false_type false_;
// if_ is a templatized conditional statement.
// if_<cond, A, B> is a compile time evaluation of cond.
// if_<>::type contains A if cond is true, B otherwise.
template<bool cond, typename A, typename B>
struct if_{
typedef A type;
};
template<typename A, typename B>
struct if_<false, A, B> {
typedef B type;
};
// type_equals_ is a template type comparator, similar to Loki IsSameType.
// type_equals_<A, B>::value is true iff "A" is the same type as "B".
//
// New code should prefer base::is_same, defined in base/type_traits.h.
// It is functionally identical, but is_same is the standard spelling.
template<typename A, typename B>
struct type_equals_ : public false_ {
};
template<typename A>
struct type_equals_<A, A> : public true_ {
};
// and_ is a template && operator.
// and_<A, B>::value evaluates "A::value && B::value".
template<typename A, typename B>
struct and_ : public integral_constant<bool, (A::value && B::value)> {
};
// or_ is a template || operator.
// or_<A, B>::value evaluates "A::value || B::value".
template<typename A, typename B>
struct or_ : public integral_constant<bool, (A::value || B::value)> {
};
template <class T> struct is_integral;
template <class T> struct is_floating_point;
template <class T> struct is_pointer;
// MSVC can't compile this correctly, and neither can gcc 3.3.5 (at least)
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
// is_enum uses is_convertible, which is not available on MSVC.
template <class T> struct is_enum;
#endif
template <class T> struct is_reference;
template <class T> struct is_pod;
template <class T> struct has_trivial_constructor;
template <class T> struct has_trivial_copy;
template <class T> struct has_trivial_assign;
template <class T> struct has_trivial_destructor;
template <class T> struct remove_const;
template <class T> struct remove_volatile;
template <class T> struct remove_cv;
template <class T> struct remove_reference;
template <class T> struct add_reference;
template <class T> struct remove_pointer;
template <class T, class U> struct is_same;
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
template <class From, class To> struct is_convertible;
#endif
// is_integral is false except for the built-in integer types. A
// cv-qualified type is integral if and only if the underlying type is.
template <class T> struct is_integral : false_type { };
template<> struct is_integral<bool> : true_type { };
template<> struct is_integral<char> : true_type { };
template<> struct is_integral<unsigned char> : true_type { };
template<> struct is_integral<signed char> : true_type { };
#if defined(_MSC_VER)
// wchar_t is not by default a distinct type from unsigned short in
// Microsoft C.
// See http://msdn2.microsoft.com/en-us/library/dh8che7s(VS.80).aspx
template<> struct is_integral<__wchar_t> : true_type { };
#else
template<> struct is_integral<wchar_t> : true_type { };
#endif
template<> struct is_integral<short> : true_type { };
template<> struct is_integral<unsigned short> : true_type { };
template<> struct is_integral<int> : true_type { };
template<> struct is_integral<unsigned int> : true_type { };
template<> struct is_integral<long> : true_type { };
template<> struct is_integral<unsigned long> : true_type { };
#if defined(Q_OS_WIN) && !defined(Q_CC_GNU)
template<> struct is_integral<__int64> : true_type { };
template<> struct is_integral<unsigned __int64> : true_type { };
#else
template<> struct is_integral<long long> : true_type { };
template<> struct is_integral<unsigned long long> : true_type { };
#endif
template <class T> struct is_integral<const T> : is_integral<T> { };
template <class T> struct is_integral<volatile T> : is_integral<T> { };
template <class T> struct is_integral<const volatile T> : is_integral<T> { };
// is_floating_point is false except for the built-in floating-point types.
// A cv-qualified type is integral if and only if the underlying type is.
template <class T> struct is_floating_point : false_type { };
template<> struct is_floating_point<float> : true_type { };
template<> struct is_floating_point<double> : true_type { };
template<> struct is_floating_point<long double> : true_type { };
template <class T> struct is_floating_point<const T>
: is_floating_point<T> { };
template <class T> struct is_floating_point<volatile T>
: is_floating_point<T> { };
template <class T> struct is_floating_point<const volatile T>
: is_floating_point<T> { };
// is_pointer is false except for pointer types. A cv-qualified type (e.g.
// "int* const", as opposed to "int const*") is cv-qualified if and only if
// the underlying type is.
template <class T> struct is_pointer : false_type { };
template <class T> struct is_pointer<T*> : true_type { };
template <class T> struct is_pointer<const T> : is_pointer<T> { };
template <class T> struct is_pointer<volatile T> : is_pointer<T> { };
template <class T> struct is_pointer<const volatile T> : is_pointer<T> { };
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
namespace internal {
template <class T> struct is_class_or_union {
template <class U> static small_ tester(void (U::*)());
template <class U> static big_ tester(...);
static const bool value = sizeof(tester<T>(0)) == sizeof(small_);
};
// is_convertible chokes if the first argument is an array. That's why
// we use add_reference here.
template <bool NotUnum, class T> struct is_enum_impl
: is_convertible<typename add_reference<T>::type, int> { };
template <class T> struct is_enum_impl<true, T> : false_type { };
} // namespace internal
// Specified by TR1 [4.5.1] primary type categories.
// Implementation note:
//
// Each type is either void, integral, floating point, array, pointer,
// reference, member object pointer, member function pointer, enum,
// union or class. Out of these, only integral, floating point, reference,
// class and enum types are potentially convertible to int. Therefore,
// if a type is not a reference, integral, floating point or class and
// is convertible to int, it's a enum. Adding cv-qualification to a type
// does not change whether it's an enum.
//
// Is-convertible-to-int check is done only if all other checks pass,
// because it can't be used with some types (e.g. void or classes with
// inaccessible conversion operators).
template <class T> struct is_enum
: internal::is_enum_impl<
is_same<T, void>::value ||
is_integral<T>::value ||
is_floating_point<T>::value ||
is_reference<T>::value ||
internal::is_class_or_union<T>::value,
T> { };
template <class T> struct is_enum<const T> : is_enum<T> { };
template <class T> struct is_enum<volatile T> : is_enum<T> { };
template <class T> struct is_enum<const volatile T> : is_enum<T> { };
#endif
// is_reference is false except for reference types.
template<typename T> struct is_reference : false_type {};
template<typename T> struct is_reference<T&> : true_type {};
// We can't get is_pod right without compiler help, so fail conservatively.
// We will assume it's false except for arithmetic types, enumerations,
// pointers and cv-qualified versions thereof. Note that std::pair<T,U>
// is not a POD even if T and U are PODs.
template <class T> struct is_pod
: integral_constant<bool, (is_integral<T>::value ||
is_floating_point<T>::value ||
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
// is_enum is not available on MSVC.
is_enum<T>::value ||
#endif
is_pointer<T>::value)> { };
template <class T> struct is_pod<const T> : is_pod<T> { };
template <class T> struct is_pod<volatile T> : is_pod<T> { };
template <class T> struct is_pod<const volatile T> : is_pod<T> { };
// We can't get has_trivial_constructor right without compiler help, so
// fail conservatively. We will assume it's false except for: (1) types
// for which is_pod is true. (2) std::pair of types with trivial
// constructors. (3) array of a type with a trivial constructor.
// (4) const versions thereof.
template <class T> struct has_trivial_constructor : is_pod<T> { };
template <class T, class U> struct has_trivial_constructor<std::pair<T, U> >
: integral_constant<bool,
(has_trivial_constructor<T>::value &&
has_trivial_constructor<U>::value)> { };
template <class A, int N> struct has_trivial_constructor<A[N]>
: has_trivial_constructor<A> { };
template <class T> struct has_trivial_constructor<const T>
: has_trivial_constructor<T> { };
// We can't get has_trivial_copy right without compiler help, so fail
// conservatively. We will assume it's false except for: (1) types
// for which is_pod is true. (2) std::pair of types with trivial copy
// constructors. (3) array of a type with a trivial copy constructor.
// (4) const versions thereof.
template <class T> struct has_trivial_copy : is_pod<T> { };
template <class T, class U> struct has_trivial_copy<std::pair<T, U> >
: integral_constant<bool,
(has_trivial_copy<T>::value &&
has_trivial_copy<U>::value)> { };
template <class A, int N> struct has_trivial_copy<A[N]>
: has_trivial_copy<A> { };
template <class T> struct has_trivial_copy<const T> : has_trivial_copy<T> { };
// We can't get has_trivial_assign right without compiler help, so fail
// conservatively. We will assume it's false except for: (1) types
// for which is_pod is true. (2) std::pair of types with trivial copy
// constructors. (3) array of a type with a trivial assign constructor.
template <class T> struct has_trivial_assign : is_pod<T> { };
template <class T, class U> struct has_trivial_assign<std::pair<T, U> >
: integral_constant<bool,
(has_trivial_assign<T>::value &&
has_trivial_assign<U>::value)> { };
template <class A, int N> struct has_trivial_assign<A[N]>
: has_trivial_assign<A> { };
// We can't get has_trivial_destructor right without compiler help, so
// fail conservatively. We will assume it's false except for: (1) types
// for which is_pod is true. (2) std::pair of types with trivial
// destructors. (3) array of a type with a trivial destructor.
// (4) const versions thereof.
template <class T> struct has_trivial_destructor : is_pod<T> { };
template <class T, class U> struct has_trivial_destructor<std::pair<T, U> >
: integral_constant<bool,
(has_trivial_destructor<T>::value &&
has_trivial_destructor<U>::value)> { };
template <class A, int N> struct has_trivial_destructor<A[N]>
: has_trivial_destructor<A> { };
template <class T> struct has_trivial_destructor<const T>
: has_trivial_destructor<T> { };
// Specified by TR1 [4.7.1]
template<typename T> struct remove_const { typedef T type; };
template<typename T> struct remove_const<T const> { typedef T type; };
template<typename T> struct remove_volatile { typedef T type; };
template<typename T> struct remove_volatile<T volatile> { typedef T type; };
template<typename T> struct remove_cv {
typedef typename remove_const<typename remove_volatile<T>::type>::type type;
};
// Specified by TR1 [4.7.2] Reference modifications.
template<typename T> struct remove_reference { typedef T type; };
template<typename T> struct remove_reference<T&> { typedef T type; };
template <typename T> struct add_reference { typedef T& type; };
template <typename T> struct add_reference<T&> { typedef T& type; };
// Specified by TR1 [4.7.4] Pointer modifications.
template<typename T> struct remove_pointer { typedef T type; };
template<typename T> struct remove_pointer<T*> { typedef T type; };
template<typename T> struct remove_pointer<T* const> { typedef T type; };
template<typename T> struct remove_pointer<T* volatile> { typedef T type; };
template<typename T> struct remove_pointer<T* const volatile> {
typedef T type; };
// Specified by TR1 [4.6] Relationships between types
template<typename T, typename U> struct is_same : public false_type { };
template<typename T> struct is_same<T, T> : public true_type { };
// Specified by TR1 [4.6] Relationships between types
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3)
namespace internal {
// This class is an implementation detail for is_convertible, and you
// don't need to know how it works to use is_convertible. For those
// who care: we declare two different functions, one whose argument is
// of type To and one with a variadic argument list. We give them
// return types of different size, so we can use sizeof to trick the
// compiler into telling us which function it would have chosen if we
// had called it with an argument of type From. See Alexandrescu's
// _Modern C++ Design_ for more details on this sort of trick.
template <typename From, typename To>
struct ConvertHelper {
static small_ Test(To);
static big_ Test(...);
static From Create();
};
} // namespace internal
// Inherits from true_type if From is convertible to To, false_type otherwise.
template <typename From, typename To>
struct is_convertible
: integral_constant<bool,
sizeof(internal::ConvertHelper<From, To>::Test(
internal::ConvertHelper<From, To>::Create()))
== sizeof(small_)> {
};
#endif
}
QT_END_NAMESPACE
QT_END_HEADER
#endif // QTYPETRAITS_H

View File

@ -1223,12 +1223,11 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent,
/*!
\fn bool QAbstractItemModel::insertRow(int row, const QModelIndex &parent)
\note The base class implementation of this function does nothing and
returns false.
Inserts a single row before the given \a row in the child items of the
\a parent specified.
\note This function calls the virtual method insertRows.
Returns true if the row is inserted; otherwise returns false.
\sa insertRows() insertColumn() removeRow()

View File

@ -122,10 +122,10 @@ QJsonArray &QJsonArray::operator =(const QJsonArray &other)
if (d && !d->ref.deref())
delete d;
d = other.d;
a = other.a;
if (d)
d->ref.ref();
}
a = other.a;
return *this;
}

View File

@ -125,10 +125,10 @@ QJsonObject &QJsonObject::operator =(const QJsonObject &other)
if (d && !d->ref.deref())
delete d;
d = other.d;
o = other.o;
if (d)
d->ref.ref();
}
o = other.o;
return *this;
}

View File

@ -137,7 +137,11 @@ public:
static void installTranslator(QTranslator * messageFile);
static void removeTranslator(QTranslator * messageFile);
#endif
enum Encoding { UnicodeUTF8, Latin1, DefaultCodec = Latin1 };
enum Encoding { UnicodeUTF8, Latin1, DefaultCodec = Latin1
#if QT_DEPRECATED_SINCE(5, 0)
, CodecForTr = Latin1
#endif
};
static QString translate(const char * context,
const char * key,
const char * disambiguation = 0,

View File

@ -375,8 +375,9 @@ void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp,
\sa type(), isRegistered(), Type
*/
const char *QMetaType::typeName(int type)
const char *QMetaType::typeName(int typeId)
{
const uint type = typeId;
// In theory it can be filled during compilation time, but for some reason template code
// that is able to do it causes GCC 4.6 to generate additional 3K of executable code. Probably
// it is not worth of it.
@ -398,7 +399,7 @@ const char *QMetaType::typeName(int type)
} else {
const QVector<QCustomTypeInfo> * const ct = customTypes();
QReadLocker locker(customTypesLock());
return ct && ct->count() > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty()
return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty()
? ct->at(type - QMetaType::User).typeName.constData()
: 0;
}

View File

@ -45,6 +45,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qatomic.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qisenum.h>
#include <new>
@ -210,7 +211,8 @@ public:
NeedsConstruction = 0x1,
NeedsDestruction = 0x2,
MovableType = 0x4,
PointerToQObject = 0x8
PointerToQObject = 0x8,
IsEnumeration = 0x10
};
Q_DECLARE_FLAGS(TypeFlags, TypeFlag)
@ -466,6 +468,8 @@ int qRegisterMetaType(const char *typeName
}
if (QtPrivate::IsPointerToTypeDerivedFromQObject<T>::Value)
flags |= QMetaType::PointerToQObject;
if (Q_IS_ENUM(T))
flags |= QMetaType::IsEnumeration;
return QMetaType::registerType(typeName, qMetaTypeDeleteHelper<T>,
qMetaTypeCreateHelper<T>,

View File

@ -1676,12 +1676,12 @@ void QVariant::load(QDataStream &s)
// by moving all ids down by 97.
typeId -= 97;
} else if (typeId == 69 /* QIcon */) {
// In Qt5 after modularization project this types where moved to a separate module (and ids were downgraded)
// In Qt5 after modularization project these types where moved to a separate module (and ids were downgraded)
typeId = QMetaType::QIcon;
} else if (typeId == 75 /* QSizePolicy */) {
typeId = QMetaType::QSizePolicy;
} else if (typeId >= 70) {
// and as a result this types recieved lower ids too
// and as a result these types received lower ids too
if (typeId <= 74) { // QImage QPolygon QRegion QBitmap QCursor
typeId -=1;
} else if (typeId <= 86) { // QKeySequence QPen QTextLength QTextFormat QMatrix QTransform QMatrix4x4 QVector2D QVector3D QVector4D QQuaternion
@ -1749,12 +1749,12 @@ void QVariant::save(QDataStream &s) const
// by moving all ids down by 97.
typeId += 97;
} else if (typeId == QMetaType::QIcon) {
// In Qt5 after modularization project this types where moved to a separate module (and ids were downgraded)
// In Qt5 after modularization project these types where moved to a separate module (and ids were downgraded)
typeId = 69;
} else if (typeId == QMetaType::QSizePolicy) {
typeId = 75;
} else if (typeId >= QMetaType::QImage) {
// and as a result this types recieved lower ids too
// and as a result these types received lower ids too
if (typeId <= QMetaType::QCursor) {
typeId +=1;
} else if (typeId <= QMetaType::QQuaternion) {
@ -2445,6 +2445,8 @@ bool QVariant::canConvert(int targetTypeId) const
if (currentType == uint(targetTypeId))
return true;
if (targetTypeId < 0 || targetTypeId >= QMetaType::User)
return false;
// FIXME It should be LastCoreType intead of Uuid
if (currentType > int(QMetaType::QUuid) || targetTypeId > int(QMetaType::QUuid)) {

View File

@ -51,6 +51,8 @@
#include <QtCore/QDebug>
#include <QtCore/QLocale>
#include <memory>
QT_BEGIN_NAMESPACE
bool qt_isQMimeTypeDebuggingActivated (false);
@ -62,27 +64,19 @@ bool qt_isQMimeTypeDebuggingActivated (false);
#endif
QMimeTypePrivate::QMimeTypePrivate()
: name()
//, comment()
, localeComments()
, genericIconName()
, iconName()
, globPatterns()
{}
QMimeTypePrivate::QMimeTypePrivate(const QMimeType &other)
: name(other.d->name)
//, comment(other.d->comment)
, localeComments(other.d->localeComments)
, genericIconName(other.d->genericIconName)
, iconName(other.d->iconName)
, globPatterns(other.d->globPatterns)
: name(other.d->name),
localeComments(other.d->localeComments),
genericIconName(other.d->genericIconName),
iconName(other.d->iconName),
globPatterns(other.d->globPatterns)
{}
void QMimeTypePrivate::clear()
{
name.clear();
//comment.clear();
localeComments.clear();
genericIconName.clear();
iconName.clear();
@ -97,7 +91,6 @@ bool QMimeTypePrivate::operator==(const QMimeTypePrivate &other) const
{
DBG();
if (name == other.name &&
//comment == other.comment &&
localeComments == other.localeComments &&
genericIconName == other.genericIconName &&
iconName == other.iconName &&

View File

@ -42,6 +42,7 @@
#ifndef QLOCALE_H
#define QLOCALE_H
#include <QtCore/qvariant.h>
#include <QtCore/qstring.h>
#include <QtCore/qobjectdefs.h>

View File

@ -47,6 +47,8 @@
#include <QtCore/qvector.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qdebug.h>
#include <QtCore/qthreadstorage.h>
#include <QtCore/qglobal.h>
#include <pcre.h>
@ -989,6 +991,47 @@ void QRegularExpressionPrivate::getPatternInfo()
(patternNewlineSetting == PCRE_NEWLINE_ANYCRLF);
}
/*!
\class QPcreJitStackPointer
\internal
Simple "smartpointer" wrapper around a pcre_jit_stack, to be used with
QThreadStorage.
*/
class QPcreJitStackPointer
{
Q_DISABLE_COPY(QPcreJitStackPointer);
public:
QPcreJitStackPointer()
{
// The default JIT stack size in PCRE is 32K,
// we allocate from 32K up to 512K.
stack = pcre16_jit_stack_alloc(32*1024, 512*1024);
}
~QPcreJitStackPointer()
{
if (stack)
pcre16_jit_stack_free(stack);
}
pcre16_jit_stack *stack;
};
Q_GLOBAL_STATIC(QThreadStorage<QPcreJitStackPointer *>, jitStacks)
/*!
\internal
*/
static pcre16_jit_stack *qtPcreCallback(void *)
{
if (jitStacks()->hasLocalData())
return jitStacks()->localData()->stack;
return 0;
}
/*!
\internal
*/
@ -1044,6 +1087,9 @@ pcre16_extra *QRegularExpressionPrivate::optimizePattern()
const char *err;
studyData = pcre16_study(compiledPattern, studyOptions, &err);
if (studyData && studyData->flags & PCRE_EXTRA_EXECUTABLE_JIT)
pcre16_assign_jit_stack(studyData, qtPcreCallback, 0);
if (!studyData && err)
qWarning("QRegularExpressionPrivate::optimizePattern(): pcre_study failed: %s", err);
@ -1060,6 +1106,9 @@ int QRegularExpressionPrivate::captureIndexForName(const QString &name) const
{
Q_ASSERT(!name.isEmpty());
if (!compiledPattern)
return -1;
int index = pcre16_get_stringnumber(compiledPattern, name.utf16());
if (index >= 0)
return index;
@ -1067,6 +1116,32 @@ int QRegularExpressionPrivate::captureIndexForName(const QString &name) const
return -1;
}
/*!
\internal
This is a simple wrapper for pcre16_exec for handling the case in which the
JIT runs out of memory. In that case, we allocate a thread-local JIT stack
and re-run pcre16_exec.
*/
static int pcre16SafeExec(const pcre16 *code, const pcre16_extra *extra,
const unsigned short *subject, int length,
int startOffset, int options,
int *ovector, int ovecsize)
{
int result = pcre16_exec(code, extra, subject, length,
startOffset, options, ovector, ovecsize);
if (result == PCRE_ERROR_JIT_STACKLIMIT && !jitStacks()->hasLocalData()) {
QPcreJitStackPointer *p = new QPcreJitStackPointer;
jitStacks()->setLocalData(p);
result = pcre16_exec(code, extra, subject, length,
startOffset, options, ovector, ovecsize);
}
return result;
}
/*!
\internal
@ -1134,15 +1209,15 @@ QRegularExpressionMatchPrivate *QRegularExpressionPrivate::doMatch(const QString
int result;
if (!previousMatchWasEmpty) {
result = pcre16_exec(compiledPattern, currentStudyData,
subjectUtf16, subjectLength,
offset, pcreOptions,
captureOffsets, captureOffsetsCount);
result = pcre16SafeExec(compiledPattern, currentStudyData,
subjectUtf16, subjectLength,
offset, pcreOptions,
captureOffsets, captureOffsetsCount);
} else {
result = pcre16_exec(compiledPattern, currentStudyData,
subjectUtf16, subjectLength,
offset, pcreOptions | PCRE_NOTEMPTY_ATSTART | PCRE_ANCHORED,
captureOffsets, captureOffsetsCount);
result = pcre16SafeExec(compiledPattern, currentStudyData,
subjectUtf16, subjectLength,
offset, pcreOptions | PCRE_NOTEMPTY_ATSTART | PCRE_ANCHORED,
captureOffsets, captureOffsetsCount);
if (result == PCRE_ERROR_NOMATCH) {
++offset;
@ -1157,10 +1232,10 @@ QRegularExpressionMatchPrivate *QRegularExpressionPrivate::doMatch(const QString
++offset;
}
result = pcre16_exec(compiledPattern, currentStudyData,
subjectUtf16, subjectLength,
offset, pcreOptions,
captureOffsets, captureOffsetsCount);
result = pcre16SafeExec(compiledPattern, currentStudyData,
subjectUtf16, subjectLength,
offset, pcreOptions,
captureOffsets, captureOffsetsCount);
}
}
@ -2131,4 +2206,119 @@ QDebug operator<<(QDebug debug, const QRegularExpressionMatch &match)
}
#endif
// fool lupdate: make it extract those strings for translation, but don't put them
// inside Qt -- they're already inside libpcre (cf. man 3 pcreapi, pcre_compile.c).
#if 0
/* PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Copyright (c) 1997-2012 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
static const char *pcreCompileErrorCodes[] =
{
QT_TRANSLATE_NOOP("QRegularExpression", "no error"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\ at end of pattern"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\c at end of pattern"),
QT_TRANSLATE_NOOP("QRegularExpression", "unrecognized character follows \\"),
QT_TRANSLATE_NOOP("QRegularExpression", "numbers out of order in {} quantifier"),
QT_TRANSLATE_NOOP("QRegularExpression", "number too big in {} quantifier"),
QT_TRANSLATE_NOOP("QRegularExpression", "missing terminating ] for character class"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid escape sequence in character class"),
QT_TRANSLATE_NOOP("QRegularExpression", "range out of order in character class"),
QT_TRANSLATE_NOOP("QRegularExpression", "nothing to repeat"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unexpected repeat"),
QT_TRANSLATE_NOOP("QRegularExpression", "unrecognized character after (? or (?-"),
QT_TRANSLATE_NOOP("QRegularExpression", "POSIX named classes are supported only within a class"),
QT_TRANSLATE_NOOP("QRegularExpression", "missing )"),
QT_TRANSLATE_NOOP("QRegularExpression", "reference to non-existent subpattern"),
QT_TRANSLATE_NOOP("QRegularExpression", "erroffset passed as NULL"),
QT_TRANSLATE_NOOP("QRegularExpression", "unknown option bit(s) set"),
QT_TRANSLATE_NOOP("QRegularExpression", "missing ) after comment"),
QT_TRANSLATE_NOOP("QRegularExpression", "regular expression is too large"),
QT_TRANSLATE_NOOP("QRegularExpression", "failed to get memory"),
QT_TRANSLATE_NOOP("QRegularExpression", "unmatched parentheses"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: code overflow"),
QT_TRANSLATE_NOOP("QRegularExpression", "unrecognized character after (?<"),
QT_TRANSLATE_NOOP("QRegularExpression", "lookbehind assertion is not fixed length"),
QT_TRANSLATE_NOOP("QRegularExpression", "malformed number or name after (?("),
QT_TRANSLATE_NOOP("QRegularExpression", "conditional group contains more than two branches"),
QT_TRANSLATE_NOOP("QRegularExpression", "assertion expected after (?("),
QT_TRANSLATE_NOOP("QRegularExpression", "(?R or (?[+-]digits must be followed by )"),
QT_TRANSLATE_NOOP("QRegularExpression", "unknown POSIX class name"),
QT_TRANSLATE_NOOP("QRegularExpression", "POSIX collating elements are not supported"),
QT_TRANSLATE_NOOP("QRegularExpression", "this version of PCRE is not compiled with PCRE_UTF8 support"),
QT_TRANSLATE_NOOP("QRegularExpression", "character value in \\x{...} sequence is too large"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid condition (?(0)"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\C not allowed in lookbehind assertion"),
QT_TRANSLATE_NOOP("QRegularExpression", "PCRE does not support \\L, \\l, \\N{name}, \\U, or \\u"),
QT_TRANSLATE_NOOP("QRegularExpression", "number after (?C is > 255"),
QT_TRANSLATE_NOOP("QRegularExpression", "closing ) for (?C expected"),
QT_TRANSLATE_NOOP("QRegularExpression", "recursive call could loop indefinitely"),
QT_TRANSLATE_NOOP("QRegularExpression", "unrecognized character after (?P"),
QT_TRANSLATE_NOOP("QRegularExpression", "syntax error in subpattern name (missing terminator)"),
QT_TRANSLATE_NOOP("QRegularExpression", "two named subpatterns have the same name"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid UTF-8 string"),
QT_TRANSLATE_NOOP("QRegularExpression", "support for \\P, \\p, and \\X has not been compiled"),
QT_TRANSLATE_NOOP("QRegularExpression", "malformed \\P or \\p sequence"),
QT_TRANSLATE_NOOP("QRegularExpression", "unknown property name after \\P or \\p"),
QT_TRANSLATE_NOOP("QRegularExpression", "subpattern name is too long (maximum 32 characters)"),
QT_TRANSLATE_NOOP("QRegularExpression", "too many named subpatterns (maximum 10000)"),
QT_TRANSLATE_NOOP("QRegularExpression", "octal value is greater than \\377 (not in UTF-8 mode)"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: overran compiling workspace"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: previously-checked referenced subpattern not found"),
QT_TRANSLATE_NOOP("QRegularExpression", "DEFINE group contains more than one branch"),
QT_TRANSLATE_NOOP("QRegularExpression", "repeating a DEFINE group is not allowed"),
QT_TRANSLATE_NOOP("QRegularExpression", "inconsistent NEWLINE options"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number"),
QT_TRANSLATE_NOOP("QRegularExpression", "a numbered reference must not be zero"),
QT_TRANSLATE_NOOP("QRegularExpression", "an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)"),
QT_TRANSLATE_NOOP("QRegularExpression", "(*VERB) not recognized"),
QT_TRANSLATE_NOOP("QRegularExpression", "number is too big"),
QT_TRANSLATE_NOOP("QRegularExpression", "subpattern name expected"),
QT_TRANSLATE_NOOP("QRegularExpression", "digit expected after (?+"),
QT_TRANSLATE_NOOP("QRegularExpression", "] is an invalid data character in JavaScript compatibility mode"),
QT_TRANSLATE_NOOP("QRegularExpression", "different names for subpatterns of the same number are not allowed"),
QT_TRANSLATE_NOOP("QRegularExpression", "(*MARK) must have an argument"),
QT_TRANSLATE_NOOP("QRegularExpression", "this version of PCRE is not compiled with PCRE_UCP support"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\c must be followed by an ASCII character"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\k is not followed by a braced, angle-bracketed, or quoted name"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unknown opcode in find_fixedlength()"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\N is not supported in a class"),
QT_TRANSLATE_NOOP("QRegularExpression", "too many forward references"),
QT_TRANSLATE_NOOP("QRegularExpression", "disallowed Unicode code point (>= 0xd800 && <= 0xdfff)"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid UTF-16 string")
};
#endif // #if 0
QT_END_NAMESPACE

View File

@ -257,7 +257,8 @@ QT_BEGIN_NAMESPACE
\value SelectionWithin Several changes to a selection has occurred in an item
view.
\value SoundPlayed A sound has been played by an object
\value StateChanged The QAccessible::State of an object has changed.
\omitvalue StateChanged The QAccessible::State of an object has changed.
This value is used internally for the QAccessibleStateChangeEvent.
\value TableCaptionChanged A table caption has been changed.
\value TableColumnDescriptionChanged The description of a table column, typically found in
the column's header, has been changed.
@ -308,6 +309,7 @@ QT_BEGIN_NAMESPACE
\value ColumnHeader A header for a column of data.
\value ComboBox A list of choices that the user can select from.
\value Cursor An object that represents the mouse cursor.
\value Desktop The object represents the desktop or workspace.
\value Dial An object that represents a dial or knob.
\value Dialog A dialog box.
\value Document A document window, usually in an MDI environment.
@ -345,6 +347,7 @@ QT_BEGIN_NAMESPACE
\value StaticText Static text, such as labels for other widgets.
\value StatusBar A status bar.
\value Table A table representing data in a grid of rows and columns.
\value Terminal A terminal or command line interface.
\value TitleBar The title bar caption of a window.
\value ToolBar A tool bar, which groups widgets that the user accesses frequently.
\value ToolTip A tool tip which provides information about other objects.
@ -694,8 +697,31 @@ void QAccessible::updateAccessibility(const QAccessibleEvent &event)
This class should be created on the stack and used as parameter for
\l QAccessible::updateAccessibility().
\sa QAccessibleStateChangedEvent
*/
/*!
\class QAccessibleStateChangedEvent
\brief This subclass of QAccessibleEvent is used to inform about state changes.
\internal
\ingroup accessibility
\inmodule QtGui
This class should be created on the stack and used as parameter for
\l QAccessible::updateAccessibility().
In addition to the regular \l QAccessibleEvent it contains details about which states
changed.
\sa QAccessibleEvent
*/
/*!
\fn QAccessibleStateChangeEvent::changedStates() const
All states that have changed are set to true. This does not reflect the state of the object,
but indicates which states are changed.
Use the \l QAccessibleInterface::state() function to get the current state.
*/
/*!
Returns the QAccessibleInterface associated with the event.

View File

@ -292,6 +292,7 @@ public:
// Additional Qt roles where enum value does not map directly to MSAA:
LayeredPane = 0x0000003F,
Terminal = 0x00000040,
Desktop = 0x00000041,
UserRole = 0x0000ffff
};
@ -436,6 +437,9 @@ public:
Q_ASSERT(obj);
}
virtual ~QAccessibleEvent()
{}
QAccessible::Event type() const { return m_type; }
QObject *object() const { return m_object; }
int child() const { return m_child; }
@ -448,6 +452,21 @@ private:
int m_child;
};
class Q_GUI_EXPORT QAccessibleStateChangeEvent :public QAccessibleEvent
{
public:
inline QAccessibleStateChangeEvent(QAccessible::State state, QObject *obj, int chld = -1)
: QAccessibleEvent(QAccessible::StateChanged, obj, chld), m_changedStates(state)
{}
QAccessible::State changedStates() const {
return m_changedStates;
}
private:
QAccessible::State m_changedStates;
};
#define QAccessibleInterface_iid "org.qt-project.Qt.QAccessibleInterface"
Q_DECLARE_INTERFACE(QAccessibleInterface, QAccessibleInterface_iid)

View File

@ -70,24 +70,6 @@ namespace QAccessible2
LineBoundary,
NoBoundary
};
enum TableModelChangeType {
TableModelChangeInsert,
TableModelChangeDelete,
TableModelChangeUpdate
};
struct TableModelChange {
int firstColumn;
int firstRow;
int lastColumn;
int lastRow;
TableModelChangeType type;
TableModelChange()
: firstColumn(0), firstRow(0), lastColumn(0), lastRow(0), type(TableModelChangeUpdate)
{}
};
}
class Q_GUI_EXPORT QAccessibleTextInterface
@ -230,19 +212,8 @@ public:
virtual bool unselectRow(int row) = 0;
// Unselects one column, leaving other selected columns selected (if any).
virtual bool unselectColumn(int column) = 0;
// Returns the type and extents describing how a table changed.
virtual QAccessible2::TableModelChange modelChange() const = 0;
protected:
// These functions are called when the model changes.
virtual void modelReset() = 0;
virtual void rowsInserted(const QModelIndex &parent, int first, int last) = 0;
virtual void rowsRemoved(const QModelIndex &parent, int first, int last) = 0;
virtual void columnsInserted(const QModelIndex &parent, int first, int last) = 0;
virtual void columnsRemoved(const QModelIndex &parent, int first, int last) = 0;
virtual void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row) = 0;
virtual void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column) = 0;
friend class QAbstractItemView;
friend class QAbstractItemViewPrivate;
};

View File

@ -1,26 +0,0 @@
contains(QT_CONFIG, egl): {
CONFIG += egl
HEADERS += \
egl/qegl_p.h \
egl/qeglcontext_p.h \
egl/qeglproperties_p.h
SOURCES += \
egl/qegl.cpp \
egl/qeglproperties.cpp
unix {
!isEmpty(QMAKE_INCDIR_EGL){
INCLUDEPATH += $$QMAKE_INCDIR_EGL
}
!isEmpty(QMAKE_LIBDIR_EGL){
for(p, QMAKE_LIBDIR_EGL) {
exists($$p):LIBS += -L$$p
}
}
!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL
}
SOURCES += egl/qegl_qpa.cpp
}

View File

@ -1,751 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qwidget.h>
#include <QtCore/qatomic.h>
#include <QtCore/qdebug.h>
#include "qegl_p.h"
#include "qeglcontext_p.h"
QT_BEGIN_NAMESPACE
/*
QEglContextTracker is used to track the EGL contexts that we
create internally in Qt, so that we can call eglTerminate() to
free additional EGL resources when the last context is destroyed.
*/
class QEglContextTracker
{
public:
static void ref() { contexts.ref(); }
static void deref() {
if (!contexts.deref()) {
eglTerminate(QEgl::display());
displayOpen = 0;
}
}
static void setDisplayOpened() { displayOpen = 1; }
static bool displayOpened() { return displayOpen; }
private:
static QBasicAtomicInt contexts;
static QBasicAtomicInt displayOpen;
};
QBasicAtomicInt QEglContextTracker::contexts = Q_BASIC_ATOMIC_INITIALIZER(0);
QBasicAtomicInt QEglContextTracker::displayOpen = Q_BASIC_ATOMIC_INITIALIZER(0);
// Current GL and VG contexts. These are used to determine if
// we can avoid an eglMakeCurrent() after a call to lazyDoneCurrent().
// If a background thread modifies the value, the worst that will
// happen is a redundant eglMakeCurrent() in the foreground thread.
static QEglContext * volatile currentGLContext = 0;
static QEglContext * volatile currentVGContext = 0;
QEglContext::QEglContext()
: apiType(QEgl::OpenGL)
, ctx(EGL_NO_CONTEXT)
, cfg(QEGL_NO_CONFIG)
, currentSurface(EGL_NO_SURFACE)
, current(false)
, ownsContext(true)
, sharing(false)
{
QEglContextTracker::ref();
}
QEglContext::~QEglContext()
{
destroyContext();
if (currentGLContext == this)
currentGLContext = 0;
if (currentVGContext == this)
currentVGContext = 0;
QEglContextTracker::deref();
}
bool QEglContext::isValid() const
{
return (ctx != EGL_NO_CONTEXT);
}
bool QEglContext::isCurrent() const
{
return current;
}
EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options)
{
if ( (devType != QInternal::Pixmap) && ((options & Renderable) == 0))
qWarning("QEgl::defaultConfig() - Only configs for pixmaps make sense to be read-only!");
EGLConfig* targetConfig = 0;
static EGLConfig defaultVGConfigs[] = {
QEGL_NO_CONFIG, // 0 Window Renderable Translucent
QEGL_NO_CONFIG, // 1 Window Renderable Opaque
QEGL_NO_CONFIG, // 2 Pixmap Renderable Translucent
QEGL_NO_CONFIG, // 3 Pixmap Renderable Opaque
QEGL_NO_CONFIG, // 4 Pixmap ReadOnly Translucent
QEGL_NO_CONFIG // 5 Pixmap ReadOnly Opaque
};
if (api == OpenVG) {
if (devType == QInternal::Widget) {
if (options & Translucent)
targetConfig = &(defaultVGConfigs[0]);
else
targetConfig = &(defaultVGConfigs[1]);
} else if (devType == QInternal::Pixmap) {
if (options & Renderable) {
if (options & Translucent)
targetConfig = &(defaultVGConfigs[2]);
else // Opaque
targetConfig = &(defaultVGConfigs[3]);
} else { // Read-only
if (options & Translucent)
targetConfig = &(defaultVGConfigs[4]);
else // Opaque
targetConfig = &(defaultVGConfigs[5]);
}
}
}
static EGLConfig defaultGLConfigs[] = {
QEGL_NO_CONFIG, // 0 Window Renderable Translucent
QEGL_NO_CONFIG, // 1 Window Renderable Opaque
QEGL_NO_CONFIG, // 2 PBuffer Renderable Translucent
QEGL_NO_CONFIG, // 3 PBuffer Renderable Opaque
QEGL_NO_CONFIG, // 4 Pixmap Renderable Translucent
QEGL_NO_CONFIG, // 5 Pixmap Renderable Opaque
QEGL_NO_CONFIG, // 6 Pixmap ReadOnly Translucent
QEGL_NO_CONFIG // 7 Pixmap ReadOnly Opaque
};
if (api == OpenGL) {
if (devType == QInternal::Widget) {
if (options & Translucent)
targetConfig = &(defaultGLConfigs[0]);
else // Opaque
targetConfig = &(defaultGLConfigs[1]);
} else if (devType == QInternal::Pbuffer) {
if (options & Translucent)
targetConfig = &(defaultGLConfigs[2]);
else // Opaque
targetConfig = &(defaultGLConfigs[3]);
} else if (devType == QInternal::Pixmap) {
if (options & Renderable) {
if (options & Translucent)
targetConfig = &(defaultGLConfigs[4]);
else // Opaque
targetConfig = &(defaultGLConfigs[5]);
} else { // ReadOnly
if (options & Translucent)
targetConfig = &(defaultGLConfigs[6]);
else // Opaque
targetConfig = &(defaultGLConfigs[7]);
}
}
}
if (!targetConfig) {
qWarning("QEgl::defaultConfig() - No default config for device/api/options combo");
return QEGL_NO_CONFIG;
}
if (*targetConfig != QEGL_NO_CONFIG)
return *targetConfig;
// We haven't found an EGL config for the target config yet, so do it now:
// Allow overriding from an environment variable:
QByteArray configId;
if (api == OpenVG)
configId = qgetenv("QT_VG_EGL_CONFIG");
else
configId = qgetenv("QT_GL_EGL_CONFIG");
if (!configId.isEmpty()) {
// Overridden, so get the EGLConfig for the specified config ID:
EGLint properties[] = {
EGL_CONFIG_ID, (EGLint)configId.toInt(),
EGL_NONE
};
EGLint configCount = 0;
eglChooseConfig(display(), properties, targetConfig, 1, &configCount);
if (configCount > 0)
return *targetConfig;
qWarning() << "QEgl::defaultConfig() -" << configId << "appears to be invalid";
}
QEglProperties configAttribs;
configAttribs.setRenderableType(api);
EGLint surfaceType;
switch (devType) {
case QInternal::Widget:
surfaceType = EGL_WINDOW_BIT;
break;
case QInternal::Pixmap:
surfaceType = EGL_PIXMAP_BIT;
break;
case QInternal::Pbuffer:
surfaceType = EGL_PBUFFER_BIT;
break;
default:
qWarning("QEgl::defaultConfig() - Can't create EGL surface for %d device type", devType);
return QEGL_NO_CONFIG;
};
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
// For OpenVG, we try to create a surface using a pre-multiplied format if
// the surface needs to have an alpha channel:
if (api == OpenVG && (options & Translucent))
surfaceType |= EGL_VG_ALPHA_FORMAT_PRE_BIT;
#endif
configAttribs.setValue(EGL_SURFACE_TYPE, surfaceType);
#ifdef EGL_BIND_TO_TEXTURE_RGBA
if (devType == QInternal::Pixmap || devType == QInternal::Pbuffer) {
if (options & Translucent)
configAttribs.setValue(EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE);
else
configAttribs.setValue(EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE);
}
#endif
// Add paint engine requirements
if (api == OpenVG) {
#if !defined(QVG_SCISSOR_CLIP) && defined(EGL_ALPHA_MASK_SIZE)
configAttribs.setValue(EGL_ALPHA_MASK_SIZE, 1);
#endif
} else {
// Both OpenGL paint engines need to have stencil and sample buffers
configAttribs.setValue(EGL_STENCIL_SIZE, 1);
configAttribs.setValue(EGL_SAMPLE_BUFFERS, 1);
#ifndef QT_OPENGL_ES_2
// Additionally, the GL1 engine likes to have a depth buffer for clipping
configAttribs.setValue(EGL_DEPTH_SIZE, 1);
#endif
}
if (options & Translucent)
configAttribs.setValue(EGL_ALPHA_SIZE, 1);
*targetConfig = chooseConfig(&configAttribs, QEgl::BestPixelFormat);
return *targetConfig;
}
// Choose a configuration that matches "properties".
EGLConfig QEgl::chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match)
{
QEglProperties props(*properties);
EGLConfig cfg = QEGL_NO_CONFIG;
do {
// Get the number of matching configurations for this set of properties.
EGLint matching = 0;
EGLDisplay dpy = QEgl::display();
if (!eglChooseConfig(dpy, props.properties(), 0, 0, &matching) || !matching)
continue;
// If we want the best pixel format, then return the first
// matching configuration.
if (match == QEgl::BestPixelFormat) {
eglChooseConfig(display(), props.properties(), &cfg, 1, &matching);
if (matching < 1)
continue;
return cfg;
}
// Fetch all of the matching configurations and find the
// first that matches the pixel format we wanted.
EGLint size = matching;
EGLConfig *configs = new EGLConfig [size];
eglChooseConfig(display(), props.properties(), configs, size, &matching);
for (EGLint index = 0; index < size; ++index) {
EGLint red, green, blue, alpha;
eglGetConfigAttrib(display(), configs[index], EGL_RED_SIZE, &red);
eglGetConfigAttrib(display(), configs[index], EGL_GREEN_SIZE, &green);
eglGetConfigAttrib(display(), configs[index], EGL_BLUE_SIZE, &blue);
eglGetConfigAttrib(display(), configs[index], EGL_ALPHA_SIZE, &alpha);
if (red == props.value(EGL_RED_SIZE) &&
green == props.value(EGL_GREEN_SIZE) &&
blue == props.value(EGL_BLUE_SIZE) &&
(props.value(EGL_ALPHA_SIZE) == 0 ||
alpha == props.value(EGL_ALPHA_SIZE))) {
cfg = configs[index];
delete [] configs;
return cfg;
}
}
delete [] configs;
} while (props.reduceConfiguration());
#ifdef EGL_BIND_TO_TEXTURE_RGBA
// Don't report an error just yet if we failed to get a pbuffer
// configuration with texture rendering. Only report failure if
// we cannot get any pbuffer configurations at all.
if (props.value(EGL_BIND_TO_TEXTURE_RGBA) == EGL_DONT_CARE &&
props.value(EGL_BIND_TO_TEXTURE_RGB) == EGL_DONT_CARE)
#endif
{
qWarning() << "QEglContext::chooseConfig(): Could not find a suitable EGL configuration";
qWarning() << "Requested:" << props.toString();
qWarning() << "Available:";
QEgl::dumpAllConfigs();
}
return QEGL_NO_CONFIG;
}
bool QEglContext::chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match)
{
cfg = QEgl::chooseConfig(&properties, match);
return cfg != QEGL_NO_CONFIG;
}
EGLSurface QEglContext::createSurface(QPaintDevice* device, const QEglProperties *properties)
{
return QEgl::createSurface(device, cfg, properties);
}
// Create the EGLContext.
bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties *properties)
{
// We need to select the correct API before calling eglCreateContext().
#ifdef QT_OPENGL_ES
#ifdef EGL_OPENGL_ES_API
if (apiType == QEgl::OpenGL)
eglBindAPI(EGL_OPENGL_ES_API);
#endif
#else
#ifdef EGL_OPENGL_API
if (apiType == QEgl::OpenGL)
eglBindAPI(EGL_OPENGL_API);
#endif
#endif //defined(QT_OPENGL_ES)
#ifdef EGL_OPENVG_API
if (apiType == QEgl::OpenVG)
eglBindAPI(EGL_OPENVG_API);
#endif
// Create a new context for the configuration.
QEglProperties contextProps;
if (properties)
contextProps = *properties;
#ifdef QT_OPENGL_ES_2
if (apiType == QEgl::OpenGL)
contextProps.setValue(EGL_CONTEXT_CLIENT_VERSION, 2);
#endif
sharing = false;
if (shareContext && shareContext->ctx == EGL_NO_CONTEXT)
shareContext = 0;
if (shareContext) {
ctx = eglCreateContext(QEgl::display(), cfg, shareContext->ctx, contextProps.properties());
if (ctx == EGL_NO_CONTEXT) {
qWarning() << "QEglContext::createContext(): Could not share context:" << QEgl::errorString();
shareContext = 0;
} else {
sharing = true;
}
}
if (ctx == EGL_NO_CONTEXT) {
ctx = eglCreateContext(display(), cfg, EGL_NO_CONTEXT, contextProps.properties());
if (ctx == EGL_NO_CONTEXT) {
qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << QEgl::errorString();
return false;
}
}
return true;
}
// Destroy an EGL surface object. If it was current on this context
// then call doneCurrent() for it first.
void QEglContext::destroySurface(EGLSurface surface)
{
if (surface != EGL_NO_SURFACE) {
if (surface == currentSurface)
doneCurrent();
eglDestroySurface(display(), surface);
}
}
// Destroy the context. Note: this does not destroy the surface.
void QEglContext::destroyContext()
{
if (ctx != EGL_NO_CONTEXT && ownsContext)
eglDestroyContext(display(), ctx);
ctx = EGL_NO_CONTEXT;
cfg = 0;
}
bool QEglContext::makeCurrent(EGLSurface surface)
{
if (ctx == EGL_NO_CONTEXT) {
qWarning() << "QEglContext::makeCurrent(): Cannot make invalid context current";
return false;
}
if (surface == EGL_NO_SURFACE) {
qWarning() << "QEglContext::makeCurrent(): Cannot make invalid surface current";
return false;
}
// If lazyDoneCurrent() was called on the surface, then we may be able
// to assume that it is still current within the thread.
if (surface == currentSurface && currentContext(apiType) == this) {
current = true;
return true;
}
current = true;
currentSurface = surface;
setCurrentContext(apiType, this);
// Force the right API to be bound before making the context current.
// The EGL implementation should be able to figure this out from ctx,
// but some systems require the API to be explicitly set anyway.
#ifdef EGL_OPENGL_ES_API
if (apiType == QEgl::OpenGL)
eglBindAPI(EGL_OPENGL_ES_API);
#endif
#ifdef EGL_OPENVG_API
if (apiType == QEgl::OpenVG)
eglBindAPI(EGL_OPENVG_API);
#endif
bool ok = eglMakeCurrent(QEgl::display(), surface, surface, ctx);
if (!ok)
qWarning() << "QEglContext::makeCurrent(" << surface << "):" << QEgl::errorString();
return ok;
}
bool QEglContext::doneCurrent()
{
// If the context is invalid, we assume that an error was reported
// when makeCurrent() was called.
if (ctx == EGL_NO_CONTEXT)
return false;
current = false;
currentSurface = EGL_NO_SURFACE;
setCurrentContext(apiType, 0);
// We need to select the correct API before calling eglMakeCurrent()
// with EGL_NO_CONTEXT because threads can have both OpenGL and OpenVG
// contexts active at the same time.
#ifdef EGL_OPENGL_ES_API
if (apiType == QEgl::OpenGL)
eglBindAPI(EGL_OPENGL_ES_API);
#endif
#ifdef EGL_OPENVG_API
if (apiType == QEgl::OpenVG)
eglBindAPI(EGL_OPENVG_API);
#endif
bool ok = eglMakeCurrent(QEgl::display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (!ok)
qWarning() << "QEglContext::doneCurrent():" << QEgl::errorString();
return ok;
}
// Act as though doneCurrent() was called, but keep the context
// and the surface active for the moment. This allows makeCurrent()
// to skip a call to eglMakeCurrent() if we are using the same
// surface as the last set of painting operations. We leave the
// currentContext() pointer as-is for now.
bool QEglContext::lazyDoneCurrent()
{
current = false;
return true;
}
bool QEglContext::swapBuffers(EGLSurface surface)
{
if(ctx == EGL_NO_CONTEXT)
return false;
bool ok = eglSwapBuffers(QEgl::display(), surface);
if (!ok)
qWarning() << "QEglContext::swapBuffers():" << QEgl::errorString();
return ok;
}
bool QEglContext::swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region) {
QVector<QRect> qrects = region->rects();
EGLint *gl_rects;
uint count;
uint i;
count = qrects.size();
QVarLengthArray <EGLint> arr(4 * count);
gl_rects = arr.data();
for (i = 0; i < count; i++) {
QRect qrect = qrects[i];
gl_rects[4 * i + 0] = qrect.x();
gl_rects[4 * i + 1] = qrect.y();
gl_rects[4 * i + 2] = qrect.width();
gl_rects[4 * i + 3] = qrect.height();
}
bool ok = QEgl::eglSwapBuffersRegion2NOK(QEgl::display(), surface, count, gl_rects);
if (!ok)
qWarning() << "QEglContext::swapBuffersRegion2NOK():" << QEgl::errorString();
return ok;
}
int QEglContext::configAttrib(int name) const
{
EGLint value;
EGLBoolean success = eglGetConfigAttrib(QEgl::display(), cfg, name, &value);
if (success)
return value;
else
return EGL_DONT_CARE;
}
typedef EGLImageKHR (EGLAPIENTRY *_eglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint*);
typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR);
// Defined in qegl.cpp:
static _eglCreateImageKHR qt_eglCreateImageKHR = 0;
static _eglDestroyImageKHR qt_eglDestroyImageKHR = 0;
typedef EGLBoolean (EGLAPIENTRY *_eglSwapBuffersRegion2NOK)(EGLDisplay, EGLSurface, EGLint, const EGLint*);
static _eglSwapBuffersRegion2NOK qt_eglSwapBuffersRegion2NOK = 0;
EGLDisplay QEgl::display()
{
static EGLDisplay dpy = EGL_NO_DISPLAY;
if (!QEglContextTracker::displayOpened()) {
dpy = eglGetDisplay(nativeDisplay());
QEglContextTracker::setDisplayOpened();
if (dpy == EGL_NO_DISPLAY) {
qWarning("QEgl::display(): Falling back to EGL_DEFAULT_DISPLAY");
dpy = eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY));
}
if (dpy == EGL_NO_DISPLAY) {
qWarning("QEgl::display(): Can't even open the default display");
return EGL_NO_DISPLAY;
}
if (!eglInitialize(dpy, NULL, NULL)) {
qWarning() << "QEgl::display(): Cannot initialize EGL display:" << QEgl::errorString();
return EGL_NO_DISPLAY;
}
// Resolve the egl extension function pointers:
#if (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES)
if (QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_base")) {
qt_eglCreateImageKHR = (_eglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR");
qt_eglDestroyImageKHR = (_eglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR");
}
#endif
if (QEgl::hasExtension("EGL_NOK_swap_region2")) {
qt_eglSwapBuffersRegion2NOK = (_eglSwapBuffersRegion2NOK) eglGetProcAddress("eglSwapBuffersRegion2NOK");
}
}
return dpy;
}
EGLImageKHR QEgl::eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
{
if (qt_eglCreateImageKHR)
return qt_eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list);
QEgl::display(); // Initialises function pointers
if (qt_eglCreateImageKHR)
return qt_eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list);
qWarning("QEgl::eglCreateImageKHR() called but EGL_KHR_image(_base) extension not present");
return 0;
}
EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
{
if (qt_eglDestroyImageKHR)
return qt_eglDestroyImageKHR(dpy, img);
QEgl::display(); // Initialises function pointers
if (qt_eglDestroyImageKHR)
return qt_eglDestroyImageKHR(dpy, img);
qWarning("QEgl::eglDestroyImageKHR() called but EGL_KHR_image(_base) extension not present");
return 0;
}
EGLBoolean QEgl::eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects)
{
if (qt_eglSwapBuffersRegion2NOK)
return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects);
QEgl::display(); // Initialises function pointers
if (qt_eglSwapBuffersRegion2NOK)
return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects);
qWarning("QEgl::eglSwapBuffersRegion2NOK() called but EGL_NOK_swap_region2 extension not present");
return 0;
}
EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties)
{
// Create the native drawable for the paint device.
int devType = device->devType();
EGLNativePixmapType pixmapDrawable = 0;
EGLNativeWindowType windowDrawable = 0;
bool ok;
if (devType == QInternal::Pixmap) {
pixmapDrawable = nativePixmap(static_cast<QPixmap *>(device));
ok = (pixmapDrawable != 0);
} else if (devType == QInternal::Widget) {
windowDrawable = nativeWindow(static_cast<QWidget *>(device));
ok = (windowDrawable != 0);
} else {
ok = false;
}
if (!ok) {
qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable");
return EGL_NO_SURFACE;
}
// Create the EGL surface to draw into, based on the native drawable.
const int *props;
if (properties)
props = properties->properties();
else
props = 0;
EGLSurface surf;
if (devType == QInternal::Widget)
surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props);
else
surf = eglCreatePixmapSurface(QEgl::display(), cfg, pixmapDrawable, props);
if (surf == EGL_NO_SURFACE) {
qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
}
return surf;
}
// Return the error string associated with a specific code.
QString QEgl::errorString(EGLint code)
{
static const char * const errors[] = {
"Success (0x3000)", // No tr
"Not initialized (0x3001)", // No tr
"Bad access (0x3002)", // No tr
"Bad alloc (0x3003)", // No tr
"Bad attribute (0x3004)", // No tr
"Bad config (0x3005)", // No tr
"Bad context (0x3006)", // No tr
"Bad current surface (0x3007)", // No tr
"Bad display (0x3008)", // No tr
"Bad match (0x3009)", // No tr
"Bad native pixmap (0x300A)", // No tr
"Bad native window (0x300B)", // No tr
"Bad parameter (0x300C)", // No tr
"Bad surface (0x300D)", // No tr
"Context lost (0x300E)" // No tr
};
if (code >= 0x3000 && code <= 0x300E) {
return QString::fromLatin1(errors[code - 0x3000]);
} else {
return QLatin1String("0x") + QString::number(int(code), 16);
}
}
// Dump all of the EGL configurations supported by the system.
void QEgl::dumpAllConfigs()
{
QEglProperties props;
EGLint count = 0;
if (!eglGetConfigs(display(), 0, 0, &count) || count < 1)
return;
EGLConfig *configs = new EGLConfig [count];
eglGetConfigs(display(), configs, count, &count);
for (EGLint index = 0; index < count; ++index) {
props = QEglProperties(configs[index]);
qWarning() << props.toString();
}
delete [] configs;
}
QString QEgl::extensions()
{
const char* exts = eglQueryString(QEgl::display(), EGL_EXTENSIONS);
return QString(QLatin1String(exts));
}
bool QEgl::hasExtension(const char* extensionName)
{
QList<QByteArray> extensions =
QByteArray(reinterpret_cast<const char *>
(eglQueryString(QEgl::display(), EGL_EXTENSIONS))).split(' ');
return extensions.contains(extensionName);
}
QEglContext *QEglContext::currentContext(QEgl::API api)
{
if (api == QEgl::OpenGL)
return currentGLContext;
else
return currentVGContext;
}
void QEglContext::setCurrentContext(QEgl::API api, QEglContext *context)
{
if (api == QEgl::OpenGL)
currentGLContext = context;
else
currentVGContext = context;
}
QT_END_NAMESPACE

View File

@ -1,191 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QEGL_P_H
#define QEGL_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience of
// the QtGui and QtOpenVG modules. This header file may change from
// version to version without notice, or even be removed.
//
// We mean it.
//
QT_BEGIN_INCLUDE_NAMESPACE
#ifndef QT_NO_EGL
#if defined(QT_OPENGL_ES_2)
# include <GLES2/gl2.h>
#endif
#if defined(QT_GLES_EGL)
# include <GLES/egl.h>
#else
# include <EGL/egl.h>
#endif
#if !defined(EGL_VERSION_1_2)
typedef unsigned int EGLenum;
typedef void *EGLClientBuffer;
#endif
#else
//types from egltypes.h for compiling stub without EGL headers
typedef int EGLBoolean;
typedef int EGLint;
typedef int EGLenum;
typedef int NativeDisplayType;
typedef void* NativeWindowType;
typedef void* NativePixmapType;
typedef int EGLDisplay;
typedef int EGLConfig;
typedef int EGLSurface;
typedef int EGLContext;
typedef int EGLClientBuffer;
#define EGL_NONE 0x3038 /* Attrib list terminator */
#endif
// Internally we use the EGL-prefixed native types which are used in EGL >= 1.3.
// For older versions of EGL, we have to define these types ourselves here:
#if !defined(EGL_VERSION_1_3) && !defined(QEGL_NATIVE_TYPES_DEFINED)
#undef EGLNativeWindowType
#undef EGLNativePixmapType
#undef EGLNativeDisplayType
typedef NativeWindowType EGLNativeWindowType;
typedef NativePixmapType EGLNativePixmapType;
typedef NativeDisplayType EGLNativeDisplayType;
#define QEGL_NATIVE_TYPES_DEFINED 1
#endif
QT_END_INCLUDE_NAMESPACE
#include <QtGui/qpaintdevice.h>
#include <QFlags>
QT_BEGIN_NAMESPACE
#define QEGL_NO_CONFIG ((EGLConfig)-1)
#ifndef EGLAPIENTRY
#define EGLAPIENTRY
#endif
// Declare/define the bits of EGL_KHR_image_base we need:
#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base)
typedef void *EGLImageKHR;
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
#define EGL_IMAGE_PRESERVED_KHR 0x30D2
#define EGL_KHR_image_base
#endif
#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_pixmap)
#define EGL_NATIVE_PIXMAP_KHR 0x30B0
#define EGL_KHR_image_pixmap
#endif
class QEglProperties;
namespace QEgl {
enum API
{
OpenGL,
OpenVG
};
enum PixelFormatMatch
{
ExactPixelFormat,
BestPixelFormat
};
enum ConfigOption
{
NoOptions = 0,
Translucent = 0x01,
Renderable = 0x02 // Config will be compatable with the paint engines (VG or GL)
};
Q_DECLARE_FLAGS(ConfigOptions, ConfigOption)
// Most of the time we use the same config for things like widgets & pixmaps, so rather than
// go through the eglChooseConfig loop every time, we use defaultConfig, which will return
// the config for a particular device/api/option combo. This function assumes that once a
// config is chosen for a particular combo, it's safe to always use that combo.
Q_GUI_EXPORT EGLConfig defaultConfig(int devType, API api, ConfigOptions options);
Q_GUI_EXPORT EGLConfig chooseConfig(const QEglProperties* configAttribs, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat);
Q_GUI_EXPORT EGLSurface createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *surfaceAttribs = 0);
Q_GUI_EXPORT void dumpAllConfigs();
#ifdef QT_NO_EGL
Q_GUI_EXPORT QString errorString(EGLint code = 0);
#else
Q_GUI_EXPORT QString errorString(EGLint code = eglGetError());
#endif
Q_GUI_EXPORT QString extensions();
Q_GUI_EXPORT bool hasExtension(const char* extensionName);
Q_GUI_EXPORT EGLDisplay display();
Q_GUI_EXPORT EGLNativeDisplayType nativeDisplay();
Q_GUI_EXPORT EGLNativeWindowType nativeWindow(QWidget*);
Q_GUI_EXPORT EGLNativePixmapType nativePixmap(QPixmap*);
// Extension functions
Q_GUI_EXPORT EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
Q_GUI_EXPORT EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img);
Q_GUI_EXPORT EGLBoolean eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects);
}
Q_DECLARE_OPERATORS_FOR_FLAGS(QEgl::ConfigOptions)
QT_END_NAMESPACE
#endif //QEGL_P_H

View File

@ -1,110 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qwidget.h>
#include "qeglcontext_p.h"
#if !defined(QT_NO_EGL)
#include <QtGui/private/qapplication_p.h>
#include <QtGui/qdesktopwidget.h>
QT_BEGIN_NAMESPACE
EGLNativeDisplayType QEgl::nativeDisplay()
{
return EGLNativeDisplayType(EGL_DEFAULT_DISPLAY);
}
EGLNativeWindowType QEgl::nativeWindow(QWidget* widget)
{
return (EGLNativeWindowType)(widget->winId());
}
EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap)
{
Q_UNUSED(pixmap);
return 0;
}
//EGLDisplay QEglContext::display()
//{
// return eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY));
//}
static QPlatformScreen *screenForDevice(QPaintDevice *device)
{
QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
int screenNumber;
if (device && device->devType() == QInternal::Widget)
screenNumber = qApp->desktop()->screenNumber(static_cast<QWidget *>(device));
else
screenNumber = 0;
if (screenNumber < 0 || screenNumber >= screens.size())
return 0;
return screens[screenNumber];
}
// Set pixel format and other properties based on a paint device.
void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev)
{
if (!dev)
return;
// Find the QOpenGLScreen for this paint device.
QPlatformScreen *screen = screenForDevice(dev);
if (!screen)
return;
int devType = dev->devType();
if (devType == QInternal::Image)
setPixelFormat(static_cast<QImage *>(dev)->format());
else
setPixelFormat(screen->format());
}
QT_END_NAMESPACE
#endif // !QT_NO_EGL

View File

@ -1,117 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QEGLCONTEXT_P_H
#define QEGLCONTEXT_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience of
// the QtGui and QtOpenVG modules. This header file may change from
// version to version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qsize.h>
#include <QtGui/qimage.h>
#include <QtGui/private/qegl_p.h>
#include <QtGui/private/qeglproperties_p.h>
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QEglContext
{
public:
QEglContext();
~QEglContext();
bool isValid() const;
bool isCurrent() const;
bool isSharing() const { return sharing; }
QEgl::API api() const { return apiType; }
void setApi(QEgl::API api) { apiType = api; }
bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat);
bool createContext(QEglContext *shareContext = 0, const QEglProperties *properties = 0);
void destroyContext();
EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0);
void destroySurface(EGLSurface surface);
bool makeCurrent(EGLSurface surface);
bool doneCurrent();
bool lazyDoneCurrent();
bool swapBuffers(EGLSurface surface);
bool swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region);
int configAttrib(int name) const;
EGLContext context() const { return ctx; }
void setContext(EGLContext context) { ctx = context; ownsContext = false;}
EGLDisplay display() {return QEgl::display();}
EGLConfig config() const { return cfg; }
void setConfig(EGLConfig config) { cfg = config; }
private:
QEgl::API apiType;
EGLContext ctx;
EGLConfig cfg;
EGLSurface currentSurface;
bool current;
bool ownsContext;
bool sharing;
static QEglContext *currentContext(QEgl::API api);
static void setCurrentContext(QEgl::API api, QEglContext *context);
friend class QMeeGoGraphicsSystem;
friend class QMeeGoPlatformPixmap;
};
QT_END_NAMESPACE
#endif // QEGLCONTEXT_P_H

View File

@ -1,563 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qdebug.h>
#include <QtCore/qstringlist.h>
#include "qeglproperties_p.h"
#include "qeglcontext_p.h"
QT_BEGIN_NAMESPACE
// Initialize a property block.
QEglProperties::QEglProperties()
{
props.append(EGL_NONE);
}
QEglProperties::QEglProperties(EGLConfig cfg)
{
props.append(EGL_NONE);
for (int name = 0x3020; name <= 0x304F; ++name) {
EGLint value;
if (name != EGL_NONE && eglGetConfigAttrib(QEgl::display(), cfg, name, &value))
setValue(name, value);
}
eglGetError(); // Clear the error state.
}
// Fetch the current value associated with a property.
int QEglProperties::value(int name) const
{
for (int index = 0; index < (props.size() - 1); index += 2) {
if (props[index] == name)
return props[index + 1];
}
// If the attribute has not been explicitly set, return the EGL default
// The following defaults were taken from the EGL 1.4 spec:
switch(name) {
case EGL_BUFFER_SIZE: return 0;
case EGL_RED_SIZE: return 0;
case EGL_GREEN_SIZE: return 0;
case EGL_BLUE_SIZE: return 0;
case EGL_ALPHA_SIZE: return 0;
#ifdef EGL_LUMINANCE_SIZE
case EGL_LUMINANCE_SIZE: return 0;
#endif
#ifdef EGL_ALPHA_MASK_SIZE
case EGL_ALPHA_MASK_SIZE: return 0;
#endif
#ifdef EGL_BIND_TO_TEXTURE_RGB
case EGL_BIND_TO_TEXTURE_RGB: return EGL_DONT_CARE;
#endif
#ifdef EGL_BIND_TO_TEXTURE_RGBA
case EGL_BIND_TO_TEXTURE_RGBA: return EGL_DONT_CARE;
#endif
#ifdef EGL_COLOR_BUFFER_TYPE
case EGL_COLOR_BUFFER_TYPE: return EGL_RGB_BUFFER;
#endif
case EGL_CONFIG_CAVEAT: return EGL_DONT_CARE;
case EGL_CONFIG_ID: return EGL_DONT_CARE;
case EGL_DEPTH_SIZE: return 0;
case EGL_LEVEL: return 0;
case EGL_NATIVE_RENDERABLE: return EGL_DONT_CARE;
case EGL_NATIVE_VISUAL_TYPE: return EGL_DONT_CARE;
case EGL_MAX_SWAP_INTERVAL: return EGL_DONT_CARE;
case EGL_MIN_SWAP_INTERVAL: return EGL_DONT_CARE;
#ifdef EGL_RENDERABLE_TYPE
case EGL_RENDERABLE_TYPE: return EGL_OPENGL_ES_BIT;
#endif
case EGL_SAMPLE_BUFFERS: return 0;
case EGL_SAMPLES: return 0;
case EGL_STENCIL_SIZE: return 0;
case EGL_SURFACE_TYPE: return EGL_WINDOW_BIT;
case EGL_TRANSPARENT_TYPE: return EGL_NONE;
case EGL_TRANSPARENT_RED_VALUE: return EGL_DONT_CARE;
case EGL_TRANSPARENT_GREEN_VALUE: return EGL_DONT_CARE;
case EGL_TRANSPARENT_BLUE_VALUE: return EGL_DONT_CARE;
#ifdef EGL_VERSION_1_3
case EGL_CONFORMANT: return 0;
case EGL_MATCH_NATIVE_PIXMAP: return EGL_NONE;
#endif
case EGL_MAX_PBUFFER_HEIGHT:
case EGL_MAX_PBUFFER_WIDTH:
case EGL_MAX_PBUFFER_PIXELS:
case EGL_NATIVE_VISUAL_ID:
case EGL_NONE:
// Attribute does not affect config selection.
return EGL_DONT_CARE;
default:
// Attribute is unknown in EGL <= 1.4.
return EGL_DONT_CARE;
}
}
// Set the value associated with a property, replacing an existing
// value if there is one.
void QEglProperties::setValue(int name, int value)
{
for (int index = 0; index < (props.size() - 1); index += 2) {
if (props[index] == name) {
props[index + 1] = value;
return;
}
}
props[props.size() - 1] = name;
props.append(value);
props.append(EGL_NONE);
}
// Remove a property value. Returns false if the property is not present.
bool QEglProperties::removeValue(int name)
{
for (int index = 0; index < (props.size() - 1); index += 2) {
if (props[index] == name) {
while ((index + 2) < props.size()) {
props[index] = props[index + 2];
++index;
}
props.resize(props.size() - 2);
return true;
}
}
return false;
}
void QEglProperties::setDeviceType(int devType)
{
if (devType == QInternal::Pixmap || devType == QInternal::Image)
setValue(EGL_SURFACE_TYPE, EGL_PIXMAP_BIT);
else if (devType == QInternal::Pbuffer)
setValue(EGL_SURFACE_TYPE, EGL_PBUFFER_BIT);
else
setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
}
// Sets the red, green, blue, and alpha sizes based on a pixel format.
// Normally used to match a configuration request to the screen format.
void QEglProperties::setPixelFormat(QImage::Format pixelFormat)
{
int red, green, blue, alpha;
switch (pixelFormat) {
case QImage::Format_RGB32:
case QImage::Format_RGB888:
red = green = blue = 8; alpha = 0; break;
case QImage::Format_ARGB32:
case QImage::Format_ARGB32_Premultiplied:
red = green = blue = alpha = 8; break;
case QImage::Format_RGB16:
red = 5; green = 6; blue = 5; alpha = 0; break;
case QImage::Format_ARGB8565_Premultiplied:
red = 5; green = 6; blue = 5; alpha = 8; break;
case QImage::Format_RGB666:
red = green = blue = 6; alpha = 0; break;
case QImage::Format_ARGB6666_Premultiplied:
red = green = blue = alpha = 6; break;
case QImage::Format_RGB555:
red = green = blue = 5; alpha = 0; break;
case QImage::Format_ARGB8555_Premultiplied:
red = green = blue = 5; alpha = 8; break;
case QImage::Format_RGB444:
red = green = blue = 4; alpha = 0; break;
case QImage::Format_ARGB4444_Premultiplied:
red = green = blue = alpha = 4; break;
default:
qWarning() << "QEglProperties::setPixelFormat(): Unsupported pixel format";
red = green = blue = alpha = 1; break;
}
setValue(EGL_RED_SIZE, red);
setValue(EGL_GREEN_SIZE, green);
setValue(EGL_BLUE_SIZE, blue);
setValue(EGL_ALPHA_SIZE, alpha);
}
void QEglProperties::setRenderableType(QEgl::API api)
{
#ifdef EGL_RENDERABLE_TYPE
#if defined(QT_OPENGL_ES_2)
if (api == QEgl::OpenGL)
setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT);
#elif defined(QT_OPENGL_ES)
if (api == QEgl::OpenGL)
setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT);
#elif defined(EGL_OPENGL_BIT)
if (api == QEgl::OpenGL)
setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT);
#endif
#ifdef EGL_OPENVG_BIT
if (api == QEgl::OpenVG)
setValue(EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT);
#endif
#else
Q_UNUSED(api);
#endif
}
// Reduce the complexity of a configuration request to ask for less
// because the previous request did not result in success. Returns
// true if the complexity was reduced, or false if no further
// reductions in complexity are possible.
bool QEglProperties::reduceConfiguration()
{
#ifdef EGL_SWAP_BEHAVIOR
if (value(EGL_SWAP_BEHAVIOR) != EGL_DONT_CARE)
removeValue(EGL_SWAP_BEHAVIOR);
#endif
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
// For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't
// find a config which supports pre-multiplied formats, remove the flag on the surface type:
EGLint surfaceType = value(EGL_SURFACE_TYPE);
if (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) {
surfaceType ^= EGL_VG_ALPHA_FORMAT_PRE_BIT;
setValue(EGL_SURFACE_TYPE, surfaceType);
return true;
}
#endif
// EGL chooses configs with the highest color depth over
// those with smaller (but faster) lower color depths. One
// way around this is to set EGL_BUFFER_SIZE to 16, which
// trumps the others. Of course, there may not be a 16-bit
// config available, so it's the first restraint we remove.
if (value(EGL_BUFFER_SIZE) == 16) {
removeValue(EGL_BUFFER_SIZE);
return true;
}
if (removeValue(EGL_SAMPLE_BUFFERS)) {
removeValue(EGL_SAMPLES);
return true;
}
if (removeValue(EGL_ALPHA_SIZE)) {
#if defined(EGL_BIND_TO_TEXTURE_RGBA) && defined(EGL_BIND_TO_TEXTURE_RGB)
if (removeValue(EGL_BIND_TO_TEXTURE_RGBA))
setValue(EGL_BIND_TO_TEXTURE_RGB, TRUE);
#endif
return true;
}
if (removeValue(EGL_STENCIL_SIZE))
return true;
if (removeValue(EGL_DEPTH_SIZE))
return true;
#ifdef EGL_BIND_TO_TEXTURE_RGB
if (removeValue(EGL_BIND_TO_TEXTURE_RGB))
return true;
#endif
return false;
}
static void addTag(QString& str, const QString& tag)
{
int lastnl = str.lastIndexOf(QLatin1String("\n"));
if (lastnl == -1)
lastnl = 0;
if ((str.length() - lastnl) >= 50)
str += QLatin1String("\n ");
str += tag;
}
// Convert a property list to a string suitable for debug output.
QString QEglProperties::toString() const
{
QString str;
int val;
val = value(EGL_CONFIG_ID);
if (val != EGL_DONT_CARE) {
str += QLatin1String("id=");
str += QString::number(val);
str += QLatin1Char(' ');
}
#ifdef EGL_RENDERABLE_TYPE
val = value(EGL_RENDERABLE_TYPE);
if (val != EGL_DONT_CARE) {
str += QLatin1String("type=");
QStringList types;
if ((val & EGL_OPENGL_ES_BIT) != 0)
types += QLatin1String("es1");
#ifdef EGL_OPENGL_ES2_BIT
if ((val & EGL_OPENGL_ES2_BIT) != 0)
types += QLatin1String("es2");
#endif
#ifdef EGL_OPENGL_BIT
if ((val & EGL_OPENGL_BIT) != 0)
types += QLatin1String("gl");
#endif
if ((val & EGL_OPENVG_BIT) != 0)
types += QLatin1String("vg");
if ((val & ~7) != 0)
types += QString::number(val);
str += types.join(QLatin1String(","));
} else {
str += QLatin1String("type=any");
}
#else
str += QLatin1String("type=es1");
#endif
int red = value(EGL_RED_SIZE);
int green = value(EGL_GREEN_SIZE);
int blue = value(EGL_BLUE_SIZE);
int alpha = value(EGL_ALPHA_SIZE);
int bufferSize = value(EGL_BUFFER_SIZE);
if (bufferSize == (red + green + blue + alpha))
bufferSize = 0;
str += QLatin1String(" rgba=");
str += QString::number(red);
str += QLatin1Char(',');
str += QString::number(green);
str += QLatin1Char(',');
str += QString::number(blue);
str += QLatin1Char(',');
str += QString::number(alpha);
if (bufferSize != 0) {
// Only report buffer size if different than r+g+b+a.
str += QLatin1String(" buffer-size=");
str += QString::number(bufferSize);
}
#ifdef EGL_COLOR_BUFFER_TYPE
val = value(EGL_COLOR_BUFFER_TYPE);
if (val == EGL_LUMINANCE_BUFFER) {
addTag(str, QLatin1String(" color-buffer-type=luminance"));
} else if (val != EGL_DONT_CARE && val != EGL_RGB_BUFFER) {
addTag(str, QLatin1String(" color-buffer-type="));
str += QString::number(val, 16);
}
#endif
val = value(EGL_DEPTH_SIZE);
if (val != 0) {
addTag(str, QLatin1String(" depth="));
str += QString::number(val);
}
val = value(EGL_STENCIL_SIZE);
if (val != 0) {
addTag(str, QLatin1String(" stencil="));
str += QString::number(val);
}
val = value(EGL_SURFACE_TYPE);
if (val != EGL_DONT_CARE) {
addTag(str, QLatin1String(" surface-type="));
QStringList types;
if ((val & EGL_WINDOW_BIT) != 0)
types += QLatin1String("window");
if ((val & EGL_PIXMAP_BIT) != 0)
types += QLatin1String("pixmap");
if ((val & EGL_PBUFFER_BIT) != 0)
types += QLatin1String("pbuffer");
#ifdef EGL_VG_COLORSPACE_LINEAR_BIT
if ((val & EGL_VG_COLORSPACE_LINEAR_BIT) != 0)
types += QLatin1String("vg-colorspace-linear");
#endif
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
if ((val & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0)
types += QLatin1String("vg-alpha-format-pre");
#endif
if ((val & ~(EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT
#ifdef EGL_VG_COLORSPACE_LINEAR_BIT
| EGL_VG_COLORSPACE_LINEAR_BIT
#endif
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
| EGL_VG_ALPHA_FORMAT_PRE_BIT
#endif
)) != 0) {
types += QString::number(val);
}
str += types.join(QLatin1String(","));
}
val = value(EGL_CONFIG_CAVEAT);
if (val != EGL_DONT_CARE) {
addTag(str, QLatin1String(" caveat="));
if (val == EGL_NONE)
str += QLatin1String("none");
else if (val == EGL_SLOW_CONFIG)
str += QLatin1String("slow");
else if (val == EGL_NON_CONFORMANT_CONFIG)
str += QLatin1String("non-conformant");
else
str += QString::number(val, 16);
}
val = value(EGL_LEVEL);
if (val != 0) {
addTag(str, QLatin1String(" level="));
str += QString::number(val);
}
int width, height, pixels;
width = value(EGL_MAX_PBUFFER_WIDTH);
height = value(EGL_MAX_PBUFFER_HEIGHT);
pixels = value(EGL_MAX_PBUFFER_PIXELS);
if (height != EGL_DONT_CARE || width != EGL_DONT_CARE) {
addTag(str, QLatin1String(" max-pbuffer-size="));
str += QString::number(width);
str += QLatin1Char('x');
str += QString::number(height);
if (pixels != (width * height)) {
addTag(str, QLatin1String(" max-pbuffer-pixels="));
str += QString::number(pixels);
}
}
val = value(EGL_NATIVE_RENDERABLE);
if (val != EGL_DONT_CARE) {
if (val)
addTag(str, QLatin1String(" native-renderable=true"));
else
addTag(str, QLatin1String(" native-renderable=false"));
}
val = value(EGL_NATIVE_VISUAL_ID);
if (val != EGL_DONT_CARE) {
addTag(str, QLatin1String(" visual-id="));
str += QString::number(val);
}
val = value(EGL_NATIVE_VISUAL_TYPE);
if (val != EGL_DONT_CARE) {
addTag(str, QLatin1String(" visual-type="));
str += QString::number(val);
}
#ifdef EGL_PRESERVED_RESOURCES
val = value(EGL_PRESERVED_RESOURCES);
if (val != EGL_DONT_CARE) {
if (val)
addTag(str, QLatin1String(" preserved-resources=true"));
else
addTag(str, QLatin1String(" preserved-resources=false"));
}
#endif
val = value(EGL_SAMPLES);
if (val != 0) {
addTag(str, QLatin1String(" samples="));
str += QString::number(val);
}
val = value(EGL_SAMPLE_BUFFERS);
if (val != 0) {
addTag(str, QLatin1String(" sample-buffers="));
str += QString::number(val);
}
val = value(EGL_TRANSPARENT_TYPE);
if (val == EGL_TRANSPARENT_RGB) {
addTag(str, QLatin1String(" transparent-rgb="));
str += QString::number(value(EGL_TRANSPARENT_RED_VALUE));
str += QLatin1Char(',');
str += QString::number(value(EGL_TRANSPARENT_GREEN_VALUE));
str += QLatin1Char(',');
str += QString::number(value(EGL_TRANSPARENT_BLUE_VALUE));
}
#if defined(EGL_BIND_TO_TEXTURE_RGB) && defined(EGL_BIND_TO_TEXTURE_RGBA)
val = value(EGL_BIND_TO_TEXTURE_RGB);
int val2 = value(EGL_BIND_TO_TEXTURE_RGBA);
if (val != EGL_DONT_CARE || val2 != EGL_DONT_CARE) {
addTag(str, QLatin1String(" bind-texture="));
if (val == EGL_TRUE)
str += QLatin1String("rgb");
else
str += QLatin1String("no-rgb");
if (val2 == EGL_TRUE)
str += QLatin1String(",rgba");
else
str += QLatin1String(",no-rgba");
}
#endif
#ifdef EGL_MIN_SWAP_INTERVAL
val = value(EGL_MIN_SWAP_INTERVAL);
if (val != EGL_DONT_CARE) {
addTag(str, QLatin1String(" min-swap-interval="));
str += QString::number(val);
}
#endif
#ifdef EGL_MIN_SWAP_INTERVAL
val = value(EGL_MAX_SWAP_INTERVAL);
if (val != EGL_DONT_CARE) {
addTag(str, QLatin1String(" max-swap-interval="));
str += QString::number(val);
}
#endif
#ifdef EGL_LUMINANCE_SIZE
val = value(EGL_LUMINANCE_SIZE);
if (val != 0) {
addTag(str, QLatin1String(" luminance="));
str += QString::number(val);
}
#endif
#ifdef EGL_ALPHA_MASK_SIZE
val = value(EGL_ALPHA_MASK_SIZE);
if (val != 0) {
addTag(str, QLatin1String(" alpha-mask="));
str += QString::number(val);
}
#endif
#ifdef EGL_CONFORMANT
val = value(EGL_CONFORMANT);
if (val != 0) {
if (val)
addTag(str, QLatin1String(" conformant=true"));
else
addTag(str, QLatin1String(" conformant=false"));
}
#endif
return str;
}
QT_END_NAMESPACE

View File

@ -32,8 +32,6 @@ include(util/util.pri)
include(math3d/math3d.pri)
include(opengl/opengl.pri)
include(egl/egl.pri)
QMAKE_LIBS += $$QMAKE_LIBS_GUI
DEFINES += Q_INTERNAL_QAPP_SRC
@ -59,20 +57,10 @@ win32:!contains(QT_CONFIG, directwrite) {
DEFINES += QT_NO_DIRECTWRITE
}
contains(QMAKE_MAC_XARCH, no) {
DEFINES += QT_NO_MAC_XARCH
} else {
win32-g++*|!win32:!win32-icc*:!macx-icc* {
mmx {
mmx_compiler.commands = $$QMAKE_CXX -c -Winline
mac {
x86: mmx_compiler.commands += -Xarch_i386 -mmmx
x86_64: mmx_compiler.commands += -Xarch_x86_64 -mmmx
} else {
mmx_compiler.commands += -mmmx
}
mmx_compiler.commands += -mmmx
mmx_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
mmx_compiler.dependency_type = TYPE_C
mmx_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
@ -84,14 +72,7 @@ contains(QMAKE_MAC_XARCH, no) {
}
3dnow {
mmx3dnow_compiler.commands = $$QMAKE_CXX -c -Winline
mac {
x86: mmx3dnow_compiler.commands += -Xarch_i386 -m3dnow -Xarch_i386 -mmmx
x86_64: mmx3dnow_compiler.commands += -Xarch_x86_64 -m3dnow -Xarch_x86_64 -mmmx
} else {
mmx3dnow_compiler.commands += -m3dnow -mmmx
}
mmx3dnow_compiler.commands += -m3dnow -mmmx
mmx3dnow_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
mmx3dnow_compiler.dependency_type = TYPE_C
mmx3dnow_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
@ -102,14 +83,7 @@ contains(QMAKE_MAC_XARCH, no) {
QMAKE_EXTRA_COMPILERS += mmx3dnow_compiler
sse {
sse3dnow_compiler.commands = $$QMAKE_CXX -c -Winline
mac {
x86: sse3dnow_compiler.commands += -Xarch_i386 -m3dnow -Xarch_i386 -msse
x86_64: sse3dnow_compiler.commands += -Xarch_x86_64 -m3dnow -Xarch_x86_64 -msse
} else {
sse3dnow_compiler.commands += -m3dnow -msse
}
sse3dnow_compiler.commands += -m3dnow -msse
sse3dnow_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
sse3dnow_compiler.dependency_type = TYPE_C
sse3dnow_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
@ -122,14 +96,7 @@ contains(QMAKE_MAC_XARCH, no) {
}
sse {
sse_compiler.commands = $$QMAKE_CXX -c -Winline
mac {
x86: sse_compiler.commands += -Xarch_i386 -msse
x86_64: sse_compiler.commands += -Xarch_x86_64 -msse
} else {
sse_compiler.commands += -msse
}
sse_compiler.commands += -msse
sse_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
sse_compiler.dependency_type = TYPE_C
sse_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
@ -141,14 +108,7 @@ contains(QMAKE_MAC_XARCH, no) {
}
sse2 {
sse2_compiler.commands = $$QMAKE_CXX -c -Winline
mac {
x86: sse2_compiler.commands += -Xarch_i386 -msse2
x86_64: sse2_compiler.commands += -Xarch_x86_64 -msse2
} else {
sse2_compiler.commands += -msse2
}
sse2_compiler.commands += -msse2
sse2_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
sse2_compiler.dependency_type = TYPE_C
sse2_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
@ -160,14 +120,7 @@ contains(QMAKE_MAC_XARCH, no) {
}
ssse3 {
ssse3_compiler.commands = $$QMAKE_CXX -c -Winline
mac {
x86: ssse3_compiler.commands += -Xarch_i386 -mssse3
x86_64: ssse3_compiler.commands += -Xarch_x86_64 -mssse3
} else {
ssse3_compiler.commands += -mssse3
}
ssse3_compiler.commands += -mssse3
ssse3_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
ssse3_compiler.dependency_type = TYPE_C
ssse3_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
@ -198,4 +151,3 @@ contains(QMAKE_MAC_XARCH, no) {
ssse3: SOURCES += $$SSSE3_SOURCES
iwmmxt: SOURCES += $$IWMMXT_SOURCES
}
}

View File

@ -50,6 +50,7 @@
#include "qstringlist.h"
#include "qvariant.h"
#include "qimagepixmapcleanuphooks_p.h"
#include "qplatformintegration_qpa.h"
#include <ctype.h>
#include <stdlib.h>
#include <limits.h>
@ -62,6 +63,7 @@
#include <qhash.h>
#include <private/qguiapplication_p.h>
#include <private/qpaintengine_raster_p.h>
#include <private/qimage_p.h>
@ -4900,7 +4902,9 @@ QPaintEngine *QImage::paintEngine() const
return 0;
if (!d->paintEngine) {
d->paintEngine = new QRasterPaintEngine(const_cast<QImage *>(this));
QPaintDevice *paintDevice = const_cast<QImage *>(this);
QPaintEngine *paintEngine = QGuiApplicationPrivate::platformIntegration()->createImagePaintEngine(paintDevice);
d->paintEngine = paintEngine ? paintEngine : new QRasterPaintEngine(paintDevice);
}
return d->paintEngine;

View File

@ -696,6 +696,8 @@ void QGuiApplicationPrivate::init()
// trigger registering of QVariant's GUI types
qRegisterGuiVariant();
QWindowSystemInterfacePrivate::eventTime.start();
is_app_running = true;
init_plugins(pluginList);
QWindowSystemInterface::sendWindowSystemEvents(QCoreApplicationPrivate::eventDispatcher, QEventLoop::AllEvents);
@ -753,7 +755,17 @@ static QClipboard *clipboard();
#endif
/*!
Returns the currently held keyboard modifiers.
Returns the current state of the modifier keys on the keyboard. The current
state is updated sychronously as the event queue is emptied of events that
will spontaneously change the keyboard state (QEvent::KeyPress and
QEvent::KeyRelease events).
It should be noted this may not reflect the actual keys held on the input
device at the time of calling but rather the modifiers as last reported in
one of the above events. If no keys are being held Qt::NoModifier is
returned.
\sa mouseButtons(), queryKeyboardModifiers()
*/
Qt::KeyboardModifiers QGuiApplication::keyboardModifiers()
{
@ -761,7 +773,39 @@ Qt::KeyboardModifiers QGuiApplication::keyboardModifiers()
}
/*!
Returns the currently held mouse buttons.
\fn Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
Queries and returns the state of the modifier keys on the keyboard.
Unlike keyboardModifiers, this method returns the actual keys held
on the input device at the time of calling the method.
It does not rely on the keypress events having been received by this
process, which makes it possible to check the modifiers while moving
a window, for instance. Note that in most cases, you should use
keyboardModifiers(), which is faster and more accurate since it contains
the state of the modifiers as they were when the currently processed
event was received.
\sa keyboardModifiers()
*/
Qt::KeyboardModifiers QGuiApplication::queryKeyboardModifiers()
{
QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
return pi->queryKeyboardModifiers();
}
/*!
Returns the current state of the buttons on the mouse. The current state is
updated syncronously as the event queue is emptied of events that will
spontaneously change the mouse state (QEvent::MouseButtonPress and
QEvent::MouseButtonRelease events).
It should be noted this may not reflect the actual buttons held on the
input device at the time of calling but rather the mouse buttons as last
reported in one of the above events. If no mouse buttons are being held
Qt::NoButton is returned.
\sa keyboardModifiers()
*/
Qt::MouseButtons QGuiApplication::mouseButtons()
{

View File

@ -113,6 +113,7 @@ public:
static void setPalette(const QPalette &pal);
static Qt::KeyboardModifiers keyboardModifiers();
static Qt::KeyboardModifiers queryKeyboardModifiers();
static Qt::MouseButtons mouseButtons();
static void setLayoutDirection(Qt::LayoutDirection direction);

View File

@ -88,6 +88,7 @@ QPlatformDrag::QPlatformDrag() : d_ptr(new QPlatformDragPrivate)
QPlatformDrag::~QPlatformDrag()
{
delete d_ptr;
}
QDrag *QPlatformDrag::currentDrag() const

View File

@ -100,6 +100,8 @@ public:
private:
QPlatformDragPrivate *d_ptr;
Q_DISABLE_COPY(QPlatformDrag)
};
QT_END_NAMESPACE

View File

@ -240,6 +240,15 @@ QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphics
return 0;
}
/*!
Factory function for QPaintEngine. This function will return 0 if the platform
integration does not support creating any paint engine the given \a paintDevice.
*/
QPaintEngine *QPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDevice) const
{
return 0;
}
/*!
Returns the platforms input context.
@ -282,6 +291,11 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return 0;
}
Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const
{
return QGuiApplication::keyboardModifiers();
}
/*!
Should be called by the implementation whenever a new screen is added.

View File

@ -91,6 +91,7 @@ public:
virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
#endif
virtual QPlatformSharedGraphicsCache *createPlatformSharedGraphicsCache(const char *cacheId) const;
virtual QPaintEngine *createImagePaintEngine(QPaintDevice *paintDevice) const;
// Event dispatcher:
virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const = 0;
@ -123,6 +124,8 @@ public:
virtual QVariant styleHint(StyleHint hint) const;
virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
virtual QPlatformTheme *platformTheme() const;
protected:

View File

@ -1386,7 +1386,7 @@ void QWindow::hideEvent(QHideEvent *ev)
/*!
Override this to handle any event sent to the window.
Remembet to call the base class version if you wish for mouse events,
Remember to call the base class version if you wish for mouse events,
key events, resize events, etc to be dispatched as usual.
*/
bool QWindow::event(QEvent *ev)

View File

@ -49,7 +49,7 @@
QT_BEGIN_NAMESPACE
QTime QWindowSystemInterfacePrivate::eventTime;
QElapsedTimer QWindowSystemInterfacePrivate::eventTime;
//------------------------------------------------------------
//

View File

@ -42,6 +42,7 @@
#define QWINDOWSYSTEMINTERFACE_QPA_P_H
#include "qwindowsysteminterface_qpa.h"
#include <QElapsedTimer>
QT_BEGIN_HEADER
@ -272,7 +273,7 @@ public:
static WindowSystemEvent * getWindowSystemEvent();
static void queueWindowSystemEvent(WindowSystemEvent *ev);
static QTime eventTime;
static QElapsedTimer eventTime;
static QList<QTouchEvent::TouchPoint> convertTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points, QEvent::Type *type);
};

View File

@ -1405,8 +1405,7 @@ void QOpenGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
// don't try to cache huge fonts or vastly transformed fonts
QFontEngine *fontEngine = textItem->fontEngine();
const qreal pixelSize = fontEngine->fontDef.pixelSize;
if (shouldDrawCachedGlyphs(pixelSize, s->matrix) || det < 0.25f || det > 4.f) {
if (shouldDrawCachedGlyphs(fontEngine, s->matrix) || det < 0.25f || det > 4.f) {
QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0
? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat)
: d->glyphCacheType;
@ -1460,8 +1459,7 @@ void QOpenGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &text
bool drawCached = txtype < QTransform::TxProject;
// don't try to cache huge fonts or vastly transformed fonts
const qreal pixelSize = ti.fontEngine->fontDef.pixelSize;
if (shouldDrawCachedGlyphs(pixelSize, s->matrix) || det < 0.25f || det > 4.f)
if (shouldDrawCachedGlyphs(ti.fontEngine, s->matrix) || det < 0.25f || det > 4.f)
drawCached = false;
QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0

View File

@ -157,7 +157,7 @@ public:
void setRenderTextActive(bool);
bool isNativePaintingActive() const;
bool supportsTransformations(qreal, const QTransform &) const { return true; }
bool supportsTransformations(QFontEngine *, const QTransform &) const { return true; }
private:
Q_DISABLE_COPY(QOpenGL2PaintEngineEx)

View File

@ -72,7 +72,7 @@ public:
, m_width(0)
, m_height(0)
{
if (ctx && !ctx->d_func()->workaround_brokenFBOReadBack)
if (!ctx->d_func()->workaround_brokenFBOReadBack)
QOpenGLFunctions(ctx).glGenFramebuffers(1, &m_fbo);
#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG

View File

@ -2465,6 +2465,15 @@ static inline bool monoVal(const uchar* s, int x)
return (s[x>>3] << (x&7)) & 0x80;
}
/*!
\internal
*/
QRasterBuffer *QRasterPaintEngine::rasterBuffer()
{
Q_D(QRasterPaintEngine);
return d->rasterBuffer.data();
}
/*!
\internal
*/
@ -2923,7 +2932,7 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
ensureRasterState();
QFontEngine *fontEngine = textItem->fontEngine();
if (shouldDrawCachedGlyphs(fontEngine->fontDef.pixelSize, state()->matrix)) {
if (shouldDrawCachedGlyphs(fontEngine, state()->matrix)) {
drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions,
fontEngine);
} else if (state()->matrix.type() < QTransform::TxProject) {
@ -3207,18 +3216,18 @@ void QRasterPaintEngine::releaseDC(HDC) const
#endif
bool QRasterPaintEngine::supportsTransformations(const QFontEngine *fontEngine) const
bool QRasterPaintEngine::supportsTransformations(QFontEngine *fontEngine) const
{
const QTransform &m = state()->matrix;
return supportsTransformations(fontEngine->fontDef.pixelSize, m);
return supportsTransformations(fontEngine, m);
}
bool QRasterPaintEngine::supportsTransformations(qreal pixelSize, const QTransform &m) const
bool QRasterPaintEngine::supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const
{
if (m.type() >= QTransform::TxProject)
return true;
return !shouldDrawCachedGlyphs(pixelSize, m);
return !shouldDrawCachedGlyphs(fontEngine, m);
}
/*!

Some files were not shown because too many files have changed in this diff Show More