Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
2
.gitignore
vendored
@ -30,6 +30,8 @@ pcviewer.cfg
|
||||
*.a
|
||||
*.la
|
||||
*.core
|
||||
*.d
|
||||
*.dylib
|
||||
*.moc
|
||||
*.o
|
||||
*.obj
|
||||
|
@ -1,6 +1,6 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
The Qt Toolkit is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
The Qt Toolkit is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
Contact: http://www.qt-project.org/legal
|
||||
|
||||
You may use, distribute and copy the Qt GUI Toolkit under the terms of
|
||||
|
@ -6,6 +6,10 @@ VERBOSE=$2
|
||||
|
||||
|
||||
cat >>bsymbolic_functions.c << EOF
|
||||
#if !(defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64))
|
||||
#error "Symbolic function binding on this architecture may be broken, disabling it (see QTBUG-36129)."
|
||||
#endif
|
||||
|
||||
int main() { return 0; }
|
||||
EOF
|
||||
|
||||
|
312
configure
vendored
@ -2766,203 +2766,25 @@ if [ "$COMMERCIAL_USER" = "ask" ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
CFG_RTOS_ENABLED=yes
|
||||
EditionString=Commercial
|
||||
if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then
|
||||
# Commercial preview release
|
||||
Licensee="Preview"
|
||||
Edition="Preview"
|
||||
LicenseType="Technology Preview"
|
||||
EditionString="Technology Preview"
|
||||
elif [ $COMMERCIAL_USER = "yes" ]; then
|
||||
# one of commercial editions
|
||||
|
||||
# read in the license file
|
||||
[ -z "$LICENSE_FILE" ] && LICENSE_FILE="$QT_LICENSE_FILE"
|
||||
[ -z "$LICENSE_FILE" ] && LICENSE_FILE="$HOME/.qt-license"
|
||||
if [ -f "$LICENSE_FILE" ]; then
|
||||
tr -d '\r' <"$LICENSE_FILE" >"${LICENSE_FILE}.tmp"
|
||||
diff "${LICENSE_FILE}.tmp" "${LICENSE_FILE}" >/dev/null 2>&1 || LICENSE_FILE="${LICENSE_FILE}.tmp"
|
||||
. "$LICENSE_FILE" >/dev/null 2>&1
|
||||
if [ -z "$LicenseKeyExt" ]; then
|
||||
echo
|
||||
echo "You are using an old license file."
|
||||
echo
|
||||
echo "Please install the license file supplied by Digia,"
|
||||
echo "or install the Qt Open Source Edition if you intend to"
|
||||
echo "develop free software."
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$Licensee" ]; then
|
||||
echo
|
||||
echo "Invalid license key. Please check the license key."
|
||||
if test -x "$relpath/bin/licheck"; then
|
||||
LicheckOutput=`$relpath/bin/licheck $relpath $outpath $PLATFORM $XPLATFORM`
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
else
|
||||
eval "$LicheckOutput"
|
||||
fi
|
||||
else
|
||||
if [ -z "$LicenseKeyExt" ]; then
|
||||
echo
|
||||
echo $ECHO_N "Please enter your license key: $ECHO_C"
|
||||
read LicenseKeyExt
|
||||
Licensee="Unknown user"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Key verification
|
||||
echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \
|
||||
&& LicenseValid="yes" \
|
||||
|| LicenseValid="no"
|
||||
if [ "$LicenseValid" != "yes" ]; then
|
||||
echo
|
||||
echo "Invalid license key. Please check the license key."
|
||||
exit 1
|
||||
fi
|
||||
ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1`
|
||||
PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -`
|
||||
LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -`
|
||||
LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1`
|
||||
|
||||
# determine which edition we are licensed to use
|
||||
case "$LicenseTypeCode" in
|
||||
F4M)
|
||||
LicenseType="Commercial"
|
||||
case $ProductCode in
|
||||
F)
|
||||
Edition="Universal"
|
||||
;;
|
||||
B)
|
||||
Edition="FullFramework"
|
||||
EditionString="Full Framework"
|
||||
;;
|
||||
L)
|
||||
Edition="GUIFramework"
|
||||
EditionString="GUI Framework"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
Z4M|R4M|Q4M)
|
||||
LicenseType="Evaluation"
|
||||
QMakeVar add DEFINES QT_EVAL
|
||||
case $ProductCode in
|
||||
B)
|
||||
Edition="Evaluation"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
if [ -z "$LicenseType" -o -z "$Edition" ]; then
|
||||
echo
|
||||
echo "Invalid license key. Please check the license key."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# verify that we are licensed to use Qt on this platform
|
||||
LICENSE_EXTENSION=
|
||||
case "$PlatformCode" in
|
||||
*L)
|
||||
CFG_RTOS_ENABLED=yes
|
||||
PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'`
|
||||
;;
|
||||
*)
|
||||
CFG_RTOS_ENABLED=no
|
||||
PlatformCode=`echo "$PlatformCode" | sed 's/.$//'`
|
||||
;;
|
||||
esac
|
||||
### EMBEDDED_QPA logic missing ###
|
||||
case "$PlatformCode,$XPLATFORM_MAC" in
|
||||
X9,* | XC,* | XU,* | XW,* | XM,*)
|
||||
# Qt All-OS
|
||||
LICENSE_EXTENSION="-ALLOS"
|
||||
;;
|
||||
8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*)
|
||||
# Qt for Embedded Linux
|
||||
LICENSE_EXTENSION="-EMBEDDED"
|
||||
;;
|
||||
6M,* | N7,* | N9,* | NX,*)
|
||||
# Embedded no-deploy
|
||||
LICENSE_EXTENSION="-EMBEDDED"
|
||||
;;
|
||||
FM,* | LM,yes | ZM,no)
|
||||
# Desktop
|
||||
LICENSE_EXTENSION="-DESKTOP"
|
||||
;;
|
||||
*)
|
||||
Platform=Linux/X11
|
||||
[ "$XPLATFORM_MAC" = "yes" ] && Platform='Mac OS X'
|
||||
echo
|
||||
echo "You are not licensed for the $Platform platform."
|
||||
echo
|
||||
echo "Please use the contact form at http://qt.digia.com/contact-us"
|
||||
echo "to upgrade your license to include the $Platform platform, or install"
|
||||
echo "the Qt Open Source Edition if you intend to develop free software."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -r "$relpath/.LICENSE"; then
|
||||
# Generic, non-final license
|
||||
LICENSE_EXTENSION=""
|
||||
line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE`
|
||||
case "$line" in
|
||||
*BETA*)
|
||||
Edition=Beta
|
||||
;;
|
||||
*TECHNOLOGY?PREVIEW*)
|
||||
Edition=Preview
|
||||
;;
|
||||
*EVALUATION*)
|
||||
Edition=Evaluation
|
||||
;;
|
||||
*)
|
||||
echo >&2 "Invalid license files; cannot continue"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Licensee="$Edition"
|
||||
EditionString="$Edition"
|
||||
fi
|
||||
|
||||
case "$LicenseFeatureCode" in
|
||||
B|G|L|Y)
|
||||
# US
|
||||
case "$LicenseType" in
|
||||
Commercial)
|
||||
cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE"
|
||||
;;
|
||||
Evaluation)
|
||||
cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
2|4|5|F)
|
||||
# non-US
|
||||
case "$LicenseType" in
|
||||
Commercial)
|
||||
cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE"
|
||||
;;
|
||||
Evaluation)
|
||||
cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo
|
||||
echo "Invalid license key. Please check the license key."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
case "$LicenseFeatureCode" in
|
||||
4|B|F|Y)
|
||||
CFG_RTOS_ENABLED=yes
|
||||
;;
|
||||
2|5|G|L)
|
||||
CFG_RTOS_ENABLED=no
|
||||
;;
|
||||
esac
|
||||
if [ '!' -f "$outpath/LICENSE" ]; then
|
||||
echo "The LICENSE, LICENSE.GPL LICENSE.LGPL file shipped with"
|
||||
echo "this software has disappeared."
|
||||
echo
|
||||
echo "Sorry, you are not licensed to use this software."
|
||||
echo "Try re-installing."
|
||||
echo "Error: This is the Open Source version of Qt."
|
||||
echo "If you want to use Enterprise features of Qt,"
|
||||
echo "use the contact form at http://qt.digia.com/contact-us"
|
||||
echo "to purchase a license."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
@ -2972,22 +2794,11 @@ elif [ $COMMERCIAL_USER = "no" ]; then
|
||||
Edition="OpenSource"
|
||||
EditionString="Open Source"
|
||||
fi
|
||||
echo
|
||||
echo "This is the Qt ${EditionString} Edition."
|
||||
echo
|
||||
|
||||
if [ "$CFG_RTOS_ENABLED" = "no" ]; then
|
||||
case `basename "$XPLATFORM"` in
|
||||
qnx-* | vxworks-*)
|
||||
echo ""
|
||||
echo "You are not licensed for Qt for `basename $XPLATFORM`."
|
||||
echo ""
|
||||
echo "Please use the contact form at http://qt.digia.com/contact-us"
|
||||
echo "to upgrade your license to include this platform, or install"
|
||||
echo "the Qt Open Source Edition if you intend to develop free software."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
if [ "$Edition" = "OpenSource" ] || [ "$Edition" = "Preview" ]; then
|
||||
echo
|
||||
echo "This is the Qt ${EditionString} Edition."
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ "$Edition" = "OpenSource" ]; then
|
||||
@ -3003,7 +2814,7 @@ if [ "$Edition" = "OpenSource" ]; then
|
||||
fi
|
||||
echo
|
||||
if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
|
||||
echo "You have already accepted the terms of the $LicenseType license."
|
||||
echo "You have already accepted the terms of the $EditionString license."
|
||||
acceptance=yes
|
||||
else
|
||||
if [ -f "$relpath/LICENSE.GPL" ]; then
|
||||
@ -3034,7 +2845,7 @@ elif [ "$Edition" = "Preview" ]; then
|
||||
while true; do
|
||||
|
||||
if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
|
||||
echo "You have already accepted the terms of the $LicenseType license."
|
||||
echo "You have already accepted the terms of the $EditionString license."
|
||||
acceptance=yes
|
||||
else
|
||||
echo "You are licensed to use this software under the terms of"
|
||||
@ -3058,77 +2869,6 @@ elif [ "$Edition" = "Preview" ]; then
|
||||
more "$relpath/LICENSE.PREVIEW.COMMERCIAL"
|
||||
fi
|
||||
done
|
||||
elif [ "$Edition" != "OpenSource" ]; then
|
||||
if [ -n "$ExpiryDate" ]; then
|
||||
ExpiryDate=`echo $ExpiryDate | sed -e 's,-,,g' | tr -d '\n\r'`
|
||||
[ -z "$ExpiryDate" ] && ExpiryDate="0"
|
||||
Today=`date +%Y%m%d`
|
||||
if [ "$Today" -gt "$ExpiryDate" ]; then
|
||||
case "$LicenseType" in
|
||||
Commercial|Academic|Educational)
|
||||
echo
|
||||
echo "WARNING WARNING WARNING WARNING"
|
||||
echo
|
||||
echo " Your support and upgrade period has expired."
|
||||
echo
|
||||
echo " You may continue to use your last licensed release"
|
||||
echo " of Qt under the terms of your existing license"
|
||||
echo " agreement. But you are not entitled to technical"
|
||||
echo " support, nor are you entitled to use any more recent"
|
||||
echo " Qt releases."
|
||||
echo
|
||||
echo " Please use the contact form at http://qt.digia.com/contact-us"
|
||||
echo " to renew your support and upgrades for this license."
|
||||
echo
|
||||
echo "WARNING WARNING WARNING WARNING"
|
||||
echo
|
||||
sleep 3
|
||||
;;
|
||||
Evaluation|*)
|
||||
echo
|
||||
echo "NOTICE NOTICE NOTICE NOTICE"
|
||||
echo
|
||||
echo " Your Evaluation license has expired."
|
||||
echo
|
||||
echo " You are no longer licensed to use this software. Please"
|
||||
echo " use the contact form at http://qt.digia.com/contact-us to"
|
||||
echo " purchase license, or install the Qt Open Source Edition"
|
||||
echo " if you intend to develop free software."
|
||||
echo
|
||||
echo "NOTICE NOTICE NOTICE NOTICE"
|
||||
echo
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
TheLicense=`head -n 1 "$outpath/LICENSE"`
|
||||
while true; do
|
||||
if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
|
||||
echo "You have already accepted the terms of the $TheLicense."
|
||||
acceptance=yes
|
||||
else
|
||||
echo "You are licensed to use this software under the terms of"
|
||||
echo "the $TheLicense."
|
||||
echo
|
||||
echo "Type '?' to view the $TheLicense."
|
||||
echo "Type 'yes' to accept this license offer."
|
||||
echo "Type 'no' to decline this license offer."
|
||||
echo
|
||||
echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C"
|
||||
read acceptance
|
||||
fi
|
||||
echo
|
||||
if [ "$acceptance" = "yes" ]; then
|
||||
break
|
||||
elif [ "$acceptance" = "no" ]; then
|
||||
echo "You are not licensed to use this software."
|
||||
echo
|
||||
exit 1
|
||||
else [ "$acceptance" = "?" ]
|
||||
more "$outpath/LICENSE"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -3851,22 +3591,6 @@ else
|
||||
chmod -w "$outpath/src/corelib/global/qconfig.cpp"
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
if [ "$LicenseType" = "Evaluation" ]; then
|
||||
EVALKEY=qt_qevalkey=$LicenseKeyExt
|
||||
elif echo "$DEFINES" | grep QT_EVAL >/dev/null 2>&1; then
|
||||
EVALKEY=qt_qevalkey=
|
||||
fi
|
||||
|
||||
if [ -n "$EVALKEY" ]; then
|
||||
rm -f "$outpath/src/corelib/global/qconfig_eval.cpp"
|
||||
cat > "$outpath/src/corelib/global/qconfig_eval.cpp" <<EOF
|
||||
/* Evaluation license key */
|
||||
static const volatile char qt_eval_key_data [512 + 12] = "$EVALKEY";
|
||||
EOF
|
||||
chmod -w "$outpath/src/corelib/global/qconfig_eval.cpp"
|
||||
fi
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# build qmake
|
||||
@ -6224,10 +5948,6 @@ full)
|
||||
;;
|
||||
esac
|
||||
|
||||
cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
|
||||
|
||||
EOF
|
||||
|
||||
echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
|
||||
[ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
dita.metadata.default.author = Qt Project
|
||||
dita.metadata.default.permissions = all
|
||||
dita.metadata.default.publisher = Qt Project
|
||||
dita.metadata.default.copyryear = 2013
|
||||
dita.metadata.default.copyryear = 2014
|
||||
dita.metadata.default.copyrholder = Digia Plc
|
||||
dita.metadata.default.audience = programmer
|
||||
|
||||
|
@ -8,7 +8,7 @@ HTML.footer = \
|
||||
"</div>\n" \
|
||||
"<div class=\"footer\">\n" \
|
||||
" <p>\n" \
|
||||
" <acronym title=\"Copyright\">©</acronym> 2013 Digia Plc and/or its\n" \
|
||||
" <acronym title=\"Copyright\">©</acronym> 2014 Digia Plc and/or its\n" \
|
||||
" subsidiaries. Documentation contributions included herein are the copyrights of\n" \
|
||||
" their respective owners.<br>" \
|
||||
" The documentation provided herein is licensed under the terms of the" \
|
||||
|
@ -1,31 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Free Documentation License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of
|
||||
** this file. Please review the following information to ensure
|
||||
** the GNU Free Documentation License version 1.3 requirements
|
||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\example remotecontrolledcar
|
||||
\title D-Bus Remote Controlled Car Example
|
||||
*/
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
@ -26,14 +26,14 @@
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\example ipc/localfortuneclient
|
||||
\example localfortuneclient
|
||||
\title Local Fortune Client Example
|
||||
\ingroup examples-ipc
|
||||
\brief Demonstrates using QLocalSocket for a simple local service client.
|
||||
|
||||
The Local Fortune Client example shows how to create a client for a simple
|
||||
local service using QLocalSocket. It is intended to be run alongside the
|
||||
\l{ipc/localfortuneserver}{Local Fortune Server} example.
|
||||
\l{Local Fortune Server Example}.
|
||||
|
||||
\image localfortuneclient-example.png Screenshot of the Local Fortune Client example
|
||||
|
@ -26,14 +26,14 @@
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\example ipc/localfortuneserver
|
||||
\example localfortuneserver
|
||||
\title Local Fortune Server Example
|
||||
\ingroup examples-ipc
|
||||
\brief Demonstrates using QLocalServer and QLocalSocket for serving a simple local service.
|
||||
|
||||
The Local Fortune Server example shows how to create a server for a simple
|
||||
local service. It is intended to be run alongside the
|
||||
\l{ipc/localfortuneclient}{Local Fortune Client} example
|
||||
\l{Local Fortune Client Example}
|
||||
|
||||
\image localfortuneserver-example.png Screenshot of the Local Fortune Server example
|
||||
*/
|
@ -26,7 +26,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\example ipc/sharedmemory
|
||||
\example sharedmemory
|
||||
\title Shared Memory Example
|
||||
\ingroup examples-ipc
|
||||
\brief Demonstrates doing inter-process communication using shared memory with
|
||||
@ -40,7 +40,7 @@
|
||||
dialog is displayed and then control is passed to the application in
|
||||
the standard way.
|
||||
|
||||
\snippet examples/ipc/sharedmemory/main.cpp 0
|
||||
\snippet sharedmemory/main.cpp 0
|
||||
|
||||
Two instances of class Dialog appear.
|
||||
|
||||
@ -51,12 +51,12 @@
|
||||
loadFromFile() and loadFromMemory() that correspond to the two
|
||||
buttons on the dialog.
|
||||
|
||||
\snippet examples/ipc/sharedmemory/dialog.h 0
|
||||
\snippet sharedmemory/dialog.h 0
|
||||
|
||||
The constructor builds the user interface widgets and connects the
|
||||
clicked() signal of each button to the corresponding slot function.
|
||||
|
||||
\snippet examples/ipc/sharedmemory/dialog.cpp 0
|
||||
\snippet sharedmemory/dialog.cpp 0
|
||||
|
||||
Note that "QSharedMemoryExample" is passed to the \l {QSharedMemory}
|
||||
{QSharedMemory()} constructor to be used as the key. This will be
|
||||
@ -69,7 +69,7 @@
|
||||
that segment is detached from the process, so we can be assured of
|
||||
starting off the example correctly.
|
||||
|
||||
\snippet examples/ipc/sharedmemory/dialog.cpp 1
|
||||
\snippet sharedmemory/dialog.cpp 1
|
||||
|
||||
The user is then asked to select an image file using
|
||||
QFileDialog::getOpenFileName(). The selected file is loaded into a
|
||||
@ -85,7 +85,7 @@
|
||||
to the image data, which we then use to do a memcopy() from the
|
||||
QBuffer into the shared memory segment.
|
||||
|
||||
\snippet examples/ipc/sharedmemory/dialog.cpp 2
|
||||
\snippet sharedmemory/dialog.cpp 2
|
||||
|
||||
Note that we \l {QSharedMemory::} {lock()} the shared memory segment
|
||||
before we copy into it, and we \l {QSharedMemory::} {unlock()} it
|
||||
@ -117,7 +117,7 @@
|
||||
then streams the data into a QImage and \l {QSharedMemory::unlock()}
|
||||
{unlocks} the segment.
|
||||
|
||||
\snippet examples/ipc/sharedmemory/dialog.cpp 3
|
||||
\snippet sharedmemory/dialog.cpp 3
|
||||
|
||||
In this case, the function does \l {QSharedMemory::} {detach()} from
|
||||
the segment, because now we are effectively finished using
|
@ -1,9 +1,7 @@
|
||||
Qt 4 makes it easier than ever to write multithreaded applications. More
|
||||
classes have been made usable from non-GUI threads, and the signals and slots
|
||||
mechanism can now be used to communicate between threads.
|
||||
This folder contains examples for the use of the threading-related classes
|
||||
in Qt Core. For examples using the higher-level Qt Concurrent module,
|
||||
check out the "qtconcurrent" folder instead.
|
||||
|
||||
Additionally, it is now possible to move objects between threads.
|
||||
|
||||
|
||||
Documentation for these examples can be found via the Examples
|
||||
link in the main Qt documentation.
|
||||
Documentation for examples can be found via the Examples and Tutorials link
|
||||
in the main Qt documentation. The examples and their documentation can also
|
||||
be opened from the Examples tab of Qt Creator's Welcome mode.
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
@ -43,6 +43,8 @@
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
Q_LOGGING_CATEGORY(lcExample, "qt.examples.imagegestures")
|
||||
|
||||
//! [constructor]
|
||||
ImageWidget::ImageWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
@ -55,15 +57,17 @@ ImageWidget::ImageWidget(QWidget *parent)
|
||||
|
||||
{
|
||||
setMinimumSize(QSize(100,100));
|
||||
|
||||
//! [enable gestures]
|
||||
grabGesture(Qt::PanGesture);
|
||||
grabGesture(Qt::PinchGesture);
|
||||
grabGesture(Qt::SwipeGesture);
|
||||
//! [enable gestures]
|
||||
}
|
||||
//! [constructor]
|
||||
|
||||
void ImageWidget::grabGestures(const QList<Qt::GestureType> &gestures)
|
||||
{
|
||||
//! [enable gestures]
|
||||
foreach (Qt::GestureType gesture, gestures)
|
||||
grabGesture(gesture);
|
||||
//! [enable gestures]
|
||||
}
|
||||
|
||||
//! [event handler]
|
||||
bool ImageWidget::event(QEvent *event)
|
||||
{
|
||||
@ -77,10 +81,10 @@ void ImageWidget::paintEvent(QPaintEvent*)
|
||||
{
|
||||
QPainter p(this);
|
||||
|
||||
float iw = currentImage.width();
|
||||
float ih = currentImage.height();
|
||||
float wh = height();
|
||||
float ww = width();
|
||||
const qreal iw = currentImage.width();
|
||||
const qreal ih = currentImage.height();
|
||||
const qreal wh = height();
|
||||
const qreal ww = width();
|
||||
|
||||
p.translate(ww/2, wh/2);
|
||||
p.translate(horizontalOffset, verticalOffset);
|
||||
@ -98,11 +102,13 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *)
|
||||
verticalOffset = 0;
|
||||
horizontalOffset = 0;
|
||||
update();
|
||||
qCDebug(lcExample) << "reset on mouse double click";
|
||||
}
|
||||
|
||||
//! [gesture event handler]
|
||||
bool ImageWidget::gestureEvent(QGestureEvent *event)
|
||||
{
|
||||
qCDebug(lcExample) << "gestureEvent():" << event->gestures().size();
|
||||
if (QGesture *swipe = event->gesture(Qt::SwipeGesture))
|
||||
swipeTriggered(static_cast<QSwipeGesture *>(swipe));
|
||||
else if (QGesture *pan = event->gesture(Qt::PanGesture))
|
||||
@ -126,6 +132,7 @@ void ImageWidget::panTriggered(QPanGesture *gesture)
|
||||
}
|
||||
#endif
|
||||
QPointF delta = gesture->delta();
|
||||
qCDebug(lcExample) << "panTriggered():" << delta;
|
||||
horizontalOffset += delta.x();
|
||||
verticalOffset += delta.y();
|
||||
update();
|
||||
@ -135,13 +142,16 @@ void ImageWidget::pinchTriggered(QPinchGesture *gesture)
|
||||
{
|
||||
QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags();
|
||||
if (changeFlags & QPinchGesture::RotationAngleChanged) {
|
||||
qreal value = gesture->property("rotationAngle").toReal();
|
||||
qreal lastValue = gesture->property("lastRotationAngle").toReal();
|
||||
rotationAngle += value - lastValue;
|
||||
const qreal value = gesture->property("rotationAngle").toReal();
|
||||
const qreal lastValue = gesture->property("lastRotationAngle").toReal();
|
||||
const qreal rotationAngleDelta = value - lastValue;
|
||||
rotationAngle += rotationAngleDelta;
|
||||
qCDebug(lcExample) << "pinchTriggered(): rotation by" << rotationAngleDelta << rotationAngle;
|
||||
}
|
||||
if (changeFlags & QPinchGesture::ScaleFactorChanged) {
|
||||
qreal value = gesture->property("scaleFactor").toReal();
|
||||
currentStepScaleFactor = value;
|
||||
qCDebug(lcExample) << "pinchTriggered(): " << currentStepScaleFactor;
|
||||
}
|
||||
if (gesture->state() == Qt::GestureFinished) {
|
||||
scaleFactor *= currentStepScaleFactor;
|
||||
@ -155,10 +165,13 @@ void ImageWidget::swipeTriggered(QSwipeGesture *gesture)
|
||||
{
|
||||
if (gesture->state() == Qt::GestureFinished) {
|
||||
if (gesture->horizontalDirection() == QSwipeGesture::Left
|
||||
|| gesture->verticalDirection() == QSwipeGesture::Up)
|
||||
|| gesture->verticalDirection() == QSwipeGesture::Up) {
|
||||
qCDebug(lcExample) << "swipeTriggered(): swipe to previous";
|
||||
goPrevImage();
|
||||
else
|
||||
} else {
|
||||
qCDebug(lcExample) << "swipeTriggered(): swipe to next";
|
||||
goNextImage();
|
||||
}
|
||||
update();
|
||||
}
|
||||
}
|
||||
@ -184,17 +197,22 @@ void ImageWidget::openDirectory(const QString &path)
|
||||
|
||||
QImage ImageWidget::loadImage(const QString &fileName)
|
||||
{
|
||||
qDebug() << position << files << fileName;
|
||||
QImageReader reader(fileName);
|
||||
qCDebug(lcExample) << "loading" << QDir::toNativeSeparators(fileName) << position << '/' << files.size();
|
||||
if (!reader.canRead()) {
|
||||
qDebug() << fileName << ": can't load image";
|
||||
qCWarning(lcExample) << QDir::toNativeSeparators(fileName) << ": can't load image";
|
||||
return QImage();
|
||||
}
|
||||
|
||||
QImage image;
|
||||
if (!reader.read(&image)) {
|
||||
qDebug() << fileName << ": corrupted image";
|
||||
qCWarning(lcExample) << QDir::toNativeSeparators(fileName) << ": corrupted image: " << reader.errorString();
|
||||
return QImage();
|
||||
}
|
||||
const QSize maximumSize(2000, 2000); // Reduce in case someone has large photo images.
|
||||
if (image.size().width() > maximumSize.width() || image.height() > maximumSize.height())
|
||||
image = image.scaled(maximumSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
return image;
|
||||
}
|
||||
|
||||
@ -238,7 +256,7 @@ void ImageWidget::goToImage(int index)
|
||||
return;
|
||||
|
||||
if (index < 0 || index >= files.size()) {
|
||||
qDebug() << "goToImage: invalid index: " << index;
|
||||
qCWarning(lcExample) << "goToImage: invalid index: " << index;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
@ -52,6 +52,8 @@ class QPinchGesture;
|
||||
class QSwipeGesture;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcExample)
|
||||
|
||||
//! [class definition begin]
|
||||
class ImageWidget : public QWidget
|
||||
{
|
||||
@ -60,6 +62,7 @@ class ImageWidget : public QWidget
|
||||
public:
|
||||
ImageWidget(QWidget *parent = 0);
|
||||
void openDirectory(const QString &path);
|
||||
void grabGestures(const QList<Qt::GestureType> &gestures);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
@ -88,11 +91,11 @@ private:
|
||||
QImage prevImage, nextImage;
|
||||
QImage currentImage;
|
||||
|
||||
float horizontalOffset;
|
||||
float verticalOffset;
|
||||
float rotationAngle;
|
||||
float scaleFactor;
|
||||
float currentStepScaleFactor;
|
||||
qreal horizontalOffset;
|
||||
qreal verticalOffset;
|
||||
qreal rotationAngle;
|
||||
qreal scaleFactor;
|
||||
qreal currentStepScaleFactor;
|
||||
//! [class definition end]
|
||||
};
|
||||
//! [class definition end]
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
@ -42,17 +42,86 @@
|
||||
|
||||
#include "mainwidget.h"
|
||||
|
||||
static void showHelp(QCommandLineParser &parser, const QString errorMessage = QString())
|
||||
{
|
||||
QString text;
|
||||
QTextStream str(&text);
|
||||
str << "<html><head/><body>";
|
||||
if (!errorMessage.isEmpty())
|
||||
str << "<p>" << errorMessage << "</p>";
|
||||
str << "<pre>" << parser.helpText() << "</pre></body></html>";
|
||||
QMessageBox box(errorMessage.isEmpty() ? QMessageBox::Information : QMessageBox::Warning,
|
||||
QGuiApplication::applicationDisplayName(), text,
|
||||
QMessageBox::Ok);
|
||||
box.setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
box.exec();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
|
||||
QCoreApplication::setApplicationName(QStringLiteral("imagegestures"));
|
||||
QGuiApplication::setApplicationDisplayName(QStringLiteral("Image Gestures Example"));
|
||||
|
||||
QCommandLineParser commandLineParser;
|
||||
const QCommandLineOption disablePanOption("no-pan", "Disable pan gesture");
|
||||
commandLineParser.addOption(disablePanOption);
|
||||
const QCommandLineOption disablePinchOption("no-pinch", "Disable pinch gesture");
|
||||
commandLineParser.addOption(disablePinchOption);
|
||||
const QCommandLineOption disableSwipeOption("no-swipe", "Disable swipe gesture");
|
||||
commandLineParser.addOption(disableSwipeOption);
|
||||
const QCommandLineOption helpOption = commandLineParser.addHelpOption();
|
||||
commandLineParser.addPositionalArgument(QStringLiteral("Directory"),
|
||||
QStringLiteral("Directory to display"));
|
||||
|
||||
const QString description = QGuiApplication::applicationDisplayName()
|
||||
+ QLatin1String("\n\nEnable \"debug\" on the logging category \"qt.examples.imagegestures\" in order to\n"
|
||||
"in order to obtain verbose information about Qt's gesture event processing,\n"
|
||||
"for example by setting the environment variables QT_LOGGING_RULES to\n"
|
||||
"qt.examples.imagegestures.debug=true\n");
|
||||
commandLineParser.setApplicationDescription(description);
|
||||
|
||||
if (!commandLineParser.parse(QCoreApplication::arguments())) {
|
||||
showHelp(commandLineParser, commandLineParser.errorText());
|
||||
return -1;
|
||||
}
|
||||
if (commandLineParser.isSet(helpOption)) {
|
||||
showHelp(commandLineParser);
|
||||
return 0;
|
||||
}
|
||||
|
||||
QStringList arguments = commandLineParser.positionalArguments();
|
||||
if (!arguments.isEmpty() && !QFileInfo(arguments.front()).isDir()) {
|
||||
showHelp(commandLineParser,
|
||||
QLatin1Char('"') + QDir::toNativeSeparators(arguments.front())
|
||||
+ QStringLiteral("\" is not a directory."));
|
||||
return -1;
|
||||
}
|
||||
|
||||
QList<Qt::GestureType> gestures;
|
||||
if (!commandLineParser.isSet(disablePanOption))
|
||||
gestures << Qt::PanGesture;
|
||||
if (!commandLineParser.isSet(disablePinchOption))
|
||||
gestures << Qt::PinchGesture;
|
||||
if (!commandLineParser.isSet(disableSwipeOption))
|
||||
gestures << Qt::SwipeGesture;
|
||||
|
||||
MainWidget w;
|
||||
w.grabGestures(gestures);
|
||||
w.show();
|
||||
|
||||
if (QApplication::arguments().size() > 1)
|
||||
w.openDirectory(QApplication::arguments().at(1));
|
||||
else
|
||||
w.openDirectory(QFileDialog::getExistingDirectory(0, "Select image folder"));
|
||||
if (arguments.isEmpty()) {
|
||||
const QStringList picturesLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
|
||||
const QString directory =
|
||||
QFileDialog::getExistingDirectory(&w, "Select image folder",
|
||||
picturesLocations.isEmpty() ? QString() : picturesLocations.front());
|
||||
if (directory.isEmpty())
|
||||
return 0;
|
||||
arguments.append(directory);
|
||||
}
|
||||
|
||||
w.openDirectory(arguments.front());
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
@ -41,15 +41,28 @@
|
||||
#include "imagewidget.h"
|
||||
#include "mainwidget.h"
|
||||
|
||||
#include <QScreen>
|
||||
#include <QGuiApplication>
|
||||
#include <QDir>
|
||||
|
||||
MainWidget::MainWidget(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, imageWidget(new ImageWidget(this))
|
||||
{
|
||||
resize(400, 300);
|
||||
imageWidget = new ImageWidget(this);
|
||||
setCentralWidget(imageWidget);
|
||||
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableGeometry();
|
||||
QRect geometry(QPoint(0, 0), QSize(screenGeometry.width() * 3 / 4, screenGeometry.height() * 3 / 4));
|
||||
geometry.moveCenter(screenGeometry.center());
|
||||
setGeometry(geometry);
|
||||
}
|
||||
|
||||
void MainWidget::openDirectory(const QString &path)
|
||||
{
|
||||
setWindowTitle(QDir::toNativeSeparators(path));
|
||||
imageWidget->openDirectory(path);
|
||||
}
|
||||
|
||||
void MainWidget::grabGestures(const QList<Qt::GestureType> &gestures)
|
||||
{
|
||||
imageWidget->grabGestures(gestures);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
@ -51,6 +51,7 @@ class MainWidget : public QMainWindow
|
||||
|
||||
public:
|
||||
MainWidget(QWidget *parent = 0);
|
||||
void grabGestures(const QList<Qt::GestureType> &gestures);
|
||||
|
||||
public slots:
|
||||
void openDirectory(const QString &path);
|
||||
|
@ -1,4 +1,4 @@
|
||||
QMAKE_TARGET_COMPANY = Digia Plc and/or its subsidiary(-ies)
|
||||
QMAKE_TARGET_PRODUCT = Qt5
|
||||
QMAKE_TARGET_DESCRIPTION = C++ application development framework.
|
||||
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
|
60
mkspecs/features/winrt/font_deployment.prf
Normal file
@ -0,0 +1,60 @@
|
||||
# Provide default fonts for windows phone
|
||||
# The DEFAULTFONTS variable indicates, whether the default set of fonts is
|
||||
# used for deployment. The check below won't work after the fonts are added
|
||||
# so this helper variable is added and used for the user warning check later.
|
||||
!defined(FONTS, var):winphone {
|
||||
FONTS = \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSans.ttf \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSans-Bold.ttf \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSans-BoldOblique.ttf \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSansMono.ttf \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSansMono-Bold.ttf \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSansMono-BoldOblique.ttf \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSansMono-Oblique.ttf \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSans-Oblique.ttf \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSerif.ttf \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSerif-Bold.ttf \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSerif-BoldOblique.ttf \
|
||||
$$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSerif-Oblique.ttf
|
||||
DEFAULTFONTS =
|
||||
}
|
||||
|
||||
if(build_pass:equals(TEMPLATE, "app"))| \
|
||||
if(!build_pass:equals(TEMPLATE, "vcapp")) {
|
||||
defined(DEFAULTFONTS, var) {
|
||||
message(Default fonts will automatically be deployed with your application. \
|
||||
To avoid automatic deployment unset the \"FONTS\" variable (\"FONTS =\") in your .pro file. \
|
||||
You can also customize which fonts are deployed by setting the \"FONTS\" variable.)
|
||||
}
|
||||
|
||||
contains(TEMPLATE, "vc.*") {
|
||||
BUILD_DIR = $$OUT_PWD
|
||||
} else {
|
||||
load(resolve_target)
|
||||
BUILD_DIR = $$dirname(QMAKE_RESOLVED_TARGET)
|
||||
}
|
||||
|
||||
for (FONT, FONTS) {
|
||||
font_$${FONT}.input = $$FONT
|
||||
font_$${FONT}.output = $$BUILD_DIR/fonts/$$basename(FONT)
|
||||
font_$${FONT}.CONFIG = verbatim
|
||||
QMAKE_SUBSTITUTES += font_$${FONT}
|
||||
}
|
||||
|
||||
!isEmpty(FONTS):equals(TEMPLATE, "app") {
|
||||
fonts.files = $$BUILD_DIR/fonts/*
|
||||
isEmpty($$target.path) {
|
||||
fonts.path = $$OUT_PWD/fonts
|
||||
} else {
|
||||
fonts.path = $$target.path/fonts
|
||||
}
|
||||
|
||||
INSTALLS += fonts
|
||||
}
|
||||
}
|
||||
|
||||
!isEmpty(FONTS):winphone:equals(TEMPLATE, "vcapp"):build_pass {
|
||||
fonts.files = $$OUT_PWD/fonts/*
|
||||
fonts.path = fonts
|
||||
DEPLOYMENT += fonts
|
||||
}
|
@ -28,6 +28,7 @@
|
||||
# WINRT_MANIFEST.iconic_tile_icon: Image file for the "iconic" tile template icon. Default provided by the mkspec.
|
||||
# WINRT_MANIFEST.iconic_tile_small: Image file for the small "iconic" tile template logo. Default provided by the mkspec.
|
||||
# WINRT_MANIFEST.capabilities: Specifies capabilities to add to the capability list.
|
||||
# WINRT_MANIFEST.capabilities_device: Specifies device capabilities to add to the capability list. (location, webcam...)
|
||||
# WINRT_MANIFEST.dependencies: Specifies dependencies required by the package.
|
||||
|
||||
# The manifest is generated for each build pass for normal apps, and only once for vcapps.
|
||||
@ -95,10 +96,14 @@
|
||||
|
||||
# Capabilities are given as a string list and may change with the configuration (network, sensors, etc.)
|
||||
WINRT_MANIFEST.capabilities = $$unique(WINRT_MANIFEST.capabilities)
|
||||
!isEmpty(WINRT_MANIFEST.capabilities)|winphone {
|
||||
WINRT_MANIFEST.capabilities_device = $$unique(WINRT_MANIFEST.capabilities_device)
|
||||
|
||||
!isEmpty(WINRT_MANIFEST.capabilities)|!isEmpty(WINRT_MANIFEST.capabilities_device)|winphone {
|
||||
MANIFEST_CAPABILITIES += "<Capabilities>"
|
||||
for(CAPABILITY, WINRT_MANIFEST.capabilities): \
|
||||
MANIFEST_CAPABILITIES += " <Capability Name=\"$$CAPABILITY\" />"
|
||||
!winphone:for(CAPABILITY, WINRT_MANIFEST.capabilities_device): \
|
||||
MANIFEST_CAPABILITIES += " <DeviceCapability Name=\"$$CAPABILITY\" />"
|
||||
MANIFEST_CAPABILITIES += "</Capabilities>"
|
||||
|
||||
WINRT_MANIFEST.capabilities = $$join(MANIFEST_CAPABILITIES, $$INDENT, $$INDENT)
|
||||
|
@ -7,6 +7,7 @@
|
||||
include(../common/winrt_winphone/qmake.conf)
|
||||
QMAKE_COMPILER_DEFINES += _MSC_VER=1700
|
||||
QMAKE_PLATFORM = winphone $$QMAKE_PLATFORM
|
||||
CONFIG += font_deployment
|
||||
DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP ARM __ARM__ __arm__
|
||||
|
||||
QMAKE_LFLAGS += /MACHINE:ARM
|
||||
|
@ -7,6 +7,7 @@
|
||||
include(../common/winrt_winphone/qmake.conf)
|
||||
QMAKE_COMPILER_DEFINES += _MSC_VER=1700
|
||||
QMAKE_PLATFORM = winphone $$QMAKE_PLATFORM
|
||||
CONFIG += font_deployment
|
||||
DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP X86 __X86__ __x86__
|
||||
|
||||
QMAKE_LFLAGS += /MACHINE:X86
|
||||
|
@ -2382,6 +2382,118 @@
|
||||
|
||||
See also \l{#DEPENDPATH}{DEPENDPATH}.
|
||||
|
||||
\target WINRT_MANIFEST
|
||||
\section1 WINRT_MANIFEST
|
||||
|
||||
Specifies parameters to be passed to the application manifest on \l{Qt for WinRT}{Windows
|
||||
Runtime}. The allowed values are:
|
||||
|
||||
\table
|
||||
\header
|
||||
\li Member
|
||||
\li Description
|
||||
\row
|
||||
\li architecture
|
||||
\li The target architecture. Defaults to \c VCPROJ_ARCH.
|
||||
\row
|
||||
\li arguments
|
||||
\li Allows arguments to be passed to the executable.
|
||||
\row
|
||||
\li author
|
||||
\li Package author. Defaults to \c{Default package author}.
|
||||
This option is only available for Windows Phone.
|
||||
\row
|
||||
\li background
|
||||
\li Tile background color. Defaults to \c{green}.
|
||||
\row
|
||||
\li capabilities
|
||||
\li Specifies capabilities to add to the capability list.
|
||||
\row
|
||||
\li capabilities_device
|
||||
\li Specifies device capabilities to add to the capability list
|
||||
(location, webcam, and so on). This option is not available on Windows Phone.
|
||||
\row
|
||||
\li dependencies
|
||||
\li Specifies dependencies required by the package.
|
||||
\row
|
||||
\li description
|
||||
\li Package description. Defaults to \c{Default package description}.
|
||||
\row
|
||||
\li foreground
|
||||
\li Tile foreground (text) color. Defaults to \c{light}.
|
||||
This option is only available for Windows Store apps on Windows 8 and Windows RT.
|
||||
\row
|
||||
\li genre
|
||||
\li Package genre. Defaults to \c{apps.normal}.
|
||||
This option is only available for Windows Phone.
|
||||
\row
|
||||
\li iconic_tile_icon
|
||||
\li Image file for the \c{iconic} tile template icon. Default provided by
|
||||
the mkspec.
|
||||
\row
|
||||
\li iconic_tile_small
|
||||
\li Image file for the small \c{iconic} tile template logo. Default provided
|
||||
by the mkspec.
|
||||
\row
|
||||
\li identity
|
||||
\li The unique ID of the app. Defaults to reusing the existing generated
|
||||
manifest's UUID, or generates a new UUID if none is present.
|
||||
\row
|
||||
\li logo_large
|
||||
\li Large logo image file. Default provided by the mkspec.
|
||||
\row
|
||||
\li logo_medium
|
||||
\li Medium logo image file. Default provided by the mkspec.
|
||||
\row
|
||||
\li logo_small
|
||||
\li Small logo image file. Default provided by the mkspec.
|
||||
\row
|
||||
\li logo_store
|
||||
\li Logo image file for Windows Store. Default provided by the mkspec.
|
||||
\row
|
||||
\li name
|
||||
\li The name of the package as displayed to the user. Defaults to TARGET.
|
||||
\row
|
||||
\li publisher
|
||||
\li Display name of the publisher. Defaults to \c{Default publisher display name}.
|
||||
\row
|
||||
\li publisher_id
|
||||
\li On Windows 8 or Windows RT, the publisher's distinguished name (default: \c{CN=MyCN}).
|
||||
On Windows Phone, the publisher's UUID (default: invalid UUID string).
|
||||
\row
|
||||
\li splash_screen
|
||||
\li Splash screen image file. Default provided by the mkspec.
|
||||
\row
|
||||
\li target
|
||||
\li The name of the target (.exe). Defaults to TARGET.
|
||||
\row
|
||||
\li version
|
||||
\li The version number of the package. Defaults to \c{1.0.0.0}.
|
||||
\endtable
|
||||
|
||||
You can use any combination of those values.
|
||||
|
||||
For example:
|
||||
|
||||
\code
|
||||
WINRT_MANIFEST.publisher = MyCompany
|
||||
WINRT_MANIFEST.logo_store = someImage.png
|
||||
winphone {
|
||||
WINRT_MANIFEST.capabilities += ID_CAP_LOCATION ID_CAP_NETWORKING
|
||||
} else {
|
||||
WINRT_MANIFEST.capabilities += internetClient
|
||||
WINRT_MANIFEST.device_capabilities += location
|
||||
}
|
||||
\endcode
|
||||
|
||||
Additionally, an input manifest file can be specified by using WINRT_MANIFEST.
|
||||
|
||||
For example:
|
||||
|
||||
\code
|
||||
WINRT_MANIFEST = someManifest.xml.in
|
||||
\endcode
|
||||
|
||||
\target YACCSOURCES
|
||||
\section1 YACCSOURCES
|
||||
|
||||
|
@ -3299,7 +3299,7 @@ MakefileGenerator::writePkgConfigFile()
|
||||
pkgConfiglibName = "-framework " + bundle + " ";
|
||||
} else {
|
||||
pkgConfiglibDir = "-L${libdir}";
|
||||
pkgConfiglibName = "-l" + fileInfo(fname).completeBaseName();
|
||||
pkgConfiglibName = "-l" + unescapeFilePath(project->first("QMAKE_ORIG_TARGET"));
|
||||
if (project->isActiveConfig("shared"))
|
||||
pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString();
|
||||
}
|
||||
|
4
src/3rdparty/angle/src/libEGL/main.cpp
vendored
@ -69,6 +69,8 @@ void DeallocateCurrent()
|
||||
|
||||
}
|
||||
|
||||
#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
|
||||
|
||||
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
switch (reason)
|
||||
@ -124,6 +126,8 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // !QT_OPENGL_ES_2_ANGLE_STATIC
|
||||
|
||||
namespace egl
|
||||
{
|
||||
|
||||
|
4
src/3rdparty/angle/src/libGLESv2/main.cpp
vendored
@ -66,6 +66,8 @@ void DeallocateCurrent()
|
||||
|
||||
}
|
||||
|
||||
#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
|
||||
|
||||
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
switch (reason)
|
||||
@ -107,6 +109,8 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // !QT_OPENGL_ES_2_ANGLE_STATIC
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
||||
|
7
src/3rdparty/sqlite/sqlite3.c
vendored
@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
** This file is an amalgamation of many separate C source files from SQLite
|
||||
** version 3.8.4.1. By combining all the individual C code files into this
|
||||
** version 3.8.4.2. By combining all the individual C code files into this
|
||||
** single large file, the entire code can be compiled as a single translation
|
||||
** unit. This allows many compilers to do optimizations that would not be
|
||||
** possible if the files were compiled separately. Performance improvements
|
||||
@ -222,9 +222,9 @@ extern "C" {
|
||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||
** [sqlite_version()] and [sqlite_source_id()].
|
||||
*/
|
||||
#define SQLITE_VERSION "3.8.4.1"
|
||||
#define SQLITE_VERSION "3.8.4.2"
|
||||
#define SQLITE_VERSION_NUMBER 3008004
|
||||
#define SQLITE_SOURCE_ID "2014-03-11 15:27:36 018d317b1257ce68a92908b05c9c7cf1494050d0"
|
||||
#define SQLITE_SOURCE_ID "2014-03-26 18:51:19 02ea166372bdb2ef9d8dfbb05e78a97609673a8e"
|
||||
|
||||
/*
|
||||
** CAPI3REF: Run-Time Library Version Numbers
|
||||
@ -64786,6 +64786,7 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompare(
|
||||
}else{
|
||||
idx1 = getVarint32(aKey1, szHdr1);
|
||||
d1 = szHdr1;
|
||||
if( d1>(unsigned)nKey1 ) return 1; /* Corruption */
|
||||
i = 0;
|
||||
}
|
||||
|
||||
|
4
src/3rdparty/sqlite/sqlite3.h
vendored
@ -107,9 +107,9 @@ extern "C" {
|
||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||
** [sqlite_version()] and [sqlite_source_id()].
|
||||
*/
|
||||
#define SQLITE_VERSION "3.8.4.1"
|
||||
#define SQLITE_VERSION "3.8.4.2"
|
||||
#define SQLITE_VERSION_NUMBER 3008004
|
||||
#define SQLITE_SOURCE_ID "2014-03-11 15:27:36 018d317b1257ce68a92908b05c9c7cf1494050d0"
|
||||
#define SQLITE_SOURCE_ID "2014-03-26 18:51:19 02ea166372bdb2ef9d8dfbb05e78a97609673a8e"
|
||||
|
||||
/*
|
||||
** CAPI3REF: Run-Time Library Version Numbers
|
||||
|
@ -120,7 +120,7 @@ public class QtActivityDelegate
|
||||
|
||||
private boolean m_keyboardIsVisible = false;
|
||||
public boolean m_backKeyPressedSent = false;
|
||||
|
||||
private long m_showHideTimeStamp = System.nanoTime();
|
||||
|
||||
public void setFullScreen(boolean enterFullScreen)
|
||||
{
|
||||
@ -201,12 +201,18 @@ public class QtActivityDelegate
|
||||
private final int ApplicationInactive = 0x2;
|
||||
private final int ApplicationActive = 0x4;
|
||||
|
||||
public void setKeyboardVisibility(boolean visibility)
|
||||
|
||||
public boolean setKeyboardVisibility(boolean visibility, long timeStamp)
|
||||
{
|
||||
if (m_showHideTimeStamp > timeStamp)
|
||||
return false;
|
||||
m_showHideTimeStamp = timeStamp;
|
||||
|
||||
if (m_keyboardIsVisible == visibility)
|
||||
return;
|
||||
return false;
|
||||
m_keyboardIsVisible = visibility;
|
||||
QtNative.keyboardVisibilityChanged(m_keyboardIsVisible);
|
||||
return true;
|
||||
}
|
||||
public void resetSoftwareKeyboard()
|
||||
{
|
||||
@ -304,11 +310,11 @@ public class QtActivityDelegate
|
||||
QtNativeInputConnection.updateCursorPosition();
|
||||
//FALLTHROUGH
|
||||
case InputMethodManager.RESULT_UNCHANGED_SHOWN:
|
||||
setKeyboardVisibility(true);
|
||||
setKeyboardVisibility(true, System.nanoTime());
|
||||
break;
|
||||
case InputMethodManager.RESULT_HIDDEN:
|
||||
case InputMethodManager.RESULT_UNCHANGED_HIDDEN:
|
||||
setKeyboardVisibility(false);
|
||||
setKeyboardVisibility(false, System.nanoTime());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -331,11 +337,11 @@ public class QtActivityDelegate
|
||||
switch (resultCode) {
|
||||
case InputMethodManager.RESULT_SHOWN:
|
||||
case InputMethodManager.RESULT_UNCHANGED_SHOWN:
|
||||
setKeyboardVisibility(true);
|
||||
setKeyboardVisibility(true, System.nanoTime());
|
||||
break;
|
||||
case InputMethodManager.RESULT_HIDDEN:
|
||||
case InputMethodManager.RESULT_UNCHANGED_HIDDEN:
|
||||
setKeyboardVisibility(false);
|
||||
setKeyboardVisibility(false, System.nanoTime());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -827,7 +833,7 @@ public class QtActivityDelegate
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && !m_backKeyPressedSent) {
|
||||
hideSoftwareKeyboard();
|
||||
setKeyboardVisibility(false);
|
||||
setKeyboardVisibility(false, System.nanoTime());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,8 @@ class QtExtractedText
|
||||
|
||||
class QtNativeInputConnection
|
||||
{
|
||||
static native boolean beginBatchEdit();
|
||||
static native boolean endBatchEdit();
|
||||
static native boolean commitText(String text, int newCursorPosition);
|
||||
static native boolean commitCompletion(String text, int position);
|
||||
static native boolean deleteSurroundingText(int leftLength, int rightLength);
|
||||
@ -82,18 +84,11 @@ class QtNativeInputConnection
|
||||
}
|
||||
|
||||
class HideKeyboardRunnable implements Runnable {
|
||||
private QtInputConnection m_connection;
|
||||
HideKeyboardRunnable(QtInputConnection connection)
|
||||
{
|
||||
m_connection = connection;
|
||||
}
|
||||
private long m_hideTimeStamp = System.nanoTime();
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (m_connection.getInputState() == QtInputConnection.InputStates.Hiding) {
|
||||
QtNative.activityDelegate().setKeyboardVisibility(false);
|
||||
m_connection.reset();
|
||||
}
|
||||
QtNative.activityDelegate().setKeyboardVisibility(false, m_hideTimeStamp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,34 +102,14 @@ public class QtInputConnection extends BaseInputConnection
|
||||
private static final int ID_SWITCH_INPUT_METHOD = android.R.id.switchInputMethod;
|
||||
private static final int ID_ADD_TO_DICTIONARY = android.R.id.addToDictionary;
|
||||
|
||||
|
||||
enum InputStates { Visible, FinishComposing, Hiding };
|
||||
|
||||
private QtEditText m_view = null;
|
||||
private InputStates m_inputState = InputStates.Visible;
|
||||
|
||||
public void reset()
|
||||
{
|
||||
m_inputState = InputStates.Visible;
|
||||
}
|
||||
|
||||
public InputStates getInputState()
|
||||
{
|
||||
return m_inputState;
|
||||
}
|
||||
|
||||
private void setClosing(boolean closing)
|
||||
{
|
||||
if (closing && m_inputState == InputStates.Hiding)
|
||||
return;
|
||||
|
||||
if (closing && m_view.getActivityDelegate().isSoftwareKeyboardVisible()) {
|
||||
m_view.postDelayed(new HideKeyboardRunnable(this), 100);
|
||||
m_inputState = InputStates.Hiding;
|
||||
if (closing) {
|
||||
m_view.postDelayed(new HideKeyboardRunnable(), 100);
|
||||
} else {
|
||||
if (m_inputState == InputStates.Hiding)
|
||||
QtNative.activityDelegate().setKeyboardVisibility(true);
|
||||
m_inputState = closing ? InputStates.FinishComposing : InputStates.Visible;
|
||||
QtNative.activityDelegate().setKeyboardVisibility(true, System.nanoTime());
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,14 +123,14 @@ public class QtInputConnection extends BaseInputConnection
|
||||
public boolean beginBatchEdit()
|
||||
{
|
||||
setClosing(false);
|
||||
return true;
|
||||
return QtNativeInputConnection.beginBatchEdit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean endBatchEdit()
|
||||
{
|
||||
// setClosing(false);
|
||||
return true;
|
||||
setClosing(false);
|
||||
return QtNativeInputConnection.endBatchEdit();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,7 +4,8 @@
|
||||
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
|
||||
android:name="org.qtproject.qt5.android.bindings.QtActivity"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="unspecified">
|
||||
android:screenOrientation="unspecified"
|
||||
android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<array name="qt_sources">
|
||||
<item>https://download.qt-project.org/ministro/android/qt5/qt-5.2</item>
|
||||
<item>https://download.qt-project.org/ministro/android/qt5/qt-5.3</item>
|
||||
</array>
|
||||
|
||||
<!-- The following is handled automatically by the deployment tool. It should
|
||||
|
@ -0,0 +1,63 @@
|
||||
From 6545677945d24854007d39fed86d4e44900b5c1a Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Knight <andrew.knight@digia.com>
|
||||
Date: Thu, 27 Mar 2014 15:36:52 +0200
|
||||
Subject: [PATCH] ANGLE: Don't export DLLMain functions for static builds
|
||||
|
||||
These ifdef guards were originally a part of
|
||||
"0004-Make-it-possible-to-link-ANGLE-statically-for-single.patch",
|
||||
but were lost during the last ANGLE upgrade.
|
||||
|
||||
Task-number: QTBUG-37842
|
||||
Change-Id: I4340c1641675dd310c14454a851eb4bc0ae2ec0d
|
||||
---
|
||||
src/3rdparty/angle/src/libEGL/main.cpp | 4 ++++
|
||||
src/3rdparty/angle/src/libGLESv2/main.cpp | 4 ++++
|
||||
2 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp
|
||||
index e972691..4cdf5f0 100644
|
||||
--- a/src/3rdparty/angle/src/libEGL/main.cpp
|
||||
+++ b/src/3rdparty/angle/src/libEGL/main.cpp
|
||||
@@ -69,6 +69,8 @@ void DeallocateCurrent()
|
||||
|
||||
}
|
||||
|
||||
+#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
|
||||
+
|
||||
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
switch (reason)
|
||||
@@ -124,6 +126,8 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+#endif // !QT_OPENGL_ES_2_ANGLE_STATIC
|
||||
+
|
||||
namespace egl
|
||||
{
|
||||
|
||||
diff --git a/src/3rdparty/angle/src/libGLESv2/main.cpp b/src/3rdparty/angle/src/libGLESv2/main.cpp
|
||||
index 95f4b8d..e527994 100644
|
||||
--- a/src/3rdparty/angle/src/libGLESv2/main.cpp
|
||||
+++ b/src/3rdparty/angle/src/libGLESv2/main.cpp
|
||||
@@ -66,6 +66,8 @@ void DeallocateCurrent()
|
||||
|
||||
}
|
||||
|
||||
+#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
|
||||
+
|
||||
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
switch (reason)
|
||||
@@ -107,6 +109,8 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+#endif // !QT_OPENGL_ES_2_ANGLE_STATIC
|
||||
+
|
||||
namespace gl
|
||||
{
|
||||
|
||||
--
|
||||
1.8.4.msysgit.0
|
||||
|
@ -9,6 +9,11 @@ DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
|
||||
SOURCES += main.cpp
|
||||
win32:!winrt: LIBS += -lole32
|
||||
|
||||
winrt:equals(WINSDK_VER, 8.1) {
|
||||
DEFINES += D3DCOMPILER_LINKED
|
||||
LIBS += -ld3dcompiler
|
||||
}
|
||||
|
||||
# __stdcall exports get mangled, so use a def file
|
||||
DEF_FILE += $${TARGET}.def
|
||||
|
||||
|
@ -52,6 +52,12 @@
|
||||
#include <qt_windows.h>
|
||||
#include <d3dcommon.h>
|
||||
|
||||
#ifdef D3DCOMPILER_LINKED
|
||||
namespace D3D {
|
||||
# include <d3dcompiler.h>
|
||||
}
|
||||
#endif // D3DCOMPILER_LINKED
|
||||
|
||||
Q_LOGGING_CATEGORY(QT_D3DCOMPILER, "qt.angle.d3dcompiler")
|
||||
|
||||
namespace D3DCompiler {
|
||||
@ -127,6 +133,7 @@ private:
|
||||
|
||||
static bool loadCompiler()
|
||||
{
|
||||
#ifndef D3DCOMPILER_LINKED
|
||||
static HMODULE d3dcompiler = 0;
|
||||
if (!d3dcompiler) {
|
||||
const wchar_t *dllNames[] = {
|
||||
@ -157,7 +164,9 @@ static bool loadCompiler()
|
||||
if (!d3dcompiler)
|
||||
qCDebug(QT_D3DCOMPILER) << "Unable to load D3D shader compiler.";
|
||||
}
|
||||
|
||||
#else // !D3DCOMPILER_LINKED
|
||||
compile = &D3D::D3DCompile;
|
||||
#endif // D3DCOMPILER_LINKED
|
||||
return bool(compile);
|
||||
}
|
||||
|
||||
@ -190,9 +199,19 @@ HRESULT WINAPI D3DCompile(
|
||||
}
|
||||
|
||||
static bool initialized = false;
|
||||
static QString binaryPath;
|
||||
static QStringList binaryPaths;
|
||||
static QString sourcePath;
|
||||
if (!initialized) {
|
||||
// Precompiled directory
|
||||
QString precompiledPath;
|
||||
if (qEnvironmentVariableIsSet("QT_D3DCOMPILER_BINARY_DIR"))
|
||||
precompiledPath = QString::fromLocal8Bit(qgetenv("QT_D3DCOMPILER_BINARY_DIR"));
|
||||
else
|
||||
precompiledPath = QStringLiteral(":/qt.d3dcompiler"); // Default QRC path
|
||||
if (QDir(precompiledPath).exists())
|
||||
binaryPaths.append(precompiledPath);
|
||||
|
||||
// Service directory
|
||||
QString base;
|
||||
if (qEnvironmentVariableIsSet("QT_D3DCOMPILER_DIR"))
|
||||
base = QString::fromLocal8Bit(qgetenv("QT_D3DCOMPILER_DIR"));
|
||||
@ -203,28 +222,33 @@ HRESULT WINAPI D3DCompile(
|
||||
base = location + QStringLiteral("/d3dcompiler");
|
||||
}
|
||||
|
||||
// Unless the service has run, this directory won't exist.
|
||||
// Create the directory structure
|
||||
QDir baseDir(base);
|
||||
if (baseDir.exists()) {
|
||||
// Check if we have can read/write blobs
|
||||
if (baseDir.exists(QStringLiteral("binary"))) {
|
||||
binaryPath = baseDir.absoluteFilePath(QStringLiteral("binary/"));
|
||||
} else {
|
||||
qCWarning(QT_D3DCOMPILER) << "D3D compiler base directory exists, but the binary directory does not.\n"
|
||||
"Check the compiler service.";
|
||||
if (!baseDir.exists()) {
|
||||
baseDir.cdUp();
|
||||
if (!baseDir.mkdir(QStringLiteral("d3dcompiler"))) {
|
||||
qCWarning(QT_D3DCOMPILER) << "Unable to create shader base directory:"
|
||||
<< QDir::toNativeSeparators(baseDir.absolutePath());
|
||||
if (binaryPaths.isEmpty()) // No possibility to get a shader, abort
|
||||
return E_FAIL;
|
||||
}
|
||||
baseDir.cd(QStringLiteral("d3dcompiler"));
|
||||
}
|
||||
|
||||
// Check if we can write shader source
|
||||
if (baseDir.exists(QStringLiteral("source"))) {
|
||||
sourcePath = baseDir.absoluteFilePath(QStringLiteral("source/"));
|
||||
} else {
|
||||
qCWarning(QT_D3DCOMPILER) << "D3D compiler base directory exists, but the source directory does not.\n"
|
||||
"Check the compiler service.";
|
||||
}
|
||||
if (!baseDir.exists(QStringLiteral("binary")) && !baseDir.mkdir(QStringLiteral("binary"))) {
|
||||
qCWarning(QT_D3DCOMPILER) << "Unable to create shader binary directory:"
|
||||
<< QDir::toNativeSeparators(baseDir.absoluteFilePath(QStringLiteral("binary")));
|
||||
if (binaryPaths.isEmpty()) // No possibility to get a shader, abort
|
||||
return E_FAIL;
|
||||
} else {
|
||||
qCWarning(QT_D3DCOMPILER) << "D3D compiler base directory does not exist:"
|
||||
<< QDir::toNativeSeparators(base)
|
||||
<< "\nCheck that the compiler service is running.";
|
||||
binaryPaths.append(baseDir.absoluteFilePath(QStringLiteral("binary/")));
|
||||
}
|
||||
|
||||
if (!baseDir.exists(QStringLiteral("source")) && !baseDir.mkdir(QStringLiteral("source"))) {
|
||||
qCWarning(QT_D3DCOMPILER) << "Unable to create shader source directory:"
|
||||
<< QDir::toNativeSeparators(baseDir.absoluteFilePath(QStringLiteral("source")));
|
||||
} else {
|
||||
sourcePath = baseDir.absoluteFilePath(QStringLiteral("source/"));
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
@ -245,8 +269,8 @@ HRESULT WINAPI D3DCompile(
|
||||
+ QLatin1Char('!') + QString::number(sflags);
|
||||
|
||||
// Check if pre-compiled shader blob is available
|
||||
if (!binaryPath.isEmpty()) {
|
||||
QString blobName = binaryPath + fileName;
|
||||
foreach (const QString &path, binaryPaths) {
|
||||
QString blobName = path + fileName;
|
||||
QFile blob(blobName);
|
||||
while (!blob.exists()) {
|
||||
// Progressively drop optional parts
|
||||
@ -262,6 +286,7 @@ HRESULT WINAPI D3DCompile(
|
||||
return S_FALSE;
|
||||
}
|
||||
qCDebug(QT_D3DCOMPILER) << "Found, but unable to open, precompiled shader blob at" << blob.fileName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,7 +309,7 @@ HRESULT WINAPI D3DCompile(
|
||||
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
QFile blob(binaryPath + fileName);
|
||||
QFile blob(binaryPaths.last() + fileName);
|
||||
while (!(blob.exists() && blob.open(QFile::ReadOnly)) && timer.elapsed() < timeout)
|
||||
QThread::msleep(100);
|
||||
|
||||
|
@ -37,6 +37,7 @@ exampledirs += \
|
||||
snippets \
|
||||
../../../examples/threads/ \
|
||||
../../../examples/tools/ \
|
||||
../../../examples/ipc/ \
|
||||
../../../examples/json/ \
|
||||
../../../examples/network/dnslookup
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include <qfileinfo.h>
|
||||
#include <qvarlengtharray.h>
|
||||
|
||||
//#define FSEVENT_DEBUG
|
||||
#undef FSEVENT_DEBUG
|
||||
#ifdef FSEVENT_DEBUG
|
||||
# define DEBUG if (true) qDebug
|
||||
#else
|
||||
@ -76,14 +76,16 @@ static void callBackFunction(ConstFSEventStreamRef streamRef,
|
||||
engine->processEvent(streamRef, numEvents, paths, eventFlags, eventIds);
|
||||
}
|
||||
|
||||
void QFseventsFileSystemWatcherEngine::checkDir(DirsByName::iterator &it)
|
||||
bool QFseventsFileSystemWatcherEngine::checkDir(DirsByName::iterator &it)
|
||||
{
|
||||
bool needsRestart = false;
|
||||
|
||||
QT_STATBUF st;
|
||||
const QString &name = it.key();
|
||||
Info &info = it->dirInfo;
|
||||
const int res = QT_STAT(QFile::encodeName(name), &st);
|
||||
if (res == -1) {
|
||||
derefPath(info.watchedPath);
|
||||
needsRestart |= derefPath(info.watchedPath);
|
||||
emit emitDirectoryChanged(info.origPath, true);
|
||||
it = watchedDirectories.erase(it);
|
||||
} else if (st.st_ctimespec != info.ctime || st.st_mode != info.mode) {
|
||||
@ -127,26 +129,34 @@ void QFseventsFileSystemWatcherEngine::checkDir(DirsByName::iterator &it)
|
||||
if (dirChanged)
|
||||
emit emitDirectoryChanged(info.origPath, false);
|
||||
}
|
||||
|
||||
return needsRestart;
|
||||
}
|
||||
|
||||
void QFseventsFileSystemWatcherEngine::rescanDirs(const QString &path)
|
||||
bool QFseventsFileSystemWatcherEngine::rescanDirs(const QString &path)
|
||||
{
|
||||
bool needsRestart = false;
|
||||
|
||||
for (DirsByName::iterator it = watchedDirectories.begin(); it != watchedDirectories.end(); ) {
|
||||
if (it.key().startsWith(path))
|
||||
checkDir(it);
|
||||
needsRestart |= checkDir(it);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
|
||||
return needsRestart;
|
||||
}
|
||||
|
||||
void QFseventsFileSystemWatcherEngine::rescanFiles(InfoByName &filesInPath)
|
||||
bool QFseventsFileSystemWatcherEngine::rescanFiles(InfoByName &filesInPath)
|
||||
{
|
||||
bool needsRestart = false;
|
||||
|
||||
for (InfoByName::iterator it = filesInPath.begin(); it != filesInPath.end(); ) {
|
||||
QT_STATBUF st;
|
||||
QString name = it.key();
|
||||
const int res = QT_STAT(QFile::encodeName(name), &st);
|
||||
if (res == -1) {
|
||||
derefPath(it->watchedPath);
|
||||
needsRestart |= derefPath(it->watchedPath);
|
||||
emit emitFileChanged(it.value().origPath, true);
|
||||
it = filesInPath.erase(it);
|
||||
continue;
|
||||
@ -158,13 +168,17 @@ void QFseventsFileSystemWatcherEngine::rescanFiles(InfoByName &filesInPath)
|
||||
|
||||
++it;
|
||||
}
|
||||
|
||||
return needsRestart;
|
||||
}
|
||||
|
||||
void QFseventsFileSystemWatcherEngine::rescanFiles(const QString &path)
|
||||
bool QFseventsFileSystemWatcherEngine::rescanFiles(const QString &path)
|
||||
{
|
||||
bool needsRestart = false;
|
||||
|
||||
for (FilesByPath::iterator i = watchedFiles.begin(); i != watchedFiles.end(); ) {
|
||||
if (i.key().startsWith(path)) {
|
||||
rescanFiles(i.value());
|
||||
needsRestart |= rescanFiles(i.value());
|
||||
if (i.value().isEmpty()) {
|
||||
i = watchedFiles.erase(i);
|
||||
continue;
|
||||
@ -173,6 +187,8 @@ void QFseventsFileSystemWatcherEngine::rescanFiles(const QString &path)
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
return needsRestart;
|
||||
}
|
||||
|
||||
void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef streamRef,
|
||||
@ -184,11 +200,20 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
|
||||
#if defined(Q_OS_OSX) && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_6
|
||||
Q_UNUSED(streamRef);
|
||||
|
||||
bool needsRestart = false;
|
||||
|
||||
QMutexLocker locker(&lock);
|
||||
|
||||
for (size_t i = 0; i < numEvents; ++i) {
|
||||
FSEventStreamEventFlags eFlags = eventFlags[i];
|
||||
DEBUG("Change %llu in %s, flags %x", eventIds[i], eventPaths[i], (unsigned int)eFlags);
|
||||
|
||||
if (eFlags & kFSEventStreamEventFlagEventIdsWrapped) {
|
||||
DEBUG("\tthe event ids wrapped");
|
||||
lastReceivedEvent = 0;
|
||||
}
|
||||
lastReceivedEvent = qMax(lastReceivedEvent, eventIds[i]);
|
||||
|
||||
QString path = QFile::decodeName(eventPaths[i]);
|
||||
if (path.endsWith(QDir::separator()))
|
||||
path = path.mid(0, path.size() - 1);
|
||||
@ -199,38 +224,36 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
|
||||
DEBUG("\t\t... user dropped.");
|
||||
if (eFlags & kFSEventStreamEventFlagKernelDropped)
|
||||
DEBUG("\t\t... kernel dropped.");
|
||||
rescanDirs(path);
|
||||
rescanFiles(path);
|
||||
needsRestart |= rescanDirs(path);
|
||||
needsRestart |= rescanFiles(path);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eFlags & kFSEventStreamEventFlagEventIdsWrapped) {
|
||||
DEBUG("\tthe event ids wrapped");
|
||||
// TODO: verify if we need to do something
|
||||
}
|
||||
|
||||
if (eFlags & kFSEventStreamEventFlagRootChanged) {
|
||||
// re-check everything:
|
||||
DirsByName::iterator dirIt = watchedDirectories.find(path);
|
||||
if (dirIt != watchedDirectories.end())
|
||||
checkDir(dirIt);
|
||||
rescanFiles(path);
|
||||
needsRestart |= checkDir(dirIt);
|
||||
needsRestart |= rescanFiles(path);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((eFlags & kFSEventStreamEventFlagItemIsDir) && (eFlags & kFSEventStreamEventFlagItemRemoved))
|
||||
rescanDirs(path);
|
||||
needsRestart |= rescanDirs(path);
|
||||
|
||||
// check watched directories:
|
||||
DirsByName::iterator dirIt = watchedDirectories.find(path);
|
||||
if (dirIt != watchedDirectories.end())
|
||||
checkDir(dirIt);
|
||||
needsRestart |= checkDir(dirIt);
|
||||
|
||||
// check watched files:
|
||||
FilesByPath::iterator pIt = watchedFiles.find(path);
|
||||
if (pIt != watchedFiles.end())
|
||||
rescanFiles(pIt.value());
|
||||
needsRestart |= rescanFiles(pIt.value());
|
||||
}
|
||||
|
||||
if (needsRestart)
|
||||
emit scheduleStreamRestart();
|
||||
#else
|
||||
// This is a work-around for moc: when we put the version check at the top of the header file,
|
||||
// moc will still see the Q_OBJECT macro and generate a meta-object when compiling for 10.6,
|
||||
@ -248,14 +271,23 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
|
||||
|
||||
void QFseventsFileSystemWatcherEngine::doEmitFileChanged(const QString path, bool removed)
|
||||
{
|
||||
DEBUG() << "emitting fileChanged for" << path << "with removed =" << removed;
|
||||
emit fileChanged(path, removed);
|
||||
}
|
||||
|
||||
void QFseventsFileSystemWatcherEngine::doEmitDirectoryChanged(const QString path, bool removed)
|
||||
{
|
||||
DEBUG() << "emitting directoryChanged for" << path << "with removed =" << removed;
|
||||
emit directoryChanged(path, removed);
|
||||
}
|
||||
|
||||
void QFseventsFileSystemWatcherEngine::restartStream()
|
||||
{
|
||||
QMutexLocker locker(&lock);
|
||||
stopStream();
|
||||
startStream();
|
||||
}
|
||||
|
||||
QFseventsFileSystemWatcherEngine *QFseventsFileSystemWatcherEngine::create(QObject *parent)
|
||||
{
|
||||
return new QFseventsFileSystemWatcherEngine(parent);
|
||||
@ -264,6 +296,7 @@ QFseventsFileSystemWatcherEngine *QFseventsFileSystemWatcherEngine::create(QObje
|
||||
QFseventsFileSystemWatcherEngine::QFseventsFileSystemWatcherEngine(QObject *parent)
|
||||
: QFileSystemWatcherEngine(parent)
|
||||
, stream(0)
|
||||
, lastReceivedEvent(kFSEventStreamEventIdSinceNow)
|
||||
{
|
||||
|
||||
// We cannot use signal-to-signal queued connections, because the
|
||||
@ -272,6 +305,8 @@ QFseventsFileSystemWatcherEngine::QFseventsFileSystemWatcherEngine(QObject *pare
|
||||
this, SLOT(doEmitDirectoryChanged(const QString, bool)), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(emitFileChanged(const QString, bool)),
|
||||
this, SLOT(doEmitFileChanged(const QString, bool)), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(scheduleStreamRestart()),
|
||||
this, SLOT(restartStream()), Qt::QueuedConnection);
|
||||
|
||||
queue = dispatch_queue_create("org.qt-project.QFseventsFileSystemWatcherEngine", NULL);
|
||||
}
|
||||
@ -284,7 +319,7 @@ QFseventsFileSystemWatcherEngine::~QFseventsFileSystemWatcherEngine()
|
||||
// The assumption with the locking strategy is that this class cannot and will not be subclassed!
|
||||
QMutexLocker locker(&lock);
|
||||
|
||||
stopStream();
|
||||
stopStream(true);
|
||||
dispatch_release(queue);
|
||||
}
|
||||
|
||||
@ -292,12 +327,14 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
|
||||
QStringList *files,
|
||||
QStringList *directories)
|
||||
{
|
||||
if (stream)
|
||||
if (stream) {
|
||||
DEBUG("Flushing, last id is %llu", FSEventStreamGetLatestEventId(stream));
|
||||
FSEventStreamFlushSync(stream);
|
||||
}
|
||||
|
||||
QMutexLocker locker(&lock);
|
||||
|
||||
bool newWatchPathsFound = false;
|
||||
bool needsRestart = false;
|
||||
|
||||
QStringList p = paths;
|
||||
QMutableListIterator<QString> it(p);
|
||||
@ -343,8 +380,9 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
|
||||
|
||||
PathRefCounts::iterator it = watchedPaths.find(watchedPath);
|
||||
if (it == watchedPaths.end()) {
|
||||
newWatchPathsFound = true;
|
||||
needsRestart = true;
|
||||
watchedPaths.insert(watchedPath, 1);
|
||||
DEBUG("Adding '%s' to watchedPaths", qPrintable(watchedPath));
|
||||
} else {
|
||||
++it.value();
|
||||
}
|
||||
@ -355,12 +393,14 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
|
||||
dirInfo.dirInfo = info;
|
||||
dirInfo.entries = scanForDirEntries(realPath);
|
||||
watchedDirectories.insert(realPath, dirInfo);
|
||||
DEBUG("-- Also adding '%s' to watchedDirectories", qPrintable(realPath));
|
||||
} else {
|
||||
watchedFiles[parentPath].insert(realPath, info);
|
||||
DEBUG("-- Also adding '%s' to watchedFiles", qPrintable(realPath));
|
||||
}
|
||||
}
|
||||
|
||||
if (newWatchPathsFound) {
|
||||
if (needsRestart) {
|
||||
stopStream();
|
||||
if (!startStream())
|
||||
p = paths;
|
||||
@ -375,6 +415,8 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
|
||||
{
|
||||
QMutexLocker locker(&lock);
|
||||
|
||||
bool needsRestart = false;
|
||||
|
||||
QStringList p = paths;
|
||||
QMutableListIterator<QString> it(p);
|
||||
while (it.hasNext()) {
|
||||
@ -389,10 +431,11 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
|
||||
if (fi.isDir()) {
|
||||
DirsByName::iterator dirIt = watchedDirectories.find(realPath);
|
||||
if (dirIt != watchedDirectories.end()) {
|
||||
derefPath(dirIt->dirInfo.watchedPath);
|
||||
needsRestart |= derefPath(dirIt->dirInfo.watchedPath);
|
||||
watchedDirectories.erase(dirIt);
|
||||
directories->removeAll(origPath);
|
||||
it.remove();
|
||||
DEBUG("Removed directory '%s'", qPrintable(realPath));
|
||||
}
|
||||
} else {
|
||||
QFileInfo fi(realPath);
|
||||
@ -402,22 +445,32 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
|
||||
InfoByName &filesInDir = pIt.value();
|
||||
InfoByName::iterator fIt = filesInDir.find(realPath);
|
||||
if (fIt != filesInDir.end()) {
|
||||
derefPath(fIt->watchedPath);
|
||||
needsRestart |= derefPath(fIt->watchedPath);
|
||||
filesInDir.erase(fIt);
|
||||
if (filesInDir.isEmpty())
|
||||
watchedFiles.erase(pIt);
|
||||
files->removeAll(origPath);
|
||||
it.remove();
|
||||
DEBUG("Removed file '%s'", qPrintable(realPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
locker.unlock();
|
||||
|
||||
if (needsRestart)
|
||||
restartStream();
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
bool QFseventsFileSystemWatcherEngine::startStream()
|
||||
{
|
||||
Q_ASSERT(stream == 0);
|
||||
if (stream) // This shouldn't happen, but let's be nice and handle it.
|
||||
stopStream();
|
||||
|
||||
if (watchedPaths.isEmpty())
|
||||
return false;
|
||||
|
||||
@ -437,11 +490,15 @@ bool QFseventsFileSystemWatcherEngine::startStream()
|
||||
const CFAbsoluteTime latency = .5; // in seconds
|
||||
FSEventStreamCreateFlags flags = kFSEventStreamCreateFlagWatchRoot;
|
||||
|
||||
// Never start with kFSEventStreamEventIdSinceNow, because this will generate an invalid
|
||||
// soft-assert in FSEventStreamFlushSync in CarbonCore when no event occurred.
|
||||
if (lastReceivedEvent == kFSEventStreamEventIdSinceNow)
|
||||
lastReceivedEvent = FSEventsGetCurrentEventId();
|
||||
stream = FSEventStreamCreate(NULL,
|
||||
&callBackFunction,
|
||||
&callBackInfo,
|
||||
reinterpret_cast<CFArrayRef>(pathsToWatch),
|
||||
kFSEventStreamEventIdSinceNow,
|
||||
lastReceivedEvent,
|
||||
latency,
|
||||
flags);
|
||||
|
||||
@ -453,10 +510,13 @@ bool QFseventsFileSystemWatcherEngine::startStream()
|
||||
FSEventStreamSetDispatchQueue(stream, queue);
|
||||
|
||||
if (FSEventStreamStart(stream)) {
|
||||
DEBUG() << "Stream started successfully.";
|
||||
DEBUG() << "Stream started successfully with sinceWhen =" << lastReceivedEvent;
|
||||
return true;
|
||||
} else {
|
||||
DEBUG() << "Stream failed to start!";
|
||||
FSEventStreamInvalidate(stream);
|
||||
FSEventStreamRelease(stream);
|
||||
stream = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -469,7 +529,7 @@ void QFseventsFileSystemWatcherEngine::stopStream(bool isStopped)
|
||||
FSEventStreamInvalidate(stream);
|
||||
FSEventStreamRelease(stream);
|
||||
stream = 0;
|
||||
DEBUG() << "Stream stopped.";
|
||||
DEBUG() << "Stream stopped. Last event ID:" << lastReceivedEvent;
|
||||
}
|
||||
}
|
||||
|
||||
@ -490,16 +550,16 @@ QFseventsFileSystemWatcherEngine::InfoByName QFseventsFileSystemWatcherEngine::s
|
||||
return entries;
|
||||
}
|
||||
|
||||
void QFseventsFileSystemWatcherEngine::derefPath(const QString &watchedPath)
|
||||
bool QFseventsFileSystemWatcherEngine::derefPath(const QString &watchedPath)
|
||||
{
|
||||
PathRefCounts::iterator it = watchedPaths.find(watchedPath);
|
||||
if (it == watchedPaths.end())
|
||||
return;
|
||||
if (--it.value() < 1) {
|
||||
if (it != watchedPaths.end() && --it.value() < 1) {
|
||||
watchedPaths.erase(it);
|
||||
stopStream();
|
||||
startStream();
|
||||
DEBUG("Removing '%s' from watchedPaths.", qPrintable(watchedPath));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif //QT_NO_FILESYSTEMWATCHER
|
||||
|
@ -84,10 +84,12 @@ public:
|
||||
Q_SIGNALS:
|
||||
void emitFileChanged(const QString path, bool removed);
|
||||
void emitDirectoryChanged(const QString path, bool removed);
|
||||
void scheduleStreamRestart();
|
||||
|
||||
private slots:
|
||||
void doEmitFileChanged(const QString path, bool removed);
|
||||
void doEmitDirectoryChanged(const QString path, bool removed);
|
||||
void restartStream();
|
||||
|
||||
private:
|
||||
struct Info {
|
||||
@ -122,11 +124,11 @@ private:
|
||||
bool startStream();
|
||||
void stopStream(bool isStopped = false);
|
||||
InfoByName scanForDirEntries(const QString &path);
|
||||
void derefPath(const QString &watchedPath);
|
||||
void checkDir(DirsByName::iterator &it);
|
||||
void rescanDirs(const QString &path);
|
||||
void rescanFiles(InfoByName &filesInPath);
|
||||
void rescanFiles(const QString &path);
|
||||
bool derefPath(const QString &watchedPath);
|
||||
bool checkDir(DirsByName::iterator &it);
|
||||
bool rescanDirs(const QString &path);
|
||||
bool rescanFiles(InfoByName &filesInPath);
|
||||
bool rescanFiles(const QString &path);
|
||||
|
||||
QMutex lock;
|
||||
dispatch_queue_t queue;
|
||||
@ -134,6 +136,7 @@ private:
|
||||
FilesByPath watchedFiles;
|
||||
DirsByName watchedDirectories;
|
||||
PathRefCounts watchedPaths;
|
||||
FSEventStreamEventId lastReceivedEvent;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -2496,6 +2496,12 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
||||
|
||||
\snippet code/src_corelib_io_qsettings.cpp 7
|
||||
|
||||
\li On Mac OS X, permissions to access settings not belonging to the
|
||||
current user (i.e. SystemScope) have changed with 10.7 (Lion). Prior to
|
||||
that version, users having admin rights could access these. For 10.7 and
|
||||
10.8 (Mountain Lion), only root can. However, 10.9 (Mavericks) changes
|
||||
that rule again but only for the native format (plist files).
|
||||
|
||||
\li On Unix and Mac OS X systems, the advisory file locking is disabled
|
||||
if NFS (or AutoFS or CacheFS) is detected to work around a bug in the
|
||||
NFS fcntl() implementation, which hangs forever if statd or lockd aren't
|
||||
|
@ -405,7 +405,6 @@ QMacSettingsPrivate::QMacSettingsPrivate(QSettings::Scope scope, const QString &
|
||||
}
|
||||
// if no bundle identifier yet. use a hard coded string.
|
||||
if (domainName.isEmpty()) {
|
||||
setStatus(QSettings::AccessError);
|
||||
domainName = QLatin1String("unknown-organization.trolltech.com");
|
||||
}
|
||||
|
||||
@ -540,27 +539,30 @@ void QMacSettingsPrivate::sync()
|
||||
// only report failures for the primary file (the one we write to)
|
||||
if (!ok && i == 0 && hostNames[j] == hostName && status == QSettings::NoError) {
|
||||
#if 1
|
||||
// work around what seems to be a bug in CFPreferences:
|
||||
// don't report an error if there are no preferences for the application
|
||||
QCFType<CFArrayRef> appIds = CFPreferencesCopyApplicationList(domains[i].userName,
|
||||
hostNames[j]);
|
||||
if (QSysInfo::macVersion() < QSysInfo::MV_10_7) {
|
||||
// work around what seems to be a bug in CFPreferences:
|
||||
// don't report an error if there are no preferences for the application
|
||||
QCFType<CFArrayRef> appIds = CFPreferencesCopyApplicationList(domains[i].userName,
|
||||
hostNames[j]);
|
||||
|
||||
// iterate through all the applications and see if we're there
|
||||
CFIndex size = CFArrayGetCount(appIds);
|
||||
for (CFIndex k = 0; k < size; ++k) {
|
||||
const void *cfvalue = CFArrayGetValueAtIndex(appIds, k);
|
||||
if (CFGetTypeID(cfvalue) == CFStringGetTypeID()) {
|
||||
if (CFStringCompare(static_cast<CFStringRef>(cfvalue),
|
||||
domains[i].applicationOrSuiteId,
|
||||
kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
||||
setStatus(QSettings::AccessError);
|
||||
break;
|
||||
// iterate through all the applications and see if we're there
|
||||
CFIndex size = CFArrayGetCount(appIds);
|
||||
for (CFIndex k = 0; k < size; ++k) {
|
||||
const void *cfvalue = CFArrayGetValueAtIndex(appIds, k);
|
||||
if (CFGetTypeID(cfvalue) == CFStringGetTypeID()) {
|
||||
if (CFStringCompare(static_cast<CFStringRef>(cfvalue),
|
||||
domains[i].applicationOrSuiteId,
|
||||
kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
||||
setStatus(QSettings::AccessError);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
setStatus(QSettings::AccessError);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
setStatus(QSettings::AccessError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,10 @@
|
||||
#include <qcoreapplication.h>
|
||||
#endif
|
||||
|
||||
#if !defined(Q_OS_WINCE)
|
||||
const GUID qCLSID_FOLDERID_Downloads = { 0x374de290, 0x123f, 0x4565, { 0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b } };
|
||||
#endif
|
||||
|
||||
#include <qt_windows.h>
|
||||
#include <shlobj.h>
|
||||
#if !defined(Q_OS_WINCE)
|
||||
@ -68,6 +72,10 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if !defined(Q_OS_WINCE)
|
||||
typedef HRESULT (WINAPI *GetKnownFolderPath)(const GUID&, DWORD, HANDLE, LPWSTR*);
|
||||
#endif
|
||||
|
||||
static QString convertCharArray(const wchar_t *path)
|
||||
{
|
||||
return QDir::fromNativeSeparators(QString::fromWCharArray(path));
|
||||
@ -77,6 +85,10 @@ QString QStandardPaths::writableLocation(StandardLocation type)
|
||||
{
|
||||
QString result;
|
||||
|
||||
#if !defined(Q_OS_WINCE)
|
||||
static GetKnownFolderPath SHGetKnownFolderPath = (GetKnownFolderPath)QSystemLibrary::resolve(QLatin1String("shell32"), "SHGetKnownFolderPath");
|
||||
#endif
|
||||
|
||||
wchar_t path[MAX_PATH];
|
||||
|
||||
switch (type) {
|
||||
@ -107,7 +119,18 @@ QString QStandardPaths::writableLocation(StandardLocation type)
|
||||
result = convertCharArray(path);
|
||||
break;
|
||||
|
||||
case DownloadLocation: // TODO implement with SHGetKnownFolderPath(FOLDERID_Downloads) (starting from Vista)
|
||||
case DownloadLocation:
|
||||
#if !defined(Q_OS_WINCE)
|
||||
if (SHGetKnownFolderPath) {
|
||||
LPWSTR path;
|
||||
if (SHGetKnownFolderPath(qCLSID_FOLDERID_Downloads, 0, 0, &path) == S_OK) {
|
||||
result = convertCharArray(path);
|
||||
CoTaskMemFree(path);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
// fall through
|
||||
case DocumentsLocation:
|
||||
if (SHGetSpecialFolderPath(0, path, CSIDL_PERSONAL, FALSE))
|
||||
result = convertCharArray(path);
|
||||
|
@ -407,6 +407,9 @@ Q_GLOBAL_STATIC(QEventUserEventRegistration, userEventRegistrationHelper)
|
||||
between QEvent::User and QEvent::MaxUser that has not yet been
|
||||
registered. The \a hint is ignored if its value is not between
|
||||
QEvent::User and QEvent::MaxUser.
|
||||
|
||||
Returns -1 if all available values are already taken or the
|
||||
program is shutting down.
|
||||
*/
|
||||
int QEvent::registerEventType(int hint)
|
||||
{
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QHash>
|
||||
#include <private/qabstracteventdispatcher_p.h>
|
||||
#include <private/qcoreapplication_p.h>
|
||||
|
||||
#include <wrl.h>
|
||||
#include <windows.foundation.h>
|
||||
@ -109,6 +110,11 @@ QEventDispatcherWinRT::QEventDispatcherWinRT(QObject *parent)
|
||||
: QAbstractEventDispatcher(*new QEventDispatcherWinRTPrivate, parent)
|
||||
{
|
||||
Q_D(QEventDispatcherWinRT);
|
||||
|
||||
// Only look up the event dispatcher in the main thread
|
||||
if (QThread::currentThread() != QCoreApplicationPrivate::theMainThread)
|
||||
return;
|
||||
|
||||
ComPtr<ICoreApplication> application;
|
||||
HRESULT hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(),
|
||||
IID_PPV_ARGS(&application));
|
||||
|
@ -938,10 +938,6 @@ public:
|
||||
return IteratorOwner<typename T::const_iterator>::getData(i);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static void advanceImpl(void **p, int step)
|
||||
{ IteratorOwner<typename T::const_iterator>::advance(p, step); }
|
||||
|
||||
template<class T>
|
||||
static void moveToBeginImpl(const void *container, void **iterator)
|
||||
{ IteratorOwner<typename T::const_iterator>::assign(iterator, static_cast<const T*>(container)->begin()); }
|
||||
@ -950,22 +946,10 @@ public:
|
||||
static void moveToEndImpl(const void *container, void **iterator)
|
||||
{ IteratorOwner<typename T::const_iterator>::assign(iterator, static_cast<const T*>(container)->end()); }
|
||||
|
||||
template<class T>
|
||||
static void destroyIterImpl(void **iterator)
|
||||
{ IteratorOwner<typename T::const_iterator>::destroy(iterator); }
|
||||
|
||||
template<class T>
|
||||
static bool equalIterImpl(void * const *iterator, void * const *other)
|
||||
{ return IteratorOwner<typename T::const_iterator>::equal(iterator, other); }
|
||||
|
||||
template<class T>
|
||||
static VariantData getImpl(void * const *iterator, int metaTypeId, uint flags)
|
||||
{ return VariantData(metaTypeId, IteratorOwner<typename T::const_iterator>::getData(iterator), flags); }
|
||||
|
||||
template<class T>
|
||||
static void copyIterImpl(void **dest, void * const * src)
|
||||
{ IteratorOwner<typename T::const_iterator>::assign(dest, src); }
|
||||
|
||||
public:
|
||||
template<class T> QSequentialIterableImpl(const T*p)
|
||||
: _iterable(p)
|
||||
@ -977,11 +961,11 @@ public:
|
||||
, _at(atImpl<T>)
|
||||
, _moveToBegin(moveToBeginImpl<T>)
|
||||
, _moveToEnd(moveToEndImpl<T>)
|
||||
, _advance(advanceImpl<T>)
|
||||
, _advance(IteratorOwner<typename T::const_iterator>::advance)
|
||||
, _get(getImpl<T>)
|
||||
, _destroyIter(destroyIterImpl<T>)
|
||||
, _equalIter(equalIterImpl<T>)
|
||||
, _copyIter(copyIterImpl<T>)
|
||||
, _destroyIter(IteratorOwner<typename T::const_iterator>::destroy)
|
||||
, _equalIter(IteratorOwner<typename T::const_iterator>::equal)
|
||||
, _copyIter(IteratorOwner<typename T::const_iterator>::assign)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1134,18 +1118,6 @@ public:
|
||||
static VariantData getValueImpl(void * const *iterator, int metaTypeId, uint flags)
|
||||
{ return VariantData(metaTypeId, &AssociativeContainerAccessor<T>::getValue(*static_cast<typename T::const_iterator*>(*iterator)), flags); }
|
||||
|
||||
template<class T>
|
||||
static void destroyIterImpl(void **iterator)
|
||||
{ IteratorOwner<typename T::const_iterator>::destroy(iterator); }
|
||||
|
||||
template<class T>
|
||||
static bool equalIterImpl(void * const *iterator, void * const *other)
|
||||
{ return IteratorOwner<typename T::const_iterator>::equal(iterator, other); }
|
||||
|
||||
template<class T>
|
||||
static void copyIterImpl(void **dest, void * const * src)
|
||||
{ IteratorOwner<typename T::const_iterator>::assign(dest, src); }
|
||||
|
||||
public:
|
||||
template<class T> QAssociativeIterableImpl(const T*p)
|
||||
: _iterable(p)
|
||||
@ -1160,9 +1132,9 @@ public:
|
||||
, _advance(advanceImpl<T>)
|
||||
, _getKey(getKeyImpl<T>)
|
||||
, _getValue(getValueImpl<T>)
|
||||
, _destroyIter(destroyIterImpl<T>)
|
||||
, _equalIter(equalIterImpl<T>)
|
||||
, _copyIter(copyIterImpl<T>)
|
||||
, _destroyIter(IteratorOwner<typename T::const_iterator>::destroy)
|
||||
, _equalIter(IteratorOwner<typename T::const_iterator>::equal)
|
||||
, _copyIter(IteratorOwner<typename T::const_iterator>::assign)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
||||
QMacPasteboardMime maps MIME to Mac flavors.
|
||||
|
||||
\sa QClipboard, QDragEnterEvent, QDragMoveEvent, QDropEvent, QDrag,
|
||||
QWindowsMime, QMacPasteboardMime, {Drag and Drop}
|
||||
QMacPasteboardMime, {Drag and Drop}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -551,7 +551,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object)
|
||||
QObject::signalsBlocked() state is transferred to this object.
|
||||
|
||||
The object's signals this signal blocker was blocking prior to
|
||||
being moved to, if any, are unblocked \em except in the case where
|
||||
being moved to, if any, are unblocked \e except in the case where
|
||||
both instances block the same object's signals and \c *this is
|
||||
unblocked while \a other is not, at the time of the move.
|
||||
*/
|
||||
@ -2731,9 +2731,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
|
||||
Qt::ConnectionType type)
|
||||
but it uses QMetaMethod to specify signal and method.
|
||||
|
||||
\sa connect(const QObject *sender, const char *signal,
|
||||
const QObject *receiver, const char *method,
|
||||
Qt::ConnectionType type)
|
||||
\sa connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
|
||||
*/
|
||||
QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMethod &signal,
|
||||
const QObject *receiver, const QMetaMethod &method,
|
||||
|
@ -333,6 +333,26 @@ QT_BEGIN_NAMESPACE
|
||||
\since 5.1
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QMargins &QMargins::operator+=(int addend)
|
||||
\overload
|
||||
|
||||
Adds the \a addend to each component of this object
|
||||
and returns a reference to it.
|
||||
|
||||
\sa operator-=()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QMargins &QMargins::operator-=(int subtrahend)
|
||||
\overload
|
||||
|
||||
Subtracts the \a subtrahend from each component of this object
|
||||
and returns a reference to it.
|
||||
|
||||
\sa operator+=()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QMargins &QMargins::operator*=(int factor)
|
||||
|
||||
|
@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
|
||||
\class QPoint
|
||||
\inmodule QtCore
|
||||
\ingroup painting
|
||||
\reentrant
|
||||
|
||||
\brief The QPoint class defines a point in the plane using integer
|
||||
precision.
|
||||
@ -470,6 +471,7 @@ QDebug operator<<(QDebug dbg, const QPointF &p)
|
||||
\class QPointF
|
||||
\inmodule QtCore
|
||||
\ingroup painting
|
||||
\reentrant
|
||||
|
||||
\brief The QPointF class defines a point in the plane using
|
||||
floating point precision.
|
||||
|
@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
|
||||
\class QRect
|
||||
\inmodule QtCore
|
||||
\ingroup painting
|
||||
\reentrant
|
||||
|
||||
\brief The QRect class defines a rectangle in the plane using
|
||||
integer precision.
|
||||
@ -1298,6 +1299,7 @@ QDebug operator<<(QDebug dbg, const QRect &r)
|
||||
\class QRectF
|
||||
\inmodule QtCore
|
||||
\ingroup painting
|
||||
\reentrant
|
||||
|
||||
\brief The QRectF class defines a rectangle in the plane using floating
|
||||
point precision.
|
||||
|
@ -79,7 +79,7 @@
|
||||
|
||||
// SSE intrinsics
|
||||
#if defined(__SSE2__) || (defined(QT_COMPILER_SUPPORTS_SSE2) && defined(Q_CC_MSVC))
|
||||
#if defined(QT_LINUXBASE)
|
||||
#if defined(QT_LINUXBASE) || defined(Q_OS_ANDROID_NO_SDK)
|
||||
/// this is an evil hack - the posix_memalign declaration in LSB
|
||||
/// is wrong - see http://bugs.linuxbase.org/show_bug.cgi?id=2431
|
||||
# define posix_memalign _lsb_hack_posix_memalign
|
||||
|
@ -78,6 +78,7 @@
|
||||
#include "qchar.cpp"
|
||||
#include "qstringmatcher.cpp"
|
||||
#include "qstringiterator_p.h"
|
||||
#include "qthreadstorage.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <qt_windows.h>
|
||||
@ -5319,6 +5320,10 @@ int QString::localeAwareCompare(const QString &other) const
|
||||
return localeAwareCompare_helper(constData(), length(), other.constData(), other.length());
|
||||
}
|
||||
|
||||
#if defined(QT_USE_ICU)
|
||||
Q_GLOBAL_STATIC(QThreadStorage<QCollator>, defaultCollator)
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\since 4.5
|
||||
@ -5362,8 +5367,9 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
|
||||
CFRelease(otherString);
|
||||
return result;
|
||||
#elif defined(QT_USE_ICU)
|
||||
QCollator collator;
|
||||
return collator.compare(data1, length1, data2, length2);
|
||||
if (!defaultCollator()->hasLocalData())
|
||||
defaultCollator()->setLocalData(QCollator());
|
||||
return defaultCollator()->localData().compare(data1, length1, data2, length2);
|
||||
#elif defined(Q_OS_UNIX)
|
||||
// declared in <string.h>
|
||||
int delta = strcoll(toLocal8Bit_helper(data1, length1).constData(), toLocal8Bit_helper(data2, length2).constData());
|
||||
@ -6168,7 +6174,7 @@ qulonglong QString::toIntegral_helper(const QChar *data, uint len, bool *ok, int
|
||||
|
||||
\snippet qstring/main.cpp 73
|
||||
|
||||
\sa number(), toULong(), toInt(), QLocale::toLong()
|
||||
\sa number(), toULong(), toInt(), QLocale::toInt()
|
||||
*/
|
||||
|
||||
long QString::toLong(bool *ok, int base) const
|
||||
@ -6197,7 +6203,7 @@ long QString::toLong(bool *ok, int base) const
|
||||
|
||||
\snippet qstring/main.cpp 78
|
||||
|
||||
\sa number(), QLocale::toULong()
|
||||
\sa number(), QLocale::toUInt()
|
||||
*/
|
||||
|
||||
ulong QString::toULong(bool *ok, int base) const
|
||||
@ -7562,6 +7568,8 @@ QString QString::multiArg(int numArgs, const QString **args) const
|
||||
\since 5.2
|
||||
|
||||
Constructs a new QString containing a copy of the \a string CFString.
|
||||
|
||||
\note this function is only available on Mac OS X and iOS.
|
||||
*/
|
||||
|
||||
/*! \fn CFStringRef QString::toCFString() const
|
||||
@ -7569,18 +7577,24 @@ QString QString::multiArg(int numArgs, const QString **args) const
|
||||
|
||||
Creates a CFString from a QString. The caller owns the CFString and is
|
||||
responsible for releasing it.
|
||||
|
||||
\note this function is only available on Mac OS X and iOS.
|
||||
*/
|
||||
|
||||
/*! \fn QString QString::fromNSString(const NSString *string)
|
||||
\since 5.2
|
||||
|
||||
Constructs a new QString containing a copy of the \a string NSString.
|
||||
|
||||
\note this function is only available on Mac OS X and iOS.
|
||||
*/
|
||||
|
||||
/*! \fn NSString QString::toNSString() const
|
||||
\since 5.2
|
||||
|
||||
Creates a NSString from a QString.g. The NSString is autoreleased.
|
||||
Creates a NSString from a QString. The NSString is autoreleased.
|
||||
|
||||
\note this function is only available on Mac OS X and iOS.
|
||||
*/
|
||||
|
||||
/*! \fn bool QString::isSimpleText() const
|
||||
|
@ -711,7 +711,7 @@ public:
|
||||
Q_DECL_CONSTEXPR inline QString(QStringDataPtr dd) : d(dd.ptr) {}
|
||||
|
||||
private:
|
||||
#if defined(QT_NO_CAST_FROM_ASCII) && !defined(Q_NO_DECLARED_NOT_DEFINED)
|
||||
#if defined(QT_NO_CAST_FROM_ASCII)
|
||||
QString &operator+=(const char *s);
|
||||
QString &operator+=(const QByteArray &s);
|
||||
QString(const char *ch);
|
||||
|
@ -349,11 +349,11 @@ QXmlStreamEntityResolver *QXmlStreamReader::entityResolver() const
|
||||
\l{QNetworkAccessManager} {network access manager}, you would issue
|
||||
a \l{QNetworkRequest} {network request} to the manager and receive a
|
||||
\l{QNetworkReply} {network reply} in return. Since a QNetworkReply
|
||||
is a QIODevice, you connect its \l{QNetworkReply::readyRead()}
|
||||
is a QIODevice, you connect its \l{QIODevice::readyRead()}
|
||||
{readyRead()} signal to a custom slot, e.g. \c{slotReadyRead()} in
|
||||
the code snippet shown in the discussion for QNetworkAccessManager.
|
||||
In this slot, you read all available data with
|
||||
\l{QNetworkReply::readAll()} {readAll()} and pass it to the XML
|
||||
\l{QIODevice::readAll()} {readAll()} and pass it to the XML
|
||||
stream reader using addData(). Then you call your custom parsing
|
||||
function that reads the XML events from the reader.
|
||||
|
||||
|
@ -155,7 +155,7 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDBusReply::error()
|
||||
\fn const QDBusError& QDBusReply::error() const
|
||||
|
||||
Returns the error code that was returned from the remote function call. If the remote call did
|
||||
not return an error (i.e., if it succeeded), then the QDBusError object that is returned will
|
||||
@ -164,6 +164,11 @@ QT_BEGIN_NAMESPACE
|
||||
\sa isValid()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QDBusError& QDBusReply::error()
|
||||
\overload
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QDBusReply::value() const
|
||||
Returns the remote function's calls return value. If the remote call returned with an error,
|
||||
|
@ -611,7 +611,7 @@ bool QImageData::checkForAlphaPixels() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QImage &operator=(QImage &&other)
|
||||
\fn QImage &QImage::operator=(QImage &&other)
|
||||
|
||||
Move-assigns \a other to this QImage instance.
|
||||
|
||||
|
@ -64,6 +64,8 @@ QNativeImage::~QNativeImage()
|
||||
|
||||
QImage::Format QNativeImage::systemFormat()
|
||||
{
|
||||
if (!QGuiApplication::primaryScreen())
|
||||
return QImage::Format_Invalid;
|
||||
return QGuiApplication::primaryScreen()->handle()->format();
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ QT_BEGIN_NAMESPACE
|
||||
\l{QWidget::mouseMoveEvent()}{mouseMoveEvent()} to check whether a QDrag is
|
||||
required.
|
||||
|
||||
\sa {Drag and Drop}, QClipboard, QMimeData, QWindowsMime, QMacPasteboardMime,
|
||||
\sa {Drag and Drop}, QClipboard, QMimeData, QMacPasteboardMime,
|
||||
{Draggable Icons Example}, {Draggable Text Example}, {Drop Site Example},
|
||||
{Fridge Magnets Example}
|
||||
*/
|
||||
|
@ -628,7 +628,7 @@ QHoverEvent::~QHoverEvent()
|
||||
\a modifiers holds the keyboard modifier flags at the time of the
|
||||
event, and \a orient holds the wheel's orientation.
|
||||
|
||||
\sa pos(), pixelDelta(), angleDelta(), state()
|
||||
\sa pos(), pixelDelta(), angleDelta()
|
||||
*/
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
QWheelEvent::QWheelEvent(const QPointF &pos, int delta,
|
||||
@ -659,7 +659,7 @@ QWheelEvent::~QWheelEvent()
|
||||
\a orient holds the wheel's orientation.
|
||||
|
||||
|
||||
\sa pos(), pixelDelta(), angleDelta(), state()
|
||||
\sa pos(), pixelDelta(), angleDelta()
|
||||
*/
|
||||
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta,
|
||||
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
|
||||
|
@ -71,6 +71,14 @@ QT_BEGIN_NAMESPACE
|
||||
How the offscreen surface is implemented depends on the underlying platform, but it will
|
||||
typically use a pixel buffer (pbuffer). If the platform doesn't implement or support
|
||||
offscreen surfaces, QOffscreenSurface will use an invisible QWindow internally.
|
||||
|
||||
\note In order to create an offscreen surface that is guaranteed to be compatible with
|
||||
a given context and window, make sure to set the format to the context's or the
|
||||
window's actual format, that is, the QSurfaceFormat returned from
|
||||
QOpenGLContext::format() or QWindow::format() \e{after the context or window has been
|
||||
created}. Passing the format returned from QWindow::requestedFormat() to setFormat()
|
||||
may result in an incompatible offscreen surface since the underlying windowing system
|
||||
interface may offer a different set of configurations for window and pbuffer surfaces.
|
||||
*/
|
||||
class Q_GUI_EXPORT QOffscreenSurfacePrivate : public QObjectPrivate
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ void QOpenGLVersionProfile::setVersion(int majorVersion, int minorVersion)
|
||||
/*!
|
||||
Returns the OpenGL profile. Only makes sense if profiles are supported by this version.
|
||||
|
||||
\sa setProfile(), supportsProfiles()
|
||||
\sa setProfile()
|
||||
*/
|
||||
QSurfaceFormat::OpenGLContextProfile QOpenGLVersionProfile::profile() const
|
||||
{
|
||||
@ -176,7 +176,7 @@ QSurfaceFormat::OpenGLContextProfile QOpenGLVersionProfile::profile() const
|
||||
Sets the OpenGL profile \a profile. Only makes sense if profiles are supported by
|
||||
this version.
|
||||
|
||||
\sa profile(), supportsProfiles()
|
||||
\sa profile()
|
||||
*/
|
||||
void QOpenGLVersionProfile::setProfile(QSurfaceFormat::OpenGLContextProfile profile)
|
||||
{
|
||||
|
@ -171,6 +171,7 @@ public:
|
||||
template <typename T>
|
||||
T *value(QOpenGLContext *context) {
|
||||
QOpenGLContextGroup *group = context->shareGroup();
|
||||
QMutexLocker locker(&group->d_func()->m_mutex);
|
||||
T *resource = static_cast<T *>(group->d_func()->m_resources.value(this, 0));
|
||||
if (!resource) {
|
||||
resource = new T(context);
|
||||
|
@ -201,7 +201,7 @@ QString QSessionManager::sessionKey() const
|
||||
Here's an example of how an application's QGuiApplication::commitDataRequest()
|
||||
might be implemented:
|
||||
|
||||
\snippet code/src_gui_kernel_qguiapplication.cpp 8
|
||||
\snippet code/src_gui_kernel_qguiapplication.cpp 1
|
||||
|
||||
If an error occurred within the application while saving its data, you may
|
||||
want to try allowsErrorInteraction() instead.
|
||||
@ -293,7 +293,7 @@ QSessionManager::RestartHint QSessionManager::restartHint() const
|
||||
If the session manager is capable of restoring sessions it will execute
|
||||
\a command in order to restore the application. The command defaults to
|
||||
|
||||
\snippet code/src_gui_kernel_qguiapplication.cpp 9
|
||||
\snippet code/src_gui_kernel_qguiapplication.cpp 2
|
||||
|
||||
The \c -session option is mandatory; otherwise QGuiApplication cannot
|
||||
tell whether it has been restored or what the current session identifier
|
||||
@ -321,7 +321,7 @@ void QSessionManager::setRestartCommand(const QStringList &command)
|
||||
|
||||
To iterate over the list, you can use the \l foreach pseudo-keyword:
|
||||
|
||||
\snippet code/src_gui_kernel_qguiapplication.cpp 10
|
||||
\snippet code/src_gui_kernel_qguiapplication.cpp 3
|
||||
|
||||
\sa setRestartCommand(), restartHint()
|
||||
*/
|
||||
@ -347,7 +347,7 @@ void QSessionManager::setDiscardCommand(const QStringList &command)
|
||||
|
||||
To iterate over the list, you can use the \l foreach pseudo-keyword:
|
||||
|
||||
\snippet code/src_gui_kernel_qguiapplication.cpp 11
|
||||
\snippet code/src_gui_kernel_qguiapplication.cpp 4
|
||||
|
||||
\sa setDiscardCommand(), restartCommand(), setRestartCommand()
|
||||
*/
|
||||
|
@ -387,7 +387,7 @@ void QSurfaceFormat::setOption(QSurfaceFormat::FormatOption option, bool on)
|
||||
|
||||
Returns true if the format option \a option is set; otherwise returns false.
|
||||
|
||||
\sa options(), testOption()
|
||||
\sa options()
|
||||
*/
|
||||
bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOption option) const
|
||||
{
|
||||
|
@ -159,10 +159,6 @@ QWindow::QWindow(QScreen *targetScreen)
|
||||
d->screen = targetScreen;
|
||||
if (!d->screen)
|
||||
d->screen = QGuiApplication::primaryScreen();
|
||||
|
||||
//if your applications aborts here, then chances are your creating a QWindow before the
|
||||
//screen list is populated.
|
||||
Q_ASSERT(d->screen);
|
||||
d->init();
|
||||
}
|
||||
|
||||
@ -232,6 +228,13 @@ QWindow::~QWindow()
|
||||
void QWindowPrivate::init()
|
||||
{
|
||||
Q_Q(QWindow);
|
||||
|
||||
// If your application aborts here, you are probably creating a QWindow
|
||||
// before the screen list is populated.
|
||||
if (!screen) {
|
||||
qFatal("Cannot create window: no screens available");
|
||||
exit(1);
|
||||
}
|
||||
QObject::connect(screen, SIGNAL(destroyed(QObject*)), q, SLOT(screenDestroyed(QObject*)));
|
||||
QGuiApplicationPrivate::window_list.prepend(q);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE
|
||||
multisampling. Most hardware require significantly more memory to
|
||||
do multisampling and the resulting quality is not on par with the
|
||||
quality of the software paint engine. The OpenGL paint engine's
|
||||
strenght lies in its performance, not its visual rendering
|
||||
strength lies in its performance, not its visual rendering
|
||||
quality.
|
||||
|
||||
\section1 State Changes
|
||||
|
@ -2668,12 +2668,12 @@ void QOpenGLTexture::generateMipMaps()
|
||||
}
|
||||
|
||||
/*!
|
||||
Generates mipmaps for this texture object from mipmap level \baseLevel. If you are
|
||||
Generates mipmaps for this texture object from mipmap level \a baseLevel. If you are
|
||||
using a texture target and filtering option that requires mipmaps and you
|
||||
have disabled automatic mipmap generation then you need to call this function
|
||||
or the overload to create the mipmap chain.
|
||||
|
||||
The generation of mipmaps to above \baseLevel is achieved by setting the mipmap
|
||||
The generation of mipmaps to above \a baseLevel is achieved by setting the mipmap
|
||||
base level to \a baseLevel and then generating the mipmap chain. If \a resetBaseLevel
|
||||
is \c true, then the baseLevel of the texture will be reset to its previous value.
|
||||
|
||||
@ -3000,7 +3000,7 @@ void QOpenGLTexture::setBorderColor(QColor color)
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the color red to \a {r}, green to \a {g}, blue to \{b}, and \a {a} to the
|
||||
Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a {a} to the
|
||||
alpha value.
|
||||
\overload
|
||||
*/
|
||||
@ -3033,8 +3033,8 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a the alpha
|
||||
value to {a}.
|
||||
Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and the alpha
|
||||
value to \a {a}.
|
||||
\overload
|
||||
*/
|
||||
void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
|
||||
@ -3068,8 +3068,8 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a the alpha
|
||||
value to {a}.
|
||||
Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and the alpha
|
||||
value to \a {a}.
|
||||
\overload
|
||||
*/
|
||||
void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a)
|
||||
|
@ -149,8 +149,6 @@ bool QOpenGLVertexArrayObjectPrivate::create()
|
||||
}
|
||||
|
||||
Q_Q(QOpenGLVertexArrayObject);
|
||||
if (context)
|
||||
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
|
||||
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
if (!ctx) {
|
||||
@ -202,6 +200,8 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
|
||||
if (!vao)
|
||||
return;
|
||||
|
||||
Q_Q(QOpenGLVertexArrayObject);
|
||||
|
||||
switch (vaoFuncsType) {
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
case Core_3_2:
|
||||
@ -220,6 +220,10 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
|
||||
break;
|
||||
}
|
||||
|
||||
Q_ASSERT(context);
|
||||
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
|
||||
context = 0;
|
||||
|
||||
vao = 0;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha {
|
||||
};
|
||||
|
||||
void qt_scale_image_rgb16_on_rgb16(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &sourceRect,
|
||||
const QRect &clip,
|
||||
@ -144,17 +144,17 @@ void qt_scale_image_rgb16_on_rgb16(uchar *destPixels, int dbpl,
|
||||
#endif
|
||||
if (const_alpha == 256) {
|
||||
Blend_RGB16_on_RGB16_NoAlpha noAlpha;
|
||||
qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl,
|
||||
qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, srch,
|
||||
targetRect, sourceRect, clip, noAlpha);
|
||||
} else {
|
||||
Blend_RGB16_on_RGB16_ConstAlpha constAlpha(const_alpha);
|
||||
qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl,
|
||||
qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, srch,
|
||||
targetRect, sourceRect, clip, constAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
void qt_scale_image_argb32_on_rgb16(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &sourceRect,
|
||||
const QRect &clip,
|
||||
@ -169,11 +169,11 @@ void qt_scale_image_argb32_on_rgb16(uchar *destPixels, int dbpl,
|
||||
#endif
|
||||
if (const_alpha == 256) {
|
||||
Blend_ARGB32_on_RGB16_SourceAlpha noAlpha;
|
||||
qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl,
|
||||
qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, srch,
|
||||
targetRect, sourceRect, clip, noAlpha);
|
||||
} else {
|
||||
Blend_ARGB32_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha);
|
||||
qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl,
|
||||
qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, srch,
|
||||
targetRect, sourceRect, clip, constAlpha);
|
||||
}
|
||||
}
|
||||
@ -453,7 +453,7 @@ struct Blend_ARGB32_on_ARGB32_SourceAndConstAlpha {
|
||||
};
|
||||
|
||||
void qt_scale_image_rgb32_on_rgb32(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &sourceRect,
|
||||
const QRect &clip,
|
||||
@ -468,17 +468,17 @@ void qt_scale_image_rgb32_on_rgb32(uchar *destPixels, int dbpl,
|
||||
#endif
|
||||
if (const_alpha == 256) {
|
||||
Blend_RGB32_on_RGB32_NoAlpha noAlpha;
|
||||
qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
|
||||
qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch,
|
||||
targetRect, sourceRect, clip, noAlpha);
|
||||
} else {
|
||||
Blend_RGB32_on_RGB32_ConstAlpha constAlpha(const_alpha);
|
||||
qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
|
||||
qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch,
|
||||
targetRect, sourceRect, clip, constAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &sourceRect,
|
||||
const QRect &clip,
|
||||
@ -493,11 +493,11 @@ void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl,
|
||||
#endif
|
||||
if (const_alpha == 256) {
|
||||
Blend_ARGB32_on_ARGB32_SourceAlpha sourceAlpha;
|
||||
qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
|
||||
qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch,
|
||||
targetRect, sourceRect, clip, sourceAlpha);
|
||||
} else {
|
||||
Blend_ARGB32_on_ARGB32_SourceAndConstAlpha constAlpha(const_alpha);
|
||||
qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
|
||||
qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch,
|
||||
targetRect, sourceRect, clip, constAlpha);
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
template <typename SRC, typename T>
|
||||
void qt_scale_image_16bit(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &srcRect,
|
||||
const QRect &clip,
|
||||
@ -136,6 +136,15 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
|
||||
|
||||
quint16 *dst = ((quint16 *) (destPixels + ty1 * dbpl)) + tx1;
|
||||
|
||||
// this bounds check here is required as floating point rounding above might in some cases lead to
|
||||
// w/h values that are one pixel too large, falling outside of the valid image area.
|
||||
int yend = (srcy + iy * (h - 1)) >> 16;
|
||||
if (yend < 0 || yend >= srch)
|
||||
--h;
|
||||
int xend = (basex + ix * (w - 1)) >> 16;
|
||||
if (xend < 0 || xend >= (int)(sbpl/sizeof(quint32)))
|
||||
--w;
|
||||
|
||||
while (h--) {
|
||||
const SRC *src = (const SRC *) (srcPixels + (srcy >> 16) * sbpl);
|
||||
int srcx = basex;
|
||||
@ -161,7 +170,7 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
|
||||
}
|
||||
|
||||
template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &srcRect,
|
||||
const QRect &clip,
|
||||
@ -215,6 +224,8 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
|
||||
|
||||
int h = ty2 - ty1;
|
||||
int w = tx2 - tx1;
|
||||
if (!w || !h)
|
||||
return;
|
||||
|
||||
quint32 basex;
|
||||
quint32 srcy;
|
||||
@ -236,6 +247,15 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
|
||||
|
||||
quint32 *dst = ((quint32 *) (destPixels + ty1 * dbpl)) + tx1;
|
||||
|
||||
// this bounds check here is required as floating point rounding above might in some cases lead to
|
||||
// w/h values that are one pixel too large, falling outside of the valid image area.
|
||||
int yend = (srcy + iy * (h - 1)) >> 16;
|
||||
if (yend < 0 || yend >= srch)
|
||||
--h;
|
||||
int xend = (basex + ix * (w - 1)) >> 16;
|
||||
if (xend < 0 || xend >= (int)(sbpl/sizeof(quint32)))
|
||||
--w;
|
||||
|
||||
while (h--) {
|
||||
const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl);
|
||||
int srcx = basex;
|
||||
|
@ -6522,7 +6522,7 @@ void qInitDrawhelperAsm()
|
||||
qDrawHelper[QImage::Format_RGBA8888_Premultiplied].bitmapBlit = qt_bitmapblit8888_sse2;
|
||||
|
||||
extern void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &sourceRect,
|
||||
const QRect &clip,
|
||||
|
@ -539,7 +539,7 @@ Blend_on_RGB16_SourceAndConstAlpha_Neon_create(BlendFunc blender, int const_alph
|
||||
}
|
||||
|
||||
void qt_scale_image_argb32_on_rgb16_neon(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &sourceRect,
|
||||
const QRect &clip,
|
||||
@ -548,19 +548,19 @@ void qt_scale_image_argb32_on_rgb16_neon(uchar *destPixels, int dbpl,
|
||||
if (const_alpha == 0)
|
||||
return;
|
||||
|
||||
qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, targetRect, sourceRect, clip,
|
||||
qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip,
|
||||
Blend_on_RGB16_SourceAndConstAlpha_Neon_create<quint32>(blend_8_pixels_argb32_on_rgb16_neon, const_alpha));
|
||||
}
|
||||
|
||||
void qt_scale_image_rgb16_on_rgb16(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &sourceRect,
|
||||
const QRect &clip,
|
||||
int const_alpha);
|
||||
|
||||
void qt_scale_image_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &sourceRect,
|
||||
const QRect &clip,
|
||||
@ -570,11 +570,11 @@ void qt_scale_image_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl,
|
||||
return;
|
||||
|
||||
if (const_alpha == 256) {
|
||||
qt_scale_image_rgb16_on_rgb16(destPixels, dbpl, srcPixels, sbpl, targetRect, sourceRect, clip, const_alpha);
|
||||
qt_scale_image_rgb16_on_rgb16(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, const_alpha);
|
||||
return;
|
||||
}
|
||||
|
||||
qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, targetRect, sourceRect, clip,
|
||||
qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip,
|
||||
Blend_on_RGB16_SourceAndConstAlpha_Neon_create<quint16>(blend_8_pixels_rgb16_on_rgb16_neon, const_alpha));
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ typedef void (*SrcOverBlendFunc)(uchar *destPixels, int dbpl,
|
||||
int const_alpha);
|
||||
|
||||
typedef void (*SrcOverScaleFunc)(uchar *destPixels, int dbpl,
|
||||
const uchar *src, int spbl,
|
||||
const uchar *src, int spbl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &sourceRect,
|
||||
const QRect &clipRect,
|
||||
|
@ -568,7 +568,7 @@ const uint * QT_FASTCALL qt_fetch_radial_gradient_sse2(uint *buffer, const Opera
|
||||
}
|
||||
|
||||
void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &sourceRect,
|
||||
const QRect &clip,
|
||||
@ -577,12 +577,12 @@ void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
|
||||
if (const_alpha != 256) {
|
||||
// from qblendfunctions.cpp
|
||||
extern void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl,
|
||||
const uchar *srcPixels, int sbpl,
|
||||
const uchar *srcPixels, int sbpl, int srch,
|
||||
const QRectF &targetRect,
|
||||
const QRectF &sourceRect,
|
||||
const QRect &clip,
|
||||
int const_alpha);
|
||||
return qt_scale_image_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, targetRect, sourceRect, clip, const_alpha);
|
||||
return qt_scale_image_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, const_alpha);
|
||||
}
|
||||
|
||||
qreal sx = targetRect.width() / (qreal) sourceRect.width();
|
||||
@ -651,6 +651,14 @@ void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
|
||||
const __m128i alphaMask = _mm_set1_epi32(0xff000000);
|
||||
const __m128i ixVector = _mm_set1_epi32(4*ix);
|
||||
|
||||
// this bounds check here is required as floating point rounding above might in some cases lead to
|
||||
// w/h values that are one pixel too large, falling outside of the valid image area.
|
||||
int yend = (srcy + iy * (h - 1)) >> 16;
|
||||
if (yend < 0 || yend >= srch)
|
||||
--h;
|
||||
int xend = (basex + ix * (w - 1)) >> 16;
|
||||
if (xend < 0 || xend >= (int)(sbpl/sizeof(quint32)))
|
||||
--w;
|
||||
|
||||
while (h--) {
|
||||
const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl);
|
||||
|
@ -2377,7 +2377,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
|
||||
SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()];
|
||||
if (func && (!clip || clip->hasRectClip)) {
|
||||
func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(),
|
||||
img.bits(), img.bytesPerLine(),
|
||||
img.bits(), img.bytesPerLine(), img.height(),
|
||||
qt_mapRect_non_normalizing(r, s->matrix), sr,
|
||||
!clip ? d->deviceRect : clip->clipRect,
|
||||
s->intOpacity);
|
||||
|
@ -1059,7 +1059,7 @@ void QPdfEngine::drawPath (const QPainterPath &p)
|
||||
if (!d->hasPen && !d->hasBrush)
|
||||
return;
|
||||
|
||||
if (d->simplePen) {
|
||||
if (d->simplePen && d->opacity == 1.0) {
|
||||
// draw strokes natively in this case for better output
|
||||
*d->currentPage << QPdf::generatePath(p, QTransform(), d->hasBrush ? QPdf::FillAndStrokePath : QPdf::StrokePath);
|
||||
} else {
|
||||
|
@ -546,6 +546,7 @@ QFontEngineData::~QFontEngineData()
|
||||
|
||||
/*!
|
||||
\fn QString QFont::rawName() const
|
||||
\deprecated
|
||||
|
||||
Returns the name of the font within the underlying window system.
|
||||
|
||||
@ -559,6 +560,7 @@ QFontEngineData::~QFontEngineData()
|
||||
|
||||
/*!
|
||||
\fn void QFont::setRawName(const QString &name)
|
||||
\deprecated
|
||||
|
||||
Sets a font by its system specific name.
|
||||
|
||||
@ -1106,7 +1108,7 @@ int QFont::weight() const
|
||||
|
||||
Qt uses a weighting scale from 0 to 99 similar to, but not the
|
||||
same as, the scales used in Windows or CSS. A weight of 0 is
|
||||
ultralight, whilst 99 will be an extremely black.
|
||||
ultralight, whilst 99 will be extremely black.
|
||||
|
||||
This enum contains the predefined font weights:
|
||||
|
||||
@ -1282,7 +1284,7 @@ bool QFont::kerning() const
|
||||
When kerning is enabled, glyph metrics do not add up anymore,
|
||||
even for Latin text. In other words, the assumption that
|
||||
width('a') + width('b') is equal to width("ab") is not
|
||||
neccesairly true.
|
||||
necessarily true.
|
||||
|
||||
\sa kerning(), QFontMetrics
|
||||
*/
|
||||
@ -2420,7 +2422,7 @@ QString QFontInfo::family() const
|
||||
\since 4.8
|
||||
|
||||
Returns the style name of the matched window system font on
|
||||
system that supports it.
|
||||
systems that support it.
|
||||
|
||||
\sa QFont::styleName()
|
||||
*/
|
||||
|
@ -242,9 +242,11 @@ public:
|
||||
{ qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; }
|
||||
#endif
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 3)
|
||||
// needed for X11
|
||||
void setRawName(const QString &);
|
||||
QString rawName() const;
|
||||
QT_DEPRECATED void setRawName(const QString &);
|
||||
QT_DEPRECATED QString rawName() const;
|
||||
#endif
|
||||
|
||||
QString key() const;
|
||||
|
||||
|
@ -251,7 +251,7 @@ public:
|
||||
return script == other.script
|
||||
&& screen == other.screen
|
||||
&& multi == other.multi
|
||||
&& (!multi || def.fallBackFamilies.size() == other.def.fallBackFamilies.size())
|
||||
&& (!multi || def.fallBackFamilies == other.def.fallBackFamilies)
|
||||
&& def == other.def;
|
||||
}
|
||||
};
|
||||
|
@ -531,7 +531,7 @@ static const int scriptForWritingSystem[] = {
|
||||
|
||||
Q_STATIC_ASSERT(sizeof(scriptForWritingSystem) / sizeof(scriptForWritingSystem[0]) == QFontDatabase::WritingSystemsCount);
|
||||
|
||||
int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem)
|
||||
Q_GUI_EXPORT int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem)
|
||||
{
|
||||
return scriptForWritingSystem[writingSystem];
|
||||
}
|
||||
|
@ -264,16 +264,12 @@ _hb_qt_unicode_compose(hb_unicode_funcs_t * /*ufuncs*/,
|
||||
// ### optimize
|
||||
QString s = QString::fromUcs4(&a, 1) + QString::fromUcs4(&b, 1);
|
||||
QString normalized = s.normalized(QString::NormalizationForm_C);
|
||||
if (normalized.isEmpty())
|
||||
return false;
|
||||
|
||||
QVector<uint> ucs4str = normalized.toUcs4();
|
||||
if (ucs4str.size() == 1) {
|
||||
*ab = ucs4str.at(0);
|
||||
return true;
|
||||
}
|
||||
QStringIterator it(normalized);
|
||||
Q_ASSERT(it.hasNext()); // size>0
|
||||
*ab = it.next();
|
||||
|
||||
return false;
|
||||
return !it.hasNext(); // size==1
|
||||
}
|
||||
|
||||
static hb_bool_t
|
||||
@ -287,29 +283,28 @@ _hb_qt_unicode_decompose(hb_unicode_funcs_t * /*ufuncs*/,
|
||||
return false;
|
||||
|
||||
QString normalized = QChar::decomposition(ab);
|
||||
Q_ASSERT(!normalized.isEmpty());
|
||||
if (normalized.isEmpty())
|
||||
return false;
|
||||
|
||||
const QVector<uint> ucs4str = normalized.toUcs4();
|
||||
Q_ASSERT(ucs4str.size() <= HB_UNICODE_MAX_DECOMPOSITION_LEN);
|
||||
QStringIterator it(normalized);
|
||||
Q_ASSERT(it.hasNext()); // size>0
|
||||
*a = it.next();
|
||||
|
||||
if (ucs4str.size() == 1) {
|
||||
*a = ucs4str.at(0);
|
||||
if (!it.hasNext()) { // size==1
|
||||
*b = 0;
|
||||
return *a != ab;
|
||||
}
|
||||
|
||||
if (ucs4str.size() == 2) {
|
||||
*a = ucs4str.at(0);
|
||||
*b = ucs4str.at(1);
|
||||
|
||||
// size>1
|
||||
*b = it.next();
|
||||
if (!it.hasNext()) { // size==2
|
||||
// Here's the ugly part: if ab decomposes to a single character and
|
||||
// that character decomposes again, we have to detect that and undo
|
||||
// the second part :-(
|
||||
QString recomposed = normalized.normalized(QString::NormalizationForm_C);
|
||||
if (recomposed.isEmpty() || recomposed == normalized)
|
||||
return false;
|
||||
|
||||
hb_codepoint_t c = recomposed.toUcs4().at(0);
|
||||
const QString recomposed = normalized.normalized(QString::NormalizationForm_C);
|
||||
QStringIterator jt(recomposed);
|
||||
Q_ASSERT(jt.hasNext()); // size>0
|
||||
const hb_codepoint_t c = jt.next();
|
||||
if (c != *a && c != ab) {
|
||||
*a = c;
|
||||
*b = 0;
|
||||
@ -317,17 +312,18 @@ _hb_qt_unicode_decompose(hb_unicode_funcs_t * /*ufuncs*/,
|
||||
return true;
|
||||
}
|
||||
|
||||
// size>2
|
||||
// If decomposed to more than two characters, take the last one,
|
||||
// and recompose the rest to get the first component
|
||||
*b = ucs4str.last();
|
||||
normalized.chop(1);
|
||||
QString recomposed = normalized.normalized(QString::NormalizationForm_C);
|
||||
if (recomposed.isEmpty() || recomposed == normalized)
|
||||
return false;
|
||||
|
||||
do {
|
||||
*b = it.next();
|
||||
} while (it.hasNext());
|
||||
normalized.chop(QChar::requiresSurrogates(*b) ? 2 : 1);
|
||||
const QString recomposed = normalized.normalized(QString::NormalizationForm_C);
|
||||
QStringIterator jt(recomposed);
|
||||
Q_ASSERT(jt.hasNext()); // size>0
|
||||
// We expect that recomposed has exactly one character now
|
||||
*a = recomposed.toUcs4().at(0);
|
||||
|
||||
*a = jt.next();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -337,9 +333,6 @@ _hb_qt_unicode_decompose_compatibility(hb_unicode_funcs_t * /*ufuncs*/,
|
||||
hb_codepoint_t *decomposed,
|
||||
void * /*user_data*/)
|
||||
{
|
||||
if (QChar::decompositionTag(u) == QChar::NoDecomposition) // !NFKD
|
||||
return 0;
|
||||
|
||||
const QString normalized = QChar::decomposition(u);
|
||||
|
||||
uint outlen = 0;
|
||||
|
@ -700,10 +700,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ
|
||||
if (fe != 0 && fe->type() == QFontEngine::Multi) {
|
||||
QFontEngineMulti *multiEngine = static_cast<QFontEngineMulti *>(fe);
|
||||
fe = multiEngine->engine(0);
|
||||
if (fe == 0) {
|
||||
multiEngine->loadEngine(0);
|
||||
fe = multiEngine->engine(0);
|
||||
}
|
||||
Q_ASSERT(fe);
|
||||
}
|
||||
|
||||
if (fe != 0) {
|
||||
|
@ -68,5 +68,5 @@
|
||||
non-OpenGL-specific GUI functionality.
|
||||
|
||||
The \l{Qt OpenGL C++ Classes} page gives an overview over the available classes
|
||||
int this module.
|
||||
in this module.
|
||||
*/
|
||||
|
@ -3227,43 +3227,6 @@ void QGLContext::moveToThread(QThread *thread)
|
||||
visual. On other platforms it may work differently.
|
||||
*/
|
||||
|
||||
/*! \fn int QGLContext::choosePixelFormat(void* dummyPfd, HDC pdc)
|
||||
|
||||
\b{Win32 only:} This virtual function chooses a pixel format
|
||||
that matches the OpenGL \l{setFormat()}{format}.
|
||||
Reimplement this function in a subclass if you need a custom
|
||||
context.
|
||||
|
||||
\warning The \a dummyPfd pointer and \a pdc are used as a \c
|
||||
PIXELFORMATDESCRIPTOR*. We use \c void to avoid using
|
||||
Windows-specific types in our header files.
|
||||
|
||||
\sa chooseContext()
|
||||
*/
|
||||
|
||||
/*! \fn void *QGLContext::chooseVisual()
|
||||
|
||||
\b{X11 only:} This virtual function tries to find a visual that
|
||||
matches the format, reducing the demands if the original request
|
||||
cannot be met.
|
||||
|
||||
The algorithm for reducing the demands of the format is quite
|
||||
simple-minded, so override this method in your subclass if your
|
||||
application has spcific requirements on visual selection.
|
||||
|
||||
\sa chooseContext()
|
||||
*/
|
||||
|
||||
/*! \fn void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth)
|
||||
\internal
|
||||
|
||||
\b{X11 only:} This virtual function chooses a visual that matches
|
||||
the OpenGL \l{format()}{format}. Reimplement this function
|
||||
in a subclass if you need a custom visual.
|
||||
|
||||
\sa chooseContext()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QGLContext::reset()
|
||||
|
||||
@ -3706,7 +3669,7 @@ QGLWidget::~QGLWidget()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QFunctionPointer QGLContext::getProcAddress() const
|
||||
\fn QFunctionPointer QGLContext::getProcAddress(const QString &proc) const
|
||||
|
||||
Returns a function pointer to the GL extension function passed in
|
||||
\a proc. 0 is returned if a pointer to the function could not be
|
||||
@ -4045,14 +4008,6 @@ void QGLWidget::paintEvent(QPaintEvent *)
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn void QGLWidget::setMouseTracking(bool enable)
|
||||
|
||||
If \a enable is true then mouse tracking is enabled; otherwise it
|
||||
is disabled.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
Renders the current scene on a pixmap and returns the pixmap.
|
||||
|
||||
|
@ -466,7 +466,7 @@ void QGLFunctions::initializeGLFunctions(const QGLContext *context)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QGLFunctions::glBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage)
|
||||
\fn void QGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage)
|
||||
|
||||
Convenience function that calls glBufferData(\a target, \a size, \a data, \a usage).
|
||||
|
||||
@ -475,7 +475,7 @@ void QGLFunctions::initializeGLFunctions(const QGLContext *context)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QGLFunctions::glBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data)
|
||||
\fn void QGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data)
|
||||
|
||||
Convenience function that calls glBufferSubData(\a target, \a offset, \a size, \a data).
|
||||
|
||||
|
@ -82,16 +82,7 @@ QVector<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format)
|
||||
// put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit,
|
||||
// we must set the red/green/blue sizes to zero. This has an unfortunate consequence that
|
||||
// if the application sets the red/green/blue size to 5/6/5 on the QSurfaceFormat,
|
||||
// they will probably get a 32-bit config, even when there's an RGB565 config available.
|
||||
|
||||
// // Now normalize the values so -1 becomes 0
|
||||
// redSize = redSize > 0 ? redSize : 0;
|
||||
// greenSize = greenSize > 0 ? greenSize : 0;
|
||||
// blueSize = blueSize > 0 ? blueSize : 0;
|
||||
// alphaSize = alphaSize > 0 ? alphaSize : 0;
|
||||
// depthSize = depthSize > 0 ? depthSize : 0;
|
||||
// stencilSize = stencilSize > 0 ? stencilSize : 0;
|
||||
// sampleCount = sampleCount > 0 ? sampleCount : 0;
|
||||
// they might still get a 32-bit config, even when there's an RGB565 config available.
|
||||
|
||||
QVector<EGLint> configAttributes;
|
||||
|
||||
@ -446,11 +437,9 @@ void q_printEglConfig(EGLDisplay display, EGLConfig config)
|
||||
for (index = 0; attrs[index].attr != -1; ++index) {
|
||||
EGLint value;
|
||||
if (eglGetConfigAttrib(display, config, attrs[index].attr, &value)) {
|
||||
qWarning("\t%s: %d\n", attrs[index].name, (int)value);
|
||||
qDebug("\t%s: %d", attrs[index].name, (int)value);
|
||||
}
|
||||
}
|
||||
|
||||
qWarning("\n");
|
||||
}
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "qeglpbuffer_p.h"
|
||||
#include <qpa/qplatformwindow.h>
|
||||
#include <QOpenGLContext>
|
||||
#include <QDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -191,6 +192,12 @@ void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLCont
|
||||
return;
|
||||
}
|
||||
|
||||
static const bool printConfig = qgetenv("QT_QPA_EGLFS_DEBUG").toInt();
|
||||
if (printConfig) {
|
||||
qDebug() << "Created context for format" << format << "with config:";
|
||||
q_printEglConfig(m_eglDisplay, m_eglConfig);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
// Make the context current to ensure the GL version query works. This needs a surface too.
|
||||
const EGLint pbufferAttributes[] = {
|
||||
@ -261,37 +268,15 @@ bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ok = eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_eglContext);
|
||||
if (!ok)
|
||||
qWarning("QEGLPlatformContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this);
|
||||
#ifdef QEGL_EXTRA_DEBUG
|
||||
static bool showDebug = true;
|
||||
if (showDebug) {
|
||||
showDebug = false;
|
||||
const char *str = (const char*)glGetString(GL_VENDOR);
|
||||
qWarning("Vendor %s\n", str);
|
||||
str = (const char*)glGetString(GL_RENDERER);
|
||||
qWarning("Renderer %s\n", str);
|
||||
str = (const char*)glGetString(GL_VERSION);
|
||||
qWarning("Version %s\n", str);
|
||||
|
||||
str = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||
qWarning("Extensions %s\n",str);
|
||||
|
||||
str = (const char*)glGetString(GL_EXTENSIONS);
|
||||
qWarning("Extensions %s\n", str);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
const bool ok = eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_eglContext);
|
||||
if (ok) {
|
||||
if (!m_swapIntervalEnvChecked) {
|
||||
m_swapIntervalEnvChecked = true;
|
||||
if (qEnvironmentVariableIsSet("QT_QPA_EGLFS_SWAPINTERVAL")) {
|
||||
QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL");
|
||||
bool ok;
|
||||
const int swapInterval = swapIntervalString.toInt(&ok);
|
||||
if (ok)
|
||||
bool intervalOk;
|
||||
const int swapInterval = swapIntervalString.toInt(&intervalOk);
|
||||
if (intervalOk)
|
||||
m_swapIntervalFromEnv = swapInterval;
|
||||
}
|
||||
}
|
||||
@ -302,6 +287,8 @@ bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface)
|
||||
m_swapInterval = requestedSwapInterval;
|
||||
eglSwapInterval(eglDisplay(), m_swapInterval);
|
||||
}
|
||||
} else {
|
||||
qWarning("QEGLPlatformContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this);
|
||||
}
|
||||
|
||||
return ok;
|
||||
|
@ -220,7 +220,7 @@ void QBasicFontDatabase::releaseHandle(void *handle)
|
||||
|
||||
extern FT_Library qt_getFreetype();
|
||||
|
||||
QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file)
|
||||
QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file, QSupportedWritingSystems *supportedWritingSystems)
|
||||
{
|
||||
FT_Library library = qt_getFreetype();
|
||||
|
||||
@ -259,6 +259,8 @@ QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByt
|
||||
if (cm->encoding == FT_ENCODING_ADOBE_CUSTOM
|
||||
|| cm->encoding == FT_ENCODING_MS_SYMBOL) {
|
||||
writingSystems.setSupported(QFontDatabase::Symbol);
|
||||
if (supportedWritingSystems)
|
||||
supportedWritingSystems->setSupported(QFontDatabase::Symbol);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -277,6 +279,8 @@ QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByt
|
||||
};
|
||||
|
||||
writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
|
||||
if (supportedWritingSystems)
|
||||
*supportedWritingSystems = writingSystems;
|
||||
|
||||
if (os2->usWeightClass == 0)
|
||||
;
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName);
|
||||
void releaseHandle(void *handle);
|
||||
|
||||
static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file);
|
||||
static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file, QSupportedWritingSystems *supportedWritingSystems = 0);
|
||||
static QString fontNameFromTTFile(const QString &filename);
|
||||
};
|
||||
|
||||
|
@ -331,10 +331,8 @@ static const char *getFcFamilyForStyleHint(const QFont::StyleHint style)
|
||||
return stylehint;
|
||||
}
|
||||
|
||||
void QFontconfigDatabase::populateFontDatabase()
|
||||
static void populateFromPattern(FcPattern *pattern)
|
||||
{
|
||||
FcFontSet *fonts;
|
||||
|
||||
QString familyName;
|
||||
FcChar8 *value = 0;
|
||||
int weight_value;
|
||||
@ -348,6 +346,110 @@ void QFontconfigDatabase::populateFontDatabase()
|
||||
FcBool scalable;
|
||||
FcBool antialias;
|
||||
|
||||
if (FcPatternGetString(pattern, FC_FAMILY, 0, &value) != FcResultMatch)
|
||||
return;
|
||||
|
||||
familyName = QString::fromUtf8((const char *)value);
|
||||
|
||||
slant_value = FC_SLANT_ROMAN;
|
||||
weight_value = FC_WEIGHT_REGULAR;
|
||||
spacing_value = FC_PROPORTIONAL;
|
||||
file_value = 0;
|
||||
indexValue = 0;
|
||||
scalable = FcTrue;
|
||||
|
||||
|
||||
if (FcPatternGetInteger(pattern, FC_SLANT, 0, &slant_value) != FcResultMatch)
|
||||
slant_value = FC_SLANT_ROMAN;
|
||||
if (FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight_value) != FcResultMatch)
|
||||
weight_value = FC_WEIGHT_REGULAR;
|
||||
if (FcPatternGetInteger(pattern, FC_WIDTH, 0, &width_value) != FcResultMatch)
|
||||
width_value = FC_WIDTH_NORMAL;
|
||||
if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing_value) != FcResultMatch)
|
||||
spacing_value = FC_PROPORTIONAL;
|
||||
if (FcPatternGetString(pattern, FC_FILE, 0, &file_value) != FcResultMatch)
|
||||
file_value = 0;
|
||||
if (FcPatternGetInteger(pattern, FC_INDEX, 0, &indexValue) != FcResultMatch)
|
||||
indexValue = 0;
|
||||
if (FcPatternGetBool(pattern, FC_SCALABLE, 0, &scalable) != FcResultMatch)
|
||||
scalable = FcTrue;
|
||||
if (FcPatternGetString(pattern, FC_FOUNDRY, 0, &foundry_value) != FcResultMatch)
|
||||
foundry_value = 0;
|
||||
if (FcPatternGetString(pattern, FC_STYLE, 0, &style_value) != FcResultMatch)
|
||||
style_value = 0;
|
||||
if (FcPatternGetBool(pattern,FC_ANTIALIAS,0,&antialias) != FcResultMatch)
|
||||
antialias = true;
|
||||
|
||||
QSupportedWritingSystems writingSystems;
|
||||
FcLangSet *langset = 0;
|
||||
FcResult res = FcPatternGetLangSet(pattern, FC_LANG, 0, &langset);
|
||||
if (res == FcResultMatch) {
|
||||
bool hasLang = false;
|
||||
for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
|
||||
const FcChar8 *lang = (const FcChar8*) languageForWritingSystem[j];
|
||||
if (lang) {
|
||||
FcLangResult langRes = FcLangSetHasLang(langset, lang);
|
||||
if (langRes != FcLangDifferentLang) {
|
||||
writingSystems.setSupported(QFontDatabase::WritingSystem(j));
|
||||
hasLang = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasLang)
|
||||
// none of our known languages, add it to the other set
|
||||
writingSystems.setSupported(QFontDatabase::Other);
|
||||
} else {
|
||||
// we set Other to supported for symbol fonts. It makes no
|
||||
// sense to merge these with other ones, as they are
|
||||
// special in a way.
|
||||
writingSystems.setSupported(QFontDatabase::Other);
|
||||
}
|
||||
|
||||
#if FC_VERSION >= 20297
|
||||
for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
|
||||
if (writingSystems.supported(QFontDatabase::WritingSystem(j))
|
||||
&& requiresOpenType(j) && openType[j]) {
|
||||
FcChar8 *cap;
|
||||
res = FcPatternGetString (pattern, FC_CAPABILITY, 0, &cap);
|
||||
if (res != FcResultMatch || !strstr((const char *)cap, openType[j]))
|
||||
writingSystems.setSupported(QFontDatabase::WritingSystem(j),false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
FontFile *fontFile = new FontFile;
|
||||
fontFile->fileName = QLatin1String((const char *)file_value);
|
||||
fontFile->indexValue = indexValue;
|
||||
|
||||
QFont::Style style = (slant_value == FC_SLANT_ITALIC)
|
||||
? QFont::StyleItalic
|
||||
: ((slant_value == FC_SLANT_OBLIQUE)
|
||||
? QFont::StyleOblique
|
||||
: QFont::StyleNormal);
|
||||
// Note: weight should really be an int but registerFont incorrectly uses an enum
|
||||
QFont::Weight weight = QFont::Weight(weightFromFcWeight(weight_value));
|
||||
|
||||
double pixel_size = 0;
|
||||
if (!scalable)
|
||||
FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &pixel_size);
|
||||
|
||||
bool fixedPitch = spacing_value >= FC_MONO;
|
||||
// Note: stretch should really be an int but registerFont incorrectly uses an enum
|
||||
QFont::Stretch stretch = QFont::Stretch(stretchFromFcWidth(width_value));
|
||||
QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString();
|
||||
QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
|
||||
// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size;
|
||||
|
||||
for (int k = 1; FcPatternGetString(pattern, FC_FAMILY, k, &value) == FcResultMatch; ++k)
|
||||
QPlatformFontDatabase::registerAliasToFontFamily(familyName, QString::fromUtf8((const char *)value));
|
||||
|
||||
}
|
||||
|
||||
void QFontconfigDatabase::populateFontDatabase()
|
||||
{
|
||||
FcInitReinitialize();
|
||||
FcFontSet *fonts;
|
||||
|
||||
{
|
||||
FcObjectSet *os = FcObjectSetCreate();
|
||||
FcPattern *pattern = FcPatternCreate();
|
||||
@ -371,103 +473,8 @@ void QFontconfigDatabase::populateFontDatabase()
|
||||
FcPatternDestroy(pattern);
|
||||
}
|
||||
|
||||
for (int i = 0; i < fonts->nfont; i++) {
|
||||
if (FcPatternGetString(fonts->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch)
|
||||
continue;
|
||||
// capitalize(value);
|
||||
familyName = QString::fromUtf8((const char *)value);
|
||||
slant_value = FC_SLANT_ROMAN;
|
||||
weight_value = FC_WEIGHT_REGULAR;
|
||||
spacing_value = FC_PROPORTIONAL;
|
||||
file_value = 0;
|
||||
indexValue = 0;
|
||||
scalable = FcTrue;
|
||||
|
||||
|
||||
if (FcPatternGetInteger (fonts->fonts[i], FC_SLANT, 0, &slant_value) != FcResultMatch)
|
||||
slant_value = FC_SLANT_ROMAN;
|
||||
if (FcPatternGetInteger (fonts->fonts[i], FC_WEIGHT, 0, &weight_value) != FcResultMatch)
|
||||
weight_value = FC_WEIGHT_REGULAR;
|
||||
if (FcPatternGetInteger (fonts->fonts[i], FC_WIDTH, 0, &width_value) != FcResultMatch)
|
||||
width_value = FC_WIDTH_NORMAL;
|
||||
if (FcPatternGetInteger (fonts->fonts[i], FC_SPACING, 0, &spacing_value) != FcResultMatch)
|
||||
spacing_value = FC_PROPORTIONAL;
|
||||
if (FcPatternGetString (fonts->fonts[i], FC_FILE, 0, &file_value) != FcResultMatch)
|
||||
file_value = 0;
|
||||
if (FcPatternGetInteger (fonts->fonts[i], FC_INDEX, 0, &indexValue) != FcResultMatch)
|
||||
indexValue = 0;
|
||||
if (FcPatternGetBool(fonts->fonts[i], FC_SCALABLE, 0, &scalable) != FcResultMatch)
|
||||
scalable = FcTrue;
|
||||
if (FcPatternGetString(fonts->fonts[i], FC_FOUNDRY, 0, &foundry_value) != FcResultMatch)
|
||||
foundry_value = 0;
|
||||
if (FcPatternGetString(fonts->fonts[i], FC_STYLE, 0, &style_value) != FcResultMatch)
|
||||
style_value = 0;
|
||||
if(FcPatternGetBool(fonts->fonts[i],FC_ANTIALIAS,0,&antialias) != FcResultMatch)
|
||||
antialias = true;
|
||||
|
||||
QSupportedWritingSystems writingSystems;
|
||||
FcLangSet *langset = 0;
|
||||
FcResult res = FcPatternGetLangSet(fonts->fonts[i], FC_LANG, 0, &langset);
|
||||
if (res == FcResultMatch) {
|
||||
bool hasLang = false;
|
||||
for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
|
||||
const FcChar8 *lang = (const FcChar8*) languageForWritingSystem[j];
|
||||
if (lang) {
|
||||
FcLangResult langRes = FcLangSetHasLang(langset, lang);
|
||||
if (langRes != FcLangDifferentLang) {
|
||||
writingSystems.setSupported(QFontDatabase::WritingSystem(j));
|
||||
hasLang = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasLang)
|
||||
// none of our known languages, add it to the other set
|
||||
writingSystems.setSupported(QFontDatabase::Other);
|
||||
} else {
|
||||
// we set Other to supported for symbol fonts. It makes no
|
||||
// sense to merge these with other ones, as they are
|
||||
// special in a way.
|
||||
writingSystems.setSupported(QFontDatabase::Other);
|
||||
}
|
||||
|
||||
#if FC_VERSION >= 20297
|
||||
for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
|
||||
if (writingSystems.supported(QFontDatabase::WritingSystem(j))
|
||||
&& requiresOpenType(j) && openType[j]) {
|
||||
FcChar8 *cap;
|
||||
res = FcPatternGetString (fonts->fonts[i], FC_CAPABILITY, 0, &cap);
|
||||
if (res != FcResultMatch || !strstr((const char *)cap, openType[j]))
|
||||
writingSystems.setSupported(QFontDatabase::WritingSystem(j),false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
FontFile *fontFile = new FontFile;
|
||||
fontFile->fileName = QLatin1String((const char *)file_value);
|
||||
fontFile->indexValue = indexValue;
|
||||
|
||||
QFont::Style style = (slant_value == FC_SLANT_ITALIC)
|
||||
? QFont::StyleItalic
|
||||
: ((slant_value == FC_SLANT_OBLIQUE)
|
||||
? QFont::StyleOblique
|
||||
: QFont::StyleNormal);
|
||||
// Note: weight should really be an int but registerFont incorrectly uses an enum
|
||||
QFont::Weight weight = QFont::Weight(weightFromFcWeight(weight_value));
|
||||
|
||||
double pixel_size = 0;
|
||||
if (!scalable)
|
||||
FcPatternGetDouble (fonts->fonts[i], FC_PIXEL_SIZE, 0, &pixel_size);
|
||||
|
||||
bool fixedPitch = spacing_value >= FC_MONO;
|
||||
// Note: stretch should really be an int but registerFont incorrectly uses an enum
|
||||
QFont::Stretch stretch = QFont::Stretch(stretchFromFcWidth(width_value));
|
||||
QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString();
|
||||
QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
|
||||
// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size;
|
||||
|
||||
for (int k = 1; FcPatternGetString(fonts->fonts[i], FC_FAMILY, k, &value) == FcResultMatch; ++k)
|
||||
QPlatformFontDatabase::registerAliasToFontFamily(familyName, QString::fromUtf8((const char *)value));
|
||||
}
|
||||
for (int i = 0; i < fonts->nfont; i++)
|
||||
populateFromPattern(fonts->fonts[i]);
|
||||
|
||||
FcFontSetDestroy (fonts);
|
||||
|
||||
@ -802,6 +809,7 @@ static FcPattern *queryFont(const FcChar8 *file, const QByteArray &data, int id,
|
||||
QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
|
||||
{
|
||||
QStringList families;
|
||||
|
||||
FcFontSet *set = FcConfigGetFonts(0, FcSetApplication);
|
||||
if (!set) {
|
||||
FcConfigAppFontAddFile(0, (const FcChar8 *)":/non-existent");
|
||||
@ -814,28 +822,24 @@ QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData,
|
||||
FcBlanks *blanks = FcConfigGetBlanks(0);
|
||||
int count = 0;
|
||||
|
||||
FcPattern *pattern = 0;
|
||||
FcPattern *pattern;
|
||||
do {
|
||||
pattern = queryFont((const FcChar8 *)QFile::encodeName(fileName).constData(),
|
||||
fontData, id, blanks, &count);
|
||||
if (!pattern)
|
||||
return families;
|
||||
|
||||
FcPatternDel(pattern, FC_FILE);
|
||||
QByteArray cs = fileName.toUtf8();
|
||||
FcPatternAddString(pattern, FC_FILE, (const FcChar8 *) cs.constData());
|
||||
|
||||
FcChar8 *fam = 0;
|
||||
if (FcPatternGetString(pattern, FC_FAMILY, 0, &fam) == FcResultMatch) {
|
||||
QString family = QString::fromUtf8(reinterpret_cast<const char *>(fam));
|
||||
families << family;
|
||||
}
|
||||
populateFromPattern(pattern);
|
||||
|
||||
if (!FcFontSetAdd(set, pattern))
|
||||
return families;
|
||||
FcFontSetAdd(set, pattern);
|
||||
|
||||
++id;
|
||||
} while (pattern && id < count);
|
||||
} while (id < count);
|
||||
|
||||
return families;
|
||||
}
|
||||
|
@ -1,20 +1,17 @@
|
||||
Generic plug-in for evdev multiple touch (ABS_MT) events.
|
||||
Supports protocol type A & B.
|
||||
Type B is supported both directly and via libmtdev.
|
||||
Single-touch devices reporting ABS_X and Y only are not supported
|
||||
by this plugin. Use tslib or evdevmouse instead.
|
||||
|
||||
The protocol type will be detected automatically.
|
||||
|
||||
libmtdev is automatically detected based on library availability. To disable it,
|
||||
pass -no-mtdev to configure.
|
||||
|
||||
Tested with the following kernel drivers:
|
||||
bcm5974 (type A)
|
||||
hid_magicmouse (type A with ABS_MT_TRACKING_ID) (type B over libmtdev)
|
||||
wacom (type B)
|
||||
Single-touch devices reporting ABS_X and Y are supported too. Keep in
|
||||
mind however that the libudev-based device discovery may not be able
|
||||
to recognize such devices. If mouse events are sufficient, it may be
|
||||
better to use evdevmouse or tslib with such devices.
|
||||
|
||||
To use this "driver", pass -plugin EvdevTouch on the command line.
|
||||
To use this plugin, pass -plugin EvdevTouch on the command line.
|
||||
|
||||
If automatic detection does not work, use -plugin
|
||||
EvdevTouch:/dev/input/eventN to explicitly set the device file
|
||||
|
@ -576,7 +576,8 @@ static void updateWindow(JNIEnv */*env*/, jobject /*thiz*/)
|
||||
}
|
||||
|
||||
QAndroidPlatformScreen *screen = static_cast<QAndroidPlatformScreen *>(m_androidPlatformIntegration->screen());
|
||||
QMetaObject::invokeMethod(screen, "setDirty", Qt::QueuedConnection, Q_ARG(QRect,screen->geometry()));
|
||||
if (screen->rasterSurfaces())
|
||||
QMetaObject::invokeMethod(screen, "setDirty", Qt::QueuedConnection, Q_ARG(QRect,screen->geometry()));
|
||||
}
|
||||
|
||||
static void updateApplicationState(JNIEnv */*env*/, jobject /*thiz*/, jint state)
|
||||
|
@ -70,6 +70,35 @@ static jfieldID m_selectionStartFieldID = 0;
|
||||
static jfieldID m_startOffsetFieldID = 0;
|
||||
static jfieldID m_textFieldID = 0;
|
||||
|
||||
static jboolean beginBatchEdit(JNIEnv */*env*/, jobject /*thiz*/)
|
||||
{
|
||||
if (!m_androidInputContext)
|
||||
return JNI_FALSE;
|
||||
|
||||
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
|
||||
qDebug() << "@@@ BEGINBATCH";
|
||||
#endif
|
||||
|
||||
return m_androidInputContext->beginBatchEdit();
|
||||
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
static jboolean endBatchEdit(JNIEnv */*env*/, jobject /*thiz*/)
|
||||
{
|
||||
if (!m_androidInputContext)
|
||||
return JNI_FALSE;
|
||||
|
||||
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
|
||||
qDebug() << "@@@ ENDBATCH";
|
||||
#endif
|
||||
|
||||
return m_androidInputContext->endBatchEdit();
|
||||
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static jboolean commitText(JNIEnv *env, jobject /*thiz*/, jstring text, jint newCursorPosition)
|
||||
{
|
||||
if (!m_androidInputContext)
|
||||
@ -121,12 +150,13 @@ static jobject getExtractedText(JNIEnv *env, jobject /*thiz*/, int hintMaxChars,
|
||||
if (!m_androidInputContext)
|
||||
return 0;
|
||||
|
||||
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
|
||||
qDebug() << "@@@ GETEX";
|
||||
#endif
|
||||
const QAndroidInputContext::ExtractedText &extractedText =
|
||||
m_androidInputContext->getExtractedText(hintMaxChars, hintMaxLines, flags);
|
||||
|
||||
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
|
||||
qDebug() << "@@@ GETEX" << hintMaxChars << hintMaxLines << QString::fromLatin1("0x") + QString::number(flags,16) << extractedText.text << "partOff:" << extractedText.partialStartOffset << extractedText.partialEndOffset << "sel:" << extractedText.selectionStart << extractedText.selectionEnd << "offset:" << extractedText.startOffset;
|
||||
#endif
|
||||
|
||||
jobject object = env->NewObject(m_extractedTextClass, m_classConstructorMethodID);
|
||||
env->SetIntField(object, m_partialStartOffsetFieldID, extractedText.partialStartOffset);
|
||||
env->SetIntField(object, m_partialEndOffsetFieldID, extractedText.partialEndOffset);
|
||||
@ -285,6 +315,8 @@ static jboolean updateCursorPosition(JNIEnv */*env*/, jobject /*thiz*/)
|
||||
|
||||
|
||||
static JNINativeMethod methods[] = {
|
||||
{"beginBatchEdit", "()Z", (void *)beginBatchEdit},
|
||||
{"endBatchEdit", "()Z", (void *)endBatchEdit},
|
||||
{"commitText", "(Ljava/lang/String;I)Z", (void *)commitText},
|
||||
{"deleteSurroundingText", "(II)Z", (void *)deleteSurroundingText},
|
||||
{"finishComposingText", "()Z", (void *)finishComposingText},
|
||||
@ -306,7 +338,7 @@ static JNINativeMethod methods[] = {
|
||||
|
||||
|
||||
QAndroidInputContext::QAndroidInputContext()
|
||||
: QPlatformInputContext(), m_blockUpdateSelection(false)
|
||||
: QPlatformInputContext(), m_blockUpdateSelection(false), m_batchEditNestingLevel(0)
|
||||
{
|
||||
QtAndroid::AttachedJNIEnv env;
|
||||
if (!env.jniEnv)
|
||||
@ -416,11 +448,14 @@ void QAndroidInputContext::commit()
|
||||
void QAndroidInputContext::updateCursorPosition()
|
||||
{
|
||||
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
|
||||
if (!query.isNull() && !m_blockUpdateSelection) {
|
||||
if (!query.isNull() && !m_blockUpdateSelection && !m_batchEditNestingLevel) {
|
||||
// make sure it also works with editors that have not been updated to the new API
|
||||
QVariant absolutePos = query->value(Qt::ImAbsolutePosition);
|
||||
const int cursorPos = absolutePos.isValid() ? absolutePos.toInt() : query->value(Qt::ImCursorPosition).toInt();
|
||||
QtAndroidInput::updateSelection(cursorPos, cursorPos, -1, -1); //selection empty and no pre-edit text
|
||||
const int composeLength = m_composingText.length();
|
||||
const int composeStart = composeLength ? cursorPos : -1;
|
||||
QtAndroidInput::updateSelection(cursorPos + composeLength, cursorPos + composeLength, //empty selection
|
||||
composeStart, composeStart + composeLength); // pre-edit text
|
||||
}
|
||||
}
|
||||
|
||||
@ -507,6 +542,19 @@ void QAndroidInputContext::sendEvent(QObject *receiver, QInputMethodQueryEvent *
|
||||
QCoreApplication::sendEvent(receiver, event);
|
||||
}
|
||||
|
||||
jboolean QAndroidInputContext::beginBatchEdit()
|
||||
{
|
||||
++m_batchEditNestingLevel;
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
jboolean QAndroidInputContext::endBatchEdit()
|
||||
{
|
||||
if (--m_batchEditNestingLevel == 0 && !m_blockUpdateSelection) //ending batch edit mode
|
||||
updateCursorPosition();
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
jboolean QAndroidInputContext::commitText(const QString &text, jint /*newCursorPosition*/)
|
||||
{
|
||||
m_composingText = text;
|
||||
@ -559,19 +607,39 @@ jint QAndroidInputContext::getCursorCapsMode(jint /*reqModes*/)
|
||||
|
||||
const QAndroidInputContext::ExtractedText &QAndroidInputContext::getExtractedText(jint hintMaxChars, jint /*hintMaxLines*/, jint /*flags*/)
|
||||
{
|
||||
// Note to self: "if the GET_EXTRACTED_TEXT_MONITOR flag is set, you should be calling
|
||||
// updateExtractedText(View, int, ExtractedText) whenever you call
|
||||
// updateSelection(View, int, int, int, int)." QTBUG-37980
|
||||
|
||||
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
|
||||
if (query.isNull())
|
||||
return m_extractedText;
|
||||
|
||||
if (hintMaxChars)
|
||||
m_extractedText.text = query->value(Qt::ImSurroundingText).toString().right(hintMaxChars);
|
||||
int localPos = query->value(Qt::ImCursorPosition).toInt(); //position before pre-edit text relative to the current block
|
||||
QVariant absolutePos = query->value(Qt::ImAbsolutePosition);
|
||||
int blockPos = absolutePos.isValid() ? absolutePos.toInt() - localPos : 0; // position of the start of the current block
|
||||
QString blockText = query->value(Qt::ImSurroundingText).toString() + m_composingText;
|
||||
int composeLength = m_composingText.length();
|
||||
|
||||
int cpos = localPos + composeLength; //actual cursor pos relative to the current block
|
||||
|
||||
int localOffset = 0; // start of extracted text relative to the current block
|
||||
if (hintMaxChars) {
|
||||
if (cpos > hintMaxChars)
|
||||
localOffset = cpos - hintMaxChars;
|
||||
m_extractedText.text = blockText.mid(localOffset, hintMaxChars);
|
||||
}
|
||||
|
||||
m_extractedText.startOffset = blockPos + localOffset; // "The offset in the overall text at which the extracted text starts."
|
||||
|
||||
m_extractedText.startOffset = query->value(Qt::ImCursorPosition).toInt();
|
||||
const QString &selection = query->value(Qt::ImCurrentSelection).toString();
|
||||
const int selLen = selection.length();
|
||||
if (selLen) {
|
||||
m_extractedText.selectionStart = query->value(Qt::ImAnchorPosition).toInt();
|
||||
m_extractedText.selectionEnd = m_extractedText.startOffset;
|
||||
m_extractedText.selectionStart = query->value(Qt::ImAnchorPosition).toInt() - localOffset;
|
||||
m_extractedText.selectionEnd = m_extractedText.selectionStart + selLen;
|
||||
} else {
|
||||
m_extractedText.selectionStart = cpos - localOffset;
|
||||
m_extractedText.selectionEnd = cpos - localOffset;
|
||||
}
|
||||
|
||||
return m_extractedText;
|
||||
@ -610,7 +678,7 @@ QString QAndroidInputContext::getTextBeforeCursor(jint length, jint /*flags*/)
|
||||
{
|
||||
QVariant textBefore = queryFocusObjectThreadSafe(Qt::ImTextBeforeCursor, QVariant(length));
|
||||
if (textBefore.isValid()) {
|
||||
return textBefore.toString().left(length);
|
||||
return textBefore.toString().left(length) + m_composingText;
|
||||
}
|
||||
|
||||
//compatibility code for old controls that do not implement the new API
|
||||
@ -624,7 +692,7 @@ QString QAndroidInputContext::getTextBeforeCursor(jint length, jint /*flags*/)
|
||||
return text;
|
||||
|
||||
const int wordLeftPos = cursorPos - length;
|
||||
return text.mid(wordLeftPos > 0 ? wordLeftPos : 0, cursorPos);
|
||||
return text.mid(wordLeftPos > 0 ? wordLeftPos : 0, cursorPos) + m_composingText;
|
||||
}
|
||||
|
||||
jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCursorPosition)
|
||||
@ -647,11 +715,11 @@ jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCur
|
||||
sendInputMethodEvent(&event);
|
||||
|
||||
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
|
||||
if (!query.isNull() && !m_blockUpdateSelection) {
|
||||
if (!query.isNull() && !m_blockUpdateSelection && !m_batchEditNestingLevel) {
|
||||
QVariant absolutePos = query->value(Qt::ImAbsolutePosition);
|
||||
const int cursorPos = absolutePos.isValid() ? absolutePos.toInt() : query->value(Qt::ImCursorPosition).toInt();
|
||||
const int preeditLength = text.length();
|
||||
QtAndroidInput::updateSelection(cursorPos+preeditLength, cursorPos+preeditLength, cursorPos, cursorPos+preeditLength);
|
||||
QtAndroidInput::updateSelection(cursorPos+preeditLength, cursorPos+preeditLength, -1, -1);
|
||||
}
|
||||
|
||||
return JNI_TRUE;
|
||||
@ -713,9 +781,17 @@ jboolean QAndroidInputContext::setComposingRegion(jint start, jint end)
|
||||
|
||||
jboolean QAndroidInputContext::setSelection(jint start, jint end)
|
||||
{
|
||||
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
|
||||
if (query.isNull())
|
||||
return JNI_FALSE;
|
||||
|
||||
int localPos = query->value(Qt::ImCursorPosition).toInt();
|
||||
QVariant absolutePos = query->value(Qt::ImAbsolutePosition);
|
||||
int blockPosition = absolutePos.isValid() ? absolutePos.toInt() - localPos : 0;
|
||||
|
||||
QList<QInputMethodEvent::Attribute> attributes;
|
||||
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection,
|
||||
start,
|
||||
start - blockPosition,
|
||||
end - start,
|
||||
QVariant()));
|
||||
|
||||
|
@ -97,6 +97,8 @@ public:
|
||||
void clear();
|
||||
|
||||
//---------------//
|
||||
jboolean beginBatchEdit();
|
||||
jboolean endBatchEdit();
|
||||
jboolean commitText(const QString &text, jint newCursorPosition);
|
||||
jboolean deleteSurroundingText(jint leftLength, jint rightLength);
|
||||
jboolean finishComposingText();
|
||||
@ -133,6 +135,7 @@ private:
|
||||
QString m_composingText;
|
||||
QMetaObject::Connection m_updateCursorPosConnection;
|
||||
bool m_blockUpdateSelection;
|
||||
int m_batchEditNestingLevel;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -41,6 +41,9 @@
|
||||
|
||||
#include "qandroidplatformdialoghelpers.h"
|
||||
#include "androidjnimain.h"
|
||||
|
||||
#include <QTextDocument>
|
||||
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <qpa/qplatformtheme.h>
|
||||
|
||||
@ -61,6 +64,14 @@ void QAndroidPlatformMessageDialogHelper::exec()
|
||||
m_loop.exec();
|
||||
}
|
||||
|
||||
static QString htmlText(QString text)
|
||||
{
|
||||
if (Qt::mightBeRichText(text))
|
||||
return text;
|
||||
text.remove(QLatin1Char('\r'));
|
||||
return text.toHtmlEscaped().replace(QLatin1Char('\n'), QLatin1String("<br />"));
|
||||
}
|
||||
|
||||
bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags
|
||||
, Qt::WindowModality windowModality
|
||||
, QWindow *parent)
|
||||
@ -74,19 +85,19 @@ bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags
|
||||
|
||||
m_javaMessageDialog.callMethod<void>("setIcon", "(I)V", opt->icon());
|
||||
|
||||
QString str = opt->windowTitle();
|
||||
QString str = htmlText(opt->windowTitle());
|
||||
if (!str.isEmpty())
|
||||
m_javaMessageDialog.callMethod<void>("setTile", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
|
||||
|
||||
str = opt->text();
|
||||
str = htmlText(opt->text());
|
||||
if (!str.isEmpty())
|
||||
m_javaMessageDialog.callMethod<void>("setText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
|
||||
|
||||
str = opt->informativeText();
|
||||
str = htmlText(opt->informativeText());
|
||||
if (!str.isEmpty())
|
||||
m_javaMessageDialog.callMethod<void>("setInformativeText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
|
||||
|
||||
str = opt->detailedText();
|
||||
str = htmlText(opt->detailedText());
|
||||
if (!str.isEmpty())
|
||||
m_javaMessageDialog.callMethod<void>("setDetailedText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
|
||||
|
||||
|
@ -60,7 +60,17 @@ void QAndroidPlatformFontDatabase::populateFontDatabase()
|
||||
QDir dir(fontpath, QLatin1String("*.ttf"));
|
||||
for (int i = 0; i < int(dir.count()); ++i) {
|
||||
const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i]));
|
||||
addTTFile(QByteArray(), file);
|
||||
|
||||
QSupportedWritingSystems supportedWritingSystems;
|
||||
QStringList families = addTTFile(QByteArray(), file, &supportedWritingSystems);
|
||||
|
||||
extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem);
|
||||
for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
|
||||
if (i == QFontDatabase::Any || supportedWritingSystems.supported(QFontDatabase::WritingSystem(i))) {
|
||||
QChar::Script script = QChar::Script(qt_script_for_writing_system(QFontDatabase::WritingSystem(i)));
|
||||
m_fallbacks[script] += families;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,9 +81,9 @@ QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &fami
|
||||
{
|
||||
Q_UNUSED(family);
|
||||
Q_UNUSED(style);
|
||||
Q_UNUSED(script);
|
||||
if (styleHint == QFont::Monospace)
|
||||
return QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";");
|
||||
|
||||
return QString(qgetenv("QT_ANDROID_FONTS")).split(";");
|
||||
if (styleHint == QFont::Monospace)
|
||||
return QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";") + m_fallbacks[script];
|
||||
|
||||
return QString(qgetenv("QT_ANDROID_FONTS")).split(";") + m_fallbacks[script];
|
||||
}
|
||||
|
@ -53,6 +53,9 @@ public:
|
||||
QFont::Style style,
|
||||
QFont::StyleHint styleHint,
|
||||
QChar::Script script) const;
|
||||
|
||||
private:
|
||||
QHash<QChar::Script, QStringList> m_fallbacks;
|
||||
};
|
||||
|
||||
#endif // QANDROIDPLATFORMFONTDATABASE_H
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#include "qandroidplatformintegration.h"
|
||||
|
||||
#include <QtCore/private/qjni_p.h>
|
||||
#include <QGuiApplication>
|
||||
#include <QOpenGLContext>
|
||||
#include <QThread>
|
||||
@ -103,9 +104,6 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶
|
||||
|
||||
m_androidPlatformNativeInterface = new QAndroidPlatformNativeInterface();
|
||||
|
||||
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
||||
qFatal("Could not bind GL_ES API");
|
||||
|
||||
m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
if (m_eglDisplay == EGL_NO_DISPLAY)
|
||||
qFatal("Could not open egl display");
|
||||
@ -114,6 +112,9 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶
|
||||
if (!eglInitialize(m_eglDisplay, &major, &minor))
|
||||
qFatal("Could not initialize egl display");
|
||||
|
||||
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
||||
qFatal("Could not bind GL_ES API");
|
||||
|
||||
m_primaryScreen = new QAndroidPlatformScreen();
|
||||
screenAdded(m_primaryScreen);
|
||||
m_primaryScreen->setPhysicalSize(QSize(m_defaultPhysicalSizeWidth, m_defaultPhysicalSizeHeight));
|
||||
@ -130,9 +131,41 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶
|
||||
#endif
|
||||
|
||||
m_androidSystemLocale = new QAndroidSystemLocale;
|
||||
|
||||
QJNIObjectPrivate javaActivity(QtAndroid::activity());
|
||||
if (javaActivity.isValid()) {
|
||||
QJNIObjectPrivate resources = javaActivity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
|
||||
QJNIObjectPrivate configuration = resources.callObjectMethod("getConfiguration", "()Landroid/content/res/Configuration;");
|
||||
|
||||
int touchScreen = configuration.getField<jint>("touchscreen");
|
||||
if (touchScreen == QJNIObjectPrivate::getStaticField<jint>("android/content/res/Configuration", "TOUCHSCREEN_FINGER")
|
||||
|| touchScreen == QJNIObjectPrivate::getStaticField<jint>("android/content/res/Configuration", "TOUCHSCREEN_STYLUS"))
|
||||
{
|
||||
m_touchDevice = new QTouchDevice;
|
||||
m_touchDevice->setType(QTouchDevice::TouchScreen);
|
||||
m_touchDevice->setCapabilities(QTouchDevice::Position
|
||||
| QTouchDevice::Area
|
||||
| QTouchDevice::Pressure
|
||||
| QTouchDevice::NormalizedPosition);
|
||||
|
||||
QJNIObjectPrivate pm = javaActivity.callObjectMethod("getPackageManager", "()Landroid/content/pm/PackageManager;");
|
||||
Q_ASSERT(pm.isValid());
|
||||
if (pm.callMethod<jboolean>("hasSystemFeature","(Ljava/lang/String;)Z",
|
||||
QJNIObjectPrivate::getStaticObjectField("android/content/pm/PackageManager", "FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND", "Ljava/lang/String;").object())) {
|
||||
m_touchDevice->setMaximumTouchPoints(10);
|
||||
} else if (pm.callMethod<jboolean>("hasSystemFeature","(Ljava/lang/String;)Z",
|
||||
QJNIObjectPrivate::getStaticObjectField("android/content/pm/PackageManager", "FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT", "Ljava/lang/String;").object())) {
|
||||
m_touchDevice->setMaximumTouchPoints(4);
|
||||
} else if (pm.callMethod<jboolean>("hasSystemFeature","(Ljava/lang/String;)Z",
|
||||
QJNIObjectPrivate::getStaticObjectField("android/content/pm/PackageManager", "FEATURE_TOUCHSCREEN_MULTITOUCH", "Ljava/lang/String;").object())) {
|
||||
m_touchDevice->setMaximumTouchPoints(2);
|
||||
}
|
||||
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool QAndroidPlatformIntegration::needsWorkaround()
|
||||
bool QAndroidPlatformIntegration::needsBasicRenderloopWorkaround()
|
||||
{
|
||||
static bool needsWorkaround =
|
||||
QtAndroid::deviceName().compare(QStringLiteral("samsung SM-T211"), Qt::CaseInsensitive) == 0
|
||||
@ -150,7 +183,7 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const
|
||||
case OpenGL: return true;
|
||||
case ForeignWindows: return true;
|
||||
case ThreadedOpenGL:
|
||||
if (needsWorkaround())
|
||||
if (needsBasicRenderloopWorkaround())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|