Merge remote-tracking branch 'base/master' into refactor

Conflicts:
	src/gui/embedded/qmousepc_qws.cpp
	src/gui/embedded/qwslock.cpp
	src/plugins/decorations/default/default.pro
	src/plugins/decorations/styled/styled.pro
	src/plugins/decorations/windows/windows.pro
	src/plugins/gfxdrivers/ahi/ahi.pro
	src/plugins/gfxdrivers/directfb/directfb.pro
	src/plugins/gfxdrivers/eglnullws/eglnullws.pro
	src/plugins/gfxdrivers/linuxfb/linuxfb.pro
	src/plugins/gfxdrivers/qvfb/qvfb.pro
	src/plugins/gfxdrivers/transformed/transformed.pro
	src/plugins/gfxdrivers/vnc/vnc.pro
	src/plugins/graphicssystems/meego/meego.pro
	src/plugins/graphicssystems/opengl/opengl.pro
	src/plugins/graphicssystems/openvg/openvg.pro
	src/plugins/graphicssystems/shivavg/shivavg.pro
	src/plugins/graphicssystems/trace/trace.pro
	src/plugins/kbddrivers/linuxinput/linuxinput.pro
	src/plugins/mousedrivers/linuxtp/linuxtp.pro
	src/plugins/mousedrivers/pc/pc.pro
	src/plugins/mousedrivers/tslib/tslib.pro
	src/plugins/platforms/minimal/minimal.pro
	tests/auto/qerrormessage/qerrormessage.pro
This commit is contained in:
Jørgen Lind 2011-06-01 15:34:58 +02:00
commit 00ef07fe96
144 changed files with 1904 additions and 540 deletions

43
configure vendored
View File

@ -8471,22 +8471,6 @@ fi
#-------------------------------------------------------------------------------
QTMODULE="$outpath/mkspecs/qmodule.pri"
cat >>"$QTMODULE.tmp" <<EOF
#paths
QT_SOURCE_TREE = \$\$quote($relpath)
QT_BUILD_TREE = \$\$quote($outpath)
QT_BUILD_PARTS = $CFG_BUILD_PARTS
#local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
QMAKE_MOC = \$\$QT_BUILD_TREE/bin/moc
QMAKE_UIC = \$\$QT_BUILD_TREE/bin/uic
QMAKE_RCC = \$\$QT_BUILD_TREE/bin/rcc
QMAKE_QDBUSXML2CPP = \$\$QT_BUILD_TREE/bin/qdbusxml2cpp
QMAKE_INCDIR_QT = \$\$QT_BUILD_TREE/include
QMAKE_LIBDIR_QT = \$\$QT_BUILD_TREE/lib
EOF
# Ensure we can link to uninistalled libraries
if [ "$XPLATFORM_MINGW" != "yes" ] && [ "$CFG_EMBEDDED" != "nacl" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
echo "QMAKE_LFLAGS = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$QTMODULE.tmp"
@ -8537,13 +8521,6 @@ if [ "$CFG_MAC_XARCH" = "no" ]; then
echo "QMAKE_MAC_XARCH = no" >> "$QTMODULE.tmp"
fi
#dump the qmake spec
if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$QTMODULE.tmp"
else
echo "QMAKESPEC = $XPLATFORM" >> "$QTMODULE.tmp"
fi
# cmdline args
cat "$QMAKE_VARS_FILE" >> "$QTMODULE.tmp"
rm -f "$QMAKE_VARS_FILE" 2>/dev/null
@ -8562,6 +8539,19 @@ fi
CACHEFILE="$outpath/.qmake.cache"
[ -f "$CACHEFILE.tmp" ] && rm -f "$CACHEFILE.tmp"
cat >>"$CACHEFILE.tmp" <<EOF
#paths
QT_SOURCE_TREE = \$\$quote($relpath)
QT_BUILD_TREE = \$\$quote($outpath)
QT_BUILD_PARTS = $CFG_BUILD_PARTS
#local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
QMAKE_MOC = \$\$QT_BUILD_TREE/bin/moc
QMAKE_UIC = \$\$QT_BUILD_TREE/bin/uic
QMAKE_RCC = \$\$QT_BUILD_TREE/bin/rcc
QMAKE_QDBUSXML2CPP = \$\$QT_BUILD_TREE/bin/qdbusxml2cpp
QMAKE_INCDIR_QT = \$\$QT_BUILD_TREE/include
QMAKE_LIBDIR_QT = \$\$QT_BUILD_TREE/lib
include(\$\$PWD/mkspecs/qmodule.pri)
CONFIG += $QMAKE_CONFIG dylib create_prl link_prl depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
QMAKE_ABSOLUTE_SOURCE_ROOT = \$\$QT_SOURCE_TREE
@ -8569,6 +8559,13 @@ QMAKE_MOC_SRC = \$\$QT_BUILD_TREE/src/moc
EOF
#dump the qmake spec
if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
else
echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
fi
# incrementals
INCREMENTAL=""
[ "$CFG_INCREMENTAL" = "auto" ] && "$WHICH" p4 >/dev/null 2>&1 && [ "$CFG_DEV" = "yes" ] && CFG_INCREMENTAL="yes"

22
dist/changes-4.8.0 vendored
View File

@ -39,12 +39,29 @@ QtCore
- Removed support for QT_NO_THREAD define for QHostInfo.
- Optimized plugin loading on ELF platforms.
Print failure reason at runtime with QT_DEBUG_PLUGINS=1 in environment.
- QMutexLocker: improved performence of the non contended case by inlining some function
- QThreadStorage: Added possibility to store object by value instead of by pointer [QTBUG-15033]
- QThread: fixed few race conditions [QTBUG-17257, QTBUG-15030]
- QtConcurrent: added support for c++0x lambda in few functions
- QObject: Improved performence of the signal activation
- QObject: added ways to connect signals using QMetaMethod
- QObject: deprecated qFindChild and qFindChildren
- QObject: optimize constructions and destruction of objects
- QObject: Qt::BlockingQueuedConnection can handle the return value [QTBUG-10440]
- QList/QVector/QStringList: added C++0x initilizer lists constructors.
- QVarLenghtArray: added method for consistency with QVector
- QStringBuilder: added support for QByteArray
- qSwap now uses std::swap, specialized std::swap for our container to work better with stl algoritms
- QVariant: deprecated global function qVariantSetValue, qVariantValue, qVariantCanConvert, qVariantFromValue
QtGui
-----
- QTabBar: reduced minimumSizeHint if ElideMode is set.
- QComboBox: Fixed a color propagation issue with the lineedit. [QTBUG-5950]
- Deprecate qGenericMatrixFromMatrix4x4 and qGenericMatrixToMatrix4x4
- QListView diverses optimisations [QTBUG-11438]
- QTreeWidget/QListWidget: use localeAwareCompare for string comparisons [QTBUG-10839]
QtOpenGL
--------
@ -54,6 +71,10 @@ QtGui
- Including <QtOpenGL> will not work in combination with GLEW, as
QGLFunctions will undefine GLEW's defines.
QtScript
--------
- Deprecated qScriptValueFromQMetaObject, qScriptValueToValue, qScriptValueFromValue
****************************************************************************
* Database Drivers *
@ -136,6 +157,7 @@ Qt for Windows CE
- qtconfig
* removed Qt3support dependency
- qt3to4

View File

@ -21,6 +21,8 @@ GeometryEngine::~GeometryEngine()
void GeometryEngine::init()
{
initializeGLFunctions();
//! [0]
// Generate 2 VBOs
glGenBuffers(2, vboIds);

View File

@ -78,6 +78,8 @@ void MainWidget::timerEvent(QTimerEvent *e)
void MainWidget::initializeGL()
{
initializeGLFunctions();
qglClearColor(Qt::black);
qDebug() << "Initializing shaders...";

View File

@ -2,6 +2,7 @@
#define MAINWIDGET_H
#include <QtOpenGL/QGLWidget>
#include <QtOpenGL/QGLFunctions>
#include <QMatrix4x4>
#include <QQuaternion>
@ -12,7 +13,7 @@ class QGLShaderProgram;
class GeometryEngine;
class MainWidget : public QGLWidget
class MainWidget : public QGLWidget, protected QGLFunctions
{
Q_OBJECT
public:

View File

@ -1,5 +1,5 @@
SOURCES = testqstring.cpp
CONFIG += qtestlib
QT += testlib
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtestlib/tutorial1

View File

@ -1,5 +1,5 @@
SOURCES = testqstring.cpp
CONFIG += qtestlib
QT += testlib
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtestlib/tutorial2

View File

@ -1,5 +1,5 @@
SOURCES = testgui.cpp
CONFIG += qtestlib
QT += testlib
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtestlib/tutorial3

View File

@ -1,5 +1,5 @@
SOURCES = testgui.cpp
CONFIG += qtestlib
QT += testlib
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtestlib/tutorial4

View File

@ -1,5 +1,5 @@
SOURCES = benchmarking.cpp
CONFIG += qtestlib
QT += testlib
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtestlib/tutorial5

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" width="44" height="44" baseProfile="tiny" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 44 44">
<defs>
<linearGradient id="linearGradient2824" y2="1051.4" gradientUnits="userSpaceOnUse" x2="30.217" y1="1009.4" x1="15.109">
<stop stop-color="#41a200" offset="0"/>
<stop stop-color="#9be948" offset="0.63897"/>
<stop stop-color="#beff61" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient2848" y2="1009.4" gradientUnits="userSpaceOnUse" y1="1053.7" gradientTransform="matrix(0.85714286,0,0,0.85714286,2.1428572,146.19467)" x2="15.085" x1="31.027">
<stop stop-color="#41a200" offset="0"/>
<stop stop-color="#9be948" offset="0.88602"/>
<stop stop-color="#beff61" offset="1"/>
</linearGradient>
</defs>
<g id="layer1" transform="translate(0,-1008.3622)">
<path id="rect2816" d="m8.412,1009h27.18c4.106,0,7.412,3.306,7.412,7.412v27.18c0,4.106-3.306,7.412-7.412,7.412h-27.18c-4.106,0-7.412-3-7.412-7v-27.18c0-4.106,3.306-7.412,7.412-7.412z" stroke-linecap="round" stroke-miterlimit="4" stroke-width="0.64300001" fill="url(#linearGradient2824)"/>
<path id="rect2816-4" d="m9.353,1011h25.29c3.52,0,6.353,2.833,6.353,6.353v25.29c0,3.519-2.833,6.353-6.353,6.353h-25.29c-3.52-0.1-6.353-2.1-6.353-6.1v-25.29c0-3.519,2.833-6.353,6.353-6.353z" stroke-linecap="round" stroke-miterlimit="4" stroke-width="0.64300001" fill="url(#linearGradient2848)"/>
<g id="text2893" font-weight="normal" transform="translate(-1.100281,1010.3622)" font-style="normal" font-stretch="normal" font-size="48px" font-variant="normal" font-family="Cambria Math" fill="#e5ffd5">
<path id="path2908" fill="#e5ffd5" d="m11.92,35.44c1.359-1.719,2.672-3.828,3.938-6.328l7.522-14.742c-0.8-3.13-1.54-5.321-2.24-6.586-0.69-1.266-1.76-1.899-3.2-1.899-1.328,0.0000307-2.594,0.6563-3.797,1.969l-1.148-1.266c2.156-2.359,4.289-3.539,6.398-3.539,1.469,0.0000335,2.609,0.418,3.422,1.254,0.8125,0.836,1.492,2.168,2.039,3.996,0.5469,1.828,1.32,5.359,2.32,10.59,1.297,6.828,2.309,11.14,3.035,12.93,0.7265,1.789,1.59,2.684,2.59,2.684,0.7187,0.000002,1.383-0.25,1.992-0.75l0.8906,1.406c-1.547,1.203-2.938,1.805-4.172,1.805-1.75,0-3-0.8984-3.75-2.695-0.75-1.797-1.797-6.633-3.141-14.51h-0.1406c-2.658,5.391-5.258,11.001-7.798,16.831h-4.758z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -0,0 +1,14 @@
#include <QtGui/QApplication>
#include <QtGui/QLabel>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QLabel label(QObject::tr("Hello, world!"));
#if defined(Q_WS_S60)
label.showMaximized();
#else
label.show();
#endif
return a.exec();
}

View File

@ -0,0 +1,71 @@
#include "elidedlabel.h"
#include <QPainter>
#include <QTextLayout>
#include <QDebug>
//! [0]
ElidedLabel::ElidedLabel(const QString &text, QWidget *parent)
: QFrame(parent)
, elided(false)
, content(text)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
}
//! [0]
//! [1]
void ElidedLabel::setText(const QString &newText)
{
content = newText;
update();
}
//! [1]
//! [2]
void ElidedLabel::paintEvent(QPaintEvent *event)
{
QFrame::paintEvent(event);
QPainter painter(this);
QFontMetrics fontMetrics = painter.fontMetrics();
bool didElide = false;
int lineSpacing = fontMetrics.lineSpacing();
int y = 0;
QTextLayout textLayout(content, painter.font());
textLayout.beginLayout();
forever {
QTextLine line = textLayout.createLine();
if (!line.isValid())
break;
line.setLineWidth(width());
int nextLineY = y + lineSpacing;
if (height() >= nextLineY + lineSpacing) {
line.draw(&painter, QPoint(0, y));
y = nextLineY;
//! [2]
//! [3]
} else {
QString lastLine = content.mid(line.textStart());
QString elidedLastLine = fontMetrics.elidedText(lastLine, Qt::ElideRight, width());
painter.drawText(QPoint(0, y + fontMetrics.ascent()), elidedLastLine);
line = textLayout.createLine();
didElide = line.isValid();
break;
}
}
textLayout.endLayout();
//! [3]
//! [4]
if (didElide != elided) {
elided = didElide;
emit elisionChanged(didElide);
}
}
//! [4]

View File

@ -0,0 +1,36 @@
#ifndef ELIDEDLABEL_H
#define ELIDEDLABEL_H
#include <QFrame>
#include <QRect>
#include <QResizeEvent>
#include <QString>
#include <QWidget>
//! [0]
class ElidedLabel : public QFrame
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText)
Q_PROPERTY(bool isElided READ isElided)
public:
ElidedLabel(const QString &text, QWidget *parent = 0);
void setText(const QString &text);
const QString & text() const { return content; }
bool isElided() const { return elided; }
protected:
void paintEvent(QPaintEvent *event);
signals:
void elisionChanged(bool elided);
private:
bool elided;
QString content;
};
//! [0]
#endif // TEXTWRAPPINGWIDGET_H

