Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Iec860bb703f983b7438e67c695b9c454e72b3e0f
This commit is contained in:
commit
ce7f14d2e0
@ -856,7 +856,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
QString lib_file = QMakeMetaInfo::checkLib(Option::normalizePath(
|
QString lib_file = QMakeMetaInfo::checkLib(Option::normalizePath(
|
||||||
(*lit) + Option::dir_sep + lib + Option::prl_ext));
|
(*lit) + Option::dir_sep + lib + Option::prl_ext));
|
||||||
if (!lib_file.isEmpty()) {
|
if (!lib_file.isEmpty()) {
|
||||||
QMakeMetaInfo libinfo(project);
|
QMakeMetaInfo libinfo;
|
||||||
if(libinfo.readLib(lib_file)) {
|
if(libinfo.readLib(lib_file)) {
|
||||||
if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) {
|
if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) {
|
||||||
library = (*lit) + Option::dir_sep + libinfo.first("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);
|
const QString meta_file = QMakeMetaInfo::checkLib(fixedFile);
|
||||||
if (meta_file.isEmpty())
|
if (meta_file.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
QMakeMetaInfo libinfo(project);
|
QMakeMetaInfo libinfo;
|
||||||
debug_msg(1, "Processing PRL file: %s", meta_file.toLatin1().constData());
|
debug_msg(1, "Processing PRL file: %s", meta_file.toLatin1().constData());
|
||||||
if (!libinfo.readLib(meta_file)) {
|
if (!libinfo.readLib(meta_file)) {
|
||||||
fprintf(stderr, "Error processing meta file %s\n", meta_file.toLatin1().constData());
|
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");
|
const ProStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES");
|
||||||
ProStringList::ConstIterator it;
|
ProStringList::ConstIterator it;
|
||||||
for(it = l.begin(); it != l.end(); ++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")) {
|
if (libinfo.readLib((*it).toQString()) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) {
|
||||||
ProString dir;
|
ProString dir;
|
||||||
int slsh = (*it).lastIndexOf(Option::dir_sep);
|
int slsh = (*it).lastIndexOf(Option::dir_sep);
|
||||||
|
@ -35,13 +35,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
QHash<QString, ProValueMap> QMakeMetaInfo::cache_vars;
|
QHash<QString, ProValueMap> QMakeMetaInfo::cache_vars;
|
||||||
|
|
||||||
QMakeMetaInfo::QMakeMetaInfo(QMakeProject *_conf)
|
|
||||||
: conf(_conf)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
QMakeMetaInfo::readLib(const QString &meta_file)
|
QMakeMetaInfo::readLib(const QString &meta_file)
|
||||||
{
|
{
|
||||||
|
@ -41,11 +41,9 @@ class QMakeProject;
|
|||||||
|
|
||||||
class QMakeMetaInfo
|
class QMakeMetaInfo
|
||||||
{
|
{
|
||||||
QMakeProject *conf;
|
|
||||||
ProValueMap vars;
|
ProValueMap vars;
|
||||||
static QHash<QString, ProValueMap> cache_vars;
|
static QHash<QString, ProValueMap> cache_vars;
|
||||||
public:
|
public:
|
||||||
QMakeMetaInfo(QMakeProject *_conf);
|
|
||||||
|
|
||||||
// These functions expect the path to be normalized
|
// These functions expect the path to be normalized
|
||||||
static QString checkLib(const QString &lib);
|
static QString checkLib(const QString &lib);
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
#include "private/qloggingregistry_p.h"
|
#include "private/qloggingregistry_p.h"
|
||||||
#include "private/qcoreapplication_p.h"
|
#include "private/qcoreapplication_p.h"
|
||||||
#include "private/qsimd_p.h"
|
#include "private/qsimd_p.h"
|
||||||
|
#include <qtcore_tracepoints_p.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <qt_windows.h>
|
#include <qt_windows.h>
|
||||||
@ -1811,6 +1812,8 @@ static void ungrabMessageHandler() { }
|
|||||||
static void qt_message_print(QtMsgType msgType, const QMessageLogContext &context, const QString &message)
|
static void qt_message_print(QtMsgType msgType, const QMessageLogContext &context, const QString &message)
|
||||||
{
|
{
|
||||||
#ifndef QT_BOOTSTRAPPED
|
#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
|
// qDebug, qWarning, ... macros do not check whether category is enabled
|
||||||
if (isDefaultCategory(context.category)) {
|
if (isDefaultCategory(context.category)) {
|
||||||
if (QLoggingCategory *defaultCategory = QLoggingCategory::defaultCategory()) {
|
if (QLoggingCategory *defaultCategory = QLoggingCategory::defaultCategory()) {
|
||||||
|
@ -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...)
|
* - Q_TRACE(tracepoint, args...)
|
||||||
* Fires 'tracepoint' if it is enabled.
|
* 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...)
|
* - Q_UNCONDITIONAL_TRACE(tracepoint, args...)
|
||||||
* Fires 'tracepoint' unconditionally: no check is performed to query
|
* Fires 'tracepoint' unconditionally: no check is performed to query
|
||||||
* whether 'tracepoint' is enabled.
|
* whether 'tracepoint' is enabled.
|
||||||
@ -110,15 +117,23 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
|
#include <QtCore/qscopeguard.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#if defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
|
#if defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
|
||||||
# define Q_TRACE(x, ...) QtPrivate::trace_ ## x(__VA_ARGS__)
|
# 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_UNCONDITIONAL_TRACE(x, ...) QtPrivate::do_trace_ ## x(__VA_ARGS__)
|
||||||
# define Q_TRACE_ENABLED(x) QtPrivate::trace_ ## x ## _enabled()
|
# define Q_TRACE_ENABLED(x) QtPrivate::trace_ ## x ## _enabled()
|
||||||
#else
|
#else
|
||||||
# define Q_TRACE(x, ...)
|
# define Q_TRACE(x, ...)
|
||||||
|
# define Q_TRACE_EXIT(x, ...)
|
||||||
|
# define Q_TRACE_SCOPE(x, ...)
|
||||||
# define Q_UNCONDITIONAL_TRACE(x, ...)
|
# define Q_UNCONDITIONAL_TRACE(x, ...)
|
||||||
# define Q_TRACE_ENABLED(x) false
|
# define Q_TRACE_ENABLED(x) false
|
||||||
#endif // defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
|
#endif // defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
|
||||||
|
@ -86,15 +86,6 @@ static void appendOrganizationAndApp(QString &path) // Courtesy qstandardpaths_u
|
|||||||
#endif
|
#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)
|
static inline void appendTestMode(QString &path)
|
||||||
{
|
{
|
||||||
if (QStandardPaths::isTestModeEnabled())
|
if (QStandardPaths::isTestModeEnabled())
|
||||||
|
@ -778,7 +778,7 @@ QCoreApplication::QCoreApplication(int &argc, char **argv
|
|||||||
|
|
||||||
void QCoreApplicationPrivate::init()
|
void QCoreApplicationPrivate::init()
|
||||||
{
|
{
|
||||||
Q_TRACE(QCoreApplicationPrivate_init_entry);
|
Q_TRACE_SCOPE(QCoreApplicationPrivate_init);
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
QMacAutoReleasePool pool;
|
QMacAutoReleasePool pool;
|
||||||
@ -883,8 +883,6 @@ void QCoreApplicationPrivate::init()
|
|||||||
#ifndef QT_NO_QOBJECT
|
#ifndef QT_NO_QOBJECT
|
||||||
is_app_running = true; // No longer starting up.
|
is_app_running = true; // No longer starting up.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Q_TRACE(QCoreApplicationPrivate_init_exit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1199,7 +1197,7 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event)
|
|||||||
{
|
{
|
||||||
// Note: when adjusting the tracepoints in here
|
// Note: when adjusting the tracepoints in here
|
||||||
// consider adjusting QApplicationPrivate::notify_helper too.
|
// 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)
|
// send to all application event filters (only does anything in the main thread)
|
||||||
if (QCoreApplication::self
|
if (QCoreApplication::self
|
||||||
@ -1498,7 +1496,7 @@ bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event)
|
|||||||
*/
|
*/
|
||||||
void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
|
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) {
|
if (receiver == 0) {
|
||||||
qWarning("QCoreApplication::postEvent: Unexpected null receiver");
|
qWarning("QCoreApplication::postEvent: Unexpected null receiver");
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
{
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QEvent;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
}
|
||||||
|
|
||||||
QCoreApplicationPrivate_init_entry()
|
QCoreApplicationPrivate_init_entry()
|
||||||
QCoreApplicationPrivate_init_exit()
|
QCoreApplicationPrivate_init_exit()
|
||||||
|
|
||||||
@ -10,6 +16,7 @@ QEvent_ctor(QEvent *event, int type)
|
|||||||
QEvent_dtor(QEvent *event, int type)
|
QEvent_dtor(QEvent *event, int type)
|
||||||
|
|
||||||
QCoreApplication_postEvent_entry(QObject *receiver, 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_compressed(QObject *receiver, QEvent *event)
|
||||||
QCoreApplication_postEvent_event_posted(QObject *receiver, QEvent *event, int type)
|
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_sendSpontaneousEvent(QObject *receiver, QEvent *event, int type)
|
||||||
|
|
||||||
QCoreApplication_notify_entry(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_event_filtered(QObject *receiver, QEvent *event, int type)
|
||||||
QCoreApplication_notify_before_delivery(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)
|
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_end_slot_functor(void *slotObject)
|
||||||
QMetaObject_activate_begin_declarative_signal(QObject *sender, int signalIndex)
|
QMetaObject_activate_begin_declarative_signal(QObject *sender, int signalIndex)
|
||||||
QMetaObject_activate_end_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)
|
||||||
|
@ -501,7 +501,11 @@ bool qt_is_ascii(const char *&ptr, const char *end) Q_DECL_NOTHROW
|
|||||||
while (ptr + 4 <= end) {
|
while (ptr + 4 <= end) {
|
||||||
quint32 data = qFromUnaligned<quint32>(ptr);
|
quint32 data = qFromUnaligned<quint32>(ptr);
|
||||||
if (data &= 0x80808080U) {
|
if (data &= 0x80808080U) {
|
||||||
|
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||||
|
uint idx = qCountLeadingZeroBits(data);
|
||||||
|
#else
|
||||||
uint idx = qCountTrailingZeroBits(data);
|
uint idx = qCountTrailingZeroBits(data);
|
||||||
|
#endif
|
||||||
ptr += idx / 8;
|
ptr += idx / 8;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -231,8 +231,8 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
|
|||||||
if (screen_gamma != 0.0 && file_gamma != 0.0)
|
if (screen_gamma != 0.0 && file_gamma != 0.0)
|
||||||
png_set_gamma(png_ptr, 1.0f / screen_gamma, file_gamma);
|
png_set_gamma(png_ptr, 1.0f / screen_gamma, file_gamma);
|
||||||
|
|
||||||
png_uint_32 width;
|
png_uint_32 width = 0;
|
||||||
png_uint_32 height;
|
png_uint_32 height = 0;
|
||||||
int bit_depth = 0;
|
int bit_depth = 0;
|
||||||
int color_type = 0;
|
int color_type = 0;
|
||||||
png_bytep trans_alpha = 0;
|
png_bytep trans_alpha = 0;
|
||||||
@ -240,7 +240,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
|
|||||||
int num_trans;
|
int num_trans;
|
||||||
png_colorp palette = 0;
|
png_colorp palette = 0;
|
||||||
int num_palette;
|
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_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_method, 0, 0);
|
||||||
png_set_interlace_handling(png_ptr);
|
png_set_interlace_handling(png_ptr);
|
||||||
|
|
||||||
@ -689,7 +689,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage)
|
|||||||
QImage::Format QPngHandlerPrivate::readImageFormat()
|
QImage::Format QPngHandlerPrivate::readImageFormat()
|
||||||
{
|
{
|
||||||
QImage::Format format = QImage::Format_Invalid;
|
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;
|
int bit_depth = 0, color_type = 0;
|
||||||
png_colorp palette;
|
png_colorp palette;
|
||||||
int num_palette;
|
int num_palette;
|
||||||
|
@ -1425,7 +1425,7 @@ void QGuiApplicationPrivate::eventDispatcherReady()
|
|||||||
|
|
||||||
void QGuiApplicationPrivate::init()
|
void QGuiApplicationPrivate::init()
|
||||||
{
|
{
|
||||||
Q_TRACE(QGuiApplicationPrivate_init_entry);
|
Q_TRACE_SCOPE(QGuiApplicationPrivate_init);
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
QMacAutoReleasePool pool;
|
QMacAutoReleasePool pool;
|
||||||
@ -1589,8 +1589,6 @@ void QGuiApplicationPrivate::init()
|
|||||||
if (!QGuiApplicationPrivate::displayName)
|
if (!QGuiApplicationPrivate::displayName)
|
||||||
QObject::connect(q, &QGuiApplication::applicationNameChanged,
|
QObject::connect(q, &QGuiApplication::applicationNameChanged,
|
||||||
q, &QGuiApplication::applicationDisplayNameChanged);
|
q, &QGuiApplication::applicationDisplayNameChanged);
|
||||||
|
|
||||||
Q_TRACE(QGuiApplicationPrivate_init_exit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void qt_cleanupFontDatabase();
|
extern void qt_cleanupFontDatabase();
|
||||||
@ -1834,7 +1832,7 @@ bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArra
|
|||||||
|
|
||||||
void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
|
void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
|
||||||
{
|
{
|
||||||
Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_entry, e->type);
|
Q_TRACE_SCOPE(QGuiApplicationPrivate_processWindowSystemEvent, e->type);
|
||||||
|
|
||||||
switch(e->type) {
|
switch(e->type) {
|
||||||
case QWindowSystemInterfacePrivate::Mouse:
|
case QWindowSystemInterfacePrivate::Mouse:
|
||||||
@ -1944,8 +1942,6 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
|
|||||||
qWarning() << "Unknown user input event type:" << e->type;
|
qWarning() << "Unknown user input event type:" << e->type;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_exit, e->type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
|
@ -1378,10 +1378,8 @@ QGradient::QGradient(Preset preset)
|
|||||||
}();
|
}();
|
||||||
|
|
||||||
const QJsonValue presetData = jsonPresets[preset - 1];
|
const QJsonValue presetData = jsonPresets[preset - 1];
|
||||||
if (!presetData.isObject()) {
|
if (!presetData.isObject())
|
||||||
qWarning("QGradient: Undefined preset %i", preset);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
m_type = LinearGradient;
|
m_type = LinearGradient;
|
||||||
setCoordinateMode(ObjectMode);
|
setCoordinateMode(ObjectMode);
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
{
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QImageReader;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
}
|
||||||
|
|
||||||
QGuiApplicationPrivate_init_entry()
|
QGuiApplicationPrivate_init_entry()
|
||||||
QGuiApplicationPrivate_init_exit()
|
QGuiApplicationPrivate_init_exit()
|
||||||
|
|
||||||
|
@ -569,12 +569,10 @@ public:
|
|||||||
|
|
||||||
bool isFileSystem() const { return (m_attributes & SFGAO_FILESYSTEM) != 0; }
|
bool isFileSystem() const { return (m_attributes & SFGAO_FILESYSTEM) != 0; }
|
||||||
bool isDir() const { return (m_attributes & SFGAO_FOLDER) != 0; }
|
bool isDir() const { return (m_attributes & SFGAO_FOLDER) != 0; }
|
||||||
// Copy using IFileOperation
|
|
||||||
bool canCopy() const { return (m_attributes & SFGAO_CANCOPY) != 0; }
|
|
||||||
// Supports IStream
|
// Supports IStream
|
||||||
bool canStream() const { return (m_attributes & SFGAO_STREAM) != 0; }
|
bool canStream() const { return (m_attributes & SFGAO_STREAM) != 0; }
|
||||||
|
|
||||||
bool copyData(QIODevice *out);
|
bool copyData(QIODevice *out, QString *errorMessage);
|
||||||
|
|
||||||
static IShellItems itemsFromItemArray(IShellItemArray *items);
|
static IShellItems itemsFromItemArray(IShellItemArray *items);
|
||||||
|
|
||||||
@ -666,14 +664,19 @@ QWindowsShellItem::IShellItems QWindowsShellItem::itemsFromItemArray(IShellItemA
|
|||||||
return result;
|
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;
|
return false;
|
||||||
|
}
|
||||||
IStream *istream = nullptr;
|
IStream *istream = nullptr;
|
||||||
HRESULT hr = m_item->BindToHandler(nullptr, BHID_Stream, IID_PPV_ARGS(&istream));
|
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;
|
return false;
|
||||||
|
}
|
||||||
enum : ULONG { bufSize = 102400 };
|
enum : ULONG { bufSize = 102400 };
|
||||||
char buffer[bufSize];
|
char buffer[bufSize];
|
||||||
ULONG bytesRead;
|
ULONG bytesRead;
|
||||||
@ -686,7 +689,12 @@ bool QWindowsShellItem::copyData(QIODevice *out)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
istream->Release();
|
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
|
// Helper for "Libraries": collections of folders appearing from Windows 7
|
||||||
@ -735,8 +743,6 @@ void QWindowsShellItem::format(QDebug &d) const
|
|||||||
d << " [dir]";
|
d << " [dir]";
|
||||||
if (canStream())
|
if (canStream())
|
||||||
d << " [stream]";
|
d << " [stream]";
|
||||||
if (canCopy())
|
|
||||||
d << " [copyable]";
|
|
||||||
d << ", normalDisplay=\"" << normalDisplay()
|
d << ", normalDisplay=\"" << normalDisplay()
|
||||||
<< "\", desktopAbsoluteParsing=\"" << desktopAbsoluteParsing()
|
<< "\", desktopAbsoluteParsing=\"" << desktopAbsoluteParsing()
|
||||||
<< "\", urlString=\"" << urlString() << "\", fileSysPath=\"" << fileSysPath() << '"';
|
<< "\", urlString=\"" << urlString() << "\", fileSysPath=\"" << fileSysPath() << '"';
|
||||||
@ -1395,21 +1401,50 @@ static void cleanupTemporaryItemCopies()
|
|||||||
QFile::remove(file);
|
QFile::remove(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString createTemporaryItemCopy(QWindowsShellItem &qItem)
|
// Determine temporary file pattern from a shell item's display
|
||||||
{
|
// name. This can be a URL.
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
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();
|
return QString();
|
||||||
const QString result = targetFile.fileName();
|
const QString result = targetFile.fileName();
|
||||||
if (temporaryItemCopies()->isEmpty())
|
if (temporaryItemCopies()->isEmpty())
|
||||||
@ -1427,11 +1462,14 @@ QList<QUrl> QWindowsNativeOpenFileDialog::dialogResult() const
|
|||||||
QWindowsShellItem qItem(item);
|
QWindowsShellItem qItem(item);
|
||||||
const QString path = qItem.path();
|
const QString path = qItem.path();
|
||||||
if (path.isEmpty() && !qItem.isDir()) {
|
if (path.isEmpty() && !qItem.isDir()) {
|
||||||
const QString temporaryCopy = createTemporaryItemCopy(qItem);
|
QString errorMessage;
|
||||||
if (temporaryCopy.isEmpty())
|
const QString temporaryCopy = createTemporaryItemCopy(qItem, &errorMessage);
|
||||||
qWarning() << "Unable to create a local copy of" << qItem;
|
if (temporaryCopy.isEmpty()) {
|
||||||
else
|
qWarning().noquote() << "Unable to create a local copy of" << qItem
|
||||||
|
<< ": " << errorMessage;
|
||||||
|
} else {
|
||||||
result.append(QUrl::fromLocalFile(temporaryCopy));
|
result.append(QUrl::fromLocalFile(temporaryCopy));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
result.append(qItem.url());
|
result.append(qItem.url());
|
||||||
}
|
}
|
||||||
|
@ -110,19 +110,21 @@ static QString createGuid(const QUuid &uuid)
|
|||||||
return guid;
|
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 guard = includeGuard(fileName);
|
||||||
const QString guid = createGuid(uuid);
|
const QString guid = createGuid(uuid);
|
||||||
const QString guidString = uuid.toString();
|
const QString guidString = uuid.toString();
|
||||||
|
|
||||||
stream << "#ifndef " << guard << "\n"
|
stream << "#ifndef " << guard << "\n"
|
||||||
<< "#define " << guard << "\n"
|
<< "#define " << guard << "\n"
|
||||||
|
<< "\n"
|
||||||
<< "#include <windows.h>\n"
|
<< "#include <windows.h>\n"
|
||||||
<< "#include <TraceLoggingProvider.h>\n";
|
<< "#include <TraceLoggingProvider.h>\n"
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
/* TraceLogging API macros cannot deal with UTF8
|
/* TraceLogging API macros cannot deal with UTF8
|
||||||
* source files, so we work around it like this
|
* 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 _TlgPragmaUtf8Begin\n"
|
||||||
"#define _TlgPragmaUtf8End\n";
|
"#define _TlgPragmaUtf8End\n";
|
||||||
|
|
||||||
stream << qtHeaders();
|
|
||||||
|
|
||||||
stream << "\n";
|
stream << "\n";
|
||||||
|
stream << qtHeaders();
|
||||||
|
stream << "\n";
|
||||||
|
|
||||||
|
if (!provider.prefixText.isEmpty())
|
||||||
|
stream << provider.prefixText.join(QLatin1Char('\n')) << "\n\n";
|
||||||
|
|
||||||
stream << "#ifdef TRACEPOINT_DEFINE\n"
|
stream << "#ifdef TRACEPOINT_DEFINE\n"
|
||||||
<< "/* " << guidString << " */\n"
|
<< "/* " << guidString << " */\n"
|
||||||
<< "TRACELOGGING_DEFINE_PROVIDER(" << provider << ", \""
|
<< "TRACELOGGING_DEFINE_PROVIDER(" << providerV << ", \""
|
||||||
<< providerName <<"\", " << guid << ");\n\n";
|
<< provider.name <<"\", " << guid << ");\n\n";
|
||||||
|
|
||||||
stream << "static inline void registerProvider()\n"
|
stream << "static inline void registerProvider()\n"
|
||||||
<< "{\n"
|
<< "{\n"
|
||||||
<< " TraceLoggingRegister(" << provider << ");\n"
|
<< " TraceLoggingRegister(" << providerV << ");\n"
|
||||||
<< "}\n\n";
|
<< "}\n\n";
|
||||||
|
|
||||||
stream << "static inline void unregisterProvider()\n"
|
stream << "static inline void unregisterProvider()\n"
|
||||||
<< "{\n"
|
<< "{\n"
|
||||||
<< " TraceLoggingUnregister(" << provider << ");\n"
|
<< " TraceLoggingUnregister(" << providerV << ");\n"
|
||||||
<< "}\n";
|
<< "}\n";
|
||||||
|
|
||||||
stream << "Q_CONSTRUCTOR_FUNCTION(registerProvider)\n"
|
stream << "Q_CONSTRUCTOR_FUNCTION(registerProvider)\n"
|
||||||
<< "Q_DESTRUCTOR_FUNCTION(unregisterProvider)\n\n";
|
<< "Q_DESTRUCTOR_FUNCTION(unregisterProvider)\n\n";
|
||||||
|
|
||||||
stream << "#else\n"
|
stream << "#else\n"
|
||||||
<< "TRACELOGGING_DECLARE_PROVIDER(" << provider << ");\n"
|
<< "TRACELOGGING_DECLARE_PROVIDER(" << providerV << ");\n"
|
||||||
<< "#endif // TRACEPOINT_DEFINE\n\n";
|
<< "#endif // TRACEPOINT_DEFINE\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +229,7 @@ void writeEtw(QFile &file, const Provider &provider)
|
|||||||
|
|
||||||
const QString fileName = QFileInfo(file.fileName()).fileName();
|
const QString fileName = QFileInfo(file.fileName()).fileName();
|
||||||
|
|
||||||
writePrologue(stream, fileName, provider.name);
|
writePrologue(stream, fileName, provider);
|
||||||
writeTracepoints(stream, provider);
|
writeTracepoints(stream, provider);
|
||||||
writeEpilogue(stream, fileName);
|
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);
|
const QString guard = includeGuard(fileName);
|
||||||
|
|
||||||
|
stream << "#undef TRACEPOINT_PROVIDER\n";
|
||||||
|
stream << "#define TRACEPOINT_PROVIDER " << provider.name << "\n";
|
||||||
stream << "\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
|
/* the first guard is the usual one, the second is required
|
||||||
* by LTTNG to force the re-evaluation of TRACEPOINT_* macros
|
* 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();
|
const QString fileName = QFileInfo(file.fileName()).fileName();
|
||||||
|
|
||||||
writePrologue(stream, fileName, provider.name);
|
writePrologue(stream, fileName, provider);
|
||||||
writeTracepoints(stream, provider);
|
writeTracepoints(stream, provider);
|
||||||
writeEpilogue(stream, fileName);
|
writeEpilogue(stream, fileName);
|
||||||
}
|
}
|
||||||
|
@ -275,9 +275,21 @@ Provider parseProvider(const QString &filename)
|
|||||||
Provider provider;
|
Provider provider;
|
||||||
provider.name = QFileInfo(filename).baseName();
|
provider.name = QFileInfo(filename).baseName();
|
||||||
|
|
||||||
|
bool parsingPrefixText = false;
|
||||||
for (int lineNumber = 1; !s.atEnd(); ++lineNumber) {
|
for (int lineNumber = 1; !s.atEnd(); ++lineNumber) {
|
||||||
QString line = s.readLine().trimmed();
|
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('#')))
|
if (line.isEmpty() || line.startsWith(QLatin1Char('#')))
|
||||||
continue;
|
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
|
#ifdef TRACEGEN_DEBUG
|
||||||
|
qDebug() << provider.prefixText;
|
||||||
for (auto i = provider.tracepoints.constBegin(); i != provider.tracepoints.constEnd(); ++i)
|
for (auto i = provider.tracepoints.constBegin(); i != provider.tracepoints.constEnd(); ++i)
|
||||||
dumpTracepoint(*i);
|
dumpTracepoint(*i);
|
||||||
#endif
|
#endif
|
||||||
|
@ -86,6 +86,7 @@ struct Provider
|
|||||||
{
|
{
|
||||||
QString name;
|
QString name;
|
||||||
QVector<Tracepoint> tracepoints;
|
QVector<Tracepoint> tracepoints;
|
||||||
|
QStringList prefixText;
|
||||||
};
|
};
|
||||||
|
|
||||||
Provider parseProvider(const QString &filename);
|
Provider parseProvider(const QString &filename);
|
||||||
|
@ -3700,7 +3700,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
|
|||||||
// to the ones in QCoreApplicationPrivate::notify_helper; the reason for their
|
// to the ones in QCoreApplicationPrivate::notify_helper; the reason for their
|
||||||
// duplication is because tracepoint symbols are not exported by QtCore.
|
// duplication is because tracepoint symbols are not exported by QtCore.
|
||||||
// If you adjust the tracepoints here, consider adjusting QCoreApplicationPrivate too.
|
// 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
|
// send to all application event filters
|
||||||
if (threadRequiresCoreApplication()
|
if (threadRequiresCoreApplication()
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
|
{
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QEvent;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
}
|
||||||
|
|
||||||
QApplication_notify_entry(QObject *receiver, QEvent *event, int type)
|
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_event_filtered(QObject *receiver, QEvent *event, int type)
|
||||||
QApplication_notify_before_delivery(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)
|
QApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed)
|
||||||
|
@ -4,5 +4,3 @@
|
|||||||
windows ci
|
windows ci
|
||||||
[blockingLookup:a-plus-aaaa]
|
[blockingLookup:a-plus-aaaa]
|
||||||
windows ci
|
windows ci
|
||||||
[reverseLookup:google-public-dns-a.google.com]
|
|
||||||
ci
|
|
||||||
|
@ -396,6 +396,68 @@ void tst_QHostInfo::lookupConnectToLambda()
|
|||||||
QCOMPARE(tmp.join(' '), expected.join(' '));
|
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()
|
void tst_QHostInfo::reverseLookup_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QString>("address");
|
QTest::addColumn<QString>("address");
|
||||||
@ -403,8 +465,8 @@ void tst_QHostInfo::reverseLookup_data()
|
|||||||
QTest::addColumn<int>("err");
|
QTest::addColumn<int>("err");
|
||||||
QTest::addColumn<bool>("ipv6");
|
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("dns.google") << QString("8.8.8.8") << reverseLookupHelper("8.8.8.8") << 0 << false;
|
||||||
QTest::newRow("gitorious.org") << QString("87.238.52.168") << QStringList(QString("gitorious.org")) << 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;
|
QTest::newRow("bogus-name") << QString("1::2::3::4") << QStringList() << 1 << true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,6 +484,8 @@ void tst_QHostInfo::reverseLookup()
|
|||||||
QHostInfo info = QHostInfo::fromName(address);
|
QHostInfo info = QHostInfo::fromName(address);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
|
if (!hostNames.contains(info.hostName()))
|
||||||
|
qDebug() << "Failure: expecting" << hostNames << ",got " << info.hostName();
|
||||||
QVERIFY(hostNames.contains(info.hostName()));
|
QVERIFY(hostNames.contains(info.hostName()));
|
||||||
QCOMPARE(info.addresses().first(), QHostAddress(address));
|
QCOMPARE(info.addresses().first(), QHostAddress(address));
|
||||||
} else {
|
} else {
|
||||||
|
@ -505,8 +505,15 @@ void FileDialogPanel::accepted()
|
|||||||
Q_ASSERT(d);
|
Q_ASSERT(d);
|
||||||
m_result.clear();
|
m_result.clear();
|
||||||
QDebug(&m_result).nospace()
|
QDebug(&m_result).nospace()
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
<< "URLs: " << d->selectedUrls() << '\n'
|
||||||
|
#endif
|
||||||
<< "Files: " << d->selectedFiles()
|
<< "Files: " << d->selectedFiles()
|
||||||
<< "\nDirectory: " << d->directory().absolutePath()
|
<< "\nDirectory: "
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
<< d->directoryUrl() << ", "
|
||||||
|
#endif
|
||||||
|
<< d->directory().absolutePath()
|
||||||
<< "\nName filter: " << d->selectedNameFilter();
|
<< "\nName filter: " << d->selectedNameFilter();
|
||||||
QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
|
QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user