Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev
This commit is contained in:
commit
601019e3f4
@ -174,7 +174,7 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\externalpage http://code.google.com/p/angleproject/
|
||||
\externalpage https://chromium.googlesource.com/angle/angle/+/master/README.md
|
||||
\title ANGLE
|
||||
*/
|
||||
|
||||
|
@ -88,7 +88,7 @@ QByteArray ConnectionManager::clientId() const
|
||||
// Generate peer id
|
||||
qint64 startupTime = QDateTime::currentSecsSinceEpoch();
|
||||
|
||||
id += QString::asprintf("-QT%04x-", (QT_VERSION % 0xffff00) >> 8).toLatin1();
|
||||
id += QString::asprintf("-QT%04x-", QT_VERSION >> 8).toLatin1();
|
||||
id += QByteArray::number(startupTime, 10);
|
||||
id += QByteArray(20 - id.size(), '-');
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ void FragmentToy::draw(const QSize &windowSize)
|
||||
m_program->enableAttributeArray("vertexCoord");
|
||||
m_vertex_buffer.release();
|
||||
|
||||
m_program->setUniformValue("currentTime", (uint) QDateTime::currentDateTime().toMSecsSinceEpoch());
|
||||
m_program->setUniformValue("currentTime", (uint) QDateTime::currentMSecsSinceEpoch());
|
||||
m_program->setUniformValue("windowSize", windowSize);
|
||||
|
||||
QOpenGLContext::currentContext()->functions()->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
@ -494,7 +494,7 @@ void PathStrokeRenderer::initializePoints()
|
||||
m_vectors.clear();
|
||||
|
||||
QMatrix m;
|
||||
qreal rot = 360 / count;
|
||||
qreal rot = 360.0 / count;
|
||||
QPointF center(width() / 2, height() / 2);
|
||||
QMatrix vm;
|
||||
vm.shear(2, -1);
|
||||
|
@ -40,5 +40,5 @@ QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
|
||||
|
||||
# Wrapper tools that understand .o/.a files with LLVM bytecode instead of machine code
|
||||
QMAKE_AR_LTCG = llvm-ar cqs
|
||||
QMAKE_NM_LTCG = gcc-nm -P
|
||||
QMAKE_NM_LTCG = llvm-nm -P
|
||||
QMAKE_RANLIB_LTCG = true # No need to run, since llvm-ar has "s"
|
||||
|
@ -35,6 +35,7 @@ QMAKE_LIBS_THREAD =
|
||||
|
||||
QMAKE_DSYMUTIL = dsymutil
|
||||
QMAKE_STRIP = strip
|
||||
QMAKE_STRIPFLAGS_LIB += -S -x
|
||||
|
||||
QMAKE_AR = ar cq
|
||||
QMAKE_RANLIB = ranlib -s
|
||||
|
@ -22,7 +22,7 @@
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name=\"Windows.Universal\" MinVersion=\"10.0.10240.0\" MaxVersionTested=\"10.0.10586.0\" />$${WINRT_MANIFEST.dependencies}
|
||||
<TargetDeviceFamily Name=\"Windows.Universal\" MinVersion=\"10.0.10586.0\" MaxVersionTested=\"10.0.10586.0\" />$${WINRT_MANIFEST.dependencies}
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
|
@ -1,8 +1,7 @@
|
||||
isEmpty(COPIES): return()
|
||||
contains(TEMPLATE, .*subdirs): error("COPIES does not work with TEMPLATE=subdirs")
|
||||
|
||||
build_pass:build_all: \
|
||||
debug_and_release:debug {
|
||||
build_pass:build_all:!isEqual(BUILD_PASS, $$first(BUILDS)) {
|
||||
# Avoid that multiple build passes race with each other.
|
||||
# This will fail to copy anything if the user explicitly invokes
|
||||
# only the non-primary build. This is unfixable, as at qmake time
|
||||
|
@ -156,7 +156,7 @@ for(ever) {
|
||||
!isEmpty(var_sfx): break()
|
||||
var_sfx = _PRIVATE
|
||||
}
|
||||
!isEmpty(using_privates):!no_private_qt_headers_warning:if(!debug_and_release|!build_pass) {
|
||||
!isEmpty(using_privates):!no_private_qt_headers_warning:!build_pass {
|
||||
message("This project is using private headers and will therefore be tied to this specific Qt module build version.")
|
||||
message("Running this project against other versions of the Qt modules may crash at any arbitrary point.")
|
||||
message("This is not a bug, but a result of using Qt internals. You have been warned!")
|
||||
|
@ -102,9 +102,9 @@ warnings_are_errors:warning_clean {
|
||||
# Work-around for bug https://code.google.com/p/android/issues/detail?id=58135
|
||||
android: QMAKE_CXXFLAGS_WARN_ON += -Wno-error=literal-suffix
|
||||
}
|
||||
} else:msvc {
|
||||
# enable for MSVC 2012, MSVC 2013
|
||||
equals(MSVC_VER, "11.0")|equals(MSVC_VER, "12.0"): QMAKE_CXXFLAGS_WARN_ON += -WX
|
||||
} else:msvc:!intel_icl {
|
||||
# enable for MSVC 2012, MSVC 2013, MSVC 2015
|
||||
contains(MSVC_VER, "1[124].0"): QMAKE_CXXFLAGS_WARN_ON += -WX
|
||||
}
|
||||
unset(ver)
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ contains(TEMPLATE, subdirs) {
|
||||
for(inst, DOC_TARGETS): \
|
||||
prepareRecursiveTarget($$inst)
|
||||
} else {
|
||||
debug_and_release:!build_pass {
|
||||
!isEmpty(BUILDS):!build_pass {
|
||||
sub = $$first(BUILDS)
|
||||
for(inst, DOC_TARGETS) {
|
||||
$${inst}.CONFIG = recursive
|
||||
|
@ -259,7 +259,10 @@ defineReplace(pkgConfigExecutable) {
|
||||
}
|
||||
|
||||
defineTest(packagesExist) {
|
||||
contains(QT_CONFIG, no-pkg-config):return(false)
|
||||
contains(QT_CONFIG, no-pkg-config) {
|
||||
warning("pkg-config disabled, can't check package existence")
|
||||
return(false)
|
||||
}
|
||||
|
||||
# this can't be done in global scope here because qt_functions is loaded
|
||||
# before the .pro is parsed, so if the .pro set PKG_CONFIG, we wouldn't know it
|
||||
|
@ -35,7 +35,7 @@ for(resource, RESOURCES) {
|
||||
|
||||
resource_file = $$RCC_DIR/qmake_$${resource}.qrc
|
||||
|
||||
!debug_and_release|build_pass {
|
||||
isEmpty(BUILDS)|build_pass {
|
||||
# Collection of files, generate qrc file
|
||||
prefix = $$eval($${resource}.prefix)
|
||||
isEmpty(prefix): \
|
||||
|
@ -17,6 +17,9 @@ QMAKE_LIBDIR_X11 = /usr/X11R7/lib
|
||||
QMAKE_INCDIR_OPENGL = /usr/X11R7/include
|
||||
QMAKE_LIBDIR_OPENGL = /usr/X11R7/lib
|
||||
|
||||
# NetBSD requires rpath to be used for all lib dirs, see http://www.netbsd.org/docs/elf.html
|
||||
QMAKE_RPATHDIR += $$QMAKE_LIBDIR $$QMAKE_LIBDIR_X11
|
||||
|
||||
include(../common/gcc-base-unix.conf)
|
||||
include(../common/g++-unix.conf)
|
||||
load(qt_config)
|
||||
|
@ -17,9 +17,26 @@ QMAKE_LIBDIR_X11 = /usr/X11R6/lib
|
||||
QMAKE_INCDIR_OPENGL = /usr/X11R6/include
|
||||
QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib
|
||||
|
||||
QMAKE_RPATHDIR += $$QMAKE_LIBDIR_X11
|
||||
|
||||
include(../common/gcc-base-unix.conf)
|
||||
include(../common/g++-unix.conf)
|
||||
|
||||
# System compiler is gcc 4.2.1 up to OpenBSD 6.0.
|
||||
# For proper C++11 support, we need to use a newer gcc from ports/packages,
|
||||
# where compiler commands are renamed to egcc/eg++. Therefore, redefine
|
||||
# mkspecs/common/g++-base.conf compiler commands
|
||||
QMAKE_CC = egcc
|
||||
|
||||
QMAKE_LINK_C = $$QMAKE_CC
|
||||
QMAKE_LINK_C_SHLIB = $$QMAKE_CC
|
||||
|
||||
QMAKE_CXX = eg++
|
||||
|
||||
QMAKE_LINK = $$QMAKE_CXX
|
||||
QMAKE_LINK_SHLIB = $$QMAKE_CXX
|
||||
|
||||
|
||||
# Reset g++-unix.conf's NOUNDEF flags as OpenBSD libc can't handle environ
|
||||
QMAKE_LFLAGS_NOUNDEF =
|
||||
|
||||
|
@ -1131,7 +1131,11 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
|
||||
QString rstr = QDir::cleanPath(
|
||||
QDir(args.count() > 1 ? args.at(1).toQString(m_tmp2) : currentDirectory())
|
||||
.absoluteFilePath(args.at(0).toQString(m_tmp1)));
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? args.at(0) : ProString(rstr).setSource(args.at(0)));
|
||||
ret << (rstr.isSharedWith(m_tmp1)
|
||||
? args.at(0)
|
||||
: args.count() > 1 && rstr.isSharedWith(m_tmp2)
|
||||
? args.at(1)
|
||||
: ProString(rstr).setSource(args.at(0)));
|
||||
}
|
||||
break;
|
||||
case E_RELATIVE_PATH:
|
||||
@ -1305,7 +1309,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
||||
return ReturnFalse;
|
||||
case T_REQUIRES:
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
checkRequirements(args);
|
||||
if (checkRequirements(args) == ReturnError)
|
||||
return ReturnError;
|
||||
#endif
|
||||
return ReturnFalse; // Another qmake breakage
|
||||
case T_EVAL: {
|
||||
@ -1327,8 +1332,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
||||
evalError(fL1S("if(condition) requires one argument."));
|
||||
return ReturnFalse;
|
||||
}
|
||||
return returnBool(evaluateConditional(args.at(0).toQStringRef(),
|
||||
m_current.pro->fileName(), m_current.line));
|
||||
return evaluateConditional(args.at(0).toQStringRef(),
|
||||
m_current.pro->fileName(), m_current.line);
|
||||
}
|
||||
case T_CONFIG: {
|
||||
if (args.count() < 1 || args.count() > 2) {
|
||||
|
@ -405,7 +405,7 @@ static ALWAYS_INLINE void addStrList(
|
||||
}
|
||||
}
|
||||
|
||||
void QMakeEvaluator::evaluateExpression(
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateExpression(
|
||||
const ushort *&tokPtr, ProStringList *ret, bool joined)
|
||||
{
|
||||
debugMsg(2, joined ? "evaluating joined expression" : "evaluating expression");
|
||||
@ -455,12 +455,15 @@ void QMakeEvaluator::evaluateExpression(
|
||||
case TokFuncName: {
|
||||
const ProKey &func = pro->getHashStr(tokPtr);
|
||||
debugMsg(2, "function %s", dbgKey(func));
|
||||
addStrList(evaluateExpandFunction(func, tokPtr), tok, ret, pending, joined);
|
||||
ProStringList val;
|
||||
if (evaluateExpandFunction(func, tokPtr, &val) == ReturnError)
|
||||
return ReturnError;
|
||||
addStrList(val, tok, ret, pending, joined);
|
||||
break; }
|
||||
default:
|
||||
debugMsg(2, "evaluated expression => %s", dbgStrList(*ret));
|
||||
tokPtr--;
|
||||
return;
|
||||
return ReturnTrue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -532,7 +535,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
|
||||
case TokAppendUnique:
|
||||
case TokRemove:
|
||||
case TokReplace:
|
||||
visitProVariable(tok, curr, tokPtr);
|
||||
ret = visitProVariable(tok, curr, tokPtr);
|
||||
if (ret == ReturnError)
|
||||
break;
|
||||
curr.clear();
|
||||
continue;
|
||||
case TokBranch:
|
||||
@ -692,9 +697,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
|
||||
continue;
|
||||
default: {
|
||||
const ushort *oTokPtr = --tokPtr;
|
||||
evaluateExpression(tokPtr, &curr, false);
|
||||
if (tokPtr != oTokPtr)
|
||||
continue;
|
||||
ret = evaluateExpression(tokPtr, &curr, false);
|
||||
if (ret == ReturnError || tokPtr != oTokPtr)
|
||||
break;
|
||||
}
|
||||
Q_ASSERT_X(false, "visitProBlock", "unexpected item type");
|
||||
continue;
|
||||
@ -727,7 +732,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
|
||||
int index = 0;
|
||||
ProKey variable;
|
||||
ProStringList oldVarVal;
|
||||
ProString it_list = expandVariableReferences(exprPtr, 0, true).at(0);
|
||||
ProStringList it_list_out;
|
||||
if (expandVariableReferences(exprPtr, 0, &it_list_out, true) == ReturnError)
|
||||
return ReturnError;
|
||||
ProString it_list = it_list_out.at(0);
|
||||
if (_variable.isEmpty()) {
|
||||
if (it_list != statics.strever) {
|
||||
evalError(fL1S("Invalid loop expression."));
|
||||
@ -826,7 +834,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
|
||||
return ret;
|
||||
}
|
||||
|
||||
void QMakeEvaluator::visitProVariable(
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
|
||||
ushort tok, const ProStringList &curr, const ushort *&tokPtr)
|
||||
{
|
||||
int sizeHint = *tokPtr++;
|
||||
@ -835,24 +843,26 @@ void QMakeEvaluator::visitProVariable(
|
||||
skipExpression(tokPtr);
|
||||
if (!m_cumulative || !curr.isEmpty())
|
||||
evalError(fL1S("Left hand side of assignment must expand to exactly one word."));
|
||||
return;
|
||||
return ReturnTrue;
|
||||
}
|
||||
const ProKey &varName = map(curr.first());
|
||||
|
||||
if (tok == TokReplace) { // ~=
|
||||
// DEFINES ~= s/a/b/?[gqi]
|
||||
|
||||
const ProStringList &varVal = expandVariableReferences(tokPtr, sizeHint, true);
|
||||
ProStringList varVal;
|
||||
if (expandVariableReferences(tokPtr, sizeHint, &varVal, true) == ReturnError)
|
||||
return ReturnError;
|
||||
const QString &val = varVal.at(0).toQString(m_tmp1);
|
||||
if (val.length() < 4 || val.at(0) != QLatin1Char('s')) {
|
||||
evalError(fL1S("The ~= operator can handle only the s/// function."));
|
||||
return;
|
||||
return ReturnTrue;
|
||||
}
|
||||
QChar sep = val.at(1);
|
||||
QStringList func = val.split(sep);
|
||||
if (func.count() < 3 || func.count() > 4) {
|
||||
evalError(fL1S("The s/// function expects 3 or 4 arguments."));
|
||||
return;
|
||||
return ReturnTrue;
|
||||
}
|
||||
|
||||
bool global = false, quote = false, case_sense = false;
|
||||
@ -873,7 +883,9 @@ void QMakeEvaluator::visitProVariable(
|
||||
replaceInList(&valuesRef(varName), regexp, replace, global, m_tmp2);
|
||||
debugMsg(2, "replaced %s with %s", dbgQStr(pattern), dbgQStr(replace));
|
||||
} else {
|
||||
ProStringList varVal = expandVariableReferences(tokPtr, sizeHint);
|
||||
ProStringList varVal;
|
||||
if (expandVariableReferences(tokPtr, sizeHint, &varVal, false) == ReturnError)
|
||||
return ReturnError;
|
||||
switch (tok) {
|
||||
default: // whatever - cannot happen
|
||||
case TokAssign: // =
|
||||
@ -919,8 +931,10 @@ void QMakeEvaluator::visitProVariable(
|
||||
}
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
else if (varName == statics.strREQUIRES)
|
||||
checkRequirements(values(varName));
|
||||
return checkRequirements(values(varName));
|
||||
#endif
|
||||
|
||||
return ReturnTrue;
|
||||
}
|
||||
|
||||
void QMakeEvaluator::setTemplate()
|
||||
@ -1612,18 +1626,18 @@ bool QMakeEvaluator::isActiveConfig(const QStringRef &config, bool regex)
|
||||
return false;
|
||||
}
|
||||
|
||||
ProStringList QMakeEvaluator::expandVariableReferences(
|
||||
const ushort *&tokPtr, int sizeHint, bool joined)
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::expandVariableReferences(
|
||||
const ushort *&tokPtr, int sizeHint, ProStringList *ret, bool joined)
|
||||
{
|
||||
ProStringList ret;
|
||||
ret.reserve(sizeHint);
|
||||
ret->reserve(sizeHint);
|
||||
forever {
|
||||
evaluateExpression(tokPtr, &ret, joined);
|
||||
if (evaluateExpression(tokPtr, ret, joined) == ReturnError)
|
||||
return ReturnError;
|
||||
switch (*tokPtr) {
|
||||
case TokValueTerminator:
|
||||
case TokFuncTerminator:
|
||||
tokPtr++;
|
||||
return ret;
|
||||
return ReturnTrue;
|
||||
case TokArgSeparator:
|
||||
if (joined) {
|
||||
tokPtr++;
|
||||
@ -1637,28 +1651,28 @@ ProStringList QMakeEvaluator::expandVariableReferences(
|
||||
}
|
||||
}
|
||||
|
||||
QList<ProStringList> QMakeEvaluator::prepareFunctionArgs(const ushort *&tokPtr)
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::prepareFunctionArgs(
|
||||
const ushort *&tokPtr, QList<ProStringList> *ret)
|
||||
{
|
||||
QList<ProStringList> args_list;
|
||||
if (*tokPtr != TokFuncTerminator) {
|
||||
for (;; tokPtr++) {
|
||||
ProStringList arg;
|
||||
evaluateExpression(tokPtr, &arg, false);
|
||||
args_list << arg;
|
||||
if (evaluateExpression(tokPtr, &arg, false) == ReturnError)
|
||||
return ReturnError;
|
||||
*ret << arg;
|
||||
if (*tokPtr == TokFuncTerminator)
|
||||
break;
|
||||
Q_ASSERT(*tokPtr == TokArgSeparator);
|
||||
}
|
||||
}
|
||||
tokPtr++;
|
||||
return args_list;
|
||||
return ReturnTrue;
|
||||
}
|
||||
|
||||
ProStringList QMakeEvaluator::evaluateFunction(
|
||||
const ProFunctionDef &func, const QList<ProStringList> &argumentsList, VisitReturn *ok)
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFunction(
|
||||
const ProFunctionDef &func, const QList<ProStringList> &argumentsList, ProStringList *ret)
|
||||
{
|
||||
VisitReturn vr;
|
||||
ProStringList ret;
|
||||
|
||||
if (m_valuemapStack.count() >= 100) {
|
||||
evalError(fL1S("Ran into infinite recursion (depth > 100)."));
|
||||
@ -1677,25 +1691,22 @@ ProStringList QMakeEvaluator::evaluateFunction(
|
||||
vr = visitProBlock(func.pro(), func.tokPtr());
|
||||
if (vr == ReturnReturn)
|
||||
vr = ReturnTrue;
|
||||
ret = m_returnValue;
|
||||
if (vr == ReturnTrue)
|
||||
*ret = m_returnValue;
|
||||
m_returnValue.clear();
|
||||
|
||||
m_current = m_locationStack.pop();
|
||||
m_valuemapStack.pop();
|
||||
}
|
||||
if (ok)
|
||||
*ok = vr;
|
||||
if (vr == ReturnTrue)
|
||||
return ret;
|
||||
return ProStringList();
|
||||
return vr;
|
||||
}
|
||||
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBoolFunction(
|
||||
const ProFunctionDef &func, const QList<ProStringList> &argumentsList,
|
||||
const ProString &function)
|
||||
{
|
||||
VisitReturn vr;
|
||||
ProStringList ret = evaluateFunction(func, argumentsList, &vr);
|
||||
ProStringList ret;
|
||||
VisitReturn vr = evaluateFunction(func, argumentsList, &ret);
|
||||
if (vr == ReturnTrue) {
|
||||
if (ret.isEmpty())
|
||||
return ReturnTrue;
|
||||
@ -1723,13 +1734,18 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
{
|
||||
if (int func_t = statics.functions.value(func)) {
|
||||
//why don't the builtin functions just use args_list? --Sam
|
||||
return evaluateBuiltinConditional(func_t, func, expandVariableReferences(tokPtr, 5, true));
|
||||
ProStringList args;
|
||||
if (expandVariableReferences(tokPtr, 5, &args, true) == ReturnError)
|
||||
return ReturnError;
|
||||
return evaluateBuiltinConditional(func_t, func, args);
|
||||
}
|
||||
|
||||
QHash<ProKey, ProFunctionDef>::ConstIterator it =
|
||||
m_functionDefs.testFunctions.constFind(func);
|
||||
if (it != m_functionDefs.testFunctions.constEnd()) {
|
||||
const QList<ProStringList> args = prepareFunctionArgs(tokPtr);
|
||||
QList<ProStringList> args;
|
||||
if (prepareFunctionArgs(tokPtr, &args) == ReturnError)
|
||||
return ReturnError;
|
||||
traceMsg("calling %s(%s)", dbgKey(func), dbgStrListList(args));
|
||||
return evaluateBoolFunction(*it, args, func);
|
||||
}
|
||||
@ -1739,34 +1755,41 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
return ReturnFalse;
|
||||
}
|
||||
|
||||
ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
const ProKey &func, const ushort *&tokPtr)
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateExpandFunction(
|
||||
const ProKey &func, const ushort *&tokPtr, ProStringList *ret)
|
||||
{
|
||||
if (int func_t = statics.expands.value(func)) {
|
||||
//why don't the builtin functions just use args_list? --Sam
|
||||
return evaluateBuiltinExpand(func_t, func, expandVariableReferences(tokPtr, 5, true));
|
||||
ProStringList args;
|
||||
if (expandVariableReferences(tokPtr, 5, &args, true) == ReturnError)
|
||||
return ReturnError;
|
||||
*ret = evaluateBuiltinExpand(func_t, func, args);
|
||||
return ReturnTrue;
|
||||
}
|
||||
|
||||
QHash<ProKey, ProFunctionDef>::ConstIterator it =
|
||||
m_functionDefs.replaceFunctions.constFind(func);
|
||||
if (it != m_functionDefs.replaceFunctions.constEnd()) {
|
||||
const QList<ProStringList> args = prepareFunctionArgs(tokPtr);
|
||||
QList<ProStringList> args;
|
||||
if (prepareFunctionArgs(tokPtr, &args) == ReturnError)
|
||||
return ReturnError;
|
||||
traceMsg("calling $$%s(%s)", dbgKey(func), dbgStrListList(args));
|
||||
return evaluateFunction(*it, args, 0);
|
||||
return evaluateFunction(*it, args, ret);
|
||||
}
|
||||
|
||||
skipExpression(tokPtr);
|
||||
evalError(fL1S("'%1' is not a recognized replace function.").arg(func.toQString(m_tmp1)));
|
||||
return ProStringList();
|
||||
return ReturnFalse;
|
||||
}
|
||||
|
||||
bool QMakeEvaluator::evaluateConditional(const QStringRef &cond, const QString &where, int line)
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditional(
|
||||
const QStringRef &cond, const QString &where, int line)
|
||||
{
|
||||
bool ret = false;
|
||||
VisitReturn ret = ReturnFalse;
|
||||
ProFile *pro = m_parser->parsedProBlock(cond, where, line, QMakeParser::TestGrammar);
|
||||
if (pro->isOk()) {
|
||||
m_locationStack.push(m_current);
|
||||
ret = visitProBlock(pro, pro->tokPtr()) == ReturnTrue;
|
||||
ret = visitProBlock(pro, pro->tokPtr());
|
||||
m_current = m_locationStack.pop();
|
||||
}
|
||||
pro->deref();
|
||||
@ -1774,28 +1797,49 @@ bool QMakeEvaluator::evaluateConditional(const QStringRef &cond, const QString &
|
||||
}
|
||||
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
void QMakeEvaluator::checkRequirements(const ProStringList &deps)
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::checkRequirements(const ProStringList &deps)
|
||||
{
|
||||
ProStringList &failed = valuesRef(ProKey("QMAKE_FAILED_REQUIREMENTS"));
|
||||
for (const ProString &dep : deps)
|
||||
if (!evaluateConditional(dep.toQStringRef(), m_current.pro->fileName(), m_current.line))
|
||||
for (const ProString &dep : deps) {
|
||||
VisitReturn vr = evaluateConditional(dep.toQStringRef(), m_current.pro->fileName(), m_current.line);
|
||||
if (vr == ReturnError)
|
||||
return ReturnError;
|
||||
if (vr != ReturnTrue)
|
||||
failed << dep;
|
||||
}
|
||||
return ReturnTrue;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool isFunctParam(const ProKey &variableName)
|
||||
{
|
||||
const int len = variableName.size();
|
||||
const QChar *data = variableName.constData();
|
||||
for (int i = 0; i < len; i++) {
|
||||
ushort c = data[i].unicode();
|
||||
if (c < '0' || c > '9')
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ProValueMap *QMakeEvaluator::findValues(const ProKey &variableName, ProValueMap::Iterator *rit)
|
||||
{
|
||||
ProValueMapStack::Iterator vmi = m_valuemapStack.end();
|
||||
do {
|
||||
for (bool first = true; ; first = false) {
|
||||
--vmi;
|
||||
ProValueMap::Iterator it = (*vmi).find(variableName);
|
||||
if (it != (*vmi).end()) {
|
||||
if (it->constBegin() == statics.fakeValue.constBegin())
|
||||
return 0;
|
||||
break;
|
||||
*rit = it;
|
||||
return &(*vmi);
|
||||
}
|
||||
} while (vmi != m_valuemapStack.begin());
|
||||
if (vmi == m_valuemapStack.begin())
|
||||
break;
|
||||
if (first && isFunctParam(variableName))
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1807,18 +1851,20 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName)
|
||||
it->clear();
|
||||
return *it;
|
||||
}
|
||||
ProValueMapStack::Iterator vmi = m_valuemapStack.end();
|
||||
if (--vmi != m_valuemapStack.begin()) {
|
||||
do {
|
||||
--vmi;
|
||||
ProValueMap::ConstIterator it = (*vmi).constFind(variableName);
|
||||
if (it != (*vmi).constEnd()) {
|
||||
ProStringList &ret = m_valuemapStack.top()[variableName];
|
||||
if (it->constBegin() != statics.fakeValue.constBegin())
|
||||
ret = *it;
|
||||
return ret;
|
||||
}
|
||||
} while (vmi != m_valuemapStack.begin());
|
||||
if (!isFunctParam(variableName)) {
|
||||
ProValueMapStack::Iterator vmi = m_valuemapStack.end();
|
||||
if (--vmi != m_valuemapStack.begin()) {
|
||||
do {
|
||||
--vmi;
|
||||
ProValueMap::ConstIterator it = (*vmi).constFind(variableName);
|
||||
if (it != (*vmi).constEnd()) {
|
||||
ProStringList &ret = m_valuemapStack.top()[variableName];
|
||||
if (it->constBegin() != statics.fakeValue.constBegin())
|
||||
ret = *it;
|
||||
return ret;
|
||||
}
|
||||
} while (vmi != m_valuemapStack.begin());
|
||||
}
|
||||
}
|
||||
return m_valuemapStack.top()[variableName];
|
||||
}
|
||||
@ -1826,7 +1872,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName)
|
||||
ProStringList QMakeEvaluator::values(const ProKey &variableName) const
|
||||
{
|
||||
ProValueMapStack::ConstIterator vmi = m_valuemapStack.constEnd();
|
||||
do {
|
||||
for (bool first = true; ; first = false) {
|
||||
--vmi;
|
||||
ProValueMap::ConstIterator it = (*vmi).constFind(variableName);
|
||||
if (it != (*vmi).constEnd()) {
|
||||
@ -1834,7 +1880,11 @@ ProStringList QMakeEvaluator::values(const ProKey &variableName) const
|
||||
break;
|
||||
return *it;
|
||||
}
|
||||
} while (vmi != m_valuemapStack.constBegin());
|
||||
if (vmi == m_valuemapStack.constBegin())
|
||||
break;
|
||||
if (first && isFunctParam(variableName))
|
||||
break;
|
||||
}
|
||||
return ProStringList();
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ public:
|
||||
{ return b ? ReturnTrue : ReturnFalse; }
|
||||
|
||||
static ALWAYS_INLINE uint getBlockLen(const ushort *&tokPtr);
|
||||
void evaluateExpression(const ushort *&tokPtr, ProStringList *ret, bool joined);
|
||||
VisitReturn evaluateExpression(const ushort *&tokPtr, ProStringList *ret, bool joined);
|
||||
static ALWAYS_INLINE void skipStr(const ushort *&tokPtr);
|
||||
static ALWAYS_INLINE void skipHashStr(const ushort *&tokPtr);
|
||||
void skipExpression(const ushort *&tokPtr);
|
||||
@ -168,7 +168,7 @@ public:
|
||||
VisitReturn visitProLoop(const ProKey &variable, const ushort *exprPtr,
|
||||
const ushort *tokPtr);
|
||||
void visitProFunctionDef(ushort tok, const ProKey &name, const ushort *tokPtr);
|
||||
void visitProVariable(ushort tok, const ProStringList &curr, const ushort *&tokPtr);
|
||||
VisitReturn visitProVariable(ushort tok, const ProStringList &curr, const ushort *&tokPtr);
|
||||
|
||||
ALWAYS_INLINE const ProKey &map(const ProString &var) { return map(var.toKey()); }
|
||||
const ProKey &map(const ProKey &var);
|
||||
@ -177,8 +177,7 @@ public:
|
||||
void setTemplate();
|
||||
|
||||
ProStringList split_value_list(const QStringRef &vals, const ProFile *source = 0);
|
||||
ProStringList expandVariableReferences(const ProString &value, int *pos = 0, bool joined = false);
|
||||
ProStringList expandVariableReferences(const ushort *&tokPtr, int sizeHint = 0, bool joined = false);
|
||||
VisitReturn expandVariableReferences(const ushort *&tokPtr, int sizeHint, ProStringList *ret, bool joined);
|
||||
|
||||
QString currentFileName() const;
|
||||
QString currentDirectory() const;
|
||||
@ -203,22 +202,22 @@ public:
|
||||
void deprecationWarning(const QString &msg) const
|
||||
{ message(QMakeHandler::EvalWarnDeprecated, msg); }
|
||||
|
||||
QList<ProStringList> prepareFunctionArgs(const ushort *&tokPtr);
|
||||
ProStringList evaluateFunction(const ProFunctionDef &func,
|
||||
const QList<ProStringList> &argumentsList, VisitReturn *ok);
|
||||
VisitReturn prepareFunctionArgs(const ushort *&tokPtr, QList<ProStringList> *ret);
|
||||
VisitReturn evaluateFunction(const ProFunctionDef &func,
|
||||
const QList<ProStringList> &argumentsList, ProStringList *ret);
|
||||
VisitReturn evaluateBoolFunction(const ProFunctionDef &func,
|
||||
const QList<ProStringList> &argumentsList,
|
||||
const ProString &function);
|
||||
|
||||
ProStringList evaluateExpandFunction(const ProKey &function, const ushort *&tokPtr);
|
||||
VisitReturn evaluateExpandFunction(const ProKey &function, const ushort *&tokPtr, ProStringList *ret);
|
||||
VisitReturn evaluateConditionalFunction(const ProKey &function, const ushort *&tokPtr);
|
||||
|
||||
ProStringList evaluateBuiltinExpand(int func_t, const ProKey &function, const ProStringList &args);
|
||||
VisitReturn evaluateBuiltinConditional(int func_t, const ProKey &function, const ProStringList &args);
|
||||
|
||||
bool evaluateConditional(const QStringRef &cond, const QString &where, int line = -1);
|
||||
VisitReturn evaluateConditional(const QStringRef &cond, const QString &where, int line = -1);
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
void checkRequirements(const ProStringList &deps);
|
||||
VisitReturn checkRequirements(const ProStringList &deps);
|
||||
#endif
|
||||
|
||||
void updateMkspecPaths();
|
||||
|
@ -299,27 +299,30 @@ void QMakeParser::read(ProFile *pro, const QStringRef &in, int line, SubGrammar
|
||||
// Worst-case size calculations:
|
||||
// - line marker adds 1 (2-nl) to 1st token of each line
|
||||
// - empty assignment "A=":2 =>
|
||||
// TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokAssign(1) + 0(1) +
|
||||
// TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokAssign(1) + size_hint(1) +
|
||||
// TokValueTerminator(1) == 8 (9)
|
||||
// - non-empty assignment "A=B C":5 =>
|
||||
// TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokAssign(1) + 2(1) +
|
||||
// TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokAssign(1) + size_hint(1) +
|
||||
// TokLiteral(1) + len(1) + "B"(1) +
|
||||
// TokLiteral(1) + len(1) + "C"(1) + TokValueTerminator(1) == 14 (15)
|
||||
// - variable expansion: "$$f":3 =>
|
||||
// TokVariable(1) + hash(2) + len(1) + "f"(1) = 5
|
||||
// - function expansion: "$$f()":5 =>
|
||||
// TokFuncName(1) + hash(2) + len(1) + "f"(1) + TokFuncTerminator(1) = 6
|
||||
// - test literal: "X":1 =>
|
||||
// TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokCondition(1) = 6 (7)
|
||||
// - scope: "X:":2 =>
|
||||
// TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokCondition(1) +
|
||||
// TokBranch(1) + len(2) + ... + len(2) + ... == 10
|
||||
// - test: "X():":4 =>
|
||||
// TokBranch(1) + len(2) + ... + len(2) + ... == 11 (12)
|
||||
// - test call: "X():":4 =>
|
||||
// TokHashLiteral(1) + hash(2) + len(1) + "A"(1) + TokTestCall(1) + TokFuncTerminator(1) +
|
||||
// TokBranch(1) + len(2) + ... + len(2) + ... == 11
|
||||
// TokBranch(1) + len(2) + ... + len(2) + ... == 12 (13)
|
||||
// - "for(A,B):":9 =>
|
||||
// TokForLoop(1) + hash(2) + len(1) + "A"(1) +
|
||||
// len(2) + TokLiteral(1) + len(1) + "B"(1) + TokValueTerminator(1) +
|
||||
// len(2) + ... + TokTerminator(1) == 14 (15)
|
||||
tokBuff.reserve((in.size() + 1) * 5);
|
||||
// One extra for possibly missing trailing newline.
|
||||
tokBuff.reserve((in.size() + 1) * 7);
|
||||
ushort *tokPtr = (ushort *)tokBuff.constData(); // Current writing position
|
||||
|
||||
// Expression precompiler buffer.
|
||||
|
@ -105,9 +105,8 @@ QStringList QMakeProject::expand(const ProKey &func, const QList<ProStringList>
|
||||
QHash<ProKey, ProFunctionDef>::ConstIterator it =
|
||||
m_functionDefs.replaceFunctions.constFind(func);
|
||||
if (it != m_functionDefs.replaceFunctions.constEnd()) {
|
||||
QMakeProject::VisitReturn vr;
|
||||
ProStringList ret = evaluateFunction(*it, args, &vr);
|
||||
if (vr == QMakeProject::ReturnError)
|
||||
ProStringList ret;
|
||||
if (evaluateFunction(*it, args, &ret) == QMakeProject::ReturnError)
|
||||
exit(3);
|
||||
return ret.toQStringList();
|
||||
}
|
||||
@ -126,7 +125,9 @@ ProString QMakeProject::expand(const QString &expr, const QString &where, int li
|
||||
m_current.pro = pro;
|
||||
m_current.line = 0;
|
||||
const ushort *tokPtr = pro->tokPtr();
|
||||
ProStringList result = expandVariableReferences(tokPtr, 1, true);
|
||||
ProStringList result;
|
||||
if (expandVariableReferences(tokPtr, 1, &result, true) == ReturnError)
|
||||
exit(3);
|
||||
if (!result.isEmpty())
|
||||
ret = result.at(0);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
ProString expand(const QString &v, const QString &file, int line);
|
||||
QStringList expand(const ProKey &func, const QList<ProStringList> &args);
|
||||
bool test(const QString &v, const QString &file, int line)
|
||||
{ m_current.clear(); return evaluateConditional(QStringRef(&v), file, line); }
|
||||
{ m_current.clear(); return evaluateConditional(QStringRef(&v), file, line) == ReturnTrue; }
|
||||
bool test(const ProKey &func, const QList<ProStringList> &args);
|
||||
|
||||
bool isSet(const ProKey &v) const { return m_valuemapStack.first().contains(v); }
|
||||
|
@ -1,6 +1,6 @@
|
||||
This is the ANGLE project from:
|
||||
|
||||
http://code.google.com/p/angleproject/
|
||||
https://chromium.googlesource.com/angle/angle/+/master/README.md
|
||||
|
||||
The upstream version used here can be found in:
|
||||
|
||||
|
@ -21,7 +21,7 @@ lib_replace.CONFIG = path
|
||||
QMAKE_PRL_INSTALL_REPLACE += lib_replace
|
||||
|
||||
# DirectX is included in the Windows 8 Kit, but everything else requires the DX SDK.
|
||||
winrt|if(msvc:!win32-msvc2005:!win32-msvc2008:!win32-msvc2010) {
|
||||
winrt|msvc {
|
||||
FXC = fxc.exe
|
||||
} else {
|
||||
DX_DIR = $$(DXSDK_DIR)
|
||||
|
@ -46,21 +46,6 @@ if (NOT TARGET Qt5::rcc)
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET Qt5::qdoc)
|
||||
add_executable(Qt5::qdoc IMPORTED)
|
||||
|
||||
!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
|
||||
set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qdoc$$CMAKE_BIN_SUFFIX\")
|
||||
!!ELSE
|
||||
set(imported_location \"$${CMAKE_BIN_DIR}qdoc$$CMAKE_BIN_SUFFIX\")
|
||||
!!ENDIF
|
||||
_qt5_Core_check_file_exists(${imported_location})
|
||||
|
||||
set_target_properties(Qt5::qdoc PROPERTIES
|
||||
IMPORTED_LOCATION ${imported_location}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(Qt5Core_QMAKE_EXECUTABLE Qt5::qmake)
|
||||
set(Qt5Core_MOC_EXECUTABLE Qt5::moc)
|
||||
set(Qt5Core_RCC_EXECUTABLE Qt5::rcc)
|
||||
|
@ -53,44 +53,168 @@ QT_END_NAMESPACE
|
||||
#pragma qt_sync_stop_processing
|
||||
#endif
|
||||
|
||||
#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
|
||||
#define Q_ATOMIC_INT_TEST_AND_SET_IS_SOMETIMES_NATIVE
|
||||
#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
|
||||
#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
|
||||
/* Attempt to detect whether the atomic operations exist in hardware
|
||||
* or whether they are emulated by way of a lock.
|
||||
*
|
||||
* C++11 29.4 [atomics.lockfree] p1 says
|
||||
*
|
||||
* The ATOMIC_..._LOCK_FREE macros indicate the lock-free property of the
|
||||
* corresponding atomic types, with the signed and unsigned variants grouped
|
||||
* together. The properties also apply to the corresponding (partial)
|
||||
* specializations of the atomic template. A value of 0 indicates that the
|
||||
* types are never lock-free. A value of 1 indicates that the types are
|
||||
* sometimes lock-free. A value of 2 indicates that the types are always
|
||||
* lock-free.
|
||||
*
|
||||
* We have a problem when the value is 1: we'd need to check at runtime, but
|
||||
* QAtomicInteger requires a constexpr answer (defect introduced in Qt 5.0). So
|
||||
* we'll err in the side of caution and say it isn't.
|
||||
*/
|
||||
|
||||
// ### Qt 6: make non-constexpr (see above)
|
||||
template <int N> struct QAtomicTraits
|
||||
{ static Q_DECL_CONSTEXPR inline bool isLockFree() Q_DECL_NOTHROW; };
|
||||
|
||||
#define Q_ATOMIC_INT32_IS_SUPPORTED
|
||||
#define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
|
||||
#define Q_ATOMIC_INT32_TEST_AND_SET_IS_SOMETIMES_NATIVE
|
||||
#define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
|
||||
#define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
|
||||
#if ATOMIC_INT_LOCK_FREE == 2
|
||||
# define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT32_TEST_AND_SET_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_ALWAYS_NATIVE
|
||||
|
||||
#define Q_ATOMIC_POINTER_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
|
||||
#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_SOMETIMES_NATIVE
|
||||
#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
|
||||
#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
|
||||
template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<4>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return true; }
|
||||
#elif ATOMIC_INT_LOCK_FREE == 1
|
||||
# define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT_TEST_AND_SET_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT32_TEST_AND_SET_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
|
||||
|
||||
template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<4>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return false; }
|
||||
#else
|
||||
# define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT_TEST_AND_SET_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT32_TEST_AND_SET_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_NEVER_NATIVE
|
||||
|
||||
template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<4>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return false; }
|
||||
#endif
|
||||
|
||||
#if ATOMIC_POINTER_LOCK_FREE == 2
|
||||
# define Q_ATOMIC_POINTER_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE
|
||||
#elif ATOMIC_POINTER_LOCK_FREE == 1
|
||||
# define Q_ATOMIC_POINTER_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_POINTER_TEST_AND_SET_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
|
||||
#else
|
||||
# define Q_ATOMIC_POINTER_REFERENCE_COUNTING_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NEVER_NATIVE
|
||||
#endif
|
||||
|
||||
template<> struct QAtomicOpsSupport<1> { enum { IsSupported = 1 }; };
|
||||
template<> struct QAtomicOpsSupport<2> { enum { IsSupported = 1 }; };
|
||||
template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; };
|
||||
|
||||
#define Q_ATOMIC_INT8_IS_SUPPORTED
|
||||
#define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
|
||||
#define Q_ATOMIC_INT8_TEST_AND_SET_IS_ALWAYS_NATIVE
|
||||
#define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_ALWAYS_NATIVE
|
||||
#define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_ALWAYS_NATIVE
|
||||
#if ATOMIC_CHAR_LOCK_FREE == 2
|
||||
# define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT8_TEST_AND_SET_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_ALWAYS_NATIVE
|
||||
|
||||
template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<1>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return true; }
|
||||
#elif ATOMIC_CHAR_LOCK_FREE == 1
|
||||
# define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT8_TEST_AND_SET_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
|
||||
|
||||
template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<1>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return false; }
|
||||
#else
|
||||
# define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT8_TEST_AND_SET_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_NEVER_NATIVE
|
||||
|
||||
template <> Q_DECL_CONSTEXPR bool QAtomicTraits<1>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return false; }
|
||||
#endif
|
||||
|
||||
template<> struct QAtomicOpsSupport<2> { enum { IsSupported = 1 }; };
|
||||
#define Q_ATOMIC_INT16_IS_SUPPORTED
|
||||
#define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
|
||||
#define Q_ATOMIC_INT16_TEST_AND_SET_IS_ALWAYS_NATIVE
|
||||
#define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_ALWAYS_NATIVE
|
||||
#define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_ALWAYS_NATIVE
|
||||
#if ATOMIC_SHORT_LOCK_FREE == 2
|
||||
# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT16_TEST_AND_SET_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_ALWAYS_NATIVE
|
||||
|
||||
template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<2>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return false; }
|
||||
#elif ATOMIC_SHORT_LOCK_FREE == 1
|
||||
# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT16_TEST_AND_SET_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
|
||||
|
||||
template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<2>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return false; }
|
||||
#else
|
||||
# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT16_TEST_AND_SET_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_NEVER_NATIVE
|
||||
|
||||
template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<2>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return false; }
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_STD_ATOMIC64
|
||||
template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; };
|
||||
# define Q_ATOMIC_INT64_IS_SUPPORTED
|
||||
# define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT64_TEST_AND_SET_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_ALWAYS_NATIVE
|
||||
# if ATOMIC_LLONG_LOCK_FREE == 2
|
||||
# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT16_TEST_AND_SET_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_ALWAYS_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_ALWAYS_NATIVE
|
||||
|
||||
template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<8>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return true; }
|
||||
# elif ATOMIC_LLONG_LOCK_FREE == 1
|
||||
# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT16_TEST_AND_SET_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
|
||||
|
||||
template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<8>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return false; }
|
||||
# else
|
||||
# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT16_TEST_AND_SET_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_NEVER_NATIVE
|
||||
# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_NEVER_NATIVE
|
||||
|
||||
template <> Q_DECL_CONSTEXPR inline bool QAtomicTraits<8>::isLockFree() Q_DECL_NOTHROW
|
||||
{ return false; }
|
||||
# endif
|
||||
#endif
|
||||
|
||||
template <typename X> struct QAtomicOps
|
||||
@ -133,7 +257,7 @@ template <typename X> struct QAtomicOps
|
||||
_q_value.store(newValue, std::memory_order_release);
|
||||
}
|
||||
|
||||
static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return true; }
|
||||
static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return isTestAndSetNative(); }
|
||||
static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return false; }
|
||||
template <typename T>
|
||||
static inline bool ref(std::atomic<T> &_q_value)
|
||||
@ -147,7 +271,8 @@ template <typename X> struct QAtomicOps
|
||||
return --_q_value != 0;
|
||||
}
|
||||
|
||||
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return false; }
|
||||
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW
|
||||
{ return QAtomicTraits<sizeof(X)>::isLockFree(); }
|
||||
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return false; }
|
||||
|
||||
template <typename T>
|
||||
@ -186,7 +311,7 @@ template <typename X> struct QAtomicOps
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return false; }
|
||||
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return isTestAndSetNative(); }
|
||||
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return false; }
|
||||
|
||||
template <typename T>
|
||||
@ -213,7 +338,7 @@ template <typename X> struct QAtomicOps
|
||||
return _q_value.exchange(newValue, std::memory_order_acq_rel);
|
||||
}
|
||||
|
||||
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return false; }
|
||||
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return isTestAndSetNative(); }
|
||||
static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return false; }
|
||||
|
||||
template <typename T> static inline
|
||||
|
@ -603,13 +603,13 @@ template<> class QTypeInfo<A> : public QTypeInfoMerger<A, B, C, D> {};
|
||||
void overloadedFunction();
|
||||
void overloadedFunction(int, QString);
|
||||
};
|
||||
... qOverload<>(&Foo:overloadedFunction)
|
||||
... qOverload<int, QString>(&Foo:overloadedFunction)
|
||||
... qOverload<>(&Foo::overloadedFunction)
|
||||
... qOverload<int, QString>(&Foo::overloadedFunction)
|
||||
//! [52]
|
||||
|
||||
//! [53]
|
||||
... QOverload<>::of(&Foo:overloadedFunction)
|
||||
... QOverload<int, QString>::of(&Foo:overloadedFunction)
|
||||
... QOverload<>::of(&Foo::overloadedFunction)
|
||||
... QOverload<int, QString>::of(&Foo::overloadedFunction)
|
||||
//! [53]
|
||||
|
||||
//! [54]
|
||||
@ -617,8 +617,8 @@ template<> class QTypeInfo<A> : public QTypeInfoMerger<A, B, C, D> {};
|
||||
void overloadedFunction(int, QString);
|
||||
void overloadedFunction(int, QString) const;
|
||||
};
|
||||
... qConstOverload<>(&Foo:overloadedFunction)
|
||||
... qNonConstOverload<int, QString>(&Foo:overloadedFunction)
|
||||
... qConstOverload<>(&Foo::overloadedFunction)
|
||||
... qNonConstOverload<int, QString>(&Foo::overloadedFunction)
|
||||
//! [54]
|
||||
|
||||
//! [qlikely]
|
||||
|
@ -147,10 +147,7 @@ QVariant data = QVariant::fromValue(object);
|
||||
|
||||
//! [9]
|
||||
|
||||
QList<int> intList;
|
||||
intList.push_back(7);
|
||||
intList.push_back(11);
|
||||
intList.push_back(42);
|
||||
QList<int> intList = {7, 11, 42};
|
||||
|
||||
QVariant variant = QVariant::fromValue(intList);
|
||||
if (variant.canConvert<QVariantList>()) {
|
||||
|
@ -1123,7 +1123,7 @@ void QMessagePattern::setPattern(const QString &pattern)
|
||||
if (m.hasMatch()) {
|
||||
int depth = m.capturedRef(1).toInt();
|
||||
if (depth <= 0)
|
||||
error += QStringLiteral("QT_MESSAGE_PATTERN: %{backtrace} depth must be a number greater than 0\n");
|
||||
error += QLatin1String("QT_MESSAGE_PATTERN: %{backtrace} depth must be a number greater than 0\n");
|
||||
else
|
||||
backtraceDepth = depth;
|
||||
}
|
||||
@ -1135,7 +1135,7 @@ void QMessagePattern::setPattern(const QString &pattern)
|
||||
backtraceParams.backtraceSeparator = backtraceSeparator;
|
||||
backtraceArgs.append(backtraceParams);
|
||||
#else
|
||||
error += QStringLiteral("QT_MESSAGE_PATTERN: %{backtrace} is not supported by this Qt build\n");
|
||||
error += QLatin1String("QT_MESSAGE_PATTERN: %{backtrace} is not supported by this Qt build\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1156,7 +1156,7 @@ void QMessagePattern::setPattern(const QString &pattern)
|
||||
else if (lexeme == QLatin1String(endifTokenC)) {
|
||||
tokens[i] = endifTokenC;
|
||||
if (!inIf && !nestedIfError)
|
||||
error += QStringLiteral("QT_MESSAGE_PATTERN: %{endif} without an %{if-*}\n");
|
||||
error += QLatin1String("QT_MESSAGE_PATTERN: %{endif} without an %{if-*}\n");
|
||||
inIf = false;
|
||||
} else {
|
||||
tokens[i] = emptyTokenC;
|
||||
@ -1172,9 +1172,9 @@ void QMessagePattern::setPattern(const QString &pattern)
|
||||
}
|
||||
}
|
||||
if (nestedIfError)
|
||||
error += QStringLiteral("QT_MESSAGE_PATTERN: %{if-*} cannot be nested\n");
|
||||
error += QLatin1String("QT_MESSAGE_PATTERN: %{if-*} cannot be nested\n");
|
||||
else if (inIf)
|
||||
error += QStringLiteral("QT_MESSAGE_PATTERN: missing %{endif}\n");
|
||||
error += QLatin1String("QT_MESSAGE_PATTERN: missing %{endif}\n");
|
||||
if (!error.isEmpty()) {
|
||||
#if defined(Q_OS_WINRT)
|
||||
OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16()));
|
||||
|
@ -195,6 +195,29 @@ private:
|
||||
int readBlock(char *data, int len);
|
||||
};
|
||||
|
||||
namespace QtPrivate {
|
||||
|
||||
class StreamStateSaver
|
||||
{
|
||||
public:
|
||||
inline StreamStateSaver(QDataStream *s) : stream(s), oldStatus(s->status())
|
||||
{
|
||||
stream->resetStatus();
|
||||
}
|
||||
inline ~StreamStateSaver()
|
||||
{
|
||||
if (oldStatus != QDataStream::Ok) {
|
||||
stream->resetStatus();
|
||||
stream->setStatus(oldStatus);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
QDataStream *stream;
|
||||
QDataStream::Status oldStatus;
|
||||
};
|
||||
|
||||
} // QtPrivate namespace
|
||||
|
||||
/*****************************************************************************
|
||||
QDataStream inline functions
|
||||
@ -239,6 +262,8 @@ inline QDataStream &QDataStream::operator<<(quint64 i)
|
||||
template <typename T>
|
||||
QDataStream& operator>>(QDataStream& s, QList<T>& l)
|
||||
{
|
||||
QtPrivate::StreamStateSaver stateSaver(&s);
|
||||
|
||||
l.clear();
|
||||
quint32 c;
|
||||
s >> c;
|
||||
@ -247,10 +272,13 @@ QDataStream& operator>>(QDataStream& s, QList<T>& l)
|
||||
{
|
||||
T t;
|
||||
s >> t;
|
||||
l.append(t);
|
||||
if (s.atEnd())
|
||||
if (s.status() != QDataStream::Ok) {
|
||||
l.clear();
|
||||
break;
|
||||
}
|
||||
l.append(t);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -266,6 +294,8 @@ QDataStream& operator<<(QDataStream& s, const QList<T>& l)
|
||||
template <typename T>
|
||||
QDataStream& operator>>(QDataStream& s, QLinkedList<T>& l)
|
||||
{
|
||||
QtPrivate::StreamStateSaver stateSaver(&s);
|
||||
|
||||
l.clear();
|
||||
quint32 c;
|
||||
s >> c;
|
||||
@ -273,10 +303,13 @@ QDataStream& operator>>(QDataStream& s, QLinkedList<T>& l)
|
||||
{
|
||||
T t;
|
||||
s >> t;
|
||||
l.append(t);
|
||||
if (s.atEnd())
|
||||
if (s.status() != QDataStream::Ok) {
|
||||
l.clear();
|
||||
break;
|
||||
}
|
||||
l.append(t);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -293,6 +326,8 @@ QDataStream& operator<<(QDataStream& s, const QLinkedList<T>& l)
|
||||
template<typename T>
|
||||
QDataStream& operator>>(QDataStream& s, QVector<T>& v)
|
||||
{
|
||||
QtPrivate::StreamStateSaver stateSaver(&s);
|
||||
|
||||
v.clear();
|
||||
quint32 c;
|
||||
s >> c;
|
||||
@ -300,8 +335,13 @@ QDataStream& operator>>(QDataStream& s, QVector<T>& v)
|
||||
for(quint32 i = 0; i < c; ++i) {
|
||||
T t;
|
||||
s >> t;
|
||||
if (s.status() != QDataStream::Ok) {
|
||||
v.clear();
|
||||
break;
|
||||
}
|
||||
v[i] = t;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -317,16 +357,21 @@ QDataStream& operator<<(QDataStream& s, const QVector<T>& v)
|
||||
template <typename T>
|
||||
QDataStream &operator>>(QDataStream &in, QSet<T> &set)
|
||||
{
|
||||
QtPrivate::StreamStateSaver stateSaver(&in);
|
||||
|
||||
set.clear();
|
||||
quint32 c;
|
||||
in >> c;
|
||||
for (quint32 i = 0; i < c; ++i) {
|
||||
T t;
|
||||
in >> t;
|
||||
set << t;
|
||||
if (in.atEnd())
|
||||
if (in.status() != QDataStream::Ok) {
|
||||
set.clear();
|
||||
break;
|
||||
}
|
||||
set << t;
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
@ -345,10 +390,9 @@ QDataStream& operator<<(QDataStream &out, const QSet<T> &set)
|
||||
template <class Key, class T>
|
||||
Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QHash<Key, T> &hash)
|
||||
{
|
||||
QDataStream::Status oldStatus = in.status();
|
||||
in.resetStatus();
|
||||
hash.clear();
|
||||
QtPrivate::StreamStateSaver stateSaver(&in);
|
||||
|
||||
hash.clear();
|
||||
quint32 n;
|
||||
in >> n;
|
||||
|
||||
@ -364,10 +408,6 @@ Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QHash<Key, T> &has
|
||||
|
||||
if (in.status() != QDataStream::Ok)
|
||||
hash.clear();
|
||||
if (oldStatus != QDataStream::Ok) {
|
||||
in.resetStatus();
|
||||
in.setStatus(oldStatus);
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
@ -391,10 +431,9 @@ template <class aKey, class aT>
|
||||
Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap<aKey, aT> &map)
|
||||
#endif
|
||||
{
|
||||
QDataStream::Status oldStatus = in.status();
|
||||
in.resetStatus();
|
||||
map.clear();
|
||||
QtPrivate::StreamStateSaver stateSaver(&in);
|
||||
|
||||
map.clear();
|
||||
quint32 n;
|
||||
in >> n;
|
||||
|
||||
@ -410,10 +449,6 @@ Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap<aKey, aT> &ma
|
||||
}
|
||||
if (in.status() != QDataStream::Ok)
|
||||
map.clear();
|
||||
if (oldStatus != QDataStream::Ok) {
|
||||
in.resetStatus();
|
||||
in.setStatus(oldStatus);
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
|
@ -694,7 +694,7 @@ QString QDir::filePath(const QString &fileName) const
|
||||
{
|
||||
const QDirPrivate* d = d_ptr.constData();
|
||||
if (isAbsolutePath(fileName))
|
||||
return QString(fileName);
|
||||
return fileName;
|
||||
|
||||
QString ret = d->dirEntry.filePath();
|
||||
if (!fileName.isEmpty()) {
|
||||
|
@ -388,7 +388,7 @@ QStringList QFileSelectorPrivate::platformSelectors()
|
||||
# endif
|
||||
QString productName = QSysInfo::productType();
|
||||
# ifdef Q_OS_MACOS
|
||||
if (productName != QStringLiteral("osx"))
|
||||
if (productName != QLatin1String("osx"))
|
||||
ret << QStringLiteral("osx"); // compatibility
|
||||
# endif
|
||||
if (productName != QLatin1String("unknown"))
|
||||
|
@ -71,12 +71,12 @@
|
||||
#elif defined(Q_OS_HAIKU)
|
||||
# include <kernel/OS.h>
|
||||
#elif defined(Q_OS_BSD4) && !defined(QT_PLATFORM_UIKIT)
|
||||
# if !defined(Q_OS_NETBSD)
|
||||
# include <sys/user.h>
|
||||
# endif
|
||||
# include <sys/cdefs.h>
|
||||
# include <sys/param.h>
|
||||
# include <sys/sysctl.h>
|
||||
# if !defined(Q_OS_NETBSD)
|
||||
# include <sys/user.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -248,8 +248,7 @@ QString QSettingsPrivate::actualKey(const QString &key) const
|
||||
{
|
||||
QString n = normalizedKey(key);
|
||||
Q_ASSERT_X(!n.isEmpty(), "QSettings", "empty key");
|
||||
n.prepend(groupPrefix);
|
||||
return n;
|
||||
return groupPrefix + n;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -324,10 +323,9 @@ void QSettingsPrivate::processChild(QStringRef key, ChildSpec spec, QStringList
|
||||
void QSettingsPrivate::beginGroupOrArray(const QSettingsGroup &group)
|
||||
{
|
||||
groupStack.push(group);
|
||||
if (!group.name().isEmpty()) {
|
||||
groupPrefix += group.name();
|
||||
groupPrefix += QLatin1Char('/');
|
||||
}
|
||||
const QString name = group.name();
|
||||
if (!name.isEmpty())
|
||||
groupPrefix += name + QLatin1Char('/');
|
||||
}
|
||||
|
||||
/*
|
||||
@ -403,9 +401,9 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
|
||||
|
||||
case QVariant::ByteArray: {
|
||||
QByteArray a = v.toByteArray();
|
||||
result = QLatin1String("@ByteArray(");
|
||||
result += QString::fromLatin1(a.constData(), a.size());
|
||||
result += QLatin1Char(')');
|
||||
result = QLatin1String("@ByteArray(")
|
||||
+ QLatin1String(a.constData(), a.size())
|
||||
+ QLatin1Char(')');
|
||||
break;
|
||||
}
|
||||
|
||||
@ -425,33 +423,17 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
|
||||
#ifndef QT_NO_GEOM_VARIANT
|
||||
case QVariant::Rect: {
|
||||
QRect r = qvariant_cast<QRect>(v);
|
||||
result += QLatin1String("@Rect(");
|
||||
result += QString::number(r.x());
|
||||
result += QLatin1Char(' ');
|
||||
result += QString::number(r.y());
|
||||
result += QLatin1Char(' ');
|
||||
result += QString::number(r.width());
|
||||
result += QLatin1Char(' ');
|
||||
result += QString::number(r.height());
|
||||
result += QLatin1Char(')');
|
||||
result = QString::asprintf("@Rect(%d %d %d %d)", r.x(), r.y(), r.width(), r.height());
|
||||
break;
|
||||
}
|
||||
case QVariant::Size: {
|
||||
QSize s = qvariant_cast<QSize>(v);
|
||||
result += QLatin1String("@Size(");
|
||||
result += QString::number(s.width());
|
||||
result += QLatin1Char(' ');
|
||||
result += QString::number(s.height());
|
||||
result += QLatin1Char(')');
|
||||
result = QString::asprintf("@Size(%d %d)", s.width(), s.height());
|
||||
break;
|
||||
}
|
||||
case QVariant::Point: {
|
||||
QPoint p = qvariant_cast<QPoint>(v);
|
||||
result += QLatin1String("@Point(");
|
||||
result += QString::number(p.x());
|
||||
result += QLatin1Char(' ');
|
||||
result += QString::number(p.y());
|
||||
result += QLatin1Char(')');
|
||||
result = QString::asprintf("@Point(%d %d)", p.x(), p.y());
|
||||
break;
|
||||
}
|
||||
#endif // !QT_NO_GEOM_VARIANT
|
||||
@ -474,9 +456,9 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
|
||||
s << v;
|
||||
}
|
||||
|
||||
result = QLatin1String(typeSpec);
|
||||
result += QString::fromLatin1(a.constData(), a.size());
|
||||
result += QLatin1Char(')');
|
||||
result = QLatin1String(typeSpec)
|
||||
+ QLatin1String(a.constData(), a.size())
|
||||
+ QLatin1Char(')');
|
||||
#else
|
||||
Q_ASSERT(!"QSettings: Cannot save custom types without QDataStream support");
|
||||
#endif
|
||||
@ -647,8 +629,7 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
|
||||
&& ((ch >= '0' && ch <= '9')
|
||||
|| (ch >= 'a' && ch <= 'f')
|
||||
|| (ch >= 'A' && ch <= 'F'))) {
|
||||
result += "\\x";
|
||||
result += QByteArray::number(ch, 16);
|
||||
result += "\\x" + QByteArray::number(ch, 16);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -687,8 +668,7 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
|
||||
break;
|
||||
default:
|
||||
if (ch <= 0x1F || (ch >= 0x7F && !useCodec)) {
|
||||
result += "\\x";
|
||||
result += QByteArray::number(ch, 16);
|
||||
result += "\\x" + QByteArray::number(ch, 16);
|
||||
escapeNextIfDigit = true;
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
} else if (useCodec) {
|
||||
@ -1038,10 +1018,33 @@ static inline int pathHashKey(QSettings::Format format, QSettings::Scope scope)
|
||||
return int((uint(format) << 1) | uint(scope == QSettings::SystemScope));
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
static QString make_user_path()
|
||||
{
|
||||
static Q_CONSTEXPR QChar sep = QLatin1Char('/');
|
||||
#ifndef QSETTINGS_USE_QSTANDARDPATHS
|
||||
// Non XDG platforms (OS X, iOS, Android...) have used this code path erroneously
|
||||
// for some time now. Moving away from that would require migrating existing settings.
|
||||
QByteArray env = qgetenv("XDG_CONFIG_HOME");
|
||||
if (env.isEmpty()) {
|
||||
return QDir::homePath() + QLatin1String("/.config/");
|
||||
} else if (env.startsWith('/')) {
|
||||
return QFile::decodeName(env) + sep;
|
||||
} else {
|
||||
return QDir::homePath() + sep + QFile::decodeName(env) + sep;
|
||||
}
|
||||
#else
|
||||
// When using a proper XDG platform, use QStandardPaths rather than the above hand-written code;
|
||||
// it makes the use of test mode from unit tests possible.
|
||||
// Ideally all platforms should use this, but see above for the migration issue.
|
||||
return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + sep;
|
||||
#endif
|
||||
}
|
||||
#endif // !Q_OS_WIN
|
||||
|
||||
static void initDefaultPaths(QMutexLocker *locker)
|
||||
{
|
||||
PathHash *pathHash = pathHashFunc();
|
||||
QString systemPath;
|
||||
|
||||
locker->unlock();
|
||||
|
||||
@ -1050,8 +1053,7 @@ static void initDefaultPaths(QMutexLocker *locker)
|
||||
avoid a dead-lock, we can't hold the global mutex while
|
||||
calling it.
|
||||
*/
|
||||
systemPath = QLibraryInfo::location(QLibraryInfo::SettingsPath);
|
||||
systemPath += QLatin1Char('/');
|
||||
QString systemPath = QLibraryInfo::location(QLibraryInfo::SettingsPath) + QLatin1Char('/');
|
||||
|
||||
locker->relock();
|
||||
if (pathHash->isEmpty()) {
|
||||
@ -1067,38 +1069,14 @@ static void initDefaultPaths(QMutexLocker *locker)
|
||||
pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::SystemScope),
|
||||
windowsConfigPath(CSIDL_COMMON_APPDATA) + QDir::separator());
|
||||
#else
|
||||
|
||||
#ifndef QSETTINGS_USE_QSTANDARDPATHS
|
||||
// Non XDG platforms (OS X, iOS, Android...) have used this code path erroneously
|
||||
// for some time now. Moving away from that would require migrating existing settings.
|
||||
QString userPath;
|
||||
QByteArray env = qgetenv("XDG_CONFIG_HOME");
|
||||
if (env.isEmpty()) {
|
||||
userPath = QDir::homePath();
|
||||
userPath += QLatin1Char('/');
|
||||
userPath += QLatin1String(".config");
|
||||
} else if (env.startsWith('/')) {
|
||||
userPath = QFile::decodeName(env);
|
||||
} else {
|
||||
userPath = QDir::homePath();
|
||||
userPath += QLatin1Char('/');
|
||||
userPath += QFile::decodeName(env);
|
||||
}
|
||||
#else
|
||||
// When using a proper XDG platform, use QStandardPaths rather than the above hand-written code;
|
||||
// it makes the use of test mode from unit tests possible.
|
||||
// Ideally all platforms should use this, but see above for the migration issue.
|
||||
QString userPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
|
||||
#endif
|
||||
userPath += QLatin1Char('/');
|
||||
|
||||
const QString userPath = make_user_path();
|
||||
pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::UserScope), userPath);
|
||||
pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::SystemScope), systemPath);
|
||||
#ifndef Q_OS_MAC
|
||||
pathHash->insert(pathHashKey(QSettings::NativeFormat, QSettings::UserScope), userPath);
|
||||
pathHash->insert(pathHashKey(QSettings::NativeFormat, QSettings::SystemScope), systemPath);
|
||||
#endif
|
||||
#endif
|
||||
#endif // Q_OS_WIN
|
||||
}
|
||||
}
|
||||
|
||||
@ -3486,8 +3464,7 @@ QSettings::Format QSettings::registerFormat(const QString &extension, ReadFunc r
|
||||
return QSettings::InvalidFormat;
|
||||
|
||||
QConfFileCustomFormat info;
|
||||
info.extension = QLatin1Char('.');
|
||||
info.extension += extension;
|
||||
info.extension = QLatin1Char('.') + extension;
|
||||
info.readFunc = readFunc;
|
||||
info.writeFunc = writeFunc;
|
||||
info.caseSensitivity = caseSensitivity;
|
||||
|
@ -92,7 +92,7 @@ static IApplicationDataContainer *subContainer(IApplicationDataContainer *parent
|
||||
if (FAILED(hr))
|
||||
return 0;
|
||||
|
||||
while (SUCCEEDED(S_OK) && current) {
|
||||
while (SUCCEEDED(hr) && current) {
|
||||
ComPtr<ContainerItem> item;
|
||||
hr = iterator->get_Current(&item);
|
||||
if (FAILED(hr))
|
||||
|
@ -1,6 +1,7 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Ivan Komissarov <ABBAPOH@gmail.com>
|
||||
** Copyright (C) 2016 Intel Corporation.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
@ -153,29 +154,41 @@ static bool isParentOf(const String &parent, const QString &dirName)
|
||||
parent.size() == 1);
|
||||
}
|
||||
|
||||
static bool isPseudoFs(const QStorageIterator &it)
|
||||
static bool shouldIncludeFs(const QStorageIterator &it)
|
||||
{
|
||||
/*
|
||||
* This function implements a heuristic algorithm to determine whether a
|
||||
* given mount should be reported to the user. Our objective is to list
|
||||
* only entries that the end-user would find useful.
|
||||
*
|
||||
* We therefore ignore:
|
||||
* - mounted in /dev, /proc, /sys: special mounts
|
||||
* (this will catch /sys/fs/cgroup, /proc/sys/fs/binfmt_misc, /dev/pts,
|
||||
* some of which are tmpfs on Linux)
|
||||
* - mounted in /var/run or /var/lock: most likely pseudofs
|
||||
* (on earlier systemd versions, /var/run was a bind-mount of /run, so
|
||||
* everything would be unnecessarily duplicated)
|
||||
* - filesystem type is "rootfs": artifact of the root-pivot on some Linux
|
||||
* initrd
|
||||
* - if the filesystem total size is zero, it's a pseudo-fs (not checked here).
|
||||
*/
|
||||
|
||||
QString mountDir = it.rootPath();
|
||||
if (isParentOf(QLatin1String("/dev"), mountDir)
|
||||
|| isParentOf(QLatin1String("/proc"), mountDir)
|
||||
|| isParentOf(QLatin1String("/sys"), mountDir)
|
||||
|| isParentOf(QLatin1String("/var/run"), mountDir)
|
||||
|| isParentOf(QLatin1String("/var/lock"), mountDir)) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray type = it.fileSystemType();
|
||||
if (type == "tmpfs")
|
||||
#ifdef Q_OS_LINUX
|
||||
if (it.fileSystemType() == "rootfs")
|
||||
return false;
|
||||
#if defined(Q_OS_LINUX)
|
||||
if (type == "rootfs" || type == "rpc_pipefs")
|
||||
return true;
|
||||
#endif
|
||||
|
||||
if (!it.device().startsWith('/'))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
// size checking in mountedVolumes()
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_BSD4)
|
||||
@ -557,11 +570,14 @@ QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes()
|
||||
QList<QStorageInfo> volumes;
|
||||
|
||||
while (it.next()) {
|
||||
if (isPseudoFs(it))
|
||||
if (!shouldIncludeFs(it))
|
||||
continue;
|
||||
|
||||
const QString mountDir = it.rootPath();
|
||||
volumes.append(QStorageInfo(mountDir));
|
||||
QStorageInfo info(mountDir);
|
||||
if (info.bytesTotal() == 0)
|
||||
continue;
|
||||
volumes.append(info);
|
||||
}
|
||||
|
||||
return volumes;
|
||||
|
@ -816,7 +816,7 @@ static const ushort * const fragmentInUrl = userNameInUrl + 6;
|
||||
|
||||
static inline void parseDecodedComponent(QString &data)
|
||||
{
|
||||
data.replace(QLatin1Char('%'), QStringLiteral("%25"));
|
||||
data.replace(QLatin1Char('%'), QLatin1String("%25"));
|
||||
}
|
||||
|
||||
static inline QString
|
||||
@ -981,10 +981,12 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro
|
||||
needsLowercasing = i;
|
||||
continue;
|
||||
}
|
||||
if (p[i] >= '0' && p[i] <= '9' && i > 0)
|
||||
continue;
|
||||
if (p[i] == '+' || p[i] == '-' || p[i] == '.')
|
||||
continue;
|
||||
if (i) {
|
||||
if (p[i] >= '0' && p[i] <= '9')
|
||||
continue;
|
||||
if (p[i] == '+' || p[i] == '-' || p[i] == '.')
|
||||
continue;
|
||||
}
|
||||
|
||||
// found something else
|
||||
// don't call setError needlessly:
|
||||
@ -1472,7 +1474,7 @@ QString QUrlPrivate::toLocalFile(QUrl::FormattingOptions options) const
|
||||
|
||||
// magic for shared drive on windows
|
||||
if (!host.isEmpty()) {
|
||||
tmp = QStringLiteral("//") + host;
|
||||
tmp = QLatin1String("//") + host;
|
||||
#ifdef Q_OS_WIN // QTBUG-42346, WebDAV is visible as local file on Windows only.
|
||||
if (scheme == webDavScheme())
|
||||
tmp += webDavSslTag();
|
||||
|
@ -2269,7 +2269,7 @@ Q_AUTOTEST_EXPORT void qt_punycodeEncoder(const QChar *s, int ucLength, QString
|
||||
}
|
||||
|
||||
// prepend ACE prefix
|
||||
output->insert(outLen, QStringLiteral("xn--"));
|
||||
output->insert(outLen, QLatin1String("xn--"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -359,16 +359,14 @@ QByteArray QJsonDocument::toJson(JsonFormat format) const
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Parses a UTF-8 encoded JSON document and creates a QJsonDocument
|
||||
Parses \a json as a UTF-8 encoded JSON document, and creates a QJsonDocument
|
||||
from it.
|
||||
|
||||
\a json contains the json document to be parsed.
|
||||
Returns a valid (non-null) QJsonDocument if the parsing succeeds. If it fails,
|
||||
the returned document will be null, and the optional \a error variable will contain
|
||||
further details about the error.
|
||||
|
||||
The optional \a error variable can be used to pass in a QJsonParseError data
|
||||
structure that will contain information about possible errors encountered during
|
||||
parsing.
|
||||
|
||||
\sa toJson(), QJsonParseError
|
||||
\sa toJson(), QJsonParseError, isNull()
|
||||
*/
|
||||
QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error)
|
||||
{
|
||||
|
@ -80,6 +80,10 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#if !defined(QT_POSIX_IPC) && !defined(QT_NO_SHAREDMEMORY) && !defined(Q_OS_ANDROID)
|
||||
# include <sys/ipc.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_VXWORKS)
|
||||
# include <ioLib.h>
|
||||
#endif
|
||||
|
@ -188,8 +188,10 @@ int QEventLoop::exec(ProcessEventsFlags flags)
|
||||
{
|
||||
if (exceptionCaught) {
|
||||
qWarning("Qt has caught an exception thrown from an event handler. Throwing\n"
|
||||
"exceptions from an event handler is not supported in Qt. You must\n"
|
||||
"reimplement QApplication::notify() and catch all exceptions there.\n");
|
||||
"exceptions from an event handler is not supported in Qt.\n"
|
||||
"You must not let any exception whatsoever propagate through Qt code.\n"
|
||||
"If that is not possible, in Qt 5 you must at least reimplement\n"
|
||||
"QCoreApplication::notify() and catch all exceptions there.\n");
|
||||
}
|
||||
locker.relock();
|
||||
QEventLoop *eventLoop = d->threadData->eventLoops.pop();
|
||||
|
@ -1353,7 +1353,7 @@ static inline QByteArray findMethodCandidates(const QMetaObject *metaObject, con
|
||||
for (int i = 0; i < metaObject->methodCount(); ++i) {
|
||||
const QMetaMethod method = metaObject->method(i);
|
||||
if (method.name() == memberByteArray)
|
||||
candidateMessage.append(" " + method.methodSignature() + '\n');
|
||||
candidateMessage += " " + method.methodSignature() + '\n';
|
||||
}
|
||||
if (!candidateMessage.isEmpty()) {
|
||||
candidateMessage.prepend("\nCandidates are:\n");
|
||||
|
@ -244,6 +244,9 @@ bool QReadWriteLock::tryLockForRead(int timeout)
|
||||
}
|
||||
|
||||
if (d == dummyLockedForWrite) {
|
||||
if (!timeout)
|
||||
return false;
|
||||
|
||||
// locked for write, assign a d_ptr and wait.
|
||||
auto val = QReadWriteLockPrivate::allocate();
|
||||
val->writerCount = 1;
|
||||
@ -345,6 +348,9 @@ bool QReadWriteLock::tryLockForWrite(int timeout)
|
||||
}
|
||||
|
||||
if (isUncontendedLocked(d)) {
|
||||
if (!timeout)
|
||||
return false;
|
||||
|
||||
// locked for either read or write, assign a d_ptr and wait.
|
||||
auto val = QReadWriteLockPrivate::allocate();
|
||||
if (d == dummyLockedForWrite)
|
||||
|
@ -3513,7 +3513,7 @@ qint64 QDateTime::toMSecsSinceEpoch() const
|
||||
|
||||
case Qt::TimeZone:
|
||||
#ifdef QT_BOOTSTRAPPED
|
||||
break;
|
||||
return 0;
|
||||
#else
|
||||
return QDateTimePrivate::zoneMSecsToEpochMSecs(d->m_msecs, d->m_timeZone);
|
||||
#endif
|
||||
@ -3771,7 +3771,7 @@ QString QDateTime::toString(Qt::DateFormat format) const
|
||||
.arg(tm.toString(Qt::TextDate))
|
||||
.arg(dt.year());
|
||||
if (timeSpec() != Qt::LocalTime) {
|
||||
buf += QStringLiteral(" GMT");
|
||||
buf += QLatin1String(" GMT");
|
||||
if (getSpec(d) == Qt::OffsetFromUTC)
|
||||
buf += toOffsetString(Qt::TextDate, offsetFromUtc());
|
||||
}
|
||||
@ -5019,7 +5019,12 @@ QDataStream &operator>>(QDataStream &in, QDate &date)
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const QTime &time)
|
||||
{
|
||||
return out << quint32(time.mds);
|
||||
if (out.version() >= QDataStream::Qt_4_0) {
|
||||
return out << quint32(time.mds);
|
||||
} else {
|
||||
// Qt3 had no support for reading -1, QTime() was valid and serialized as 0
|
||||
return out << quint32(time.isNull() ? 0 : time.mds);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -5034,7 +5039,12 @@ QDataStream &operator>>(QDataStream &in, QTime &time)
|
||||
{
|
||||
quint32 ds;
|
||||
in >> ds;
|
||||
time.mds = int(ds);
|
||||
if (in.version() >= QDataStream::Qt_4_0) {
|
||||
time.mds = int(ds);
|
||||
} else {
|
||||
// Qt3 would write 0 for a null time
|
||||
time.mds = (ds == 0) ? QTime::NullTime : int(ds);
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
|
@ -1786,17 +1786,12 @@ void QString::reallocData(uint alloc, bool grow)
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
void QString::expand(int i)
|
||||
{
|
||||
int sz = d->size;
|
||||
resize(qMax(i + 1, sz));
|
||||
if (d->size - 1 > sz) {
|
||||
ushort *n = d->data() + d->size - 1;
|
||||
ushort *e = d->data() + sz;
|
||||
while (n != e)
|
||||
* --n = ' ';
|
||||
}
|
||||
resize(qMax(i + 1, d->size), QLatin1Char(' '));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*! \fn void QString::clear()
|
||||
|
||||
@ -1982,7 +1977,10 @@ QString &QString::insert(int i, QLatin1String str)
|
||||
return *this;
|
||||
|
||||
int len = str.size();
|
||||
expand(qMax(d->size, i) + len - 1);
|
||||
if (Q_UNLIKELY(i > d->size))
|
||||
resize(i + len, QLatin1Char(' '));
|
||||
else
|
||||
resize(d->size + len);
|
||||
|
||||
::memmove(d->data() + i + len, d->data() + i, (d->size - i - len) * sizeof(QChar));
|
||||
qt_from_latin1(d->data() + i, s, uint(len));
|
||||
@ -2012,7 +2010,10 @@ QString& QString::insert(int i, const QChar *unicode, int size)
|
||||
return *this;
|
||||
}
|
||||
|
||||
expand(qMax(d->size, i) + size - 1);
|
||||
if (Q_UNLIKELY(i > d->size))
|
||||
resize(i + size, QLatin1Char(' '));
|
||||
else
|
||||
resize(d->size + size);
|
||||
|
||||
::memmove(d->data() + i + size, d->data() + i, (d->size - i - size) * sizeof(QChar));
|
||||
memcpy(d->data() + i, s, size * sizeof(QChar));
|
||||
@ -2032,7 +2033,10 @@ QString& QString::insert(int i, QChar ch)
|
||||
i += d->size;
|
||||
if (i < 0)
|
||||
return *this;
|
||||
expand(qMax(i, d->size));
|
||||
if (Q_UNLIKELY(i > d->size))
|
||||
resize(i + 1, QLatin1Char(' '));
|
||||
else
|
||||
resize(d->size + 1);
|
||||
::memmove(d->data() + i + 1, d->data() + i, (d->size - i - 1) * sizeof(QChar));
|
||||
d->data()[i] = ch.unicode();
|
||||
return *this;
|
||||
@ -2404,26 +2408,40 @@ QString &QString::replace(const QString &before, const QString &after, Qt::CaseS
|
||||
return replace(before.constData(), before.size(), after.constData(), after.size(), cs);
|
||||
}
|
||||
|
||||
namespace { // helpers for replace and its helper:
|
||||
QChar *textCopy(const QChar *start, int len)
|
||||
{
|
||||
const size_t size = len * sizeof(QChar);
|
||||
QChar *const copy = static_cast<QChar *>(::malloc(size));
|
||||
Q_CHECK_PTR(copy);
|
||||
::memcpy(copy, start, size);
|
||||
return copy;
|
||||
}
|
||||
|
||||
bool pointsIntoRange(const QChar *ptr, const ushort *base, int len)
|
||||
{
|
||||
const QChar *const start = reinterpret_cast<const QChar *>(base);
|
||||
return start <= ptr && ptr < start + len;
|
||||
}
|
||||
} // end namespace
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen)
|
||||
{
|
||||
// copy *after in case it lies inside our own d->data() area
|
||||
// (which we could possibly invalidate via a realloc or corrupt via memcpy operations.)
|
||||
QChar *afterBuffer = const_cast<QChar *>(after);
|
||||
if (after >= reinterpret_cast<QChar *>(d->data()) && after < reinterpret_cast<QChar *>(d->data()) + d->size) {
|
||||
afterBuffer = static_cast<QChar *>(::malloc(alen*sizeof(QChar)));
|
||||
Q_CHECK_PTR(afterBuffer);
|
||||
::memcpy(afterBuffer, after, alen*sizeof(QChar));
|
||||
}
|
||||
// Copy after if it lies inside our own d->data() area (which we could
|
||||
// possibly invalidate via a realloc or modify by replacement).
|
||||
QChar *afterBuffer = 0;
|
||||
if (pointsIntoRange(after, d->data(), d->size)) // Use copy in place of vulnerable original:
|
||||
after = afterBuffer = textCopy(after, alen);
|
||||
|
||||
QT_TRY {
|
||||
if (blen == alen) {
|
||||
// replace in place
|
||||
detach();
|
||||
for (int i = 0; i < nIndices; ++i)
|
||||
memcpy(d->data() + indices[i], afterBuffer, alen * sizeof(QChar));
|
||||
memcpy(d->data() + indices[i], after, alen * sizeof(QChar));
|
||||
} else if (alen < blen) {
|
||||
// replace from front
|
||||
detach();
|
||||
@ -2439,7 +2457,7 @@ void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar
|
||||
to += msize;
|
||||
}
|
||||
if (alen) {
|
||||
memcpy(d->data() + to, afterBuffer, alen*sizeof(QChar));
|
||||
memcpy(d->data() + to, after, alen * sizeof(QChar));
|
||||
to += alen;
|
||||
}
|
||||
movestart = indices[i] + blen;
|
||||
@ -2462,17 +2480,15 @@ void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar
|
||||
int moveto = insertstart + alen;
|
||||
memmove(d->data() + moveto, d->data() + movestart,
|
||||
(moveend - movestart)*sizeof(QChar));
|
||||
memcpy(d->data() + insertstart, afterBuffer, alen*sizeof(QChar));
|
||||
memcpy(d->data() + insertstart, after, alen * sizeof(QChar));
|
||||
moveend = movestart-blen;
|
||||
}
|
||||
}
|
||||
} QT_CATCH(const std::bad_alloc &) {
|
||||
if (afterBuffer != after)
|
||||
::free(afterBuffer);
|
||||
::free(afterBuffer);
|
||||
QT_RETHROW;
|
||||
}
|
||||
if (afterBuffer != after)
|
||||
::free(afterBuffer);
|
||||
::free(afterBuffer);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -2501,31 +2517,48 @@ QString &QString::replace(const QChar *before, int blen,
|
||||
return *this;
|
||||
|
||||
QStringMatcher matcher(before, blen, cs);
|
||||
QChar *beforeBuffer = 0, *afterBuffer = 0;
|
||||
|
||||
int index = 0;
|
||||
while (1) {
|
||||
uint indices[1024];
|
||||
uint pos = 0;
|
||||
while (pos < 1023) {
|
||||
while (pos < 1024) {
|
||||
index = matcher.indexIn(*this, index);
|
||||
if (index == -1)
|
||||
break;
|
||||
indices[pos++] = index;
|
||||
index += blen;
|
||||
// avoid infinite loop
|
||||
if (!blen)
|
||||
if (blen) // Step over before:
|
||||
index += blen;
|
||||
else // Only count one instance of empty between any two characters:
|
||||
index++;
|
||||
}
|
||||
if (!pos)
|
||||
if (!pos) // Nothing to replace
|
||||
break;
|
||||
|
||||
if (Q_UNLIKELY(index != -1)) {
|
||||
/*
|
||||
We're about to change data, that before and after might point
|
||||
into, and we'll need that data for our next batch of indices.
|
||||
*/
|
||||
if (!afterBuffer && pointsIntoRange(after, d->data(), d->size))
|
||||
after = afterBuffer = textCopy(after, alen);
|
||||
|
||||
if (!beforeBuffer && pointsIntoRange(before, d->data(), d->size)) {
|
||||
beforeBuffer = textCopy(before, blen);
|
||||
matcher = QStringMatcher(beforeBuffer, blen, cs);
|
||||
}
|
||||
}
|
||||
|
||||
replace_helper(indices, pos, blen, after, alen);
|
||||
|
||||
if (index == -1)
|
||||
if (Q_LIKELY(index == -1)) // Nothing left to replace
|
||||
break;
|
||||
// index has to be adjusted in case we get back into the loop above.
|
||||
// The call to replace_helper just moved what index points at:
|
||||
index += pos*(alen-blen);
|
||||
}
|
||||
::free(afterBuffer);
|
||||
::free(beforeBuffer);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -2556,26 +2589,26 @@ QString& QString::replace(QChar ch, const QString &after, Qt::CaseSensitivity cs
|
||||
uint indices[1024];
|
||||
uint pos = 0;
|
||||
if (cs == Qt::CaseSensitive) {
|
||||
while (pos < 1023 && index < d->size) {
|
||||
while (pos < 1024 && index < d->size) {
|
||||
if (d->data()[index] == cc)
|
||||
indices[pos++] = index;
|
||||
index++;
|
||||
}
|
||||
} else {
|
||||
while (pos < 1023 && index < d->size) {
|
||||
while (pos < 1024 && index < d->size) {
|
||||
if (QChar::toCaseFolded(d->data()[index]) == cc)
|
||||
indices[pos++] = index;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if (!pos)
|
||||
if (!pos) // Nothing to replace
|
||||
break;
|
||||
|
||||
replace_helper(indices, pos, 1, after.constData(), after.d->size);
|
||||
|
||||
if (index == -1)
|
||||
if (Q_LIKELY(index == -1)) // Nothing left to replace
|
||||
break;
|
||||
// index has to be adjusted in case we get back into the loop above.
|
||||
// The call to replace_helper just moved what index points at:
|
||||
index += pos*(after.d->size - 1);
|
||||
}
|
||||
return *this;
|
||||
@ -5001,7 +5034,7 @@ void QString::truncate(int pos)
|
||||
Removes \a n characters from the end of the string.
|
||||
|
||||
If \a n is greater than or equal to size(), the result is an
|
||||
empty string.
|
||||
empty string; if \a n is negative, it is equivalent to passing zero.
|
||||
|
||||
Example:
|
||||
\snippet qstring/main.cpp 15
|
||||
|
@ -821,7 +821,9 @@ private:
|
||||
friend inline bool operator> (QChar, QLatin1String) Q_DECL_NOTHROW;
|
||||
|
||||
void reallocData(uint alloc, bool grow = false);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
void expand(int i);
|
||||
#endif
|
||||
QString multiArg(int numArgs, const QString **args) const;
|
||||
static int compare_helper(const QChar *data1, int length1,
|
||||
const QChar *data2, int length2,
|
||||
@ -1008,7 +1010,7 @@ public:
|
||||
inline operator QChar() const
|
||||
{ return i < s.d->size ? s.d->data()[i] : 0; }
|
||||
inline QCharRef &operator=(QChar c)
|
||||
{ if (i >= s.d->size) s.expand(i); else s.detach();
|
||||
{ if (i >= s.d->size) s.resize(i + 1, QLatin1Char(' ')); else s.detach();
|
||||
s.d->data()[i] = c.unicode(); return *this; }
|
||||
|
||||
// An operator= for each QChar cast constructors
|
||||
|
@ -82,7 +82,7 @@ struct QStringBuilderCommon
|
||||
T toLower() const { return resolved().toLower(); }
|
||||
|
||||
protected:
|
||||
const T resolved() const { return *static_cast<const Builder*>(this); }
|
||||
T resolved() const { return *static_cast<const Builder*>(this); }
|
||||
};
|
||||
|
||||
template<typename Builder, typename T>
|
||||
|
@ -332,7 +332,7 @@ QString QIcuTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
|
||||
{
|
||||
// Return standard offset format name as ICU C api doesn't support it yet
|
||||
if (nameType == QTimeZone::OffsetName) {
|
||||
const Data nowData = data(QDateTime::currentDateTimeUtc().toMSecsSinceEpoch());
|
||||
const Data nowData = data(QDateTime::currentMSecsSinceEpoch());
|
||||
// We can't use transitions reliably to find out right dst offset
|
||||
// Instead use dst offset api to try get it if needed
|
||||
if (timeType == QTimeZone::DaylightTime)
|
||||
|
@ -59,6 +59,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
// Create the system default time zone
|
||||
QMacTimeZonePrivate::QMacTimeZonePrivate()
|
||||
: m_nstz(0)
|
||||
{
|
||||
init(systemTimeZoneId());
|
||||
}
|
||||
@ -106,7 +107,7 @@ QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
|
||||
{
|
||||
// TODO Mac doesn't support OffsetName yet so use standard offset name
|
||||
if (nameType == QTimeZone::OffsetName) {
|
||||
const Data nowData = data(QDateTime::currentDateTimeUtc().toMSecsSinceEpoch());
|
||||
const Data nowData = data(QDateTime::currentMSecsSinceEpoch());
|
||||
// TODO Cheat for now, assume if has dst the offset if 1 hour
|
||||
if (timeType == QTimeZone::DaylightTime && hasDaylightTime())
|
||||
return isoOffsetFormat(nowData.standardTimeOffset + 3600);
|
||||
|
@ -758,7 +758,7 @@ void QAccessible::deleteAccessibleInterface(Id id)
|
||||
*/
|
||||
QAccessible::Id QAccessible::uniqueId(QAccessibleInterface *iface)
|
||||
{
|
||||
Id id = QAccessibleCache::instance()->idToInterface.key(iface);
|
||||
Id id = QAccessibleCache::instance()->idForInterface(iface);
|
||||
if (!id)
|
||||
id = registerAccessibleInterface(iface);
|
||||
return id;
|
||||
@ -771,7 +771,7 @@ QAccessible::Id QAccessible::uniqueId(QAccessibleInterface *iface)
|
||||
*/
|
||||
QAccessibleInterface *QAccessible::accessibleInterface(Id id)
|
||||
{
|
||||
return QAccessibleCache::instance()->idToInterface.value(id);
|
||||
return QAccessibleCache::instance()->interfaceForId(id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,6 +83,11 @@ QAccessibleInterface *QAccessibleCache::interfaceForId(QAccessible::Id id) const
|
||||
return idToInterface.value(id);
|
||||
}
|
||||
|
||||
QAccessible::Id QAccessibleCache::idForInterface(QAccessibleInterface *iface) const
|
||||
{
|
||||
return interfaceToId.value(iface);
|
||||
}
|
||||
|
||||
QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface *iface) const
|
||||
{
|
||||
Q_ASSERT(iface);
|
||||
@ -90,7 +95,7 @@ QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface *
|
||||
|
||||
// object might be 0
|
||||
Q_ASSERT(!objectToId.contains(object));
|
||||
Q_ASSERT_X(!idToInterface.values().contains(iface), "", "Accessible interface inserted into cache twice!");
|
||||
Q_ASSERT_X(!interfaceToId.contains(iface), "", "Accessible interface inserted into cache twice!");
|
||||
|
||||
QAccessible::Id id = acquireId();
|
||||
QObject *obj = iface->object();
|
||||
@ -100,6 +105,7 @@ QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface *
|
||||
connect(obj, &QObject::destroyed, this, &QAccessibleCache::objectDestroyed);
|
||||
}
|
||||
idToInterface.insert(id, iface);
|
||||
interfaceToId.insert(iface, id);
|
||||
return id;
|
||||
}
|
||||
|
||||
@ -115,6 +121,7 @@ void QAccessibleCache::objectDestroyed(QObject* obj)
|
||||
void QAccessibleCache::deleteInterface(QAccessible::Id id, QObject *obj)
|
||||
{
|
||||
QAccessibleInterface *iface = idToInterface.take(id);
|
||||
interfaceToId.take(iface);
|
||||
if (!obj)
|
||||
obj = iface->object();
|
||||
if (obj)
|
||||
|
@ -70,6 +70,7 @@ class Q_GUI_EXPORT QAccessibleCache :public QObject
|
||||
public:
|
||||
static QAccessibleCache *instance();
|
||||
QAccessibleInterface *interfaceForId(QAccessible::Id id) const;
|
||||
QAccessible::Id idForInterface(QAccessibleInterface *iface) const;
|
||||
QAccessible::Id insert(QObject *object, QAccessibleInterface *iface) const;
|
||||
void deleteInterface(QAccessible::Id id, QObject *obj = 0);
|
||||
|
||||
@ -85,6 +86,7 @@ private:
|
||||
QAccessible::Id acquireId() const;
|
||||
|
||||
mutable QHash<QAccessible::Id, QAccessibleInterface *> idToInterface;
|
||||
mutable QHash<QAccessibleInterface *, QAccessible::Id> interfaceToId;
|
||||
mutable QHash<QObject *, QAccessible::Id> objectToId;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
@ -1227,8 +1227,8 @@ bool QIcon::hasThemeIcon(const QString &name)
|
||||
/*!
|
||||
\since 5.6
|
||||
|
||||
Indicate that this icon is a mask image, and hence can potentially
|
||||
be modified based on where it's displayed.
|
||||
Indicate that this icon is a mask image(boolean \a isMask), and hence can
|
||||
potentially be modified based on where it's displayed.
|
||||
\sa isMask()
|
||||
*/
|
||||
void QIcon::setIsMask(bool isMask)
|
||||
|
@ -1796,11 +1796,12 @@ QStandardItem *QStandardItem::takeChild(int row, int column)
|
||||
QList<QStandardItem*> QStandardItem::takeRow(int row)
|
||||
{
|
||||
Q_D(QStandardItem);
|
||||
QList<QStandardItem*> items;
|
||||
if ((row < 0) || (row >= rowCount()))
|
||||
return QList<QStandardItem*>();
|
||||
return items;
|
||||
if (d->model)
|
||||
d->model->d_func()->rowsAboutToBeRemoved(this, row, row);
|
||||
QList<QStandardItem*> items;
|
||||
|
||||
int index = d->childIndex(row, 0); // Will return -1 if there are no columns
|
||||
if (index != -1) {
|
||||
int col_count = d->columnCount();
|
||||
@ -1829,13 +1830,15 @@ QList<QStandardItem*> QStandardItem::takeRow(int row)
|
||||
QList<QStandardItem*> QStandardItem::takeColumn(int column)
|
||||
{
|
||||
Q_D(QStandardItem);
|
||||
QList<QStandardItem*> items;
|
||||
if ((column < 0) || (column >= columnCount()))
|
||||
return QList<QStandardItem*>();
|
||||
return items;
|
||||
if (d->model)
|
||||
d->model->d_func()->columnsAboutToBeRemoved(this, column, column);
|
||||
QList<QStandardItem*> items;
|
||||
|
||||
for (int row = d->rowCount() - 1; row >= 0; --row) {
|
||||
const int rowCount = d->rowCount();
|
||||
items.reserve(rowCount);
|
||||
for (int row = rowCount - 1; row >= 0; --row) {
|
||||
int index = d->childIndex(row, column);
|
||||
QStandardItem *ch = d->children.at(index);
|
||||
if (ch)
|
||||
|
@ -3355,28 +3355,6 @@ bool QGuiApplication::isSavingSession() const
|
||||
return d->is_saving_session;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.2
|
||||
|
||||
Function that can be used to sync Qt state with the Window Systems state.
|
||||
|
||||
This function will first empty Qts events by calling QCoreApplication::processEvents(),
|
||||
then the platform plugin will sync up with the windowsystem, and finally Qts events
|
||||
will be delived by another call to QCoreApplication::processEvents();
|
||||
|
||||
This function is timeconsuming and its use is discouraged.
|
||||
*/
|
||||
void QGuiApplication::sync()
|
||||
{
|
||||
QCoreApplication::processEvents();
|
||||
if (QGuiApplicationPrivate::platform_integration
|
||||
&& QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::SyncState)) {
|
||||
QGuiApplicationPrivate::platform_integration->sync();
|
||||
QCoreApplication::processEvents();
|
||||
QWindowSystemInterface::flushWindowSystemEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void QGuiApplicationPrivate::commitData()
|
||||
{
|
||||
Q_Q(QGuiApplication);
|
||||
@ -3401,6 +3379,28 @@ void QGuiApplicationPrivate::saveState()
|
||||
}
|
||||
#endif //QT_NO_SESSIONMANAGER
|
||||
|
||||
/*!
|
||||
\since 5.2
|
||||
|
||||
Function that can be used to sync Qt state with the Window Systems state.
|
||||
|
||||
This function will first empty Qts events by calling QCoreApplication::processEvents(),
|
||||
then the platform plugin will sync up with the windowsystem, and finally Qts events
|
||||
will be delived by another call to QCoreApplication::processEvents();
|
||||
|
||||
This function is timeconsuming and its use is discouraged.
|
||||
*/
|
||||
void QGuiApplication::sync()
|
||||
{
|
||||
QCoreApplication::processEvents();
|
||||
if (QGuiApplicationPrivate::platform_integration
|
||||
&& QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::SyncState)) {
|
||||
QGuiApplicationPrivate::platform_integration->sync();
|
||||
QCoreApplication::processEvents();
|
||||
QWindowSystemInterface::flushWindowSystemEvents();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QGuiApplication::layoutDirection
|
||||
\brief the default layout direction for this application
|
||||
@ -3647,7 +3647,8 @@ QPixmap QGuiApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape)
|
||||
|
||||
void QGuiApplicationPrivate::notifyThemeChanged()
|
||||
{
|
||||
if (!(applicationResourceFlags & ApplicationPaletteExplicitlySet)) {
|
||||
if (!(applicationResourceFlags & ApplicationPaletteExplicitlySet) &&
|
||||
!QCoreApplication::testAttribute(Qt::AA_SetPalette)) {
|
||||
clearPalette();
|
||||
initPalette();
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath)
|
||||
QCoreApplication::addLibraryPath(platformPluginPath);
|
||||
list = directLoader()->keyMap().values();
|
||||
if (!list.isEmpty()) {
|
||||
const QString postFix = QStringLiteral(" (from ")
|
||||
const QString postFix = QLatin1String(" (from ")
|
||||
+ QDir::toNativeSeparators(platformPluginPath)
|
||||
+ QLatin1Char(')');
|
||||
const QStringList::iterator end = list.end();
|
||||
|
@ -88,7 +88,7 @@ QStringList QPlatformThemeFactory::keys(const QString &platformPluginPath)
|
||||
QCoreApplication::addLibraryPath(platformPluginPath);
|
||||
list += directLoader()->keyMap().values();
|
||||
if (!list.isEmpty()) {
|
||||
const QString postFix = QStringLiteral(" (from ")
|
||||
const QString postFix = QLatin1String(" (from ")
|
||||
+ QDir::toNativeSeparators(platformPluginPath)
|
||||
+ QLatin1Char(')');
|
||||
const QStringList::iterator end = list.end();
|
||||
|
@ -1284,6 +1284,7 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ
|
||||
const char *ver = reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION));
|
||||
|
||||
// Blacklist GPU chipsets that have problems with their BGRA support.
|
||||
#ifndef Q_OS_IOS
|
||||
const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0
|
||||
&& ::strstr(ver, "1.3") != 0) ||
|
||||
(qstrcmp(renderer, "Mali-T760") == 0
|
||||
@ -1291,7 +1292,9 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ
|
||||
(qstrcmp(renderer, "Mali-T720") == 0
|
||||
&& ::strstr(ver, "3.1") != 0) ||
|
||||
qstrcmp(renderer, "PowerVR SGX 554") == 0;
|
||||
|
||||
#else
|
||||
const bool blackListed = true;
|
||||
#endif
|
||||
const bool supports_bgra = has_bgra_ext && !blackListed;
|
||||
|
||||
if (supports_bgra) {
|
||||
|
@ -259,7 +259,6 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id,
|
||||
newFreetype->ref.store(1);
|
||||
newFreetype->xsize = 0;
|
||||
newFreetype->ysize = 0;
|
||||
newFreetype->scalableBitmapScaleFactor = 1;
|
||||
newFreetype->matrix.xx = 0x10000;
|
||||
newFreetype->matrix.yy = 0x10000;
|
||||
newFreetype->matrix.xy = 0;
|
||||
@ -335,10 +334,11 @@ void QFreetypeFace::release(const QFontEngine::FaceId &face_id)
|
||||
}
|
||||
|
||||
|
||||
void QFreetypeFace::computeSize(const QFontDef &fontDef, int *xsize, int *ysize, bool *outline_drawing)
|
||||
void QFreetypeFace::computeSize(const QFontDef &fontDef, int *xsize, int *ysize, bool *outline_drawing, QFixed *scalableBitmapScaleFactor)
|
||||
{
|
||||
*ysize = qRound(fontDef.pixelSize * 64);
|
||||
*xsize = *ysize * fontDef.stretch / 100;
|
||||
*scalableBitmapScaleFactor = 1;
|
||||
*outline_drawing = false;
|
||||
|
||||
if (!(face->face_flags & FT_FACE_FLAG_SCALABLE)) {
|
||||
@ -376,7 +376,7 @@ void QFreetypeFace::computeSize(const QFontDef &fontDef, int *xsize, int *ysize,
|
||||
// to make sure we can select the desired bitmap strike index
|
||||
if (FT_Select_Size(face, best) == 0) {
|
||||
if (isScalableBitmap())
|
||||
scalableBitmapScaleFactor = QFixed::fromReal((qreal)fontDef.pixelSize / face->available_sizes[best].height);
|
||||
*scalableBitmapScaleFactor = QFixed::fromReal((qreal)fontDef.pixelSize / face->available_sizes[best].height);
|
||||
*xsize = face->available_sizes[best].x_ppem;
|
||||
*ysize = face->available_sizes[best].y_ppem;
|
||||
} else {
|
||||
@ -729,7 +729,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
|
||||
symbol = bool(fontDef.family.contains(QLatin1String("symbol"), Qt::CaseInsensitive));
|
||||
}
|
||||
|
||||
freetype->computeSize(fontDef, &xsize, &ysize, &defaultGlyphSet.outline_drawing);
|
||||
freetype->computeSize(fontDef, &xsize, &ysize, &defaultGlyphSet.outline_drawing, &scalableBitmapScaleFactor);
|
||||
|
||||
FT_Face face = lockFace();
|
||||
|
||||
@ -1294,24 +1294,24 @@ int QFontEngineFT::synthesized() const
|
||||
QFixed QFontEngineFT::ascent() const
|
||||
{
|
||||
QFixed v = QFixed::fromFixed(metrics.ascender);
|
||||
if (freetype->scalableBitmapScaleFactor != 1)
|
||||
v *= freetype->scalableBitmapScaleFactor;
|
||||
if (scalableBitmapScaleFactor != 1)
|
||||
v *= scalableBitmapScaleFactor;
|
||||
return v;
|
||||
}
|
||||
|
||||
QFixed QFontEngineFT::descent() const
|
||||
{
|
||||
QFixed v = QFixed::fromFixed(-metrics.descender);
|
||||
if (freetype->scalableBitmapScaleFactor != 1)
|
||||
v *= freetype->scalableBitmapScaleFactor;
|
||||
if (scalableBitmapScaleFactor != 1)
|
||||
v *= scalableBitmapScaleFactor;
|
||||
return v;
|
||||
}
|
||||
|
||||
QFixed QFontEngineFT::leading() const
|
||||
{
|
||||
QFixed v = QFixed::fromFixed(metrics.height - metrics.ascender + metrics.descender);
|
||||
if (freetype->scalableBitmapScaleFactor != 1)
|
||||
v *= freetype->scalableBitmapScaleFactor;
|
||||
if (scalableBitmapScaleFactor != 1)
|
||||
v *= scalableBitmapScaleFactor;
|
||||
return v;
|
||||
}
|
||||
|
||||
@ -1326,7 +1326,7 @@ QFixed QFontEngineFT::xHeight() const
|
||||
return answer;
|
||||
}
|
||||
} else {
|
||||
return QFixed(freetype->face->size->metrics.y_ppem) * freetype->scalableBitmapScaleFactor;
|
||||
return QFixed(freetype->face->size->metrics.y_ppem) * scalableBitmapScaleFactor;
|
||||
}
|
||||
return QFontEngine::xHeight();
|
||||
}
|
||||
@ -1352,8 +1352,8 @@ QFixed QFontEngineFT::averageCharWidth() const
|
||||
qreal QFontEngineFT::maxCharWidth() const
|
||||
{
|
||||
QFixed max_advance = QFixed::fromFixed(metrics.max_advance);
|
||||
if (freetype->scalableBitmapScaleFactor != 1)
|
||||
max_advance *= freetype->scalableBitmapScaleFactor;
|
||||
if (scalableBitmapScaleFactor != 1)
|
||||
max_advance *= scalableBitmapScaleFactor;
|
||||
return max_advance.toReal();
|
||||
}
|
||||
|
||||
@ -1639,7 +1639,7 @@ bool QFontEngineFT::shouldUseDesignMetrics(QFontEngine::ShaperFlags flags) const
|
||||
|
||||
QFixed QFontEngineFT::scaledBitmapMetrics(QFixed m) const
|
||||
{
|
||||
return m * freetype->scalableBitmapScaleFactor;
|
||||
return m * scalableBitmapScaleFactor;
|
||||
}
|
||||
|
||||
glyph_metrics_t QFontEngineFT::scaledBitmapMetrics(const glyph_metrics_t &m) const
|
||||
@ -1677,8 +1677,8 @@ void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlag
|
||||
delete g;
|
||||
}
|
||||
|
||||
if (freetype->scalableBitmapScaleFactor != 1)
|
||||
glyphs->advances[i] *= freetype->scalableBitmapScaleFactor;
|
||||
if (scalableBitmapScaleFactor != 1)
|
||||
glyphs->advances[i] *= scalableBitmapScaleFactor;
|
||||
}
|
||||
if (face)
|
||||
unlockFace();
|
||||
@ -1981,9 +1981,9 @@ QImage QFontEngineFT::bitmapForGlyph(glyph_t g, QFixed subPixelPosition, const Q
|
||||
else if (defaultFormat == GlyphFormat::Format_Mono)
|
||||
img = QImage(glyph->data, glyph->width, glyph->height, QImage::Format_Mono).copy();
|
||||
|
||||
if (!img.isNull() && (!t.isIdentity() || freetype->scalableBitmapScaleFactor != 1)) {
|
||||
if (!img.isNull() && (!t.isIdentity() || scalableBitmapScaleFactor != 1)) {
|
||||
QTransform trans(t);
|
||||
const qreal scaleFactor = freetype->scalableBitmapScaleFactor.toReal();
|
||||
const qreal scaleFactor = scalableBitmapScaleFactor.toReal();
|
||||
trans.scale(scaleFactor, scaleFactor);
|
||||
img = img.transformed(trans, Qt::SmoothTransformation);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class QFontconfigDatabase;
|
||||
class QFreetypeFace
|
||||
{
|
||||
public:
|
||||
void computeSize(const QFontDef &fontDef, int *xsize, int *ysize, bool *outline_drawing);
|
||||
void computeSize(const QFontDef &fontDef, int *xsize, int *ysize, bool *outline_drawing, QFixed *scalableBitmapScaleFactor);
|
||||
QFontEngine::Properties properties() const;
|
||||
bool getSfntTable(uint tag, uchar *buffer, uint *length) const;
|
||||
|
||||
@ -96,7 +96,6 @@ public:
|
||||
FT_Face face;
|
||||
int xsize; // 26.6
|
||||
int ysize; // 26.6
|
||||
QFixed scalableBitmapScaleFactor;
|
||||
FT_Matrix matrix;
|
||||
FT_CharMap unicode_map;
|
||||
FT_CharMap symbol_map;
|
||||
@ -340,6 +339,7 @@ private:
|
||||
|
||||
FT_Size_Metrics metrics;
|
||||
mutable bool kerning_pairs_loaded;
|
||||
QFixed scalableBitmapScaleFactor;
|
||||
};
|
||||
|
||||
inline uint qHash(const QFontEngineFT::GlyphAndSubPixelPosition &g)
|
||||
|
@ -428,7 +428,7 @@ QTextHtmlImporter::QTextHtmlImporter(QTextDocument *_doc, const QString &_html,
|
||||
QString html = _html;
|
||||
const int startFragmentPos = html.indexOf(QLatin1String("<!--StartFragment-->"));
|
||||
if (startFragmentPos != -1) {
|
||||
QString qt3RichTextHeader(QLatin1String("<meta name=\"qrichtext\" content=\"1\" />"));
|
||||
const QLatin1String qt3RichTextHeader("<meta name=\"qrichtext\" content=\"1\" />");
|
||||
|
||||
// Hack for Qt3
|
||||
const bool hasQtRichtextMetaTag = html.contains(qt3RichTextHeader);
|
||||
|
@ -1418,16 +1418,16 @@ static bool setFloatAttribute(qreal *destination, const QString &value)
|
||||
return ok;
|
||||
}
|
||||
|
||||
static void setWidthAttribute(QTextLength *width, QString value)
|
||||
static void setWidthAttribute(QTextLength *width, const QString &valueStr)
|
||||
{
|
||||
bool ok = false;
|
||||
qreal realVal = value.toDouble(&ok);
|
||||
qreal realVal = valueStr.toDouble(&ok);
|
||||
if (ok) {
|
||||
*width = QTextLength(QTextLength::FixedLength, realVal);
|
||||
} else {
|
||||
value = value.trimmed();
|
||||
QStringRef value = QStringRef(&valueStr).trimmed();
|
||||
if (!value.isEmpty() && value.endsWith(QLatin1Char('%'))) {
|
||||
value.chop(1);
|
||||
value.truncate(value.size() - 1);
|
||||
realVal = value.toDouble(&ok);
|
||||
if (ok)
|
||||
*width = QTextLength(QTextLength::PercentageLength, realVal);
|
||||
@ -1438,9 +1438,7 @@ static void setWidthAttribute(QTextLength *width, QString value)
|
||||
#ifndef QT_NO_CSSPARSER
|
||||
void QTextHtmlParserNode::parseStyleAttribute(const QString &value, const QTextDocument *resourceProvider)
|
||||
{
|
||||
QString css = value;
|
||||
css.prepend(QLatin1String("* {"));
|
||||
css.append(QLatin1Char('}'));
|
||||
const QString css = QLatin1String("* {") + value + QLatin1Char('}');
|
||||
QCss::Parser parser(css);
|
||||
QCss::StyleSheet sheet;
|
||||
parser.parse(&sheet, Qt::CaseInsensitive);
|
||||
|
@ -111,7 +111,7 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format, con
|
||||
doc->addResource(QTextDocument::ImageResource, url, pm);
|
||||
}
|
||||
|
||||
if (name.contains(QStringLiteral("@2x")))
|
||||
if (name.contains(QLatin1String("@2x")))
|
||||
pm.setDevicePixelRatio(sourcePixelRatio);
|
||||
|
||||
return pm;
|
||||
|
@ -2034,7 +2034,7 @@ int QFtp::rename(const QString &oldname, const QString &newname)
|
||||
*/
|
||||
int QFtp::rawCommand(const QString &command)
|
||||
{
|
||||
QString cmd = command.trimmed() + QLatin1String("\r\n");
|
||||
const QString cmd = QStringRef(&command).trimmed() + QLatin1String("\r\n");
|
||||
return d_func()->addCommand(new QFtpCommand(RawCommand, QStringList(cmd)));
|
||||
}
|
||||
|
||||
@ -2253,8 +2253,8 @@ void QFtpPrivate::_q_startNextCommand()
|
||||
// Proxy support, replace the Login argument in place, then fall
|
||||
// through.
|
||||
if (c->command == QFtp::Login && !proxyHost.isEmpty()) {
|
||||
QString loginString = c->rawCmds.constFirst().trimmed();
|
||||
loginString += QLatin1Char('@') + host;
|
||||
QString loginString;
|
||||
loginString += QStringRef(&c->rawCmds.constFirst()).trimmed() + QLatin1Char('@') + host;
|
||||
if (port && port != 21)
|
||||
loginString += QLatin1Char(':') + QString::number(port);
|
||||
loginString += QLatin1String("\r\n");
|
||||
|
@ -306,8 +306,6 @@ void QNetworkAccessFtpBackend::ftpDone()
|
||||
state = CheckingFeatures;
|
||||
if (operation() == QNetworkAccessManager::GetOperation) {
|
||||
// send help command to find out if server supports "SIZE" and "MDTM"
|
||||
QString command = url().path();
|
||||
command.prepend(QLatin1String("%1 "));
|
||||
helpId = ftp->rawCommand(QLatin1String("HELP")); // get supported commands
|
||||
} else {
|
||||
ftpDone();
|
||||
@ -316,14 +314,13 @@ void QNetworkAccessFtpBackend::ftpDone()
|
||||
state = Statting;
|
||||
if (operation() == QNetworkAccessManager::GetOperation) {
|
||||
// logged in successfully, send the stat requests (if supported)
|
||||
QString command = url().path();
|
||||
command.prepend(QLatin1String("%1 "));
|
||||
const QString path = url().path();
|
||||
if (supportsSize) {
|
||||
ftp->rawCommand(QLatin1String("TYPE I"));
|
||||
sizeId = ftp->rawCommand(command.arg(QLatin1String("SIZE"))); // get size
|
||||
sizeId = ftp->rawCommand(QLatin1String("SIZE ") + path); // get size
|
||||
}
|
||||
if (supportsMdtm)
|
||||
mdtmId = ftp->rawCommand(command.arg(QLatin1String("MDTM"))); // get modified time
|
||||
mdtmId = ftp->rawCommand(QLatin1String("MDTM ") + path); // get modified time
|
||||
if (!supportsSize && !supportsMdtm)
|
||||
ftpDone(); // no commands sent, move to the next state
|
||||
} else {
|
||||
|
@ -1277,7 +1277,7 @@ static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx,
|
||||
time = QDateTime::currentSecsSinceEpoch() + 11644473600;
|
||||
|
||||
// represented as 100 nano seconds
|
||||
time = Q_UINT64_C(time * 10000000);
|
||||
time = time * Q_UINT64_C(10000000);
|
||||
ds << time;
|
||||
}
|
||||
|
||||
|
@ -902,10 +902,7 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
|
||||
if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_RECVIF
|
||||
&& cmsgptr->cmsg_len >= CMSG_LEN(sizeof(sockaddr_dl))) {
|
||||
sockaddr_dl *sdl = reinterpret_cast<sockaddr_dl *>(CMSG_DATA(cmsgptr));
|
||||
# if defined(Q_OS_OPENBSD)
|
||||
# define LLINDEX(s) ((s)->sdl_index)
|
||||
# endif
|
||||
header->ifindex = LLINDEX(sdl);
|
||||
header->ifindex = sdl->sdl_index;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
@ -55,7 +55,8 @@
|
||||
QSslSocket establishes a secure, encrypted TCP connection you can
|
||||
use for transmitting encrypted data. It can operate in both client
|
||||
and server mode, and it supports modern SSL protocols, including
|
||||
SSLv3 and TLSv1_0. By default, QSslSocket uses TLSv1_0, but you can
|
||||
SSL 3 and TLS 1.2. By default, QSslSocket uses only SSL protocols
|
||||
which are considered to be secure (QSsl::SecureProtocols), but you can
|
||||
change the SSL protocol by calling setProtocol() as long as you do
|
||||
it before the handshake has started.
|
||||
|
||||
@ -2394,6 +2395,13 @@ void QSslSocketPrivate::_q_disconnectedSlot()
|
||||
#endif
|
||||
disconnected();
|
||||
emit q->disconnected();
|
||||
|
||||
q->setLocalPort(0);
|
||||
q->setLocalAddress(QHostAddress());
|
||||
q->setPeerPort(0);
|
||||
q->setPeerAddress(QHostAddress());
|
||||
q->setPeerName(QString());
|
||||
cachedSocketDescriptor = -1;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -321,7 +321,7 @@ long QSslSocketPrivate::sslLibraryVersionNumber()
|
||||
|
||||
QString QSslSocketPrivate::sslLibraryVersionString()
|
||||
{
|
||||
return QStringLiteral("Secure Transport, ") + QSysInfo::prettyProductName();
|
||||
return QLatin1String("Secure Transport, ") + QSysInfo::prettyProductName();
|
||||
}
|
||||
|
||||
long QSslSocketPrivate::sslLibraryBuildVersionNumber()
|
||||
@ -436,7 +436,7 @@ void QSslSocketBackendPrivate::startClientEncryption()
|
||||
// Error description/code were set, 'error' emitted
|
||||
// by initSslContext, but OpenSSL socket also sets error
|
||||
// emits a signal twice, so ...
|
||||
setErrorAndEmit(QAbstractSocket::SslInternalError, "Unable to init SSL Context");
|
||||
setErrorAndEmit(QAbstractSocket::SslInternalError, QStringLiteral("Unable to init SSL Context"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -449,7 +449,7 @@ void QSslSocketBackendPrivate::startServerEncryption()
|
||||
// Error description/code were set, 'error' emitted
|
||||
// by initSslContext, but OpenSSL socket also sets error
|
||||
// emits a signal twice, so ...
|
||||
setErrorAndEmit(QAbstractSocket::SslInternalError, "Unable to init SSL Context");
|
||||
setErrorAndEmit(QAbstractSocket::SslInternalError, QStringLiteral("Unable to init SSL Context"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -470,7 +470,7 @@ void QSslSocketBackendPrivate::transmit()
|
||||
|
||||
if (connectionEncrypted && !writeBuffer.isEmpty()) {
|
||||
qint64 totalBytesWritten = 0;
|
||||
while (writeBuffer.nextDataBlockSize() > 0) {
|
||||
while (writeBuffer.nextDataBlockSize() > 0 && context) {
|
||||
const size_t nextDataBlockSize = writeBuffer.nextDataBlockSize();
|
||||
size_t writtenBytes = 0;
|
||||
const OSStatus err = SSLWrite(context, writeBuffer.readPointer(), nextDataBlockSize, &writtenBytes);
|
||||
@ -505,7 +505,7 @@ void QSslSocketBackendPrivate::transmit()
|
||||
|
||||
if (connectionEncrypted) {
|
||||
QVarLengthArray<char, 4096> data;
|
||||
while (true) {
|
||||
while (context) {
|
||||
size_t readBytes = 0;
|
||||
data.resize(4096);
|
||||
const OSStatus err = SSLRead(context, data.data(), data.size(), &readBytes);
|
||||
@ -780,7 +780,7 @@ bool QSslSocketBackendPrivate::initSslContext()
|
||||
|
||||
context.reset(qt_createSecureTransportContext(mode));
|
||||
if (!context) {
|
||||
setErrorAndEmit(QAbstractSocket::SslInternalError, "SSLCreateContext failed");
|
||||
setErrorAndEmit(QAbstractSocket::SslInternalError, QStringLiteral("SSLCreateContext failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -808,7 +808,7 @@ bool QSslSocketBackendPrivate::initSslContext()
|
||||
|
||||
if (!setSessionProtocol()) {
|
||||
destroySslContext();
|
||||
setErrorAndEmit(QAbstractSocket::SslInternalError, "Failed to set protocol version");
|
||||
setErrorAndEmit(QAbstractSocket::SslInternalError, QStringLiteral("Failed to set protocol version"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1121,7 +1121,10 @@ bool QSslSocketBackendPrivate::verifyPeerTrust()
|
||||
// report errors
|
||||
if (!errors.isEmpty() && !canIgnoreVerify) {
|
||||
sslErrors = errors;
|
||||
if (!checkSslErrors())
|
||||
// checkSslErrors unconditionally emits sslErrors:
|
||||
// a user's slot can abort/close/disconnect on this
|
||||
// signal, so we also test the socket's state:
|
||||
if (!checkSslErrors() || q->state() != QAbstractSocket::ConnectedState)
|
||||
return false;
|
||||
} else {
|
||||
sslErrors.clear();
|
||||
@ -1219,8 +1222,7 @@ bool QSslSocketBackendPrivate::startHandshake()
|
||||
// check protocol version ourselves, as Secure Transport does not enforce
|
||||
// the requested min / max versions.
|
||||
if (!verifySessionProtocol()) {
|
||||
setErrorAndEmit(QAbstractSocket::SslHandshakeFailedError,
|
||||
"Protocol version mismatch");
|
||||
setErrorAndEmit(QAbstractSocket::SslHandshakeFailedError, QStringLiteral("Protocol version mismatch"));
|
||||
plainSocket->disconnectFromHost();
|
||||
return false;
|
||||
}
|
||||
|
@ -412,9 +412,7 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q
|
||||
// I can only handle two types (system and unicode) so deal with them that way
|
||||
QVariant ret;
|
||||
if (flavor == QLatin1String("public.utf8-plain-text")) {
|
||||
ret = QString(QCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
|
||||
reinterpret_cast<const UInt8 *>(firstData.constData()),
|
||||
firstData.size(), CFStringGetSystemEncoding(), false)));
|
||||
ret = QString::fromUtf8(firstData);
|
||||
} else if (flavor == QLatin1String("public.utf16-plain-text")) {
|
||||
ret = QString(reinterpret_cast<const QChar *>(firstData.constData()),
|
||||
firstData.size() / sizeof(QChar));
|
||||
|
@ -66,7 +66,7 @@ Q_LOGGING_CATEGORY(qLcTray, "qt.qpa.tray")
|
||||
|
||||
static const QString KDEItemFormat = QStringLiteral("org.kde.StatusNotifierItem-%1-%2");
|
||||
static const QString KDEWatcherService = QStringLiteral("org.kde.StatusNotifierWatcher");
|
||||
static const QString TempFileTemplate = QDir::tempPath() + QStringLiteral("/qt-trayicon-XXXXXX.png");
|
||||
static const QString TempFileTemplate = QDir::tempPath() + QLatin1String("/qt-trayicon-XXXXXX.png");
|
||||
static const QString XdgNotificationService = QStringLiteral("org.freedesktop.Notifications");
|
||||
static const QString XdgNotificationPath = QStringLiteral("/org/freedesktop/Notifications");
|
||||
static const QString DefaultAction = QStringLiteral("default");
|
||||
@ -156,7 +156,7 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon)
|
||||
QDBusConnection session = QDBusConnection::sessionBus();
|
||||
uint pid = session.interface()->servicePid(KDEWatcherService).value();
|
||||
QString processName = QLockFilePrivate::processNameByPid(pid);
|
||||
necessary = processName.endsWith(QStringLiteral("indicator-application-service"));
|
||||
necessary = processName.endsWith(QLatin1String("indicator-application-service"));
|
||||
necessity_checked = true;
|
||||
}
|
||||
if (!necessary)
|
||||
|
@ -585,8 +585,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
|
||||
fallbackList.append(familyNameFromPostScriptName(item));
|
||||
}
|
||||
|
||||
if (QCoreTextFontEngine::supportsColorGlyphs())
|
||||
fallbackList.append(QLatin1String("Apple Color Emoji"));
|
||||
fallbackList.append(QLatin1String("Apple Color Emoji"));
|
||||
|
||||
// Since we are only returning a list of default fonts for the current language, we do not
|
||||
// cover all unicode completely. This was especially an issue for some of the common script
|
||||
|
@ -224,11 +224,9 @@ void QCoreTextFontEngine::init()
|
||||
synthesisFlags = 0;
|
||||
CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(ctfont);
|
||||
|
||||
#if defined(QT_PLATFORM_UIKIT) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||
if (supportsColorGlyphs() && (traits & kCTFontColorGlyphsTrait))
|
||||
if (traits & kCTFontColorGlyphsTrait)
|
||||
glyphFormat = QFontEngine::Format_ARGB;
|
||||
else
|
||||
#endif
|
||||
glyphFormat = defaultGlyphFormat;
|
||||
|
||||
if (traits & kCTFontItalicTrait)
|
||||
@ -659,9 +657,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
|
||||
CGContextSetTextPosition(ctx, pos_x + 0.5 * lineThickness().toReal(), pos_y);
|
||||
CGContextShowGlyphsWithAdvances(ctx, &cgGlyph, &CGSizeZero, 1);
|
||||
}
|
||||
}
|
||||
#if defined(QT_PLATFORM_UIKIT) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||
else if (supportsColorGlyphs()) {
|
||||
} else {
|
||||
// CGContextSetTextMatrix does not work with color glyphs, so we use
|
||||
// the CTM instead. This means we must translate the CTM as well, to
|
||||
// set the glyph position, instead of using CGContextSetTextPosition.
|
||||
@ -672,7 +668,6 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
|
||||
// glyphs in the Apple Color Emoji font, so we use CTFontDrawGlyphs instead.
|
||||
CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
CGContextRelease(ctx);
|
||||
CGColorSpaceRelease(colorspace);
|
||||
|
@ -116,21 +116,6 @@ public:
|
||||
|
||||
QFontEngine::Properties properties() const Q_DECL_OVERRIDE;
|
||||
|
||||
static bool supportsColorGlyphs()
|
||||
{
|
||||
#if defined(QT_PLATFORM_UIKIT)
|
||||
return true;
|
||||
#elif MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
|
||||
return &CTFontDrawGlyphs;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool ct_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *length);
|
||||
static QFont::Weight qtWeightFromCFWeight(float value);
|
||||
|
||||
|
@ -64,7 +64,7 @@ QTsLibMouseHandler::QTsLibMouseHandler(const QString &key,
|
||||
|
||||
QByteArray device = qgetenv("TSLIB_TSDEVICE");
|
||||
|
||||
if (specification.startsWith(QStringLiteral("/dev/")))
|
||||
if (specification.startsWith(QLatin1String("/dev/")))
|
||||
device = specification.toLocal8Bit();
|
||||
|
||||
if (device.isEmpty())
|
||||
|
@ -101,7 +101,7 @@ static inline bool detectWebBrowser(const QByteArray &desktop,
|
||||
if (desktop == QByteArray("KDE")) {
|
||||
// Konqueror launcher
|
||||
if (checkExecutable(QStringLiteral("kfmclient"), browser)) {
|
||||
browser->append(QStringLiteral(" exec"));
|
||||
browser->append(QLatin1String(" exec"));
|
||||
return true;
|
||||
}
|
||||
} else if (desktop == QByteArray("GNOME")) {
|
||||
@ -121,7 +121,7 @@ static inline bool launch(const QString &launcher, const QUrl &url)
|
||||
if (debug)
|
||||
qDebug("Launching %s", qPrintable(command));
|
||||
#if defined(QT_NO_PROCESS)
|
||||
const bool ok = ::system(qPrintable(command + QStringLiteral(" &")));
|
||||
const bool ok = ::system(qPrintable(command + QLatin1String(" &")));
|
||||
#else
|
||||
const bool ok = QProcess::startDetached(command);
|
||||
#endif
|
||||
|
@ -170,7 +170,7 @@ QStringList QGenericUnixTheme::xdgIconThemePaths()
|
||||
{
|
||||
QStringList paths;
|
||||
// Add home directory first in search path
|
||||
const QFileInfo homeIconDir(QDir::homePath() + QStringLiteral("/.icons"));
|
||||
const QFileInfo homeIconDir(QDir::homePath() + QLatin1String("/.icons"));
|
||||
if (homeIconDir.isDir())
|
||||
paths.prepend(homeIconDir.absoluteFilePath());
|
||||
|
||||
@ -247,8 +247,8 @@ public:
|
||||
static QString kdeGlobals(const QString &kdeDir, int kdeVersion)
|
||||
{
|
||||
if (kdeVersion > 4)
|
||||
return kdeDir + QStringLiteral("/kdeglobals");
|
||||
return kdeDir + QStringLiteral("/share/config/kdeglobals");
|
||||
return kdeDir + QLatin1String("/kdeglobals");
|
||||
return kdeDir + QLatin1String("/share/config/kdeglobals");
|
||||
}
|
||||
|
||||
void refresh();
|
||||
@ -559,22 +559,22 @@ QPlatformTheme *QKdeTheme::createKdeTheme()
|
||||
if (!kdeDirsVar.isEmpty())
|
||||
kdeDirs += kdeDirsVar.split(QLatin1Char(':'), QString::SkipEmptyParts);
|
||||
|
||||
const QString kdeVersionHomePath = QDir::homePath() + QStringLiteral("/.kde") + QLatin1String(kdeVersionBA);
|
||||
const QString kdeVersionHomePath = QDir::homePath() + QLatin1String("/.kde") + QLatin1String(kdeVersionBA);
|
||||
if (QFileInfo(kdeVersionHomePath).isDir())
|
||||
kdeDirs += kdeVersionHomePath;
|
||||
|
||||
const QString kdeHomePath = QDir::homePath() + QStringLiteral("/.kde");
|
||||
const QString kdeHomePath = QDir::homePath() + QLatin1String("/.kde");
|
||||
if (QFileInfo(kdeHomePath).isDir())
|
||||
kdeDirs += kdeHomePath;
|
||||
|
||||
const QString kdeRcPath = QStringLiteral("/etc/kde") + QLatin1String(kdeVersionBA) + QStringLiteral("rc");
|
||||
const QString kdeRcPath = QLatin1String("/etc/kde") + QLatin1String(kdeVersionBA) + QLatin1String("rc");
|
||||
if (QFileInfo(kdeRcPath).isReadable()) {
|
||||
QSettings kdeSettings(kdeRcPath, QSettings::IniFormat);
|
||||
kdeSettings.beginGroup(QStringLiteral("Directories-default"));
|
||||
kdeDirs += kdeSettings.value(QStringLiteral("prefixes")).toStringList();
|
||||
}
|
||||
|
||||
const QString kdeVersionPrefix = QStringLiteral("/etc/kde") + QLatin1String(kdeVersionBA);
|
||||
const QString kdeVersionPrefix = QLatin1String("/etc/kde") + QLatin1String(kdeVersionBA);
|
||||
if (QFileInfo(kdeVersionPrefix).isDir())
|
||||
kdeDirs += kdeVersionPrefix;
|
||||
|
||||
|
@ -218,6 +218,7 @@ protected:
|
||||
private:
|
||||
QVariantMap properties();
|
||||
QVariantMap propertiesMap;
|
||||
private Q_SLOTS:
|
||||
void scanReply(QDBusPendingCallWatcher *call);
|
||||
|
||||
};
|
||||
|
@ -278,7 +278,7 @@ QString TableGenerator::findComposeFile()
|
||||
|
||||
// check if user’s home directory has a file named .XCompose
|
||||
if (cleanState()) {
|
||||
QString path = qgetenv("HOME") + QStringLiteral("/.XCompose");
|
||||
QString path = qgetenv("HOME") + QLatin1String("/.XCompose");
|
||||
if (QFile::exists(path))
|
||||
return path;
|
||||
}
|
||||
|
@ -456,6 +456,10 @@ QCocoaScreen *QCocoaIntegration::screenAtIndex(int index)
|
||||
if (index >= mScreens.count())
|
||||
updateScreens();
|
||||
|
||||
// It is possible that the screen got removed while updateScreens was called
|
||||
// so we do a sanity check to be certain
|
||||
if (index >= mScreens.count())
|
||||
return 0;
|
||||
return mScreens.at(index);
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,9 @@ public:
|
||||
void setAttachedItem(NSMenuItem *item);
|
||||
NSMenuItem *attachedItem() const;
|
||||
|
||||
bool isOpen() const;
|
||||
void setIsOpen(bool isOpen);
|
||||
|
||||
private:
|
||||
QCocoaMenuItem *itemOrNull(int index) const;
|
||||
void insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem);
|
||||
@ -100,9 +103,10 @@ private:
|
||||
QList<QCocoaMenuItem *> m_menuItems;
|
||||
NSMenu *m_nativeMenu;
|
||||
NSMenuItem *m_attachedItem;
|
||||
quintptr m_tag;
|
||||
bool m_enabled;
|
||||
bool m_visible;
|
||||
quintptr m_tag;
|
||||
bool m_isOpen;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -137,12 +137,14 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate);
|
||||
- (void) menuWillOpen:(NSMenu*)m
|
||||
{
|
||||
Q_UNUSED(m);
|
||||
m_menu->setIsOpen(true);
|
||||
emit m_menu->aboutToShow();
|
||||
}
|
||||
|
||||
- (void) menuDidClose:(NSMenu*)m
|
||||
{
|
||||
Q_UNUSED(m);
|
||||
m_menu->setIsOpen(false);
|
||||
// wrong, but it's the best we can do
|
||||
emit m_menu->aboutToHide();
|
||||
}
|
||||
@ -257,9 +259,10 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
QCocoaMenu::QCocoaMenu() :
|
||||
m_attachedItem(0),
|
||||
m_tag(0),
|
||||
m_enabled(true),
|
||||
m_visible(true),
|
||||
m_tag(0)
|
||||
m_isOpen(false)
|
||||
{
|
||||
QMacAutoReleasePool pool;
|
||||
|
||||
@ -330,6 +333,8 @@ void QCocoaMenu::insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem)
|
||||
item->nsItem().target = m_nativeMenu.delegate;
|
||||
if (!item->menu())
|
||||
[item->nsItem() setAction:@selector(itemFired:)];
|
||||
else if (isOpen() && item->nsItem()) // Someone's adding new items after aboutToShow() was emitted
|
||||
item->menu()->setAttachedItem(item->nsItem());
|
||||
|
||||
if (item->isMerged())
|
||||
return;
|
||||
@ -353,6 +358,16 @@ void QCocoaMenu::insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem)
|
||||
item->setMenuParent(this);
|
||||
}
|
||||
|
||||
bool QCocoaMenu::isOpen() const
|
||||
{
|
||||
return m_isOpen;
|
||||
}
|
||||
|
||||
void QCocoaMenu::setIsOpen(bool isOpen)
|
||||
{
|
||||
m_isOpen = isOpen;
|
||||
}
|
||||
|
||||
void QCocoaMenu::removeMenuItem(QPlatformMenuItem *menuItem)
|
||||
{
|
||||
QMacAutoReleasePool pool;
|
||||
|
@ -179,9 +179,11 @@ void QCocoaMenuBar::syncMenu(QPlatformMenu *menu)
|
||||
}
|
||||
}
|
||||
|
||||
NSMenuItem *nativeMenuItem = nativeItemForMenu(cocoaMenu);
|
||||
nativeMenuItem.title = cocoaMenu->nsMenu().title;
|
||||
nativeMenuItem.hidden = shouldHide;
|
||||
if (NSMenuItem *attachedItem = cocoaMenu->attachedItem()) {
|
||||
// Non-nil attached item means the item's submenu is set
|
||||
attachedItem.title = cocoaMenu->nsMenu().title;
|
||||
attachedItem.hidden = shouldHide;
|
||||
}
|
||||
}
|
||||
|
||||
NSMenuItem *QCocoaMenuBar::nativeItemForMenu(QCocoaMenu *menu) const
|
||||
|
@ -260,34 +260,14 @@ QPixmap QCocoaTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
|
||||
}
|
||||
if (iconType != 0) {
|
||||
QPixmap pixmap;
|
||||
IconRef icon;
|
||||
IconRef overlayIcon = 0;
|
||||
if (iconType != kGenericApplicationIcon) {
|
||||
GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
|
||||
} else {
|
||||
FSRef fsRef;
|
||||
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||
GetProcessBundleLocation(&psn, &fsRef);
|
||||
GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0);
|
||||
if (sp == MessageBoxCritical) {
|
||||
overlayIcon = icon;
|
||||
GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon);
|
||||
}
|
||||
}
|
||||
IconRef icon = Q_NULLPTR;
|
||||
GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
|
||||
|
||||
if (icon) {
|
||||
pixmap = qt_mac_convert_iconref(icon, size.width(), size.height());
|
||||
ReleaseIconRef(icon);
|
||||
}
|
||||
|
||||
if (overlayIcon) {
|
||||
QSizeF littleSize = size / 2;
|
||||
QPixmap overlayPix = qt_mac_convert_iconref(overlayIcon, littleSize.width(), littleSize.height());
|
||||
QPainter painter(&pixmap);
|
||||
painter.drawPixmap(littleSize.width(), littleSize.height(), overlayPix);
|
||||
ReleaseIconRef(overlayIcon);
|
||||
}
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,8 @@ static bool _q_dontOverrideCtrlLMB = false;
|
||||
NSUInteger screenIndex = [[NSScreen screens] indexOfObject:self.window.screen];
|
||||
if (screenIndex != NSNotFound) {
|
||||
QCocoaScreen *cocoaScreen = QCocoaIntegration::instance()->screenAtIndex(screenIndex);
|
||||
QWindowSystemInterface::handleWindowScreenChanged(m_window, cocoaScreen->screen());
|
||||
if (cocoaScreen)
|
||||
QWindowSystemInterface::handleWindowScreenChanged(m_window, cocoaScreen->screen());
|
||||
m_platformWindow->updateExposedGeometry();
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath)
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
list = directLoader()->keyMap().values();
|
||||
if (!list.isEmpty()) {
|
||||
const QString postFix = QStringLiteral(" (from ")
|
||||
const QString postFix = QLatin1String(" (from ")
|
||||
+ QDir::toNativeSeparators(pluginPath)
|
||||
+ QLatin1Char(')');
|
||||
const QStringList::iterator end = list.end();
|
||||
|
@ -11,7 +11,7 @@ HEADERS = qminimalintegration.h \
|
||||
OTHER_FILES += minimal.json
|
||||
|
||||
CONFIG += qpa/genericunixfontdatabase
|
||||
darwin: DEFINES += QT_NO_FONTCONFIG
|
||||
win32|darwin: DEFINES += QT_NO_FONTCONFIG
|
||||
|
||||
PLUGIN_TYPE = platforms
|
||||
PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin
|
||||
|
@ -178,7 +178,7 @@ void QQnxRasterWindow::adjustBufferSize()
|
||||
{
|
||||
// When having a raster window we don't need any buffers, since
|
||||
// Qt will draw to the parent TLW backing store.
|
||||
const QSize windowSize = window()->parent() ? QSize(1,1) : window()->size();
|
||||
const QSize windowSize = window()->parent() ? QSize(0,0) : window()->size();
|
||||
if (windowSize != bufferSize())
|
||||
setBufferSize(windowSize);
|
||||
}
|
||||
@ -194,6 +194,13 @@ void QQnxRasterWindow::resetBuffers()
|
||||
m_currentBufferIndex = -1;
|
||||
m_previousDirty = QRegion();
|
||||
m_scrolled = QRegion();
|
||||
if (window()->parent() && bufferSize() == QSize(1,1)) {
|
||||
// If we have a parent then we're not really rendering. But if we don't render we'll
|
||||
// be invisible and any children won't show up. This should be harmless since we're
|
||||
// rendering into a 1x1 window that has transparency set to discard.
|
||||
renderBuffer();
|
||||
post(QRegion(0,0,1,1));
|
||||
}
|
||||
}
|
||||
|
||||
void QQnxRasterWindow::blitPreviousToCurrent(const QRegion ®ion, int dx, int dy, bool flush)
|
||||
|
@ -386,7 +386,12 @@ void QQnxWindow::setBufferSize(const QSize &size)
|
||||
// Set the transparency. According to QNX technical support, setting the window
|
||||
// transparency property should always be done *after* creating the window
|
||||
// buffers in order to guarantee the property is paid attention to.
|
||||
if (window()->requestedFormat().alphaBufferSize() == 0) {
|
||||
if (size.isEmpty()) {
|
||||
// We can't create 0x0 buffers and instead make them 1x1. But to allow these windows to
|
||||
// still be 'visible' (thus allowing their children to be visible), we need to allow
|
||||
// them to be posted but still not show up.
|
||||
val[0] = SCREEN_TRANSPARENCY_DISCARD;
|
||||
} else if (window()->requestedFormat().alphaBufferSize() == 0) {
|
||||
// To avoid overhead in the composition manager, disable blending
|
||||
// when the underlying window buffer doesn't have an alpha channel.
|
||||
val[0] = SCREEN_TRANSPARENCY_NONE;
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "qwindowsmime.h"
|
||||
#include "qwindowsinputcontext.h"
|
||||
#include "qwindowstabletsupport.h"
|
||||
#include "qwindowstheme.h"
|
||||
#include <private/qguiapplication_p.h>
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
# include "accessible/qwindowsaccessibility.h"
|
||||
@ -339,7 +340,9 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness;
|
||||
if (QWindowsContext::shcoredll.isValid()) {
|
||||
const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness);
|
||||
if (FAILED(hr)) {
|
||||
// E_ACCESSDENIED means set externally (MSVC manifest or external app loading Qt plugin).
|
||||
// Silence warning in that case unless debug is enabled.
|
||||
if (FAILED(hr) && (hr != E_ACCESSDENIED || lcQpaWindows().isDebugEnabled())) {
|
||||
qWarning().noquote().nospace() << "SetProcessDpiAwareness("
|
||||
<< dpiAwareness << ") failed: " << QWindowsContext::comErrorString(hr)
|
||||
<< ", using " << QWindowsContext::processDpiAwareness();
|
||||
@ -428,28 +431,29 @@ QString QWindowsContext::registerWindowClass(const QWindow *w)
|
||||
break;
|
||||
}
|
||||
// Create a unique name for the flag combination
|
||||
QString cname = QStringLiteral("Qt5QWindow");
|
||||
QString cname;
|
||||
cname += QLatin1String("Qt5QWindow");
|
||||
switch (type) {
|
||||
case Qt::Tool:
|
||||
cname += QStringLiteral("Tool");
|
||||
cname += QLatin1String("Tool");
|
||||
break;
|
||||
case Qt::ToolTip:
|
||||
cname += QStringLiteral("ToolTip");
|
||||
cname += QLatin1String("ToolTip");
|
||||
break;
|
||||
case Qt::Popup:
|
||||
cname += QStringLiteral("Popup");
|
||||
cname += QLatin1String("Popup");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (style & CS_DROPSHADOW)
|
||||
cname += QStringLiteral("DropShadow");
|
||||
cname += QLatin1String("DropShadow");
|
||||
if (style & CS_SAVEBITS)
|
||||
cname += QStringLiteral("SaveBits");
|
||||
cname += QLatin1String("SaveBits");
|
||||
if (style & CS_OWNDC)
|
||||
cname += QStringLiteral("OwnDC");
|
||||
cname += QLatin1String("OwnDC");
|
||||
if (icon)
|
||||
cname += QStringLiteral("Icon");
|
||||
cname += QLatin1String("Icon");
|
||||
|
||||
return registerWindowClass(cname, qWindowsWndProc, style, GetSysColorBrush(COLOR_WINDOW), icon);
|
||||
}
|
||||
@ -714,8 +718,8 @@ static inline QString errorMessageFromComError(const _com_error &comError)
|
||||
return result;
|
||||
}
|
||||
if (const WORD wCode = comError.WCode())
|
||||
return QStringLiteral("IDispatch error #") + QString::number(wCode);
|
||||
return QStringLiteral("Unknown error 0x0") + QString::number(comError.Error(), 16);
|
||||
return QString::asprintf("IDispatch error #%u", uint(wCode));
|
||||
return QString::asprintf("Unknown error 0x0%x", uint(comError.Error()));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -736,6 +740,9 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr)
|
||||
case E_UNEXPECTED:
|
||||
result += QByteArrayLiteral("E_UNEXPECTED");
|
||||
break;
|
||||
case E_ACCESSDENIED:
|
||||
result += QByteArrayLiteral("E_ACCESSDENIED");
|
||||
break;
|
||||
case CO_E_ALREADYINITIALIZED:
|
||||
result += QByteArrayLiteral("CO_E_ALREADYINITIALIZED");
|
||||
break;
|
||||
@ -891,6 +898,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
|
||||
#endif
|
||||
case QtWindows::DisplayChangedEvent:
|
||||
return d->m_screenManager.handleDisplayChange(wParam, lParam);
|
||||
if (QWindowsTheme *t = QWindowsTheme::instance())
|
||||
t->displayChanged();
|
||||
case QtWindows::SettingChangedEvent:
|
||||
return d->m_screenManager.handleScreenChanges();
|
||||
default:
|
||||
|
@ -367,7 +367,7 @@ QSurfaceFormat QWindowsEGLStaticContext::formatFromConfig(EGLDisplay display, EG
|
||||
\list
|
||||
\o Install the Direct X SDK
|
||||
\o Checkout and build ANGLE (SVN repository) as explained here:
|
||||
\l{http://code.google.com/p/angleproject/wiki/DevSetup}{ANGLE-Project}.
|
||||
\l{https://chromium.googlesource.com/angle/angle/+/master/README.md}
|
||||
When building for 64bit, de-activate the "WarnAsError" option
|
||||
in every project file (as otherwise integer conversion
|
||||
warnings will break the build).
|
||||
|
@ -696,7 +696,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
|
||||
QByteArray data = getData(CF_UNICODETEXT, pDataObj);
|
||||
if (!data.isEmpty()) {
|
||||
str = QString::fromWCharArray(reinterpret_cast<const wchar_t *>(data.constData()));
|
||||
str.replace(QStringLiteral("\r\n"), QStringLiteral("\n"));
|
||||
str.replace(QLatin1String("\r\n"), QLatin1String("\n"));
|
||||
} else {
|
||||
data = getData(CF_TEXT, pDataObj);
|
||||
if (!data.isEmpty()) {
|
||||
|
@ -420,6 +420,8 @@ static bool isValidWheelReceiver(QWindow *candidate)
|
||||
{
|
||||
if (candidate) {
|
||||
const QWindow *toplevel = QWindowsWindow::topLevelOf(candidate);
|
||||
if (toplevel->type() == Qt::ForeignWindow)
|
||||
return true;
|
||||
if (const QWindowsWindow *ww = QWindowsWindow::windowsWindowOf(toplevel))
|
||||
return !ww->testFlag(QWindowsWindow::BlockedByModal);
|
||||
}
|
||||
|
@ -226,15 +226,16 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
|
||||
if (!glesOnly && testDesktopGL())
|
||||
result |= QWindowsOpenGLTester::DesktopGl;
|
||||
|
||||
QSet<QString> features;
|
||||
const char bugListFileVar[] = "QT_OPENGL_BUGLIST";
|
||||
QString buglistFileName = QStringLiteral(":/qt-project.org/windows/openglblacklists/default.json");
|
||||
|
||||
if (qEnvironmentVariableIsSet(bugListFileVar)) {
|
||||
const QString fileName = resolveBugListFile(QFile::decodeName(qgetenv(bugListFileVar)));
|
||||
if (!fileName.isEmpty())
|
||||
features = QOpenGLConfig::gpuFeatures(qgpu, fileName);
|
||||
} else {
|
||||
features = QOpenGLConfig::gpuFeatures(qgpu, QStringLiteral(":/qt-project.org/windows/openglblacklists/default.json"));
|
||||
buglistFileName = fileName;
|
||||
}
|
||||
|
||||
QSet<QString> features = QOpenGLConfig::gpuFeatures(qgpu, buglistFileName);
|
||||
qCDebug(lcQpaGl) << "GPU features:" << features;
|
||||
|
||||
if (features.contains(QStringLiteral("disable_desktopgl"))) { // Qt-specific
|
||||
|
@ -87,9 +87,8 @@ static inline QString mailCommand()
|
||||
keyName = QString::fromWCharArray(command);
|
||||
RegCloseKey(handle);
|
||||
}
|
||||
if (keyName.isEmpty())
|
||||
keyName = QStringLiteral("mailto");
|
||||
keyName += QStringLiteral("\\Shell\\Open\\Command");
|
||||
const QLatin1String mailto = keyName.isEmpty() ? QLatin1String("mailto") : QLatin1String();
|
||||
keyName += mailto + QLatin1String("\\Shell\\Open\\Command");
|
||||
if (debug)
|
||||
qDebug() << __FUNCTION__ << "keyName=" << keyName;
|
||||
command[0] = 0;
|
||||
@ -123,7 +122,7 @@ static inline bool launchMail(const QUrl &url)
|
||||
}
|
||||
// Pass the url as the parameter. Should use QProcess::startDetached(),
|
||||
// but that cannot handle a Windows command line [yet].
|
||||
command.replace(QStringLiteral("%1"), url.toString(QUrl::FullyEncoded));
|
||||
command.replace(QLatin1String("%1"), url.toString(QUrl::FullyEncoded));
|
||||
if (debug)
|
||||
qDebug() << __FUNCTION__ << "Launching" << command;
|
||||
//start the process
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QWindow>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QScopedArrayPointer>
|
||||
#include <QtCore/QVarLengthArray>
|
||||
#include <QtCore/QtMath>
|
||||
|
||||
#include <private/qguiapplication_p.h>
|
||||
@ -233,7 +233,7 @@ QString QWindowsTabletSupport::description() const
|
||||
const unsigned size = m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_WINTABID, 0);
|
||||
if (!size)
|
||||
return QString();
|
||||
QScopedPointer<TCHAR> winTabId(new TCHAR[size + 1]);
|
||||
QVarLengthArray<TCHAR> winTabId(size + 1);
|
||||
m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_WINTABID, winTabId.data());
|
||||
WORD implementationVersion = 0;
|
||||
m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_IMPLVERSION, &implementationVersion);
|
||||
@ -246,11 +246,11 @@ QString QWindowsTabletSupport::description() const
|
||||
.arg(implementationVersion >> 8).arg(implementationVersion & 0xFF)
|
||||
.arg(opts, 0, 16);
|
||||
if (opts & CXO_MESSAGES)
|
||||
result += QStringLiteral(" CXO_MESSAGES");
|
||||
result += QLatin1String(" CXO_MESSAGES");
|
||||
if (opts & CXO_CSRMESSAGES)
|
||||
result += QStringLiteral(" CXO_CSRMESSAGES");
|
||||
result += QLatin1String(" CXO_CSRMESSAGES");
|
||||
if (m_tiltSupport)
|
||||
result += QStringLiteral(" tilt");
|
||||
result += QLatin1String(" tilt");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -319,6 +319,7 @@ QWindowsTheme::QWindowsTheme()
|
||||
std::fill(m_fonts, m_fonts + NFonts, static_cast<QFont *>(0));
|
||||
std::fill(m_palettes, m_palettes + NPalettes, static_cast<QPalette *>(0));
|
||||
refresh();
|
||||
refreshIconPixmapSizes();
|
||||
}
|
||||
|
||||
QWindowsTheme::~QWindowsTheme()
|
||||
@ -330,7 +331,7 @@ QWindowsTheme::~QWindowsTheme()
|
||||
|
||||
static inline QStringList iconThemeSearchPaths()
|
||||
{
|
||||
const QFileInfo appDir(QCoreApplication::applicationDirPath() + QStringLiteral("/icons"));
|
||||
const QFileInfo appDir(QCoreApplication::applicationDirPath() + QLatin1String("/icons"));
|
||||
return appDir.isDir() ? QStringList(appDir.absoluteFilePath()) : QStringList();
|
||||
}
|
||||
|
||||
@ -382,16 +383,8 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const
|
||||
return QVariant(int(WindowsKeyboardScheme));
|
||||
case UiEffects:
|
||||
return QVariant(uiEffects());
|
||||
case IconPixmapSizes: {
|
||||
QList<int> sizes;
|
||||
sizes << 16 << 32;
|
||||
#ifdef USE_IIMAGELIST
|
||||
sizes << 48; // sHIL_EXTRALARGE
|
||||
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
|
||||
sizes << 256; // SHIL_JUMBO
|
||||
#endif // USE_IIMAGELIST
|
||||
return QVariant::fromValue(sizes);
|
||||
}
|
||||
case IconPixmapSizes:
|
||||
return m_fileIconSizes;
|
||||
case DialogSnapToDefaultButton:
|
||||
return QVariant(booleanSystemParametersInfo(SPI_GETSNAPTODEFBUTTON, false));
|
||||
case ContextMenuOnMouseRelease:
|
||||
@ -459,6 +452,15 @@ void QWindowsTheme::refreshFonts()
|
||||
m_fonts[FixedFont] = new QFont(fixedFont);
|
||||
}
|
||||
|
||||
enum FileIconSize {
|
||||
// Standard icons obtainable via shGetFileInfo(), SHGFI_SMALLICON, SHGFI_LARGEICON
|
||||
SmallFileIcon, LargeFileIcon,
|
||||
// Larger icons obtainable via SHGetImageList()
|
||||
ExtraLargeFileIcon,
|
||||
JumboFileIcon, // Vista onwards
|
||||
FileIconSizeCount
|
||||
};
|
||||
|
||||
bool QWindowsTheme::usePlatformNativeDialog(DialogType type) const
|
||||
{
|
||||
return QWindowsDialogs::useHelper(type);
|
||||
@ -475,6 +477,27 @@ void QWindowsTheme::windowsThemeChanged(QWindow * window)
|
||||
QWindowSystemInterface::handleThemeChange(window);
|
||||
}
|
||||
|
||||
static int fileIconSizes[FileIconSizeCount];
|
||||
|
||||
void QWindowsTheme::refreshIconPixmapSizes()
|
||||
{
|
||||
// Standard sizes: 16, 32, 48, 256
|
||||
fileIconSizes[SmallFileIcon] = GetSystemMetrics(SM_CXSMICON); // corresponds to SHGFI_SMALLICON);
|
||||
fileIconSizes[LargeFileIcon] = GetSystemMetrics(SM_CXICON); // corresponds to SHGFI_LARGEICON
|
||||
fileIconSizes[ExtraLargeFileIcon] =
|
||||
fileIconSizes[LargeFileIcon] + fileIconSizes[LargeFileIcon] / 2;
|
||||
fileIconSizes[JumboFileIcon] = 8 * fileIconSizes[LargeFileIcon]; // empirical, has not been observed to work
|
||||
QList<int> sizes;
|
||||
sizes << fileIconSizes[SmallFileIcon] << fileIconSizes[LargeFileIcon];
|
||||
#ifdef USE_IIMAGELIST
|
||||
sizes << fileIconSizes[ExtraLargeFileIcon]; // sHIL_EXTRALARGE
|
||||
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
|
||||
sizes << fileIconSizes[JumboFileIcon]; // SHIL_JUMBO
|
||||
#endif // USE_IIMAGELIST
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << sizes;
|
||||
m_fileIconSizes = QVariant::fromValue(sizes);
|
||||
}
|
||||
|
||||
// Defined in qpixmap_win.cpp
|
||||
Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);
|
||||
|
||||
@ -702,10 +725,12 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s
|
||||
QPixmap pixmap;
|
||||
const QString filePath = QDir::toNativeSeparators(fileInfo.filePath());
|
||||
const int width = int(size.width());
|
||||
const int iconSize = width > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON;
|
||||
const int iconSize = width > fileIconSizes[SmallFileIcon] ? SHGFI_LARGEICON : SHGFI_SMALLICON;
|
||||
const int requestedImageListSize =
|
||||
#ifdef USE_IIMAGELIST
|
||||
width > 48 ? sHIL_JUMBO : (width > 32 ? sHIL_EXTRALARGE : 0);
|
||||
width > fileIconSizes[ExtraLargeFileIcon]
|
||||
? sHIL_JUMBO
|
||||
: (width > fileIconSizes[LargeFileIcon] ? sHIL_EXTRALARGE : 0);
|
||||
#else
|
||||
0;
|
||||
#endif // !USE_IIMAGELIST
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include "qwindowsthreadpoolrunner.h"
|
||||
#include <qpa/qplatformtheme.h>
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWindow;
|
||||
@ -68,6 +70,7 @@ public:
|
||||
QPlatformTheme::IconOptions iconOptions = 0) const Q_DECL_OVERRIDE;
|
||||
|
||||
void windowsThemeChanged(QWindow *window);
|
||||
void displayChanged() { refreshIconPixmapSizes(); }
|
||||
|
||||
static const char *name;
|
||||
|
||||
@ -77,11 +80,13 @@ private:
|
||||
void refreshPalettes();
|
||||
void clearFonts();
|
||||
void refreshFonts();
|
||||
void refreshIconPixmapSizes();
|
||||
|
||||
static QWindowsTheme *m_instance;
|
||||
QPalette *m_palettes[NPalettes];
|
||||
QFont *m_fonts[NFonts];
|
||||
mutable QWindowsThreadPoolRunner m_threadPoolRunner;
|
||||
QVariant m_fileIconSizes;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -2395,9 +2395,10 @@ void QWindowsWindow::aboutToMakeCurrent()
|
||||
|
||||
void QWindowsWindow::setHasBorderInFullScreenStatic(QWindow *window, bool border)
|
||||
{
|
||||
if (!window->handle())
|
||||
return;
|
||||
static_cast<QWindowsWindow *>(window->handle())->setHasBorderInFullScreen(border);
|
||||
if (QPlatformWindow *handle = window->handle())
|
||||
static_cast<QWindowsWindow *>(handle)->setHasBorderInFullScreen(border);
|
||||
else
|
||||
qWarning("%s invoked without window handle; call has no effect.", Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
void QWindowsWindow::setHasBorderInFullScreen(bool border)
|
||||
|
@ -102,7 +102,7 @@ QMimeData *QWinRTClipboard::mimeData(QClipboard::Mode mode)
|
||||
quint32 size;
|
||||
const wchar_t *textStr = result.GetRawBuffer(&size);
|
||||
QString text = QString::fromWCharArray(textStr, size);
|
||||
text.replace(QStringLiteral("\r\n"), QStringLiteral("\n"));
|
||||
text.replace(QLatin1String("\r\n"), QLatin1String("\n"));
|
||||
m_mimeData.setText(text);
|
||||
|
||||
return &m_mimeData;
|
||||
|
@ -504,8 +504,8 @@ static HRESULT qt_drop(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventA
|
||||
class QtDragEventHandler##name : public IDragEventHandler \
|
||||
{ \
|
||||
public: \
|
||||
virtual HRESULT STDMETHODCALLTYPE Invoke(IInspectable *sender, \
|
||||
ABI::Windows::UI::Xaml::IDragEventArgs *e) \
|
||||
STDMETHODIMP Invoke(IInspectable *sender, \
|
||||
ABI::Windows::UI::Xaml::IDragEventArgs *e) \
|
||||
{ \
|
||||
return qt_##func(sender, e);\
|
||||
} \
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user