Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging
* 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging: (142 commits) ifdef out mac/no_coreservices path more cleanly fix build on symbian Allow different text for undo actions and items in QUndoView Allow using not only prefixes for undo command text QFileSystemEngine::currentPath(): use QFileSystemEntry() also for the no-PATH_MAX case Massively update the hurd-g++ mkspec. Do not allow multiple threads to acquire a QMutex Ensure that QDateTimeEdit::calendarWidget() will always return a valid widget. don't crash in QProcessEnvironment::systemEnvironment() HTTP backend: do not load resources from cache that must be revalidated Compile fix for QLocale on Symbian. Added Kazakh language to the QLocale mapping table on Symbian. Added support for QLocale::uiLanguages on Symbian. Fix drawing text in item view: Add enablers for Symbian App Booster Don't rely on uninitialized data Don't realloc user-provided buffer qmake: Introduce new template type Make autotest more resilient against network timeout (cherry picked from commit 50be38737507f5c23b4d050e635a200024164a13) Do not filter adhoc clients (cherry picked from commit 4fe5307af44a76b99cc8c70aa330180c1985eabc) ...
This commit is contained in:
commit
09d6bb0ebd
@ -238,11 +238,7 @@ if ($templatepkg =~ m/_installer\.pkg$/i && $onlyUnsigned) {
|
||||
my $unsigned_sis_name = $sisoutputbasename."_unsigned.sis";
|
||||
my $stub_sis_name = $sisoutputbasename.".sis";
|
||||
|
||||
# Store some utility variables
|
||||
my $scriptpath = dirname(__FILE__);
|
||||
my $certtext = $certificate;
|
||||
# certificates are one step up in hierarchy
|
||||
my $certpath = File::Spec->catdir($scriptpath, File::Spec->updir(), "src/s60installs/");
|
||||
|
||||
# Check some pre-conditions and print error messages if needed.
|
||||
unless (length($templatepkg)) {
|
||||
@ -265,6 +261,16 @@ if (length($certificate)) {
|
||||
}
|
||||
} else {
|
||||
#If no certificate is given, check default options
|
||||
my $scriptpath = dirname(__FILE__);
|
||||
my $certpath = File::Spec->catdir($scriptpath, File::Spec->updir(), "src/s60installs");
|
||||
|
||||
unless (-e $certpath) {
|
||||
my $qmakeCmd = File::Spec->catfile($scriptpath, "qmake");
|
||||
$certpath = `$qmakeCmd -query QT_INSTALL_PREFIX`;
|
||||
$certpath =~ s/\s+$//;
|
||||
$certpath = File::Spec->catdir($certpath, "src/s60installs");
|
||||
}
|
||||
|
||||
$certtext = "RnD";
|
||||
$certificate = File::Spec->catfile($certpath, "rd.cer");
|
||||
$key = File::Spec->catfile($certpath, "rd-key.pem");
|
||||
|
@ -38,10 +38,12 @@ loc.prf /epoc32/tools/qt/mkspecs/features/loc.prf
|
||||
//For UDA image
|
||||
confml/qt.confml CONFML_EXPORT_PATH(qt.confml,uda_content)
|
||||
implml/qt_copy.implml CRML_EXPORT_PATH(qt_copy.implml,uda_content)
|
||||
content/apps/qt.sisx CRML_EXPORT_PATH(../content/sis/,uda_content)
|
||||
content/apps/qt_stub.sis /epoc32/data/z/system/install/qt_stub.sis
|
||||
qt.sisx CRML_EXPORT_PATH(../content/sis/,uda_content)
|
||||
#endif
|
||||
|
||||
/* export stub sis to enable eclipsing */
|
||||
qt_stub.sis /epoc32/data/z/system/install/qt_stub.sis
|
||||
|
||||
//tools
|
||||
../../bin/createpackage.bat /epoc32/tools/createpackage.bat
|
||||
../../bin/createpackage.pl /epoc32/tools/createpackage.pl
|
||||
|
1
config.profiles/symbian/qt.sisx
Normal file
1
config.profiles/symbian/qt.sisx
Normal file
@ -0,0 +1 @@
|
||||
1
|
@ -15,56 +15,3 @@
|
||||
; Unique Vendor name
|
||||
:"Nokia, Qt"
|
||||
|
||||
; Dependencies of Qt libraries
|
||||
|
||||
"" - "z:\sys\bin\QtCore.dll"
|
||||
"" - "z:\sys\bin\QtXml.dll"
|
||||
"" - "z:\sys\bin\QtGui.dll"
|
||||
"" - "z:\sys\bin\QtNetwork.dll"
|
||||
"" - "z:\sys\bin\QtTest.dll"
|
||||
"" - "z:\sys\bin\QtSql.dll"
|
||||
"" - "z:\sys\bin\QtSvg.dll"
|
||||
"" - "z:\sys\bin\phonon.dll"
|
||||
"" - "z:\sys\bin\QtScript.dll"
|
||||
"" - "z:\sys\bin\QtXmlPatterns.dll"
|
||||
"" - "z:\sys\bin\QtDeclarative.dll"
|
||||
"" - "z:\sys\bin\QtOpenVG.dll"
|
||||
"" - "z:\sys\bin\QtOpenGL.dll"
|
||||
"" - "z:\sys\bin\QtMultimedia.dll"
|
||||
"" - "z:\private\10202D56\import\packages\2001E61C\backup_registration.xml"
|
||||
"" - "z:\sys\bin\qjpeg.dll"
|
||||
"" - "z:\resource\qt\plugins\imageformats\qjpeg.qtplugin"
|
||||
"" - "z:\sys\bin\qgif.dll"
|
||||
"" - "z:\resource\qt\plugins\imageformats\qgif.qtplugin"
|
||||
"" - "z:\sys\bin\qmng.dll"
|
||||
"" - "z:\resource\qt\plugins\imageformats\qmng.qtplugin"
|
||||
"" - "z:\sys\bin\qtiff.dll"
|
||||
"" - "z:\resource\qt\plugins\imageformats\qtiff.qtplugin"
|
||||
"" - "z:\sys\bin\qico.dll"
|
||||
"" - "z:\resource\qt\plugins\imageformats\qico.qtplugin"
|
||||
"" - "z:\sys\bin\qsvg.dll"
|
||||
"" - "z:\resource\qt\plugins\imageformats\qsvg.qtplugin"
|
||||
"" - "z:\sys\bin\qcncodecs.dll"
|
||||
"" - "z:\resource\qt\plugins\codecs\qcncodecs.qtplugin"
|
||||
"" - "z:\sys\bin\qjpcodecs.dll"
|
||||
"" - "z:\resource\qt\plugins\codecs\qjpcodecs.qtplugin"
|
||||
"" - "z:\sys\bin\qtwcodecs.dll"
|
||||
"" - "z:\resource\qt\plugins\codecs\qtwcodecs.qtplugin"
|
||||
"" - "z:\sys\bin\qkrcodecs.dll"
|
||||
"" - "z:\resource\qt\plugins\codecs\qkrcodecs.qtplugin"
|
||||
"" - "z:\sys\bin\qvggraphicssystem.dll"
|
||||
"" - "z:\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin"
|
||||
"" - "z:\sys\bin\qglgraphicssystem.dll"
|
||||
"" - "z:\resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin"
|
||||
"" - "z:\sys\bin\qsvgicon.dll"
|
||||
"" - "z:\resource\qt\plugins\iconengines\qsvgicon.qtplugin"
|
||||
"" - "z:\sys\bin\qmlfolderlistmodelplugin.dll"
|
||||
"" - "z:\resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin"
|
||||
"" - "z:\resource\qt\imports\Qt\labs\folderlistmodel\qmldir"
|
||||
"" - "z:\sys\bin\qmlgesturesplugin.dll"
|
||||
"" - "z:\resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin"
|
||||
"" - "z:\resource\qt\imports\Qt\labs\gestures\qmldir"
|
||||
"" - "z:\sys\bin\qmlparticlesplugin.dll"
|
||||
"" - "z:\resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin"
|
||||
"" - "z:\resource\qt\imports\Qt\labs\particles\qmldir"
|
||||
|
||||
|
BIN
config.profiles/symbian/qt_stub.sis
Normal file
BIN
config.profiles/symbian/qt_stub.sis
Normal file
Binary file not shown.
@ -86,38 +86,3 @@ beginMoveRows(parent, 2, 2, parent, 0);
|
||||
//! [9]
|
||||
beginMoveRows(parent, 2, 2, parent, 4);
|
||||
//! [9]
|
||||
|
||||
|
||||
//! [10]
|
||||
class CustomDataProxy : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CustomDataProxy(QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
...
|
||||
|
||||
QVariant data(const QModelIndex &index, int role)
|
||||
{
|
||||
if (role != Qt::BackgroundRole)
|
||||
return QSortFilterProxyModel::data(index, role);
|
||||
|
||||
if (m_customData.contains(index.row()))
|
||||
return m_customData.value(index.row());
|
||||
return QSortFilterProxyModel::data(index, role);
|
||||
}
|
||||
|
||||
private slots:
|
||||
void resetInternalData()
|
||||
{
|
||||
m_customData.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
QHash<int, QVariant> m_customData;
|
||||
};
|
||||
//! [10]
|
||||
|
||||
|
1
mkspecs/common/symbian/template.applite
Normal file
1
mkspecs/common/symbian/template.applite
Normal file
@ -0,0 +1 @@
|
||||
// This is an auto-generated lite registration file
|
@ -26,7 +26,11 @@ equals(GENERATE_SIS_TARGETS, true) {
|
||||
|
||||
qtPrepareTool(QMAKE_CREATEPACKAGE, createpackage)
|
||||
|
||||
CREATEPACKAGE_DIR = $$OBJECTS_DIR/createpackage_tmp
|
||||
sis_objects_dir = $$OBJECTS_DIR
|
||||
isEmpty(sis_objects_dir):sis_objects_dir = .
|
||||
|
||||
CREATEPACKAGE_DIR = $$sis_objects_dir/createpackage_tmp
|
||||
|
||||
QMAKE_CLEAN += $$CREATEPACKAGE_DIR/*
|
||||
|
||||
symbian-abld|symbian-sbsv2 {
|
||||
|
32
mkspecs/features/symbian/symbian_appbooster.prf
Normal file
32
mkspecs/features/symbian/symbian_appbooster.prf
Normal file
@ -0,0 +1,32 @@
|
||||
contains(TEMPLATE, ".*app") {
|
||||
baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET))
|
||||
|
||||
symbian-abld|symbian-sbsv2 {
|
||||
LITE_REG_TARGET = $$_PRO_FILE_PWD_
|
||||
} else {
|
||||
contains(DESTDIR, "/.*") {
|
||||
LITE_REG_TARGET = $$DESTDIR
|
||||
} else:isEmpty(DESTDIR) {
|
||||
LITE_REG_TARGET = $$OUT_PWD
|
||||
} else {
|
||||
LITE_REG_TARGET = $$OUT_PWD/$$DESTDIR
|
||||
}
|
||||
}
|
||||
|
||||
LITE_REG_TARGET = $${LITE_REG_TARGET}/$${baseTarget}.applite
|
||||
LITE_REG_TEMPLATE = $$[QT_INSTALL_DATA]/mkspecs/common/symbian/template.applite
|
||||
|
||||
lite_reg_copy.input = LITE_REG_TEMPLATE
|
||||
lite_reg_copy.output = $$LITE_REG_TARGET
|
||||
lite_reg_copy.variable_out = PRE_TARGETDEPS
|
||||
lite_reg_copy.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
|
||||
lite_reg_copy.CONFIG += no_link
|
||||
QMAKE_EXTRA_COMPILERS += lite_reg_copy
|
||||
|
||||
isEmpty(LITE_IMPORT_DIR): LITE_IMPORT_DIR = /private/20034884/import/apps
|
||||
lite_deployment.sources += $$LITE_REG_TARGET
|
||||
lite_deployment.path = $$LITE_IMPORT_DIR
|
||||
DEPLOYMENT += lite_deployment
|
||||
|
||||
LIBS += -lqDeclarativeBooster.dll
|
||||
}
|
@ -1,90 +1,74 @@
|
||||
#
|
||||
# qmake configuration for hurd-g++
|
||||
#
|
||||
# Submitted by uch@nop.or.jp as "gnu-g++".
|
||||
# Renamed to "hurd-g++" because people were confusing GNU/Hurd with GNU/Linux.
|
||||
#
|
||||
|
||||
MAKEFILE_GENERATOR = UNIX
|
||||
TARGET_PLATFORM = unix
|
||||
TEMPLATE = app
|
||||
CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index
|
||||
QT += core gui
|
||||
CONFIG += qt warn_on release link_prl
|
||||
QMAKE_INCREMENTAL_STYLE = sublib
|
||||
|
||||
QMAKE_CC = gcc
|
||||
QMAKE_LEX = flex
|
||||
QMAKE_LEXFLAGS =
|
||||
QMAKE_YACC = yacc
|
||||
QMAKE_YACCFLAGS = -d
|
||||
QMAKE_CFLAGS = -pipe
|
||||
QMAKE_CFLAGS_DEPS = -M
|
||||
QMAKE_CFLAGS_WARN_ON = -Wall -W
|
||||
QMAKE_CFLAGS_WARN_OFF = -w
|
||||
QMAKE_CFLAGS_RELEASE = -O2
|
||||
QMAKE_CFLAGS_DEBUG = -g
|
||||
QMAKE_CFLAGS_SHLIB = -fPIC
|
||||
QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB
|
||||
QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
|
||||
QMAKE_CFLAGS_THREAD = -D_REENTRANT
|
||||
QMAKE_CFLAGS_THREAD += -D_REENTRANT
|
||||
QMAKE_CXXFLAGS_THREAD += $$QMAKE_CFLAGS_THREAD
|
||||
|
||||
QMAKE_CXX = g++
|
||||
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
|
||||
QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS
|
||||
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
|
||||
QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
|
||||
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
|
||||
QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
|
||||
QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB
|
||||
QMAKE_CXXFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_STATIC_LIB
|
||||
QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
|
||||
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CXXFLAGS_THREAD
|
||||
QMAKE_INCDIR =
|
||||
QMAKE_LIBDIR =
|
||||
QMAKE_INCDIR_X11 = /usr/X11R6/include
|
||||
QMAKE_LIBDIR_X11 = /usr/X11R6/lib
|
||||
QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
|
||||
QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
|
||||
QMAKE_INCDIR_OPENGL = /usr/X11R6/include
|
||||
QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib
|
||||
QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_INCDIR_OPENGL
|
||||
QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL
|
||||
QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL
|
||||
QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL
|
||||
QMAKE_INCDIR_EGL =
|
||||
QMAKE_LIBDIR_EGL =
|
||||
QMAKE_INCDIR_OPENVG =
|
||||
QMAKE_LIBDIR_OPENVG =
|
||||
|
||||
QMAKE_INCDIR =
|
||||
QMAKE_LIBDIR =
|
||||
QMAKE_INCDIR_X11 = /usr/X11R6/include
|
||||
QMAKE_LIBDIR_X11 = /usr/X11R6/lib
|
||||
QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
|
||||
QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
|
||||
QMAKE_INCDIR_OPENGL = /usr/X11R6/include
|
||||
QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib
|
||||
QMAKE_LIBS =
|
||||
QMAKE_LIBS_DYNLOAD = -ldl
|
||||
QMAKE_LIBS_X11 = -lXext -lX11 -lm
|
||||
QMAKE_LIBS_X11SM = -lSM -lICE
|
||||
QMAKE_LIBS_NIS = -lnsl
|
||||
QMAKE_LIBS_EGL = -lEGL
|
||||
QMAKE_LIBS_OPENGL = -lGL
|
||||
QMAKE_LIBS_OPENGL_QT = -lGL
|
||||
QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM
|
||||
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
|
||||
QMAKE_LIBS_OPENVG = -lOpenVG
|
||||
QMAKE_LIBS_THREAD = -lpthread
|
||||
|
||||
QMAKE_LINK = g++
|
||||
QMAKE_LINK_SHLIB = g++
|
||||
QMAKE_LINK_C = gcc
|
||||
QMAKE_LINK_C_SHLIB = gcc
|
||||
QMAKE_LFLAGS = -Wl,-rpath=/lib:/usr/X11R6/lib:$$[QT_INSTALL_LIBS]
|
||||
QMAKE_LFLAGS_RELEASE =
|
||||
QMAKE_LFLAGS_DEBUG =
|
||||
QMAKE_LFLAGS_SHLIB = -shared
|
||||
QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
|
||||
QMAKE_LFLAGS_SONAME = -Wl,-soname,
|
||||
QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
|
||||
QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
|
||||
|
||||
QMAKE_LIBS = -lpthread # This is tricky but needed
|
||||
QMAKE_LIBS_DYNLOAD = -ldl
|
||||
QMAKE_LIBS_X11 = -lXext -lX11 -lm
|
||||
QMAKE_LIBS_X11SM = -lSM -lICE
|
||||
QMAKE_LIBS_NIS = -lnsl
|
||||
QMAKE_LIBS_QT_THREAD = -lqt-mt
|
||||
QMAKE_LIBS_THREAD =
|
||||
QMAKE_AR = ar cqs
|
||||
QMAKE_OBJCOPY = objcopy
|
||||
QMAKE_RANLIB =
|
||||
|
||||
QMAKE_LIBS_OPENGL = -lGL
|
||||
QMAKE_LIBS_OPENGL_QT = -lGL
|
||||
QMAKE_TAR = tar -cf
|
||||
QMAKE_GZIP = gzip -9f
|
||||
|
||||
QMAKE_MOC = $$[QT_INSTALL_BINS]/moc
|
||||
QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
|
||||
QMAKE_COPY = cp -f
|
||||
QMAKE_COPY_FILE = $(COPY)
|
||||
QMAKE_COPY_DIR = $(COPY) -r
|
||||
QMAKE_MOVE = mv -f
|
||||
QMAKE_DEL_FILE = rm -f
|
||||
QMAKE_DEL_DIR = rmdir
|
||||
QMAKE_STRIP = strip
|
||||
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
|
||||
QMAKE_CHK_DIR_EXISTS = test -d
|
||||
QMAKE_MKDIR = mkdir -p
|
||||
QMAKE_INSTALL_FILE = install -m 644 -p
|
||||
QMAKE_INSTALL_PROGRAM = install -m 755 -p
|
||||
|
||||
QMAKE_AR = ar cqs
|
||||
QMAKE_OBJCOPY = objcopy
|
||||
QMAKE_RANLIB =
|
||||
|
||||
QMAKE_TAR = tar -cf
|
||||
QMAKE_GZIP = gzip -9f
|
||||
|
||||
QMAKE_COPY = cp -f
|
||||
QMAKE_MOVE = mv -f
|
||||
QMAKE_DEL_FILE = rm -f
|
||||
QMAKE_DEL_DIR = rmdir
|
||||
QMAKE_CHK_DIR_EXISTS = test -d
|
||||
QMAKE_MKDIR = mkdir -p
|
||||
include(../common/unix.conf)
|
||||
include(../common/gcc-base-unix.conf)
|
||||
include(../common/g++-unix.conf)
|
||||
load(qt_config)
|
||||
|
||||
# This is tricky but needed
|
||||
QMAKE_LIBS += $$QMAKE_LIBS_THREAD
|
||||
|
@ -96,7 +96,8 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t)
|
||||
}
|
||||
|
||||
if (project->values("TEMPLATE").first() == "app" ||
|
||||
project->values("TEMPLATE").first() == "lib") {
|
||||
project->values("TEMPLATE").first() == "lib" ||
|
||||
project->values("TEMPLATE").first() == "aux") {
|
||||
if(Option::mkfile::do_stub_makefile && MakefileGenerator::writeStubMakefile(t))
|
||||
return true;
|
||||
writeMakeParts(t);
|
||||
@ -1017,6 +1018,9 @@ void UnixMakefileGenerator::init2()
|
||||
if(project->isEmpty("QMAKE_FRAMEWORK_VERSION"))
|
||||
project->values("QMAKE_FRAMEWORK_VERSION").append(project->values("VER_MAJ").first());
|
||||
|
||||
if (project->values("TEMPLATE").first() == "aux")
|
||||
return;
|
||||
|
||||
if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
|
||||
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
||||
QString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION");
|
||||
|
@ -68,7 +68,8 @@ BorlandMakefileGenerator::writeMakefile(QTextStream &t)
|
||||
}
|
||||
|
||||
if(project->first("TEMPLATE") == "app" ||
|
||||
project->first("TEMPLATE") == "lib") {
|
||||
project->first("TEMPLATE") == "lib" ||
|
||||
project->first("TEMPLATE") == "aux") {
|
||||
writeBorlandParts(t);
|
||||
return MakefileGenerator::writeMakefile(t);
|
||||
}
|
||||
@ -136,6 +137,11 @@ BorlandMakefileGenerator::init()
|
||||
|
||||
void BorlandMakefileGenerator::writeBuildRulesPart(QTextStream &t)
|
||||
{
|
||||
if (project->first("TEMPLATE") == "aux") {
|
||||
t << "first:" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
t << "first: all" << endl;
|
||||
t << "all: " << fileFixify(Option::output.fileName()) << " " << varGlue("ALL_DEPS"," "," "," ") << " $(DESTDIR_TARGET)" << endl << endl;
|
||||
t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS");
|
||||
|
@ -141,7 +141,8 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
|
||||
}
|
||||
|
||||
if(project->first("TEMPLATE") == "app" ||
|
||||
project->first("TEMPLATE") == "lib") {
|
||||
project->first("TEMPLATE") == "lib" ||
|
||||
project->first("TEMPLATE") == "aux") {
|
||||
if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
|
||||
writePkgConfigFile();
|
||||
|
||||
@ -436,6 +437,11 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
|
||||
|
||||
void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
|
||||
{
|
||||
if (project->first("TEMPLATE") == "aux") {
|
||||
t << "first:" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
t << "first: all" << endl;
|
||||
t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS"))," "," "," ") << " $(DESTDIR_TARGET)" << endl << endl;
|
||||
t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS");
|
||||
|
@ -70,7 +70,8 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
|
||||
}
|
||||
|
||||
if(project->first("TEMPLATE") == "app" ||
|
||||
project->first("TEMPLATE") == "lib") {
|
||||
project->first("TEMPLATE") == "lib" ||
|
||||
project->first("TEMPLATE") == "aux") {
|
||||
#if 0
|
||||
if(Option::mkfile::do_stub_makefile)
|
||||
return MakefileGenerator::writeStubMakefile(t);
|
||||
@ -341,6 +342,11 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
|
||||
|
||||
void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t)
|
||||
{
|
||||
if (project->first("TEMPLATE") == "aux") {
|
||||
t << "first:" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
t << "first: all" << endl;
|
||||
t << "all: " << fileFixify(Option::output.fileName()) << " " << varGlue("ALL_DEPS"," "," "," ") << "$(DESTDIR_TARGET)" << endl << endl;
|
||||
t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS");
|
||||
|
@ -655,6 +655,7 @@ void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength,
|
||||
const HB_ScriptItem *items, hb_uint32 numItems,
|
||||
HB_CharAttributes *attributes)
|
||||
{
|
||||
memset(attributes, 0, stringLength * sizeof(HB_CharAttributes));
|
||||
calcLineBreaks(string, stringLength, attributes);
|
||||
|
||||
for (hb_uint32 i = 0; i < numItems; ++i) {
|
||||
|
@ -115,19 +115,7 @@ ThreadEngineStarter<void> filterInternal(Sequence &sequence, KeepFunctor keep, T
|
||||
template <typename Sequence, typename KeepFunctor>
|
||||
QFuture<void> filter(Sequence &sequence, KeepFunctor keep)
|
||||
{
|
||||
return filterInternal(sequence, keep, &Sequence::push_back);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
QFuture<void> filter(Sequence &sequence, bool (keep)(T))
|
||||
{
|
||||
return filterInternal(sequence, FunctionWrapper1<bool, T>(keep), &Sequence::push_back);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename C>
|
||||
QFuture<void> filter(Sequence &sequence, bool (C::*keep)() const)
|
||||
{
|
||||
return filterInternal(sequence, ConstMemberFunctionWrapper<bool, C>(keep), &Sequence::push_back);
|
||||
return filterInternal(sequence, QtPrivate::createFunctionWrapper(keep), &Sequence::push_back);
|
||||
}
|
||||
|
||||
// filteredReduced() on sequences
|
||||
@ -137,103 +125,20 @@ QFuture<ResultType> filteredReduced(const Sequence &sequence,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startFilteredReduced<ResultType>(sequence, keep, reduce, options);
|
||||
}
|
||||
return startFilteredReduced<ResultType>(sequence, QtPrivate::createFunctionWrapper(keep), QtPrivate::createFunctionWrapper(reduce), options);
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Sequence, typename T, typename ReduceFunctor>
|
||||
QFuture<ResultType> filteredReduced(const Sequence &sequence,
|
||||
bool (filter)(T),
|
||||
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor>
|
||||
QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> filteredReduced(const Sequence &sequence,
|
||||
KeepFunctor keep,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<ResultType>(sequence,
|
||||
FunctionWrapper1<bool, T>(filter),
|
||||
reduce,
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Sequence, typename C, typename ReduceFunctor>
|
||||
QFuture<ResultType> filteredReduced(const Sequence &sequence,
|
||||
bool (C::*filter)() const,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<ResultType>(sequence,
|
||||
ConstMemberFunctionWrapper<bool, C>(filter),
|
||||
reduce,
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename KeepFunctor, typename T, typename U, typename V>
|
||||
QFuture<U> filteredReduced(const Sequence &sequence,
|
||||
KeepFunctor keep,
|
||||
T (reduce)(U &, V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<U>(sequence,
|
||||
keep,
|
||||
FunctionWrapper2<T, U &, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename KeepFunctor, typename T, typename C, typename U>
|
||||
QFuture<C> filteredReduced(const Sequence &sequence,
|
||||
KeepFunctor keep,
|
||||
T (C::*reduce)(U),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<C>(sequence,
|
||||
keep,
|
||||
MemberFunctionWrapper1<T, C, U>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename U, typename V, typename W>
|
||||
QFuture<V> filteredReduced(const Sequence &sequence,
|
||||
bool (keep)(T),
|
||||
U (reduce)(V &, W),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<V>(sequence,
|
||||
FunctionWrapper1<bool, T>(keep),
|
||||
FunctionWrapper2<U, V &, W>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename C, typename T, typename U, typename V>
|
||||
QFuture<U> filteredReduced(const Sequence &sequence,
|
||||
bool (C::*keep)() const,
|
||||
T (reduce)(U &, V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<U>(sequence,
|
||||
ConstMemberFunctionWrapper<bool, C>(keep),
|
||||
FunctionWrapper2<T, U &, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename U, typename C, typename V>
|
||||
QFuture<C> filteredReduced(const Sequence &sequence,
|
||||
bool (keep)(T),
|
||||
U (C::*reduce)(V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<C>(sequence,
|
||||
FunctionWrapper1<bool, T>(keep),
|
||||
MemberFunctionWrapper1<U, C, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename C, typename T, typename D, typename U>
|
||||
QFuture<D> filteredReduced(const Sequence &sequence,
|
||||
bool (C::*keep)() const,
|
||||
T (D::*reduce)(U),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<D>(sequence,
|
||||
ConstMemberFunctionWrapper<bool, C>(keep),
|
||||
MemberFunctionWrapper1<T, D, U>(reduce),
|
||||
options);
|
||||
return startFilteredReduced<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
|
||||
(sequence,
|
||||
QtPrivate::createFunctionWrapper(keep),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
// filteredReduced() on iterators
|
||||
@ -244,184 +149,42 @@ QFuture<ResultType> filteredReduced(Iterator begin,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startFilteredReduced<ResultType>(begin, end, keep, reduce, options);
|
||||
return startFilteredReduced<ResultType>(begin, end, QtPrivate::createFunctionWrapper(keep), QtPrivate::createFunctionWrapper(reduce), options);
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Iterator, typename T, typename ReduceFunctor>
|
||||
QFuture<ResultType> filteredReduced(Iterator begin,
|
||||
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor>
|
||||
QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> filteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (filter)(T),
|
||||
KeepFunctor keep,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<ResultType>(begin,
|
||||
end,
|
||||
FunctionWrapper1<bool, T>(filter),
|
||||
reduce,
|
||||
options);
|
||||
return startFilteredReduced<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
|
||||
(begin, end,
|
||||
QtPrivate::createFunctionWrapper(keep),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Iterator, typename C, typename ReduceFunctor>
|
||||
QFuture<ResultType> filteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (C::*filter)() const,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<ResultType>(begin,
|
||||
end,
|
||||
ConstMemberFunctionWrapper<bool, C>(filter),
|
||||
reduce,
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename KeepFunctor, typename T, typename U, typename V>
|
||||
QFuture<U> filteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
KeepFunctor keep,
|
||||
T (reduce)(U &, V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<U>(begin,
|
||||
end,
|
||||
keep,
|
||||
FunctionWrapper2<T, U &, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename KeepFunctor, typename T, typename C, typename U>
|
||||
QFuture<C> filteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
KeepFunctor keep,
|
||||
T (C::*reduce)(U),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<C>(begin,
|
||||
end,
|
||||
keep,
|
||||
MemberFunctionWrapper1<T, C, U>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename U, typename V, typename W>
|
||||
QFuture<V> filteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (keep)(T),
|
||||
U (reduce)(V &, W),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<V>(begin,
|
||||
end,
|
||||
FunctionWrapper1<bool, T>(keep),
|
||||
FunctionWrapper2<U, V &, W>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename C, typename T, typename U, typename V>
|
||||
QFuture<U> filteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (C::*keep)() const,
|
||||
T (reduce)(U &, V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<U>(begin,
|
||||
end,
|
||||
ConstMemberFunctionWrapper<bool, C>(keep),
|
||||
FunctionWrapper2<T, U &, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename U, typename C, typename V>
|
||||
QFuture<C> filteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (keep)(T),
|
||||
U (C::*reduce)(V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<C>(begin,
|
||||
end,
|
||||
FunctionWrapper1<bool, T>(keep),
|
||||
MemberFunctionWrapper1<U, C, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename C, typename T, typename D, typename U>
|
||||
QFuture<D> filteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (C::*keep)() const,
|
||||
T (D::*reduce)(U),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return filteredReduced<D>(begin,
|
||||
end,
|
||||
ConstMemberFunctionWrapper<bool, C>(keep),
|
||||
MemberFunctionWrapper1<T, D, U>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
// filtered() on sequences
|
||||
template <typename Sequence, typename KeepFunctor>
|
||||
QFuture<typename Sequence::value_type> filtered(const Sequence &sequence, KeepFunctor keep)
|
||||
{
|
||||
return startFiltered(sequence, keep);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
QFuture<typename Sequence::value_type> filtered(const Sequence &sequence, bool (keep)(T))
|
||||
{
|
||||
return startFiltered(sequence, FunctionWrapper1<bool, T>(keep));
|
||||
}
|
||||
|
||||
template <typename Sequence, typename C>
|
||||
QFuture<typename Sequence::value_type> filtered(const Sequence &sequence, bool (C::*keep)() const)
|
||||
{
|
||||
return startFiltered(sequence, ConstMemberFunctionWrapper<bool, C>(keep));
|
||||
return startFiltered(sequence, QtPrivate::createFunctionWrapper(keep));
|
||||
}
|
||||
|
||||
// filtered() on iterators
|
||||
template <typename Iterator, typename KeepFunctor>
|
||||
QFuture<typename qValueType<Iterator>::value_type> filtered(Iterator begin, Iterator end, KeepFunctor keep)
|
||||
{
|
||||
return startFiltered(begin, end, keep);
|
||||
return startFiltered(begin, end, QtPrivate::createFunctionWrapper(keep));
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T>
|
||||
QFuture<typename qValueType<Iterator>::value_type> filtered(Iterator begin, Iterator end, bool (keep)(T))
|
||||
{
|
||||
return startFiltered(begin, end, FunctionWrapper1<bool, T>(keep));
|
||||
}
|
||||
|
||||
template <typename Iterator, typename C>
|
||||
QFuture<typename qValueType<Iterator>::value_type> filtered(Iterator begin,
|
||||
Iterator end,
|
||||
bool (C::*keep)() const)
|
||||
{
|
||||
return startFiltered(begin, end, ConstMemberFunctionWrapper<bool, C>(keep));
|
||||
}
|
||||
|
||||
|
||||
// blocking filter() on sequences
|
||||
template <typename Sequence, typename KeepFunctor>
|
||||
void blockingFilter(Sequence &sequence, KeepFunctor keep)
|
||||
{
|
||||
filterInternal(sequence, keep, &Sequence::push_back).startBlocking();
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
void blockingFilter(Sequence &sequence, bool (keep)(T))
|
||||
{
|
||||
filterInternal(sequence, FunctionWrapper1<bool, T>(keep), &Sequence::push_back)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename Sequence, typename C>
|
||||
void blockingFilter(Sequence &sequence, bool (C::*keep)() const)
|
||||
{
|
||||
filterInternal(sequence,
|
||||
ConstMemberFunctionWrapper<bool, C>(keep),
|
||||
&Sequence::push_back)
|
||||
.startBlocking();
|
||||
filterInternal(sequence, QtPrivate::createFunctionWrapper(keep), &Sequence::push_back).startBlocking();
|
||||
}
|
||||
|
||||
// blocking filteredReduced() on sequences
|
||||
@ -431,111 +194,20 @@ ResultType blockingFilteredReduced(const Sequence &sequence,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startFilteredReduced<ResultType>(sequence, keep, reduce, options)
|
||||
return startFilteredReduced<ResultType>(sequence, QtPrivate::createFunctionWrapper(keep), QtPrivate::createFunctionWrapper(reduce), options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Sequence, typename T, typename ReduceFunctor>
|
||||
ResultType blockingFilteredReduced(const Sequence &sequence,
|
||||
bool (filter)(T),
|
||||
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor>
|
||||
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingFilteredReduced(const Sequence &sequence,
|
||||
KeepFunctor keep,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<ResultType>
|
||||
return blockingFilteredReduced<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
|
||||
(sequence,
|
||||
FunctionWrapper1<bool, T>(filter),
|
||||
reduce,
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Sequence, typename C, typename ReduceFunctor>
|
||||
ResultType blockingFilteredReduced(const Sequence &sequence,
|
||||
bool (C::*filter)() const,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<ResultType>
|
||||
(sequence,
|
||||
ConstMemberFunctionWrapper<bool, C>(filter),
|
||||
reduce,
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename KeepFunctor, typename T, typename U, typename V>
|
||||
U blockingFilteredReduced(const Sequence &sequence,
|
||||
KeepFunctor keep,
|
||||
T (reduce)(U &, V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<U>
|
||||
(sequence,
|
||||
keep,
|
||||
FunctionWrapper2<T, U &, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename KeepFunctor, typename T, typename C, typename U>
|
||||
C blockingFilteredReduced(const Sequence &sequence,
|
||||
KeepFunctor keep,
|
||||
T (C::*reduce)(U),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<C>
|
||||
(sequence,
|
||||
keep,
|
||||
MemberFunctionWrapper1<T, C, U>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename U, typename V, typename W>
|
||||
V blockingFilteredReduced(const Sequence &sequence,
|
||||
bool (keep)(T),
|
||||
U (reduce)(V &, W),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<V>
|
||||
(sequence,
|
||||
FunctionWrapper1<bool, T>(keep),
|
||||
FunctionWrapper2<U, V &, W>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename C, typename T, typename U, typename V>
|
||||
U blockingFilteredReduced(const Sequence &sequence,
|
||||
bool (C::*keep)() const,
|
||||
T (reduce)(U &, V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<U>
|
||||
(sequence,
|
||||
ConstMemberFunctionWrapper<bool, C>(keep),
|
||||
FunctionWrapper2<T, U &, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename U, typename C, typename V>
|
||||
C blockingFilteredReduced(const Sequence &sequence,
|
||||
bool (keep)(T),
|
||||
U (C::*reduce)(V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<C>
|
||||
(sequence,
|
||||
FunctionWrapper1<bool, T>(keep),
|
||||
MemberFunctionWrapper1<U, C, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename C, typename T, typename D, typename U>
|
||||
D blockingFilteredReduced(const Sequence &sequence,
|
||||
bool (C::*keep)() const,
|
||||
T (D::*reduce)(U),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<D>
|
||||
(sequence,
|
||||
ConstMemberFunctionWrapper<bool, C>(keep),
|
||||
MemberFunctionWrapper1<T, D, U>(reduce),
|
||||
QtPrivate::createFunctionWrapper(keep),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
@ -547,150 +219,34 @@ ResultType blockingFilteredReduced(Iterator begin,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startFilteredReduced<ResultType>(begin, end, keep, reduce, options)
|
||||
return startFilteredReduced<ResultType>
|
||||
(begin, end,
|
||||
QtPrivate::createFunctionWrapper(keep),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Iterator, typename T, typename ReduceFunctor>
|
||||
ResultType blockingFilteredReduced(Iterator begin,
|
||||
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor>
|
||||
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingFilteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (filter)(T),
|
||||
KeepFunctor keep,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<ResultType>
|
||||
(begin,
|
||||
end,
|
||||
FunctionWrapper1<bool, T>(filter),
|
||||
reduce,
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Iterator, typename C, typename ReduceFunctor>
|
||||
ResultType blockingFilteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (C::*filter)() const,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<ResultType>
|
||||
(begin,
|
||||
end,
|
||||
ConstMemberFunctionWrapper<bool, C>(filter),
|
||||
reduce,
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename KeepFunctor, typename T, typename U, typename V>
|
||||
U blockingFilteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
KeepFunctor keep,
|
||||
T (reduce)(U &, V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<U>
|
||||
(begin,
|
||||
end,
|
||||
keep,
|
||||
FunctionWrapper2<T, U &, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename KeepFunctor, typename T, typename C, typename U>
|
||||
C blockingFilteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
KeepFunctor keep,
|
||||
T (C::*reduce)(U),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<C>
|
||||
(begin,
|
||||
end,
|
||||
keep,
|
||||
MemberFunctionWrapper1<T, C, U>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename U, typename V, typename W>
|
||||
V blockingFilteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (keep)(T),
|
||||
U (reduce)(V &, W),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<V>
|
||||
(begin,
|
||||
end,
|
||||
FunctionWrapper1<bool, T>(keep),
|
||||
FunctionWrapper2<U, V &, W>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename C, typename T, typename U, typename V>
|
||||
U blockingFilteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (C::*keep)() const,
|
||||
T (reduce)(U &, V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<U>
|
||||
(begin,
|
||||
end,
|
||||
ConstMemberFunctionWrapper<bool, C>(keep),
|
||||
FunctionWrapper2<T, U &, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename U, typename C, typename V>
|
||||
C blockingFilteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (keep)(T),
|
||||
U (C::*reduce)(V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<C>
|
||||
(begin,
|
||||
end,
|
||||
FunctionWrapper1<bool, T>(keep),
|
||||
MemberFunctionWrapper1<U, C, V>(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename C, typename T, typename D, typename U>
|
||||
D blockingFilteredReduced(Iterator begin,
|
||||
Iterator end,
|
||||
bool (C::*keep)() const,
|
||||
T (D::*reduce)(U),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return blockingFilteredReduced<D>
|
||||
(begin,
|
||||
end,
|
||||
ConstMemberFunctionWrapper<bool, C>(keep),
|
||||
MemberFunctionWrapper1<T, D, U>(reduce),
|
||||
options);
|
||||
return startFilteredReduced<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
|
||||
(begin, end,
|
||||
QtPrivate::createFunctionWrapper(keep),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
// blocking filtered() on sequences
|
||||
template <typename Sequence, typename KeepFunctor>
|
||||
Sequence blockingFiltered(const Sequence &sequence, KeepFunctor keep)
|
||||
{
|
||||
return blockingFilteredReduced(sequence, keep, &Sequence::push_back, OrderedReduce);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
Sequence blockingFiltered(const Sequence &sequence, bool (keep)(T))
|
||||
{
|
||||
return blockingFilteredReduced(sequence, keep, &Sequence::push_back, OrderedReduce);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename C>
|
||||
Sequence blockingFiltered(const Sequence &sequence, bool (C::*filter)() const)
|
||||
{
|
||||
return blockingFilteredReduced(sequence,
|
||||
filter,
|
||||
&Sequence::push_back,
|
||||
OrderedReduce);
|
||||
return blockingFilteredReduced(sequence, QtPrivate::createFunctionWrapper(keep), &Sequence::push_back, OrderedReduce);
|
||||
}
|
||||
|
||||
// blocking filtered() on iterators
|
||||
@ -699,27 +255,7 @@ OutputSequence blockingFiltered(Iterator begin, Iterator end, KeepFunctor keep)
|
||||
{
|
||||
return blockingFilteredReduced(begin,
|
||||
end,
|
||||
keep,
|
||||
&OutputSequence::push_back,
|
||||
OrderedReduce);
|
||||
}
|
||||
|
||||
template <typename OutputSequence, typename Iterator, typename T>
|
||||
OutputSequence blockingFiltered(Iterator begin, Iterator end, bool (keep)(T))
|
||||
{
|
||||
return blockingFilteredReduced(begin,
|
||||
end,
|
||||
keep,
|
||||
&OutputSequence::push_back,
|
||||
OrderedReduce);
|
||||
}
|
||||
|
||||
template <typename OutputSequence, typename Iterator, typename C>
|
||||
OutputSequence blockingFiltered(Iterator begin, Iterator end, bool (C::*filter)() const)
|
||||
{
|
||||
return blockingFilteredReduced(begin,
|
||||
end,
|
||||
filter,
|
||||
QtPrivate::createFunctionWrapper(keep),
|
||||
&OutputSequence::push_back,
|
||||
OrderedReduce);
|
||||
}
|
||||
|
@ -163,6 +163,125 @@ private:
|
||||
|
||||
} // namespace QtConcurrent.
|
||||
|
||||
namespace QtPrivate {
|
||||
|
||||
template <typename T>
|
||||
const T& createFunctionWrapper(const T& t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
QtConcurrent::FunctionWrapper1<T, U> createFunctionWrapper(T (*func)(U))
|
||||
{
|
||||
return QtConcurrent::FunctionWrapper1<T, U>(func);
|
||||
}
|
||||
|
||||
template <typename T, typename C>
|
||||
QtConcurrent::MemberFunctionWrapper<T, C> createFunctionWrapper(T (C::*func)())
|
||||
{
|
||||
return QtConcurrent::MemberFunctionWrapper<T, C>(func);
|
||||
}
|
||||
|
||||
template <typename T, typename C, typename U>
|
||||
QtConcurrent::MemberFunctionWrapper1<T, C, U> createFunctionWrapper(T (C::*func)(U))
|
||||
{
|
||||
return QtConcurrent::MemberFunctionWrapper1<T, C, U>(func);
|
||||
}
|
||||
|
||||
template <typename T, typename C>
|
||||
QtConcurrent::ConstMemberFunctionWrapper<T, C> createFunctionWrapper(T (C::*func)() const)
|
||||
{
|
||||
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*)>
|
||||
struct LazyResultType { typedef typename Functor::result_type Type; };
|
||||
template <typename Functor>
|
||||
struct LazyResultType<Functor, true> { typedef void Type; };
|
||||
|
||||
|
||||
template <class T>
|
||||
struct ReduceResultType;
|
||||
|
||||
template <class U, class V>
|
||||
struct ReduceResultType<void(*)(U&,V)>
|
||||
{
|
||||
typedef U ResultType;
|
||||
};
|
||||
|
||||
template <class T, class C, class U>
|
||||
struct ReduceResultType<T(C::*)(U)>
|
||||
{
|
||||
typedef C ResultType;
|
||||
};
|
||||
|
||||
template <class InputSequence, class MapFunctor>
|
||||
struct MapResultType
|
||||
{
|
||||
typedef typename LazyResultType<MapFunctor>::Type ResultType;
|
||||
};
|
||||
|
||||
template <class U, class V>
|
||||
struct MapResultType<void, U (*)(V)>
|
||||
{
|
||||
typedef U ResultType;
|
||||
};
|
||||
|
||||
template <class T, class C>
|
||||
struct MapResultType<void, T(C::*)() const>
|
||||
{
|
||||
typedef T ResultType;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
|
||||
|
||||
template <template <typename> class InputSequence, typename MapFunctor, typename T>
|
||||
struct MapResultType<InputSequence<T>, MapFunctor>
|
||||
{
|
||||
typedef InputSequence<typename LazyResultType<MapFunctor>::Type> ResultType;
|
||||
};
|
||||
|
||||
template <template <typename> class InputSequence, class T, class U, class V>
|
||||
struct MapResultType<InputSequence<T>, U (*)(V)>
|
||||
{
|
||||
typedef InputSequence<U> ResultType;
|
||||
};
|
||||
|
||||
template <template <typename> class InputSequence, class T, class U, class C>
|
||||
struct MapResultType<InputSequence<T>, U(C::*)() const>
|
||||
{
|
||||
typedef InputSequence<U> ResultType;
|
||||
};
|
||||
|
||||
#endif // QT_NO_TEMPLATE_TEMPLATE_PARAMETER
|
||||
|
||||
template <class MapFunctor>
|
||||
struct MapResultType<QStringList, MapFunctor>
|
||||
{
|
||||
typedef QList<typename LazyResultType<MapFunctor>::Type> ResultType;
|
||||
};
|
||||
|
||||
template <class U, class V>
|
||||
struct MapResultType<QStringList, U (*)(V)>
|
||||
{
|
||||
typedef QList<U> ResultType;
|
||||
};
|
||||
|
||||
template <class U, class C>
|
||||
struct MapResultType<QStringList, U(C::*)() const>
|
||||
{
|
||||
typedef QList<U> ResultType;
|
||||
};
|
||||
|
||||
} // namespace QtPrivate.
|
||||
|
||||
#endif //qdoc
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -110,38 +110,14 @@ namespace QtConcurrent {
|
||||
template <typename Sequence, typename MapFunctor>
|
||||
QFuture<void> map(Sequence &sequence, MapFunctor map)
|
||||
{
|
||||
return startMap(sequence.begin(), sequence.end(), map);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename U>
|
||||
QFuture<void> map(Sequence &sequence, T (map)(U))
|
||||
{
|
||||
return startMap(sequence.begin(), sequence.end(), FunctionWrapper1<T, U>(map));
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename C>
|
||||
QFuture<void> map(Sequence &sequence, T (C::*map)())
|
||||
{
|
||||
return startMap(sequence.begin(), sequence.end(), MemberFunctionWrapper<T, C>(map));
|
||||
return startMap(sequence.begin(), sequence.end(), QtPrivate::createFunctionWrapper(map));
|
||||
}
|
||||
|
||||
// map() on iterators
|
||||
template <typename Iterator, typename MapFunctor>
|
||||
QFuture<void> map(Iterator begin, Iterator end, MapFunctor map)
|
||||
{
|
||||
return startMap(begin, end, map);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename U>
|
||||
QFuture<void> map(Iterator begin, Iterator end, T (map)(U))
|
||||
{
|
||||
return startMap(begin, end, FunctionWrapper1<T, U>(map));
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename C>
|
||||
QFuture<void> map(Iterator begin, Iterator end, T (C::*map)())
|
||||
{
|
||||
return startMap(begin, end, MemberFunctionWrapper<T, C>(map));
|
||||
return startMap(begin, end, QtPrivate::createFunctionWrapper(map));
|
||||
}
|
||||
|
||||
// mappedReduced() for sequences.
|
||||
@ -151,88 +127,24 @@ QFuture<ResultType> mappedReduced(const Sequence &sequence,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<typename MapFunctor::result_type, ResultType>
|
||||
(sequence, map, reduce, options);
|
||||
return startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, ResultType>
|
||||
(sequence,
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename MapFunctor, typename T, typename U, typename V>
|
||||
QFuture<U> mappedReduced(const Sequence &sequence,
|
||||
MapFunctor map,
|
||||
T (reduce)(U &, V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<typename MapFunctor::result_type, U>
|
||||
(sequence, map, FunctionWrapper2<T, U &, V>(reduce), options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename MapFunctor, typename T, typename C, typename U>
|
||||
QFuture<C> mappedReduced(const Sequence &sequence,
|
||||
MapFunctor map,
|
||||
T (C::*reduce)(U),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<typename MapFunctor::result_type, C>
|
||||
(sequence, map, MemberFunctionWrapper1<T, C, U>(reduce), options);
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Sequence, typename T, typename U, typename ReduceFunctor>
|
||||
QFuture<ResultType> mappedReduced(const Sequence &sequence,
|
||||
T (map)(U),
|
||||
template <typename Sequence, typename MapFunctor, typename ReduceFunctor>
|
||||
QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> mappedReduced(const Sequence &sequence,
|
||||
MapFunctor map,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, ResultType>
|
||||
(sequence, FunctionWrapper1<T, U>(map), reduce, options);
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Sequence, typename T, typename C, typename ReduceFunctor>
|
||||
QFuture<ResultType> mappedReduced(const Sequence &sequence,
|
||||
T (C::*map)() const,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, ResultType>
|
||||
(sequence, ConstMemberFunctionWrapper<T, C>(map), reduce, options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename U, typename V, typename W, typename X>
|
||||
QFuture<W> mappedReduced(const Sequence &sequence,
|
||||
T (map)(U),
|
||||
V (reduce)(W &, X),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, W>
|
||||
(sequence, FunctionWrapper1<T, U>(map), FunctionWrapper2<V, W &, X>(reduce), options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename C, typename U, typename V, typename W>
|
||||
QFuture<V> mappedReduced(const Sequence &sequence,
|
||||
T (C::*map)() const,
|
||||
U (reduce)(V &, W),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, V> (sequence, ConstMemberFunctionWrapper<T, C>(map),
|
||||
FunctionWrapper2<U, V &, W>(reduce), options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename U, typename V, typename C, typename W>
|
||||
QFuture<C> mappedReduced(const Sequence &sequence,
|
||||
T (map)(U),
|
||||
V (C::*reduce)(W),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, C> (sequence, FunctionWrapper1<T, U>(map),
|
||||
MemberFunctionWrapper1<V, C, W>(reduce), options);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename C, typename U,typename D, typename V>
|
||||
QFuture<D> mappedReduced(const Sequence &sequence,
|
||||
T (C::*map)() const,
|
||||
U (D::*reduce)(V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, D>(sequence, ConstMemberFunctionWrapper<T, C>(map),
|
||||
MemberFunctionWrapper1<U, D, V>(reduce), options);
|
||||
return startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
|
||||
(sequence,
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
// mappedReduced() for iterators
|
||||
@ -243,295 +155,85 @@ QFuture<ResultType> mappedReduced(Iterator begin,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<ResultType, typename MapFunctor::result_type>
|
||||
(begin, end, map, reduce, options);
|
||||
return startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, ResultType>
|
||||
(begin, end,
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename MapFunctor, typename T, typename U, typename V>
|
||||
QFuture<U> mappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
MapFunctor map,
|
||||
T (reduce)(U &, V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<typename MapFunctor::result_type, U>
|
||||
(begin, end, map, FunctionWrapper2<T, U &, V>(reduce), options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename MapFunctor, typename T, typename C, typename U>
|
||||
QFuture<C> mappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
MapFunctor map,
|
||||
T (C::*reduce)(U),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<typename MapFunctor::result_type, C>
|
||||
(begin, end, map, MemberFunctionWrapper1<T, C, U>(reduce), options);
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Iterator, typename T, typename U, typename ReduceFunctor>
|
||||
QFuture<ResultType> mappedReduced(Iterator begin,
|
||||
template <typename Iterator, typename MapFunctor, typename ReduceFunctor>
|
||||
QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> mappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (map)(U),
|
||||
MapFunctor map,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, ResultType>
|
||||
(begin, end, FunctionWrapper1<T, U>(map), reduce, options);
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Iterator, typename T, typename C, typename ReduceFunctor>
|
||||
QFuture<ResultType> mappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (C::*map)() const,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, ResultType>
|
||||
(begin, end, ConstMemberFunctionWrapper<T, C>(map), reduce, options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename U, typename V, typename W, typename X>
|
||||
QFuture<W> mappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (map)(U),
|
||||
V (reduce)(W &, X),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, W>
|
||||
(begin, end, FunctionWrapper1<T, U>(map), FunctionWrapper2<V, W &, X>(reduce), options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename C, typename U, typename V, typename W>
|
||||
QFuture<V> mappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (C::*map)() const,
|
||||
U (reduce)(V &, W),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, V>(begin, end, ConstMemberFunctionWrapper<T, C>(map),
|
||||
FunctionWrapper2<U, V &, W>(reduce), options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename U, typename V, typename C, typename W>
|
||||
QFuture<C> mappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (map)(U),
|
||||
V (C::*reduce)(W),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, C>
|
||||
(begin, end, FunctionWrapper1<T, U>(map), MemberFunctionWrapper1<V, C, W>(reduce), options);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename C, typename U,typename D, typename V>
|
||||
QFuture<D> mappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (C::*map)() const,
|
||||
U (D::*reduce)(V),
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return startMappedReduced<T, D>(begin, end, ConstMemberFunctionWrapper<T, C>(map),
|
||||
MemberFunctionWrapper1<U, D, V>(reduce), options);
|
||||
return startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
|
||||
(begin, end,
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options);
|
||||
}
|
||||
|
||||
// mapped() for sequences
|
||||
template <typename Sequence, typename MapFunctor>
|
||||
QFuture<typename MapFunctor::result_type> mapped(const Sequence &sequence, MapFunctor map)
|
||||
QFuture<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType> mapped(const Sequence &sequence, MapFunctor map)
|
||||
{
|
||||
return startMapped<typename MapFunctor::result_type>(sequence, map);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename U>
|
||||
QFuture<T> mapped(const Sequence &sequence, T (map)(U))
|
||||
{
|
||||
return startMapped<T>(sequence, FunctionWrapper1<T, U>(map));
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename C>
|
||||
QFuture<T> mapped(const Sequence &sequence, T (C::*map)() const)
|
||||
{
|
||||
return startMapped<T>(sequence, ConstMemberFunctionWrapper<T, C>(map));
|
||||
return startMapped<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType>(sequence, QtPrivate::createFunctionWrapper(map));
|
||||
}
|
||||
|
||||
// mapped() for iterator ranges.
|
||||
template <typename Iterator, typename MapFunctor>
|
||||
QFuture<typename MapFunctor::result_type> mapped(Iterator begin, Iterator end, MapFunctor map)
|
||||
QFuture<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType> mapped(Iterator begin, Iterator end, MapFunctor map)
|
||||
{
|
||||
return startMapped<Q_TYPENAME MapFunctor::result_type>(begin, end, map);
|
||||
return startMapped<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType>(begin, end, QtPrivate::createFunctionWrapper(map));
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename U>
|
||||
QFuture<T> mapped(Iterator begin, Iterator end, T (map)(U))
|
||||
{
|
||||
return startMapped<T>(begin, end, FunctionWrapper1<T, U>(map));
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename C>
|
||||
QFuture<T> mapped(Iterator begin, Iterator end, T (C::*map)() const)
|
||||
{
|
||||
return startMapped<T>(begin, end, ConstMemberFunctionWrapper<T, C>(map));
|
||||
}
|
||||
|
||||
|
||||
// blockingMap() for sequences
|
||||
template <typename Sequence, typename MapFunctor>
|
||||
void blockingMap(Sequence &sequence, MapFunctor map)
|
||||
{
|
||||
startMap(sequence.begin(), sequence.end(), map).startBlocking();
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename U>
|
||||
void blockingMap(Sequence &sequence, T (map)(U))
|
||||
{
|
||||
startMap(sequence.begin(), sequence.end(), QtConcurrent::FunctionWrapper1<T, U>(map)).startBlocking();
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename C>
|
||||
void blockingMap(Sequence &sequence, T (C::*map)())
|
||||
{
|
||||
startMap(sequence.begin(), sequence.end(), QtConcurrent::MemberFunctionWrapper<T, C>(map)).startBlocking();
|
||||
startMap(sequence.begin(), sequence.end(), QtPrivate::createFunctionWrapper(map)).startBlocking();
|
||||
}
|
||||
|
||||
// blockingMap() for iterator ranges
|
||||
template <typename Iterator, typename MapFunctor>
|
||||
void blockingMap(Iterator begin, Iterator end, MapFunctor map)
|
||||
{
|
||||
startMap(begin, end, map).startBlocking();
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename U>
|
||||
void blockingMap(Iterator begin, Iterator end, T (map)(U))
|
||||
{
|
||||
startMap(begin, end, QtConcurrent::FunctionWrapper1<T, U>(map)).startBlocking();
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename C>
|
||||
void blockingMap(Iterator begin, Iterator end, T (C::*map)())
|
||||
{
|
||||
startMap(begin, end, QtConcurrent::MemberFunctionWrapper<T, C>(map)).startBlocking();
|
||||
startMap(begin, end, QtPrivate::createFunctionWrapper(map)).startBlocking();
|
||||
}
|
||||
|
||||
// blockingMappedReduced() for sequences
|
||||
template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor>
|
||||
ResultType blockingMappedReduced(const Sequence &sequence,
|
||||
MapFunctor map,
|
||||
ReduceFunctor reduce,
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, ResultType>
|
||||
(sequence, map, reduce, options).startBlocking();
|
||||
}
|
||||
|
||||
template <typename Sequence, typename MapFunctor, typename T, typename U, typename V>
|
||||
U blockingMappedReduced(const Sequence &sequence,
|
||||
MapFunctor map,
|
||||
T (reduce)(U &, V),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, U>
|
||||
return QtConcurrent::startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, ResultType>
|
||||
(sequence,
|
||||
map,
|
||||
QtConcurrent::FunctionWrapper2<T, U &, V>(reduce),
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename Sequence, typename MapFunctor, typename T, typename C, typename U>
|
||||
C blockingMappedReduced(const Sequence &sequence,
|
||||
MapFunctor map,
|
||||
T (C::*reduce)(U),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, C>
|
||||
(sequence,
|
||||
map,
|
||||
QtConcurrent::MemberFunctionWrapper1<T, C, U>(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Sequence, typename T, typename U, typename ReduceFunctor>
|
||||
ResultType blockingMappedReduced(const Sequence &sequence,
|
||||
T (map)(U),
|
||||
template <typename MapFunctor, typename ReduceFunctor, typename Sequence>
|
||||
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingMappedReduced(const Sequence &sequence,
|
||||
MapFunctor map,
|
||||
ReduceFunctor reduce,
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, ResultType>
|
||||
return QtConcurrent::startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
|
||||
(sequence,
|
||||
QtConcurrent::FunctionWrapper1<T, U>(map),
|
||||
reduce,
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Sequence, typename T, typename C, typename ReduceFunctor>
|
||||
ResultType blockingMappedReduced(const Sequence &sequence,
|
||||
T (C::*map)() const,
|
||||
ReduceFunctor reduce,
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, ResultType>
|
||||
(sequence,
|
||||
QtConcurrent::ConstMemberFunctionWrapper<T, C>(map),
|
||||
reduce,
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename U, typename V, typename W, typename X>
|
||||
W blockingMappedReduced(const Sequence &sequence,
|
||||
T (map)(U),
|
||||
V (reduce)(W &, X),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, W>
|
||||
(sequence,
|
||||
QtConcurrent::FunctionWrapper1<T, U>(map),
|
||||
QtConcurrent::FunctionWrapper2<V, W &, X>(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename C, typename U, typename V, typename W>
|
||||
V blockingMappedReduced(const Sequence &sequence,
|
||||
T (C::*map)() const,
|
||||
U (reduce)(V &, W),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, V>
|
||||
(sequence,
|
||||
QtConcurrent::ConstMemberFunctionWrapper<T, C>(map),
|
||||
QtConcurrent::FunctionWrapper2<U, V &, W>(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename U, typename V, typename C, typename W>
|
||||
C blockingMappedReduced(const Sequence &sequence,
|
||||
T (map)(U),
|
||||
V (C::*reduce)(W),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, C>
|
||||
(sequence,
|
||||
QtConcurrent::FunctionWrapper1<T, U>(map),
|
||||
QtConcurrent::MemberFunctionWrapper1<V, C, W>(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T, typename C, typename U,typename D, typename V>
|
||||
D blockingMappedReduced(const Sequence &sequence,
|
||||
T (C::*map)() const,
|
||||
U (D::*reduce)(V),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, D>
|
||||
(sequence,
|
||||
QtConcurrent::ConstMemberFunctionWrapper<T, C>(map),
|
||||
QtConcurrent::MemberFunctionWrapper1<U, D, V>(reduce),
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
// blockingMappedReduced() for iterator ranges
|
||||
template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor>
|
||||
ResultType blockingMappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
@ -539,134 +241,25 @@ ResultType blockingMappedReduced(Iterator begin,
|
||||
ReduceFunctor reduce,
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, ResultType>
|
||||
(begin, end, map, reduce, options).startBlocking();
|
||||
}
|
||||
|
||||
template <typename Iterator, typename MapFunctor, typename T, typename U, typename V>
|
||||
U blockingMappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
MapFunctor map,
|
||||
T (reduce)(U &, V),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, U>
|
||||
(begin,
|
||||
end,
|
||||
map,
|
||||
QtConcurrent::FunctionWrapper2<T, U &, V>(reduce),
|
||||
return QtConcurrent::startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, ResultType>
|
||||
(begin, end,
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename Iterator, typename MapFunctor, typename T, typename C, typename U>
|
||||
C blockingMappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
MapFunctor map,
|
||||
T (C::*reduce)(U),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<typename MapFunctor::result_type, C>
|
||||
(begin,
|
||||
end,
|
||||
map,
|
||||
QtConcurrent::MemberFunctionWrapper1<T, C, U>(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Iterator, typename T, typename U, typename ReduceFunctor>
|
||||
ResultType blockingMappedReduced(Iterator begin,
|
||||
template <typename Iterator, typename MapFunctor, typename ReduceFunctor>
|
||||
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingMappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (map)(U),
|
||||
MapFunctor map,
|
||||
ReduceFunctor reduce,
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, ResultType>
|
||||
(begin,
|
||||
end,
|
||||
QtConcurrent::FunctionWrapper1<T, U>(map),
|
||||
reduce,
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename ResultType, typename Iterator, typename T, typename C, typename ReduceFunctor>
|
||||
ResultType blockingMappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (C::*map)() const,
|
||||
ReduceFunctor reduce,
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, ResultType>
|
||||
(begin,
|
||||
end,
|
||||
QtConcurrent::ConstMemberFunctionWrapper<T, C>(map),
|
||||
reduce,
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename U, typename V, typename W, typename X>
|
||||
W blockingMappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (map)(U),
|
||||
V (reduce)(W &, X),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, W>
|
||||
(begin,
|
||||
end,
|
||||
QtConcurrent::FunctionWrapper1<T, U>(map),
|
||||
QtConcurrent::FunctionWrapper2<V, W &, X>(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename C, typename U, typename V, typename W>
|
||||
V blockingMappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (C::*map)() const,
|
||||
U (reduce)(V &, W),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, V>
|
||||
(begin,
|
||||
end,
|
||||
QtConcurrent::ConstMemberFunctionWrapper<T, C>(map),
|
||||
QtConcurrent::FunctionWrapper2<U, V &, W>(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename U, typename V, typename C, typename W>
|
||||
C blockingMappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (map)(U),
|
||||
V (C::*reduce)(W),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, C>
|
||||
(begin,
|
||||
end,
|
||||
QtConcurrent::FunctionWrapper1<T, U>(map),
|
||||
QtConcurrent::MemberFunctionWrapper1<V, C, W>(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
|
||||
template <typename Iterator, typename T, typename C, typename U,typename D, typename V>
|
||||
D blockingMappedReduced(Iterator begin,
|
||||
Iterator end,
|
||||
T (C::*map)() const,
|
||||
U (D::*reduce)(V),
|
||||
QtConcurrent::ReduceOptions options = QtConcurrent::ReduceOptions(QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce))
|
||||
{
|
||||
return QtConcurrent::startMappedReduced<T, D>
|
||||
(begin,
|
||||
end,
|
||||
QtConcurrent::ConstMemberFunctionWrapper<T, C>(map),
|
||||
QtConcurrent::MemberFunctionWrapper1<U, D, V>(reduce),
|
||||
return QtConcurrent::startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
|
||||
(begin, end,
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
QtPrivate::createFunctionWrapper(reduce),
|
||||
options)
|
||||
.startBlocking();
|
||||
}
|
||||
@ -675,97 +268,44 @@ D blockingMappedReduced(Iterator begin,
|
||||
template <typename OutputSequence, typename InputSequence, typename MapFunctor>
|
||||
OutputSequence blockingMapped(const InputSequence &sequence, MapFunctor map)
|
||||
{
|
||||
return blockingMappedReduced(sequence, map, &OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
return blockingMappedReduced<OutputSequence>
|
||||
(sequence,
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
&OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
|
||||
template <typename OutputSequence, typename InputSequence, typename T, typename U>
|
||||
OutputSequence blockingMapped(const InputSequence &sequence, T (map)(U))
|
||||
template <typename MapFunctor, typename InputSequence>
|
||||
typename QtPrivate::MapResultType<InputSequence, MapFunctor>::ResultType blockingMapped(const InputSequence &sequence, MapFunctor map)
|
||||
{
|
||||
return blockingMappedReduced(sequence, map, &OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
|
||||
template <typename OutputSequence, typename InputSequence, typename T, typename C>
|
||||
OutputSequence blockingMapped(const InputSequence &sequence, T (C::*map)() const)
|
||||
{
|
||||
return blockingMappedReduced(sequence, map, &OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
#ifndef QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
|
||||
|
||||
// overloads for changing the container value type:
|
||||
template <template <typename> class Sequence, typename MapFunctor, typename T>
|
||||
Sequence<typename MapFunctor::result_type> blockingMapped(const Sequence<T> &sequence, MapFunctor map)
|
||||
{
|
||||
typedef Sequence<typename MapFunctor::result_type> OutputSequence;
|
||||
return blockingMappedReduced(sequence, map, &OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
|
||||
template <template <typename> class Sequence, typename T, typename U, typename V>
|
||||
Sequence<U> blockingMapped(const Sequence<T> &sequence, U (map)(V))
|
||||
{
|
||||
typedef Sequence<U> OutputSequence;
|
||||
return blockingMappedReduced(sequence, map, &OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
|
||||
template <template <typename> class Sequence, typename T, typename U, typename C>
|
||||
Sequence<U> blockingMapped(const Sequence<T> &sequence, U (C::*map)() const)
|
||||
{
|
||||
typedef Sequence<U> OutputSequence;
|
||||
return blockingMappedReduced(sequence, map, &OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
|
||||
#endif // QT_NO_TEMPLATE_TEMPLATE_PARAMETER
|
||||
|
||||
// overloads for changing the container value type from a QStringList:
|
||||
template <typename MapFunctor>
|
||||
QList<typename MapFunctor::result_type> blockingMapped(const QStringList &sequence, MapFunctor map)
|
||||
{
|
||||
typedef QList<typename MapFunctor::result_type> OutputSequence;
|
||||
return blockingMappedReduced(sequence, map, &OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
|
||||
template <typename U, typename V>
|
||||
QList<U> blockingMapped(const QStringList &sequence, U (map)(V))
|
||||
{
|
||||
typedef QList<U> OutputSequence;
|
||||
return blockingMappedReduced(sequence, map, &OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
|
||||
template <typename U, typename C>
|
||||
QList<U> blockingMapped(const QStringList &sequence, U (C::*map)() const)
|
||||
{
|
||||
typedef QList<U> OutputSequence;
|
||||
return blockingMappedReduced(sequence, map, &OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
typedef typename QtPrivate::MapResultType<InputSequence, MapFunctor>::ResultType OutputSequence;
|
||||
return blockingMappedReduced<OutputSequence>
|
||||
(sequence,
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
&OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
|
||||
// mapped() for iterator ranges
|
||||
template <typename Sequence, typename Iterator, typename MapFunctor>
|
||||
Sequence blockingMapped(Iterator begin, Iterator end, MapFunctor map)
|
||||
{
|
||||
return blockingMappedReduced(begin, end, map, &Sequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
return blockingMappedReduced<Sequence>
|
||||
(begin, end,
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
&Sequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename Iterator, typename T, typename U>
|
||||
Sequence blockingMapped(Iterator begin, Iterator end, T (map)(U))
|
||||
template <typename Iterator, typename MapFunctor>
|
||||
typename QtPrivate::MapResultType<Iterator, MapFunctor>::ResultType blockingMapped(Iterator begin, Iterator end, MapFunctor map)
|
||||
{
|
||||
return blockingMappedReduced(begin, end, map, &Sequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename Iterator, typename T, typename C>
|
||||
Sequence blockingMapped(Iterator begin, Iterator end, T (C::*map)() const)
|
||||
{
|
||||
return blockingMappedReduced(begin, end, map, &Sequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
typedef typename QtPrivate::MapResultType<Iterator, MapFunctor>::ResultType OutputSequence;
|
||||
return blockingMappedReduced<OutputSequence>
|
||||
(begin, end,
|
||||
QtPrivate::createFunctionWrapper(map),
|
||||
&OutputSequence::push_back,
|
||||
QtConcurrent::OrderedReduce);
|
||||
}
|
||||
|
||||
} // namespace QtConcurrent
|
||||
|
@ -356,6 +356,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
|
||||
const QByteArray &path = entry.nativeFilePath();
|
||||
nativeFilePath = path.constData();
|
||||
nativeFilePathLength = path.size();
|
||||
Q_UNUSED(nativeFilePathLength);
|
||||
}
|
||||
|
||||
bool entryExists = true; // innocent until proven otherwise
|
||||
@ -638,7 +639,7 @@ QFileSystemEntry QFileSystemEngine::currentPath()
|
||||
#if defined(__GLIBC__) && !defined(PATH_MAX)
|
||||
char *currentName = ::get_current_dir_name();
|
||||
if (currentName) {
|
||||
result = QFile::decodeName(QByteArray(currentName));
|
||||
result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath());
|
||||
::free(currentName);
|
||||
}
|
||||
#else
|
||||
|
@ -143,55 +143,13 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
\sa QProcess, QProcess::systemEnvironment(), QProcess::setProcessEnvironment()
|
||||
*/
|
||||
#ifdef Q_OS_WIN
|
||||
static inline QProcessEnvironmentPrivate::Unit prepareName(const QString &name)
|
||||
{ return name.toUpper(); }
|
||||
static inline QProcessEnvironmentPrivate::Unit prepareName(const QByteArray &name)
|
||||
{ return QString::fromLocal8Bit(name).toUpper(); }
|
||||
static inline QString nameToString(const QProcessEnvironmentPrivate::Unit &name)
|
||||
{ return name; }
|
||||
static inline QProcessEnvironmentPrivate::Unit prepareValue(const QString &value)
|
||||
{ return value; }
|
||||
static inline QProcessEnvironmentPrivate::Unit prepareValue(const QByteArray &value)
|
||||
{ return QString::fromLocal8Bit(value); }
|
||||
static inline QString valueToString(const QProcessEnvironmentPrivate::Unit &value)
|
||||
{ return value; }
|
||||
static inline QByteArray valueToByteArray(const QProcessEnvironmentPrivate::Unit &value)
|
||||
{ return value.toLocal8Bit(); }
|
||||
#else
|
||||
static inline QProcessEnvironmentPrivate::Unit prepareName(const QByteArray &name)
|
||||
{ return name; }
|
||||
static inline QProcessEnvironmentPrivate::Unit prepareName(const QString &name)
|
||||
{ return name.toLocal8Bit(); }
|
||||
static inline QString nameToString(const QProcessEnvironmentPrivate::Unit &name)
|
||||
{ return QString::fromLocal8Bit(name); }
|
||||
static inline QProcessEnvironmentPrivate::Unit prepareValue(const QByteArray &value)
|
||||
{ return value; }
|
||||
static inline QProcessEnvironmentPrivate::Unit prepareValue(const QString &value)
|
||||
{ return value.toLocal8Bit(); }
|
||||
static inline QString valueToString(const QProcessEnvironmentPrivate::Unit &value)
|
||||
{ return QString::fromLocal8Bit(value); }
|
||||
static inline QByteArray valueToByteArray(const QProcessEnvironmentPrivate::Unit &value)
|
||||
{ return value; }
|
||||
#endif
|
||||
|
||||
template<> void QSharedDataPointer<QProcessEnvironmentPrivate>::detach()
|
||||
{
|
||||
if (d && d->ref == 1)
|
||||
return;
|
||||
QProcessEnvironmentPrivate *x = (d ? new QProcessEnvironmentPrivate(*d)
|
||||
: new QProcessEnvironmentPrivate);
|
||||
x->ref.ref();
|
||||
if (d && !d->ref.deref())
|
||||
delete d;
|
||||
d = x;
|
||||
}
|
||||
|
||||
QStringList QProcessEnvironmentPrivate::toList() const
|
||||
{
|
||||
QStringList result;
|
||||
QHash<Unit, Unit>::ConstIterator it = hash.constBegin(),
|
||||
end = hash.constEnd();
|
||||
result.reserve(hash.size());
|
||||
Hash::ConstIterator it = hash.constBegin(),
|
||||
end = hash.constEnd();
|
||||
for ( ; it != end; ++it) {
|
||||
QString data = nameToString(it.key());
|
||||
QString value = valueToString(it.value());
|
||||
@ -224,19 +182,27 @@ QProcessEnvironment QProcessEnvironmentPrivate::fromList(const QStringList &list
|
||||
QStringList QProcessEnvironmentPrivate::keys() const
|
||||
{
|
||||
QStringList result;
|
||||
QHash<Unit, Unit>::ConstIterator it = hash.constBegin(),
|
||||
end = hash.constEnd();
|
||||
result.reserve(hash.size());
|
||||
Hash::ConstIterator it = hash.constBegin(),
|
||||
end = hash.constEnd();
|
||||
for ( ; it != end; ++it)
|
||||
result << nameToString(it.key());
|
||||
return result;
|
||||
}
|
||||
|
||||
void QProcessEnvironmentPrivate::insert(const Hash &h)
|
||||
void QProcessEnvironmentPrivate::insert(const QProcessEnvironmentPrivate &other)
|
||||
{
|
||||
QHash<Unit, Unit>::ConstIterator it = h.constBegin(),
|
||||
end = h.constEnd();
|
||||
Hash::ConstIterator it = other.hash.constBegin(),
|
||||
end = other.hash.constEnd();
|
||||
for ( ; it != end; ++it)
|
||||
hash.insert(it.key(), it.value());
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
QHash<QString, Key>::ConstIterator nit = other.nameMap.constBegin(),
|
||||
nend = other.nameMap.constEnd();
|
||||
for ( ; nit != nend; ++nit)
|
||||
nameMap.insert(nit.key(), nit.value());
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -317,6 +283,8 @@ void QProcessEnvironment::clear()
|
||||
{
|
||||
if (d)
|
||||
d->hash.clear();
|
||||
// Unix: Don't clear d->nameMap, as the environment is likely to be
|
||||
// re-populated with the same keys again.
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -331,7 +299,7 @@ void QProcessEnvironment::clear()
|
||||
*/
|
||||
bool QProcessEnvironment::contains(const QString &name) const
|
||||
{
|
||||
return d ? d->hash.contains(prepareName(name)) : false;
|
||||
return d ? d->hash.contains(d->prepareName(name)) : false;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -353,7 +321,7 @@ bool QProcessEnvironment::contains(const QString &name) const
|
||||
void QProcessEnvironment::insert(const QString &name, const QString &value)
|
||||
{
|
||||
// d detaches from null
|
||||
d->hash.insert(prepareName(name), prepareValue(value));
|
||||
d->hash.insert(d->prepareName(name), d->prepareValue(value));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -370,7 +338,7 @@ void QProcessEnvironment::insert(const QString &name, const QString &value)
|
||||
void QProcessEnvironment::remove(const QString &name)
|
||||
{
|
||||
if (d)
|
||||
d->hash.remove(prepareName(name));
|
||||
d->hash.remove(d->prepareName(name));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -389,11 +357,11 @@ QString QProcessEnvironment::value(const QString &name, const QString &defaultVa
|
||||
if (!d)
|
||||
return defaultValue;
|
||||
|
||||
QProcessEnvironmentPrivate::Hash::ConstIterator it = d->hash.constFind(prepareName(name));
|
||||
QProcessEnvironmentPrivate::Hash::ConstIterator it = d->hash.constFind(d->prepareName(name));
|
||||
if (it == d->hash.constEnd())
|
||||
return defaultValue;
|
||||
|
||||
return valueToString(it.value());
|
||||
return d->valueToString(it.value());
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -438,7 +406,7 @@ void QProcessEnvironment::insert(const QProcessEnvironment &e)
|
||||
return;
|
||||
|
||||
// d detaches from null
|
||||
d->insert(e.d->hash);
|
||||
d->insert(*e.d);
|
||||
}
|
||||
|
||||
void QProcessPrivate::Channel::clear()
|
||||
@ -2321,6 +2289,8 @@ QStringList QProcess::systemEnvironment()
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QProcessEnvironment QProcessEnvironment::systemEnvironment()
|
||||
|
||||
\since 4.6
|
||||
|
||||
\brief The systemEnvironment function returns the environment of
|
||||
@ -2336,21 +2306,6 @@ QStringList QProcess::systemEnvironment()
|
||||
|
||||
\sa QProcess::systemEnvironment()
|
||||
*/
|
||||
QProcessEnvironment QProcessEnvironment::systemEnvironment()
|
||||
{
|
||||
QProcessEnvironment env;
|
||||
const char *entry;
|
||||
for (int count = 0; (entry = environ[count]); ++count) {
|
||||
const char *equal = strchr(entry, '=');
|
||||
if (!equal)
|
||||
continue;
|
||||
|
||||
QByteArray name(entry, equal - entry);
|
||||
QByteArray value(equal + 1);
|
||||
env.insert(QString::fromLocal8Bit(name), QString::fromLocal8Bit(value));
|
||||
}
|
||||
return env;
|
||||
}
|
||||
|
||||
/*!
|
||||
\typedef Q_PID
|
||||
|
@ -81,23 +81,119 @@ class QTimer;
|
||||
class RProcess;
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
class QProcEnvKey : public QString
|
||||
{
|
||||
public:
|
||||
QProcEnvKey() {}
|
||||
explicit QProcEnvKey(const QString &other) : QString(other) {}
|
||||
QProcEnvKey(const QProcEnvKey &other) : QString(other) {}
|
||||
bool operator==(const QProcEnvKey &other) const { return !compare(other, Qt::CaseInsensitive); }
|
||||
};
|
||||
inline uint qHash(const QProcEnvKey &key) { return qHash(key.toCaseFolded()); }
|
||||
|
||||
typedef QString QProcEnvValue;
|
||||
#else
|
||||
class QProcEnvKey
|
||||
{
|
||||
public:
|
||||
QProcEnvKey() : hash(0) {}
|
||||
explicit QProcEnvKey(const QByteArray &other) : key(other), hash(qHash(key)) {}
|
||||
QProcEnvKey(const QProcEnvKey &other) { *this = other; }
|
||||
bool operator==(const QProcEnvKey &other) const { return key == other.key; }
|
||||
|
||||
QByteArray key;
|
||||
uint hash;
|
||||
};
|
||||
inline uint qHash(const QProcEnvKey &key) { return key.hash; }
|
||||
|
||||
class QProcEnvValue
|
||||
{
|
||||
public:
|
||||
QProcEnvValue() {}
|
||||
QProcEnvValue(const QProcEnvValue &other) { *this = other; }
|
||||
explicit QProcEnvValue(const QString &value) : stringValue(value) {}
|
||||
explicit QProcEnvValue(const QByteArray &value) : byteValue(value) {}
|
||||
bool operator==(const QProcEnvValue &other) const
|
||||
{
|
||||
return byteValue.isEmpty() && other.byteValue.isEmpty()
|
||||
? stringValue == other.stringValue
|
||||
: bytes() == other.bytes();
|
||||
}
|
||||
QByteArray bytes() const
|
||||
{
|
||||
if (byteValue.isEmpty() && !stringValue.isEmpty())
|
||||
byteValue = stringValue.toLocal8Bit();
|
||||
return byteValue;
|
||||
}
|
||||
QString string() const
|
||||
{
|
||||
if (stringValue.isEmpty() && !byteValue.isEmpty())
|
||||
stringValue = QString::fromLocal8Bit(byteValue);
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
mutable QByteArray byteValue;
|
||||
mutable QString stringValue;
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(QProcEnvValue, Q_MOVABLE_TYPE);
|
||||
#endif
|
||||
Q_DECLARE_TYPEINFO(QProcEnvKey, Q_MOVABLE_TYPE);
|
||||
|
||||
class QProcessEnvironmentPrivate: public QSharedData
|
||||
{
|
||||
public:
|
||||
typedef QProcEnvKey Key;
|
||||
typedef QProcEnvValue Value;
|
||||
#ifdef Q_OS_WIN
|
||||
typedef QString Unit;
|
||||
inline Key prepareName(const QString &name) const { return Key(name); }
|
||||
inline QString nameToString(const Key &name) const { return name; }
|
||||
inline Value prepareValue(const QString &value) const { return value; }
|
||||
inline QString valueToString(const Value &value) const { return value; }
|
||||
#else
|
||||
typedef QByteArray Unit;
|
||||
inline Key prepareName(const QString &name) const
|
||||
{
|
||||
Key &ent = nameMap[name];
|
||||
if (ent.key.isEmpty())
|
||||
ent = Key(name.toLocal8Bit());
|
||||
return ent;
|
||||
}
|
||||
inline QString nameToString(const Key &name) const
|
||||
{
|
||||
const QString sname = QString::fromLocal8Bit(name.key);
|
||||
nameMap[sname] = name;
|
||||
return sname;
|
||||
}
|
||||
inline Value prepareValue(const QString &value) const { return Value(value); }
|
||||
inline QString valueToString(const Value &value) const { return value.string(); }
|
||||
#endif
|
||||
typedef QHash<Unit, Unit> Hash;
|
||||
|
||||
typedef QHash<Key, Value> Hash;
|
||||
Hash hash;
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
typedef QHash<QString, Key> NameHash;
|
||||
mutable NameHash nameMap;
|
||||
#endif
|
||||
|
||||
static QProcessEnvironment fromList(const QStringList &list);
|
||||
QStringList toList() const;
|
||||
QStringList keys() const;
|
||||
void insert(const Hash &hash);
|
||||
void insert(const QProcessEnvironmentPrivate &other);
|
||||
};
|
||||
|
||||
template<> Q_INLINE_TEMPLATE void QSharedDataPointer<QProcessEnvironmentPrivate>::detach()
|
||||
{
|
||||
if (d && d->ref == 1)
|
||||
return;
|
||||
QProcessEnvironmentPrivate *x = (d ? new QProcessEnvironmentPrivate(*d)
|
||||
: new QProcessEnvironmentPrivate);
|
||||
x->ref.ref();
|
||||
if (d && !d->ref.deref())
|
||||
delete d;
|
||||
d = x;
|
||||
}
|
||||
|
||||
class QProcessPrivate : public QIODevicePrivate
|
||||
{
|
||||
public:
|
||||
|
@ -1062,6 +1062,11 @@ void QProcessPrivate::initializeProcessManager()
|
||||
(void) processManager();
|
||||
}
|
||||
|
||||
QProcessEnvironment QProcessEnvironment::systemEnvironment()
|
||||
{
|
||||
return QProcessEnvironment();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_PROCESS
|
||||
|
@ -467,7 +467,35 @@ bool QProcessPrivate::createChannel(Channel &channel)
|
||||
}
|
||||
}
|
||||
|
||||
static char **_q_dupEnvironment(const QHash<QByteArray, QByteArray> &environment, int *envc)
|
||||
QT_BEGIN_INCLUDE_NAMESPACE
|
||||
#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
|
||||
# include <crt_externs.h>
|
||||
# define environ (*_NSGetEnviron())
|
||||
#else
|
||||
extern char **environ;
|
||||
#endif
|
||||
QT_END_INCLUDE_NAMESPACE
|
||||
|
||||
QProcessEnvironment QProcessEnvironment::systemEnvironment()
|
||||
{
|
||||
QProcessEnvironment env;
|
||||
#if !defined(Q_OS_MAC) || !defined(QT_NO_CORESERVICES)
|
||||
const char *entry;
|
||||
for (int count = 0; (entry = environ[count]); ++count) {
|
||||
const char *equal = strchr(entry, '=');
|
||||
if (!equal)
|
||||
continue;
|
||||
|
||||
QByteArray name(entry, equal - entry);
|
||||
QByteArray value(equal + 1);
|
||||
env.d->hash.insert(QProcessEnvironmentPrivate::Key(name),
|
||||
QProcessEnvironmentPrivate::Value(value));
|
||||
}
|
||||
#endif
|
||||
return env;
|
||||
}
|
||||
|
||||
static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environment, int *envc)
|
||||
{
|
||||
*envc = 0;
|
||||
if (environment.isEmpty())
|
||||
@ -483,17 +511,17 @@ static char **_q_dupEnvironment(const QHash<QByteArray, QByteArray> &environment
|
||||
#endif
|
||||
const QByteArray envLibraryPath = qgetenv(libraryPath);
|
||||
bool needToAddLibraryPath = !envLibraryPath.isEmpty() &&
|
||||
!environment.contains(libraryPath);
|
||||
!environment.contains(QProcessEnvironmentPrivate::Key(QByteArray(libraryPath)));
|
||||
|
||||
char **envp = new char *[environment.count() + 2];
|
||||
envp[environment.count()] = 0;
|
||||
envp[environment.count() + 1] = 0;
|
||||
|
||||
QHash<QByteArray, QByteArray>::ConstIterator it = environment.constBegin();
|
||||
const QHash<QByteArray, QByteArray>::ConstIterator end = environment.constEnd();
|
||||
QProcessEnvironmentPrivate::Hash::ConstIterator it = environment.constBegin();
|
||||
const QProcessEnvironmentPrivate::Hash::ConstIterator end = environment.constEnd();
|
||||
for ( ; it != end; ++it) {
|
||||
QByteArray key = it.key();
|
||||
QByteArray value = it.value();
|
||||
QByteArray key = it.key().key;
|
||||
QByteArray value = it.value().bytes();
|
||||
key.reserve(key.length() + 1 + value.length());
|
||||
key.append('=');
|
||||
key.append(value);
|
||||
|
@ -278,29 +278,55 @@ static QString qt_create_commandline(const QString &program, const QStringList &
|
||||
return args;
|
||||
}
|
||||
|
||||
static QByteArray qt_create_environment(const QHash<QString, QString> &environment)
|
||||
QProcessEnvironment QProcessEnvironment::systemEnvironment()
|
||||
{
|
||||
QProcessEnvironment env;
|
||||
#if !defined(Q_OS_WINCE)
|
||||
// Calls to setenv() affect the low-level environment as well.
|
||||
// This is not the case the other way round.
|
||||
if (wchar_t *envStrings = GetEnvironmentStringsW()) {
|
||||
for (const wchar_t *entry = envStrings; *entry; ) {
|
||||
int entryLen = wcslen(entry);
|
||||
if (const wchar_t *equal = wcschr(entry, L'=')) {
|
||||
int nameLen = equal - entry;
|
||||
QString name = QString::fromWCharArray(entry, nameLen);
|
||||
QString value = QString::fromWCharArray(equal + 1, entryLen - nameLen - 1);
|
||||
env.d->hash.insert(QProcessEnvironmentPrivate::Key(name), value);
|
||||
}
|
||||
entry += entryLen + 1;
|
||||
}
|
||||
FreeEnvironmentStringsW(envStrings);
|
||||
}
|
||||
#endif
|
||||
return env;
|
||||
}
|
||||
|
||||
#if !defined(Q_OS_WINCE)
|
||||
static QByteArray qt_create_environment(const QProcessEnvironmentPrivate::Hash &environment)
|
||||
{
|
||||
QByteArray envlist;
|
||||
if (!environment.isEmpty()) {
|
||||
QHash<QString, QString> copy = environment;
|
||||
QProcessEnvironmentPrivate::Hash copy = environment;
|
||||
|
||||
// add PATH if necessary (for DLL loading)
|
||||
if (!copy.contains(QLatin1String("PATH"))) {
|
||||
QProcessEnvironmentPrivate::Key pathKey(QLatin1String("PATH"));
|
||||
if (!copy.contains(pathKey)) {
|
||||
QByteArray path = qgetenv("PATH");
|
||||
if (!path.isEmpty())
|
||||
copy.insert(QLatin1String("PATH"), QString::fromLocal8Bit(path));
|
||||
copy.insert(pathKey, QString::fromLocal8Bit(path));
|
||||
}
|
||||
|
||||
// add systemroot if needed
|
||||
if (!copy.contains(QLatin1String("SYSTEMROOT"))) {
|
||||
QByteArray systemRoot = qgetenv("SYSTEMROOT");
|
||||
QProcessEnvironmentPrivate::Key rootKey(QLatin1String("SystemRoot"));
|
||||
if (!copy.contains(rootKey)) {
|
||||
QByteArray systemRoot = qgetenv("SystemRoot");
|
||||
if (!systemRoot.isEmpty())
|
||||
copy.insert(QLatin1String("SYSTEMROOT"), QString::fromLocal8Bit(systemRoot));
|
||||
copy.insert(rootKey, QString::fromLocal8Bit(systemRoot));
|
||||
}
|
||||
|
||||
int pos = 0;
|
||||
QHash<QString, QString>::ConstIterator it = copy.constBegin(),
|
||||
end = copy.constEnd();
|
||||
QProcessEnvironmentPrivate::Hash::ConstIterator it = copy.constBegin(),
|
||||
end = copy.constEnd();
|
||||
|
||||
static const wchar_t equal = L'=';
|
||||
static const wchar_t nul = L'\0';
|
||||
@ -335,6 +361,7 @@ static QByteArray qt_create_environment(const QHash<QString, QString> &environme
|
||||
}
|
||||
return envlist;
|
||||
}
|
||||
#endif
|
||||
|
||||
void QProcessPrivate::startProcess()
|
||||
{
|
||||
|
@ -981,23 +981,6 @@ QStringList QSettingsPrivate::splitArgs(const QString &s, int idx)
|
||||
// ************************************************************************
|
||||
// QConfFileSettingsPrivate
|
||||
|
||||
/*
|
||||
If we don't have the permission to read the file, returns false.
|
||||
If the file doesn't exist, returns true.
|
||||
*/
|
||||
static bool checkAccess(const QString &name)
|
||||
{
|
||||
QFileInfo fileInfo(name);
|
||||
|
||||
if (fileInfo.exists()) {
|
||||
QFile file(name);
|
||||
// if the file exists but we can't open it, report an error
|
||||
return file.open(QFile::ReadOnly);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void QConfFileSettingsPrivate::initFormat()
|
||||
{
|
||||
extension = (format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini");
|
||||
@ -1026,18 +1009,13 @@ void QConfFileSettingsPrivate::initFormat()
|
||||
|
||||
void QConfFileSettingsPrivate::initAccess()
|
||||
{
|
||||
bool readAccess = false;
|
||||
if (confFiles[spec]) {
|
||||
readAccess = checkAccess(confFiles[spec]->name);
|
||||
if (format > QSettings::IniFormat) {
|
||||
if (!readFunc)
|
||||
readAccess = false;
|
||||
setStatus(QSettings::AccessError);
|
||||
}
|
||||
}
|
||||
|
||||
if (!readAccess)
|
||||
setStatus(QSettings::AccessError);
|
||||
|
||||
sync(); // loads the files the first time
|
||||
}
|
||||
|
||||
@ -1432,7 +1410,7 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo)
|
||||
We can often optimize the read-only case, if the file on disk
|
||||
hasn't changed.
|
||||
*/
|
||||
if (readOnly) {
|
||||
if (readOnly && confFile->size > 0) {
|
||||
QFileInfo fileInfo(confFile->name);
|
||||
if (confFile->size == fileInfo.size() && confFile->timeStamp == fileInfo.lastModified())
|
||||
return;
|
||||
@ -1455,6 +1433,9 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo)
|
||||
if (!file.isOpen())
|
||||
file.open(QFile::ReadOnly);
|
||||
|
||||
if (!createFile && !file.isOpen())
|
||||
setStatus(QSettings::AccessError);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
HANDLE readSemaphore = 0;
|
||||
HANDLE writeSemaphore = 0;
|
||||
|
@ -270,6 +270,17 @@ bool QCoreApplicationPrivate::is_app_closing = false;
|
||||
Q_CORE_EXPORT bool qt_locale_initialized = false;
|
||||
|
||||
|
||||
/*
|
||||
Create an instance of Trolltech.conf. This ensures that the settings will not
|
||||
be thrown out of QSetting's cache for unused settings.
|
||||
*/
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QSettings, staticTrolltechConf, (QSettings::UserScope, QLatin1String("Trolltech")))
|
||||
|
||||
QSettings *QCoreApplicationPrivate::trolltechConf()
|
||||
{
|
||||
return staticTrolltechConf();
|
||||
}
|
||||
|
||||
Q_CORE_EXPORT uint qGlobalPostedEventsCount()
|
||||
{
|
||||
QThreadData *currentThreadData = QThreadData::current();
|
||||
|
@ -55,6 +55,7 @@
|
||||
|
||||
#include "QtCore/qcoreapplication.h"
|
||||
#include "QtCore/qtranslator.h"
|
||||
#include "QtCore/qsettings.h"
|
||||
#include "private/qobject_p.h"
|
||||
|
||||
#ifdef Q_OS_SYMBIAN
|
||||
@ -141,6 +142,7 @@ public:
|
||||
#if defined(QT3_SUPPORT)
|
||||
static bool useQt3Support;
|
||||
#endif
|
||||
static QSettings *trolltechConf();
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include <qmap.h>
|
||||
#include <qsettings.h>
|
||||
#include <qdatetime.h>
|
||||
#include <private/qcoreapplication_p.h>
|
||||
#ifdef Q_OS_MAC
|
||||
# include <private/qcore_mac_p.h>
|
||||
#endif
|
||||
@ -408,12 +409,6 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QB
|
||||
typedef QMap<QString, QLibraryPrivate*> LibraryMap;
|
||||
|
||||
struct LibraryData {
|
||||
LibraryData() : settings(0) { }
|
||||
~LibraryData() {
|
||||
delete settings;
|
||||
}
|
||||
|
||||
QSettings *settings;
|
||||
LibraryMap libraryMap;
|
||||
QSet<QLibraryPrivate*> loadedLibs;
|
||||
};
|
||||
@ -711,11 +706,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
|
||||
QStringList reg;
|
||||
#ifndef QT_NO_SETTINGS
|
||||
if (!settings) {
|
||||
settings = libraryData()->settings;
|
||||
if (!settings) {
|
||||
settings = new QSettings(QSettings::UserScope, QLatin1String("Trolltech"));
|
||||
libraryData()->settings = settings;
|
||||
}
|
||||
settings = QCoreApplicationPrivate::trolltechConf();
|
||||
}
|
||||
reg = settings->value(regkey).toStringList();
|
||||
#endif
|
||||
|
@ -107,18 +107,21 @@ bool QMutexPrivate::wait(int timeout)
|
||||
// lock acquired without waiting
|
||||
return true;
|
||||
}
|
||||
bool returnValue;
|
||||
kern_return_t r;
|
||||
if (timeout < 0) {
|
||||
returnValue = semaphore_wait(mach_semaphore) == KERN_SUCCESS;
|
||||
do {
|
||||
r = semaphore_wait(mach_semaphore);
|
||||
} while (r == KERN_ABORTED);
|
||||
if (r != KERN_SUCCESS)
|
||||
qWarning("QMutex: infinite wait failed, error %d", r);
|
||||
} else {
|
||||
mach_timespec_t ts;
|
||||
ts.tv_nsec = ((timeout % 1000) * 1000) * 1000;
|
||||
ts.tv_sec = (timeout / 1000);
|
||||
kern_return_t r = semaphore_timedwait(mach_semaphore, ts);
|
||||
returnValue = r == KERN_SUCCESS;
|
||||
r = semaphore_timedwait(mach_semaphore, ts);
|
||||
}
|
||||
contenders.deref();
|
||||
return returnValue;
|
||||
return r == KERN_SUCCESS;
|
||||
}
|
||||
|
||||
void QMutexPrivate::wakeUp()
|
||||
|
@ -329,6 +329,8 @@ void *QThreadPrivate::start(void *arg)
|
||||
data->quitNow = thr->d_func()->exited;
|
||||
}
|
||||
|
||||
CTrapCleanup *cleanup = CTrapCleanup::New();
|
||||
|
||||
// ### TODO: allow the user to create a custom event dispatcher
|
||||
createEventDispatcher(data);
|
||||
|
||||
@ -337,6 +339,8 @@ void *QThreadPrivate::start(void *arg)
|
||||
|
||||
QThreadPrivate::finish(arg);
|
||||
|
||||
delete cleanup;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ void QThreadPrivate::createEventDispatcher(QThreadData *data)
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
|
||||
unsigned int __stdcall QThreadPrivate::start(void *arg)
|
||||
unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(void *arg)
|
||||
{
|
||||
QThread *thr = reinterpret_cast<QThread *>(arg);
|
||||
QThreadData *data = QThreadData::get2(thr);
|
||||
|
@ -2460,7 +2460,11 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
|
||||
|
||||
If the \a format is Qt::ISODate, the string format corresponds
|
||||
to the ISO 8601 extended specification for representations of
|
||||
dates and times, taking the form YYYY-MM-DDTHH:MM:SS.
|
||||
dates and times, taking the form YYYY-MM-DDTHH:MM:SS[Z|[+|-]HH:MM],
|
||||
depending on the timeSpec() of the QDateTime. If the timeSpec()
|
||||
is Qt::UTC, Z will be appended to the string; if the timeSpec() is
|
||||
Qt::OffsetFromUTC the offset in hours and minutes from UTC will
|
||||
be appended to the string.
|
||||
|
||||
If the \a format is Qt::SystemLocaleShortDate or
|
||||
Qt::SystemLocaleLongDate, the string format depends on the locale
|
||||
@ -2497,6 +2501,21 @@ QString QDateTime::toString(Qt::DateFormat f) const
|
||||
return QString(); // failed to convert
|
||||
buf += QLatin1Char('T');
|
||||
buf += d->time.toString(Qt::ISODate);
|
||||
switch (d->spec) {
|
||||
case QDateTimePrivate::UTC:
|
||||
buf += QLatin1Char('Z');
|
||||
break;
|
||||
case QDateTimePrivate::OffsetFromUTC: {
|
||||
int sign = d->utcOffset >= 0 ? 1: -1;
|
||||
buf += QString::fromLatin1("%1%2:%3").
|
||||
arg(sign == 1 ? QLatin1Char('+') : QLatin1Char('-')).
|
||||
arg(d->utcOffset * sign / SECS_PER_HOUR, 2, 10, QLatin1Char('0')).
|
||||
arg((d->utcOffset / 60) % 60, 2, 10, QLatin1Char('0'));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifndef QT_NO_TEXTDATE
|
||||
else if (f == Qt::TextDate) {
|
||||
|
@ -95,7 +95,7 @@ qint64 QElapsedTimer::restart()
|
||||
qint64 oldt1 = t1;
|
||||
t1 = getMicrosecondFromTick();
|
||||
t2 = 0;
|
||||
return t1 - oldt1;
|
||||
return (t1 - oldt1) / 1000;
|
||||
}
|
||||
|
||||
qint64 QElapsedTimer::nsecsElapsed() const
|
||||
|
@ -2782,8 +2782,6 @@ bool QLocalePrivate::numberToCLocale(const QString &num,
|
||||
if (idx == l)
|
||||
return false;
|
||||
|
||||
const QChar _group = group();
|
||||
|
||||
while (idx < l) {
|
||||
const QChar &in = uc[idx];
|
||||
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <QTime>
|
||||
#include <QVariant>
|
||||
#include <QThread>
|
||||
#include <QStringList>
|
||||
|
||||
#include <e32std.h>
|
||||
#include <e32const.h>
|
||||
@ -86,6 +87,7 @@ static TPtrC defaultFormatSpec(TExtendedLocale&)
|
||||
struct symbianToISO {
|
||||
int symbian_language;
|
||||
char iso_name[8];
|
||||
char uilanguage[8];
|
||||
};
|
||||
|
||||
|
||||
@ -94,77 +96,80 @@ struct symbianToISO {
|
||||
NOTE: This array should be sorted by the first column!
|
||||
*/
|
||||
static const symbianToISO symbian_to_iso_list[] = {
|
||||
{ ELangEnglish, "en_GB" }, // 1
|
||||
{ ELangFrench, "fr_FR" }, // 2
|
||||
{ ELangGerman, "de_DE" }, // 3
|
||||
{ ELangSpanish, "es_ES" }, // 4
|
||||
{ ELangItalian, "it_IT" }, // 5
|
||||
{ ELangSwedish, "sv_SE" }, // 6
|
||||
{ ELangDanish, "da_DK" }, // 7
|
||||
{ ELangNorwegian, "no_NO" }, // 8
|
||||
{ ELangFinnish, "fi_FI" }, // 9
|
||||
{ ELangAmerican, "en_US" }, // 10
|
||||
{ ELangPortuguese, "pt_PT" }, // 13
|
||||
{ ELangTurkish, "tr_TR" }, // 14
|
||||
{ ELangIcelandic, "is_IS" }, // 15
|
||||
{ ELangRussian, "ru_RU" }, // 16
|
||||
{ ELangHungarian, "hu_HU" }, // 17
|
||||
{ ELangDutch, "nl_NL" }, // 18
|
||||
{ ELangBelgianFlemish, "nl_BE" }, // 19
|
||||
{ ELangCzech, "cs_CZ" }, // 25
|
||||
{ ELangSlovak, "sk_SK" }, // 26
|
||||
{ ELangPolish, "pl_PL" }, // 27
|
||||
{ ELangSlovenian, "sl_SI" }, // 28
|
||||
{ ELangTaiwanChinese, "zh_TW" }, // 29
|
||||
{ ELangHongKongChinese, "zh_HK" }, // 30
|
||||
{ ELangPrcChinese, "zh_CN" }, // 31
|
||||
{ ELangJapanese, "ja_JP" }, // 32
|
||||
{ ELangThai, "th_TH" }, // 33
|
||||
{ ELangArabic, "ar_AE" }, // 37
|
||||
{ ELangTagalog, "tl_PH" }, // 39
|
||||
{ ELangBulgarian, "bg_BG" }, // 42
|
||||
{ ELangCatalan, "ca_ES" }, // 44
|
||||
{ ELangCroatian, "hr_HR" }, // 45
|
||||
{ ELangEstonian, "et_EE" }, // 49
|
||||
{ ELangFarsi, "fa_IR" }, // 50
|
||||
{ ELangCanadianFrench, "fr_CA" }, // 51
|
||||
{ ELangGreek, "el_GR" }, // 54
|
||||
{ ELangHebrew, "he_IL" }, // 57
|
||||
{ ELangHindi, "hi_IN" }, // 58
|
||||
{ ELangIndonesian, "id_ID" }, // 59
|
||||
{ ELangKorean, "ko_KO" }, // 65
|
||||
{ ELangLatvian, "lv_LV" }, // 67
|
||||
{ ELangLithuanian, "lt_LT" }, // 68
|
||||
{ ELangMalay, "ms_MY" }, // 70
|
||||
{ ELangNorwegianNynorsk, "nn_NO" }, // 75
|
||||
{ ELangBrazilianPortuguese, "pt_BR" }, // 76
|
||||
{ ELangRomanian, "ro_RO" }, // 78
|
||||
{ ELangSerbian, "sr_RS" }, // 79
|
||||
{ ELangLatinAmericanSpanish,"es_419" }, // 83
|
||||
{ ELangUkrainian, "uk_UA" }, // 93
|
||||
{ ELangUrdu, "ur_PK" }, // 94 - India/Pakistan
|
||||
{ ELangVietnamese, "vi_VN" }, // 96
|
||||
{ ELangEnglish, "en_GB", "en" }, // 1
|
||||
{ ELangFrench, "fr_FR", "fr" }, // 2
|
||||
{ ELangGerman, "de_DE", "de" }, // 3
|
||||
{ ELangSpanish, "es_ES", "es" }, // 4
|
||||
{ ELangItalian, "it_IT", "it" }, // 5
|
||||
{ ELangSwedish, "sv_SE", "sv" }, // 6
|
||||
{ ELangDanish, "da_DK", "da" }, // 7
|
||||
{ ELangNorwegian, "nb_NO", "nb" }, // 8
|
||||
{ ELangFinnish, "fi_FI", "fi" }, // 9
|
||||
{ ELangAmerican, "en_US", "en-US" }, // 10
|
||||
{ ELangPortuguese, "pt_PT", "pt" }, // 13
|
||||
{ ELangTurkish, "tr_TR", "tr" }, // 14
|
||||
{ ELangIcelandic, "is_IS", "is" }, // 15
|
||||
{ ELangRussian, "ru_RU", "ru" }, // 16
|
||||
{ ELangHungarian, "hu_HU", "hu" }, // 17
|
||||
{ ELangDutch, "nl_NL", "nl" }, // 18
|
||||
{ ELangCzech, "cs_CZ", "cs" }, // 25
|
||||
{ ELangSlovak, "sk_SK", "sk" }, // 26
|
||||
{ ELangPolish, "pl_PL", "pl" }, // 27
|
||||
{ ELangSlovenian, "sl_SI", "sl" }, // 28
|
||||
{ ELangTaiwanChinese, "zh_TW", "zh-TW" }, // 29
|
||||
{ ELangHongKongChinese, "zh_HK", "zh-HK" }, // 30
|
||||
{ ELangPrcChinese, "zh_CN", "zh" }, // 31
|
||||
{ ELangJapanese, "ja_JP", "ja" }, // 32
|
||||
{ ELangThai, "th_TH", "th" }, // 33
|
||||
{ ELangArabic, "ar_AE", "ar" }, // 37
|
||||
{ ELangTagalog, "tl_PH", "tl" }, // 39
|
||||
{ ELangBulgarian, "bg_BG", "bg" }, // 42
|
||||
{ ELangCatalan, "ca_ES", "ca" }, // 44
|
||||
{ ELangCroatian, "hr_HR", "hr" }, // 45
|
||||
{ ELangEstonian, "et_EE", "et" }, // 49
|
||||
{ ELangFarsi, "fa_IR", "fa" }, // 50
|
||||
{ ELangCanadianFrench, "fr_CA", "fr-CA" }, // 51
|
||||
{ ELangGreek, "el_GR", "el" }, // 54
|
||||
{ ELangHebrew, "he_IL", "he" }, // 57
|
||||
{ ELangHindi, "hi_IN", "hi" }, // 58
|
||||
{ ELangIndonesian, "id_ID", "id" }, // 59
|
||||
{ 63/*ELangKazakh*/, "kk_KZ", "kk" }, // 63
|
||||
{ ELangKorean, "ko_KO", "ko" }, // 65
|
||||
{ ELangLatvian, "lv_LV", "lv" }, // 67
|
||||
{ ELangLithuanian, "lt_LT", "lt" }, // 68
|
||||
{ ELangMalay, "ms_MY", "ms" }, // 70
|
||||
{ ELangNorwegianNynorsk, "nn_NO", "nn" }, // 75
|
||||
{ ELangBrazilianPortuguese, "pt_BR", "pt-BR" }, // 76
|
||||
{ ELangRomanian, "ro_RO", "ro" }, // 78
|
||||
{ ELangSerbian, "sr_RS", "sr" }, // 79
|
||||
{ ELangLatinAmericanSpanish,"es_419", "es-419" },// 83
|
||||
{ ELangUkrainian, "uk_UA", "uk" }, // 93
|
||||
{ ELangUrdu, "ur_PK", "ur" }, // 94 - India/Pakistan
|
||||
{ ELangVietnamese, "vi_VN", "vi" }, // 96
|
||||
#ifdef __E32LANG_H__
|
||||
// 5.0
|
||||
{ ELangBasque, "eu_ES" }, // 102
|
||||
{ ELangGalician, "gl_ES" }, // 103
|
||||
{ ELangBasque, "eu_ES", "eu" }, // 102
|
||||
{ ELangGalician, "gl_ES", "gl" }, // 103
|
||||
#endif
|
||||
#if !defined(__SERIES60_31__)
|
||||
{ ELangEnglish_Apac, "en" }, // 129
|
||||
{ ELangEnglish_Taiwan, "en_TW" }, // 157 ### Not supported by CLDR
|
||||
{ ELangEnglish_HongKong, "en_HK" }, // 158
|
||||
{ ELangEnglish_Prc, "en_CN" }, // 159 ### Not supported by CLDR
|
||||
{ ELangEnglish_Japan, "en_JP"}, // 160 ### Not supported by CLDR
|
||||
{ ELangEnglish_Thailand, "en_TH" }, // 161 ### Not supported by CLDR
|
||||
{ ELangMalay_Apac, "ms" }, // 326
|
||||
{ ELangEnglish_Apac, "en_GB", "en" }, // 129
|
||||
{ ELangEnglish_Taiwan, "en_TW", "en-TW" }, // 157 ### Not supported by CLDR
|
||||
{ ELangEnglish_HongKong, "en_HK", "en-HK" }, // 158
|
||||
{ ELangEnglish_Prc, "en_CN", "en-CN" }, // 159 ### Not supported by CLDR
|
||||
{ ELangEnglish_Japan, "en_JP", "en" }, // 160 ### Not supported by CLDR
|
||||
{ ELangEnglish_Thailand, "en_TH", "en" }, // 161 ### Not supported by CLDR
|
||||
{ 230/*ELangEnglish_India*/,"en_IN", "en" }, // 230
|
||||
{ ELangMalay_Apac, "ms_MY", "ms" }, // 326
|
||||
#endif
|
||||
{ 327/*ELangIndonesian_Apac*/,"id_ID" } // 327 - appeared in Symbian^3
|
||||
{ 327/*ELangIndonesian_Apac*/, "id_ID", "id" } // 327 - appeared in Symbian^3
|
||||
};
|
||||
|
||||
/*!
|
||||
Returns ISO name corresponding to the Symbian locale code \a sys_fmt.
|
||||
*/
|
||||
QByteArray qt_symbianLocaleName(int code)
|
||||
enum LocaleNameType {
|
||||
ISO,
|
||||
UILanguage
|
||||
};
|
||||
|
||||
QByteArray qt_resolveSymbianLocaleName(int code, LocaleNameType type)
|
||||
{
|
||||
//Number of Symbian to ISO locale mappings
|
||||
static const int symbian_to_iso_count
|
||||
@ -174,8 +179,11 @@ QByteArray qt_symbianLocaleName(int code)
|
||||
if (cmp < 0)
|
||||
return 0;
|
||||
|
||||
if (cmp == 0)
|
||||
return symbian_to_iso_list[0].iso_name;
|
||||
if (cmp == 0) {
|
||||
if (type == ISO)
|
||||
return symbian_to_iso_list[0].iso_name;
|
||||
return symbian_to_iso_list[0].uilanguage;
|
||||
}
|
||||
|
||||
int begin = 0;
|
||||
int end = symbian_to_iso_count;
|
||||
@ -185,17 +193,27 @@ QByteArray qt_symbianLocaleName(int code)
|
||||
|
||||
const symbianToISO *elt = symbian_to_iso_list + mid;
|
||||
int cmp = code - elt->symbian_language;
|
||||
if (cmp < 0)
|
||||
if (cmp < 0) {
|
||||
end = mid;
|
||||
else if (cmp > 0)
|
||||
} else if (cmp > 0) {
|
||||
begin = mid;
|
||||
else
|
||||
return elt->iso_name;
|
||||
} else {
|
||||
if (type == ISO)
|
||||
return elt->iso_name;
|
||||
return elt->uilanguage;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns ISO name corresponding to the Symbian locale code \a sys_fmt.
|
||||
*/
|
||||
QByteArray qt_symbianLocaleName(int code)
|
||||
{
|
||||
return qt_resolveSymbianLocaleName(code, ISO);
|
||||
}
|
||||
|
||||
// order is: normal, abbr, nmode, nmode+abbr
|
||||
static const char *us_locale_dep[] = {
|
||||
@ -822,6 +840,13 @@ QLocale QSystemLocale::fallbackLocale() const
|
||||
return QLocale(locale);
|
||||
}
|
||||
|
||||
static QStringList symbianUILanguages()
|
||||
{
|
||||
TLanguage lang = User::Language();
|
||||
QString s = QLatin1String(qt_resolveSymbianLocaleName(lang, UILanguage));
|
||||
return QStringList(s);
|
||||
}
|
||||
|
||||
QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
|
||||
{
|
||||
switch(type) {
|
||||
@ -889,6 +914,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
|
||||
return qt_TDes2QString(TAmPmName(TAmPm(EAm)));
|
||||
case PMText:
|
||||
return qt_TDes2QString(TAmPmName(TAmPm(EPm)));
|
||||
case UILanguages:
|
||||
return QVariant(symbianUILanguages());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -695,9 +695,9 @@ inline QString::QString(const QLatin1String &aLatin1) : d(fromLatin1_helper(aLat
|
||||
inline int QString::length() const
|
||||
{ return d->size; }
|
||||
inline const QChar QString::at(int i) const
|
||||
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
||||
{ Q_ASSERT(uint(i) < uint(size())); return d->data[i]; }
|
||||
inline const QChar QString::operator[](int i) const
|
||||
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
||||
{ Q_ASSERT(uint(i) < uint(size())); return d->data[i]; }
|
||||
inline const QChar QString::operator[](uint i) const
|
||||
{ Q_ASSERT(i < uint(size())); return d->data[i]; }
|
||||
inline bool QString::isEmpty() const
|
||||
|
@ -199,11 +199,11 @@ QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &o
|
||||
chars = other.chars;
|
||||
length = other.length;
|
||||
pos = other.pos;
|
||||
freePrivate = true;
|
||||
|
||||
QTextBoundaryFinderPrivate *newD = (QTextBoundaryFinderPrivate *)
|
||||
realloc(d, length*sizeof(HB_CharAttributes));
|
||||
realloc(freePrivate ? d : 0, length*sizeof(HB_CharAttributes));
|
||||
Q_CHECK_PTR(newD);
|
||||
freePrivate = true;
|
||||
d = newD;
|
||||
memcpy(d, other.d, length*sizeof(HB_CharAttributes));
|
||||
|
||||
|
@ -83,6 +83,42 @@ public:
|
||||
|
||||
MenuCommand = 0x0018,
|
||||
|
||||
// Values from IAccessible2
|
||||
ActionChanged = 0x0101,
|
||||
ActiveDescendantChanged,
|
||||
AttributeChanged,
|
||||
DocumentContentChanged,
|
||||
DocumentLoadComplete,
|
||||
DocumentLoadStopped,
|
||||
DocumentReload,
|
||||
HyperlinkEndIndexChanged,
|
||||
HyperlinkNumberOfAnchorsChanged,
|
||||
HyperlinkSelectedLinkChanged,
|
||||
HypertextLinkActivated,
|
||||
HypertextLinkSelected,
|
||||
HyperlinkStartIndexChanged,
|
||||
HypertextChanged,
|
||||
HypertextNLinksChanged,
|
||||
ObjectAttributeChanged,
|
||||
PageChanged,
|
||||
SectionChanged,
|
||||
TableCaptionChanged,
|
||||
TableColumnDescriptionChanged,
|
||||
TableColumnHeaderChanged,
|
||||
TableModelChanged,
|
||||
TableRowDescriptionChanged,
|
||||
TableRowHeaderChanged,
|
||||
TableSummaryChanged,
|
||||
TextAttributeChanged,
|
||||
TextCaretMoved,
|
||||
TextChanged,
|
||||
TextColumnChanged,
|
||||
TextInserted,
|
||||
TextRemoved,
|
||||
TextUpdated,
|
||||
TextSelectionChanged,
|
||||
VisibleDataChanged,
|
||||
|
||||
ObjectCreated = 0x8000,
|
||||
ObjectDestroyed = 0x8001,
|
||||
ObjectShow = 0x8002,
|
||||
|
@ -322,9 +322,7 @@ QString QAccessibleApplication::text(Text t, int) const
|
||||
{
|
||||
switch (t) {
|
||||
case Name:
|
||||
if (QApplication::activeWindow())
|
||||
return QApplication::activeWindow()->windowTitle();
|
||||
break;
|
||||
return QApplication::applicationName();
|
||||
case Description:
|
||||
return QApplication::applicationFilePath();
|
||||
default:
|
||||
|
@ -343,6 +343,7 @@ QT_USE_NAMESPACE
|
||||
mDialogIsExecuting = true;
|
||||
bool modalEnded = false;
|
||||
while (!modalEnded) {
|
||||
#ifndef QT_NO_EXCEPTIONS
|
||||
@try {
|
||||
[NSApp runModalForWindow:mColorPanel];
|
||||
modalEnded = true;
|
||||
@ -351,6 +352,10 @@ QT_USE_NAMESPACE
|
||||
// clicking on 'SelectedMenuItemColor' from the 'Developer'
|
||||
// palette (tab three).
|
||||
}
|
||||
#else
|
||||
[NSApp runModalForWindow:mColorPanel];
|
||||
modalEnded = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher::instance()->interrupt();
|
||||
|
@ -1977,13 +1977,14 @@ bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) co
|
||||
const bool hideHidden = !(filters & QDir::Hidden);
|
||||
const bool hideSystem = !(filters & QDir::System);
|
||||
const bool hideSymlinks = (filters & QDir::NoSymLinks);
|
||||
const bool hideDotAndDotDot = (filters & QDir::NoDotAndDotDot);
|
||||
const bool hideDot = (filters & QDir::NoDot) || (filters & QDir::NoDotAndDotDot); // ### Qt5: simplify (because NoDotAndDotDot=NoDot|NoDotDot)
|
||||
const bool hideDotDot = (filters & QDir::NoDotDot) || (filters & QDir::NoDotAndDotDot); // ### Qt5: simplify (because NoDotAndDotDot=NoDot|NoDotDot)
|
||||
|
||||
// Note that we match the behavior of entryList and not QFileInfo on this and this
|
||||
// incompatibility won't be fixed until Qt 5 at least
|
||||
bool isDotOrDot = ( (node->fileName == QLatin1String(".")
|
||||
|| node->fileName == QLatin1String("..")));
|
||||
if ( (hideHidden && (!isDotOrDot && node->isHidden()))
|
||||
bool isDot = (node->fileName == QLatin1String("."));
|
||||
bool isDotDot = (node->fileName == QLatin1String(".."));
|
||||
if ( (hideHidden && !(isDot || isDotDot) && node->isHidden())
|
||||
|| (hideSystem && node->isSystem())
|
||||
|| (hideDirs && node->isDir())
|
||||
|| (hideFiles && node->isFile())
|
||||
@ -1991,7 +1992,8 @@ bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) co
|
||||
|| (hideReadable && node->isReadable())
|
||||
|| (hideWritable && node->isWritable())
|
||||
|| (hideExecutable && node->isExecutable())
|
||||
|| (hideDotAndDotDot && isDotOrDot))
|
||||
|| (hideDot && isDot)
|
||||
|| (hideDotDot && isDotDot))
|
||||
return false;
|
||||
|
||||
return nameFilterDisables || passNameFilters(node);
|
||||
|
@ -451,8 +451,8 @@ static QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> getFactor(qreal valu
|
||||
static qreal interpolate(const QPair<QGraphicsAnchorLayoutPrivate::Interval, qreal> &factor,
|
||||
qreal min, qreal minPref, qreal pref, qreal maxPref, qreal max)
|
||||
{
|
||||
qreal lower;
|
||||
qreal upper;
|
||||
qreal lower = 0;
|
||||
qreal upper = 0;
|
||||
|
||||
switch (factor.first) {
|
||||
case QGraphicsAnchorLayoutPrivate::MinimumToMinPreferred:
|
||||
|
@ -167,7 +167,7 @@ QGraphicsLayout::QGraphicsLayout(QGraphicsLayoutItem *parent)
|
||||
" neither a QGraphicsWidget nor QGraphicsLayout");
|
||||
}
|
||||
}
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, QSizePolicy::DefaultType);
|
||||
d_func()->sizePolicy = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, QSizePolicy::DefaultType);
|
||||
setOwnedByLayout(true);
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ QGraphicsLayout::QGraphicsLayout(QGraphicsLayoutPrivate &dd, QGraphicsLayoutItem
|
||||
" neither a QGraphicsWidget nor QGraphicsLayout");
|
||||
}
|
||||
}
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, QSizePolicy::DefaultType);
|
||||
d_func()->sizePolicy = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, QSizePolicy::DefaultType);
|
||||
setOwnedByLayout(true);
|
||||
}
|
||||
|
||||
|
@ -50,14 +50,14 @@
|
||||
|
||||
QGraphicsSceneBspTreeIndex index use a BSP(Binary Space Partitioning)
|
||||
implementation to discover items quickly. This implementation is
|
||||
very efficient for static scene. It has a depth that you can set.
|
||||
very efficient for static scenes. It has a depth that you can set.
|
||||
The depth directly affects performance and memory usage; the latter
|
||||
growing exponentially with the depth of the tree. With an optimal tree
|
||||
depth, the index can instantly determine the locality of items, even
|
||||
for scenes with thousands or millions of items. This also greatly improves
|
||||
rendering performance.
|
||||
|
||||
By default, the value is 0, in which case Qt will guess a reasonable
|
||||
By default, the depth value is 0, in which case Qt will guess a reasonable
|
||||
default depth based on the size, location and number of items in the
|
||||
scene. If these parameters change frequently, however, you may experience
|
||||
slowdowns as the index retunes the depth internally. You can avoid
|
||||
|
@ -857,8 +857,6 @@ void QGraphicsWidgetPrivate::setWidth(qreal w)
|
||||
if (q->geometry().width() == w)
|
||||
return;
|
||||
|
||||
QRectF oldGeom = q->geometry();
|
||||
|
||||
q->setGeometry(QRectF(q->x(), q->y(), w, height()));
|
||||
}
|
||||
|
||||
@ -882,8 +880,6 @@ void QGraphicsWidgetPrivate::setHeight(qreal h)
|
||||
if (q->geometry().height() == h)
|
||||
return;
|
||||
|
||||
QRectF oldGeom = q->geometry();
|
||||
|
||||
q->setGeometry(QRectF(q->x(), q->y(), width(), h));
|
||||
}
|
||||
|
||||
|
@ -1224,12 +1224,8 @@ Qt::HANDLE QPixmap::handle() const
|
||||
{
|
||||
#if defined(Q_WS_X11)
|
||||
const QPixmapData *pd = pixmapData();
|
||||
if (pd) {
|
||||
if (pd->classId() == QPixmapData::X11Class)
|
||||
return static_cast<const QX11PixmapData*>(pd)->handle();
|
||||
else
|
||||
qWarning("QPixmap::handle(): Pixmap is not an X11 class pixmap");
|
||||
}
|
||||
if (pd && pd->classId() == QPixmapData::X11Class)
|
||||
return static_cast<const QX11PixmapData*>(pd)->handle();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -121,15 +121,12 @@ QAbstractProxyModel::~QAbstractProxyModel()
|
||||
void QAbstractProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
||||
{
|
||||
Q_D(QAbstractProxyModel);
|
||||
if (d->model) {
|
||||
if (d->model)
|
||||
disconnect(d->model, SIGNAL(destroyed()), this, SLOT(_q_sourceModelDestroyed()));
|
||||
disconnect(d->model, SIGNAL(modelReset()), this, SLOT(resetInternalData()));
|
||||
}
|
||||
|
||||
if (sourceModel) {
|
||||
d->model = sourceModel;
|
||||
connect(d->model, SIGNAL(destroyed()), this, SLOT(_q_sourceModelDestroyed()));
|
||||
connect(d->model, SIGNAL(modelReset()), this, SLOT(resetInternalData()));
|
||||
} else {
|
||||
d->model = QAbstractItemModelPrivate::staticEmptyModel();
|
||||
}
|
||||
@ -383,25 +380,6 @@ Qt::DropActions QAbstractProxyModel::supportedDropActions() const
|
||||
return d->model->supportedDropActions();
|
||||
}
|
||||
|
||||
/*
|
||||
\since 4.8
|
||||
|
||||
This slot is called just after the internal data of a model is cleared
|
||||
while it is being reset.
|
||||
|
||||
This slot is provided the convenience of subclasses of concrete proxy
|
||||
models, such as subclasses of QSortFilterProxyModel which maintain extra
|
||||
data.
|
||||
|
||||
\snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 10
|
||||
|
||||
\sa modelAboutToBeReset(), modelReset()
|
||||
*/
|
||||
void QAbstractProxyModel::resetInternalData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qabstractproxymodel.cpp"
|
||||
|
@ -95,9 +95,6 @@ public:
|
||||
QStringList mimeTypes() const;
|
||||
Qt::DropActions supportedDropActions() const;
|
||||
|
||||
protected Q_SLOTS:
|
||||
void resetInternalData();
|
||||
|
||||
protected:
|
||||
QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent);
|
||||
|
||||
|
@ -291,7 +291,7 @@ void QDataWidgetMapperPrivate::_q_modelDestroyed()
|
||||
\snippet doc/src/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp 0
|
||||
|
||||
After the call to toFirst(), \c mySpinBox displays the value \c{1}, \c myLineEdit
|
||||
displays \c {Nokia Corporation and/or its subsidiary(-ies)} and \c myCountryChooser displays \c{Oslo}. The
|
||||
displays \c{Qt Norway} and \c myCountryChooser displays \c{Oslo}. The
|
||||
navigational functions toFirst(), toNext(), toPrevious(), toLast() and setCurrentIndex()
|
||||
can be used to navigate in the model and update the widgets with contents from
|
||||
the model.
|
||||
|
@ -1145,11 +1145,8 @@ void QItemSelectionModel::clearSelection()
|
||||
Q_D(QItemSelectionModel);
|
||||
if (d->ranges.count() == 0 && d->currentSelection.count() == 0)
|
||||
return;
|
||||
QItemSelection selection = d->ranges;
|
||||
selection.merge(d->currentSelection, d->currentCommand);
|
||||
d->ranges.clear();
|
||||
d->currentSelection.clear();
|
||||
emit selectionChanged(QItemSelection(), selection);
|
||||
|
||||
select(QItemSelection(), Clear);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1101,6 +1101,21 @@ void QTableView::setRootIndex(const QModelIndex &index)
|
||||
QAbstractItemView::setRootIndex(index);
|
||||
}
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
*/
|
||||
void QTableView::doItemsLayout()
|
||||
{
|
||||
Q_D(QTableView);
|
||||
QAbstractItemView::doItemsLayout();
|
||||
if (verticalScrollMode() == QAbstractItemView::ScrollPerItem)
|
||||
d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value());
|
||||
else
|
||||
d->verticalHeader->setOffset(verticalScrollBar()->value());
|
||||
if (!d->verticalHeader->updatesEnabled())
|
||||
d->verticalHeader->setUpdatesEnabled(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
*/
|
||||
@ -1285,7 +1300,6 @@ void QTableView::paintEvent(QPaintEvent *event)
|
||||
const QPen gridPen = QPen(gridColor, 0, d->gridStyle);
|
||||
const QHeaderView *verticalHeader = d->verticalHeader;
|
||||
const QHeaderView *horizontalHeader = d->horizontalHeader;
|
||||
const QStyle::State state = option.state;
|
||||
const bool alternate = d->alternatingColors;
|
||||
const bool rightToLeft = isRightToLeft();
|
||||
|
||||
@ -1975,9 +1989,13 @@ QModelIndexList QTableView::selectedIndexes() const
|
||||
previous number of rows is specified by \a oldCount, and the new
|
||||
number of rows is specified by \a newCount.
|
||||
*/
|
||||
void QTableView::rowCountChanged(int /*oldCount*/, int /*newCount*/ )
|
||||
void QTableView::rowCountChanged(int oldCount, int newCount )
|
||||
{
|
||||
Q_D(QTableView);
|
||||
//when removing rows, we need to disable updates for the header until the geometries have been
|
||||
//updated and the offset has been adjusted, or we risk calling paintSection for all the sections
|
||||
if (newCount < oldCount)
|
||||
d->verticalHeader->setUpdatesEnabled(false);
|
||||
d->doDelayedItemsLayout();
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
void setModel(QAbstractItemModel *model);
|
||||
void setRootIndex(const QModelIndex &index);
|
||||
void setSelectionModel(QItemSelectionModel *selectionModel);
|
||||
void doItemsLayout();
|
||||
|
||||
QHeaderView *horizontalHeader() const;
|
||||
QHeaderView *verticalHeader() const;
|
||||
|
@ -2703,6 +2703,9 @@ QS60ThreadLocalData::QS60ThreadLocalData()
|
||||
|
||||
QS60ThreadLocalData::~QS60ThreadLocalData()
|
||||
{
|
||||
for (int i = 0; i < releaseFuncs.count(); ++i)
|
||||
releaseFuncs[i]();
|
||||
releaseFuncs.clear();
|
||||
if (!usingCONEinstances) {
|
||||
delete screenDevice;
|
||||
wsSession.Close();
|
||||
|
@ -2372,8 +2372,13 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
case WM_GETOBJECT:
|
||||
{
|
||||
/* On Win64, lParam can be 0x00000000fffffffc or 0xfffffffffffffffc (!),
|
||||
but MSDN says that lParam should be converted to a DWORD
|
||||
before its compared against OBJID_CLIENT
|
||||
*/
|
||||
const DWORD dwObjId = (DWORD)lParam;
|
||||
// Ignoring all requests while starting up
|
||||
if (QApplication::startingUp() || QApplication::closingDown() || lParam != (LPARAM)OBJID_CLIENT) {
|
||||
if (QApplication::startingUp() || QApplication::closingDown() || dwObjId != OBJID_CLIENT) {
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
|
@ -55,6 +55,9 @@
|
||||
#endif // QT_NO_XCURSOR
|
||||
|
||||
#ifndef QT_NO_XFIXES
|
||||
#ifndef Status
|
||||
#define Status int
|
||||
#endif
|
||||
# include <X11/extensions/Xfixes.h>
|
||||
#endif // QT_NO_XFIXES
|
||||
|
||||
|
@ -566,7 +566,6 @@ void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,
|
||||
= w->d_func()->gestureContext.find(type);
|
||||
if (it != w->d_func()->gestureContext.end()) {
|
||||
// i.e. 'w' listens to gesture 'type'
|
||||
Qt::GestureFlags flags = it.value();
|
||||
if (!(it.value() & Qt::DontStartGestureOnChildren) && w != widget) {
|
||||
// conflicting gesture!
|
||||
(*conflicts)[widget].append(gestures[widget]);
|
||||
|
@ -97,6 +97,10 @@ static const int qt_symbian_max_screens = 4;
|
||||
//this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2
|
||||
#define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13)
|
||||
|
||||
class QSymbianTypeFaceExtras;
|
||||
typedef QHash<QString, const QSymbianTypeFaceExtras *> QSymbianTypeFaceExtrasHash;
|
||||
typedef void (*QThreadLocalReleaseFunc)();
|
||||
|
||||
class Q_AUTOTEST_EXPORT QS60ThreadLocalData
|
||||
{
|
||||
public:
|
||||
@ -105,6 +109,8 @@ public:
|
||||
bool usingCONEinstances;
|
||||
RWsSession wsSession;
|
||||
CWsScreenDevice *screenDevice;
|
||||
QSymbianTypeFaceExtrasHash fontData;
|
||||
QVector<QThreadLocalReleaseFunc> releaseFuncs;
|
||||
};
|
||||
|
||||
class QS60Data
|
||||
@ -175,6 +181,8 @@ public:
|
||||
inline CWsScreenDevice* screenDevice(const QWidget *widget);
|
||||
inline CWsScreenDevice* screenDevice(int screenNumber);
|
||||
static inline int screenNumberForWidget(const QWidget *widget);
|
||||
inline QSymbianTypeFaceExtrasHash& fontData();
|
||||
inline void addThreadLocalReleaseFunc(QThreadLocalReleaseFunc func);
|
||||
static inline CCoeAppUi* appUi();
|
||||
static inline CEikMenuBar* menuBar();
|
||||
#ifdef Q_WS_S60
|
||||
@ -470,6 +478,24 @@ inline int QS60Data::screenNumberForWidget(const QWidget *widget)
|
||||
return qt_widget_private(const_cast<QWidget *>(w))->symbianScreenNumber;
|
||||
}
|
||||
|
||||
inline QSymbianTypeFaceExtrasHash& QS60Data::fontData()
|
||||
{
|
||||
if (!tls.hasLocalData()) {
|
||||
tls.setLocalData(new QS60ThreadLocalData);
|
||||
}
|
||||
return tls.localData()->fontData;
|
||||
}
|
||||
|
||||
inline void QS60Data::addThreadLocalReleaseFunc(QThreadLocalReleaseFunc func)
|
||||
{
|
||||
if (!tls.hasLocalData()) {
|
||||
tls.setLocalData(new QS60ThreadLocalData);
|
||||
}
|
||||
QS60ThreadLocalData *data = tls.localData();
|
||||
if (!data->releaseFuncs.contains(func))
|
||||
data->releaseFuncs.append(func);
|
||||
}
|
||||
|
||||
inline CCoeAppUi* QS60Data::appUi()
|
||||
{
|
||||
return CCoeEnv::Static()-> AppUi();
|
||||
|
@ -11206,6 +11206,7 @@ void QWidget::setAccessibleName(const QString &name)
|
||||
{
|
||||
Q_D(QWidget);
|
||||
d->accessibleName = name;
|
||||
QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
|
||||
}
|
||||
|
||||
QString QWidget::accessibleName() const
|
||||
@ -11227,6 +11228,7 @@ void QWidget::setAccessibleDescription(const QString &description)
|
||||
{
|
||||
Q_D(QWidget);
|
||||
d->accessibleDescription = description;
|
||||
QAccessible::updateAccessibility(this, 0, QAccessible::DescriptionChanged);
|
||||
}
|
||||
|
||||
QString QWidget::accessibleDescription() const
|
||||
|
@ -239,7 +239,16 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
|
||||
if (w != oldSize.width() || h != oldSize.height())
|
||||
data.window_state &= ~Qt::WindowMaximized;
|
||||
|
||||
if (extra) { // any size restrictions?
|
||||
bool checkExtra = true;
|
||||
if (q->isWindow() && (data.window_state & Qt::WindowFullScreen)) {
|
||||
// Do not modity window size for fullscreen windows, if requested
|
||||
// size is already equal to clientRect.
|
||||
TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
|
||||
if (w == r.Width() && h == r.Height())
|
||||
checkExtra = false;
|
||||
}
|
||||
|
||||
if (checkExtra && extra) { // any size restrictions?
|
||||
w = qMin(w,extra->maxw);
|
||||
h = qMin(h,extra->maxh);
|
||||
w = qMax(w,extra->minw);
|
||||
|
@ -486,8 +486,6 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
|
||||
|
||||
bool topLevel = (flags & Qt::Window);
|
||||
bool popup = (type == Qt::Popup);
|
||||
bool dialog = (type == Qt::Dialog
|
||||
|| type == Qt::Sheet);
|
||||
bool desktop = (type == Qt::Desktop);
|
||||
bool tool = (type == Qt::Tool || type == Qt::SplashScreen
|
||||
|| type == Qt::ToolTip || type == Qt::Drawer);
|
||||
@ -553,7 +551,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
|
||||
int sh = DisplayHeight(dpy,scr);
|
||||
|
||||
if (desktop) { // desktop widget
|
||||
dialog = popup = false; // force these flags off
|
||||
popup = false; // force these flags off
|
||||
data.crect.setRect(0, 0, sw, sh);
|
||||
} else if (topLevel && !q->testAttribute(Qt::WA_Resized)) {
|
||||
QDesktopWidget *desktopWidget = qApp->desktop();
|
||||
@ -954,8 +952,13 @@ static void qt_x11_recreateWidget(QWidget *widget)
|
||||
// recreate their GL context, which in turn causes them to choose
|
||||
// their visual again. Now that WA_TranslucentBackground is set,
|
||||
// QGLContext::chooseVisual will select an ARGB visual.
|
||||
QEvent e(QEvent::ParentChange);
|
||||
QApplication::sendEvent(widget, &e);
|
||||
|
||||
// QGLWidget expects a ParentAboutToChange to be sent first
|
||||
QEvent aboutToChangeEvent(QEvent::ParentAboutToChange);
|
||||
QApplication::sendEvent(widget, &aboutToChangeEvent);
|
||||
|
||||
QEvent parentChangeEvent(QEvent::ParentChange);
|
||||
QApplication::sendEvent(widget, &parentChangeEvent);
|
||||
} else {
|
||||
// For regular widgets, reparent them with their parent which
|
||||
// also triggers a recreation of the native window
|
||||
|
@ -840,6 +840,22 @@ const QGradient *QBrush::gradient() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush)
|
||||
{
|
||||
if (brush.style() == Qt::RadialGradientPattern) {
|
||||
const QGradient *g = brush.gradient();
|
||||
const QRadialGradient *rg = static_cast<const QRadialGradient *>(g);
|
||||
|
||||
if (!qFuzzyIsNull(rg->focalRadius()))
|
||||
return true;
|
||||
|
||||
QPointF delta = rg->focalPoint() - rg->center();
|
||||
if (delta.x() * delta.x() + delta.y() * delta.y() > rg->radius() * rg->radius())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if the brush is fully opaque otherwise false. A brush
|
||||
@ -849,6 +865,7 @@ const QGradient *QBrush::gradient() const
|
||||
\i The alpha component of the color() is 255.
|
||||
\i Its texture() does not have an alpha channel and is not a QBitmap.
|
||||
\i The colors in the gradient() all have an alpha component that is 255.
|
||||
\i It is an extended radial gradient.
|
||||
\endlist
|
||||
*/
|
||||
|
||||
@ -860,6 +877,9 @@ bool QBrush::isOpaque() const
|
||||
if (d->style == Qt::SolidPattern)
|
||||
return opaqueColor;
|
||||
|
||||
if (qt_isExtendedRadialGradient(*this))
|
||||
return false;
|
||||
|
||||
if (d->style == Qt::LinearGradientPattern
|
||||
|| d->style == Qt::RadialGradientPattern
|
||||
|| d->style == Qt::ConicalGradientPattern) {
|
||||
@ -1209,8 +1229,10 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
|
||||
|
||||
\list
|
||||
\o \e Linear gradients interpolate colors between start and end points.
|
||||
\o \e Radial gradients interpolate colors between a focal point and end
|
||||
points on a circle surrounding it.
|
||||
\o \e Simple radial gradients interpolate colors between a focal point
|
||||
and end points on a circle surrounding it.
|
||||
\o \e Extended radial gradients interpolate colors between a center and
|
||||
a focal circle.
|
||||
\o \e Conical gradients interpolate colors around a center point.
|
||||
\endlist
|
||||
|
||||
@ -1506,8 +1528,6 @@ void QGradient::setInterpolationMode(InterpolationMode mode)
|
||||
dummy = p;
|
||||
}
|
||||
|
||||
#undef Q_DUMMY_ACCESSOR
|
||||
|
||||
/*!
|
||||
\fn bool QGradient::operator!=(const QGradient &gradient) const
|
||||
\since 4.2
|
||||
@ -1541,7 +1561,7 @@ bool QGradient::operator==(const QGradient &gradient) const
|
||||
|| m_data.radial.cy != gradient.m_data.radial.cy
|
||||
|| m_data.radial.fx != gradient.m_data.radial.fx
|
||||
|| m_data.radial.fy != gradient.m_data.radial.fy
|
||||
|| m_data.radial.radius != gradient.m_data.radial.radius)
|
||||
|| m_data.radial.cradius != gradient.m_data.radial.cradius)
|
||||
return false;
|
||||
} else { // m_type == ConicalGradient
|
||||
if (m_data.conical.cx != gradient.m_data.conical.cx
|
||||
@ -1747,10 +1767,17 @@ void QLinearGradient::setFinalStop(const QPointF &stop)
|
||||
\brief The QRadialGradient class is used in combination with QBrush to
|
||||
specify a radial gradient brush.
|
||||
|
||||
Radial gradients interpolate colors between a focal point and end
|
||||
points on a circle surrounding it. Outside the end points the
|
||||
gradient is either padded, reflected or repeated depending on the
|
||||
currently set \l {QGradient::Spread}{spread} method:
|
||||
Qt supports both simple and extended radial gradients.
|
||||
|
||||
Simple radial gradients interpolate colors between a focal point and end
|
||||
points on a circle surrounding it. Extended radial gradients interpolate
|
||||
colors between a focal circle and a center circle. Points outside the cone
|
||||
defined by the two circles will be transparent. For simple radial gradients
|
||||
the focal point is adjusted to lie inside the center circle, whereas the
|
||||
focal point can have any position in an extended radial gradient.
|
||||
|
||||
Outside the end points the gradient is either padded, reflected or repeated
|
||||
depending on the currently set \l {QGradient::Spread}{spread} method:
|
||||
|
||||
\table
|
||||
\row
|
||||
@ -1795,9 +1822,14 @@ static QPointF qt_radial_gradient_adapt_focal_point(const QPointF ¢er,
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a radial gradient with the given \a center, \a
|
||||
Constructs a simple radial gradient with the given \a center, \a
|
||||
radius and \a focalPoint.
|
||||
|
||||
\note If the given focal point is outside the circle defined by the
|
||||
center (\a cx, \a cy) and the \a radius it will be re-adjusted to
|
||||
the intersection between the line from the center to the focal point
|
||||
and the circle.
|
||||
|
||||
\sa QGradient::setColorAt(), QGradient::setStops()
|
||||
*/
|
||||
|
||||
@ -1807,7 +1839,7 @@ QRadialGradient::QRadialGradient(const QPointF ¢er, qreal radius, const QPoi
|
||||
m_spread = PadSpread;
|
||||
m_data.radial.cx = center.x();
|
||||
m_data.radial.cy = center.y();
|
||||
m_data.radial.radius = radius;
|
||||
m_data.radial.cradius = radius;
|
||||
|
||||
QPointF adapted_focal = qt_radial_gradient_adapt_focal_point(center, radius, focalPoint);
|
||||
m_data.radial.fx = adapted_focal.x();
|
||||
@ -1815,7 +1847,7 @@ QRadialGradient::QRadialGradient(const QPointF ¢er, qreal radius, const QPoi
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a radial gradient with the given \a center, \a
|
||||
Constructs a simple radial gradient with the given \a center, \a
|
||||
radius and the focal point in the circle center.
|
||||
|
||||
\sa QGradient::setColorAt(), QGradient::setStops()
|
||||
@ -1826,16 +1858,21 @@ QRadialGradient::QRadialGradient(const QPointF ¢er, qreal radius)
|
||||
m_spread = PadSpread;
|
||||
m_data.radial.cx = center.x();
|
||||
m_data.radial.cy = center.y();
|
||||
m_data.radial.radius = radius;
|
||||
m_data.radial.cradius = radius;
|
||||
m_data.radial.fx = center.x();
|
||||
m_data.radial.fy = center.y();
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Constructs a radial gradient with the given center (\a cx, \a cy),
|
||||
Constructs a simple radial gradient with the given center (\a cx, \a cy),
|
||||
\a radius and focal point (\a fx, \a fy).
|
||||
|
||||
\note If the given focal point is outside the circle defined by the
|
||||
center (\a cx, \a cy) and the \a radius it will be re-adjusted to
|
||||
the intersection between the line from the center to the focal point
|
||||
and the circle.
|
||||
|
||||
\sa QGradient::setColorAt(), QGradient::setStops()
|
||||
*/
|
||||
|
||||
@ -1845,7 +1882,7 @@ QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal radius, qreal fx, qre
|
||||
m_spread = PadSpread;
|
||||
m_data.radial.cx = cx;
|
||||
m_data.radial.cy = cy;
|
||||
m_data.radial.radius = radius;
|
||||
m_data.radial.cradius = radius;
|
||||
|
||||
QPointF adapted_focal = qt_radial_gradient_adapt_focal_point(QPointF(cx, cy),
|
||||
radius,
|
||||
@ -1856,7 +1893,7 @@ QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal radius, qreal fx, qre
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a radial gradient with the center at (\a cx, \a cy) and the
|
||||
Constructs a simple radial gradient with the center at (\a cx, \a cy) and the
|
||||
specified \a radius. The focal point lies at the center of the circle.
|
||||
|
||||
\sa QGradient::setColorAt(), QGradient::setStops()
|
||||
@ -1867,14 +1904,14 @@ QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal radius)
|
||||
m_spread = PadSpread;
|
||||
m_data.radial.cx = cx;
|
||||
m_data.radial.cy = cy;
|
||||
m_data.radial.radius = radius;
|
||||
m_data.radial.cradius = radius;
|
||||
m_data.radial.fx = cx;
|
||||
m_data.radial.fy = cy;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Constructs a radial gradient with the center and focal point at
|
||||
Constructs a simple radial gradient with the center and focal point at
|
||||
(0, 0) with a radius of 1.
|
||||
*/
|
||||
QRadialGradient::QRadialGradient()
|
||||
@ -1883,11 +1920,51 @@ QRadialGradient::QRadialGradient()
|
||||
m_spread = PadSpread;
|
||||
m_data.radial.cx = 0;
|
||||
m_data.radial.cy = 0;
|
||||
m_data.radial.radius = 1;
|
||||
m_data.radial.cradius = 1;
|
||||
m_data.radial.fx = 0;
|
||||
m_data.radial.fy = 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
Constructs an extended radial gradient with the given \a center, \a
|
||||
centerRadius, \a focalPoint, and \a focalRadius.
|
||||
*/
|
||||
QRadialGradient::QRadialGradient(const QPointF ¢er, qreal centerRadius, const QPointF &focalPoint, qreal focalRadius)
|
||||
{
|
||||
m_type = RadialGradient;
|
||||
m_spread = PadSpread;
|
||||
m_data.radial.cx = center.x();
|
||||
m_data.radial.cy = center.y();
|
||||
m_data.radial.cradius = centerRadius;
|
||||
|
||||
m_data.radial.fx = focalPoint.x();
|
||||
m_data.radial.fy = focalPoint.y();
|
||||
setFocalRadius(focalRadius);
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
Constructs an extended radial gradient with the given \a center, \a
|
||||
centerRadius, \a focalPoint, and \a focalRadius.
|
||||
Constructs a radial gradient with the given center (\a cx, \a cy),
|
||||
center radius \a centerRadius, focal point (\a fx, \a fy), and
|
||||
focal radius \a focalRadius.
|
||||
*/
|
||||
QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal centerRadius, qreal fx, qreal fy, qreal focalRadius)
|
||||
{
|
||||
m_type = RadialGradient;
|
||||
m_spread = PadSpread;
|
||||
m_data.radial.cx = cx;
|
||||
m_data.radial.cy = cy;
|
||||
m_data.radial.cradius = centerRadius;
|
||||
|
||||
m_data.radial.fx = fx;
|
||||
m_data.radial.fy = fy;
|
||||
setFocalRadius(focalRadius);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the center of this radial gradient in logical coordinates.
|
||||
@ -1932,13 +2009,15 @@ void QRadialGradient::setCenter(const QPointF ¢er)
|
||||
/*!
|
||||
Returns the radius of this radial gradient in logical coordinates.
|
||||
|
||||
Equivalent to centerRadius()
|
||||
|
||||
\sa QGradient::stops()
|
||||
*/
|
||||
|
||||
qreal QRadialGradient::radius() const
|
||||
{
|
||||
Q_ASSERT(m_type == RadialGradient);
|
||||
return m_data.radial.radius;
|
||||
return m_data.radial.cradius;
|
||||
}
|
||||
|
||||
|
||||
@ -1947,13 +2026,81 @@ qreal QRadialGradient::radius() const
|
||||
|
||||
Sets the radius of this radial gradient in logical coordinates
|
||||
to \a radius
|
||||
|
||||
Equivalent to setCenterRadius()
|
||||
*/
|
||||
void QRadialGradient::setRadius(qreal radius)
|
||||
{
|
||||
Q_ASSERT(m_type == RadialGradient);
|
||||
m_data.radial.radius = radius;
|
||||
m_data.radial.cradius = radius;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
Returns the center radius of this radial gradient in logical
|
||||
coordinates.
|
||||
|
||||
\sa QGradient::stops()
|
||||
*/
|
||||
qreal QRadialGradient::centerRadius() const
|
||||
{
|
||||
Q_ASSERT(m_type == RadialGradient);
|
||||
return m_data.radial.cradius;
|
||||
}
|
||||
|
||||
/*
|
||||
\since 4.8
|
||||
|
||||
Sets the center radius of this radial gradient in logical coordinates
|
||||
to \a radius
|
||||
*/
|
||||
void QRadialGradient::setCenterRadius(qreal radius)
|
||||
{
|
||||
Q_ASSERT(m_type == RadialGradient);
|
||||
m_data.radial.cradius = radius;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
Returns the focal radius of this radial gradient in logical
|
||||
coordinates.
|
||||
|
||||
\sa QGradient::stops()
|
||||
*/
|
||||
qreal QRadialGradient::focalRadius() const
|
||||
{
|
||||
Q_ASSERT(m_type == RadialGradient);
|
||||
Q_DUMMY_ACCESSOR
|
||||
|
||||
// mask away low three bits
|
||||
union { float f; quint32 i; } u;
|
||||
u.i = i & ~0x07;
|
||||
return u.f;
|
||||
}
|
||||
|
||||
/*
|
||||
\since 4.8
|
||||
|
||||
Sets the focal radius of this radial gradient in logical coordinates
|
||||
to \a radius
|
||||
*/
|
||||
void QRadialGradient::setFocalRadius(qreal radius)
|
||||
{
|
||||
Q_ASSERT(m_type == RadialGradient);
|
||||
Q_DUMMY_ACCESSOR
|
||||
|
||||
// Since there's no QGradientData, we only have the dummy void * to
|
||||
// store additional data in. The three lowest bits are already
|
||||
// taken, thus we cut the three lowest bits from the significand
|
||||
// and store the radius as a float.
|
||||
union { float f; quint32 i; } u;
|
||||
u.f = float(radius);
|
||||
// add 0x04 to round up when we drop the three lowest bits
|
||||
i |= (u.i + 0x04) & ~0x07;
|
||||
dummy = p;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the focal point of this radial gradient in logical
|
||||
@ -2193,4 +2340,6 @@ void QConicalGradient::setAngle(qreal angle)
|
||||
\sa setTransform()
|
||||
*/
|
||||
|
||||
#undef Q_DUMMY_ACCESSOR
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -255,6 +255,7 @@ private:
|
||||
friend class QLinearGradient;
|
||||
friend class QRadialGradient;
|
||||
friend class QConicalGradient;
|
||||
friend class QBrush;
|
||||
|
||||
Type m_type;
|
||||
Spread m_spread;
|
||||
@ -264,7 +265,7 @@ private:
|
||||
qreal x1, y1, x2, y2;
|
||||
} linear;
|
||||
struct {
|
||||
qreal cx, cy, fx, fy, radius;
|
||||
qreal cx, cy, fx, fy, cradius;
|
||||
} radial;
|
||||
struct {
|
||||
qreal cx, cy, angle;
|
||||
@ -303,6 +304,9 @@ public:
|
||||
QRadialGradient(const QPointF ¢er, qreal radius);
|
||||
QRadialGradient(qreal cx, qreal cy, qreal radius);
|
||||
|
||||
QRadialGradient(const QPointF ¢er, qreal centerRadius, const QPointF &focalPoint, qreal focalRadius);
|
||||
QRadialGradient(qreal cx, qreal cy, qreal centerRadius, qreal fx, qreal fy, qreal focalRadius);
|
||||
|
||||
QPointF center() const;
|
||||
void setCenter(const QPointF ¢er);
|
||||
inline void setCenter(qreal x, qreal y) { setCenter(QPointF(x, y)); }
|
||||
@ -313,6 +317,12 @@ public:
|
||||
|
||||
qreal radius() const;
|
||||
void setRadius(qreal radius);
|
||||
|
||||
qreal centerRadius() const;
|
||||
void setCenterRadius(qreal radius);
|
||||
|
||||
qreal focalRadius() const;
|
||||
void setFocalRadius(qreal radius);
|
||||
};
|
||||
|
||||
|
||||
|
@ -75,44 +75,10 @@ enum {
|
||||
fixed_scale = 1 << 16,
|
||||
half_point = 1 << 15
|
||||
};
|
||||
|
||||
// must be multiple of 4 for easier SIMD implementations
|
||||
static const int buffer_size = 2048;
|
||||
|
||||
struct LinearGradientValues
|
||||
{
|
||||
qreal dx;
|
||||
qreal dy;
|
||||
qreal l;
|
||||
qreal off;
|
||||
};
|
||||
|
||||
struct RadialGradientValues
|
||||
{
|
||||
qreal dx;
|
||||
qreal dy;
|
||||
qreal a;
|
||||
};
|
||||
|
||||
struct Operator;
|
||||
typedef uint* (QT_FASTCALL *DestFetchProc)(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length);
|
||||
typedef void (QT_FASTCALL *DestStoreProc)(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length);
|
||||
typedef const uint* (QT_FASTCALL *SourceFetchProc)(uint *buffer, const Operator *o, const QSpanData *data, int y, int x, int length);
|
||||
|
||||
|
||||
struct Operator
|
||||
{
|
||||
QPainter::CompositionMode mode;
|
||||
DestFetchProc dest_fetch;
|
||||
DestStoreProc dest_store;
|
||||
SourceFetchProc src_fetch;
|
||||
CompositionFunctionSolid funcSolid;
|
||||
CompositionFunction func;
|
||||
union {
|
||||
LinearGradientValues linear;
|
||||
RadialGradientValues radial;
|
||||
// TextureValues texture;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
Destination fetch. This is simple as we don't have to do bounds checks or
|
||||
transformations
|
||||
@ -1346,64 +1312,13 @@ static const SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static inline uint qt_gradient_pixel(const QGradientData *data, qreal pos)
|
||||
{
|
||||
int ipos = int(pos * (GRADIENT_STOPTABLE_SIZE - 1) + qreal(0.5));
|
||||
|
||||
// calculate the actual offset.
|
||||
if (ipos < 0 || ipos >= GRADIENT_STOPTABLE_SIZE) {
|
||||
if (data->spread == QGradient::RepeatSpread) {
|
||||
ipos = ipos % GRADIENT_STOPTABLE_SIZE;
|
||||
ipos = ipos < 0 ? GRADIENT_STOPTABLE_SIZE + ipos : ipos;
|
||||
|
||||
} else if (data->spread == QGradient::ReflectSpread) {
|
||||
const int limit = GRADIENT_STOPTABLE_SIZE * 2 - 1;
|
||||
ipos = ipos % limit;
|
||||
ipos = ipos < 0 ? limit + ipos : ipos;
|
||||
ipos = ipos >= GRADIENT_STOPTABLE_SIZE ? limit - ipos : ipos;
|
||||
|
||||
} else {
|
||||
if (ipos < 0) ipos = 0;
|
||||
else if (ipos >= GRADIENT_STOPTABLE_SIZE) ipos = GRADIENT_STOPTABLE_SIZE-1;
|
||||
}
|
||||
}
|
||||
|
||||
Q_ASSERT(ipos >= 0);
|
||||
Q_ASSERT(ipos < GRADIENT_STOPTABLE_SIZE);
|
||||
|
||||
return data->colorTable[ipos];
|
||||
}
|
||||
|
||||
#define FIXPT_BITS 8
|
||||
#define FIXPT_SIZE (1<<FIXPT_BITS)
|
||||
|
||||
static uint qt_gradient_pixel_fixed(const QGradientData *data, int fixed_pos)
|
||||
{
|
||||
int ipos = (fixed_pos + (FIXPT_SIZE / 2)) >> FIXPT_BITS;
|
||||
|
||||
// calculate the actual offset.
|
||||
if (ipos < 0 || ipos >= GRADIENT_STOPTABLE_SIZE) {
|
||||
if (data->spread == QGradient::RepeatSpread) {
|
||||
ipos = ipos % GRADIENT_STOPTABLE_SIZE;
|
||||
ipos = ipos < 0 ? GRADIENT_STOPTABLE_SIZE + ipos : ipos;
|
||||
|
||||
} else if (data->spread == QGradient::ReflectSpread) {
|
||||
const int limit = GRADIENT_STOPTABLE_SIZE * 2 - 1;
|
||||
ipos = ipos % limit;
|
||||
ipos = ipos < 0 ? limit + ipos : ipos;
|
||||
ipos = ipos >= GRADIENT_STOPTABLE_SIZE ? limit - ipos : ipos;
|
||||
|
||||
} else {
|
||||
if (ipos < 0) ipos = 0;
|
||||
else if (ipos >= GRADIENT_STOPTABLE_SIZE) ipos = GRADIENT_STOPTABLE_SIZE-1;
|
||||
}
|
||||
}
|
||||
|
||||
Q_ASSERT(ipos >= 0);
|
||||
Q_ASSERT(ipos < GRADIENT_STOPTABLE_SIZE);
|
||||
|
||||
return data->colorTable[ipos];
|
||||
return data->colorTable[qt_gradient_clamp(data, ipos)];
|
||||
}
|
||||
|
||||
static void QT_FASTCALL getLinearGradientValues(LinearGradientValues *v, const QSpanData *data)
|
||||
@ -1419,8 +1334,8 @@ static void QT_FASTCALL getLinearGradientValues(LinearGradientValues *v, const Q
|
||||
}
|
||||
}
|
||||
|
||||
static const uint * QT_FASTCALL fetchLinearGradient(uint *buffer, const Operator *op, const QSpanData *data,
|
||||
int y, int x, int length)
|
||||
static const uint * QT_FASTCALL qt_fetch_linear_gradient(uint *buffer, const Operator *op, const QSpanData *data,
|
||||
int y, int x, int length)
|
||||
{
|
||||
const uint *b = buffer;
|
||||
qreal t, inc;
|
||||
@ -1487,110 +1402,65 @@ static const uint * QT_FASTCALL fetchLinearGradient(uint *buffer, const Operator
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline qreal determinant(qreal a, qreal b, qreal c)
|
||||
{
|
||||
return (b * b) - (4 * a * c);
|
||||
}
|
||||
|
||||
// function to evaluate real roots
|
||||
static inline qreal realRoots(qreal a, qreal b, qreal detSqrt)
|
||||
{
|
||||
return (-b + detSqrt)/(2 * a);
|
||||
}
|
||||
|
||||
static inline qreal qSafeSqrt(qreal x)
|
||||
{
|
||||
return x > 0 ? qSqrt(x) : 0;
|
||||
}
|
||||
|
||||
static void QT_FASTCALL getRadialGradientValues(RadialGradientValues *v, const QSpanData *data)
|
||||
{
|
||||
v->dx = data->gradient.radial.center.x - data->gradient.radial.focal.x;
|
||||
v->dy = data->gradient.radial.center.y - data->gradient.radial.focal.y;
|
||||
v->a = data->gradient.radial.radius*data->gradient.radial.radius - v->dx*v->dx - v->dy*v->dy;
|
||||
|
||||
v->dr = data->gradient.radial.center.radius - data->gradient.radial.focal.radius;
|
||||
v->sqrfr = data->gradient.radial.focal.radius * data->gradient.radial.focal.radius;
|
||||
|
||||
v->a = v->dr * v->dr - v->dx*v->dx - v->dy*v->dy;
|
||||
v->inv2a = 1 / (2 * v->a);
|
||||
|
||||
v->extended = !qFuzzyIsNull(data->gradient.radial.focal.radius) || v->a <= 0;
|
||||
}
|
||||
|
||||
static const uint * QT_FASTCALL fetchRadialGradient(uint *buffer, const Operator *op, const QSpanData *data,
|
||||
int y, int x, int length)
|
||||
class RadialFetchPlain
|
||||
{
|
||||
const uint *b = buffer;
|
||||
qreal rx = data->m21 * (y + qreal(0.5))
|
||||
+ data->dx + data->m11 * (x + qreal(0.5));
|
||||
qreal ry = data->m22 * (y + qreal(0.5))
|
||||
+ data->dy + data->m12 * (x + qreal(0.5));
|
||||
bool affine = !data->m13 && !data->m23;
|
||||
//qreal r = data->gradient.radial.radius;
|
||||
public:
|
||||
static inline void fetch(uint *buffer, uint *end, const Operator *op, const QSpanData *data, qreal det,
|
||||
qreal delta_det, qreal delta_delta_det, qreal b, qreal delta_b)
|
||||
{
|
||||
if (op->radial.extended) {
|
||||
while (buffer < end) {
|
||||
quint32 result = 0;
|
||||
if (det >= 0) {
|
||||
qreal w = qSqrt(det) - b;
|
||||
if (data->gradient.radial.focal.radius + op->radial.dr * w >= 0)
|
||||
result = qt_gradient_pixel(&data->gradient, w);
|
||||
}
|
||||
|
||||
const uint *end = buffer + length;
|
||||
if (affine) {
|
||||
rx -= data->gradient.radial.focal.x;
|
||||
ry -= data->gradient.radial.focal.y;
|
||||
*buffer = result;
|
||||
|
||||
qreal inv_a = 1 / qreal(2 * op->radial.a);
|
||||
det += delta_det;
|
||||
delta_det += delta_delta_det;
|
||||
b += delta_b;
|
||||
|
||||
const qreal delta_rx = data->m11;
|
||||
const qreal delta_ry = data->m12;
|
||||
|
||||
qreal b = 2*(rx * op->radial.dx + ry * op->radial.dy);
|
||||
qreal delta_b = 2*(delta_rx * op->radial.dx + delta_ry * op->radial.dy);
|
||||
const qreal b_delta_b = 2 * b * delta_b;
|
||||
const qreal delta_b_delta_b = 2 * delta_b * delta_b;
|
||||
|
||||
const qreal bb = b * b;
|
||||
const qreal delta_bb = delta_b * delta_b;
|
||||
|
||||
b *= inv_a;
|
||||
delta_b *= inv_a;
|
||||
|
||||
const qreal rxrxryry = rx * rx + ry * ry;
|
||||
const qreal delta_rxrxryry = delta_rx * delta_rx + delta_ry * delta_ry;
|
||||
const qreal rx_plus_ry = 2*(rx * delta_rx + ry * delta_ry);
|
||||
const qreal delta_rx_plus_ry = 2 * delta_rxrxryry;
|
||||
|
||||
inv_a *= inv_a;
|
||||
|
||||
qreal det = (bb + 4 * op->radial.a * rxrxryry) * inv_a;
|
||||
qreal delta_det = (b_delta_b + delta_bb + 4 * op->radial.a * (rx_plus_ry + delta_rxrxryry)) * inv_a;
|
||||
const qreal delta_delta_det = (delta_b_delta_b + 4 * op->radial.a * delta_rx_plus_ry) * inv_a;
|
||||
|
||||
while (buffer < end) {
|
||||
*buffer = qt_gradient_pixel(&data->gradient, qSafeSqrt(det) - b);
|
||||
|
||||
det += delta_det;
|
||||
delta_det += delta_delta_det;
|
||||
b += delta_b;
|
||||
|
||||
++buffer;
|
||||
}
|
||||
} else {
|
||||
qreal rw = data->m23 * (y + qreal(0.5))
|
||||
+ data->m33 + data->m13 * (x + qreal(0.5));
|
||||
if (!rw)
|
||||
rw = 1;
|
||||
while (buffer < end) {
|
||||
qreal gx = rx/rw - data->gradient.radial.focal.x;
|
||||
qreal gy = ry/rw - data->gradient.radial.focal.y;
|
||||
qreal b = 2*(gx*op->radial.dx + gy*op->radial.dy);
|
||||
qreal det = determinant(op->radial.a, b , -(gx*gx + gy*gy));
|
||||
qreal s = realRoots(op->radial.a, b, qSafeSqrt(det));
|
||||
|
||||
*buffer = qt_gradient_pixel(&data->gradient, s);
|
||||
|
||||
rx += data->m11;
|
||||
ry += data->m12;
|
||||
rw += data->m13;
|
||||
if (!rw) {
|
||||
rw += data->m13;
|
||||
++buffer;
|
||||
}
|
||||
} else {
|
||||
while (buffer < end) {
|
||||
*buffer++ = qt_gradient_pixel(&data->gradient, qSqrt(det) - b);
|
||||
|
||||
det += delta_det;
|
||||
delta_det += delta_delta_det;
|
||||
b += delta_b;
|
||||
}
|
||||
++buffer;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return b;
|
||||
const uint * QT_FASTCALL qt_fetch_radial_gradient_plain(uint *buffer, const Operator *op, const QSpanData *data,
|
||||
int y, int x, int length)
|
||||
{
|
||||
return qt_fetch_radial_gradient_template<RadialFetchPlain>(buffer, op, data, y, x, length);
|
||||
}
|
||||
|
||||
static const uint * QT_FASTCALL fetchConicalGradient(uint *buffer, const Operator *, const QSpanData *data,
|
||||
int y, int x, int length)
|
||||
static SourceFetchProc qt_fetch_radial_gradient = qt_fetch_radial_gradient_plain;
|
||||
|
||||
static const uint * QT_FASTCALL qt_fetch_conical_gradient(uint *buffer, const Operator *, const QSpanData *data,
|
||||
int y, int x, int length)
|
||||
{
|
||||
const uint *b = buffer;
|
||||
qreal rx = data->m21 * (y + qreal(0.5))
|
||||
@ -3347,16 +3217,16 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
|
||||
case QSpanData::LinearGradient:
|
||||
solidSource = !data->gradient.alphaColor;
|
||||
getLinearGradientValues(&op.linear, data);
|
||||
op.src_fetch = fetchLinearGradient;
|
||||
op.src_fetch = qt_fetch_linear_gradient;
|
||||
break;
|
||||
case QSpanData::RadialGradient:
|
||||
solidSource = !data->gradient.alphaColor;
|
||||
getRadialGradientValues(&op.radial, data);
|
||||
op.src_fetch = fetchRadialGradient;
|
||||
op.src_fetch = qt_fetch_radial_gradient;
|
||||
break;
|
||||
case QSpanData::ConicalGradient:
|
||||
solidSource = !data->gradient.alphaColor;
|
||||
op.src_fetch = fetchConicalGradient;
|
||||
op.src_fetch = qt_fetch_conical_gradient;
|
||||
break;
|
||||
case QSpanData::Texture:
|
||||
op.src_fetch = sourceFetch[getBlendType(data)][data->texture.format];
|
||||
@ -7882,6 +7752,11 @@ void qInitDrawhelperAsm()
|
||||
qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2;
|
||||
qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
|
||||
qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
|
||||
|
||||
extern const uint * QT_FASTCALL qt_fetch_radial_gradient_sse2(uint *buffer, const Operator *op, const QSpanData *data,
|
||||
int y, int x, int length);
|
||||
|
||||
qt_fetch_radial_gradient = qt_fetch_radial_gradient_sse2;
|
||||
}
|
||||
|
||||
#ifdef QT_HAVE_SSSE3
|
||||
@ -7977,6 +7852,11 @@ void qInitDrawhelperAsm()
|
||||
qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon;
|
||||
qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon;
|
||||
qt_memfill32 = qt_memfill32_neon;
|
||||
|
||||
extern const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Operator *op, const QSpanData *data,
|
||||
int y, int x, int length);
|
||||
|
||||
qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -955,6 +955,46 @@ void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h,
|
||||
}
|
||||
}
|
||||
|
||||
class QSimdNeon
|
||||
{
|
||||
public:
|
||||
typedef int32x4_t Int32x4;
|
||||
typedef float32x4_t Float32x4;
|
||||
|
||||
union Vect_buffer_i { Int32x4 v; int i[4]; };
|
||||
union Vect_buffer_f { Float32x4 v; float f[4]; };
|
||||
|
||||
static inline Float32x4 v_dup(float x) { return vdupq_n_f32(x); }
|
||||
static inline Int32x4 v_dup(int x) { return vdupq_n_s32(x); }
|
||||
static inline Int32x4 v_dup(uint x) { return vdupq_n_s32(x); }
|
||||
|
||||
static inline Float32x4 v_add(Float32x4 a, Float32x4 b) { return vaddq_f32(a, b); }
|
||||
static inline Int32x4 v_add(Int32x4 a, Int32x4 b) { return vaddq_s32(a, b); }
|
||||
|
||||
static inline Float32x4 v_max(Float32x4 a, Float32x4 b) { return vmaxq_f32(a, b); }
|
||||
static inline Float32x4 v_min(Float32x4 a, Float32x4 b) { return vminq_f32(a, b); }
|
||||
static inline Int32x4 v_min_16(Int32x4 a, Int32x4 b) { return vminq_s32(a, b); }
|
||||
|
||||
static inline Int32x4 v_and(Int32x4 a, Int32x4 b) { return vandq_s32(a, b); }
|
||||
|
||||
static inline Float32x4 v_sub(Float32x4 a, Float32x4 b) { return vsubq_f32(a, b); }
|
||||
static inline Int32x4 v_sub(Int32x4 a, Int32x4 b) { return vsubq_s32(a, b); }
|
||||
|
||||
static inline Float32x4 v_mul(Float32x4 a, Float32x4 b) { return vmulq_f32(a, b); }
|
||||
|
||||
static inline Float32x4 v_sqrt(Float32x4 x) { Float32x4 y = vrsqrteq_f32(x); y = vmulq_f32(y, vrsqrtsq_f32(x, vmulq_f32(y, y))); return vmulq_f32(x, y); }
|
||||
|
||||
static inline Int32x4 v_toInt(Float32x4 x) { return vcvtq_s32_f32(x); }
|
||||
|
||||
static inline Int32x4 v_greaterOrEqual(Float32x4 a, Float32x4 b) { return vcge_f32(a, b); }
|
||||
};
|
||||
|
||||
const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Operator *op, const QSpanData *data,
|
||||
int y, int x, int length)
|
||||
{
|
||||
return qt_fetch_radial_gradient_template<QRadialFetchSimd<QSimdNeon> >(buffer, op, data, y, x, length);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_HAVE_NEON
|
||||
|
@ -63,6 +63,7 @@
|
||||
#endif
|
||||
#include "private/qrasterdefs_p.h"
|
||||
#include <private/qsimd_p.h>
|
||||
#include <private/qmath_p.h>
|
||||
|
||||
#ifdef Q_WS_QWS
|
||||
#include "QtGui/qscreen_qws.h"
|
||||
@ -178,6 +179,44 @@ void qBlendTextureCallback(int count, const QSpan *spans, void *userData);
|
||||
typedef void (QT_FASTCALL *CompositionFunction)(uint *dest, const uint *src, int length, uint const_alpha);
|
||||
typedef void (QT_FASTCALL *CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha);
|
||||
|
||||
struct LinearGradientValues
|
||||
{
|
||||
qreal dx;
|
||||
qreal dy;
|
||||
qreal l;
|
||||
qreal off;
|
||||
};
|
||||
|
||||
struct RadialGradientValues
|
||||
{
|
||||
qreal dx;
|
||||
qreal dy;
|
||||
qreal dr;
|
||||
qreal sqrfr;
|
||||
qreal a;
|
||||
qreal inv2a;
|
||||
bool extended;
|
||||
};
|
||||
|
||||
struct Operator;
|
||||
typedef uint* (QT_FASTCALL *DestFetchProc)(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length);
|
||||
typedef void (QT_FASTCALL *DestStoreProc)(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length);
|
||||
typedef const uint* (QT_FASTCALL *SourceFetchProc)(uint *buffer, const Operator *o, const QSpanData *data, int y, int x, int length);
|
||||
|
||||
struct Operator
|
||||
{
|
||||
QPainter::CompositionMode mode;
|
||||
DestFetchProc dest_fetch;
|
||||
DestStoreProc dest_store;
|
||||
SourceFetchProc src_fetch;
|
||||
CompositionFunctionSolid funcSolid;
|
||||
CompositionFunction func;
|
||||
union {
|
||||
LinearGradientValues linear;
|
||||
RadialGradientValues radial;
|
||||
};
|
||||
};
|
||||
|
||||
void qInitDrawhelperAsm();
|
||||
|
||||
class QRasterPaintEngine;
|
||||
@ -204,12 +243,13 @@ struct QRadialGradientData
|
||||
struct {
|
||||
qreal x;
|
||||
qreal y;
|
||||
qreal radius;
|
||||
} center;
|
||||
struct {
|
||||
qreal x;
|
||||
qreal y;
|
||||
qreal radius;
|
||||
} focal;
|
||||
qreal radius;
|
||||
};
|
||||
|
||||
struct QConicalGradientData
|
||||
@ -233,8 +273,10 @@ struct QGradientData
|
||||
|
||||
#ifdef Q_WS_QWS
|
||||
#define GRADIENT_STOPTABLE_SIZE 256
|
||||
#define GRADIENT_STOPTABLE_SIZE_SHIFT 8
|
||||
#else
|
||||
#define GRADIENT_STOPTABLE_SIZE 1024
|
||||
#define GRADIENT_STOPTABLE_SIZE_SHIFT 10
|
||||
#endif
|
||||
|
||||
uint* colorTable; //[GRADIENT_STOPTABLE_SIZE];
|
||||
@ -308,6 +350,218 @@ struct QSpanData
|
||||
void adjustSpanMethods();
|
||||
};
|
||||
|
||||
static inline uint qt_gradient_clamp(const QGradientData *data, int ipos)
|
||||
{
|
||||
if (ipos < 0 || ipos >= GRADIENT_STOPTABLE_SIZE) {
|
||||
if (data->spread == QGradient::RepeatSpread) {
|
||||
ipos = ipos % GRADIENT_STOPTABLE_SIZE;
|
||||
ipos = ipos < 0 ? GRADIENT_STOPTABLE_SIZE + ipos : ipos;
|
||||
} else if (data->spread == QGradient::ReflectSpread) {
|
||||
const int limit = GRADIENT_STOPTABLE_SIZE * 2;
|
||||
ipos = ipos % limit;
|
||||
ipos = ipos < 0 ? limit + ipos : ipos;
|
||||
ipos = ipos >= GRADIENT_STOPTABLE_SIZE ? limit - 1 - ipos : ipos;
|
||||
} else {
|
||||
if (ipos < 0)
|
||||
ipos = 0;
|
||||
else if (ipos >= GRADIENT_STOPTABLE_SIZE)
|
||||
ipos = GRADIENT_STOPTABLE_SIZE-1;
|
||||
}
|
||||
}
|
||||
|
||||
Q_ASSERT(ipos >= 0);
|
||||
Q_ASSERT(ipos < GRADIENT_STOPTABLE_SIZE);
|
||||
|
||||
return ipos;
|
||||
}
|
||||
|
||||
static inline uint qt_gradient_pixel(const QGradientData *data, qreal pos)
|
||||
{
|
||||
int ipos = int(pos * (GRADIENT_STOPTABLE_SIZE - 1) + qreal(0.5));
|
||||
return data->colorTable[qt_gradient_clamp(data, ipos)];
|
||||
}
|
||||
|
||||
static inline qreal qRadialDeterminant(qreal a, qreal b, qreal c)
|
||||
{
|
||||
return (b * b) - (4 * a * c);
|
||||
}
|
||||
|
||||
template <class RadialFetchFunc>
|
||||
const uint * QT_FASTCALL qt_fetch_radial_gradient_template(uint *buffer, const Operator *op, const QSpanData *data,
|
||||
int y, int x, int length)
|
||||
{
|
||||
// avoid division by zero
|
||||
if (qFuzzyIsNull(op->radial.a)) {
|
||||
extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count);
|
||||
qt_memfill32(buffer, 0, length);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const uint *b = buffer;
|
||||
qreal rx = data->m21 * (y + qreal(0.5))
|
||||
+ data->dx + data->m11 * (x + qreal(0.5));
|
||||
qreal ry = data->m22 * (y + qreal(0.5))
|
||||
+ data->dy + data->m12 * (x + qreal(0.5));
|
||||
bool affine = !data->m13 && !data->m23;
|
||||
|
||||
uint *end = buffer + length;
|
||||
if (affine) {
|
||||
rx -= data->gradient.radial.focal.x;
|
||||
ry -= data->gradient.radial.focal.y;
|
||||
|
||||
qreal inv_a = 1 / qreal(2 * op->radial.a);
|
||||
|
||||
const qreal delta_rx = data->m11;
|
||||
const qreal delta_ry = data->m12;
|
||||
|
||||
qreal b = 2*(op->radial.dr*data->gradient.radial.focal.radius + rx * op->radial.dx + ry * op->radial.dy);
|
||||
qreal delta_b = 2*(delta_rx * op->radial.dx + delta_ry * op->radial.dy);
|
||||
const qreal b_delta_b = 2 * b * delta_b;
|
||||
const qreal delta_b_delta_b = 2 * delta_b * delta_b;
|
||||
|
||||
const qreal bb = b * b;
|
||||
const qreal delta_bb = delta_b * delta_b;
|
||||
|
||||
b *= inv_a;
|
||||
delta_b *= inv_a;
|
||||
|
||||
const qreal rxrxryry = rx * rx + ry * ry;
|
||||
const qreal delta_rxrxryry = delta_rx * delta_rx + delta_ry * delta_ry;
|
||||
const qreal rx_plus_ry = 2*(rx * delta_rx + ry * delta_ry);
|
||||
const qreal delta_rx_plus_ry = 2 * delta_rxrxryry;
|
||||
|
||||
inv_a *= inv_a;
|
||||
|
||||
qreal det = (bb - 4 * op->radial.a * (op->radial.sqrfr - rxrxryry)) * inv_a;
|
||||
qreal delta_det = (b_delta_b + delta_bb + 4 * op->radial.a * (rx_plus_ry + delta_rxrxryry)) * inv_a;
|
||||
const qreal delta_delta_det = (delta_b_delta_b + 4 * op->radial.a * delta_rx_plus_ry) * inv_a;
|
||||
|
||||
RadialFetchFunc::fetch(buffer, end, op, data, det, delta_det, delta_delta_det, b, delta_b);
|
||||
} else {
|
||||
qreal rw = data->m23 * (y + qreal(0.5))
|
||||
+ data->m33 + data->m13 * (x + qreal(0.5));
|
||||
|
||||
while (buffer < end) {
|
||||
if (rw == 0) {
|
||||
*buffer = 0;
|
||||
} else {
|
||||
qreal invRw = 1 / rw;
|
||||
qreal gx = rx * invRw - data->gradient.radial.focal.x;
|
||||
qreal gy = ry * invRw - data->gradient.radial.focal.y;
|
||||
qreal b = 2*(op->radial.dr*data->gradient.radial.focal.radius + gx*op->radial.dx + gy*op->radial.dy);
|
||||
qreal det = qRadialDeterminant(op->radial.a, b, op->radial.sqrfr - (gx*gx + gy*gy));
|
||||
|
||||
quint32 result = 0;
|
||||
if (det >= 0) {
|
||||
qreal detSqrt = qSqrt(det);
|
||||
|
||||
qreal s0 = (-b - detSqrt) * op->radial.inv2a;
|
||||
qreal s1 = (-b + detSqrt) * op->radial.inv2a;
|
||||
|
||||
qreal s = qMax(s0, s1);
|
||||
|
||||
if (data->gradient.radial.focal.radius + op->radial.dr * s >= 0)
|
||||
result = qt_gradient_pixel(&data->gradient, s);
|
||||
}
|
||||
|
||||
*buffer = result;
|
||||
}
|
||||
|
||||
rx += data->m11;
|
||||
ry += data->m12;
|
||||
rw += data->m13;
|
||||
|
||||
++buffer;
|
||||
}
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
template <class Simd>
|
||||
class QRadialFetchSimd
|
||||
{
|
||||
public:
|
||||
static void fetch(uint *buffer, uint *end, const Operator *op, const QSpanData *data, qreal det,
|
||||
qreal delta_det, qreal delta_delta_det, qreal b, qreal delta_b)
|
||||
{
|
||||
typename Simd::Vect_buffer_f det_vec;
|
||||
typename Simd::Vect_buffer_f delta_det4_vec;
|
||||
typename Simd::Vect_buffer_f b_vec;
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
det_vec.f[i] = det;
|
||||
delta_det4_vec.f[i] = 4 * delta_det;
|
||||
b_vec.f[i] = b;
|
||||
|
||||
det += delta_det;
|
||||
delta_det += delta_delta_det;
|
||||
b += delta_b;
|
||||
}
|
||||
|
||||
const typename Simd::Float32x4 v_delta_delta_det16 = Simd::v_dup(16 * delta_delta_det);
|
||||
const typename Simd::Float32x4 v_delta_delta_det6 = Simd::v_dup(6 * delta_delta_det);
|
||||
const typename Simd::Float32x4 v_delta_b4 = Simd::v_dup(4 * delta_b);
|
||||
|
||||
const typename Simd::Float32x4 v_r0 = Simd::v_dup(data->gradient.radial.focal.radius);
|
||||
const typename Simd::Float32x4 v_dr = Simd::v_dup(op->radial.dr);
|
||||
|
||||
const typename Simd::Float32x4 v_min = Simd::v_dup(0.0f);
|
||||
const typename Simd::Float32x4 v_max = Simd::v_dup(float(GRADIENT_STOPTABLE_SIZE-1));
|
||||
const typename Simd::Float32x4 v_half = Simd::v_dup(0.5f);
|
||||
|
||||
const typename Simd::Int32x4 v_repeat_mask = Simd::v_dup(~(uint(0xffffff) << GRADIENT_STOPTABLE_SIZE_SHIFT));
|
||||
const typename Simd::Int32x4 v_reflect_mask = Simd::v_dup(~(uint(0xffffff) << (GRADIENT_STOPTABLE_SIZE_SHIFT+1)));
|
||||
|
||||
const typename Simd::Int32x4 v_reflect_limit = Simd::v_dup(2 * GRADIENT_STOPTABLE_SIZE - 1);
|
||||
|
||||
const int extended_mask = op->radial.extended ? 0x0 : ~0x0;
|
||||
|
||||
#define FETCH_RADIAL_LOOP_PROLOGUE \
|
||||
while (buffer < end) { \
|
||||
typename Simd::Vect_buffer_i v_buffer_mask; \
|
||||
v_buffer_mask.v = Simd::v_greaterOrEqual(det_vec.v, v_min); \
|
||||
const typename Simd::Float32x4 v_index_local = Simd::v_sub(Simd::v_sqrt(Simd::v_max(v_min, det_vec.v)), b_vec.v); \
|
||||
const typename Simd::Float32x4 v_index = Simd::v_add(Simd::v_mul(v_index_local, v_max), v_half); \
|
||||
v_buffer_mask.v = Simd::v_and(v_buffer_mask.v, Simd::v_greaterOrEqual(Simd::v_add(v_r0, Simd::v_mul(v_dr, v_index_local)), v_min)); \
|
||||
typename Simd::Vect_buffer_i index_vec;
|
||||
#define FETCH_RADIAL_LOOP_CLAMP_REPEAT \
|
||||
index_vec.v = Simd::v_and(v_repeat_mask, Simd::v_toInt(v_index));
|
||||
#define FETCH_RADIAL_LOOP_CLAMP_REFLECT \
|
||||
const typename Simd::Int32x4 v_index_i = Simd::v_and(v_reflect_mask, Simd::v_toInt(v_index)); \
|
||||
const typename Simd::Int32x4 v_index_i_inv = Simd::v_sub(v_reflect_limit, v_index_i); \
|
||||
index_vec.v = Simd::v_min_16(v_index_i, v_index_i_inv);
|
||||
#define FETCH_RADIAL_LOOP_CLAMP_PAD \
|
||||
index_vec.v = Simd::v_toInt(Simd::v_min(v_max, Simd::v_max(v_min, v_index)));
|
||||
#define FETCH_RADIAL_LOOP_EPILOGUE \
|
||||
det_vec.v = Simd::v_add(Simd::v_add(det_vec.v, delta_det4_vec.v), v_delta_delta_det6); \
|
||||
delta_det4_vec.v = Simd::v_add(delta_det4_vec.v, v_delta_delta_det16); \
|
||||
b_vec.v = Simd::v_add(b_vec.v, v_delta_b4); \
|
||||
for (int i = 0; i < 4; ++i) \
|
||||
*buffer++ = (extended_mask | v_buffer_mask.i[i]) & data->gradient.colorTable[index_vec.i[i]]; \
|
||||
}
|
||||
|
||||
#define FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP) \
|
||||
FETCH_RADIAL_LOOP_PROLOGUE \
|
||||
FETCH_RADIAL_LOOP_CLAMP \
|
||||
FETCH_RADIAL_LOOP_EPILOGUE
|
||||
|
||||
switch (data->gradient.spread) {
|
||||
case QGradient::RepeatSpread:
|
||||
FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP_REPEAT)
|
||||
break;
|
||||
case QGradient::ReflectSpread:
|
||||
FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP_REFLECT)
|
||||
break;
|
||||
case QGradient::PadSpread:
|
||||
FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP_PAD)
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(Q_CC_RVCT)
|
||||
# pragma push
|
||||
# pragma arm
|
||||
|
@ -112,8 +112,6 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
|
||||
|
||||
// First, align dest to 16 bytes:
|
||||
ALIGNMENT_PROLOGUE_16BYTES(dst, x, w) {
|
||||
quint32 s = src[x];
|
||||
s = BYTE_MUL(s, const_alpha);
|
||||
dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
|
||||
}
|
||||
|
||||
@ -127,8 +125,6 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
|
||||
}
|
||||
}
|
||||
for (; x<w; ++x) {
|
||||
quint32 s = src[x];
|
||||
s = BYTE_MUL(s, const_alpha);
|
||||
dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
|
||||
}
|
||||
dst = (quint32 *)(((uchar *) dst) + dbpl);
|
||||
@ -491,6 +487,58 @@ void qt_bitmapblit16_sse2(QRasterBuffer *rasterBuffer, int x, int y,
|
||||
}
|
||||
}
|
||||
|
||||
class QSimdSse2
|
||||
{
|
||||
public:
|
||||
typedef __m128i Int32x4;
|
||||
typedef __m128 Float32x4;
|
||||
|
||||
union Vect_buffer_i { Int32x4 v; int i[4]; };
|
||||
union Vect_buffer_f { Float32x4 v; float f[4]; };
|
||||
|
||||
static inline Float32x4 v_dup(float x) { return _mm_set1_ps(x); }
|
||||
static inline Float32x4 v_dup(double x) { return _mm_set1_ps(x); }
|
||||
static inline Int32x4 v_dup(int x) { return _mm_set1_epi32(x); }
|
||||
static inline Int32x4 v_dup(uint x) { return _mm_set1_epi32(x); }
|
||||
|
||||
static inline Float32x4 v_add(Float32x4 a, Float32x4 b) { return _mm_add_ps(a, b); }
|
||||
static inline Int32x4 v_add(Int32x4 a, Int32x4 b) { return _mm_add_epi32(a, b); }
|
||||
|
||||
static inline Float32x4 v_max(Float32x4 a, Float32x4 b) { return _mm_max_ps(a, b); }
|
||||
static inline Float32x4 v_min(Float32x4 a, Float32x4 b) { return _mm_min_ps(a, b); }
|
||||
static inline Int32x4 v_min_16(Int32x4 a, Int32x4 b) { return _mm_min_epi16(a, b); }
|
||||
|
||||
static inline Int32x4 v_and(Int32x4 a, Int32x4 b) { return _mm_and_si128(a, b); }
|
||||
|
||||
static inline Float32x4 v_sub(Float32x4 a, Float32x4 b) { return _mm_sub_ps(a, b); }
|
||||
static inline Int32x4 v_sub(Int32x4 a, Int32x4 b) { return _mm_sub_epi32(a, b); }
|
||||
|
||||
static inline Float32x4 v_mul(Float32x4 a, Float32x4 b) { return _mm_mul_ps(a, b); }
|
||||
|
||||
static inline Float32x4 v_sqrt(Float32x4 x) { return _mm_sqrt_ps(x); }
|
||||
|
||||
static inline Int32x4 v_toInt(Float32x4 x) { return _mm_cvttps_epi32(x); }
|
||||
|
||||
// pre-VS 2008 doesn't have cast intrinsics, whereas 2008 and later requires it
|
||||
#if defined(Q_CC_MSVC) && _MSC_VER < 1500
|
||||
static inline Int32x4 v_greaterOrEqual(Float32x4 a, Float32x4 b)
|
||||
{
|
||||
union Convert { Int32x4 vi; Float32x4 vf; } convert;
|
||||
convert.vf = _mm_cmpgt_ps(a, b);
|
||||
return convert.vi;
|
||||
}
|
||||
#else
|
||||
static inline Int32x4 v_greaterOrEqual(Float32x4 a, Float32x4 b) { return _mm_castps_si128(_mm_cmpgt_ps(a, b)); }
|
||||
#endif
|
||||
};
|
||||
|
||||
const uint * QT_FASTCALL qt_fetch_radial_gradient_sse2(uint *buffer, const Operator *op, const QSpanData *data,
|
||||
int y, int x, int length)
|
||||
{
|
||||
return qt_fetch_radial_gradient_template<QRadialFetchSimd<QSimdSse2> >(buffer, op, data, y, x, length);
|
||||
}
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_HAVE_SSE2
|
||||
|
@ -535,16 +535,6 @@ QString QPaintBuffer::commandDescription(int command) const
|
||||
QTextItemInt &ti = (*tiCopy)();
|
||||
QString text(ti.text());
|
||||
|
||||
QFont font(ti.font());
|
||||
font.setUnderline(false);
|
||||
font.setStrikeOut(false);
|
||||
font.setOverline(false);
|
||||
|
||||
const QTextItemInt &si = static_cast<const QTextItemInt &>(ti);
|
||||
qreal justificationWidth = 0;
|
||||
if (si.justified)
|
||||
justificationWidth = si.width.toReal();
|
||||
|
||||
debug << "Cmd_DrawTextItem:" << pos << " " << text;
|
||||
break; }
|
||||
case QPaintBufferPrivate::Cmd_SystemStateChanged: {
|
||||
|
@ -1546,8 +1546,9 @@ void QCoreGraphicsPaintEnginePrivate::setFillBrush(const QPointF &offset)
|
||||
QPointF center(radialGrad->center());
|
||||
QPointF focal(radialGrad->focalPoint());
|
||||
qreal radius = radialGrad->radius();
|
||||
qreal focalRadius = radialGrad->focalRadius();
|
||||
shading = CGShadingCreateRadial(colorspace, CGPointMake(focal.x(), focal.y()),
|
||||
0.0, CGPointMake(center.x(), center.y()), radius, fill_func, false, true);
|
||||
focalRadius, CGPointMake(center.x(), center.y()), radius, fill_func, false, true);
|
||||
}
|
||||
|
||||
CGFunctionRelease(fill_func);
|
||||
|
@ -5033,6 +5033,84 @@ void QGradientCache::generateGradientColorTable(const QGradient& gradient, uint
|
||||
|
||||
bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation);
|
||||
|
||||
if (stopCount == 2) {
|
||||
uint first_color = ARGB_COMBINE_ALPHA(stops[0].second.rgba(), opacity);
|
||||
uint second_color = ARGB_COMBINE_ALPHA(stops[1].second.rgba(), opacity);
|
||||
|
||||
qreal first_stop = stops[0].first;
|
||||
qreal second_stop = stops[1].first;
|
||||
|
||||
if (second_stop < first_stop) {
|
||||
qSwap(first_color, second_color);
|
||||
qSwap(first_stop, second_stop);
|
||||
}
|
||||
|
||||
if (colorInterpolation) {
|
||||
first_color = PREMUL(first_color);
|
||||
second_color = PREMUL(second_color);
|
||||
}
|
||||
|
||||
int first_index = qRound(first_stop * (GRADIENT_STOPTABLE_SIZE-1));
|
||||
int second_index = qRound(second_stop * (GRADIENT_STOPTABLE_SIZE-1));
|
||||
|
||||
uint red_first = qRed(first_color) << 16;
|
||||
uint green_first = qGreen(first_color) << 16;
|
||||
uint blue_first = qBlue(first_color) << 16;
|
||||
uint alpha_first = qAlpha(first_color) << 16;
|
||||
|
||||
uint red_second = qRed(second_color) << 16;
|
||||
uint green_second = qGreen(second_color) << 16;
|
||||
uint blue_second = qBlue(second_color) << 16;
|
||||
uint alpha_second = qAlpha(second_color) << 16;
|
||||
|
||||
int i = 0;
|
||||
for (; i <= qMin(GRADIENT_STOPTABLE_SIZE, first_index); ++i) {
|
||||
if (colorInterpolation)
|
||||
colorTable[i] = first_color;
|
||||
else
|
||||
colorTable[i] = PREMUL(first_color);
|
||||
}
|
||||
|
||||
if (i < second_index) {
|
||||
qreal reciprocal = qreal(1) / (second_index - first_index);
|
||||
|
||||
int red_delta = qRound(int(red_second - red_first) * reciprocal);
|
||||
int green_delta = qRound(int(green_second - green_first) * reciprocal);
|
||||
int blue_delta = qRound(int(blue_second - blue_first) * reciprocal);
|
||||
int alpha_delta = qRound(int(alpha_second - alpha_first) * reciprocal);
|
||||
|
||||
// rounding
|
||||
red_first += 1 << 15;
|
||||
green_first += 1 << 15;
|
||||
blue_first += 1 << 15;
|
||||
alpha_first += 1 << 15;
|
||||
|
||||
for (; i < qMin(GRADIENT_STOPTABLE_SIZE, second_index); ++i) {
|
||||
red_first += red_delta;
|
||||
green_first += green_delta;
|
||||
blue_first += blue_delta;
|
||||
alpha_first += alpha_delta;
|
||||
|
||||
const uint color = ((alpha_first << 8) & 0xff000000) | (red_first & 0xff0000)
|
||||
| ((green_first >> 8) & 0xff00) | (blue_first >> 16);
|
||||
|
||||
if (colorInterpolation)
|
||||
colorTable[i] = color;
|
||||
else
|
||||
colorTable[i] = PREMUL(color);
|
||||
}
|
||||
}
|
||||
|
||||
for (; i < GRADIENT_STOPTABLE_SIZE; ++i) {
|
||||
if (colorInterpolation)
|
||||
colorTable[i] = second_color;
|
||||
else
|
||||
colorTable[i] = PREMUL(second_color);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
uint current_color = ARGB_COMBINE_ALPHA(stops[0].second.rgba(), opacity);
|
||||
if (stopCount == 1) {
|
||||
current_color = PREMUL(current_color);
|
||||
@ -5204,10 +5282,11 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
|
||||
QPointF center = g->center();
|
||||
radialData.center.x = center.x();
|
||||
radialData.center.y = center.y();
|
||||
radialData.center.radius = g->centerRadius();
|
||||
QPointF focal = g->focalPoint();
|
||||
radialData.focal.x = focal.x();
|
||||
radialData.focal.y = focal.y();
|
||||
radialData.radius = g->radius();
|
||||
radialData.focal.radius = g->focalRadius();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1611,8 +1611,6 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p
|
||||
&& (fill.style() != Qt::NoBrush)
|
||||
&& ((has_fill_texture && fill.texture().hasAlpha()) || antialias || !solid_fill || has_alpha_pen != has_alpha_brush))
|
||||
{
|
||||
QRect br = tessellator->tessellate((QPointF *)clippedPoints, clippedCount,
|
||||
mode == QPaintEngine::WindingMode);
|
||||
if (tessellator->size > 0) {
|
||||
XRenderPictureAttributes attrs;
|
||||
attrs.poly_edge = antialias ? PolyEdgeSmooth : PolyEdgeSharp;
|
||||
@ -1771,7 +1769,6 @@ void QX11PaintEngine::drawPath(const QPainterPath &path)
|
||||
Q_D(QX11PaintEngine);
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
QTransform old_matrix = d->matrix;
|
||||
|
||||
if (d->has_brush)
|
||||
d->fillPath(path, QX11PaintEnginePrivate::BrushGC, true);
|
||||
|
@ -1012,4 +1012,50 @@ void QPaintEngineEx::updateState(const QPaintEngineState &)
|
||||
// do nothing...
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path)
|
||||
{
|
||||
const qreal *points = path.points();
|
||||
const QPainterPath::ElementType *types = path.elements();
|
||||
|
||||
QPainterPath p;
|
||||
if (types) {
|
||||
int id = 0;
|
||||
for (int i=0; i<path.elementCount(); ++i) {
|
||||
switch(types[i]) {
|
||||
case QPainterPath::MoveToElement:
|
||||
p.moveTo(QPointF(points[id], points[id+1]));
|
||||
id+=2;
|
||||
break;
|
||||
case QPainterPath::LineToElement:
|
||||
p.lineTo(QPointF(points[id], points[id+1]));
|
||||
id+=2;
|
||||
break;
|
||||
case QPainterPath::CurveToElement: {
|
||||
QPointF p1(points[id], points[id+1]);
|
||||
QPointF p2(points[id+2], points[id+3]);
|
||||
QPointF p3(points[id+4], points[id+5]);
|
||||
p.cubicTo(p1, p2, p3);
|
||||
id+=6;
|
||||
break;
|
||||
}
|
||||
case QPainterPath::CurveToDataElement:
|
||||
;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
p.moveTo(QPointF(points[0], points[1]));
|
||||
int id = 2;
|
||||
for (int i=1; i<path.elementCount(); ++i) {
|
||||
p.lineTo(QPointF(points[id], points[id+1]));
|
||||
id+=2;
|
||||
}
|
||||
}
|
||||
if (path.hints() & QVectorPath::WindingFill)
|
||||
p.setFillRule(Qt::WindingFill);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -504,8 +504,12 @@ void QPainterPrivate::draw_helper(const QPainterPath &originalPath, DrawOperatio
|
||||
|
||||
q->save();
|
||||
state->matrix = QTransform();
|
||||
state->dirtyFlags |= QPaintEngine::DirtyTransform;
|
||||
updateState(state);
|
||||
if (extended) {
|
||||
extended->transformChanged();
|
||||
} else {
|
||||
state->dirtyFlags |= QPaintEngine::DirtyTransform;
|
||||
updateState(state);
|
||||
}
|
||||
engine->drawImage(absPathRect,
|
||||
image,
|
||||
QRectF(0, 0, absPathRect.width(), absPathRect.height()),
|
||||
@ -688,11 +692,14 @@ void QPainterPrivate::updateInvMatrix()
|
||||
invMatrix = state->matrix.inverted();
|
||||
}
|
||||
|
||||
extern bool qt_isExtendedRadialGradient(const QBrush &brush);
|
||||
|
||||
void QPainterPrivate::updateEmulationSpecifier(QPainterState *s)
|
||||
{
|
||||
bool alpha = false;
|
||||
bool linearGradient = false;
|
||||
bool radialGradient = false;
|
||||
bool extendedRadialGradient = false;
|
||||
bool conicalGradient = false;
|
||||
bool patternBrush = false;
|
||||
bool xform = false;
|
||||
@ -724,6 +731,7 @@ void QPainterPrivate::updateEmulationSpecifier(QPainterState *s)
|
||||
(brushStyle == Qt::LinearGradientPattern));
|
||||
radialGradient = ((penBrushStyle == Qt::RadialGradientPattern) ||
|
||||
(brushStyle == Qt::RadialGradientPattern));
|
||||
extendedRadialGradient = radialGradient && (qt_isExtendedRadialGradient(penBrush) || qt_isExtendedRadialGradient(s->brush));
|
||||
conicalGradient = ((penBrushStyle == Qt::ConicalGradientPattern) ||
|
||||
(brushStyle == Qt::ConicalGradientPattern));
|
||||
patternBrush = (((penBrushStyle > Qt::SolidPattern
|
||||
@ -807,7 +815,7 @@ void QPainterPrivate::updateEmulationSpecifier(QPainterState *s)
|
||||
s->emulationSpecifier &= ~QPaintEngine::LinearGradientFill;
|
||||
|
||||
// Radial gradient emulation
|
||||
if (radialGradient && !engine->hasFeature(QPaintEngine::RadialGradientFill))
|
||||
if (extendedRadialGradient || (radialGradient && !engine->hasFeature(QPaintEngine::RadialGradientFill)))
|
||||
s->emulationSpecifier |= QPaintEngine::RadialGradientFill;
|
||||
else
|
||||
s->emulationSpecifier &= ~QPaintEngine::RadialGradientFill;
|
||||
|
@ -553,6 +553,7 @@ private:
|
||||
friend class QPaintEngine;
|
||||
friend class QPaintEngineExPrivate;
|
||||
friend class QOpenGLPaintEngine;
|
||||
friend class QVGPaintEngine;
|
||||
friend class QX11PaintEngine;
|
||||
friend class QX11PaintEnginePrivate;
|
||||
friend class QWin32PaintEngine;
|
||||
|
@ -1126,6 +1126,7 @@ void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &
|
||||
QTextEngine *eng = layout.engine();
|
||||
layout.beginLayout();
|
||||
QTextLine line = layout.createLine();
|
||||
Q_UNUSED(line);
|
||||
layout.endLayout();
|
||||
const QScriptLine &sl = eng->lines[0];
|
||||
if (!sl.length || !eng->layoutData)
|
||||
|
@ -534,7 +534,10 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
|
||||
|
||||
QImage image = img;
|
||||
QImage::Format format = image.format();
|
||||
if (image.depth() == 1 && *bitmap && img.colorTable().size() == 0) {
|
||||
if (image.depth() == 1 && *bitmap && img.colorTable().size() == 2
|
||||
&& img.colorTable().at(0) == QColor(Qt::black).rgba()
|
||||
&& img.colorTable().at(1) == QColor(Qt::white).rgba())
|
||||
{
|
||||
if (format == QImage::Format_MonoLSB)
|
||||
image = image.convertToFormat(QImage::Format_Mono);
|
||||
format = QImage::Format_Mono;
|
||||
|
@ -552,6 +552,7 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine
|
||||
|
||||
// // line to the beginning of the arc segment, (should not be needed).
|
||||
// emitLineTo(qt_real_to_fixed(curve_start.x()), qt_real_to_fixed(curve_start.y()));
|
||||
Q_UNUSED(curve_start);
|
||||
|
||||
for (int i=0; i<point_count; i+=3) {
|
||||
emitCubicTo(qt_real_to_fixed(curves[i].x()),
|
||||
|
@ -841,7 +841,6 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
|
||||
case PE_PanelButtonTool:
|
||||
painter->save();
|
||||
if ((option->state & State_Enabled || option->state & State_On) || !(option->state & State_AutoRaise)) {
|
||||
QRect rect = option->rect;
|
||||
QPen oldPen = painter->pen();
|
||||
|
||||
if (widget && widget->inherits("QDockWidgetTitleButton")) {
|
||||
@ -1241,7 +1240,6 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
|
||||
if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
|
||||
QColor borderColor = darkOutline.lighter(110);
|
||||
QColor alphaCornerColor = mergedColors(borderColor, option->palette.background().color());
|
||||
QColor innerShadow = mergedColors(borderColor, option->palette.base().color());
|
||||
|
||||
int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, twf, widget);
|
||||
bool reverse = (twf->direction == Qt::RightToLeft);
|
||||
@ -1879,7 +1877,6 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
|
||||
} else {
|
||||
alphaCornerColor = mergedColors(option->palette.background().color(), borderColor);
|
||||
}
|
||||
QColor alphaTextColor = mergedColors(option->palette.background().color(), option->palette.text().color());
|
||||
if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
|
||||
painter->fillRect(menuItem->rect, menuBackground);
|
||||
int w = 0;
|
||||
@ -2220,7 +2217,6 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
|
||||
&& tabBarAlignment == Qt::AlignLeft);
|
||||
|
||||
QColor light = tab->palette.light().color();
|
||||
QColor midlight = tab->palette.midlight().color();
|
||||
|
||||
QColor background = tab->palette.background().color();
|
||||
int borderThinkness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget);
|
||||
@ -2444,14 +2440,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
|
||||
QColor gradientStartColor = option->palette.button().color().lighter(108);
|
||||
QColor gradientStopColor = mergedColors(option->palette.button().color().darker(108), dark.lighter(150), 70);
|
||||
|
||||
QColor highlightedGradientStartColor = option->palette.button().color();
|
||||
QColor highlightedGradientStopColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 85);
|
||||
|
||||
QColor highlightedDarkInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 35);
|
||||
QColor highlightedLightInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 58);
|
||||
|
||||
QColor buttonShadowAlpha = option->palette.background().color().darker(105);
|
||||
|
||||
QPalette palette = option->palette;
|
||||
|
||||
switch (control) {
|
||||
@ -3437,7 +3425,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
|
||||
QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
|
||||
QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
|
||||
QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
|
||||
|
||||
bool horizontal = slider->orientation == Qt::Horizontal;
|
||||
bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
|
||||
@ -3539,8 +3526,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
|
||||
QRect pixmapRect(0, 0, handle.width(), handle.height());
|
||||
QPainter handlePainter(&cache);
|
||||
|
||||
QColor highlightedGradientStartColor = option->palette.button().color();
|
||||
QColor highlightedGradientStopColor = option->palette.light().color();
|
||||
QColor gradientStartColor = mergedColors(option->palette.button().color().lighter(155),
|
||||
dark.lighter(155), 50);
|
||||
QColor gradientStopColor = gradientStartColor.darker(108);
|
||||
@ -3557,7 +3542,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
|
||||
}
|
||||
|
||||
// gradient fill
|
||||
QRect innerBorder = gradRect;
|
||||
QRect r = pixmapRect.adjusted(1, 1, -1, -1);
|
||||
|
||||
qt_cleanlooks_draw_gradient(&handlePainter, gradRect,
|
||||
|
@ -223,16 +223,13 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
|
||||
--yy;
|
||||
}
|
||||
if (!(opt->state & State_Enabled) && !(opt->state & State_On)) {
|
||||
int pnt;
|
||||
p->setPen(opt->palette.highlightedText().color());
|
||||
QPoint offset(1, 1);
|
||||
for (pnt = 0; pnt < a.size(); ++pnt)
|
||||
a[pnt].translate(offset.x(), offset.y());
|
||||
p->save();
|
||||
p->translate(1, 1);
|
||||
p->setPen(opt->palette.light().color());
|
||||
p->drawLines(a);
|
||||
for (pnt = 0; pnt < a.size(); ++pnt)
|
||||
a[pnt].translate(offset.x(), offset.y());
|
||||
p->restore();
|
||||
}
|
||||
p->setPen(opt->palette.text().color());
|
||||
p->setPen((opt->state & State_On) ? opt->palette.highlightedText().color() : opt->palette.text().color());
|
||||
p->drawLines(a);
|
||||
break; }
|
||||
case PE_Frame:
|
||||
@ -919,6 +916,7 @@ static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
|
||||
return QSizeF(widthUsed, height);
|
||||
}
|
||||
|
||||
|
||||
void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItemV4 *option, const QRect &rect) const
|
||||
{
|
||||
Q_Q(const QCommonStyle);
|
||||
@ -936,7 +934,7 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt
|
||||
textLayout.setFont(option->font);
|
||||
textLayout.setText(option->text);
|
||||
|
||||
QSizeF textLayoutSize = viewItemTextLayout(textLayout, textRect.width());
|
||||
viewItemTextLayout(textLayout, textRect.width());
|
||||
|
||||
QString elidedText;
|
||||
qreal height = 0;
|
||||
|
@ -586,7 +586,6 @@ void QGtkPainter::paintShadow(GtkWidget *gtkWidget, const gchar* part,
|
||||
if (!rect.isValid())
|
||||
return;
|
||||
|
||||
QRect r = rect;
|
||||
QPixmap cache;
|
||||
QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey;
|
||||
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
|
||||
@ -605,7 +604,6 @@ void QGtkPainter::paintFlatBox(GtkWidget *gtkWidget, const gchar* part,
|
||||
{
|
||||
if (!rect.isValid())
|
||||
return;
|
||||
QRect r = rect;
|
||||
QPixmap cache;
|
||||
QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey;
|
||||
if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
|
||||
@ -632,7 +630,6 @@ void QGtkPainter::paintExtention(GtkWidget *gtkWidget,
|
||||
if (!rect.isValid())
|
||||
return;
|
||||
|
||||
QRect r = rect;
|
||||
QPixmap cache;
|
||||
QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget)
|
||||
% HexString<uchar>(gap_pos);
|
||||
@ -660,7 +657,6 @@ void QGtkPainter::paintOption(GtkWidget *gtkWidget, const QRect &radiorect,
|
||||
if (!rect.isValid())
|
||||
return;
|
||||
|
||||
QRect r = rect;
|
||||
QPixmap cache;
|
||||
QString pixmapName = uniqueName(detail, state, shadow, rect.size());
|
||||
GdkRectangle gtkCliprect = {0, 0, rect.width(), rect.height()};
|
||||
@ -692,7 +688,6 @@ void QGtkPainter::paintCheckbox(GtkWidget *gtkWidget, const QRect &checkrect,
|
||||
if (!rect.isValid())
|
||||
return;
|
||||
|
||||
QRect r = rect;
|
||||
QPixmap cache;
|
||||
QString pixmapName = uniqueName(detail, state, shadow, rect.size());
|
||||
GdkRectangle gtkCliprect = {0, 0, rect.width(), rect.height()};
|
||||
|
@ -782,7 +782,6 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
|
||||
GtkStateType state = gtkPainter.gtkState(option);
|
||||
style = gtkTreeHeader->style;
|
||||
GtkArrowType type = GTK_ARROW_UP;
|
||||
QRect r = header->rect;
|
||||
QImage arrow;
|
||||
// This sorting indicator inversion is intentional, and follows the GNOME HIG.
|
||||
// See http://library.gnome.org/devel/hig-book/stable/controls-lists.html.en#controls-lists-sortable
|
||||
@ -1857,7 +1856,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
|
||||
editArea.setRight(upRect.left());
|
||||
}
|
||||
if (spinBox->frame) {
|
||||
GtkShadowType shadow = GTK_SHADOW_OUT;
|
||||
GtkStateType state = gtkPainter.gtkState(option);
|
||||
|
||||
if (!(option->state & State_Enabled))
|
||||
@ -1867,7 +1865,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
|
||||
else if (state == GTK_STATE_PRELIGHT)
|
||||
state = GTK_STATE_NORMAL;
|
||||
|
||||
shadow = GTK_SHADOW_IN;
|
||||
style = gtkPainter.getStyle(gtkSpinButton);
|
||||
|
||||
|
||||
|
@ -4707,7 +4707,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
|
||||
|
||||
HIThemeFrameDrawInfo fdi;
|
||||
fdi.version = qt_mac_hitheme_version;
|
||||
fdi.state = kThemeStateInactive;
|
||||
fdi.state = tds;
|
||||
fdi.kind = kHIThemeFrameTextFieldSquare;
|
||||
fdi.isFocused = false;
|
||||
HIRect hirect = qt_hirectForQRect(lineeditRect);
|
||||
|
@ -2007,14 +2007,10 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
|
||||
} else {
|
||||
alphaCornerColor = mergedColors(option->palette.background().color(), borderColor);
|
||||
}
|
||||
QColor alphaTextColor = mergedColors(option->palette.background().color(), option->palette.text().color());
|
||||
|
||||
QColor gradientStartColor = option->palette.button().color().lighter(104);
|
||||
QColor gradientStopColor = option->palette.button().color().darker(105);
|
||||
|
||||
QColor shadowGradientStartColor = option->palette.button().color().darker(115);
|
||||
QColor shadowGradientStopColor = option->palette.button().color().darker(120);
|
||||
|
||||
QColor highlightedGradientStartColor = option->palette.button().color().lighter(101);
|
||||
QColor highlightedGradientStopColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 85);
|
||||
|
||||
@ -2025,8 +2021,6 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
|
||||
QColor highlightedLightInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 58);
|
||||
|
||||
QColor alphaInnerColor = mergedColors(highlightedDarkInnerBorderColor, option->palette.base().color());
|
||||
QColor lightShadow = lightShadowGradientStartColor;
|
||||
QColor shadow = shadowGradientStartColor;
|
||||
|
||||
switch (element) {
|
||||
#ifndef QT_NO_TABBAR
|
||||
@ -3786,10 +3780,6 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
|
||||
}
|
||||
QColor gradientStartColor = option->palette.button().color().lighter(104);
|
||||
QColor gradientStopColor = option->palette.button().color().darker(105);
|
||||
QColor highlightedGradientStartColor = option->palette.button().color().lighter(101);
|
||||
QColor highlightedGradientStopColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 85);
|
||||
QColor highlightedDarkInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 35);
|
||||
QColor highlightedLightInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 58);
|
||||
|
||||
switch (control) {
|
||||
#ifndef QT_NO_SLIDER
|
||||
@ -3797,7 +3787,6 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
|
||||
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
|
||||
QRect grooveRegion = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
|
||||
QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
|
||||
QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
|
||||
bool horizontal = slider->orientation == Qt::Horizontal;
|
||||
bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
|
||||
bool ticksBelow = slider->tickPosition & QSlider::TicksBelow;
|
||||
|
@ -1858,8 +1858,8 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
||||
}
|
||||
|
||||
QRect vCheckRect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x(), menuitem->rect.y(), checkcol, menuitem->rect.height()));
|
||||
if (checked) {
|
||||
if (act && !dis) {
|
||||
if (!menuitem->icon.isNull() && checked) {
|
||||
if (act) {
|
||||
qDrawShadePanel(p, vCheckRect,
|
||||
menuitem->palette, true, 1,
|
||||
&menuitem->palette.brush(QPalette::Button));
|
||||
@ -2028,10 +2028,8 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
||||
&& tabBarAlignment == Qt::AlignLeft);
|
||||
|
||||
QColor light = tab->palette.light().color();
|
||||
QColor midlight = tab->palette.midlight().color();
|
||||
QColor dark = tab->palette.dark().color();
|
||||
QColor shadow = tab->palette.shadow().color();
|
||||
QColor background = tab->palette.background().color();
|
||||
int borderThinkness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget);
|
||||
if (selected)
|
||||
borderThinkness /= 2;
|
||||
|
@ -969,7 +969,8 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
|
||||
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option))
|
||||
{
|
||||
|
||||
if (QWindowsVistaAnimation *anim = d->widgetAnimation(widget)) {
|
||||
QWindowsVistaAnimation *anim = d->widgetAnimation(widget);
|
||||
if (anim && (btn->state & State_Enabled)) {
|
||||
anim->paint(painter, option);
|
||||
} else {
|
||||
name = QLatin1String("BUTTON");
|
||||
@ -996,7 +997,6 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
|
||||
!(state & (State_Sunken | State_On)) && !(state & State_MouseOver) &&
|
||||
(state & State_Enabled) && (state & State_Active))
|
||||
{
|
||||
QWindowsVistaAnimation *anim = d->widgetAnimation(widget);
|
||||
if (!anim && widget) {
|
||||
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
|
||||
startImage.fill(0);
|
||||
@ -1074,8 +1074,8 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
|
||||
}
|
||||
|
||||
if (const QProgressBar *progressbar = qobject_cast<const QProgressBar *>(widget)) {
|
||||
if (((progressbar->value() > 0 && d->transitionsEnabled()) || isIndeterminate)) {
|
||||
if (!d->widgetAnimation(progressbar) && progressbar->value() < progressbar->maximum()) {
|
||||
if (isIndeterminate || (progressbar->value() > 0 && (progressbar->value() < progressbar->maximum()) && d->transitionsEnabled())) {
|
||||
if (!d->widgetAnimation(progressbar)) {
|
||||
QWindowsVistaAnimation *a = new QWindowsVistaAnimation;
|
||||
a->setWidget(const_cast<QWidget*>(widget));
|
||||
a->setStartTime(QTime::currentTime());
|
||||
@ -2502,7 +2502,6 @@ void QWindowsVistaStylePrivate::timerEvent()
|
||||
animations[i]->widget()->update();
|
||||
|
||||
if (!animations[i]->widget() ||
|
||||
!animations[i]->widget()->isEnabled() ||
|
||||
!animations[i]->widget()->isVisible() ||
|
||||
animations[i]->widget()->window()->isMinimized() ||
|
||||
!animations[i]->running() ||
|
||||
|
@ -1196,8 +1196,14 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option,
|
||||
if (qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option))
|
||||
{
|
||||
rect = QWindowsStyle::subElementRect(sr, option, widget);
|
||||
if (sr == SE_TabWidgetTabContents)
|
||||
rect.adjust(0, 0, -2, -2);
|
||||
if (sr == SE_TabWidgetTabContents) {
|
||||
if (const QTabWidget *tabWidget = qobject_cast<const QTabWidget *>(widget)) {
|
||||
if (tabWidget->documentMode())
|
||||
break;
|
||||
}
|
||||
|
||||
rect.adjust(0, 0, -2, -2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SE_TabWidgetTabBar: {
|
||||
|
@ -152,7 +152,6 @@ public:
|
||||
COpenFontRasterizer *m_rasterizer;
|
||||
mutable QList<const QSymbianTypeFaceExtras *> m_extras;
|
||||
|
||||
mutable QHash<QString, const QSymbianTypeFaceExtras *> m_extrasHash;
|
||||
mutable QSet<QString> m_applicationFontFamilies;
|
||||
};
|
||||
|
||||
@ -255,8 +254,9 @@ void QSymbianFontDatabaseExtrasImplementation::clear()
|
||||
static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
|
||||
if (!dbExtras)
|
||||
return; // initializeDb() has never been called
|
||||
QSymbianTypeFaceExtrasHash &extrasHash = S60->fontData();
|
||||
if (QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) {
|
||||
qDeleteAll(dbExtras->m_extrasHash);
|
||||
qDeleteAll(extrasHash);
|
||||
} else {
|
||||
typedef QList<const QSymbianTypeFaceExtras *>::iterator iterator;
|
||||
for (iterator p = dbExtras->m_extras.begin(); p != dbExtras->m_extras.end(); ++p) {
|
||||
@ -265,11 +265,16 @@ void QSymbianFontDatabaseExtrasImplementation::clear()
|
||||
}
|
||||
dbExtras->m_extras.clear();
|
||||
}
|
||||
dbExtras->m_extrasHash.clear();
|
||||
extrasHash.clear();
|
||||
}
|
||||
|
||||
void qt_cleanup_symbianFontDatabase()
|
||||
{
|
||||
static bool cleanupDone = false;
|
||||
if (cleanupDone)
|
||||
return;
|
||||
cleanupDone = true;
|
||||
|
||||
QFontDatabasePrivate *db = privateDb();
|
||||
if (!db)
|
||||
return;
|
||||
@ -320,9 +325,12 @@ COpenFont* OpenFontFromBitmapFont(const CBitmapFont* aBitmapFont)
|
||||
const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(const QString &aTypeface,
|
||||
bool bold, bool italic) const
|
||||
{
|
||||
QSymbianTypeFaceExtrasHash &extrasHash = S60->fontData();
|
||||
if (extrasHash.isEmpty() && QThread::currentThread() != QApplication::instance()->thread())
|
||||
S60->addThreadLocalReleaseFunc(clear);
|
||||
const QString typeface = qt_symbian_fontNameWithAppFontMarker(aTypeface);
|
||||
const QString searchKey = typeface + QString::number(int(bold)) + QString::number(int(italic));
|
||||
if (!m_extrasHash.contains(searchKey)) {
|
||||
if (!extrasHash.contains(searchKey)) {
|
||||
TFontSpec searchSpec(qt_QString2TPtrC(typeface), 1);
|
||||
if (bold)
|
||||
searchSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
|
||||
@ -336,7 +344,7 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c
|
||||
QScopedPointer<CFont, CFontFromScreenDeviceReleaser> sFont(font);
|
||||
QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font);
|
||||
sFont.take();
|
||||
m_extrasHash.insert(searchKey, extras);
|
||||
extrasHash.insert(searchKey, extras);
|
||||
} else {
|
||||
const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, searchSpec);
|
||||
Q_ASSERT(err == KErrNone && font);
|
||||
@ -350,20 +358,20 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c
|
||||
const TOpenFontFaceAttrib* const attrib = openFont->FaceAttrib();
|
||||
const QString foundKey =
|
||||
QString((const QChar*)attrib->FullName().Ptr(), attrib->FullName().Length());
|
||||
if (!m_extrasHash.contains(foundKey)) {
|
||||
if (!extrasHash.contains(foundKey)) {
|
||||
QScopedPointer<CFont, CFontFromFontStoreReleaser> sFont(font);
|
||||
QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font, openFont);
|
||||
sFont.take();
|
||||
m_extras.append(extras);
|
||||
m_extrasHash.insert(searchKey, extras);
|
||||
m_extrasHash.insert(foundKey, extras);
|
||||
extrasHash.insert(searchKey, extras);
|
||||
extrasHash.insert(foundKey, extras);
|
||||
} else {
|
||||
m_store->ReleaseFont(font);
|
||||
m_extrasHash.insert(searchKey, m_extrasHash.value(foundKey));
|
||||
extrasHash.insert(searchKey, extrasHash.value(foundKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
return m_extrasHash.value(searchKey);
|
||||
return extrasHash.value(searchKey);
|
||||
}
|
||||
|
||||
void QSymbianFontDatabaseExtrasImplementation::removeAppFontData(
|
||||
@ -956,7 +964,7 @@ bool QFontDatabase::removeAllApplicationFonts()
|
||||
|
||||
bool QFontDatabase::supportsThreadedFontRendering()
|
||||
{
|
||||
return false;
|
||||
return QSymbianTypeFaceExtras::symbianFontTableApiAvailable();
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -3090,6 +3090,7 @@ void QTextDocumentLayoutPrivate::ensureLayouted(QFixed y) const
|
||||
if (currentLazyLayoutPosition == -1)
|
||||
return;
|
||||
const QSizeF oldSize = q->dynamicDocumentSize();
|
||||
Q_UNUSED(oldSize);
|
||||
|
||||
if (checkPoints.isEmpty())
|
||||
layoutStep();
|
||||
|
@ -1211,8 +1211,6 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
|
||||
d->itemize();
|
||||
|
||||
QPointF position = pos + d->position;
|
||||
QFixed pos_x = QFixed::fromReal(position.x());
|
||||
QFixed pos_y = QFixed::fromReal(position.y());
|
||||
|
||||
cursorPosition = qBound(0, cursorPosition, d->layoutData->string.length());
|
||||
int line = d->lineNumberForTextPosition(cursorPosition);
|
||||
|
@ -218,10 +218,10 @@ public:
|
||||
mouseTarget = 0;
|
||||
} else if (mouseTarget) {
|
||||
// we did send a press, so we need to fake a release now
|
||||
Qt::MouseButtons mouseButtons = QApplication::mouseButtons();
|
||||
|
||||
// release all pressed mouse buttons
|
||||
/*for (int i = 0; i < 32; ++i) {
|
||||
/* Qt::MouseButtons mouseButtons = QApplication::mouseButtons();
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
if (mouseButtons & (1 << i)) {
|
||||
Qt::MouseButton b = static_cast<Qt::MouseButton>(1 << i);
|
||||
mouseButtons &= ~b;
|
||||
|
@ -1777,10 +1777,7 @@ void QScrollerPrivate::setState(QScroller::State newstate)
|
||||
*/
|
||||
void QScrollerPrivate::setContentPositionHelperDragging(const QPointF &deltaPos)
|
||||
{
|
||||
Q_Q(QScroller);
|
||||
QPointF ppm = q->pixelPerMeter();
|
||||
const QScrollerPropertiesPrivate *sp = properties.d.data();
|
||||
QPointF v = q->velocity();
|
||||
|
||||
if (sp->overshootDragResistanceFactor)
|
||||
overshootPosition /= sp->overshootDragResistanceFactor;
|
||||
|
@ -375,15 +375,18 @@ bool QUndoGroup::isClean() const
|
||||
for undo, if the group is empty or if none of the stacks are active, this action will
|
||||
be disabled.
|
||||
|
||||
If \a prefix is empty, the default prefix "Undo" is used.
|
||||
If \a prefix is empty, the default template "Undo %1" is used instead of prefix.
|
||||
Before Qt 4.8, the prefix "Undo" was used by default.
|
||||
|
||||
\sa createRedoAction() canUndo() QUndoCommand::text()
|
||||
*/
|
||||
|
||||
QAction *QUndoGroup::createUndoAction(QObject *parent, const QString &prefix) const
|
||||
{
|
||||
QString pref = prefix.isEmpty() ? tr("Undo") : prefix;
|
||||
QUndoAction *result = new QUndoAction(pref, parent);
|
||||
QUndoAction *result = new QUndoAction(prefix, parent);
|
||||
if (prefix.isEmpty())
|
||||
result->setTextFormat(tr("Undo %1"), tr("Undo", "Default text for undo action"));
|
||||
|
||||
result->setEnabled(canUndo());
|
||||
result->setPrefixedText(undoText());
|
||||
connect(this, SIGNAL(canUndoChanged(bool)),
|
||||
@ -403,15 +406,18 @@ QAction *QUndoGroup::createUndoAction(QObject *parent, const QString &prefix) co
|
||||
for redo, if the group is empty or if none of the stacks are active, this action will
|
||||
be disabled.
|
||||
|
||||
If \a prefix is empty, the default prefix "Undo" is used.
|
||||
If \a prefix is empty, the default template "Redo %1" is used instead of prefix.
|
||||
Before Qt 4.8, the prefix "Redo" was used by default.
|
||||
|
||||
\sa createUndoAction() canRedo() QUndoCommand::text()
|
||||
*/
|
||||
|
||||
QAction *QUndoGroup::createRedoAction(QObject *parent, const QString &prefix) const
|
||||
{
|
||||
QString pref = prefix.isEmpty() ? tr("Redo") : prefix;
|
||||
QUndoAction *result = new QUndoAction(pref, parent);
|
||||
QUndoAction *result = new QUndoAction(prefix, parent);
|
||||
if (prefix.isEmpty())
|
||||
result->setTextFormat(tr("Redo %1"), tr("Redo", "Default text for redo action"));
|
||||
|
||||
result->setEnabled(canRedo());
|
||||
result->setPrefixedText(redoText());
|
||||
connect(this, SIGNAL(canRedoChanged(bool)),
|
||||
|
@ -114,7 +114,7 @@ QUndoCommand::QUndoCommand(const QString &text, QUndoCommand *parent)
|
||||
d = new QUndoCommandPrivate;
|
||||
if (parent != 0)
|
||||
parent->d->child_list.append(this);
|
||||
d->text = text;
|
||||
setText(text);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -230,10 +230,9 @@ void QUndoCommand::undo()
|
||||
Returns a short text string describing what this command does; for example,
|
||||
"insert text".
|
||||
|
||||
The text is used when the text properties of the stack's undo and redo
|
||||
actions are updated.
|
||||
The text is used for names of items in QUndoView.
|
||||
|
||||
\sa setText(), QUndoStack::createUndoAction(), QUndoStack::createRedoAction()
|
||||
\sa actionText(), setText(), QUndoStack::createUndoAction(), QUndoStack::createRedoAction()
|
||||
*/
|
||||
|
||||
QString QUndoCommand::text() const
|
||||
@ -241,18 +240,48 @@ QString QUndoCommand::text() const
|
||||
return d->text;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
Returns a short text string describing what this command does; for example,
|
||||
"insert text".
|
||||
|
||||
The text is used when the text properties of the stack's undo and redo
|
||||
actions are updated.
|
||||
|
||||
\sa text(), setText(), QUndoStack::createUndoAction(), QUndoStack::createRedoAction()
|
||||
*/
|
||||
|
||||
QString QUndoCommand::actionText() const
|
||||
{
|
||||
return d->actionText;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the command's text to be the \a text specified.
|
||||
|
||||
The specified text should be a short user-readable string describing what this
|
||||
command does.
|
||||
|
||||
\sa text() QUndoStack::createUndoAction() QUndoStack::createRedoAction()
|
||||
If you need to have two different strings for text() and actionText(), separate
|
||||
them with "\n" and pass into this function. Even if you do not use this feature
|
||||
for English strings during development, you can still let translators use two
|
||||
different strings in order to match specific languages' needs.
|
||||
The described feature and the function actionText() are available since Qt 4.8.
|
||||
|
||||
\sa text() actionText() QUndoStack::createUndoAction() QUndoStack::createRedoAction()
|
||||
*/
|
||||
|
||||
void QUndoCommand::setText(const QString &text)
|
||||
{
|
||||
d->text = text;
|
||||
int cdpos = text.indexOf(QLatin1Char('\n'));
|
||||
if (cdpos > 0) {
|
||||
d->text = text.left(cdpos);
|
||||
d->actionText = text.mid(cdpos + 1);
|
||||
} else {
|
||||
d->text = text;
|
||||
d->actionText = text;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -374,11 +403,24 @@ QUndoAction::QUndoAction(const QString &prefix, QObject *parent)
|
||||
|
||||
void QUndoAction::setPrefixedText(const QString &text)
|
||||
{
|
||||
QString s = m_prefix;
|
||||
if (!m_prefix.isEmpty() && !text.isEmpty())
|
||||
s.append(QLatin1Char(' '));
|
||||
s.append(text);
|
||||
setText(s);
|
||||
if (m_defaultText.isEmpty()) {
|
||||
QString s = m_prefix;
|
||||
if (!m_prefix.isEmpty() && !text.isEmpty())
|
||||
s.append(QLatin1Char(' '));
|
||||
s.append(text);
|
||||
setText(s);
|
||||
} else {
|
||||
if (text.isEmpty())
|
||||
setText(m_defaultText);
|
||||
else
|
||||
setText(m_prefix.arg(text));
|
||||
}
|
||||
}
|
||||
|
||||
void QUndoAction::setTextFormat(const QString &textFormat, const QString &defaultText)
|
||||
{
|
||||
m_prefix = textFormat;
|
||||
m_defaultText = defaultText;
|
||||
}
|
||||
|
||||
#endif // QT_NO_ACTION
|
||||
@ -783,7 +825,7 @@ bool QUndoStack::canRedo() const
|
||||
/*!
|
||||
Returns the text of the command which will be undone in the next call to undo().
|
||||
|
||||
\sa QUndoCommand::text() redoText()
|
||||
\sa QUndoCommand::actionText() redoText()
|
||||
*/
|
||||
|
||||
QString QUndoStack::undoText() const
|
||||
@ -792,14 +834,14 @@ QString QUndoStack::undoText() const
|
||||
if (!d->macro_stack.isEmpty())
|
||||
return QString();
|
||||
if (d->index > 0)
|
||||
return d->command_list.at(d->index - 1)->text();
|
||||
return d->command_list.at(d->index - 1)->actionText();
|
||||
return QString();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the text of the command which will be redone in the next call to redo().
|
||||
|
||||
\sa QUndoCommand::text() undoText()
|
||||
\sa QUndoCommand::actionText() undoText()
|
||||
*/
|
||||
|
||||
QString QUndoStack::redoText() const
|
||||
@ -808,7 +850,7 @@ QString QUndoStack::redoText() const
|
||||
if (!d->macro_stack.isEmpty())
|
||||
return QString();
|
||||
if (d->index < d->command_list.size())
|
||||
return d->command_list.at(d->index)->text();
|
||||
return d->command_list.at(d->index)->actionText();
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -822,15 +864,18 @@ QString QUndoStack::redoText() const
|
||||
prefixed by the specified \a prefix. If there is no command available for undo,
|
||||
this action will be disabled.
|
||||
|
||||
If \a prefix is empty, the default prefix "Undo" is used.
|
||||
If \a prefix is empty, the default template "Undo %1" is used instead of prefix.
|
||||
Before Qt 4.8, the prefix "Undo" was used by default.
|
||||
|
||||
\sa createRedoAction(), canUndo(), QUndoCommand::text()
|
||||
*/
|
||||
|
||||
QAction *QUndoStack::createUndoAction(QObject *parent, const QString &prefix) const
|
||||
{
|
||||
QString pref = prefix.isEmpty() ? tr("Undo") : prefix;
|
||||
QUndoAction *result = new QUndoAction(pref, parent);
|
||||
QUndoAction *result = new QUndoAction(prefix, parent);
|
||||
if (prefix.isEmpty())
|
||||
result->setTextFormat(tr("Undo %1"), tr("Undo", "Default text for undo action"));
|
||||
|
||||
result->setEnabled(canUndo());
|
||||
result->setPrefixedText(undoText());
|
||||
connect(this, SIGNAL(canUndoChanged(bool)),
|
||||
@ -849,15 +894,18 @@ QAction *QUndoStack::createUndoAction(QObject *parent, const QString &prefix) co
|
||||
prefixed by the specified \a prefix. If there is no command available for redo,
|
||||
this action will be disabled.
|
||||
|
||||
If \a prefix is empty, the default prefix "Redo" is used.
|
||||
If \a prefix is empty, the default template "Redo %1" is used instead of prefix.
|
||||
Before Qt 4.8, the prefix "Redo" was used by default.
|
||||
|
||||
\sa createUndoAction(), canRedo(), QUndoCommand::text()
|
||||
*/
|
||||
|
||||
QAction *QUndoStack::createRedoAction(QObject *parent, const QString &prefix) const
|
||||
{
|
||||
QString pref = prefix.isEmpty() ? tr("Redo") : prefix;
|
||||
QUndoAction *result = new QUndoAction(pref, parent);
|
||||
QUndoAction *result = new QUndoAction(prefix, parent);
|
||||
if (prefix.isEmpty())
|
||||
result->setTextFormat(tr("Redo %1"), tr("Redo", "Default text for redo action"));
|
||||
|
||||
result->setEnabled(canRedo());
|
||||
result->setPrefixedText(redoText());
|
||||
connect(this, SIGNAL(canRedoChanged(bool)),
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
virtual void redo();
|
||||
|
||||
QString text() const;
|
||||
QString actionText() const;
|
||||
void setText(const QString &text);
|
||||
|
||||
virtual int id() const;
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
QUndoCommandPrivate() : id(-1) {}
|
||||
QList<QUndoCommand*> child_list;
|
||||
QString text;
|
||||
QString actionText;
|
||||
int id;
|
||||
};
|
||||
|
||||
@ -98,10 +99,12 @@ class QUndoAction : public QAction
|
||||
Q_OBJECT
|
||||
public:
|
||||
QUndoAction(const QString &prefix, QObject *parent = 0);
|
||||
void setTextFormat(const QString &textFormat, const QString &defaultText);
|
||||
public Q_SLOTS:
|
||||
void setPrefixedText(const QString &text);
|
||||
private:
|
||||
QString m_prefix;
|
||||
QString m_defaultText;
|
||||
};
|
||||
#endif // QT_NO_ACTION
|
||||
|
||||
|
@ -2538,20 +2538,32 @@ void QDateTimeEditPrivate::syncCalendarWidget()
|
||||
}
|
||||
|
||||
QCalendarPopup::QCalendarPopup(QWidget * parent, QCalendarWidget *cw)
|
||||
: QWidget(parent, Qt::Popup), calendar(0)
|
||||
: QWidget(parent, Qt::Popup)
|
||||
{
|
||||
setAttribute(Qt::WA_WindowPropagation);
|
||||
|
||||
dateChanged = false;
|
||||
if (!cw) {
|
||||
cw = new QCalendarWidget(this);
|
||||
verifyCalendarInstance();
|
||||
} else {
|
||||
setCalendarWidget(cw);
|
||||
}
|
||||
}
|
||||
|
||||
QCalendarWidget *QCalendarPopup::verifyCalendarInstance()
|
||||
{
|
||||
if (calendar.isNull()) {
|
||||
QCalendarWidget *cw = new QCalendarWidget(this);
|
||||
cw->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader);
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
cw->setHorizontalHeaderFormat(QCalendarWidget::SingleLetterDayNames);
|
||||
#endif
|
||||
setCalendarWidget(cw);
|
||||
return cw;
|
||||
} else {
|
||||
return calendar.data();
|
||||
}
|
||||
setCalendarWidget(cw);
|
||||
}
|
||||
|
||||
void QCalendarPopup::setCalendarWidget(QCalendarWidget *cw)
|
||||
@ -2563,28 +2575,29 @@ void QCalendarPopup::setCalendarWidget(QCalendarWidget *cw)
|
||||
widgetLayout->setMargin(0);
|
||||
widgetLayout->setSpacing(0);
|
||||
}
|
||||
delete calendar;
|
||||
calendar = cw;
|
||||
widgetLayout->addWidget(calendar);
|
||||
delete calendar.data();
|
||||
calendar = QWeakPointer<QCalendarWidget>(cw);
|
||||
widgetLayout->addWidget(cw);
|
||||
|
||||
connect(calendar, SIGNAL(activated(QDate)), this, SLOT(dateSelected(QDate)));
|
||||
connect(calendar, SIGNAL(clicked(QDate)), this, SLOT(dateSelected(QDate)));
|
||||
connect(calendar, SIGNAL(selectionChanged()), this, SLOT(dateSelectionChanged()));
|
||||
connect(cw, SIGNAL(activated(QDate)), this, SLOT(dateSelected(QDate)));
|
||||
connect(cw, SIGNAL(clicked(QDate)), this, SLOT(dateSelected(QDate)));
|
||||
connect(cw, SIGNAL(selectionChanged()), this, SLOT(dateSelectionChanged()));
|
||||
|
||||
calendar->setFocus();
|
||||
cw->setFocus();
|
||||
}
|
||||
|
||||
|
||||
void QCalendarPopup::setDate(const QDate &date)
|
||||
{
|
||||
oldDate = date;
|
||||
calendar->setSelectedDate(date);
|
||||
verifyCalendarInstance()->setSelectedDate(date);
|
||||
}
|
||||
|
||||
void QCalendarPopup::setDateRange(const QDate &min, const QDate &max)
|
||||
{
|
||||
calendar->setMinimumDate(min);
|
||||
calendar->setMaximumDate(max);
|
||||
QCalendarWidget *cw = verifyCalendarInstance();
|
||||
cw->setMinimumDate(min);
|
||||
cw->setMaximumDate(max);
|
||||
}
|
||||
|
||||
void QCalendarPopup::mousePressEvent(QMouseEvent *event)
|
||||
@ -2620,7 +2633,7 @@ bool QCalendarPopup::event(QEvent *event)
|
||||
void QCalendarPopup::dateSelectionChanged()
|
||||
{
|
||||
dateChanged = true;
|
||||
emit newDateSelected(calendar->selectedDate());
|
||||
emit newDateSelected(verifyCalendarInstance()->selectedDate());
|
||||
}
|
||||
void QCalendarPopup::dateSelected(const QDate &date)
|
||||
{
|
||||
|
@ -148,11 +148,11 @@ class QCalendarPopup : public QWidget
|
||||
Q_OBJECT
|
||||
public:
|
||||
QCalendarPopup(QWidget *parent = 0, QCalendarWidget *cw = 0);
|
||||
QDate selectedDate() { return calendar->selectedDate(); }
|
||||
QDate selectedDate() { return verifyCalendarInstance()->selectedDate(); }
|
||||
void setDate(const QDate &date);
|
||||
void setDateRange(const QDate &min, const QDate &max);
|
||||
void setFirstDayOfWeek(Qt::DayOfWeek dow) { calendar->setFirstDayOfWeek(dow); }
|
||||
QCalendarWidget *calendarWidget() const { return calendar; }
|
||||
void setFirstDayOfWeek(Qt::DayOfWeek dow) { verifyCalendarInstance()->setFirstDayOfWeek(dow); }
|
||||
QCalendarWidget *calendarWidget() const { return const_cast<QCalendarPopup*>(this)->verifyCalendarInstance(); }
|
||||
void setCalendarWidget(QCalendarWidget *cw);
|
||||
Q_SIGNALS:
|
||||
void activated(const QDate &date);
|
||||
@ -171,7 +171,9 @@ protected:
|
||||
bool event(QEvent *e);
|
||||
|
||||
private:
|
||||
QCalendarWidget *calendar;
|
||||
QCalendarWidget *verifyCalendarInstance();
|
||||
|
||||
QWeakPointer<QCalendarWidget> calendar;
|
||||
QDate oldDate;
|
||||
bool dateChanged;
|
||||
};
|
||||
|
@ -2100,7 +2100,6 @@ bool QDockAreaLayoutInfo::updateTabBar() const
|
||||
bool gap = false;
|
||||
|
||||
int tab_idx = 0;
|
||||
bool changed = false;
|
||||
for (int i = 0; i < item_list.count(); ++i) {
|
||||
const QDockAreaLayoutItem &item = item_list.at(i);
|
||||
if (item.skip())
|
||||
@ -2121,7 +2120,6 @@ bool QDockAreaLayoutInfo::updateTabBar() const
|
||||
tabBar->setTabToolTip(tab_idx, title);
|
||||
#endif
|
||||
tabBar->setTabData(tab_idx, id);
|
||||
changed = true;
|
||||
} else if (qvariant_cast<quintptr>(tabBar->tabData(tab_idx)) != id) {
|
||||
if (tab_idx + 1 < tabBar->count()
|
||||
&& qvariant_cast<quintptr>(tabBar->tabData(tab_idx + 1)) == id)
|
||||
@ -2133,7 +2131,6 @@ bool QDockAreaLayoutInfo::updateTabBar() const
|
||||
#endif
|
||||
tabBar->setTabData(tab_idx, id);
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (title != tabBar->tabText(tab_idx)) {
|
||||
@ -2141,7 +2138,6 @@ bool QDockAreaLayoutInfo::updateTabBar() const
|
||||
#ifndef QT_NO_TOOLTIP
|
||||
tabBar->setTabToolTip(tab_idx, title);
|
||||
#endif
|
||||
changed = true;
|
||||
}
|
||||
|
||||
++tab_idx;
|
||||
@ -2149,7 +2145,6 @@ bool QDockAreaLayoutInfo::updateTabBar() const
|
||||
|
||||
while (tab_idx < tabBar->count()) {
|
||||
tabBar->removeTab(tab_idx);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
tabBar->blockSignals(blocked);
|
||||
|
@ -161,7 +161,6 @@ void QDockWidgetTitleButton::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
|
||||
QRect r = rect();
|
||||
QStyleOptionToolButton opt;
|
||||
opt.init(this);
|
||||
opt.state |= QStyle::State_AutoRaise;
|
||||
|
@ -226,6 +226,12 @@ QList<QPointer<QWidget> > QMenuPrivate::calcCausedStack() const
|
||||
}
|
||||
|
||||
void QMenuPrivate::updateActionRects() const
|
||||
{
|
||||
Q_Q(const QMenu);
|
||||
updateActionRects(popupGeometry(q));
|
||||
}
|
||||
|
||||
void QMenuPrivate::updateActionRects(const QRect &screen) const
|
||||
{
|
||||
Q_Q(const QMenu);
|
||||
if (!itemsDirty)
|
||||
@ -237,20 +243,10 @@ void QMenuPrivate::updateActionRects() const
|
||||
actionRects.resize(actions.count());
|
||||
actionRects.fill(QRect());
|
||||
|
||||
//let's try to get the last visible action
|
||||
int lastVisibleAction = actions.count() - 1;
|
||||
for(;lastVisibleAction >= 0; --lastVisibleAction) {
|
||||
const QAction *action = actions.at(lastVisibleAction);
|
||||
if (action->isVisible()) {
|
||||
//removing trailing separators
|
||||
if (action->isSeparator() && collapsibleSeparators)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int lastVisibleAction = getLastVisibleAction();
|
||||
|
||||
int max_column_width = 0,
|
||||
dh = popupGeometry(q).height(),
|
||||
dh = screen.height(),
|
||||
y = 0;
|
||||
QStyle *style = q->style();
|
||||
QStyleOption opt;
|
||||
@ -351,7 +347,6 @@ void QMenuPrivate::updateActionRects() const
|
||||
const int min_column_width = q->minimumWidth() - (sfcMargin + leftmargin + rightmargin + 2 * (fw + hmargin));
|
||||
max_column_width = qMax(min_column_width, max_column_width);
|
||||
|
||||
|
||||
//calculate position
|
||||
const int base_y = vmargin + fw + topmargin +
|
||||
(scroll ? scroll->scrollOffset : 0) +
|
||||
@ -382,6 +377,34 @@ void QMenuPrivate::updateActionRects() const
|
||||
itemsDirty = 0;
|
||||
}
|
||||
|
||||
QSize QMenuPrivate::adjustMenuSizeForScreen(const QRect &screen)
|
||||
{
|
||||
Q_Q(QMenu);
|
||||
QSize ret = screen.size();
|
||||
itemsDirty = true;
|
||||
updateActionRects(screen);
|
||||
const int fw = q->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);
|
||||
ret.setWidth(actionRects.at(getLastVisibleAction()).right() + fw);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int QMenuPrivate::getLastVisibleAction() const
|
||||
{
|
||||
//let's try to get the last visible action
|
||||
int lastVisibleAction = actions.count() - 1;
|
||||
for (;lastVisibleAction >= 0; --lastVisibleAction) {
|
||||
const QAction *action = actions.at(lastVisibleAction);
|
||||
if (action->isVisible()) {
|
||||
//removing trailing separators
|
||||
if (action->isSeparator() && collapsibleSeparators)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return lastVisibleAction;
|
||||
}
|
||||
|
||||
|
||||
QRect QMenuPrivate::actionRect(QAction *act) const
|
||||
{
|
||||
int index = actions.indexOf(act);
|
||||
@ -1813,9 +1836,20 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
|
||||
else
|
||||
#endif
|
||||
screen = d->popupGeometry(QApplication::desktop()->screenNumber(p));
|
||||
|
||||
const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, this);
|
||||
bool adjustToDesktop = !window()->testAttribute(Qt::WA_DontShowOnScreen);
|
||||
|
||||
// if the screens have very different geometries and the menu is too big, we have to recalculate
|
||||
if (size.height() > screen.height() || size.width() > screen.width()) {
|
||||
size = d->adjustMenuSizeForScreen(screen);
|
||||
adjustToDesktop = true;
|
||||
}
|
||||
// Layout is not right, we might be able to save horizontal space
|
||||
if (d->ncols >1 && size.height() < screen.height()) {
|
||||
size = d->adjustMenuSizeForScreen(screen);
|
||||
adjustToDesktop = true;
|
||||
}
|
||||
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (!atAction && QApplication::keypadNavigationEnabled()) {
|
||||
// Try to have one item activated
|
||||
@ -1909,6 +1943,27 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
|
||||
}
|
||||
}
|
||||
}
|
||||
const int subMenuOffset = style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0, this);
|
||||
const QSize menuSize(sizeHint());
|
||||
QMenu *caused = qobject_cast<QMenu*>(d_func()->causedPopup.widget);
|
||||
if (caused && caused->geometry().width() + menuSize.width() + subMenuOffset < screen.width()) {
|
||||
QRect parentActionRect(caused->d_func()->actionRect(caused->d_func()->currentAction));
|
||||
const QPoint actionTopLeft = caused->mapToGlobal(parentActionRect.topLeft());
|
||||
parentActionRect.moveTopLeft(actionTopLeft);
|
||||
if (isRightToLeft()) {
|
||||
if ((pos.x() + menuSize.width() > parentActionRect.left() - subMenuOffset)
|
||||
&& (pos.x() < parentActionRect.right()))
|
||||
{
|
||||
pos.rx() = parentActionRect.right();
|
||||
}
|
||||
} else {
|
||||
if ((pos.x() < parentActionRect.right() + subMenuOffset)
|
||||
&& (pos.x() + menuSize.width() > parentActionRect.left()))
|
||||
{
|
||||
pos.rx() = parentActionRect.left() - menuSize.width();
|
||||
}
|
||||
}
|
||||
}
|
||||
setGeometry(QRect(pos, size));
|
||||
#ifndef QT_NO_EFFECTS
|
||||
int hGuess = isRightToLeft() ? QEffects::LeftScroll : QEffects::RightScroll;
|
||||
@ -2941,28 +2996,8 @@ void QMenu::internalDelayedPopup()
|
||||
const QRect actionRect(d->actionRect(d->currentAction));
|
||||
const QSize menuSize(d->activeMenu->sizeHint());
|
||||
const QPoint rightPos(mapToGlobal(QPoint(actionRect.right() + subMenuOffset + 1, actionRect.top())));
|
||||
const QPoint leftPos(mapToGlobal(QPoint(actionRect.left() - subMenuOffset - menuSize.width(), actionRect.top())));
|
||||
|
||||
QPoint pos(rightPos);
|
||||
QMenu *caused = qobject_cast<QMenu*>(d->activeMenu->d_func()->causedPopup.widget);
|
||||
|
||||
const QRect availGeometry(d->popupGeometry(caused));
|
||||
if (isRightToLeft()) {
|
||||
pos = leftPos;
|
||||
if ((caused && caused->x() < x()) || pos.x() < availGeometry.left()) {
|
||||
if(rightPos.x() + menuSize.width() < availGeometry.right())
|
||||
pos = rightPos;
|
||||
else
|
||||
pos.rx() = availGeometry.left();
|
||||
}
|
||||
} else {
|
||||
if ((caused && caused->x() > x()) || pos.x() + menuSize.width() > availGeometry.right()) {
|
||||
if(leftPos.x() < availGeometry.left())
|
||||
pos.rx() = availGeometry.right() - menuSize.width();
|
||||
else
|
||||
pos = leftPos;
|
||||
}
|
||||
}
|
||||
|
||||
//calc sloppy focus buffer
|
||||
if (style()->styleHint(QStyle::SH_Menu_SloppySubMenus, 0, this)) {
|
||||
|
@ -194,10 +194,13 @@ public:
|
||||
mutable QVector<QRect> actionRects;
|
||||
mutable QHash<QAction *, QWidget *> widgetItems;
|
||||
void updateActionRects() const;
|
||||
void updateActionRects(const QRect &screen) const;
|
||||
QRect popupGeometry(const QWidget *widget) const;
|
||||
QRect popupGeometry(int screen = -1) const;
|
||||
mutable uint ncols : 4; //4 bits is probably plenty
|
||||
uint collapsibleSeparators : 1;
|
||||
QSize adjustMenuSizeForScreen(const QRect & screen);
|
||||
int getLastVisibleAction() const;
|
||||
|
||||
bool activationRecursionGuard;
|
||||
|
||||
@ -296,7 +299,6 @@ public:
|
||||
|
||||
void updateLayoutDirection();
|
||||
|
||||
|
||||
//menu fading/scrolling effects
|
||||
bool doChildEffects;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user