View File

@ -0,0 +1,13 @@
#include "testwidget.h"
#include <QtGui/QApplication>
//! [0]
int main( int argc, char *argv[] )
{
QApplication application( argc, argv );
TestWidget w;
w.showFullScreen();
return application.exec();
}
//! [0]

View File

@ -0,0 +1,124 @@
#include "testwidget.h"
#include "elidedlabel.h"
#include <QLabel>
#include <QPushButton>
#include <QSizePolicy>
#include <QGridLayout>
//! [0]
TestWidget::TestWidget(QWidget *parent):
QWidget(parent)
{
const QString romeo = tr(
"But soft, what light through yonder window breaks? / "
"It is the east, and Juliet is the sun. / "
"Arise, fair sun, and kill the envious moon, / "
"Who is already sick and pale with grief / "
"That thou, her maid, art far more fair than she."
);
const QString macbeth = tr(
"To-morrow, and to-morrow, and to-morrow, / "
"Creeps in this petty pace from day to day, / "
"To the last syllable of recorded time; / "
"And all our yesterdays have lighted fools / "
"The way to dusty death. Out, out, brief candle! / "
"Life's but a walking shadow, a poor player, / "
"That struts and frets his hour upon the stage, / "
"And then is heard no more. It is a tale / "
"Told by an idiot, full of sound and fury, / "
"Signifying nothing."
);
const QString harry = tr("Feeling lucky, punk?");
textSamples << romeo << macbeth << harry;
//! [0]
//! [1]
sampleIndex = 0;
elidedText = new ElidedLabel(textSamples[sampleIndex], this);
elidedText->setFrameStyle(QFrame::Box);
//! [1]
//! [2]
QPushButton *switchButton = new QPushButton(tr("Switch text"));
connect(switchButton, SIGNAL(clicked(bool)), this, SLOT(switchText()));
QPushButton *exitButton = new QPushButton(tr("Exit"));
connect(exitButton, SIGNAL(clicked(bool)), this, SLOT(close()));
QLabel *label = new QLabel(tr("Elided"));
label->setVisible(elidedText->isElided());
connect(elidedText, SIGNAL(elisionChanged(bool)), label, SLOT(setVisible(bool)));
//! [2]
//! [3]
widthSlider = new QSlider(Qt::Horizontal);
widthSlider->setMinimum(0);
connect(widthSlider, SIGNAL(valueChanged(int)), this, SLOT(onWidthChanged(int)));
heightSlider = new QSlider(Qt::Vertical);
heightSlider->setInvertedAppearance(true);
heightSlider->setMinimum(0);
connect(heightSlider, SIGNAL(valueChanged(int)), this, SLOT(onHeightChanged(int)));
//! [3]
//! [4]
QGridLayout *layout = new QGridLayout();
layout->addWidget(label, 0, 1, Qt::AlignCenter);
layout->addWidget(switchButton, 0, 2);
layout->addWidget(exitButton, 0, 3);
layout->addWidget(widthSlider, 1, 1, 1, 3);
layout->addWidget(heightSlider, 2, 0);
layout->addWidget(elidedText, 2, 1, 1, 3, Qt::AlignTop | Qt::AlignLeft);
setLayout(layout);
//! [4]
//! [5]
#ifdef Q_WS_MAEMO_5
setAttribute(Qt::WA_Maemo5AutoOrientation, true);
#endif
}
//! [5]
//! [6]
void TestWidget::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(event)
int maxWidth = widthSlider->width();
widthSlider->setMaximum(maxWidth);
widthSlider->setValue(maxWidth / 2);
int maxHeight = heightSlider->height();
heightSlider->setMaximum(maxHeight);
heightSlider->setValue(maxHeight / 2);
elidedText->setFixedSize(widthSlider->value(), heightSlider->value());
}
//! [6]
//! [7]
void TestWidget::switchText()
{
sampleIndex = (sampleIndex + 1) % textSamples.size();
elidedText->setText(textSamples.at(sampleIndex));
}
//! [7]
//! [8]
void TestWidget::onWidthChanged(int width)
{
elidedText->setFixedWidth(width);
}
void TestWidget::onHeightChanged(int height)
{
elidedText->setFixedHeight(height);
}
//! [8]

View File

@ -0,0 +1,36 @@
#ifndef TESTWIDGET_H
#define TESTWIDGET_H
#include <QWidget>
#include <QStringList>
#include <QSlider>
#include <QComboBox>
class ElidedLabel;
//! [0]
class TestWidget : public QWidget
{
Q_OBJECT
public:
TestWidget(QWidget *parent = 0);
protected:
void resizeEvent(QResizeEvent *event);
private slots:
void switchText();
void onWidthChanged(int width);
void onHeightChanged(int height);
private:
int sampleIndex;
QStringList textSamples;
ElidedLabel *elidedText;
QSlider *heightSlider;
QSlider *widthSlider;
};
//! [0]
#endif // TESTWIDGET_H

View File

@ -26,7 +26,11 @@ exists($$_PRO_FILE_PWD_/sync.profile) {
message("Running syncqt for $$PRO_BASENAME in $$OUT_PWD")
qtPrepareTool(QMAKE_SYNCQT, syncqt)
system("$$QMAKE_SYNCQT $$QTFWD -outdir $$OUT_PWD $$_PRO_FILE_PWD_")
system("$$QMAKE_SYNCQT $$QTFWD -outdir $$OUT_PWD $$_PRO_FILE_PWD_") {
# success! Nothing to do
} else {
error("Failed to run: $$QMAKE_SYNCQT $$QTFWD -outdir $$OUT_PWD $$_PRO_FILE_PWD_")
}
unset(QTFWD)
unset(PRO_BASENAME)
}

View File

@ -1,7 +1,6 @@
QT += xml
contains(QT_CONFIG, script): QT += script
QT += xml uilib
!isEmpty(QT.script.name): QT += script
!isEmpty(QT.designer.name): QT += designer
qt:load(qt)
plugin:DEFINES += QDESIGNER_EXPORT_WIDGETS
qtAddLibrary(QtDesigner, true)

View File

@ -1,20 +1,6 @@
CONFIG += testcase
!symbian {
INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtQuickTest
} else {
load(data_caging_paths)
INCLUDEPATH+=$$MW_LAYER_PUBLIC_EXPORT_PATH(QtQuickTest)
}
QT += declarative
win32:CONFIG(debug, debug|release) {
LIBS += -lQtQuickTest$${QT_LIBINFIX}d
} else {
LIBS += -lQtQuickTest$${QT_LIBINFIX}
}
QT += declarative qmltest
# If the .pro file specified an IMPORTPATH, then add that to
# the command-line when the test is run.

View File

