Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: mkspecs/win32-clang-msvc/qmake.conf src/gui/image/qpnghandler.cpp Change-Id: Ied79d02912ffb3a307a99483df7db08c7f9d0cd8
This commit is contained in:
commit
a20da2353c
@ -51,7 +51,4 @@ QMAKE_CFLAGS_OPTIMIZE_FULL = /clang:-O3
|
||||
|
||||
QMAKE_LFLAGS_RELEASE += /OPT:REF,ICF,LBR
|
||||
|
||||
# Precompiled headers are not supported yet by clang
|
||||
CONFIG -= precompile_header
|
||||
|
||||
load(qt_config)
|
||||
|
@ -856,7 +856,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
QString lib_file = QMakeMetaInfo::checkLib(Option::normalizePath(
|
||||
(*lit) + Option::dir_sep + lib + Option::prl_ext));
|
||||
if (!lib_file.isEmpty()) {
|
||||
QMakeMetaInfo libinfo(project);
|
||||
QMakeMetaInfo libinfo;
|
||||
if(libinfo.readLib(lib_file)) {
|
||||
if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) {
|
||||
library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET");
|
||||
|
@ -912,7 +912,7 @@ MakefileGenerator::processPrlFileCore(QString &origFile, const QStringRef &origN
|
||||
const QString meta_file = QMakeMetaInfo::checkLib(fixedFile);
|
||||
if (meta_file.isEmpty())
|
||||
return false;
|
||||
QMakeMetaInfo libinfo(project);
|
||||
QMakeMetaInfo libinfo;
|
||||
debug_msg(1, "Processing PRL file: %s", meta_file.toLatin1().constData());
|
||||
if (!libinfo.readLib(meta_file)) {
|
||||
fprintf(stderr, "Error processing meta file %s\n", meta_file.toLatin1().constData());
|
||||
|
@ -407,7 +407,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
const ProStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES");
|
||||
ProStringList::ConstIterator it;
|
||||
for(it = l.begin(); it != l.end(); ++it) {
|
||||
QMakeMetaInfo libinfo(project);
|
||||
QMakeMetaInfo libinfo;
|
||||
if (libinfo.readLib((*it).toQString()) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) {
|
||||
ProString dir;
|
||||
int slsh = (*it).lastIndexOf(Option::dir_sep);
|
||||
|
@ -165,21 +165,17 @@ QString NmakeMakefileGenerator::var(const ProKey &value) const
|
||||
|| value == "QMAKE_RUN_CXX_IMP"
|
||||
|| value == "QMAKE_RUN_CXX");
|
||||
if ((isRunCpp && usePCH) || (isRunC && usePCHC)) {
|
||||
QFileInfo precompHInfo(fileInfo(precompH));
|
||||
QString precompH_f = escapeFilePath(precompHInfo.fileName());
|
||||
QString precompH_f = escapeFilePath(fileFixify(precompH, FileFixifyBackwards));
|
||||
QString precompRule = QString("-c -FI%1 -Yu%2 -Fp%3")
|
||||
.arg(precompH_f, precompH_f, escapeFilePath(isRunC ? precompPchC : precompPch));
|
||||
// ### For clang_cl 8 we force inline methods to be compiled here instead
|
||||
// linking them from a pch.o file. We do this by pretending we are also doing
|
||||
// the pch.o generation step.
|
||||
if (project->isActiveConfig("clang_cl"))
|
||||
precompRule += QString(" -Xclang -building-pch-with-obj");
|
||||
QString p = MakefileGenerator::var(value);
|
||||
p.replace(QLatin1String("-c"), precompRule);
|
||||
// Cannot use -Gm with -FI & -Yu, as this gives an
|
||||
// internal compiler error, on the newer compilers
|
||||
// ### work-around for a VS 2003 bug. Move to some prf file or remove completely.
|
||||
p.remove("-Gm");
|
||||
return p;
|
||||
} else if (value == "QMAKE_CXXFLAGS") {
|
||||
// Remove internal compiler error option
|
||||
// ### work-around for a VS 2003 bug. Move to some prf file or remove completely.
|
||||
return MakefileGenerator::var(value).remove("-Gm");
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,7 +234,10 @@ void NmakeMakefileGenerator::init()
|
||||
precompObj = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch" + Option::obj_ext;
|
||||
precompPch = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch.pch";
|
||||
// Add linking of precompObj (required for whole precompiled classes)
|
||||
project->values("OBJECTS") += precompObj;
|
||||
// ### For clang_cl we currently let inline methods be generated in the normal objects,
|
||||
// since the PCH object is buggy (as of clang 8.0.0)
|
||||
if (!project->isActiveConfig("clang_cl"))
|
||||
project->values("OBJECTS") += precompObj;
|
||||
// Add pch file to cleanup
|
||||
project->values("QMAKE_CLEAN") += precompPch;
|
||||
// Return to variable pool
|
||||
@ -248,7 +247,8 @@ void NmakeMakefileGenerator::init()
|
||||
if (usePCHC) {
|
||||
precompObjC = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch_c" + Option::obj_ext;
|
||||
precompPchC = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch_c.pch";
|
||||
project->values("OBJECTS") += precompObjC;
|
||||
if (!project->isActiveConfig("clang_cl"))
|
||||
project->values("OBJECTS") += precompObjC;
|
||||
project->values("QMAKE_CLEAN") += precompPchC;
|
||||
project->values("PRECOMPILED_OBJECT_C") = ProStringList(precompObjC);
|
||||
project->values("PRECOMPILED_PCH_C") = ProStringList(precompPchC);
|
||||
|
@ -1063,16 +1063,6 @@ void VcprojGenerator::initCompilerTool()
|
||||
conf.compiler.PrecompiledHeaderFile = "$(IntDir)\\" + precompPch;
|
||||
conf.compiler.PrecompiledHeaderThrough = project->first("PRECOMPILED_HEADER").toQString();
|
||||
conf.compiler.ForcedIncludeFiles = project->values("PRECOMPILED_HEADER").toQStringList();
|
||||
|
||||
if (conf.CompilerVersion <= NET2003) {
|
||||
// Minimal build option triggers an Internal Compiler Error
|
||||
// when used in conjunction with /FI and /Yu, so remove it
|
||||
// ### work-around for a VS 2003 bug. Move to some prf file or remove completely.
|
||||
project->values("QMAKE_CFLAGS_DEBUG").removeAll("-Gm");
|
||||
project->values("QMAKE_CFLAGS_DEBUG").removeAll("/Gm");
|
||||
project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("-Gm");
|
||||
project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("/Gm");
|
||||
}
|
||||
}
|
||||
|
||||
conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS"));
|
||||
|
@ -260,25 +260,31 @@ static int installFile(const QString &source, const QString &target, bool exe =
|
||||
return 3;
|
||||
}
|
||||
|
||||
QFileDevice::Permissions targetPermissions = QFileDevice::ReadOwner | QFileDevice::WriteOwner
|
||||
| QFileDevice::ReadUser | QFileDevice::WriteUser
|
||||
| QFileDevice::ReadGroup | QFileDevice::ReadOther;
|
||||
if (exe) {
|
||||
targetPermissions |= QFileDevice::ExeOwner | QFileDevice::ExeUser |
|
||||
QFileDevice::ExeGroup | QFileDevice::ExeOther;
|
||||
}
|
||||
if (!targetFile.setPermissions(targetPermissions)) {
|
||||
fprintf(stderr, "Error setting permissions on %s: %s\n",
|
||||
qPrintable(target), qPrintable(targetFile.errorString()));
|
||||
return 3;
|
||||
if (!targetFile.setPermissions(sourceFile.permissions() | QFileDevice::ExeOwner | QFileDevice::ExeUser |
|
||||
QFileDevice::ExeGroup | QFileDevice::ExeOther)) {
|
||||
fprintf(stderr, "Error setting execute permissions on %s: %s\n",
|
||||
qPrintable(target), qPrintable(targetFile.errorString()));
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy file times
|
||||
QString error;
|
||||
#ifdef Q_OS_WIN
|
||||
const QFile::Permissions permissions = targetFile.permissions();
|
||||
const bool readOnly = !(permissions & QFile::WriteUser);
|
||||
if (readOnly)
|
||||
targetFile.setPermissions(permissions | QFile::WriteUser);
|
||||
#endif
|
||||
if (!IoUtils::touchFile(target, sourceFile.fileName(), &error)) {
|
||||
fprintf(stderr, "%s", qPrintable(error));
|
||||
return 3;
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
if (readOnly)
|
||||
targetFile.setPermissions(permissions);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -35,13 +35,6 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
QHash<QString, ProValueMap> QMakeMetaInfo::cache_vars;
|
||||
|
||||
QMakeMetaInfo::QMakeMetaInfo(QMakeProject *_conf)
|
||||
: conf(_conf)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
QMakeMetaInfo::readLib(const QString &meta_file)
|
||||
{
|
||||
|
@ -41,11 +41,9 @@ class QMakeProject;
|
||||
|
||||
class QMakeMetaInfo
|
||||
{
|
||||
QMakeProject *conf;
|
||||
ProValueMap vars;
|
||||
static QHash<QString, ProValueMap> cache_vars;
|
||||
public:
|
||||
QMakeMetaInfo(QMakeProject *_conf);
|
||||
|
||||
// These functions expect the path to be normalized
|
||||
static QString checkLib(const QString &lib);
|
||||
|
2
src/3rdparty/wintab/LICENSE.txt
vendored
Normal file
2
src/3rdparty/wintab/LICENSE.txt
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
The text and information contained in this file may be freely used,
|
||||
copied, or distributed without compensation or licensing restrictions.
|
6
src/3rdparty/wintab/qt_attribution.json
vendored
6
src/3rdparty/wintab/qt_attribution.json
vendored
@ -5,9 +5,9 @@
|
||||
"QtUsage": "Used in the Qt platform plugin for Windows. Configure with -no-feature-tabletevent to avoid.",
|
||||
|
||||
"Description": "Wintab is a de facto API for pointing devices on Windows.",
|
||||
"Version": "Upstream no longer offers updates; treat as final",
|
||||
"Homepage": "http://www.pointing.com/Wintab.html",
|
||||
"License": "Public Domain",
|
||||
"PackageComment": "Upstream http://www.pointing.com/Wintab.html no longer offers updates; treat as final",
|
||||
"License": "Custom License",
|
||||
"LicenseFile": "LICENSE.txt",
|
||||
"LicenseId": "NONE",
|
||||
"Copyright": "Copyright 1991-1998 by LCS/Telegraphics."
|
||||
}
|
||||
|
@ -79,10 +79,9 @@ msvc {
|
||||
# /Oy: Omits frame pointer (x86 only).
|
||||
# /Gy: Enables function-level linking.
|
||||
# /GS: Buffers security check.
|
||||
# /Gm-: Disable minimal rebuild.
|
||||
# /RTC1: Run time error checking
|
||||
QMAKE_CFLAGS_RELEASE += -Oy- -Gy -GS -Gm-
|
||||
QMAKE_CFLAGS_DEBUG += -Oy- -Gy -GS -Gm- -RTC1
|
||||
QMAKE_CFLAGS_RELEASE += -Oy- -Gy -GS
|
||||
QMAKE_CFLAGS_DEBUG += -Oy- -Gy -GS -RTC1
|
||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -Zi $$QMAKE_CFLAGS_RELEASE
|
||||
|
||||
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
|
||||
|
@ -57,6 +57,7 @@
|
||||
#include "private/qloggingregistry_p.h"
|
||||
#include "private/qcoreapplication_p.h"
|
||||
#include "private/qsimd_p.h"
|
||||
#include <qtcore_tracepoints_p.h>
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
#include <qt_windows.h>
|
||||
@ -1811,6 +1812,8 @@ static void ungrabMessageHandler() { }
|
||||
static void qt_message_print(QtMsgType msgType, const QMessageLogContext &context, const QString &message)
|
||||
{
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
Q_TRACE(qt_message_print, msgType, context.category, context.function, context.file, context.line, message);
|
||||
|
||||
// qDebug, qWarning, ... macros do not check whether category is enabled
|
||||
if (isDefaultCategory(context.category)) {
|
||||
if (QLoggingCategory *defaultCategory = QLoggingCategory::defaultCategory()) {
|
||||
|
@ -60,12 +60,18 @@
|
||||
# undef _POSIX_
|
||||
#endif
|
||||
#include <qcoreapplication.h>
|
||||
#include <qcoreevent.h>
|
||||
#include <qiodevice.h>
|
||||
#include <qlist.h>
|
||||
#include <qvariant.h> /* All moc genereated code has this include */
|
||||
#include <qobject.h>
|
||||
#include <qregexp.h>
|
||||
#include <qscopedpointer.h>
|
||||
#include <qshareddata.h>
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qtimer.h>
|
||||
#include <qvector.h>
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include <qtextcodec.h>
|
||||
#endif
|
||||
|
@ -52,11 +52,18 @@
|
||||
//
|
||||
|
||||
/*
|
||||
* The Qt tracepoints API consists of only three macros:
|
||||
* The Qt tracepoints API consists of only five macros:
|
||||
*
|
||||
* - Q_TRACE(tracepoint, args...)
|
||||
* Fires 'tracepoint' if it is enabled.
|
||||
*
|
||||
* - Q_TRACE_EXIT(tracepoint, args...)
|
||||
* Fires 'tracepoint' if it is enabled when the current scope exists.
|
||||
*
|
||||
* - Q_TRACE_SCOPE(tracepoint, args...)
|
||||
* Wrapper around Q_TRACE/_EXIT to trace entry and exit. First it traces
|
||||
* `${tracepoint}_entry` and then `${tracepoint}_exit` on scope exit.
|
||||
*
|
||||
* - Q_UNCONDITIONAL_TRACE(tracepoint, args...)
|
||||
* Fires 'tracepoint' unconditionally: no check is performed to query
|
||||
* whether 'tracepoint' is enabled.
|
||||
@ -110,17 +117,25 @@
|
||||
*/
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qscopeguard.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
|
||||
# define Q_HAS_TRACEPOINTS 1
|
||||
# define Q_TRACE(x, ...) QtPrivate::trace_ ## x(__VA_ARGS__)
|
||||
# define Q_TRACE_EXIT(x, ...) \
|
||||
const auto qTraceExit_ ## x ## __COUNTER__ = qScopeGuard([&]() { Q_TRACE(x, __VA_ARGS__); });
|
||||
# define Q_TRACE_SCOPE(x, ...) \
|
||||
Q_TRACE(x ## _entry, __VA_ARGS__); \
|
||||
Q_TRACE_EXIT(x ## _exit, __VA_ARGS__);
|
||||
# define Q_UNCONDITIONAL_TRACE(x, ...) QtPrivate::do_trace_ ## x(__VA_ARGS__)
|
||||
# define Q_TRACE_ENABLED(x) QtPrivate::trace_ ## x ## _enabled()
|
||||
#else
|
||||
# define Q_HAS_TRACEPOINTS 0
|
||||
# define Q_TRACE(x, ...)
|
||||
# define Q_TRACE_EXIT(x, ...)
|
||||
# define Q_TRACE_SCOPE(x, ...)
|
||||
# define Q_UNCONDITIONAL_TRACE(x, ...)
|
||||
# define Q_TRACE_ENABLED(x) false
|
||||
#endif // defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
|
||||
|
@ -86,15 +86,6 @@ static void appendOrganizationAndApp(QString &path) // Courtesy qstandardpaths_u
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline QString displayName(QStandardPaths::StandardLocation type)
|
||||
{
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
return QStandardPaths::displayName(type);
|
||||
#else
|
||||
return QString::number(type);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void appendTestMode(QString &path)
|
||||
{
|
||||
if (QStandardPaths::isTestModeEnabled())
|
||||
|
@ -769,7 +769,7 @@ QCoreApplication::QCoreApplication(int &argc, char **argv
|
||||
|
||||
void QCoreApplicationPrivate::init()
|
||||
{
|
||||
Q_TRACE(QCoreApplicationPrivate_init_entry);
|
||||
Q_TRACE_SCOPE(QCoreApplicationPrivate_init);
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
QMacAutoReleasePool pool;
|
||||
@ -869,8 +869,6 @@ void QCoreApplicationPrivate::init()
|
||||
#ifndef QT_NO_QOBJECT
|
||||
is_app_running = true; // No longer starting up.
|
||||
#endif
|
||||
|
||||
Q_TRACE(QCoreApplicationPrivate_init_exit);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1185,7 +1183,7 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event)
|
||||
{
|
||||
// Note: when adjusting the tracepoints in here
|
||||
// consider adjusting QApplicationPrivate::notify_helper too.
|
||||
Q_TRACE(QCoreApplication_notify_entry, receiver, event, event->type());
|
||||
Q_TRACE_SCOPE(QCoreApplication_notify, receiver, event, event->type());
|
||||
|
||||
// send to all application event filters (only does anything in the main thread)
|
||||
if (QCoreApplication::self
|
||||
@ -1484,7 +1482,7 @@ bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event)
|
||||
*/
|
||||
void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
|
||||
{
|
||||
Q_TRACE(QCoreApplication_postEvent_entry, receiver, event, event->type());
|
||||
Q_TRACE_SCOPE(QCoreApplication_postEvent, receiver, event, event->type());
|
||||
|
||||
if (receiver == 0) {
|
||||
qWarning("QCoreApplication::postEvent: Unexpected null receiver");
|
||||
|
@ -1,3 +1,9 @@
|
||||
{
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QEvent;
|
||||
QT_END_NAMESPACE
|
||||
}
|
||||
|
||||
QCoreApplicationPrivate_init_entry()
|
||||
QCoreApplicationPrivate_init_exit()
|
||||
|
||||
@ -10,6 +16,7 @@ QEvent_ctor(QEvent *event, int type)
|
||||
QEvent_dtor(QEvent *event, int type)
|
||||
|
||||
QCoreApplication_postEvent_entry(QObject *receiver, QEvent *event, int type)
|
||||
QCoreApplication_postEvent_exit(QObject *receiver, QEvent *event, int type)
|
||||
QCoreApplication_postEvent_event_compressed(QObject *receiver, QEvent *event)
|
||||
QCoreApplication_postEvent_event_posted(QObject *receiver, QEvent *event, int type)
|
||||
|
||||
@ -17,6 +24,7 @@ QCoreApplication_sendEvent(QObject *receiver, QEvent *event, int type)
|
||||
QCoreApplication_sendSpontaneousEvent(QObject *receiver, QEvent *event, int type)
|
||||
|
||||
QCoreApplication_notify_entry(QObject *receiver, QEvent *event, int type)
|
||||
QCoreApplication_notify_exit(QObject *receiver, QEvent *event, int type)
|
||||
QCoreApplication_notify_event_filtered(QObject *receiver, QEvent *event, int type)
|
||||
QCoreApplication_notify_before_delivery(QObject *receiver, QEvent *event, int type)
|
||||
QCoreApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed)
|
||||
@ -32,3 +40,5 @@ QMetaObject_activate_begin_slot_functor(void *slotObject)
|
||||
QMetaObject_activate_end_slot_functor(void *slotObject)
|
||||
QMetaObject_activate_begin_declarative_signal(QObject *sender, int signalIndex)
|
||||
QMetaObject_activate_end_declarative_signal(QObject *sender, int signalIndex)
|
||||
|
||||
qt_message_print(int type, const char *category, const char *function, const char *file, int line, const QString &message)
|
||||
|
@ -140,6 +140,10 @@ public:
|
||||
// Inlined for its one caller in qdatetime.cpp
|
||||
inline void setUtcOffsetByTZ(qint64 atMSecsSinceEpoch);
|
||||
#endif // timezone
|
||||
|
||||
// ### Qt 5.14: expose publicly in QDateTime
|
||||
// The first and last years of which QDateTime can represent some part:
|
||||
enum class YearRange : qint32 { First = -292275056, Last = +292278994 };
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -494,7 +494,11 @@ bool qt_is_ascii(const char *&ptr, const char *end) noexcept
|
||||
while (ptr + 4 <= end) {
|
||||
quint32 data = qFromUnaligned<quint32>(ptr);
|
||||
if (data &= 0x80808080U) {
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
uint idx = qCountLeadingZeroBits(data);
|
||||
#else
|
||||
uint idx = qCountTrailingZeroBits(data);
|
||||
#endif
|
||||
ptr += idx / 8;
|
||||
return false;
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "qtimezone.h"
|
||||
#include "qtimezoneprivate_p.h"
|
||||
#include "qdatetime_p.h" // ### Qt 5.14: remove once YearRange is on QDateTime
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QHash>
|
||||
@ -520,19 +521,14 @@ PosixZone PosixZone::parse(const char *&pos, const char *end)
|
||||
|
||||
static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArray &posixRule,
|
||||
int startYear, int endYear,
|
||||
int lastTranMSecs)
|
||||
qint64 lastTranMSecs)
|
||||
{
|
||||
QVector<QTimeZonePrivate::Data> result;
|
||||
|
||||
// Limit year by qint64 max size for msecs
|
||||
if (startYear > 292278994)
|
||||
startYear = 292278994;
|
||||
if (endYear > 292278994)
|
||||
endYear = 292278994;
|
||||
|
||||
// POSIX Format is like "TZ=CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00"
|
||||
// i.e. "std offset dst [offset],start[/time],end[/time]"
|
||||
// See the section about TZ at http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
|
||||
// See the section about TZ at
|
||||
// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
|
||||
QList<QByteArray> parts = posixRule.split(',');
|
||||
|
||||
PosixZone stdZone, dstZone = PosixZone::invalid();
|
||||
@ -583,6 +579,13 @@ static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArra
|
||||
else
|
||||
stdTime = QTime(2, 0, 0);
|
||||
|
||||
// Limit year to the range QDateTime can represent:
|
||||
const int minYear = int(QDateTimePrivate::YearRange::First);
|
||||
const int maxYear = int(QDateTimePrivate::YearRange::Last);
|
||||
startYear = qBound(minYear, startYear, maxYear);
|
||||
endYear = qBound(minYear, endYear, maxYear);
|
||||
Q_ASSERT(startYear <= endYear);
|
||||
|
||||
for (int year = startYear; year <= endYear; ++year) {
|
||||
QTimeZonePrivate::Data dstData;
|
||||
QDateTime dst(calculatePosixDate(dstDateRule, year), dstTime, Qt::UTC);
|
||||
@ -598,13 +601,16 @@ static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArra
|
||||
stdData.standardTimeOffset = stdZone.offset;
|
||||
stdData.daylightTimeOffset = 0;
|
||||
stdData.abbreviation = stdZone.name;
|
||||
// Part of the high year will overflow
|
||||
if (year == 292278994 && (dstData.atMSecsSinceEpoch < 0 || stdData.atMSecsSinceEpoch < 0)) {
|
||||
// Part of maxYear will overflow (likewise for minYear, below):
|
||||
if (year == maxYear && (dstData.atMSecsSinceEpoch < 0 || stdData.atMSecsSinceEpoch < 0)) {
|
||||
if (dstData.atMSecsSinceEpoch > 0) {
|
||||
result << dstData;
|
||||
} else if (stdData.atMSecsSinceEpoch > 0) {
|
||||
result << stdData;
|
||||
}
|
||||
} else if (year < 1970) { // We ignore DST before the epoch.
|
||||
if (year > minYear || stdData.atMSecsSinceEpoch != QTimeZonePrivate::invalidMSecs())
|
||||
result << stdData;
|
||||
} else if (dst < std) {
|
||||
result << dstData << stdData;
|
||||
} else {
|
||||
@ -794,6 +800,8 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId)
|
||||
tran.atMSecsSinceEpoch = tz_tran.tz_time * 1000;
|
||||
m_tranTimes.append(tran);
|
||||
}
|
||||
if (m_tranTimes.isEmpty() && m_posixRule.isEmpty())
|
||||
return; // Invalid after all !
|
||||
|
||||
if (ianaId.isEmpty())
|
||||
m_id = systemTimeZoneId();
|
||||
@ -954,22 +962,25 @@ QVector<QTimeZonePrivate::Data> QTzTimeZonePrivate::getPosixTransitions(qint64 m
|
||||
QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
|
||||
{
|
||||
// If the required time is after the last transition (or there were none)
|
||||
// and we have a POSIX rule then use it:
|
||||
if ((m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch)
|
||||
&& !m_posixRule.isEmpty() && forMSecsSinceEpoch >= 0) {
|
||||
// and we have a POSIX rule, then use it:
|
||||
if (!m_posixRule.isEmpty()
|
||||
&& (m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch)) {
|
||||
QVector<QTimeZonePrivate::Data> posixTrans = getPosixTransitions(forMSecsSinceEpoch);
|
||||
auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(),
|
||||
[forMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) {
|
||||
return at.atMSecsSinceEpoch <= forMSecsSinceEpoch;
|
||||
});
|
||||
if (it > posixTrans.cbegin()) {
|
||||
QTimeZonePrivate::Data data = *--it;
|
||||
// Use most recent, if any in the past; or the first if we have no other rules:
|
||||
if (it > posixTrans.cbegin() || (m_tranTimes.isEmpty() && it < posixTrans.cend())) {
|
||||
QTimeZonePrivate::Data data = *(it > posixTrans.cbegin() ? it - 1 : it);
|
||||
data.atMSecsSinceEpoch = forMSecsSinceEpoch;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
if (m_tranTimes.isEmpty()) // Only possible if !isValid()
|
||||
return invalidData();
|
||||
|
||||
// Otherwise, if we can find a valid tran, then use its rule:
|
||||
// Otherwise, use the rule for the most recent or first transition:
|
||||
auto last = std::partition_point(m_tranTimes.cbegin(), m_tranTimes.cend(),
|
||||
[forMSecsSinceEpoch] (const QTzTransitionTime &at) {
|
||||
return at.atMSecsSinceEpoch <= forMSecsSinceEpoch;
|
||||
@ -989,9 +1000,9 @@ bool QTzTimeZonePrivate::hasTransitions() const
|
||||
QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSinceEpoch) const
|
||||
{
|
||||
// If the required time is after the last transition (or there were none)
|
||||
// and we have a POSIX rule then use it:
|
||||
if ((m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch)
|
||||
&& !m_posixRule.isEmpty() && afterMSecsSinceEpoch >= 0) {
|
||||
// and we have a POSIX rule, then use it:
|
||||
if (!m_posixRule.isEmpty()
|
||||
&& (m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch)) {
|
||||
QVector<QTimeZonePrivate::Data> posixTrans = getPosixTransitions(afterMSecsSinceEpoch);
|
||||
auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(),
|
||||
[afterMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) {
|
||||
@ -1012,9 +1023,9 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSince
|
||||
QTimeZonePrivate::Data QTzTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const
|
||||
{
|
||||
// If the required time is after the last transition (or there were none)
|
||||
// and we have a POSIX rule then use it:
|
||||
if ((m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch)
|
||||
&& !m_posixRule.isEmpty() && beforeMSecsSinceEpoch > 0) {
|
||||
// and we have a POSIX rule, then use it:
|
||||
if (!m_posixRule.isEmpty()
|
||||
&& (m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch)) {
|
||||
QVector<QTimeZonePrivate::Data> posixTrans = getPosixTransitions(beforeMSecsSinceEpoch);
|
||||
auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(),
|
||||
[beforeMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) {
|
||||
|
@ -749,7 +749,8 @@
|
||||
},
|
||||
"headers": [ "xkbcommon/xkbcommon.h" ],
|
||||
"sources": [
|
||||
{ "type": "pkgConfig", "args": "xkbcommon >= 0.5.0" }
|
||||
{ "type": "pkgConfig", "args": "xkbcommon >= 0.5.0" },
|
||||
"-lxkbcommon"
|
||||
]
|
||||
},
|
||||
"xkbcommon_x11": {
|
||||
@ -759,7 +760,8 @@
|
||||
},
|
||||
"headers": [ "xkbcommon/xkbcommon-x11.h" ],
|
||||
"sources": [
|
||||
{ "type": "pkgConfig", "args": "xkbcommon-x11" }
|
||||
{ "type": "pkgConfig", "args": "xkbcommon-x11" },
|
||||
"-lxkbcommon -lxkbcommon-x11"
|
||||
]
|
||||
},
|
||||
"xrender": {
|
||||
|
@ -242,8 +242,8 @@ void qpiw_flush_fn(png_structp /* png_ptr */)
|
||||
static
|
||||
void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scaledSize, bool *doScaledRead)
|
||||
{
|
||||
png_uint_32 width;
|
||||
png_uint_32 height;
|
||||
png_uint_32 width = 0;
|
||||
png_uint_32 height = 0;
|
||||
int bit_depth = 0;
|
||||
int color_type = 0;
|
||||
png_bytep trans_alpha = 0;
|
||||
@ -251,7 +251,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
|
||||
int num_trans;
|
||||
png_colorp palette = 0;
|
||||
int num_palette;
|
||||
int interlace_method;
|
||||
int interlace_method = PNG_INTERLACE_LAST;
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_method, 0, 0);
|
||||
png_set_interlace_handling(png_ptr);
|
||||
|
||||
@ -749,7 +749,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage)
|
||||
QImage::Format QPngHandlerPrivate::readImageFormat()
|
||||
{
|
||||
QImage::Format format = QImage::Format_Invalid;
|
||||
png_uint_32 width, height;
|
||||
png_uint_32 width = 0, height = 0;
|
||||
int bit_depth = 0, color_type = 0;
|
||||
png_colorp palette;
|
||||
int num_palette;
|
||||
|
@ -1425,7 +1425,7 @@ void QGuiApplicationPrivate::eventDispatcherReady()
|
||||
|
||||
void QGuiApplicationPrivate::init()
|
||||
{
|
||||
Q_TRACE(QGuiApplicationPrivate_init_entry);
|
||||
Q_TRACE_SCOPE(QGuiApplicationPrivate_init);
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
QMacAutoReleasePool pool;
|
||||
@ -1589,8 +1589,6 @@ void QGuiApplicationPrivate::init()
|
||||
if (!QGuiApplicationPrivate::displayName)
|
||||
QObject::connect(q, &QGuiApplication::applicationNameChanged,
|
||||
q, &QGuiApplication::applicationDisplayNameChanged);
|
||||
|
||||
Q_TRACE(QGuiApplicationPrivate_init_exit);
|
||||
}
|
||||
|
||||
extern void qt_cleanupFontDatabase();
|
||||
@ -1836,7 +1834,7 @@ bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArra
|
||||
|
||||
void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
|
||||
{
|
||||
Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_entry, e->type);
|
||||
Q_TRACE_SCOPE(QGuiApplicationPrivate_processWindowSystemEvent, e->type);
|
||||
|
||||
switch(e->type) {
|
||||
case QWindowSystemInterfacePrivate::Mouse:
|
||||
@ -1946,8 +1944,6 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
|
||||
qWarning() << "Unknown user input event type:" << e->type;
|
||||
break;
|
||||
}
|
||||
|
||||
Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_exit, e->type);
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
|
@ -45,37 +45,20 @@
|
||||
* UNSUPPORTED.
|
||||
*/
|
||||
|
||||
// from corelib/global/qt_pch.h
|
||||
#include "../../corelib/global/qt_pch.h"
|
||||
|
||||
#if defined __cplusplus
|
||||
#include <qtguiglobal.h>
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# define _POSIX_
|
||||
# include <limits.h>
|
||||
# undef _POSIX_
|
||||
#endif
|
||||
|
||||
#include <qcoreapplication.h>
|
||||
#include <qlist.h>
|
||||
#include <qvariant.h> // All moc genereated code has this include
|
||||
#include <qobject.h>
|
||||
#include <qregexp.h>
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include <qtextcodec.h>
|
||||
#endif
|
||||
|
||||
#include <qguiapplication.h>
|
||||
#include <qbitmap.h>
|
||||
#include <qclipboard.h>
|
||||
#include <qcursor.h>
|
||||
#include <qevent.h>
|
||||
#include <qfont.h>
|
||||
#include <qimage.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <qscreen.h>
|
||||
#include <qsurface.h>
|
||||
#include <qwindow.h>
|
||||
#endif
|
||||
|
@ -65,11 +65,11 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
|
||||
const QRect &clip,
|
||||
T blender)
|
||||
{
|
||||
qreal sx = targetRect.width() / (qreal) srcRect.width();
|
||||
qreal sy = targetRect.height() / (qreal) srcRect.height();
|
||||
qreal sx = srcRect.width() / (qreal) targetRect.width();
|
||||
qreal sy = srcRect.height() / (qreal) targetRect.height();
|
||||
|
||||
int ix = 0x00010000 / sx;
|
||||
int iy = 0x00010000 / sy;
|
||||
const int ix = 0x00010000 * sx;
|
||||
const int iy = 0x00010000 * sy;
|
||||
|
||||
// qDebug() << "scale:" << endl
|
||||
// << " - target" << targetRect << endl
|
||||
@ -77,59 +77,30 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
|
||||
// << " - clip" << clip << endl
|
||||
// << " - sx=" << sx << " sy=" << sy << " ix=" << ix << " iy=" << iy;
|
||||
|
||||
int cx1 = clip.x();
|
||||
int cx2 = clip.x() + clip.width();
|
||||
int cy1 = clip.top();
|
||||
int cy2 = clip.y() + clip.height();
|
||||
|
||||
int tx1 = qRound(targetRect.left());
|
||||
int tx2 = qRound(targetRect.right());
|
||||
int ty1 = qRound(targetRect.top());
|
||||
int ty2 = qRound(targetRect.bottom());
|
||||
|
||||
if (tx2 < tx1)
|
||||
qSwap(tx2, tx1);
|
||||
|
||||
if (ty2 < ty1)
|
||||
qSwap(ty2, ty1);
|
||||
|
||||
if (tx1 < cx1)
|
||||
tx1 = cx1;
|
||||
|
||||
if (tx2 >= cx2)
|
||||
tx2 = cx2;
|
||||
|
||||
if (tx1 >= tx2)
|
||||
QRect tr = targetRect.normalized().toRect();
|
||||
tr = tr.intersected(clip);
|
||||
if (tr.isEmpty())
|
||||
return;
|
||||
|
||||
if (ty1 < cy1)
|
||||
ty1 = cy1;
|
||||
|
||||
if (ty2 >= cy2)
|
||||
ty2 = cy2;
|
||||
|
||||
if (ty1 >= ty2)
|
||||
return;
|
||||
|
||||
int h = ty2 - ty1;
|
||||
int w = tx2 - tx1;
|
||||
|
||||
const int tx1 = tr.left();
|
||||
const int ty1 = tr.top();
|
||||
int h = tr.height();
|
||||
int w = tr.width();
|
||||
|
||||
quint32 basex;
|
||||
quint32 srcy;
|
||||
|
||||
if (sx < 0) {
|
||||
int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
|
||||
int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * sx * 65536) + 1;
|
||||
basex = quint32(srcRect.right() * 65536) + dstx;
|
||||
} else {
|
||||
int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;
|
||||
int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * sx * 65536) - 1;
|
||||
basex = quint32(srcRect.left() * 65536) + dstx;
|
||||
}
|
||||
if (sy < 0) {
|
||||
int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;
|
||||
int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * sy * 65536) + 1;
|
||||
srcy = quint32(srcRect.bottom() * 65536) + dsty;
|
||||
} else {
|
||||
int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;
|
||||
int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * sy * 65536) - 1;
|
||||
srcy = quint32(srcRect.top() * 65536) + dsty;
|
||||
}
|
||||
|
||||
@ -185,11 +156,11 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
|
||||
const QRect &clip,
|
||||
T blender)
|
||||
{
|
||||
qreal sx = targetRect.width() / (qreal) srcRect.width();
|
||||
qreal sy = targetRect.height() / (qreal) srcRect.height();
|
||||
qreal sx = srcRect.width() / (qreal) targetRect.width();
|
||||
qreal sy = srcRect.height() / (qreal) targetRect.height();
|
||||
|
||||
int ix = 0x00010000 / sx;
|
||||
int iy = 0x00010000 / sy;
|
||||
const int ix = 0x00010000 * sx;
|
||||
const int iy = 0x00010000 * sy;
|
||||
|
||||
// qDebug() << "scale:" << endl
|
||||
// << " - target" << targetRect << endl
|
||||
@ -197,60 +168,30 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
|
||||
// << " - clip" << clip << endl
|
||||
// << " - sx=" << sx << " sy=" << sy << " ix=" << ix << " iy=" << iy;
|
||||
|
||||
int cx1 = clip.x();
|
||||
int cx2 = clip.x() + clip.width();
|
||||
int cy1 = clip.top();
|
||||
int cy2 = clip.y() + clip.height();
|
||||
|
||||
int tx1 = qRound(targetRect.left());
|
||||
int tx2 = qRound(targetRect.right());
|
||||
int ty1 = qRound(targetRect.top());
|
||||
int ty2 = qRound(targetRect.bottom());
|
||||
|
||||
if (tx2 < tx1)
|
||||
qSwap(tx2, tx1);
|
||||
|
||||
if (ty2 < ty1)
|
||||
qSwap(ty2, ty1);
|
||||
|
||||
if (tx1 < cx1)
|
||||
tx1 = cx1;
|
||||
|
||||
if (tx2 >= cx2)
|
||||
tx2 = cx2;
|
||||
|
||||
if (tx1 >= tx2)
|
||||
return;
|
||||
|
||||
if (ty1 < cy1)
|
||||
ty1 = cy1;
|
||||
|
||||
if (ty2 >= cy2)
|
||||
ty2 = cy2;
|
||||
|
||||
if (ty1 >= ty2)
|
||||
return;
|
||||
|
||||
int h = ty2 - ty1;
|
||||
int w = tx2 - tx1;
|
||||
if (!w || !h)
|
||||
QRect tr = targetRect.normalized().toRect();
|
||||
tr = tr.intersected(clip);
|
||||
if (tr.isEmpty())
|
||||
return;
|
||||
const int tx1 = tr.left();
|
||||
const int ty1 = tr.top();
|
||||
int h = tr.height();
|
||||
int w = tr.width();
|
||||
|
||||
quint32 basex;
|
||||
quint32 srcy;
|
||||
|
||||
if (sx < 0) {
|
||||
int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
|
||||
int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * sx * 65536) + 1;
|
||||
basex = quint32(srcRect.right() * 65536) + dstx;
|
||||
} else {
|
||||
int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;
|
||||
int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * sx * 65536) - 1;
|
||||
basex = quint32(srcRect.left() * 65536) + dstx;
|
||||
}
|
||||
if (sy < 0) {
|
||||
int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;
|
||||
int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * sy * 65536) + 1;
|
||||
srcy = quint32(srcRect.bottom() * 65536) + dsty;
|
||||
} else {
|
||||
int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;
|
||||
int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * sy * 65536) - 1;
|
||||
srcy = quint32(srcRect.top() * 65536) + dsty;
|
||||
}
|
||||
|
||||
|
@ -1378,10 +1378,8 @@ QGradient::QGradient(Preset preset)
|
||||
}();
|
||||
|
||||
const QJsonValue presetData = jsonPresets[preset - 1];
|
||||
if (!presetData.isObject()) {
|
||||
qWarning("QGradient: Undefined preset %i", preset);
|
||||
if (!presetData.isObject())
|
||||
return;
|
||||
}
|
||||
|
||||
m_type = LinearGradient;
|
||||
setCoordinateMode(ObjectMode);
|
||||
|
@ -1,3 +1,9 @@
|
||||
{
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QImageReader;
|
||||
QT_END_NAMESPACE
|
||||
}
|
||||
|
||||
QGuiApplicationPrivate_init_entry()
|
||||
QGuiApplicationPrivate_init_exit()
|
||||
|
||||
|
@ -54,8 +54,8 @@ void Server::initSocket()
|
||||
udpSocket = new QUdpSocket(this);
|
||||
udpSocket->bind(QHostAddress::LocalHost, 7755);
|
||||
|
||||
connect(udpSocket, SIGNAL(readyRead()),
|
||||
this, SLOT(readPendingDatagrams()));
|
||||
connect(udpSocket, &QUdpSocket::readyRead,
|
||||
this, &Server::readPendingDatagrams);
|
||||
}
|
||||
|
||||
void Server::readPendingDatagrams()
|
||||
|
@ -39,8 +39,11 @@ qtConfig(dnslookup) {
|
||||
|
||||
unix {
|
||||
!integrity:qtConfig(dnslookup): SOURCES += kernel/qdnslookup_unix.cpp
|
||||
|
||||
SOURCES += kernel/qhostinfo_unix.cpp
|
||||
|
||||
qtConfig(dlopen): QMAKE_USE_PRIVATE += libdl
|
||||
|
||||
qtConfig(linux-netlink): SOURCES += kernel/qnetworkinterface_linux.cpp
|
||||
else: SOURCES += kernel/qnetworkinterface_unix.cpp
|
||||
}
|
||||
|
@ -59,6 +59,10 @@
|
||||
# include <gnu/lib-names.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_FREEBSD) || QT_CONFIG(dlopen)
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -87,6 +91,18 @@ struct QDnsLookupStateDeleter
|
||||
}
|
||||
};
|
||||
|
||||
static QFunctionPointer resolveSymbol(QLibrary &lib, const char *sym)
|
||||
{
|
||||
if (lib.isLoaded())
|
||||
return lib.resolve(sym);
|
||||
|
||||
#if defined(RTLD_DEFAULT) && (defined(Q_OS_FREEBSD) || QT_CONFIG(dlopen))
|
||||
return reinterpret_cast<QFunctionPointer>(dlsym(RTLD_DEFAULT, sym));
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool resolveLibraryInternal()
|
||||
{
|
||||
QLibrary lib;
|
||||
@ -96,31 +112,30 @@ static bool resolveLibraryInternal()
|
||||
#endif
|
||||
{
|
||||
lib.setFileName(QLatin1String("resolv"));
|
||||
if (!lib.load())
|
||||
return false;
|
||||
lib.load();
|
||||
}
|
||||
|
||||
local_dn_expand = dn_expand_proto(lib.resolve("__dn_expand"));
|
||||
local_dn_expand = dn_expand_proto(resolveSymbol(lib, "__dn_expand"));
|
||||
if (!local_dn_expand)
|
||||
local_dn_expand = dn_expand_proto(lib.resolve("dn_expand"));
|
||||
local_dn_expand = dn_expand_proto(resolveSymbol(lib, "dn_expand"));
|
||||
|
||||
local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));
|
||||
local_res_nclose = res_nclose_proto(resolveSymbol(lib, "__res_nclose"));
|
||||
if (!local_res_nclose)
|
||||
local_res_nclose = res_nclose_proto(lib.resolve("res_9_nclose"));
|
||||
local_res_nclose = res_nclose_proto(resolveSymbol(lib, "res_9_nclose"));
|
||||
if (!local_res_nclose)
|
||||
local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
|
||||
local_res_nclose = res_nclose_proto(resolveSymbol(lib, "res_nclose"));
|
||||
|
||||
local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));
|
||||
local_res_ninit = res_ninit_proto(resolveSymbol(lib, "__res_ninit"));
|
||||
if (!local_res_ninit)
|
||||
local_res_ninit = res_ninit_proto(lib.resolve("res_9_ninit"));
|
||||
local_res_ninit = res_ninit_proto(resolveSymbol(lib, "res_9_ninit"));
|
||||
if (!local_res_ninit)
|
||||
local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));
|
||||
local_res_ninit = res_ninit_proto(resolveSymbol(lib, "res_ninit"));
|
||||
|
||||
local_res_nquery = res_nquery_proto(lib.resolve("__res_nquery"));
|
||||
local_res_nquery = res_nquery_proto(resolveSymbol(lib, "__res_nquery"));
|
||||
if (!local_res_nquery)
|
||||
local_res_nquery = res_nquery_proto(lib.resolve("res_9_nquery"));
|
||||
local_res_nquery = res_nquery_proto(resolveSymbol(lib, "res_9_nquery"));
|
||||
if (!local_res_nquery)
|
||||
local_res_nquery = res_nquery_proto(lib.resolve("res_nquery"));
|
||||
local_res_nquery = res_nquery_proto(resolveSymbol(lib, "res_nquery"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -66,6 +66,10 @@
|
||||
# include <gnu/lib-names.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_FREEBSD) || QT_CONFIG(dlopen)
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// Almost always the same. If not, specify in qplatformdefs.h.
|
||||
@ -115,6 +119,18 @@ struct LibResolv
|
||||
};
|
||||
}
|
||||
|
||||
static QFunctionPointer resolveSymbol(QLibrary &lib, const char *sym)
|
||||
{
|
||||
if (lib.isLoaded())
|
||||
return lib.resolve(sym);
|
||||
|
||||
#if defined(RTLD_DEFAULT) && (defined(Q_OS_FREEBSD) || QT_CONFIG(dlopen))
|
||||
return reinterpret_cast<QFunctionPointer>(dlsym(RTLD_DEFAULT, sym));
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
LibResolv::LibResolv()
|
||||
{
|
||||
QLibrary lib;
|
||||
@ -124,31 +140,30 @@ LibResolv::LibResolv()
|
||||
#endif
|
||||
{
|
||||
lib.setFileName(QLatin1String("resolv"));
|
||||
if (!lib.load())
|
||||
return;
|
||||
lib.load();
|
||||
}
|
||||
|
||||
// res_ninit is required for localDomainName()
|
||||
local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));
|
||||
local_res_ninit = res_ninit_proto(resolveSymbol(lib, "__res_ninit"));
|
||||
if (!local_res_ninit)
|
||||
local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));
|
||||
local_res_ninit = res_ninit_proto(resolveSymbol(lib, "res_ninit"));
|
||||
if (local_res_ninit) {
|
||||
// we must now find res_nclose
|
||||
local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
|
||||
local_res_nclose = res_nclose_proto(resolveSymbol(lib, "res_nclose"));
|
||||
if (!local_res_nclose)
|
||||
local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));
|
||||
local_res_nclose = res_nclose_proto(resolveSymbol(lib, "__res_nclose"));
|
||||
if (!local_res_nclose)
|
||||
local_res_ninit = nullptr;
|
||||
}
|
||||
|
||||
if (ReinitNecessary || !local_res_ninit) {
|
||||
local_res_init = res_init_proto(lib.resolve("__res_init"));
|
||||
local_res_init = res_init_proto(resolveSymbol(lib, "__res_init"));
|
||||
if (!local_res_init)
|
||||
local_res_init = res_init_proto(lib.resolve("res_init"));
|
||||
local_res_init = res_init_proto(resolveSymbol(lib, "res_init"));
|
||||
|
||||
if (local_res_init && !local_res_ninit) {
|
||||
// if we can't get a thread-safe context, we have to use the global _res state
|
||||
local_res = res_state_ptr(lib.resolve("_res"));
|
||||
local_res = res_state_ptr(resolveSymbol(lib, "_res"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -381,6 +381,7 @@ qint64 QUdpSocket::writeDatagram(const char *data, qint64 size, const QHostAddre
|
||||
*/
|
||||
|
||||
/*!
|
||||
\since 5.8
|
||||
\overload
|
||||
|
||||
Sends the datagram \a datagram to the host address and port numbers
|
||||
@ -431,6 +432,8 @@ qint64 QUdpSocket::writeDatagram(const QNetworkDatagram &datagram)
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.8
|
||||
|
||||
Receives a datagram no larger than \a maxSize bytes and returns it in the
|
||||
QNetworkDatagram object, along with the sender's host address and port. If
|
||||
possible, this function will also try to determine the datagram's
|
||||
|
@ -569,12 +569,10 @@ public:
|
||||
|
||||
bool isFileSystem() const { return (m_attributes & SFGAO_FILESYSTEM) != 0; }
|
||||
bool isDir() const { return (m_attributes & SFGAO_FOLDER) != 0; }
|
||||
// Copy using IFileOperation
|
||||
bool canCopy() const { return (m_attributes & SFGAO_CANCOPY) != 0; }
|
||||
// Supports IStream
|
||||
bool canStream() const { return (m_attributes & SFGAO_STREAM) != 0; }
|
||||
|
||||
bool copyData(QIODevice *out);
|
||||
bool copyData(QIODevice *out, QString *errorMessage);
|
||||
|
||||
static IShellItems itemsFromItemArray(IShellItemArray *items);
|
||||
|
||||
@ -666,14 +664,19 @@ QWindowsShellItem::IShellItems QWindowsShellItem::itemsFromItemArray(IShellItemA
|
||||
return result;
|
||||
}
|
||||
|
||||
bool QWindowsShellItem::copyData(QIODevice *out)
|
||||
bool QWindowsShellItem::copyData(QIODevice *out, QString *errorMessage)
|
||||
{
|
||||
if (!canCopy() || !canStream())
|
||||
if (!canStream()) {
|
||||
*errorMessage = QLatin1String("Item not streamable");
|
||||
return false;
|
||||
}
|
||||
IStream *istream = nullptr;
|
||||
HRESULT hr = m_item->BindToHandler(nullptr, BHID_Stream, IID_PPV_ARGS(&istream));
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr)) {
|
||||
*errorMessage = QLatin1String("BindToHandler() failed: ")
|
||||
+ QLatin1String(QWindowsContext::comErrorString(hr));
|
||||
return false;
|
||||
}
|
||||
enum : ULONG { bufSize = 102400 };
|
||||
char buffer[bufSize];
|
||||
ULONG bytesRead;
|
||||
@ -686,7 +689,12 @@ bool QWindowsShellItem::copyData(QIODevice *out)
|
||||
break;
|
||||
}
|
||||
istream->Release();
|
||||
return hr == S_OK || hr == S_FALSE;
|
||||
if (hr != S_OK && hr != S_FALSE) {
|
||||
*errorMessage = QLatin1String("Read() failed: ")
|
||||
+ QLatin1String(QWindowsContext::comErrorString(hr));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Helper for "Libraries": collections of folders appearing from Windows 7
|
||||
@ -735,8 +743,6 @@ void QWindowsShellItem::format(QDebug &d) const
|
||||
d << " [dir]";
|
||||
if (canStream())
|
||||
d << " [stream]";
|
||||
if (canCopy())
|
||||
d << " [copyable]";
|
||||
d << ", normalDisplay=\"" << normalDisplay()
|
||||
<< "\", desktopAbsoluteParsing=\"" << desktopAbsoluteParsing()
|
||||
<< "\", urlString=\"" << urlString() << "\", fileSysPath=\"" << fileSysPath() << '"';
|
||||
@ -1395,21 +1401,50 @@ static void cleanupTemporaryItemCopies()
|
||||
QFile::remove(file);
|
||||
}
|
||||
|
||||
static QString createTemporaryItemCopy(QWindowsShellItem &qItem)
|
||||
{
|
||||
if (!qItem.canCopy() || !qItem.canStream())
|
||||
return QString();
|
||||
QString pattern = qItem.normalDisplay();
|
||||
const int lastDot = pattern.lastIndexOf(QLatin1Char('.'));
|
||||
const QString placeHolder = QStringLiteral("_XXXXXX");
|
||||
if (lastDot >= 0)
|
||||
pattern.insert(lastDot, placeHolder);
|
||||
else
|
||||
pattern.append(placeHolder);
|
||||
// Determine temporary file pattern from a shell item's display
|
||||
// name. This can be a URL.
|
||||
|
||||
QTemporaryFile targetFile(QDir::tempPath() + QLatin1Char('/') + pattern);
|
||||
static bool validFileNameCharacter(QChar c)
|
||||
{
|
||||
return c.isLetterOrNumber() || c == QLatin1Char('_') || c == QLatin1Char('-');
|
||||
}
|
||||
|
||||
QString tempFilePattern(QString name)
|
||||
{
|
||||
const int lastSlash = qMax(name.lastIndexOf(QLatin1Char('/')),
|
||||
name.lastIndexOf(QLatin1Char('\\')));
|
||||
if (lastSlash != -1)
|
||||
name.remove(0, lastSlash + 1);
|
||||
|
||||
int lastDot = name.lastIndexOf(QLatin1Char('.'));
|
||||
if (lastDot < 0)
|
||||
lastDot = name.size();
|
||||
name.insert(lastDot, QStringLiteral("_XXXXXX"));
|
||||
|
||||
for (int i = lastDot - 1; i >= 0; --i) {
|
||||
if (!validFileNameCharacter(name.at(i)))
|
||||
name[i] = QLatin1Char('_');
|
||||
}
|
||||
|
||||
name.prepend(QDir::tempPath() + QLatin1Char('/'));
|
||||
return name;
|
||||
}
|
||||
|
||||
static QString createTemporaryItemCopy(QWindowsShellItem &qItem, QString *errorMessage)
|
||||
{
|
||||
if (!qItem.canStream()) {
|
||||
*errorMessage = QLatin1String("Item not streamable");
|
||||
return QString();
|
||||
}
|
||||
|
||||
QTemporaryFile targetFile(tempFilePattern(qItem.normalDisplay()));
|
||||
targetFile.setAutoRemove(false);
|
||||
if (!targetFile.open() || !qItem.copyData(&targetFile))
|
||||
if (!targetFile.open()) {
|
||||
*errorMessage = QLatin1String("Cannot create temporary file: ")
|
||||
+ targetFile.errorString();
|
||||
return QString();
|
||||
}
|
||||
if (!qItem.copyData(&targetFile, errorMessage))
|
||||
return QString();
|
||||
const QString result = targetFile.fileName();
|
||||
if (temporaryItemCopies()->isEmpty())
|
||||
@ -1427,11 +1462,14 @@ QList<QUrl> QWindowsNativeOpenFileDialog::dialogResult() const
|
||||
QWindowsShellItem qItem(item);
|
||||
const QString path = qItem.path();
|
||||
if (path.isEmpty() && !qItem.isDir()) {
|
||||
const QString temporaryCopy = createTemporaryItemCopy(qItem);
|
||||
if (temporaryCopy.isEmpty())
|
||||
qWarning() << "Unable to create a local copy of" << qItem;
|
||||
else
|
||||
QString errorMessage;
|
||||
const QString temporaryCopy = createTemporaryItemCopy(qItem, &errorMessage);
|
||||
if (temporaryCopy.isEmpty()) {
|
||||
qWarning().noquote() << "Unable to create a local copy of" << qItem
|
||||
<< ": " << errorMessage;
|
||||
} else {
|
||||
result.append(QUrl::fromLocalFile(temporaryCopy));
|
||||
}
|
||||
} else {
|
||||
result.append(qItem.url());
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
#include <QtCore/qprocess.h>
|
||||
#include <QtCore/qdir.h>
|
||||
#include <QtCore/qregularexpression.h>
|
||||
#include <QtCore/qset.h>
|
||||
#include <QtTest/private/callgrind_p.h>
|
||||
|
||||
@ -90,13 +91,13 @@ qint64 QBenchmarkValgrindUtils::extractResult(const QString &fileName)
|
||||
|
||||
qint64 val = -1;
|
||||
bool valSeen = false;
|
||||
QRegExp rxValue(QLatin1String("^summary: (\\d+)"));
|
||||
QRegularExpression rxValue(QLatin1String("^summary: (\\d+)"));
|
||||
while (!file.atEnd()) {
|
||||
const QString line(QLatin1String(file.readLine()));
|
||||
if (rxValue.indexIn(line) != -1) {
|
||||
Q_ASSERT(rxValue.captureCount() == 1);
|
||||
QRegularExpressionMatch match = rxValue.match(line);
|
||||
if (match.hasMatch()) {
|
||||
bool ok;
|
||||
val = rxValue.cap(1).toLongLong(&ok);
|
||||
val = match.captured(1).toLongLong(&ok);
|
||||
Q_ASSERT(ok);
|
||||
valSeen = true;
|
||||
break;
|
||||
@ -120,13 +121,12 @@ QString QBenchmarkValgrindUtils::getNewestFileName()
|
||||
int hiSuffix = -1;
|
||||
QFileInfo lastFileInfo;
|
||||
const QString pattern = QString::fromLatin1("%1.(\\d+)").arg(base);
|
||||
QRegExp rx(pattern);
|
||||
QRegularExpression rx(pattern);
|
||||
for (const QFileInfo &fileInfo : fiList) {
|
||||
const int index = rx.indexIn(fileInfo.fileName());
|
||||
Q_ASSERT(index == 0);
|
||||
Q_UNUSED(index);
|
||||
QRegularExpressionMatch match = rx.match(fileInfo.fileName());
|
||||
Q_ASSERT(match.hasMatch());
|
||||
bool ok;
|
||||
const int suffix = rx.cap(1).toInt(&ok);
|
||||
const int suffix = match.captured(1).toInt(&ok);
|
||||
Q_ASSERT(ok);
|
||||
Q_ASSERT(suffix >= 0);
|
||||
if (suffix > hiSuffix) {
|
||||
|
@ -110,19 +110,21 @@ static QString createGuid(const QUuid &uuid)
|
||||
return guid;
|
||||
}
|
||||
|
||||
static void writePrologue(QTextStream &stream, const QString &fileName, const QString &providerName)
|
||||
static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider)
|
||||
{
|
||||
QUuid uuid = QUuid::createUuidV5(QUuid(), providerName.toLocal8Bit());
|
||||
QUuid uuid = QUuid::createUuidV5(QUuid(), provider.name.toLocal8Bit());
|
||||
|
||||
const QString provider = providerVar(providerName);
|
||||
const QString providerV = providerVar(provider.name);
|
||||
const QString guard = includeGuard(fileName);
|
||||
const QString guid = createGuid(uuid);
|
||||
const QString guidString = uuid.toString();
|
||||
|
||||
stream << "#ifndef " << guard << "\n"
|
||||
<< "#define " << guard << "\n"
|
||||
<< "\n"
|
||||
<< "#include <windows.h>\n"
|
||||
<< "#include <TraceLoggingProvider.h>\n";
|
||||
<< "#include <TraceLoggingProvider.h>\n"
|
||||
<< "\n";
|
||||
|
||||
/* TraceLogging API macros cannot deal with UTF8
|
||||
* source files, so we work around it like this
|
||||
@ -132,30 +134,33 @@ static void writePrologue(QTextStream &stream, const QString &fileName, const QS
|
||||
"#define _TlgPragmaUtf8Begin\n"
|
||||
"#define _TlgPragmaUtf8End\n";
|
||||
|
||||
stream << qtHeaders();
|
||||
|
||||
stream << "\n";
|
||||
stream << qtHeaders();
|
||||
stream << "\n";
|
||||
|
||||
if (!provider.prefixText.isEmpty())
|
||||
stream << provider.prefixText.join(QLatin1Char('\n')) << "\n\n";
|
||||
|
||||
stream << "#ifdef TRACEPOINT_DEFINE\n"
|
||||
<< "/* " << guidString << " */\n"
|
||||
<< "TRACELOGGING_DEFINE_PROVIDER(" << provider << ", \""
|
||||
<< providerName <<"\", " << guid << ");\n\n";
|
||||
<< "TRACELOGGING_DEFINE_PROVIDER(" << providerV << ", \""
|
||||
<< provider.name <<"\", " << guid << ");\n\n";
|
||||
|
||||
stream << "static inline void registerProvider()\n"
|
||||
<< "{\n"
|
||||
<< " TraceLoggingRegister(" << provider << ");\n"
|
||||
<< " TraceLoggingRegister(" << providerV << ");\n"
|
||||
<< "}\n\n";
|
||||
|
||||
stream << "static inline void unregisterProvider()\n"
|
||||
<< "{\n"
|
||||
<< " TraceLoggingUnregister(" << provider << ");\n"
|
||||
<< " TraceLoggingUnregister(" << providerV << ");\n"
|
||||
<< "}\n";
|
||||
|
||||
stream << "Q_CONSTRUCTOR_FUNCTION(registerProvider)\n"
|
||||
<< "Q_DESTRUCTOR_FUNCTION(unregisterProvider)\n\n";
|
||||
|
||||
stream << "#else\n"
|
||||
<< "TRACELOGGING_DECLARE_PROVIDER(" << provider << ");\n"
|
||||
<< "TRACELOGGING_DECLARE_PROVIDER(" << providerV << ");\n"
|
||||
<< "#endif // TRACEPOINT_DEFINE\n\n";
|
||||
}
|
||||
|
||||
@ -224,7 +229,7 @@ void writeEtw(QFile &file, const Provider &provider)
|
||||
|
||||
const QString fileName = QFileInfo(file.fileName()).fileName();
|
||||
|
||||
writePrologue(stream, fileName, provider.name);
|
||||
writePrologue(stream, fileName, provider);
|
||||
writeTracepoints(stream, provider);
|
||||
writeEpilogue(stream, fileName);
|
||||
}
|
||||
|
@ -104,17 +104,22 @@ static void writeCtfMacro(QTextStream &stream, const Tracepoint::Field &field)
|
||||
}
|
||||
}
|
||||
|
||||
static void writePrologue(QTextStream &stream, const QString &fileName, const QString &providerName)
|
||||
static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider)
|
||||
{
|
||||
stream << "#undef TRACEPOINT_PROVIDER\n";
|
||||
stream << "#define TRACEPOINT_PROVIDER " << providerName << "\n\n";
|
||||
|
||||
stream << qtHeaders();
|
||||
|
||||
const QString guard = includeGuard(fileName);
|
||||
|
||||
stream << "#undef TRACEPOINT_PROVIDER\n";
|
||||
stream << "#define TRACEPOINT_PROVIDER " << provider.name << "\n";
|
||||
stream << "\n";
|
||||
|
||||
// include prefix text or qt headers only once
|
||||
stream << "#if !defined(" << guard << ")\n";
|
||||
stream << qtHeaders();
|
||||
stream << "\n";
|
||||
if (!provider.prefixText.isEmpty())
|
||||
stream << provider.prefixText.join(QLatin1Char('\n')) << "\n\n";
|
||||
stream << "#endif\n\n";
|
||||
|
||||
/* the first guard is the usual one, the second is required
|
||||
* by LTTNG to force the re-evaluation of TRACEPOINT_* macros
|
||||
*/
|
||||
@ -213,7 +218,7 @@ void writeLttng(QFile &file, const Provider &provider)
|
||||
|
||||
const QString fileName = QFileInfo(file.fileName()).fileName();
|
||||
|
||||
writePrologue(stream, fileName, provider.name);
|
||||
writePrologue(stream, fileName, provider);
|
||||
writeTracepoints(stream, provider);
|
||||
writeEpilogue(stream, fileName);
|
||||
}
|
||||
|
@ -275,9 +275,21 @@ Provider parseProvider(const QString &filename)
|
||||
Provider provider;
|
||||
provider.name = QFileInfo(filename).baseName();
|
||||
|
||||
bool parsingPrefixText = false;
|
||||
for (int lineNumber = 1; !s.atEnd(); ++lineNumber) {
|
||||
QString line = s.readLine().trimmed();
|
||||
|
||||
if (line == QLatin1String("{")) {
|
||||
parsingPrefixText = true;
|
||||
continue;
|
||||
} else if (parsingPrefixText && line == QLatin1String("}")) {
|
||||
parsingPrefixText = false;
|
||||
continue;
|
||||
} else if (parsingPrefixText) {
|
||||
provider.prefixText.append(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.isEmpty() || line.startsWith(QLatin1Char('#')))
|
||||
continue;
|
||||
|
||||
@ -296,7 +308,14 @@ Provider parseProvider(const QString &filename)
|
||||
}
|
||||
}
|
||||
|
||||
if (parsingPrefixText) {
|
||||
panic("Syntax error while processing '%s': "
|
||||
"no closing brace found for prefix text block",
|
||||
qPrintable(filename));
|
||||
}
|
||||
|
||||
#ifdef TRACEGEN_DEBUG
|
||||
qDebug() << provider.prefixText;
|
||||
for (auto i = provider.tracepoints.constBegin(); i != provider.tracepoints.constEnd(); ++i)
|
||||
dumpTracepoint(*i);
|
||||
#endif
|
||||
|
@ -86,6 +86,7 @@ struct Provider
|
||||
{
|
||||
QString name;
|
||||
QVector<Tracepoint> tracepoints;
|
||||
QStringList prefixText;
|
||||
};
|
||||
|
||||
Provider parseProvider(const QString &filename);
|
||||
|
@ -3696,7 +3696,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
|
||||
// to the ones in QCoreApplicationPrivate::notify_helper; the reason for their
|
||||
// duplication is because tracepoint symbols are not exported by QtCore.
|
||||
// If you adjust the tracepoints here, consider adjusting QCoreApplicationPrivate too.
|
||||
Q_TRACE(QApplication_notify_entry, receiver, e, e->type());
|
||||
Q_TRACE_SCOPE(QApplication_notify, receiver, e, e->type());
|
||||
|
||||
// send to all application event filters
|
||||
if (threadRequiresCoreApplication()
|
||||
|
@ -45,41 +45,17 @@
|
||||
* UNSUPPORTED.
|
||||
*/
|
||||
|
||||
// from corelib/global/qt_pch.h
|
||||
#include "../../gui/kernel/qt_gui_pch.h"
|
||||
|
||||
#if defined __cplusplus
|
||||
#include <qtwidgetsglobal.h>
|
||||
|
||||
|
||||
#if 0 // Used to be included in Qt4 for Q_WS_WIN
|
||||
# define _POSIX_
|
||||
# include <limits.h>
|
||||
# undef _POSIX_
|
||||
#endif
|
||||
|
||||
#include <qcoreapplication.h>
|
||||
#include <qlist.h>
|
||||
#include <qvariant.h> // All moc genereated code has this include
|
||||
#include <qobject.h>
|
||||
#include <qregexp.h>
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include <qtextcodec.h>
|
||||
#endif
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qbitmap.h>
|
||||
#include <qcursor.h>
|
||||
#include <qdesktopwidget.h>
|
||||
#include <qevent.h>
|
||||
#include <qimage.h>
|
||||
#include <qabstractbutton.h>
|
||||
#include <qabstractscrollarea.h>
|
||||
#include <qabstractslider.h>
|
||||
#include <qaction.h>
|
||||
#include <qcommonstyle.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qstyle.h>
|
||||
#include <qtimer.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#endif
|
||||
|
@ -885,8 +885,6 @@ void QWidgetWindow::handleDragEnterEvent(QDragEnterEvent *event, QWidget *widget
|
||||
const QPoint mapped = widget->mapFromGlobal(m_widget->mapToGlobal(event->pos()));
|
||||
QDragEnterEvent translated(mapped, event->possibleActions(), event->mimeData(),
|
||||
event->mouseButtons(), event->keyboardModifiers());
|
||||
translated.setDropAction(event->dropAction());
|
||||
translated.setAccepted(event->isAccepted());
|
||||
QGuiApplication::forwardEvent(m_dragTarget, &translated, event);
|
||||
event->setAccepted(translated.isAccepted());
|
||||
event->setDropAction(translated.dropAction());
|
||||
|
@ -1,4 +1,11 @@
|
||||
{
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QEvent;
|
||||
QT_END_NAMESPACE
|
||||
}
|
||||
|
||||
QApplication_notify_entry(QObject *receiver, QEvent *event, int type)
|
||||
QApplication_notify_exit(QObject *receiver, QEvent *event, int type)
|
||||
QApplication_notify_event_filtered(QObject *receiver, QEvent *event, int type)
|
||||
QApplication_notify_before_delivery(QObject *receiver, QEvent *event, int type)
|
||||
QApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed)
|
||||
|
@ -538,8 +538,13 @@ void tst_QTimeZone::checkOffset_data()
|
||||
int year, month, day, hour, min, sec;
|
||||
int std, dst;
|
||||
} table[] = {
|
||||
// Zone with no transitions (QTBUG-74614, when TZ backend uses minimalist data)
|
||||
// Zone with no transitions (QTBUG-74614, QTBUG-74666, when TZ backend uses minimal data)
|
||||
{ "Etc/UTC", "epoch", 1970, 1, 1, 0, 0, 0, 0, 0 },
|
||||
{ "Etc/UTC", "pre_int32", 1901, 12, 13, 20, 45, 51, 0, 0 },
|
||||
{ "Etc/UTC", "post_int32", 2038, 1, 19, 3, 14, 9, 0, 0 },
|
||||
{ "Etc/UTC", "post_uint32", 2106, 2, 7, 6, 28, 17, 0, 0 },
|
||||
{ "Etc/UTC", "initial", -292275056, 5, 16, 16, 47, 5, 0, 0 },
|
||||
{ "Etc/UTC", "final", 292278994, 8, 17, 7, 12, 55, 0, 0 },
|
||||
// Kiev: regression test for QTBUG-64122 (on MS):
|
||||
{ "Europe/Kiev", "summer", 2017, 10, 27, 12, 0, 0, 2 * 3600, 3600 },
|
||||
{ "Europe/Kiev", "winter", 2017, 10, 29, 12, 0, 0, 2 * 3600, 0 }
|
||||
|
@ -4,5 +4,3 @@
|
||||
windows ci
|
||||
[blockingLookup:a-plus-aaaa]
|
||||
windows ci
|
||||
[reverseLookup:google-public-dns-a.google.com]
|
||||
ci
|
||||
|
@ -393,6 +393,68 @@ void tst_QHostInfo::lookupConnectToLambda()
|
||||
QCOMPARE(tmp.join(' '), expected.join(' '));
|
||||
}
|
||||
|
||||
static QStringList reverseLookupHelper(const QString &ip)
|
||||
{
|
||||
QStringList results;
|
||||
|
||||
const QString pythonCode =
|
||||
"import socket;"
|
||||
"import sys;"
|
||||
"print (socket.getnameinfo((sys.argv[1], 0), 0)[0]);";
|
||||
|
||||
QList<QByteArray> lines;
|
||||
QProcess python;
|
||||
python.setProcessChannelMode(QProcess::ForwardedErrorChannel);
|
||||
python.start("python", QStringList() << QString("-c") << pythonCode << ip);
|
||||
if (python.waitForFinished()) {
|
||||
if (python.exitStatus() == QProcess::NormalExit && python.exitCode() == 0)
|
||||
lines = python.readAllStandardOutput().split('\n');
|
||||
for (QByteArray line : lines) {
|
||||
if (!line.isEmpty())
|
||||
results << line.trimmed();
|
||||
}
|
||||
if (!results.isEmpty())
|
||||
return results;
|
||||
}
|
||||
|
||||
qDebug() << "Python failed, falling back to nslookup";
|
||||
QProcess lookup;
|
||||
lookup.setProcessChannelMode(QProcess::ForwardedErrorChannel);
|
||||
lookup.start("nslookup", QStringList(ip));
|
||||
if (!lookup.waitForFinished()) {
|
||||
results << "nslookup failure";
|
||||
qDebug() << "nslookup failure";
|
||||
return results;
|
||||
}
|
||||
lines = lookup.readAllStandardOutput().split('\n');
|
||||
|
||||
QByteArray name;
|
||||
|
||||
const QByteArray nameMarkerNix("name =");
|
||||
const QByteArray nameMarkerWin("Name:");
|
||||
const QByteArray addressMarkerWin("Address:");
|
||||
|
||||
for (QByteArray line : lines) {
|
||||
int index = -1;
|
||||
if ((index = line.indexOf(nameMarkerNix)) != -1) { // Linux and macOS
|
||||
name = line.mid(index + nameMarkerNix.length()).chopped(1).trimmed();
|
||||
results << name;
|
||||
} else if (line.startsWith(nameMarkerWin)) { // Windows formatting
|
||||
name = line.mid(line.lastIndexOf(" ")).trimmed();
|
||||
} else if (line.startsWith(addressMarkerWin)) {
|
||||
QByteArray address = line.mid(addressMarkerWin.length()).trimmed();
|
||||
if (address == ip) {
|
||||
results << name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (results.isEmpty()) {
|
||||
qDebug() << "Failure to parse nslookup output: " << lines;
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
void tst_QHostInfo::reverseLookup_data()
|
||||
{
|
||||
QTest::addColumn<QString>("address");
|
||||
@ -400,8 +462,8 @@ void tst_QHostInfo::reverseLookup_data()
|
||||
QTest::addColumn<int>("err");
|
||||
QTest::addColumn<bool>("ipv6");
|
||||
|
||||
QTest::newRow("google-public-dns-a.google.com") << QString("8.8.8.8") << QStringList(QString("google-public-dns-a.google.com")) << 0 << false;
|
||||
QTest::newRow("gitorious.org") << QString("87.238.52.168") << QStringList(QString("gitorious.org")) << 0 << false;
|
||||
QTest::newRow("dns.google") << QString("8.8.8.8") << reverseLookupHelper("8.8.8.8") << 0 << false;
|
||||
QTest::newRow("one.one.one.one") << QString("1.1.1.1") << reverseLookupHelper("1.1.1.1") << 0 << false;
|
||||
QTest::newRow("bogus-name") << QString("1::2::3::4") << QStringList() << 1 << true;
|
||||
}
|
||||
|
||||
@ -419,6 +481,8 @@ void tst_QHostInfo::reverseLookup()
|
||||
QHostInfo info = QHostInfo::fromName(address);
|
||||
|
||||
if (err == 0) {
|
||||
if (!hostNames.contains(info.hostName()))
|
||||
qDebug() << "Failure: expecting" << hostNames << ",got " << info.hostName();
|
||||
QVERIFY(hostNames.contains(info.hostName()));
|
||||
QCOMPARE(info.addresses().first(), QHostAddress(address));
|
||||
} else {
|
||||
|
@ -46,6 +46,9 @@
|
||||
#include <private/qwindow_p.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <qpa/qplatformdrag.h>
|
||||
#include <private/qhighdpiscaling_p.h>
|
||||
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
@ -87,6 +90,7 @@ private slots:
|
||||
#if QT_CONFIG(draganddrop)
|
||||
void tst_dnd();
|
||||
void tst_dnd_events();
|
||||
void tst_dnd_propagation();
|
||||
#endif
|
||||
|
||||
void tst_qtbug35600();
|
||||
@ -744,6 +748,77 @@ void tst_QWidget_window::tst_dnd_events()
|
||||
|
||||
QCOMPARE(dndWidget._dndEvents, expectedDndEvents);
|
||||
}
|
||||
|
||||
class DropTarget : public QWidget
|
||||
{
|
||||
public:
|
||||
explicit DropTarget()
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
|
||||
const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
|
||||
auto width = availableGeometry.width() / 6;
|
||||
auto height = availableGeometry.height() / 4;
|
||||
|
||||
setGeometry(availableGeometry.x() + 200, availableGeometry.y() + 200, width, height);
|
||||
|
||||
QLabel *label = new QLabel(QStringLiteral("Test"), this);
|
||||
label->setGeometry(40, 40, 60, 60);
|
||||
label->setAcceptDrops(true);
|
||||
}
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *event) override
|
||||
{
|
||||
event->accept();
|
||||
mDndEvents.append("enter ");
|
||||
}
|
||||
|
||||
void dragMoveEvent(QDragMoveEvent *event) override
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
void dragLeaveEvent(QDragLeaveEvent *) override
|
||||
{
|
||||
mDndEvents.append("leave ");
|
||||
}
|
||||
|
||||
void dropEvent(QDropEvent *event) override
|
||||
{
|
||||
event->accept();
|
||||
mDndEvents.append("drop ");
|
||||
}
|
||||
|
||||
QString mDndEvents;
|
||||
};
|
||||
|
||||
void tst_QWidget_window::tst_dnd_propagation()
|
||||
{
|
||||
QMimeData mimeData;
|
||||
mimeData.setText(QLatin1String("testmimetext"));
|
||||
|
||||
DropTarget target;
|
||||
target.show();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&target));
|
||||
|
||||
Qt::DropActions supportedActions = Qt::DropAction::CopyAction;
|
||||
QWindow *window = target.windowHandle();
|
||||
|
||||
auto posInsideDropTarget = QHighDpi::toNativePixels(QPoint(20, 20), window->screen());
|
||||
auto posInsideLabel = QHighDpi::toNativePixels(QPoint(60, 60), window->screen());
|
||||
|
||||
// Enter DropTarget.
|
||||
QWindowSystemInterface::handleDrag(window, &mimeData, posInsideDropTarget, supportedActions, 0, 0);
|
||||
// Enter QLabel. This will propagate because default QLabel does
|
||||
// not accept the drop event in dragEnterEvent().
|
||||
QWindowSystemInterface::handleDrag(window, &mimeData, posInsideLabel, supportedActions, 0, 0);
|
||||
// Drop on QLabel. DropTarget will get dropEvent(), because it accepted the event.
|
||||
QWindowSystemInterface::handleDrop(window, &mimeData, posInsideLabel, supportedActions, 0, 0);
|
||||
|
||||
QGuiApplication::processEvents();
|
||||
|
||||
QCOMPARE(target.mDndEvents, "enter leave enter drop ");
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QWidget_window::tst_qtbug35600()
|
||||
|
@ -505,8 +505,15 @@ void FileDialogPanel::accepted()
|
||||
Q_ASSERT(d);
|
||||
m_result.clear();
|
||||
QDebug(&m_result).nospace()
|
||||
#if QT_VERSION >= 0x050000
|
||||
<< "URLs: " << d->selectedUrls() << '\n'
|
||||
#endif
|
||||
<< "Files: " << d->selectedFiles()
|
||||
<< "\nDirectory: " << d->directory().absolutePath()
|
||||
<< "\nDirectory: "
|
||||
#if QT_VERSION >= 0x050000
|
||||
<< d->directoryUrl() << ", "
|
||||
#endif
|
||||
<< d->directory().absolutePath()
|
||||
<< "\nName filter: " << d->selectedNameFilter();
|
||||
QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user