@ -160,7 +160,7 @@ for(QTLIB, $$list($$lower($$unique(QT)))) {
# add include paths for all .depends, since module/application might need f.ex. template specializations etc.
QT_DEPENDS -= $$QT
for(QTLIB, $$list($$lower($$unique(QT_DEPENDS)))):INCLUDEPATH += $$INCLUDEPATH $$eval(QT.$${QTLIB}.includes)
for(QTLIB, $$list($$lower($$unique(QT_DEPENDS)))):INCLUDEPATH *= $$INCLUDEPATH $$eval(QT.$${QTLIB}.includes)
!isEmpty(using_privates):!no_private_qt_headers_warning:if(!debug_and_release|!build_pass) {
message("This project is using private headers and will therefore be tied to this specific Qt module build version.")

View File

@ -0,0 +1,41 @@
TEMPLATE = lib
isEmpty(QT_MAJOR_VERSION) {
VERSION=5.0.0
} else {
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
}
CONFIG += qt plugin
win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
TARGET = $$qtLibraryTarget($$TARGET)
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
load(qt_targets)
wince*:LIBS += $$QMAKE_LIBS_GUI
symbian: {
TARGET.EPOCALLOWDLLDATA=1
TARGET.CAPABILITY = All -Tcb
TARGET = $${TARGET}$${QT_LIBINFIX}
load(armcc_warnings)
# Make partial upgrade SIS file for Qt plugin dll's
# Partial upgrade SIS file
vendorinfo = \
"; Localised Vendor name" \
"%{\"Nokia\"}" \
" " \
"; Unique Vendor name" \
":\"Nokia, Qt\"" \
" "
isEmpty(QT_LIBINFIX): PARTIAL_UPGRADE_UID = 0x2001E61C
else: PARTIAL_UPGRADE_UID = 0xE001E61C
pu_header = "; Partial upgrade package for testing $${TARGET} changes without reinstalling everything" \
"$${LITERAL_HASH}{\"$${TARGET}\"}, ($$PARTIAL_UPGRADE_UID), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU"
partial_upgrade.pkg_prerules = pu_header vendorinfo
partial_upgrade.files = $$QMAKE_LIBDIR_QT/$${TARGET}.dll
partial_upgrade.path = c:/sys/bin
DEPLOYMENT += partial_upgrade
}

View File

@ -10,26 +10,34 @@ cross_compile: CONFIG += nostrip
module_qtbase_tests.subdir = tests
module_qtbase_tests.target = module-qtbase-tests
module_qtbase_tests.depends = module_qtbase_src
module_qtbase_tests.CONFIG = no_default_target no_default_install
module_qtbase_tests.CONFIG = no_default_install
#process the projects
for(PROJECT, $$list($$lower($$unique(QT_BUILD_PARTS)))) {
isEqual(PROJECT, examples) {
SUBDIRS += examples
} else:isEqual(PROJECT, demos) {
SUBDIRS += demos
} else:isEqual(PROJECT, tests) {
module_qtbase_tests.CONFIG -= no_default_target
} else:isEqual(PROJECT, libs) {
include(src/src.pro)
} else:isEqual(PROJECT, qmake) {
# SUBDIRS += qmake
} else {
message(Unknown PROJECT: $$PROJECT)
}
PROJECTS=$$eval($$list($$lower($$unique(QT_BUILD_PARTS))))
# note that the order matters for these blocks!
contains(PROJECTS, qmake) {
PROJECTS -= qmake
# nothing to be done
}
contains(PROJECTS, libs) {
PROJECTS -= libs
include(src/src.pro)
}
contains(PROJECTS, examples) {
PROJECTS -= examples
SUBDIRS += examples
}
contains(PROJECTS, demos) {
PROJECTS -= demos
SUBDIRS += demos
}
contains(PROJECTS, tests) {
PROJECTS -= tests
SUBDIRS += module_qtbase_tests
}
!isEmpty(PROJECTS) {
message(Unknown PROJECTS: $$PROJECTS)
}
SUBDIRS += module_qtbase_tests
!symbian: confclean.depends += clean
confclean.commands =

View File

@ -57,6 +57,20 @@ QT_MODULE(Core)
# define QT_TYPENAME typename
#endif
namespace QtPrivate {
template<class T>
class HasResultType {
typedef char Yes;
typedef void *No;
template<typename U> static Yes test(int, const typename U::result_type * = 0);
template<typename U> static No test(double);
public:
enum { Value = (sizeof(test<T>(0)) == sizeof(Yes)) };
};
}
QT_END_NAMESPACE
QT_END_HEADER

View File

@ -195,17 +195,10 @@ QtConcurrent::ConstMemberFunctionWrapper<T, C> createFunctionWrapper(T (C::*func
return QtConcurrent::ConstMemberFunctionWrapper<T, C>(func);
}
template<typename T>
void *lazyResultType_helper(int, typename T::result_type * = 0);
template<typename T>
char lazyResultType_helper(double);
template <typename Functor, bool foo = sizeof(lazyResultType_helper<Functor>(0)) != sizeof(void*)>
template <typename Functor, bool foo = HasResultType<Functor>::Value>
struct LazyResultType { typedef typename Functor::result_type Type; };
template <typename Functor>
struct LazyResultType<Functor, true> { typedef void Type; };
struct LazyResultType<Functor, false> { typedef void Type; };
template <class T>
struct ReduceResultType;

View File

@ -71,63 +71,114 @@ namespace QtConcurrent {
template <typename T>
QFuture<T> run(T (*functionPointer)())
{
return (new QT_TYPENAME SelectStoredFunctorCall0<T, T (*)()>::type(functionPointer))->start();
return (new StoredFunctorCall0<T, T (*)()>(functionPointer))->start();
}
template <typename T, typename Param1, typename Arg1>
QFuture<T> run(T (*functionPointer)(Param1), const Arg1 &arg1)
{
return (new QT_TYPENAME SelectStoredFunctorCall1<T, T (*)(Param1), Arg1>::type(functionPointer, arg1))->start();
return (new StoredFunctorCall1<T, T (*)(Param1), Arg1>(functionPointer, arg1))->start();
}
template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2>
QFuture<T> run(T (*functionPointer)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2)
{
return (new QT_TYPENAME SelectStoredFunctorCall2<T, T (*)(Param1, Param2), Arg1, Arg2>::type(functionPointer, arg1, arg2))->start();
return (new StoredFunctorCall2<T, T (*)(Param1, Param2), Arg1, Arg2>(functionPointer, arg1, arg2))->start();
}
template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3>
QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
{
return (new QT_TYPENAME SelectStoredFunctorCall3<T, T (*)(Param1, Param2, Param3), Arg1, Arg2, Arg3>::type(functionPointer, arg1, arg2, arg3))->start();
return (new StoredFunctorCall3<T, T (*)(Param1, Param2, Param3), Arg1, Arg2, Arg3>(functionPointer, arg1, arg2, arg3))->start();
}
template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4>
QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
{
return (new QT_TYPENAME SelectStoredFunctorCall4<T, T (*)(Param1, Param2, Param3, Param4), Arg1, Arg2, Arg3, Arg4>::type(functionPointer, arg1, arg2, arg3, arg4))->start();
return (new StoredFunctorCall4<T, T (*)(Param1, Param2, Param3, Param4), Arg1, Arg2, Arg3, Arg4>(functionPointer, arg1, arg2, arg3, arg4))->start();
}
template <typename T, typename Param1, typename Arg1, typename Param2, typename Arg2, typename Param3, typename Arg3, typename Param4, typename Arg4, typename Param5, typename Arg5>
QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3, Param4, Param5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
{
return (new QT_TYPENAME SelectStoredFunctorCall5<T, T (*)(Param1, Param2, Param3, Param4, Param5), Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionPointer, arg1, arg2, arg3, arg4, arg5))->start();
return (new StoredFunctorCall5<T, T (*)(Param1, Param2, Param3, Param4, Param5), Arg1, Arg2, Arg3, Arg4, Arg5>(functionPointer, arg1, arg2, arg3, arg4, arg5))->start();
}
#ifdef Q_COMPILER_DECLTYPE
template <typename Functor>
auto run(Functor functor) -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor())> >::Type
{
typedef decltype(functor()) result_type;
return (new StoredFunctorCall0<result_type, Functor>(functor))->start();
}
template <typename Functor, typename Arg1>
auto run(Functor functor, const Arg1 &arg1)
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1))> >::Type
{
typedef decltype(functor(arg1)) result_type;
return (new StoredFunctorCall1<result_type, Functor, Arg1>(functor, arg1))->start();
}
template <typename Functor, typename Arg1, typename Arg2>
auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2)
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2))> >::Type
{
typedef decltype(functor(arg1, arg2)) result_type;
return (new StoredFunctorCall2<result_type, Functor, Arg1, Arg2>(functor, arg1, arg2))->start();
}
template <typename Functor, typename Arg1, typename Arg2, typename Arg3>
auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3))> >::Type
{
typedef decltype(functor(arg1, arg2, arg3)) result_type;
return (new StoredFunctorCall3<result_type, Functor, Arg1, Arg2, Arg3>(functor, arg1, arg2, arg3))->start();
}
template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4))> >::Type
{
typedef decltype(functor(arg1, arg2, arg3, arg4)) result_type;
return (new StoredFunctorCall4<result_type, Functor, Arg1, Arg2, Arg3, Arg4>(functor, arg1, arg2, arg3, arg4))->start();
}
template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4, arg5))> >::Type
{
typedef decltype(functor(arg1, arg2, arg3, arg4, arg5)) result_type;
return (new StoredFunctorCall5<result_type, Functor, Arg1, Arg2, Arg3, Arg4, Arg5>(functor, arg1, arg2, arg3, arg4, arg5))->start();
}
#endif
template <typename FunctionObject>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject)
{
return (new QT_TYPENAME SelectStoredFunctorCall0<QT_TYPENAME FunctionObject::result_type, FunctionObject>::type(functionObject))->start();
return (new StoredFunctorCall0<QT_TYPENAME FunctionObject::result_type, FunctionObject>(functionObject))->start();
}
template <typename FunctionObject, typename Arg1>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1)
{
return (new QT_TYPENAME SelectStoredFunctorCall1<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1>::type(functionObject, arg1))->start();
return (new StoredFunctorCall1<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1>(functionObject, arg1))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2)
{
return (new QT_TYPENAME SelectStoredFunctorCall2<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2>::type(functionObject, arg1, arg2))->start();
return (new StoredFunctorCall2<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2>(functionObject, arg1, arg2))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
{
return (new QT_TYPENAME SelectStoredFunctorCall3<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>::type(functionObject, arg1, arg2, arg3))->start();
return (new StoredFunctorCall3<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>(functionObject, arg1, arg2, arg3))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
{
return (new QT_TYPENAME SelectStoredFunctorCall4<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>::type(functionObject, arg1, arg2, arg3, arg4))->start();
return (new StoredFunctorCall4<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>(functionObject, arg1, arg2, arg3, arg4))->start();
}
template <typename FunctionObject, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
QFuture<typename FunctionObject::result_type> run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
{
return (new QT_TYPENAME SelectStoredFunctorCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionObject, arg1, arg2, arg3, arg4, arg5))->start();
return (new StoredFunctorCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>(functionObject, arg1, arg2, arg3, arg4, arg5))->start();
}
template <typename FunctionObject>

View File

@ -66,23 +66,16 @@ struct StoredFunctorCall0: public RunFunctionTask<T>
};
template <typename T, typename FunctionPointer>
struct VoidStoredFunctorCall0: public RunFunctionTask<T>
template <typename FunctionPointer>
struct StoredFunctorCall0<void, FunctionPointer>: public RunFunctionTask<void>
{
inline VoidStoredFunctorCall0(FunctionPointer _function)
inline StoredFunctorCall0(FunctionPointer _function)
: function(_function) {}
void runFunctor() { function(); }
FunctionPointer function;
};
template <typename T, typename FunctionPointer>
struct SelectStoredFunctorCall0
{
typedef typename SelectSpecialization<T>::template
Type<StoredFunctorCall0 <T, FunctionPointer>,
VoidStoredFunctorCall0<T, FunctionPointer> >::type type;
};
template <typename T, typename FunctionPointer>
struct StoredFunctorPointerCall0: public RunFunctionTask<T>
{
@ -276,23 +269,16 @@ struct StoredFunctorCall1: public RunFunctionTask<T>
Arg1 arg1;
};
template <typename T, typename FunctionPointer, typename Arg1>
struct VoidStoredFunctorCall1: public RunFunctionTask<T>
template <typename FunctionPointer, typename Arg1>
struct StoredFunctorCall1<void, FunctionPointer, Arg1>: public RunFunctionTask<void>
{
inline VoidStoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1)
inline StoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1)
: function(_function), arg1(_arg1) {}
void runFunctor() { function(arg1); }
FunctionPointer function;
Arg1 arg1;
};
template <typename T, typename FunctionPointer, typename Arg1>
struct SelectStoredFunctorCall1
{
typedef typename SelectSpecialization<T>::template
Type<StoredFunctorCall1 <T, FunctionPointer, Arg1>,
VoidStoredFunctorCall1<T, FunctionPointer, Arg1> >::type type;
};
template <typename T, typename FunctionPointer, typename Arg1>
struct StoredFunctorPointerCall1: public RunFunctionTask<T>
{
@ -486,23 +472,16 @@ struct StoredFunctorCall2: public RunFunctionTask<T>
Arg1 arg1; Arg2 arg2;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2>
struct VoidStoredFunctorCall2: public RunFunctionTask<T>
template <typename FunctionPointer, typename Arg1, typename Arg2>
struct StoredFunctorCall2<void, FunctionPointer, Arg1, Arg2>: public RunFunctionTask<void>
{
inline VoidStoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2)
inline StoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2)
: function(_function), arg1(_arg1), arg2(_arg2) {}
void runFunctor() { function(arg1, arg2); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2>
struct SelectStoredFunctorCall2
{
typedef typename SelectSpecialization<T>::template
Type<StoredFunctorCall2 <T, FunctionPointer, Arg1, Arg2>,
VoidStoredFunctorCall2<T, FunctionPointer, Arg1, Arg2> >::type type;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2>
struct StoredFunctorPointerCall2: public RunFunctionTask<T>
{
@ -696,23 +675,16 @@ struct StoredFunctorCall3: public RunFunctionTask<T>
Arg1 arg1; Arg2 arg2; Arg3 arg3;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3>
struct VoidStoredFunctorCall3: public RunFunctionTask<T>
template <typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3>
struct StoredFunctorCall3<void, FunctionPointer, Arg1, Arg2, Arg3>: public RunFunctionTask<void>
{
inline VoidStoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
inline StoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {}
void runFunctor() { function(arg1, arg2, arg3); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2; Arg3 arg3;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3>
struct SelectStoredFunctorCall3
{
typedef typename SelectSpecialization<T>::template
Type<StoredFunctorCall3 <T, FunctionPointer, Arg1, Arg2, Arg3>,
VoidStoredFunctorCall3<T, FunctionPointer, Arg1, Arg2, Arg3> >::type type;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3>
struct StoredFunctorPointerCall3: public RunFunctionTask<T>
{
@ -906,23 +878,16 @@ struct StoredFunctorCall4: public RunFunctionTask<T>
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
struct VoidStoredFunctorCall4: public RunFunctionTask<T>
template <typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
struct StoredFunctorCall4<void, FunctionPointer, Arg1, Arg2, Arg3, Arg4>: public RunFunctionTask<void>
{
inline VoidStoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
inline StoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {}
void runFunctor() { function(arg1, arg2, arg3, arg4); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
struct SelectStoredFunctorCall4
{
typedef typename SelectSpecialization<T>::template
Type<StoredFunctorCall4 <T, FunctionPointer, Arg1, Arg2, Arg3, Arg4>,
VoidStoredFunctorCall4<T, FunctionPointer, Arg1, Arg2, Arg3, Arg4> >::type type;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
struct StoredFunctorPointerCall4: public RunFunctionTask<T>
{
@ -1116,23 +1081,16 @@ struct StoredFunctorCall5: public RunFunctionTask<T>
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
struct VoidStoredFunctorCall5: public RunFunctionTask<T>
template <typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
struct StoredFunctorCall5<void, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5>: public RunFunctionTask<void>
{
inline VoidStoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
inline StoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {}
void runFunctor() { function(arg1, arg2, arg3, arg4, arg5); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
struct SelectStoredFunctorCall5
{
typedef typename SelectSpecialization<T>::template
Type<StoredFunctorCall5 <T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5>,
VoidStoredFunctorCall5<T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5> >::type type;
};
template <typename T, typename FunctionPointer, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
struct StoredFunctorPointerCall5: public RunFunctionTask<T>
{
@ -1316,6 +1274,33 @@ struct SelectStoredConstMemberFunctionPointerCall5
Type<StoredConstMemberFunctionPointerCall5 <T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>,
VoidStoredConstMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5> >::type type;
};
template <typename T, typename Functor>
class StoredFunctorCall : public RunFunctionTask<T>
{
public:
StoredFunctorCall(const Functor &f) : functor(f) { }
void runFunctor()
{
this->result = functor();
}
private:
Functor functor;
};
template <typename Functor>
class StoredFunctorCall<void, Functor> : public RunFunctionTask<void>
{
public:
StoredFunctorCall(const Functor &f) : functor(f) { }
void runFunctor()
{
functor();
}
private:
Functor functor;
};
} //namespace QtConcurrent
#endif // qdoc

View File

@ -363,6 +363,11 @@ template <typename T> inline void qToLittleEndian(T src, uchar *dest)
#endif // Q_BYTE_ORDER == Q_BIG_ENDIAN
template <> inline quint8 qbswap<quint8>(quint8 source)
{
return source;
}
QT_END_NAMESPACE
QT_END_HEADER

View File

@ -425,14 +425,11 @@ namespace QT_NAMESPACE {}
#if defined(Q_CC_MSVC) && _MSC_VER >= 1600
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_INITIALIZER_LISTS
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_LAMBDA
//# define Q_COMPILER_VARIADIC_TEMPLATES
//# define Q_COMPILER_CLASS_ENUM
//# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
//# define Q_COMPILER_UNICODE_STRINGS
//# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_DECLTYPE
// MSCV has std::initilizer_list, but do not support the braces initialization
//# define Q_COMPILER_INITIALIZER_LISTS
# endif
@ -524,6 +521,7 @@ namespace QT_NAMESPACE {}
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
/* C++0x features supported in GCC 4.3: */
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_DECLTYPE
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
/* C++0x features supported in GCC 4.4: */
@ -791,6 +789,7 @@ namespace QT_NAMESPACE {}
# if __INTEL_COMPILER >= 1100
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_DECLTYPE
# elif __INTEL_COMPILER >= 1200
# define Q_COMPILER_VARIADIC_TEMPLATES
# define Q_COMPILER_AUTO_TYPE
@ -2792,6 +2791,12 @@ QT_LICENSED_MODULE(Sensors)
# define QT_NO_RAWFONT
#endif
namespace QtPrivate {
//like std::enable_if
template <bool B, typename T = void> struct QEnableIf;
template <typename T> struct QEnableIf<true, T> { typedef T Type; };
}
QT_END_NAMESPACE
QT_END_HEADER

View File

@ -1121,7 +1121,7 @@
\value WA_X11NetWmWindowTypeToolBar Adds _NET_WM_WINDOW_TYPE_TOOLBAR to the
window's _NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This attribute
has no effect on non-X11 platforms. \note Qt automaticaly sets this
has no effect on non-X11 platforms. \note Qt automatically sets this
attribute for QToolBar.
\value WA_X11NetWmWindowTypeMenu Adds _NET_WM_WINDOW_TYPE_MENU to the
@ -2593,7 +2593,7 @@
\value ImhFormattedNumbersOnly Only number input is allowed. This includes decimal point and minus sign.
\value ImhUppercaseOnly Only upper case letter input is allowed.
\value ImhLowercaseOnly Only lower case letter input is allowed.
\value ImhDialableCharactersOnly Only characters suitable for phone dialling are allowed.
\value ImhDialableCharactersOnly Only characters suitable for phone dialing are allowed.
\value ImhEmailCharactersOnly Only characters suitable for email addresses are allowed.
\value ImhUrlCharactersOnly Only characters suitable for URLs are allowed.

View File

@ -24,6 +24,8 @@ HEADERS += \
io/qresource_p.h \
io/qresource_iterator_p.h \
io/qurl.h \
io/qurltlds_p.h \
io/qtldurl_p.h \
io/qsettings.h \
io/qsettings_p.h \
io/qfsfileengine.h \
@ -41,6 +43,7 @@ SOURCES += \
io/qbuffer.cpp \
io/qdatastream.cpp \
io/qdataurl.cpp \
io/qtldurl.cpp \
io/qdebug.cpp \
io/qdir.cpp \
io/qdiriterator.cpp \

117
src/corelib/io/qtldurl.cpp Normal file
View File

@ -0,0 +1,117 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qplatformdefs.h"
#include "qurl.h"
#include "private/qurltlds_p.h"
#include "private/qtldurl_p.h"
#include "QtCore/qstringlist.h"
QT_BEGIN_NAMESPACE
static bool containsTLDEntry(const QString &entry)
{
int index = qHash(entry) % tldCount;
int currentDomainIndex = tldIndices[index];
while (currentDomainIndex < tldIndices[index+1]) {
QString currentEntry = QString::fromUtf8(tldData + currentDomainIndex);
if (currentEntry == entry)
return true;
currentDomainIndex += qstrlen(tldData + currentDomainIndex) + 1; // +1 for the ending \0
}
return false;
}
/*!
\internal
Return the top-level-domain per Qt's copy of the Mozilla public suffix list of
\a domain.
*/
Q_CORE_EXPORT QString qTopLevelDomain(const QString &domain)
{
QStringList sections = domain.toLower().split(QLatin1Char('.'), QString::SkipEmptyParts);
if (sections.isEmpty())
return QString();
QString level, tld;
for (int j = sections.count() - 1; j >= 0; --j) {
level.prepend(QLatin1Char('.') + sections.at(j));
if (qIsEffectiveTLD(level.right(level.size() - 1)))
tld = level;
}
return tld;
}
/*!
\internal
Return true if \a domain is a top-level-domain per Qt's copy of the Mozilla public suffix list.
*/
Q_CORE_EXPORT bool qIsEffectiveTLD(const QString &domain)
{
// for domain 'foo.bar.com':
// 1. return if TLD table contains 'foo.bar.com'
if (containsTLDEntry(domain))
return true;
if (domain.contains(QLatin1Char('.'))) {
int count = domain.size() - domain.indexOf(QLatin1Char('.'));
QString wildCardDomain;
wildCardDomain.reserve(count + 1);
wildCardDomain.append(QLatin1Char('*'));
wildCardDomain.append(domain.right(count));
// 2. if table contains '*.bar.com',
// test if table contains '!foo.bar.com'
if (containsTLDEntry(wildCardDomain)) {
QString exceptionDomain;
exceptionDomain.reserve(domain.size() + 1);
exceptionDomain.append(QLatin1Char('!'));
exceptionDomain.append(domain);
return (! containsTLDEntry(exceptionDomain));
}
}
return false;
}
QT_END_NAMESPACE

View File

@ -0,0 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTLDURL_P_H
#define QTLDURL_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of qDecodeDataUrl. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "QtCore/qurl.h"
#include "QtCore/qstring.h"
QT_BEGIN_NAMESPACE
Q_CORE_EXPORT QString qTopLevelDomain(const QString &domain);
Q_CORE_EXPORT bool qIsEffectiveTLD(const QString &domain);
QT_END_NAMESPACE
#endif // QDATAURL_P_H

View File

@ -192,7 +192,9 @@
#if defined QT3_SUPPORT
#include "qfileinfo.h"
#endif
#ifndef QT_BOOTSTRAPPED
#include "qtldurl_p.h"
#endif
#if defined(Q_OS_WINCE_WM)
#pragma optimize("g", off)
#endif
@ -5592,6 +5594,21 @@ bool QUrl::hasFragment() const
return d->hasFragment;
}
/*!
\since 4.8
Returns the TLD (Top-Level Domain) of the URL, (e.g. .co.uk, .net).
Note that the return value is prefixed with a '.' unless the
URL does not contain a valid TLD, in which case the function returns
an empty string.
*/
#ifndef QT_BOOTSTRAPPED
QString QUrl::topLevelDomain() const
{
return qTopLevelDomain(host());
}
#endif
/*!
Returns the result of the merge of this URL with \a relative. This
URL is used as a base to convert \a relative to an absolute URL.

View File

@ -181,6 +181,9 @@ public:
void setEncodedFragment(const QByteArray &fragment);
QByteArray encodedFragment() const;
bool hasFragment() const;
#ifndef QT_BOOTSTRAPPED
QString topLevelDomain() const;
#endif
QUrl resolved(const QUrl &relative) const;

View File

@ -38,15 +38,15 @@
// the terms of any one of the MPL, the GPL or the LGPL.
//
#ifndef QNETWORKCOOKIEJARTLD_P_H
#define QNETWORKCOOKIEJARTLD_P_H
#ifndef QURLTLD_P_H
#define QURLTLD_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of the Network Access framework. This header file may change from
// of the Network Access and Core framework. This header file may change from
// version to version without notice, or even be removed.
//
// We mean it.
@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
// note to maintainer:
// this file should be updated before each release ->
// for instructions see the program at
// util/network/cookiejar-generateTLDs
// util/corelib/qurl-generateTLDs
static const quint16 tldCount = 3949;
static const quint16 tldIndices[] = {
@ -6478,4 +6478,4 @@ static const char tldData[] = {
QT_END_NAMESPACE
#endif // QNETWORKCOOKIEJARTLD_P_H
#endif // QURLTLD_P_H

View File

@ -1,15 +1,15 @@
The file qnetworkcookiejartlds_p.h is generated from the Public Suffix
The file qurltlds_p.h is generated from the Public Suffix
List (see [1] and [2]), by the program residing at
util/network/cookiejar-generateTLDs in the Qt source tree.
util/corelib/qurl-generateTLDs in the Qt source tree.
That program generates a character array and an index array from the
list to provide fast lookups of elements within C++.
Those arrays in qnetworkcookiejartlds_p.h are derived from the Public
Those arrays in qurltlds_p.h are derived from the Public
Suffix List ([2]), which was originally provided by
Jo Hermans <jo.hermans@gmail.com>.
The file qnetworkcookiejartlds_p.h was last generated Friday,
The file qurltlds_p.h was last generated Friday,
November 19th 15:24 2010.
----

View File

@ -42,9 +42,96 @@
#include "quuid.h"
#include "qdatastream.h"
#include "qendian.h"
QT_BEGIN_NAMESPACE
#ifndef QT_NO_QUUID_STRING
template <class Char, class Integral>
void _q_toHex(Char *&dst, Integral value)
{
static const char digits[] = "0123456789abcdef";
value = qToBigEndian(value);
const char* p = reinterpret_cast<const char*>(&value);
for (uint i = 0; i < sizeof(Integral); ++i, dst += 2) {
uint j = (p[i] >> 4) & 0xf;
dst[0] = Char(digits[j]);
j = p[i] & 0xf;
dst[1] = Char(digits[j]);
}
}
template <class Char, class Integral>
bool _q_fromHex(const Char *&src, Integral &value)
{
value = 0;
for (uint i = 0; i < sizeof(Integral) * 2; ++i) {
int ch = *src++;
int tmp;
if (ch >= '0' && ch <= '9')
tmp = ch - '0';
else if (ch >= 'a' && ch <= 'f')
tmp = ch - 'a' + 10;
else if (ch >= 'A' && ch <= 'F')
tmp = ch - 'A' + 10;
else
return false;
value = value * 16 + tmp;
}
return true;
}
template <class Char>
void _q_uuidToHex(Char *&dst, const uint &d1, const ushort &d2, const ushort &d3, const uchar (&d4)[8])
{
*dst++ = Char('{');
_q_toHex(dst, d1);
*dst++ = Char('-');
_q_toHex(dst, d2);
*dst++ = Char('-');
_q_toHex(dst, d3);
*dst++ = Char('-');
for (int i = 0; i < 2; i++)
_q_toHex(dst, d4[i]);
*dst++ = Char('-');
for (int i = 2; i < 8; i++)
_q_toHex(dst, d4[i]);
*dst = Char('}');
}
template <class Char>
bool _q_uuidFromHex(const Char *&src, uint &d1, ushort &d2, ushort &d3, uchar (&d4)[8])
{
if (*src == Char('{'))
src++;
if (!_q_fromHex(src, d1)
|| *src++ != Char('-')
|| !_q_fromHex(src, d2)
|| *src++ != Char('-')
|| !_q_fromHex(src, d3)
|| *src++ != Char('-')
|| !_q_fromHex(src, d4[0])
|| !_q_fromHex(src, d4[1])
|| *src++ != Char('-')
|| !_q_fromHex(src, d4[2])
|| !_q_fromHex(src, d4[3])
|| !_q_fromHex(src, d4[4])
|| !_q_fromHex(src, d4[5])
|| !_q_fromHex(src, d4[6])
|| !_q_fromHex(src, d4[7])) {
return false;
}
return true;
}
#endif
/*!
\class QUuid
\brief The QUuid class stores a Universally Unique Identifier (UUID).
@ -231,50 +318,22 @@ QT_BEGIN_NAMESPACE
*/
QUuid::QUuid(const QString &text)
{
bool ok;
if (text.isEmpty()) {
*this = QUuid();
return;
}
QString temp = text.toUpper();
if (temp[0] != QLatin1Char('{'))
temp = QLatin1Char('{') + text;
if (text[(int)text.length()-1] != QLatin1Char('}'))
temp += QLatin1Char('}');
data1 = temp.mid(1, 8).toULongLong(&ok, 16);
if (!ok) {
if (text.length() < 36) {
*this = QUuid();
return;
}
data2 = temp.mid(10, 4).toUInt(&ok, 16);
if (!ok) {
const ushort *data = reinterpret_cast<const ushort *>(text.unicode());
if (*data == '{' && text.length() < 37) {
*this = QUuid();
return;
}
data3 = temp.mid(15, 4).toUInt(&ok, 16);
if (!ok) {
if (!_q_uuidFromHex(data, data1, data2, data3, data4)) {
*this = QUuid();
return;
}
data4[0] = temp.mid(20, 2).toUInt(&ok, 16);
if (!ok) {
*this = QUuid();
return;
}
data4[1] = temp.mid(22, 2).toUInt(&ok, 16);
if (!ok) {
*this = QUuid();
return;
}
for (int i = 2; i<8; i++) {
data4[i] = temp.mid(25 + (i-2)*2, 2).toUShort(&ok, 16);
if (!ok) {
*this = QUuid();
return;
}
}
}
/*!
@ -282,10 +341,90 @@ QUuid::QUuid(const QString &text)
*/
QUuid::QUuid(const char *text)
{
*this = QUuid(QString::fromLatin1(text));
if (!text) {
*this = QUuid();
return;
}
if (!_q_uuidFromHex(text, data1, data2, data3, data4)) {
*this = QUuid();
return;
}
}
/*!
Creates a QUuid object from the QByteArray \a text, which must be
formatted as five hex fields separated by '-', e.g.,
"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex
digit. The curly braces shown here are optional, but it is normal to
include them. If the conversion fails, a null UUID is created. See
toByteArray() for an explanation of how the five hex fields map to the
public data members in QUuid.
\since 4.8
\sa toByteArray(), QUuid()
*/
QUuid::QUuid(const QByteArray &text)
{
if (text.length() < 36) {
*this = QUuid();
return;
}
const char *data = text.constData();
if (*data == '{' && text.length() < 37) {
*this = QUuid();
return;
}
if (!_q_uuidFromHex(data, data1, data2, data3, data4)) {
*this = QUuid();
return;
}
}
#endif
/*!
Creates a QUuid object from the binary representation of the UUID, as
specified by RFC 4122 section 4.1.2. See toRfc4122() for a further
explanation of the order of bytes required.
The byte array accepted is NOT a human readable format.
If the conversion fails, a null UUID is created.
\since 4.8
\sa toRfc4122(), QUuid()
*/
QUuid QUuid::fromRfc4122(const QByteArray &bytes)
{
if (bytes.isEmpty() || bytes.length() != 16)
return QUuid();
uint d1;
ushort d2, d3;
uchar d4[8];
const uchar *data = reinterpret_cast<const uchar *>(bytes.constData());
d1 = qFromBigEndian<quint32>(data);
data += sizeof(quint32);
d2 = qFromBigEndian<quint16>(data);
data += sizeof(quint16);
d3 = qFromBigEndian<quint16>(data);
data += sizeof(quint16);
for (int i = 0; i < 8; ++i) {
d4[i] = *(data);
data++;
}
return QUuid(d1, d2, d3, d4[0], d4[1], d4[2], d4[3], d4[4], d4[5], d4[6], d4[7]);
}
/*!
\fn bool QUuid::operator==(const QUuid &other) const
@ -308,11 +447,6 @@ QUuid::QUuid(const char *text)
\sa toString()
*/
static QString uuidhex(uint data, int digits)
{
return QString::number(data, 16).rightJustified(digits, QLatin1Char('0'));
}
/*!
Returns the string representation of this QUuid. The string is
formatted as five hex fields separated by '-' and enclosed in
@ -349,25 +483,114 @@ static QString uuidhex(uint data, int digits)
*/
QString QUuid::toString() const
{
QString result;
QString result(38, Qt::Uninitialized);
ushort *data = (ushort *)result.unicode();
QChar dash = QLatin1Char('-');
result = QLatin1Char('{') + uuidhex(data1,8);
result += dash;
result += uuidhex(data2,4);
result += dash;
result += uuidhex(data3,4);
result += dash;
result += uuidhex(data4[0],2);
result += uuidhex(data4[1],2);
result += dash;
for (int i = 2; i < 8; i++)
result += uuidhex(data4[i],2);
_q_uuidToHex(data, data1, data2, data3, data4);
return result + QLatin1Char('}');
return result;
}
/*!
Returns the binary representation of this QUuid. The byte array is
formatted as five hex fields separated by '-' and enclosed in
curly braces, i.e., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where
'x' is a hex digit. From left to right, the five hex fields are
obtained from the four public data members in QUuid as follows:
\table
\header
\o Field #
\o Source
\row
\o 1
\o data1
\row
\o 2
\o data2
\row
\o 3
\o data3
\row
\o 4
\o data4[0] .. data4[1]
\row
\o 5
\o data4[2] .. data4[7]
\endtable
\since 4.8
*/
QByteArray QUuid::toByteArray() const
{
QByteArray result(38, Qt::Uninitialized);
char *data = result.data();
_q_uuidToHex(data, data1, data2, data3, data4);
return result;
}
#endif
/*!
Returns the binary representation of this QUuid. The byte array is in big
endian format, and formatted according to RFC 4122, section 4.1.2 -
"Layout and byte order".
The order is as follows:
\table
\header
\o Field #
\o Source
\row
\o 1
\o data1
\row
\o 2
\o data2
\row
\o 3
\o data3
\row
\o 4
\o data4[0] .. data4[7]
\endtable
\since 4.8
*/
QByteArray QUuid::toRfc4122() const
{
// we know how many bytes a UUID has, I hope :)
QByteArray bytes(16, Qt::Uninitialized);
uchar *data = reinterpret_cast<uchar*>(bytes.data());
qToBigEndian(data1, data);
data += sizeof(quint32);
qToBigEndian(data2, data);
data += sizeof(quint16);
qToBigEndian(data3, data);
data += sizeof(quint16);
for (int i = 0; i < 8; ++i) {
*(data) = data4[i];
data++;
}
return bytes;
}
#ifndef QT_NO_DATASTREAM
/*!
\relates QUuid
@ -375,11 +598,30 @@ QString QUuid::toString() const
*/
QDataStream &operator<<(QDataStream &s, const QUuid &id)
{
s << (quint32)id.data1;
s << (quint16)id.data2;
s << (quint16)id.data3;
for (int i = 0; i < 8; i++)
s << (quint8)id.data4[i];
QByteArray bytes;
if (s.byteOrder() == QDataStream::BigEndian) {
bytes = id.toRfc4122();
} else {
// we know how many bytes a UUID has, I hope :)
bytes = QByteArray(16, Qt::Uninitialized);
uchar *data = reinterpret_cast<uchar*>(bytes.data());
qToLittleEndian(id.data1, data);
data += sizeof(quint32);
qToLittleEndian(id.data2, data);
data += sizeof(quint16);
qToLittleEndian(id.data3, data);
data += sizeof(quint16);
for (int i = 0; i < 8; ++i) {
*(data) = id.data4[i];
data++;
}
}
if (s.writeRawData(bytes.data(), 16) != 16) {
s.setStatus(QDataStream::WriteFailed);
}
return s;
}
@ -389,19 +631,30 @@ QDataStream &operator<<(QDataStream &s, const QUuid &id)
*/
QDataStream &operator>>(QDataStream &s, QUuid &id)
{
quint32 u32;
quint16 u16;
quint8 u8;
s >> u32;
id.data1 = u32;
s >> u16;
id.data2 = u16;
s >> u16;
id.data3 = u16;
for (int i = 0; i < 8; i++) {
s >> u8;
id.data4[i] = u8;
QByteArray bytes(16, Qt::Uninitialized);
if (s.readRawData(bytes.data(), 16) != 16) {
s.setStatus(QDataStream::ReadPastEnd);
return s;
}
if (s.byteOrder() == QDataStream::BigEndian) {
id = QUuid::fromRfc4122(bytes);
} else {
const uchar *data = reinterpret_cast<const uchar *>(bytes.constData());
id.data1 = qFromLittleEndian<quint32>(data);
data += sizeof(quint32);
id.data2 = qFromLittleEndian<quint16>(data);
data += sizeof(quint16);
id.data3 = qFromLittleEndian<quint16>(data);
data += sizeof(quint16);
for (int i = 0; i < 8; ++i) {
id.data4[i] = *(data);
data++;
}
}
return s;
}
#endif // QT_NO_DATASTREAM

View File

@ -108,8 +108,12 @@ struct Q_CORE_EXPORT QUuid
QUuid(const QString &);
QUuid(const char *);
QString toString() const;
operator QString() const { return toString(); }
operator QString() const { return toString(); } // ### Qt5 remove
QUuid(const QByteArray &);
QByteArray toByteArray() const;
#endif
QByteArray toRfc4122() const;
static QUuid fromRfc4122(const QByteArray &);
bool isNull() const;
bool operator==(const QUuid &orig) const

View File

@ -641,6 +641,8 @@ Q_OUTOFLINE_TEMPLATE QList<T> QList<T>::mid(int pos, int alength) const
if (pos == 0 && alength == size())
return *this;
QList<T> cpy;
if (alength <= 0)
return cpy;
cpy.reserve(alength);
cpy.d->end = alength;
QT_TRY {

View File

@ -879,10 +879,10 @@ QStringList QFontDatabasePrivate::addTTFile(const QByteArray &file, const QByteA
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
if (os2) {
quint32 unicodeRange[4] = {
os2->ulUnicodeRange1, os2->ulUnicodeRange2, os2->ulUnicodeRange3, os2->ulUnicodeRange4
static_cast<quint32>(os2->ulUnicodeRange1), static_cast<quint32>(os2->ulUnicodeRange2), static_cast<quint32>(os2->ulUnicodeRange3), static_cast<quint32>(os2->ulUnicodeRange4)
};
quint32 codePageRange[2] = {
os2->ulCodePageRange1, os2->ulCodePageRange2
static_cast<quint32>(os2->ulCodePageRange1), static_cast<quint32>(os2->ulCodePageRange2)
};
writingSystems = qt_determine_writing_systems_from_truetype_bits(unicodeRange, codePageRange);

View File

@ -2825,6 +2825,75 @@ QFixed QTextEngine::offsetInLigature(const QScriptItem *si, int pos, int max, in
return 0;
}
// Scan in logClusters[from..to-1] for glyph_pos
int QTextEngine::getClusterLength(unsigned short *logClusters,
const HB_CharAttributes *attributes,
int from, int to, int glyph_pos, int *start)
{
int clusterLength = 0;
for (int i = from; i < to; i++) {
if (logClusters[i] == glyph_pos && attributes[i].charStop) {
if (*start < 0)
*start = i;
clusterLength++;
}
else if (clusterLength)
break;
}
return clusterLength;
}
int QTextEngine::positionInLigature(const QScriptItem *si, int end,
QFixed x, QFixed edge, int glyph_pos,
bool cursorOnCharacter)
{
unsigned short *logClusters = this->logClusters(si);
int clusterStart = -1;
int clusterLength = 0;
if (si->analysis.script != QUnicodeTables::Common &&
si->analysis.script != QUnicodeTables::Greek) {
if (glyph_pos == -1)
return si->position + end;
else {
int i;
for (i = 0; i < end; i++)
if (logClusters[i] == glyph_pos)
break;
return si->position + i;
}
}
if (glyph_pos == -1 && end > 0)
glyph_pos = logClusters[end - 1];
else {
if (x <= edge)
glyph_pos--;
}
const HB_CharAttributes *attrs = attributes();
clusterLength = getClusterLength(logClusters, attrs, 0, end, glyph_pos, &clusterStart);
if (clusterLength) {
const QGlyphLayout &glyphs = shapedGlyphs(si);
QFixed glyphWidth = glyphs.effectiveAdvance(glyph_pos);
// the approximate width of each individual element of the ligature
QFixed perItemWidth = glyphWidth / clusterLength;
QFixed left = x > edge ? edge : edge - glyphWidth;
int n = ((x - left) / perItemWidth).floor().toInt();
QFixed dist = x - left - n * perItemWidth;
int closestItem = dist > (perItemWidth / 2) ? n + 1 : n;
if (cursorOnCharacter && closestItem > 0)
closestItem--;
int pos = si->position + clusterStart + closestItem;
// Jump to the next charStop
while (!attrs[pos].charStop && pos < end)
pos++;
return pos;
}
return si->position + end;
}
int QTextEngine::previousLogicalPosition(int oldPos) const
{
const HB_CharAttributes *attrs = attributes();

View File

@ -620,6 +620,7 @@ public:
QFixed leadingSpaceWidth(const QScriptLine &line);
QFixed offsetInLigature(const QScriptItem *si, int pos, int max, int glyph_pos);
int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos, bool cursorOnCharacter);
int previousLogicalPosition(int oldPos) const;
int nextLogicalPosition(int oldPos) const;
int lineNumberForTextPosition(int pos);
@ -642,6 +643,7 @@ private:
void resolveAdditionalFormats() const;
int endOfLine(int lineNum);
int beginningOfLine(int lineNum);
int getClusterLength(unsigned short *logClusters, const HB_CharAttributes *attributes, int from, int to, int glyph_pos, int *start);
};
class Q_GUI_EXPORT QStackTextEngine : public QTextEngine {

View File

@ -2607,8 +2607,8 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
} else {
bool rtl = eng->isRightToLeft();
bool visual = eng->visualCursorMovement();
int end = qMin(lineEnd, si->position + l) - si->position;
if (reverse) {
int end = qMin(lineEnd, si->position + l) - si->position;
int glyph_end = end == l ? si->num_glyphs : logClusters[end];
int glyph_start = glyph_pos;
if (visual && !rtl && !(lastLine && itm == (visualOrder[nItems - 1] + firstItem)))
@ -2624,7 +2624,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
for (int i = glyph_start; i <= glyph_end; i++)
x += glyphs.effectiveAdvance(i);
}
x += eng->offsetInLigature(si, pos, line.length, glyph_pos);
x += eng->offsetInLigature(si, pos, end, glyph_pos);
}
*cursorPos = pos + si->position;
@ -2739,6 +2739,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
}
int glyph_pos = -1;
QFixed edge;
// has to be inside run
if (cpos == QTextLine::CursorOnCharacter) {
if (si.analysis.bidiLevel % 2) {
@ -2749,6 +2750,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
if (pos < x)
break;
glyph_pos = gs;
edge = pos;
break;
}
pos -= glyphs.effectiveAdvance(gs);
@ -2761,6 +2763,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
if (pos > x)
break;
glyph_pos = gs;
edge = pos;
}
pos += glyphs.effectiveAdvance(gs);
++gs;
@ -2774,6 +2777,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
while (gs <= ge) {
if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = gs;
edge = pos;
dist = qAbs(x-pos);
}
pos -= glyphs.effectiveAdvance(gs);
@ -2783,6 +2787,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
while (ge >= gs) {
if (glyphs.attributes[ge].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = ge;
edge = pos;
dist = qAbs(x-pos);
}
pos += glyphs.effectiveAdvance(ge);
@ -2794,6 +2799,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
while (gs <= ge) {
if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = gs;
edge = pos;
dist = qAbs(x-pos);
}
pos += glyphs.effectiveAdvance(gs);
@ -2805,6 +2811,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
pos += glyphs.effectiveAdvance(gs);
if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) {
glyph_pos = gs;
edge = pos;
dist = qAbs(x-pos);
}
++gs;
@ -2821,16 +2828,13 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
if (rtl && nchars > 0)
return insertionPoints[lastLine ? nchars : nchars - 1];
}
return si.position + end;
return eng->positionInLigature(&si, end, x, pos, -1,
cpos == QTextLine::CursorOnCharacter);
}
}
Q_ASSERT(glyph_pos != -1);
int j;
for (j = 0; j < eng->length(item); ++j)
if (logClusters[j] == glyph_pos)
break;
// qDebug("at pos %d (in run: %d)", si.position + j, j);
return si.position + j;
return eng->positionInLigature(&si, end, x, edge, glyph_pos,
cpos == QTextLine::CursorOnCharacter);
}
}
// right of last item

View File

@ -21,7 +21,6 @@ HEADERS += \
access/qnetworkcookie_p.h \
access/qnetworkcookiejar.h \
access/qnetworkcookiejar_p.h \
access/qnetworkcookiejartlds_p.h \
access/qnetworkrequest.h \
access/qnetworkrequest_p.h \
access/qnetworkreply.h \

View File

@ -261,7 +261,17 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair)
// set the host
value = request.headerField("host");
if (value.isEmpty()) {
QByteArray host = QUrl::toAce(hostName);
QHostAddress add;
QByteArray host;
if (add.setAddress(hostName)) {
if (add.protocol() == QAbstractSocket::IPv6Protocol)
host = "[" + hostName.toAscii() + "]";//format the ipv6 in the standard way
else
host = hostName.toAscii();
} else {
host = QUrl::toAce(hostName);
}
int port = request.url().port();
if (port != -1) {

View File

@ -40,12 +40,12 @@
****************************************************************************/
#include "qnetworkcookiejar.h"
#include "qnetworkcookiejartlds_p.h"
#include "qnetworkcookiejar_p.h"
#include "QtNetwork/qnetworkcookie.h"
#include "QtCore/qurl.h"
#include "QtCore/qdatetime.h"
#include "private/qtldurl_p.h"
QT_BEGIN_NAMESPACE
@ -216,7 +216,7 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieLis
// the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2
// redundant; the "leading dot" rule has been relaxed anyway, see above
// we remove the leading dot for this check
if (QNetworkCookieJarPrivate::isEffectiveTLD(domain.remove(0, 1)))
if (qIsEffectiveTLD(domain.remove(0, 1)))
continue; // not accepted
}
@ -304,43 +304,4 @@ QList<QNetworkCookie> QNetworkCookieJar::cookiesForUrl(const QUrl &url) const
return result;
}
bool QNetworkCookieJarPrivate::isEffectiveTLD(const QString &domain)
{
// for domain 'foo.bar.com':
// 1. return if TLD table contains 'foo.bar.com'
if (containsTLDEntry(domain))
return true;
if (domain.contains(QLatin1Char('.'))) {
int count = domain.size() - domain.indexOf(QLatin1Char('.'));
QString wildCardDomain;
wildCardDomain.reserve(count + 1);
wildCardDomain.append(QLatin1Char('*'));
wildCardDomain.append(domain.right(count));
// 2. if table contains '*.bar.com',
// test if table contains '!foo.bar.com'
if (containsTLDEntry(wildCardDomain)) {
QString exceptionDomain;
exceptionDomain.reserve(domain.size() + 1);
exceptionDomain.append(QLatin1Char('!'));
exceptionDomain.append(domain);
return (! containsTLDEntry(exceptionDomain));
}
}
return false;
}
bool QNetworkCookieJarPrivate::containsTLDEntry(const QString &entry)
{
int index = qHash(entry) % tldCount;
int currentDomainIndex = tldIndices[index];
while (currentDomainIndex < tldIndices[index+1]) {
QString currentEntry = QString::fromUtf8(tldData + currentDomainIndex);
if (currentEntry == entry)
return true;
currentDomainIndex += qstrlen(tldData + currentDomainIndex) + 1; // +1 for the ending \0
}
return false;
}
QT_END_NAMESPACE

View File

@ -63,9 +63,6 @@ class QNetworkCookieJarPrivate: public QObjectPrivate
public:
QList<QNetworkCookie> allCookies;
static bool Q_AUTOTEST_EXPORT isEffectiveTLD(const QString &domain);
static bool containsTLDEntry(const QString &entry);
Q_DECLARE_PUBLIC(QNetworkCookieJar)
};

View File

@ -488,7 +488,7 @@ void QNetworkConfigurationManagerPrivate::enablePolling()
++forcedPolling;
if (forcedPolling == 1)
startPolling();
QMetaObject::invokeMethod(this, "startPolling");
}
void QNetworkConfigurationManagerPrivate::disablePolling()

View File

@ -107,7 +107,7 @@ private Q_SLOTS:
void pollEngines();
private:
void startPolling();
Q_INVOKABLE void startPolling();
QTimer *pollTimer;
private:

View File

@ -149,6 +149,8 @@ bool QHttpSocketEngine::connectInternal()
// Handshake isn't done. If unconnected, start connecting.
if (d->state == None && d->socket->state() == QAbstractSocket::UnconnectedState) {
setState(QAbstractSocket::ConnectingState);
//limit buffer in internal socket, data is buffered in the external socket under application control
d->socket->setReadBufferSize(65536);
d->socket->connectToHost(d->proxy.hostName(), d->proxy.port());
}

View File

@ -1126,6 +1126,8 @@ bool QSocks5SocketEngine::connectInternal()
if (d->socks5State == QSocks5SocketEnginePrivate::Uninitialized
&& d->socketState != QAbstractSocket::ConnectingState) {
setState(QAbstractSocket::ConnectingState);
//limit buffer in internal socket, data is buffered in the external socket under application control
d->data->controlSocket->setReadBufferSize(65536);
d->data->controlSocket->connectToHost(d->proxyInfo.hostName(), d->proxyInfo.port());
return false;
}

View File

@ -127,7 +127,7 @@
QT_BEGIN_NAMESPACE
// forward declaration
static QMap<QString, QString> _q_mapFromOnelineName(char *name);
static QMap<QString, QString> _q_mapFromX509Name(X509_NAME *name);
/*!
Constructs a QSslCertificate by reading \a format encoded data
@ -324,7 +324,7 @@ QString QSslCertificate::issuerInfo(SubjectInfo info) const
// lazy init
if (d->issuerInfo.isEmpty() && d->x509)
d->issuerInfo =
_q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0));
_q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
return d->issuerInfo.value(_q_SubjectInfoToString(info));
}
@ -341,7 +341,7 @@ QString QSslCertificate::issuerInfo(const QByteArray &tag) const
// lazy init
if (d->issuerInfo.isEmpty() && d->x509)
d->issuerInfo =
_q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0));
_q_mapFromX509Name(q_X509_get_issuer_name(d->x509));
return d->issuerInfo.value(QString::fromLatin1(tag));
}
@ -360,7 +360,7 @@ QString QSslCertificate::subjectInfo(SubjectInfo info) const
// lazy init
if (d->subjectInfo.isEmpty() && d->x509)
d->subjectInfo =
_q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0));
_q_mapFromX509Name(q_X509_get_subject_name(d->x509));
return d->subjectInfo.value(_q_SubjectInfoToString(info));
}
@ -376,7 +376,7 @@ QString QSslCertificate::subjectInfo(const QByteArray &tag) const
// lazy init
if (d->subjectInfo.isEmpty() && d->x509)
d->subjectInfo =
_q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0));
_q_mapFromX509Name(q_X509_get_subject_name(d->x509));
return d->subjectInfo.value(QString::fromLatin1(tag));
}
@ -666,37 +666,17 @@ QByteArray QSslCertificatePrivate::QByteArray_from_X509(X509 *x509, QSsl::Encodi
return BEGINCERTSTRING "\n" + tmp + ENDCERTSTRING "\n";
}
static QMap<QString, QString> _q_mapFromOnelineName(char *name)
static QMap<QString, QString> _q_mapFromX509Name(X509_NAME *name)
{
QMap<QString, QString> info;
QString infoStr = QString::fromLocal8Bit(name);
q_CRYPTO_free(name);
// ### The right-hand encoding seems to allow hex (Regulierungsbeh\xC8orde)
//entry.replace(QLatin1String("\\x"), QLatin1String("%"));
//entry = QUrl::fromPercentEncoding(entry.toLatin1());
// ### See RFC-4630 for more details!
QRegExp rx(QLatin1String("/([A-Za-z]+)=(.+)"));
int pos = 0;
while ((pos = rx.indexIn(infoStr, pos)) != -1) {
const QString name = rx.cap(1);
QString value = rx.cap(2);
const int valuePos = rx.pos(2);
const int next = rx.indexIn(value);
if (next == -1) {
info.insert(name, value);
break;
}
value = value.left(next);
info.insert(name, value);
pos = valuePos + value.length();
for (int i = 0; i < q_X509_NAME_entry_count(name); ++i) {
X509_NAME_ENTRY *e = q_X509_NAME_get_entry(name, i);
const char *obj = q_OBJ_nid2sn(q_OBJ_obj2nid(q_X509_NAME_ENTRY_get_object(e)));
unsigned char *data = 0;
int size = q_ASN1_STRING_to_UTF8(&data, q_X509_NAME_ENTRY_get_data(e));
info[QString::fromUtf8(obj)] = QString::fromUtf8((char*)data, size);
q_CRYPTO_free(data);
}
return info;
}

View File

@ -101,6 +101,7 @@ DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c,
DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return)
DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return)
DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return)
DEFINEFUNC2(int, ASN1_STRING_to_UTF8, unsigned char **a, a, ASN1_STRING *b, b, return 0, return);
DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return)
DEFINEFUNC(int, BIO_free, BIO *a, a, return 0, return)
DEFINEFUNC(BIO *, BIO_new, BIO_METHOD *a, a, return 0, return)
@ -248,7 +249,10 @@ DEFINEFUNC4(void *, X509_get_ext_d2i, X509 *a, a, int b, b, int *c, c, int *d, d
DEFINEFUNC(X509_NAME *, X509_get_issuer_name, X509 *a, a, return 0, return)
DEFINEFUNC(X509_NAME *, X509_get_subject_name, X509 *a, a, return 0, return)
DEFINEFUNC(int, X509_verify_cert, X509_STORE_CTX *a, a, return -1, return)
DEFINEFUNC3(char *, X509_NAME_oneline, X509_NAME *a, a, char *b, b, int c, c, return 0, return)
DEFINEFUNC(int, X509_NAME_entry_count, X509_NAME *a, a, return 0, return)
DEFINEFUNC2(X509_NAME_ENTRY *, X509_NAME_get_entry, X509_NAME *a, a, int b, b, return 0, return)
DEFINEFUNC(ASN1_STRING *, X509_NAME_ENTRY_get_data, X509_NAME_ENTRY *a, a, return 0, return)
DEFINEFUNC(ASN1_OBJECT *, X509_NAME_ENTRY_get_object, X509_NAME_ENTRY *a, a, return 0, return)
DEFINEFUNC(EVP_PKEY *, X509_PUBKEY_get, X509_PUBKEY *a, a, return 0, return)
DEFINEFUNC(void, X509_STORE_free, X509_STORE *a, a, return, DUMMYARG)
DEFINEFUNC(X509_STORE *, X509_STORE_new, DUMMYARG, DUMMYARG, return 0, return)
@ -518,6 +522,7 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(ASN1_INTEGER_get, 48, libs.second )
RESOLVEFUNC(ASN1_STRING_data, 71, libs.second )
RESOLVEFUNC(ASN1_STRING_length, 76, libs.second )
RESOLVEFUNC(ASN1_STRING_to_UTF8, 86, libs.second )
RESOLVEFUNC(BIO_ctrl, 184, libs.second )
RESOLVEFUNC(BIO_free, 209, libs.second )
RESOLVEFUNC(BIO_new, 222, libs.second )
@ -608,7 +613,10 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(SSLv23_server_method, 191, libs.first )
RESOLVEFUNC(TLSv1_server_method, 200, libs.first )
RESOLVEFUNC(SSL_CTX_load_verify_locations, 34, libs.first )
RESOLVEFUNC(X509_NAME_oneline, 1830, libs.second )
RESOLVEFUNC(X509_NAME_entry_count, 1821, libs.second )
RESOLVEFUNC(X509_NAME_get_entry, 1823, libs.second )
RESOLVEFUNC(X509_NAME_ENTRY_get_data, 1808, libs.second )
RESOLVEFUNC(X509_NAME_ENTRY_get_object, 1809, libs.second )
RESOLVEFUNC(X509_PUBKEY_get, 1844, libs.second )
RESOLVEFUNC(X509_STORE_free, 1939, libs.second )
RESOLVEFUNC(X509_STORE_new, 1942, libs.second )
@ -647,6 +655,7 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(ASN1_INTEGER_get)
RESOLVEFUNC(ASN1_STRING_data)
RESOLVEFUNC(ASN1_STRING_length)
RESOLVEFUNC(ASN1_STRING_to_UTF8)
RESOLVEFUNC(BIO_ctrl)
RESOLVEFUNC(BIO_free)
RESOLVEFUNC(BIO_new)
@ -736,7 +745,10 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(SSLv3_server_method)
RESOLVEFUNC(SSLv23_server_method)
RESOLVEFUNC(TLSv1_server_method)
RESOLVEFUNC(X509_NAME_oneline)
RESOLVEFUNC(X509_NAME_entry_count)
RESOLVEFUNC(X509_NAME_get_entry)
RESOLVEFUNC(X509_NAME_ENTRY_get_data)
RESOLVEFUNC(X509_NAME_ENTRY_get_object)
RESOLVEFUNC(X509_PUBKEY_get)
RESOLVEFUNC(X509_STORE_free)
RESOLVEFUNC(X509_STORE_new)

View File

@ -204,6 +204,7 @@ bool q_resolveOpenSslSymbols();
long q_ASN1_INTEGER_get(ASN1_INTEGER *a);
unsigned char * q_ASN1_STRING_data(ASN1_STRING *a);
int q_ASN1_STRING_length(ASN1_STRING *a);
int q_ASN1_STRING_to_UTF8(unsigned char **a, ASN1_STRING *b);
long q_BIO_ctrl(BIO *a, int b, long c, void *d);
int q_BIO_free(BIO *a);
BIO *q_BIO_new(BIO_METHOD *a);
@ -360,7 +361,10 @@ void *q_X509_get_ext_d2i(X509 *a, int b, int *c, int *d);
X509_NAME *q_X509_get_issuer_name(X509 *a);
X509_NAME *q_X509_get_subject_name(X509 *a);
int q_X509_verify_cert(X509_STORE_CTX *ctx);
char *q_X509_NAME_oneline(X509_NAME *a, char *b, int c);
int q_X509_NAME_entry_count(X509_NAME *a);
X509_NAME_ENTRY *q_X509_NAME_get_entry(X509_NAME *a,int b);
ASN1_STRING *q_X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *a);
ASN1_OBJECT *q_X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *a);
EVP_PKEY *q_X509_PUBKEY_get(X509_PUBKEY *a);
void q_X509_STORE_free(X509_STORE *store);
X509_STORE *q_X509_STORE_new();

View File

@ -1795,7 +1795,7 @@ static void convertFromGLImage(QImage &img, int w, int h, bool alpha_format, boo
img = img.mirrored();
}
QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha)
Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha)
{
QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied
: QImage::Format_RGB32);

View File

@ -59,7 +59,7 @@
QT_BEGIN_NAMESPACE
extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool);
extern Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer(const QSize&, bool, bool);
#define QGL_FUNC_CONTEXT const QGLContext *ctx = d_ptr->fbo_guard.context();
#define QGL_FUNCP_CONTEXT const QGLContext *ctx = fbo_guard.context();

View File

@ -113,7 +113,7 @@ extern void qgl_cleanup_glyph_cache(QGLContext *);
void qgl_cleanup_glyph_cache(QGLContext *) {}
#endif
extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool);
extern Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer(const QSize&, bool, bool);
QGLContext* QGLPBufferGLPaintDevice::context() const

View File

@ -1,5 +1,5 @@
TARGET = qtaccessiblewidgets
include(../../qpluginbase.pri)
load(qt_plugin)
include (../qaccessiblebase.pri)
QT += core-private gui-private widgets-private

View File

@ -1,5 +1,5 @@
TARGET = qconnmanbearer
include(../../qpluginbase.pri)
load(qt_plugin)
QT = core network-private dbus

View File

@ -1,5 +1,5 @@
TARGET = qcorewlanbearer
include(../../qpluginbase.pri)
load(qt_plugin)
QT = core-private network-private
LIBS += -framework Foundation -framework SystemConfiguration

View File

@ -1,5 +1,5 @@
TARGET = qgenericbearer
include(../../qpluginbase.pri)
load(qt_plugin)
QT = core-private network-private

View File

@ -1,5 +1,5 @@
TARGET = qicdbearer
include(../../qpluginbase.pri)
load(qt_plugin)
QT = core network dbus

View File

@ -1,5 +1,5 @@
TARGET = qnativewifibearer
include(../../qpluginbase.pri)
load(qt_plugin)
QT = core-private network-private

View File

@ -1,5 +1,5 @@
TARGET = qnmbearer
include(../../qpluginbase.pri)
load(qt_plugin)
QT = core network-private dbus

View File

@ -1,5 +1,5 @@
TARGET = qnlabearer
include(../../qpluginbase.pri)
load(qt_plugin)
QT = core network

View File

@ -1,5 +1,5 @@
TARGET = qsymbianbearer
include(../../qpluginbase.pri)
load(qt_plugin)
QT = core network

View File

@ -1,5 +1,5 @@
TARGET = qcncodecs
include(../../qpluginbase.pri)
load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs

View File

@ -1,5 +1,5 @@
TARGET = qjpcodecs
include(../../qpluginbase.pri)
load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs

View File

@ -1,5 +1,5 @@
TARGET = qkrcodecs
include(../../qpluginbase.pri)
load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs

View File

@ -1,5 +1,5 @@
TARGET = qtwcodecs
include(../../qpluginbase.pri)
load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs

View File

@ -1,5 +1,5 @@
TARGET = qlinuxinputplugin
include(../../qpluginbase.pri)
load(qt_plugin)
DESTDIR = $$QT.gui.plugins/generic
target.path = $$[QT_INSTALL_PLUGINS]/generic

View File

@ -1,5 +1,5 @@
TARGET = qlinuxinputplugin
include(../../qpluginbase.pri)
load(qt_plugin)
DESTDIR = $$QT.gui.plugins/generic
target.path = $$[QT_INSTALL_PLUGINS]/generic

View File

@ -1,5 +1,5 @@
TARGET = qgif
include(../../qpluginbase.pri)
load(qt_plugin)
include(../../../gui/image/qgifhandler.pri)
SOURCES += $$PWD/main.cpp

View File

@ -1,5 +1,5 @@
TARGET = qico
include(../../qpluginbase.pri)
load(qt_plugin)
QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-ico)"

View File

@ -1,5 +1,5 @@
TARGET = qjpeg
include(../../qpluginbase.pri)
load(qt_plugin)
QT += core-private

View File

@ -1,5 +1,5 @@
TARGET = qmng
include(../../qpluginbase.pri)
load(qt_plugin)
QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-mng)"

View File

@ -1,5 +1,5 @@
TARGET = qtiff
include(../../qpluginbase.pri)
load(qt_plugin)
QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-tiff)"

View File

@ -1,5 +1,5 @@
TARGET = qimsw-multi
include(../../qpluginbase.pri)
load(qt_plugin)
CONFIG += warn_on
QT += widgets

View File

@ -1,5 +1,5 @@
TARGET = qcocoa
include(../../qpluginbase.pri)
load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms
OBJECTIVE_SOURCES = main.mm \

View File

@ -1,5 +1,5 @@
TARGET = qdirectfb
include(../../qpluginbase.pri)
load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms
isEmpty(DIRECTFB_LIBS) {

View File

@ -2,7 +2,7 @@ TARGET = qeglfs
TEMPLATE = lib
CONFIG += plugin
QT += opengl
QT += opengl core-private gui-private opengl-private
DESTDIR = $$QT.gui.plugins/platforms

View File

@ -26,4 +26,4 @@
QT_SOURCE_TREE = $$fromfile($$(QTDIR)/.qmake.cache,QT_SOURCE_TREE)
QT_BUILD_TREE = $$fromfile($$(QTDIR)/.qmake.cache,QT_BUILD_TREE)
include($$QT_SOURCE_TREE/src/plugins/qpluginbase.pri)
load(qt_plugin)

View File

@ -6,7 +6,7 @@
#QT -= core gui
TARGET = fb_base
#include(../../qpluginbase.pri)
#load(qt_plugin)
DESTDIR = $$QT.gui.plugins/graphicssystems

View File

@ -1,5 +1,5 @@
TARGET = qlinuxfbgraphicssystem
include(../../qpluginbase.pri)
load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms

View File

@ -1,6 +1,5 @@
TARGET = qminimal
include(../../qpluginbase.pri)
QT += gui-private core-private
load(qt_plugin)
QT = core-private gui-private
DESTDIR = $$QT.gui.plugins/platforms

View File

@ -1,5 +1,5 @@
TARGET = qopenkodeintegration
include(../../qpluginbase.pri)
load(qt_plugin)
QT += opengl

View File

@ -1,5 +1,5 @@
TARGET = qvglitegraphicssystem
include(../../qpluginbase.pri)
load(qt_plugin)
QT += openvg

View File

@ -1,5 +1,5 @@
TARGET = qvfbintegration
include(../../qpluginbase.pri)
load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms

View File

@ -1,5 +1,5 @@
TARGET = quikit
include(../../qpluginbase.pri)
load(qt_plugin)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
QT += opengl

View File

@ -1,5 +1,5 @@
TARGET = qvncgraphicssystem
include(../../qpluginbase.pri)
load(qt_plugin)
QT += network

View File

@ -139,6 +139,11 @@ QWaylandDisplay::QWaylandDisplay(void)
#ifdef QT_WAYLAND_GL_SUPPORT
mEglIntegration = QWaylandGLIntegration::createGLIntegration(this);
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
mWindowManagerIntegration = QWaylandWindowManagerIntegration::createIntegration(this);
#endif
blockingReadEvents();
qRegisterMetaType<uint32_t>("uint32_t");
@ -147,10 +152,6 @@ QWaylandDisplay::QWaylandDisplay(void)
mEglIntegration->initialize();
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
mWindowManagerIntegration = QWaylandWindowManagerIntegration::createIntegration(this);
#endif
connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()), this, SLOT(flushRequests()));
mFd = wl_display_get_fd(mDisplay, sourceUpdate, this);

View File

@ -68,6 +68,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
mDisplay->windowManagerIntegration()->mapClientToProcess(qApp->applicationPid());
mDisplay->windowManagerIntegration()->authenticateWithToken();
#endif
mSurface = mDisplay->createSurface(this);

View File

@ -1,5 +1,5 @@
TARGET = qwayland
include(../../qpluginbase.pri)
load(qt_plugin)
QT+=gui-private core-private opengl-private

View File

@ -36,16 +36,37 @@ struct wl_client;
struct wl_windowmanager;
struct wl_proxy;
extern void
wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...);
extern struct wl_proxy *
wl_proxy_create(struct wl_proxy *factory,
const struct wl_interface *interface);
extern struct wl_proxy *
wl_proxy_create_for_id(struct wl_display *display,
const struct wl_interface *interface, uint32_t id);
extern void
wl_proxy_destroy(struct wl_proxy *proxy);
extern int
wl_proxy_add_listener(struct wl_proxy *proxy,
void (**implementation)(void), void *data);
extern void
wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data);
extern void *
wl_proxy_get_user_data(struct wl_proxy *proxy);
extern const struct wl_interface wl_windowmanager_interface;
#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0
#define wl_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0
#define wl_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN 1
static inline struct wl_windowmanager *
wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t /*version*/)
wl_windowmanager_create(struct wl_display *display, uint32_t id)
{
// ### does not run without latest wayland. must be enabled later
//wl_display_bind(display, id, "wl_windowmanager", version);
return (struct wl_windowmanager *)
wl_proxy_create_for_id(display, &wl_windowmanager_interface, id);
}
@ -72,7 +93,14 @@ static inline void
wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid)
{
wl_proxy_marshal((struct wl_proxy *) wl_windowmanager,
WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid);
wl_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid);
}
static inline void
wl_windowmanager_authenticate_with_token(struct wl_windowmanager *wl_windowmanager, const char *wl_authentication_token)
{
wl_proxy_marshal((struct wl_proxy *) wl_windowmanager,
wl_WINDOWMANAGER_AUTHENTICATE_WITH_TOKEN, wl_authentication_token);
}
#ifdef __cplusplus

View File

@ -68,12 +68,11 @@ struct wl_windowmanager *QWaylandWindowManagerIntegration::windowManager() const
return mWaylandWindowManager;
}
void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface,
uint32_t version, void *data)
void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data)
{
if (strcmp(interface, "wl_windowmanager") == 0) {
QWaylandWindowManagerIntegration *integration = static_cast<QWaylandWindowManagerIntegration *>(data);
integration->mWaylandWindowManager = wl_windowmanager_create(display,id, version);
integration->mWaylandWindowManager = wl_windowmanager_create(display, id);
}
}
@ -83,3 +82,11 @@ void QWaylandWindowManagerIntegration::mapClientToProcess(long long processId)
wl_windowmanager_map_client_to_process(mWaylandWindowManager, (uint32_t) processId);
}
void QWaylandWindowManagerIntegration::authenticateWithToken(const QByteArray &token)
{
QByteArray authToken = token;
if (authToken.isEmpty())
authToken = qgetenv("WL_AUTHENTICATION_TOKEN");
if (mWaylandWindowManager)
wl_windowmanager_authenticate_with_token(mWaylandWindowManager, authToken.constData());
}

View File

@ -56,6 +56,7 @@ public:
void mapSurfaceToProcess(struct wl_surface *surface, long long processId);
void mapClientToProcess(long long processId);
void authenticateWithToken(const QByteArray &token = QByteArray());
private:
static void wlHandleListenerGlobal(wl_display *display, uint32_t id,

View File

@ -26,7 +26,8 @@
#include "wayland-util.h"
static const struct wl_message wl_windowmanager_requests[] = {
{ "map_client_to_process", "u", NULL },
{ "map_client_to_process", "u" },
{ "authenticate_with_token", "s" },
};
WL_EXPORT const struct wl_interface wl_windowmanager_interface = {

View File

@ -1,6 +1,6 @@
TARGET = xcb
include(../../qpluginbase.pri)
load(qt_plugin)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
QT += core-private gui-private

View File

@ -1,6 +1,6 @@
TARGET = qxlib
include(../../qpluginbase.pri)
load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms
QT += core-private gui-private opengl-private

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