From bd48f0e5edb1d5ce10529360fb9d14e7b7135022 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 20 Jul 2016 15:35:50 +0200 Subject: Tooling: Convert connects to Qt5 style Change-Id: I6746b777f73d047f5cf610bfca9b320ac1e13676 Reviewed-by: Simon Hausmann --- .../qmltooling/packetprotocol/qpacketprotocol.cpp | 18 ++--- .../qmltooling/packetprotocol/qpacketprotocol_p.h | 2 +- .../qmldbg_debugger/qqmlenginedebugservice.cpp | 10 ++- .../qmldbg_debugger/qqmlenginedebugservice.h | 10 +-- .../qmltooling/qmldbg_debugger/qqmlwatcher.cpp | 5 +- .../qmltooling/qmldbg_debugger/qv4debugger.cpp | 4 +- .../qmltooling/qmldbg_debugger/qv4debugger.h | 5 +- .../qmltooling/qmldbg_debugger/qv4debuggeragent.h | 1 - .../qmldbg_inspector/globalinspector.cpp | 9 ++- .../qmltooling/qmldbg_inspector/globalinspector.h | 4 +- .../qmltooling/qmldbg_inspector/highlight.cpp | 26 ++++---- .../qmltooling/qmldbg_inspector/highlight.h | 7 +- .../qmldbg_inspector/qqmlinspectorservice.cpp | 14 ++-- .../qmldbg_local/qlocalclientconnection.cpp | 7 +- .../qmldbg_native/qqmlnativedebugconnector.h | 4 +- .../qmldbg_profiler/qqmlprofileradapter.cpp | 27 ++++---- .../qmldbg_profiler/qqmlprofileradapter.h | 1 - .../qmldbg_profiler/qqmlprofilerservice.cpp | 14 ++-- .../qmldbg_profiler/qqmlprofilerservice.h | 4 +- .../qmldbg_profiler/qv4profileradapter.cpp | 37 +++++------ .../qmldbg_profiler/qv4profileradapter.h | 13 ++-- .../qmldbg_quickprofiler/qquickprofileradapter.cpp | 28 ++++---- .../qmldbg_quickprofiler/qquickprofileradapter.h | 2 - .../qmltooling/qmldbg_server/qqmldebugserver.cpp | 76 ++++++++++++---------- .../qmltooling/qmldbg_tcp/qtcpserverconnection.cpp | 7 +- src/plugins/qmltooling/shared/qqmldebugserver.h | 2 +- src/qml/debugger/qqmldebugservice.cpp | 3 +- src/qml/debugger/qqmldebugserviceinterfaces_p.h | 14 ++-- src/qml/debugger/qqmlprofiler_p.h | 3 +- src/qml/jsruntime/qv4profiling_p.h | 1 - src/qmldebug/qqmldebugconnection.cpp | 53 +++++++-------- src/qmldebug/qqmldebugconnection_p.h | 2 +- src/qmldebug/qqmlprofilerclient_p.h | 2 - src/quick/util/qquickprofiler.cpp | 9 ++- src/quick/util/qquickprofiler_p.h | 7 +- 35 files changed, 211 insertions(+), 220 deletions(-) (limited to 'src') diff --git a/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp b/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp index d20ddf9dc0..e541810330 100644 --- a/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp +++ b/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp @@ -124,12 +124,9 @@ QPacketProtocol::QPacketProtocol(QIODevice *dev, QObject *parent) Q_ASSERT(4 == sizeof(qint32)); Q_ASSERT(dev); - QObject::connect(dev, SIGNAL(readyRead()), - this, SLOT(readyToRead())); - QObject::connect(dev, SIGNAL(aboutToClose()), - this, SLOT(aboutToClose())); - QObject::connect(dev, SIGNAL(bytesWritten(qint64)), - this, SLOT(bytesWritten(qint64))); + QObject::connect(dev, &QIODevice::readyRead, this, &QPacketProtocol::readyToRead); + QObject::connect(dev, &QIODevice::aboutToClose, this, &QPacketProtocol::aboutToClose); + QObject::connect(dev, &QIODevice::bytesWritten, this, &QPacketProtocol::bytesWritten); } /*! @@ -247,12 +244,9 @@ void QPacketProtocol::readyToRead() // Check sizing constraints if (d->inProgressSize > MAX_PACKET_SIZE) { - QObject::disconnect(d->dev, SIGNAL(readyRead()), - this, SLOT(readyToRead())); - QObject::disconnect(d->dev, SIGNAL(aboutToClose()), - this, SLOT(aboutToClose())); - QObject::disconnect(d->dev, SIGNAL(bytesWritten(qint64)), - this, SLOT(bytesWritten(qint64))); + disconnect(d->dev, &QIODevice::readyRead, this, &QPacketProtocol::readyToRead); + disconnect(d->dev, &QIODevice::aboutToClose, this, &QPacketProtocol::aboutToClose); + disconnect(d->dev, &QIODevice::bytesWritten, this, &QPacketProtocol::bytesWritten); d->dev = 0; emit invalidPacket(); return; diff --git a/src/plugins/qmltooling/packetprotocol/qpacketprotocol_p.h b/src/plugins/qmltooling/packetprotocol/qpacketprotocol_p.h index 8f95a081e9..7fd722f17f 100644 --- a/src/plugins/qmltooling/packetprotocol/qpacketprotocol_p.h +++ b/src/plugins/qmltooling/packetprotocol/qpacketprotocol_p.h @@ -74,7 +74,7 @@ Q_SIGNALS: void readyRead(); void invalidPacket(); -private Q_SLOTS: +private: void aboutToClose(); void bytesWritten(qint64 bytes); void readyToRead(); diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp index e49b15218e..12ed987ca0 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp @@ -63,8 +63,12 @@ QT_BEGIN_NAMESPACE QQmlEngineDebugServiceImpl::QQmlEngineDebugServiceImpl(QObject *parent) : QQmlEngineDebugService(2, parent), m_watch(new QQmlWatcher(this)), m_statesDelegate(0) { - QObject::connect(m_watch, SIGNAL(propertyChanged(int,int,QMetaProperty,QVariant)), - this, SLOT(propertyChanged(int,int,QMetaProperty,QVariant))); + connect(m_watch, &QQmlWatcher::propertyChanged, + this, &QQmlEngineDebugServiceImpl::propertyChanged); + + // Move the message into the correct thread for processing + connect(this, &QQmlEngineDebugServiceImpl::scheduleMessage, + this, &QQmlEngineDebugServiceImpl::processMessage, Qt::QueuedConnection); } QQmlEngineDebugServiceImpl::~QQmlEngineDebugServiceImpl() @@ -420,7 +424,7 @@ QQmlEngineDebugServiceImpl::objectData(QObject *object) void QQmlEngineDebugServiceImpl::messageReceived(const QByteArray &message) { - QMetaObject::invokeMethod(this, "processMessage", Qt::QueuedConnection, Q_ARG(QByteArray, message)); + emit scheduleMessage(message); } /*! diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h index cb75a63850..2e40eb4de8 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h @@ -101,16 +101,18 @@ public: void setStatesDelegate(QQmlDebugStatesDelegate *) Q_DECL_OVERRIDE; +signals: + void scheduleMessage(const QByteArray &); + protected: virtual void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; -private Q_SLOTS: - void processMessage(const QByteArray &msg); - void propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value); - private: friend class QQmlDebuggerServiceFactory; + void processMessage(const QByteArray &msg); + void propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value); + void prepareDeferredObjects(QObject *); void buildObjectList(QDataStream &, QQmlContext *, const QList > &instances); diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp index 392080dd51..1214212727 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp @@ -69,7 +69,7 @@ public: QQmlWatcher *parent = 0); public slots: - void notifyValueChanged(); + void notifyValueChanged(); // Needs to be a slot because of QQmlPropertyPrivate::connect() private: friend class QQmlWatcher; @@ -88,7 +88,8 @@ QQmlWatchProxy::QQmlWatchProxy(int id, QQmlWatcher *parent) : QObject(parent), m_id(id), m_watch(parent), m_object(0), m_debugId(debugId), m_expr(exp) { - QObject::connect(m_expr, SIGNAL(valueChanged()), this, SLOT(notifyValueChanged())); + QObject::connect(m_expr, &QQmlExpression::valueChanged, + this, &QQmlWatchProxy::notifyValueChanged); } QQmlWatchProxy::QQmlWatchProxy(int id, diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp index 53f2eab5ff..44810dd4cb 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp @@ -79,6 +79,8 @@ QV4Debugger::QV4Debugger(QV4::ExecutionEngine *engine) static int pauseReasonId = qRegisterMetaType(); Q_UNUSED(debuggerId); Q_UNUSED(pauseReasonId); + connect(this, &QV4Debugger::scheduleJob, + this, &QV4Debugger::runJobUnpaused, Qt::QueuedConnection); } QV4::ExecutionEngine *QV4Debugger::engine() const @@ -320,7 +322,7 @@ void QV4Debugger::runInEngine_havingLock(QV4DebugJob *job) if (state() == Paused) m_runningCondition.wakeAll(); else - QMetaObject::invokeMethod(this, "runJobUnpaused", Qt::QueuedConnection); + emit scheduleJob(); m_jobIsRunning.wait(&m_lock); m_runningJob = 0; } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.h b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.h index 3a5b6080cb..cd412e573d 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.h @@ -140,15 +140,14 @@ public: signals: void debuggerPaused(QV4Debugger *self, QV4Debugger::PauseReason reason); - -private slots: - void runJobUnpaused(); + void scheduleJob(); private: // requires lock to be held void pauseAndWait(PauseReason reason); bool reallyHitTheBreakPoint(const QString &filename, int linenr); void runInEngine_havingLock(QV4DebugJob *job); + void runJobUnpaused(); QV4::ExecutionEngine *m_engine; QV4::PersistentValue m_currentContext; diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.h b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.h index 1c7eb50ac7..39ac4d4dcb 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.h @@ -72,7 +72,6 @@ public: void setBreakOnThrow(bool onoff); void clearAllPauseRequests(); -public slots: void debuggerPaused(QV4Debugger *debugger, QV4Debugger::PauseReason reason); void handleDebuggerDeleted(QObject *debugger); diff --git a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp index 2150b68f32..107d54c626 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp @@ -148,10 +148,6 @@ public: m_component.setData(qml, filename); } -signals: - void result(int requestId, bool success); - -public slots: void tryCreateObject(QQmlComponent::Status status) { switch (status) { @@ -171,7 +167,7 @@ public slots: else emit result(m_requestId, false); } - delete this; + deleteLater(); // The component might send more signals return; } default: @@ -179,6 +175,9 @@ public slots: } } +signals: + void result(int requestId, bool success); + private: QQmlComponent m_component; int m_requestId; diff --git a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.h b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.h index 7bbe6d6aa2..338eee14c3 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.h +++ b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.h @@ -72,10 +72,8 @@ public: signals: void messageToClient(const QString &name, const QByteArray &data); -private slots: - void sendResult(int requestId, bool success); - private: + void sendResult(int requestId, bool success); void sendCurrentObjects(const QList &objects); void removeFromSelectedItems(QObject *object); QString titleForItem(QQuickItem *item) const; diff --git a/src/plugins/qmltooling/qmldbg_inspector/highlight.cpp b/src/plugins/qmltooling/qmldbg_inspector/highlight.cpp index 26eb0f8ed8..88a6ea6b6d 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/highlight.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/highlight.cpp @@ -72,24 +72,22 @@ void Highlight::setItem(QQuickItem *item) m_item->disconnect(this); if (item) { - connect(item, SIGNAL(xChanged()), SLOT(adjust())); - connect(item, SIGNAL(yChanged()), SLOT(adjust())); - connect(item, SIGNAL(widthChanged()), SLOT(adjust())); - connect(item, SIGNAL(heightChanged()), SLOT(adjust())); - connect(item, SIGNAL(rotationChanged()), SLOT(adjust())); - connect(item, SIGNAL(transformOriginChanged(TransformOrigin)), - SLOT(adjust())); + connect(item, &QQuickItem::xChanged, this, &Highlight::adjust); + connect(item, &QQuickItem::yChanged, this, &Highlight::adjust); + connect(item, &QQuickItem::widthChanged, this, &Highlight::adjust); + connect(item, &QQuickItem::heightChanged, this, &Highlight::adjust); + connect(item, &QQuickItem::rotationChanged, this, &Highlight::adjust); + connect(item, &QQuickItem::transformOriginChanged, this, &Highlight::adjust); } QQuickWindow *view = item->window(); QQuickItem * contentItem = view->contentItem(); if (contentItem) { - connect(contentItem, SIGNAL(xChanged()), SLOT(adjust())); - connect(contentItem, SIGNAL(yChanged()), SLOT(adjust())); - connect(contentItem, SIGNAL(widthChanged()), SLOT(adjust())); - connect(contentItem, SIGNAL(heightChanged()), SLOT(adjust())); - connect(contentItem, SIGNAL(rotationChanged()), SLOT(adjust())); - connect(contentItem, SIGNAL(transformOriginChanged(TransformOrigin)), - SLOT(adjust())); + connect(contentItem, &QQuickItem::xChanged, this, &Highlight::adjust); + connect(contentItem, &QQuickItem::yChanged, this, &Highlight::adjust); + connect(contentItem, &QQuickItem::widthChanged, this, &Highlight::adjust); + connect(contentItem, &QQuickItem::heightChanged, this, &Highlight::adjust); + connect(contentItem, &QQuickItem::rotationChanged, this, &Highlight::adjust); + connect(contentItem, &QQuickItem::transformOriginChanged, this, &Highlight::adjust); } m_item = item; setContentsSize(view->size()); diff --git a/src/plugins/qmltooling/qmldbg_inspector/highlight.h b/src/plugins/qmltooling/qmldbg_inspector/highlight.h index 4a85cb4d50..2bf4fc1ad5 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/highlight.h +++ b/src/plugins/qmltooling/qmldbg_inspector/highlight.h @@ -65,8 +65,6 @@ protected: private: void initRenderDetails(); - -private slots: void adjust(); private: @@ -86,13 +84,12 @@ public: void paint(QPainter *painter); void showName(const QPointF &displayPoint); -private slots: - void disableNameDisplay(); - private: QPointF m_displayPoint; QString m_name; bool m_nameDisplayActive; + + void disableNameDisplay(); }; /** diff --git a/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp b/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp index 48a3f656b0..ab1aeebf64 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp @@ -55,23 +55,27 @@ public: void setParentWindow(QQuickWindow *window, QWindow *parent) Q_DECL_OVERRIDE; void removeWindow(QQuickWindow *window) Q_DECL_OVERRIDE; +signals: + void scheduleMessage(const QByteArray &message); + protected: virtual void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; -private slots: - void messageFromClient(const QByteArray &message); - private: friend class QQmlInspectorServiceFactory; QmlJSDebugger::GlobalInspector *checkInspector(); QmlJSDebugger::GlobalInspector *m_globalInspector; QHash m_waitingWindows; + + void messageFromClient(const QByteArray &message); }; QQmlInspectorServiceImpl::QQmlInspectorServiceImpl(QObject *parent): QQmlInspectorService(1, parent), m_globalInspector(0) { + connect(this, &QQmlInspectorServiceImpl::scheduleMessage, + this, &QQmlInspectorServiceImpl::messageFromClient, Qt::QueuedConnection); } QmlJSDebugger::GlobalInspector *QQmlInspectorServiceImpl::checkInspector() @@ -122,8 +126,8 @@ void QQmlInspectorServiceImpl::setParentWindow(QQuickWindow *window, QWindow *pa void QQmlInspectorServiceImpl::messageReceived(const QByteArray &message) { - QMetaObject::invokeMethod(this, "messageFromClient", Qt::QueuedConnection, - Q_ARG(QByteArray, message)); + // Move the message to the right thread via queued signal + emit scheduleMessage(message); } void QQmlInspectorServiceImpl::messageFromClient(const QByteArray &message) diff --git a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp index 01c24f2395..64b26bdd0d 100644 --- a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp +++ b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp @@ -65,10 +65,8 @@ public: void waitForConnection(); void flush(); -private slots: - void connectionEstablished(); - private: + void connectionEstablished(); bool connectToServer(); bool m_block; @@ -135,7 +133,8 @@ bool QLocalClientConnection::connectToServer() { m_socket = new QLocalSocket; m_socket->setParent(this); - QObject::connect(m_socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); + QObject::connect(m_socket, &QLocalSocket::connected, + this, &QLocalClientConnection::connectionEstablished); m_socket->connectToServer(m_filename); qDebug("QML Debugger: Connecting to socket %s...", m_filename.toLatin1().constData()); return true; diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h index 03b5b5eb1e..1184925e53 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h @@ -63,11 +63,9 @@ public: bool open(const QVariantHash &configuration) Q_DECL_OVERRIDE; static void setDataStreamVersion(int version); -private slots: +private: void sendMessage(const QString &name, const QByteArray &message); void sendMessages(const QString &name, const QList &messages); - -private: void announceObjectAvailability(const QString &objectType, QObject *object, bool available); QVector m_services; diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp index f161f988de..ea052f0475 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp @@ -49,19 +49,20 @@ QQmlProfilerAdapter::QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEngin { setService(service); engine->enableProfiler(); - connect(this, SIGNAL(profilingEnabled(quint64)), engine->profiler, SLOT(startProfiling(quint64))); - connect(this, SIGNAL(profilingEnabledWhileWaiting(quint64)), - engine->profiler, SLOT(startProfiling(quint64)), Qt::DirectConnection); - connect(this, SIGNAL(profilingDisabled()), engine->profiler, SLOT(stopProfiling())); - connect(this, SIGNAL(profilingDisabledWhileWaiting()), - engine->profiler, SLOT(stopProfiling()), Qt::DirectConnection); - connect(this, SIGNAL(dataRequested(bool)), engine->profiler, SLOT(reportData(bool))); - connect(this, SIGNAL(referenceTimeKnown(QElapsedTimer)), - engine->profiler, SLOT(setTimer(QElapsedTimer))); - connect(engine->profiler, - SIGNAL(dataReady(QVector,QQmlProfiler::LocationHash)), - this, - SLOT(receiveData(QVector,QQmlProfiler::LocationHash))); + connect(this, &QQmlProfilerAdapter::profilingEnabled, + engine->profiler, &QQmlProfiler::startProfiling); + connect(this, &QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting, + engine->profiler, &QQmlProfiler::startProfiling, Qt::DirectConnection); + connect(this, &QQmlAbstractProfilerAdapter::profilingDisabled, + engine->profiler, &QQmlProfiler::stopProfiling); + connect(this, &QQmlAbstractProfilerAdapter::profilingDisabledWhileWaiting, + engine->profiler, &QQmlProfiler::stopProfiling, Qt::DirectConnection); + connect(this, &QQmlAbstractProfilerAdapter::dataRequested, + engine->profiler, &QQmlProfiler::reportData); + connect(this, &QQmlAbstractProfilerAdapter::referenceTimeKnown, + engine->profiler, &QQmlProfiler::setTimer); + connect(engine->profiler, &QQmlProfiler::dataReady, + this, &QQmlProfilerAdapter::receiveData); } // convert to QByteArrays that can be sent to the debug client diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h index 96cdcd6d38..1fee5c389f 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h @@ -63,7 +63,6 @@ public: qint64 sendMessages(qint64 until, QList &messages, bool trackLocations) Q_DECL_OVERRIDE; -public slots: void receiveData(const QVector &new_data, const QQmlProfiler::LocationHash &locations); diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp index 425543d27a..dba2fd3cc3 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp @@ -409,14 +409,16 @@ void QQmlProfilerServiceImpl::messageReceived(const QByteArray &message) if (!stream.atEnd()) { stream >> flushInterval; m_flushTimer.setInterval(flushInterval); + auto timerStart = static_cast(&QTimer::start); if (flushInterval > 0) { - connect(&m_flushTimer, SIGNAL(timeout()), this, SLOT(flush())); - connect(this, SIGNAL(startFlushTimer()), &m_flushTimer, SLOT(start())); - connect(this, SIGNAL(stopFlushTimer()), &m_flushTimer, SLOT(stop())); + connect(&m_flushTimer, &QTimer::timeout, this, &QQmlProfilerServiceImpl::flush); + connect(this, &QQmlProfilerServiceImpl::startFlushTimer, &m_flushTimer, timerStart); + connect(this, &QQmlProfilerServiceImpl::stopFlushTimer, &m_flushTimer, &QTimer::stop); } else { - disconnect(&m_flushTimer, SIGNAL(timeout()), this, SLOT(flush())); - disconnect(this, SIGNAL(startFlushTimer()), &m_flushTimer, SLOT(start())); - disconnect(this, SIGNAL(stopFlushTimer()), &m_flushTimer, SLOT(stop())); + disconnect(&m_flushTimer, &QTimer::timeout, this, &QQmlProfilerServiceImpl::flush); + disconnect(this, &QQmlProfilerServiceImpl::startFlushTimer, &m_flushTimer, timerStart); + disconnect(this, &QQmlProfilerServiceImpl::stopFlushTimer, + &m_flushTimer, &QTimer::stop); } } if (!stream.atEnd()) diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h index 42efdefd12..bbfc32b681 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h @@ -99,9 +99,6 @@ signals: void startFlushTimer(); void stopFlushTimer(); -private slots: - void flush(); - protected: virtual void stateAboutToBeChanged(State state) Q_DECL_OVERRIDE; virtual void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; @@ -112,6 +109,7 @@ private: void sendMessages(); void addEngineProfiler(QQmlAbstractProfilerAdapter *profiler, QJSEngine *engine); void removeProfilerFromStartTimes(const QQmlAbstractProfilerAdapter *profiler); + void flush(); QElapsedTimer m_timer; QTimer m_flushTimer; diff --git a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp index c3bbb86e3a..084ac9e489 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp @@ -47,26 +47,25 @@ QV4ProfilerAdapter::QV4ProfilerAdapter(QQmlProfilerService *service, QV4::Execut { setService(service); engine->enableProfiler(); - connect(this, SIGNAL(profilingEnabled(quint64)), - this, SLOT(forwardEnabled(quint64))); - connect(this, SIGNAL(profilingEnabledWhileWaiting(quint64)), - this, SLOT(forwardEnabledWhileWaiting(quint64)), Qt::DirectConnection); - connect(this, SIGNAL(v4ProfilingEnabled(quint64)), - engine->profiler, SLOT(startProfiling(quint64))); - connect(this, SIGNAL(v4ProfilingEnabledWhileWaiting(quint64)), - engine->profiler, SLOT(startProfiling(quint64)), Qt::DirectConnection); - connect(this, SIGNAL(profilingDisabled()), engine->profiler, SLOT(stopProfiling())); - connect(this, SIGNAL(profilingDisabledWhileWaiting()), engine->profiler, SLOT(stopProfiling()), + connect(this, &QQmlAbstractProfilerAdapter::profilingEnabled, + this, &QV4ProfilerAdapter::forwardEnabled); + connect(this, &QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting, + this, &QV4ProfilerAdapter::forwardEnabledWhileWaiting, Qt::DirectConnection); + connect(this, &QV4ProfilerAdapter::v4ProfilingEnabled, + engine->profiler, &QV4::Profiling::Profiler::startProfiling); + connect(this, &QV4ProfilerAdapter::v4ProfilingEnabledWhileWaiting, + engine->profiler, &QV4::Profiling::Profiler::startProfiling, Qt::DirectConnection); + connect(this, &QQmlAbstractProfilerAdapter::profilingDisabled, + engine->profiler, &QV4::Profiling::Profiler::stopProfiling); + connect(this, &QQmlAbstractProfilerAdapter::profilingDisabledWhileWaiting, + engine->profiler, &QV4::Profiling::Profiler::stopProfiling, Qt::DirectConnection); - connect(this, SIGNAL(dataRequested(bool)), engine->profiler, SLOT(reportData(bool))); - connect(this, SIGNAL(referenceTimeKnown(QElapsedTimer)), - engine->profiler, SLOT(setTimer(QElapsedTimer))); - connect(engine->profiler, SIGNAL(dataReady(QV4::Profiling::FunctionLocationHash, - QVector, - QVector)), - this, SLOT(receiveData(QV4::Profiling::FunctionLocationHash, - QVector, - QVector))); + connect(this, &QQmlAbstractProfilerAdapter::dataRequested, + engine->profiler, &QV4::Profiling::Profiler::reportData); + connect(this, &QQmlAbstractProfilerAdapter::referenceTimeKnown, + engine->profiler, &QV4::Profiling::Profiler::setTimer); + connect(engine->profiler, &QV4::Profiling::Profiler::dataReady, + this, &QV4ProfilerAdapter::receiveData); } qint64 QV4ProfilerAdapter::appendMemoryEvents(qint64 until, QList &messages, diff --git a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h index 13a595f6eb..5d5b83f7ca 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h @@ -70,18 +70,13 @@ public: virtual qint64 sendMessages(qint64 until, QList &messages, bool trackLocations) override; -signals: - void v4ProfilingEnabled(quint64 v4Features); - void v4ProfilingEnabledWhileWaiting(quint64 v4Features); - -public slots: void receiveData(const QV4::Profiling::FunctionLocationHash &, const QVector &, const QVector &); -private slots: - void forwardEnabled(quint64 features); - void forwardEnabledWhileWaiting(quint64 features); +signals: + void v4ProfilingEnabled(quint64 v4Features); + void v4ProfilingEnabledWhileWaiting(quint64 v4Features); private: QV4::Profiling::FunctionLocationHash m_functionLocations; @@ -93,6 +88,8 @@ private: qint64 appendMemoryEvents(qint64 until, QList &messages, QQmlDebugPacket &d); qint64 finalizeMessages(qint64 until, QList &messages, qint64 callNext, QQmlDebugPacket &d); + void forwardEnabled(quint64 features); + void forwardEnabledWhileWaiting(quint64 features); static quint64 translateFeatures(quint64 qmlFeatures); }; diff --git a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp index bebf8806c6..0c9fc36463 100644 --- a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp @@ -51,20 +51,20 @@ QQuickProfilerAdapter::QQuickProfilerAdapter(QObject *parent) : QQuickProfiler::initialize(this); // We can always do DirectConnection here as all methods are protected by mutexes - connect(this, SIGNAL(profilingEnabled(quint64)), - QQuickProfiler::s_instance, SLOT(startProfilingImpl(quint64)), Qt::DirectConnection); - connect(this, SIGNAL(profilingEnabledWhileWaiting(quint64)), - QQuickProfiler::s_instance, SLOT(startProfilingImpl(quint64)), Qt::DirectConnection); - connect(this, SIGNAL(referenceTimeKnown(QElapsedTimer)), - QQuickProfiler::s_instance, SLOT(setTimer(QElapsedTimer)), Qt::DirectConnection); - connect(this, SIGNAL(profilingDisabled()), - QQuickProfiler::s_instance, SLOT(stopProfilingImpl()), Qt::DirectConnection); - connect(this, SIGNAL(profilingDisabledWhileWaiting()), - QQuickProfiler::s_instance, SLOT(stopProfilingImpl()), Qt::DirectConnection); - connect(this, SIGNAL(dataRequested(bool)), - QQuickProfiler::s_instance, SLOT(reportDataImpl(bool)), Qt::DirectConnection); - connect(QQuickProfiler::s_instance, SIGNAL(dataReady(QVector)), - this, SLOT(receiveData(QVector)), Qt::DirectConnection); + connect(this, &QQmlAbstractProfilerAdapter::profilingEnabled, + QQuickProfiler::s_instance, &QQuickProfiler::startProfilingImpl, Qt::DirectConnection); + connect(this, &QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting, + QQuickProfiler::s_instance, &QQuickProfiler::startProfilingImpl, Qt::DirectConnection); + connect(this, &QQmlAbstractProfilerAdapter::referenceTimeKnown, + QQuickProfiler::s_instance, &QQuickProfiler::setTimer, Qt::DirectConnection); + connect(this, &QQmlAbstractProfilerAdapter::profilingDisabled, + QQuickProfiler::s_instance, &QQuickProfiler::stopProfilingImpl, Qt::DirectConnection); + connect(this, &QQmlAbstractProfilerAdapter::profilingDisabledWhileWaiting, + QQuickProfiler::s_instance, &QQuickProfiler::stopProfilingImpl, Qt::DirectConnection); + connect(this, &QQmlAbstractProfilerAdapter::dataRequested, + QQuickProfiler::s_instance, &QQuickProfiler::reportDataImpl, Qt::DirectConnection); + connect(QQuickProfiler::s_instance, &QQuickProfiler::dataReady, + this, &QQuickProfilerAdapter::receiveData, Qt::DirectConnection); } QQuickProfilerAdapter::~QQuickProfilerAdapter() diff --git a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.h b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.h index f1ba411ac5..1ad020afd6 100644 --- a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.h +++ b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.h @@ -62,8 +62,6 @@ public: QQuickProfilerAdapter(QObject *parent = 0); ~QQuickProfilerAdapter(); qint64 sendMessages(qint64 until, QList &messages, bool trackLocations) override; - -public slots: void receiveData(const QVector &new_data); private: diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp index cbde86e389..96b3455790 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp @@ -149,15 +149,6 @@ public: static void cleanup(); -private slots: - void wakeEngine(QJSEngine *engine); - void sendMessage(const QString &name, const QByteArray &message); - void sendMessages(const QString &name, const QList &messages); - void changeServiceState(const QString &serviceName, QQmlDebugService::State state); - void removeThread(); - void receiveMessage(); - void invalidPacket(); - private: friend class QQmlDebugServerThread; friend class QQmlDebugServerFactory; @@ -179,6 +170,13 @@ private: bool canSendMessage(const QString &name); void doSendMessage(const QString &name, const QByteArray &message); + void wakeEngine(QJSEngine *engine); + void sendMessage(const QString &name, const QByteArray &message); + void sendMessages(const QString &name, const QList &messages); + void changeServiceState(const QString &serviceName, QQmlDebugService::State state); + void removeThread(); + void receiveMessage(); + void invalidPacket(); QQmlDebugServerConnection *m_connection; QHash m_plugins; @@ -203,18 +201,22 @@ void QQmlDebugServerImpl::cleanup() if (!server) return; - for (QHash::ConstIterator i = server->m_plugins.constBegin(); - i != server->m_plugins.constEnd(); ++i) { - server->m_changeServiceStateCalls.ref(); - QMetaObject::invokeMethod(server, "changeServiceState", Qt::QueuedConnection, - Q_ARG(QString, i.key()), - Q_ARG(QQmlDebugService::State, - QQmlDebugService::NotConnected)); + { + QObject signalSource; + for (QHash::ConstIterator i = server->m_plugins.constBegin(); + i != server->m_plugins.constEnd(); ++i) { + server->m_changeServiceStateCalls.ref(); + QString key = i.key(); + // Process this in the server's thread. + connect(&signalSource, &QObject::destroyed, server, [key, server](){ + server->changeServiceState(key, QQmlDebugService::NotConnected); + }, Qt::QueuedConnection); + } } // Wait for changeServiceState calls to finish // (while running an event loop because some services - // might again use slots to execute stuff in the GUI thread) + // might again defer execution of stuff in the GUI thread) QEventLoop loop; while (!server->m_changeServiceStateCalls.testAndSetOrdered(0, 0)) loop.processEvents(); @@ -293,7 +295,7 @@ QQmlDebugServerImpl::QQmlDebugServerImpl() : // Remove the thread immmediately when it finishes, so that we don't have to wait for the // event loop to signal that. - QObject::connect(&m_thread, SIGNAL(finished()), this, SLOT(removeThread()), + QObject::connect(&m_thread, &QThread::finished, this, &QQmlDebugServerImpl::removeThread, Qt::DirectConnection); m_thread.setObjectName(QStringLiteral("QQmlDebugServerThread")); parseArguments(); @@ -631,15 +633,15 @@ bool QQmlDebugServerImpl::addService(const QString &name, QQmlDebugService *serv if (!service || m_plugins.contains(name)) return false; - connect(service, SIGNAL(messageToClient(QString,QByteArray)), - this, SLOT(sendMessage(QString,QByteArray))); - connect(service, SIGNAL(messagesToClient(QString,QList)), - this, SLOT(sendMessages(QString,QList))); + connect(service, &QQmlDebugService::messageToClient, + this, &QQmlDebugServerImpl::sendMessage); + connect(service, &QQmlDebugService::messagesToClient, + this, &QQmlDebugServerImpl::sendMessages); - connect(service, SIGNAL(attachedToEngine(QJSEngine*)), - this, SLOT(wakeEngine(QJSEngine*)), Qt::QueuedConnection); - connect(service, SIGNAL(detachedFromEngine(QJSEngine*)), - this, SLOT(wakeEngine(QJSEngine*)), Qt::QueuedConnection); + connect(service, &QQmlDebugService::attachedToEngine, + this, &QQmlDebugServerImpl::wakeEngine, Qt::QueuedConnection); + connect(service, &QQmlDebugService::detachedFromEngine, + this, &QQmlDebugServerImpl::wakeEngine, Qt::QueuedConnection); service->setState(QQmlDebugService::Unavailable); m_plugins.insert(name, service); @@ -659,15 +661,15 @@ bool QQmlDebugServerImpl::removeService(const QString &name) m_plugins.remove(name); service->setState(QQmlDebugService::NotConnected); - disconnect(service, SIGNAL(detachedFromEngine(QJSEngine*)), - this, SLOT(wakeEngine(QJSEngine*))); - disconnect(service, SIGNAL(attachedToEngine(QJSEngine*)), - this, SLOT(wakeEngine(QJSEngine*))); + disconnect(service, &QQmlDebugService::detachedFromEngine, + this, &QQmlDebugServerImpl::wakeEngine); + disconnect(service, &QQmlDebugService::attachedToEngine, + this, &QQmlDebugServerImpl::wakeEngine); - disconnect(service, SIGNAL(messagesToClient(QString,QList)), - this, SLOT(sendMessages(QString,QList))); - disconnect(service, SIGNAL(messageToClient(QString,QByteArray)), - this, SLOT(sendMessage(QString,QByteArray))); + disconnect(service, &QQmlDebugService::messagesToClient, + this, &QQmlDebugServerImpl::sendMessages); + disconnect(service, &QQmlDebugService::messageToClient, + this, &QQmlDebugServerImpl::sendMessage); return true; } @@ -738,8 +740,10 @@ void QQmlDebugServerImpl::EngineCondition::wake() void QQmlDebugServerImpl::setDevice(QIODevice *socket) { m_protocol = new QPacketProtocol(socket, this); - QObject::connect(m_protocol, SIGNAL(readyRead()), this, SLOT(receiveMessage())); - QObject::connect(m_protocol, SIGNAL(invalidPacket()), this, SLOT(invalidPacket())); + QObject::connect(m_protocol, &QPacketProtocol::readyRead, + this, &QQmlDebugServerImpl::receiveMessage); + QObject::connect(m_protocol, &QPacketProtocol::invalidPacket, + this, &QQmlDebugServerImpl::invalidPacket); if (blockingMode()) m_protocol->waitForReadyRead(-1); diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp index 3d64312b16..b305c3f535 100644 --- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp +++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp @@ -65,10 +65,8 @@ public: void waitForConnection(); void flush(); -private slots: - void newConnection(); - private: + void newConnection(); bool listen(); int m_portFrom; @@ -152,7 +150,8 @@ void QTcpServerConnection::flush() bool QTcpServerConnection::listen() { m_tcpServer = new QTcpServer(this); - QObject::connect(m_tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); + QObject::connect(m_tcpServer, &QTcpServer::newConnection, + this, &QTcpServerConnection::newConnection); QHostAddress hostaddress; if (!m_hostaddress.isEmpty()) { if (!hostaddress.setAddress(m_hostaddress)) { diff --git a/src/plugins/qmltooling/shared/qqmldebugserver.h b/src/plugins/qmltooling/shared/qqmldebugserver.h index 424c7c4120..109f1e246c 100644 --- a/src/plugins/qmltooling/shared/qqmldebugserver.h +++ b/src/plugins/qmltooling/shared/qqmldebugserver.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -class QQmlDebugServer : protected QQmlDebugConnector +class QQmlDebugServer : public QQmlDebugConnector { Q_OBJECT public: diff --git a/src/qml/debugger/qqmldebugservice.cpp b/src/qml/debugger/qqmldebugservice.cpp index 44311de8b5..b576c3bb85 100644 --- a/src/qml/debugger/qqmldebugservice.cpp +++ b/src/qml/debugger/qqmldebugservice.cpp @@ -132,7 +132,6 @@ public: int nextId; -private slots: void remove(QObject *obj); }; } @@ -163,7 +162,7 @@ int QQmlDebugService::idForObject(QObject *object) int id = hash->nextId++; hash->ids.insert(id, object); iter = hash->objects.insert(object, id); - connect(object, SIGNAL(destroyed(QObject*)), hash, SLOT(remove(QObject*))); + connect(object, &QObject::destroyed, hash, &ObjectReferenceHash::remove); } return iter.value(); } diff --git a/src/qml/debugger/qqmldebugserviceinterfaces_p.h b/src/qml/debugger/qqmldebugserviceinterfaces_p.h index 8f66779872..77fde02386 100644 --- a/src/qml/debugger/qqmldebugserviceinterfaces_p.h +++ b/src/qml/debugger/qqmldebugserviceinterfaces_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE -class Q_QML_PRIVATE_EXPORT QV4DebugService : protected QQmlDebugService +class Q_QML_PRIVATE_EXPORT QV4DebugService : public QQmlDebugService { Q_OBJECT public: @@ -77,7 +77,7 @@ protected: QQmlDebugService(s_key, version, parent) {} }; -class Q_QML_PRIVATE_EXPORT QQmlProfilerService : protected QQmlDebugService +class Q_QML_PRIVATE_EXPORT QQmlProfilerService : public QQmlDebugService { Q_OBJECT public: @@ -99,7 +99,7 @@ protected: QQmlDebugService(s_key, version, parent) {} }; -class Q_QML_PRIVATE_EXPORT QQmlEngineDebugService : protected QQmlDebugService +class Q_QML_PRIVATE_EXPORT QQmlEngineDebugService : public QQmlDebugService { Q_OBJECT public: @@ -119,7 +119,7 @@ protected: class QWindow; class QQuickWindow; -class Q_QML_PRIVATE_EXPORT QQmlInspectorService : protected QQmlDebugService +class Q_QML_PRIVATE_EXPORT QQmlInspectorService : public QQmlDebugService { Q_OBJECT public: @@ -136,7 +136,7 @@ protected: QQmlDebugService(s_key, version, parent) {} }; -class Q_QML_PRIVATE_EXPORT QDebugMessageService : protected QQmlDebugService +class Q_QML_PRIVATE_EXPORT QDebugMessageService : public QQmlDebugService { Q_OBJECT public: @@ -151,7 +151,7 @@ protected: QQmlDebugService(s_key, version, parent) {} }; -class Q_QML_PRIVATE_EXPORT QQmlEngineControlService : protected QQmlDebugService +class Q_QML_PRIVATE_EXPORT QQmlEngineControlService : public QQmlDebugService { Q_OBJECT public: @@ -165,7 +165,7 @@ protected: }; -class Q_QML_PRIVATE_EXPORT QQmlNativeDebugService : protected QQmlDebugService +class Q_QML_PRIVATE_EXPORT QQmlNativeDebugService : public QQmlDebugService { Q_OBJECT diff --git a/src/qml/debugger/qqmlprofiler_p.h b/src/qml/debugger/qqmlprofiler_p.h index 707901063c..08606814a9 100644 --- a/src/qml/debugger/qqmlprofiler_p.h +++ b/src/qml/debugger/qqmlprofiler_p.h @@ -94,7 +94,7 @@ struct Q_AUTOTEST_EXPORT QQmlProfilerData : public QQmlProfilerDefinitions Q_DECLARE_TYPEINFO(QQmlProfilerData, Q_MOVABLE_TYPE); -class QQmlProfiler : public QObject, public QQmlProfilerDefinitions { +class Q_QML_PRIVATE_EXPORT QQmlProfiler : public QObject, public QQmlProfilerDefinitions { Q_OBJECT public: @@ -250,7 +250,6 @@ public: return reinterpret_cast(pointer); } -public slots: void startProfiling(quint64 features); void stopProfiling(); void reportData(bool trackLocations); diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h index 01fdf2951e..a422dd0fb6 100644 --- a/src/qml/jsruntime/qv4profiling_p.h +++ b/src/qml/jsruntime/qv4profiling_p.h @@ -228,7 +228,6 @@ public: quint64 featuresEnabled; -public slots: void stopProfiling(); void startProfiling(quint64 features); void reportData(bool trackLocations); diff --git a/src/qmldebug/qqmldebugconnection.cpp b/src/qmldebug/qqmldebugconnection.cpp index 61f178fd28..b5db71557f 100644 --- a/src/qmldebug/qqmldebugconnection.cpp +++ b/src/qmldebug/qqmldebugconnection.cpp @@ -77,7 +77,7 @@ public: QStringList removedPlugins; void advertisePlugins(); - void connectDeviceSignals(); + void createProtocol(); void flush(); }; @@ -254,7 +254,7 @@ QQmlDebugConnection::QQmlDebugConnection(QObject *parent) : QObject(*(new QQmlDebugConnectionPrivate), parent) { Q_D(QQmlDebugConnection); - connect(&d->handshakeTimer, SIGNAL(timeout()), this, SLOT(handshakeTimeout())); + connect(&d->handshakeTimer, &QTimer::timeout, this, &QQmlDebugConnection::handshakeTimeout); } QQmlDebugConnection::~QQmlDebugConnection() @@ -387,12 +387,12 @@ void QQmlDebugConnection::connectToHost(const QString &hostName, quint16 port) close(); QTcpSocket *socket = new QTcpSocket(this); d->device = socket; - d->connectDeviceSignals(); - connect(socket, SIGNAL(connected()), this, SLOT(socketConnected())); - connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), - this, SIGNAL(socketError(QAbstractSocket::SocketError))); - connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), - this, SIGNAL(socketStateChanged(QAbstractSocket::SocketState))); + d->createProtocol(); + connect(socket, &QAbstractSocket::disconnected, this, &QQmlDebugConnection::socketDisconnected); + connect(socket, &QAbstractSocket::connected, this, &QQmlDebugConnection::socketConnected); + connect(socket, static_cast( + &QAbstractSocket::error), this, &QQmlDebugConnection::socketError); + connect(socket, &QAbstractSocket::stateChanged, this, &QQmlDebugConnection::socketStateChanged); socket->connectToHost(hostName, port); } @@ -405,7 +405,8 @@ void QQmlDebugConnection::startLocalServer(const QString &fileName) d->server->deleteLater(); d->server = new QLocalServer(this); // QueuedConnection so that waitForNewConnection() returns true. - connect(d->server, SIGNAL(newConnection()), this, SLOT(newConnection()), Qt::QueuedConnection); + connect(d->server, &QLocalServer::newConnection, + this, &QQmlDebugConnection::newConnection, Qt::QueuedConnection); d->server->listen(fileName); } @@ -415,17 +416,12 @@ class LocalSocketSignalTranslator : public QObject public: LocalSocketSignalTranslator(QLocalSocket *parent) : QObject(parent) { - connect(parent, SIGNAL(stateChanged(QLocalSocket::LocalSocketState)), - this, SLOT(onStateChanged(QLocalSocket::LocalSocketState))); - connect(parent, SIGNAL(error(QLocalSocket::LocalSocketError)), - this, SLOT(onError(QLocalSocket::LocalSocketError))); + connect(parent, &QLocalSocket::stateChanged, + this, &LocalSocketSignalTranslator::onStateChanged); + connect(parent, static_cast( + &QLocalSocket::error), this, &LocalSocketSignalTranslator::onError); } -signals: - void socketError(QAbstractSocket::SocketError error); - void socketStateChanged(QAbstractSocket::SocketState state); - -public slots: void onError(QLocalSocket::LocalSocketError error) { emit socketError(static_cast(error)); @@ -435,6 +431,10 @@ public slots: { emit socketStateChanged(static_cast(state)); } + +signals: + void socketError(QAbstractSocket::SocketError error); + void socketStateChanged(QAbstractSocket::SocketState state); }; void QQmlDebugConnection::newConnection() @@ -444,23 +444,24 @@ void QQmlDebugConnection::newConnection() QLocalSocket *socket = d->server->nextPendingConnection(); d->server->close(); d->device = socket; - d->connectDeviceSignals(); + d->createProtocol(); + connect(socket, &QLocalSocket::disconnected, this, &QQmlDebugConnection::socketDisconnected); LocalSocketSignalTranslator *translator = new LocalSocketSignalTranslator(socket); - QObject::connect(translator, SIGNAL(socketError(QAbstractSocket::SocketError)), - this, SIGNAL(socketError(QAbstractSocket::SocketError))); - QObject::connect(translator, SIGNAL(socketStateChanged(QAbstractSocket::SocketState)), - this, SIGNAL(socketStateChanged(QAbstractSocket::SocketState))); + connect(translator, &LocalSocketSignalTranslator::socketError, + this, &QQmlDebugConnection::socketError); + connect(translator, &LocalSocketSignalTranslator::socketStateChanged, + this, &QQmlDebugConnection::socketStateChanged); socketConnected(); } -void QQmlDebugConnectionPrivate::connectDeviceSignals() +void QQmlDebugConnectionPrivate::createProtocol() { Q_Q(QQmlDebugConnection); delete protocol; protocol = new QPacketProtocol(device, q); - QObject::connect(protocol, SIGNAL(readyRead()), q, SLOT(protocolReadyRead())); - QObject::connect(device, SIGNAL(disconnected()), q, SLOT(socketDisconnected())); + QObject::connect(protocol, &QPacketProtocol::readyRead, + q, &QQmlDebugConnection::protocolReadyRead); } QT_END_NAMESPACE diff --git a/src/qmldebug/qqmldebugconnection_p.h b/src/qmldebug/qqmldebugconnection_p.h index 40753fc998..be425b6cbf 100644 --- a/src/qmldebug/qqmldebugconnection_p.h +++ b/src/qmldebug/qqmldebugconnection_p.h @@ -92,7 +92,7 @@ signals: void socketError(QAbstractSocket::SocketError socketError); void socketStateChanged(QAbstractSocket::SocketState socketState); -private Q_SLOTS: +private: void newConnection(); void socketConnected(); void socketDisconnected(); diff --git a/src/qmldebug/qqmlprofilerclient_p.h b/src/qmldebug/qqmlprofilerclient_p.h index 832c05fef7..b4054ed0d9 100644 --- a/src/qmldebug/qqmlprofilerclient_p.h +++ b/src/qmldebug/qqmlprofilerclient_p.h @@ -67,8 +67,6 @@ class QQmlProfilerClient : public QQmlDebugClient public: QQmlProfilerClient(QQmlDebugConnection *connection); void setFeatures(quint64 features); - -public slots: void sendRecordingStatus(bool record, int engineId = -1, quint32 flushInterval = 0); protected: diff --git a/src/quick/util/qquickprofiler.cpp b/src/quick/util/qquickprofiler.cpp index 659ffe1d84..841a1c9bcf 100644 --- a/src/quick/util/qquickprofiler.cpp +++ b/src/quick/util/qquickprofiler.cpp @@ -70,7 +70,7 @@ void QQuickProfiler::registerAnimationCallback() class CallbackRegistrationHelper : public QObject { Q_OBJECT -public slots: +public: void registerAnimationTimerCallback() { QQuickProfiler::registerAnimationCallback(); @@ -86,7 +86,12 @@ QQuickProfiler::QQuickProfiler(QObject *parent) : QObject(parent) m_timer.start(); CallbackRegistrationHelper *helper = new CallbackRegistrationHelper; // will delete itself helper->moveToThread(QCoreApplication::instance()->thread()); - QMetaObject::invokeMethod(helper, "registerAnimationTimerCallback", Qt::QueuedConnection); + + // Queue the signal to have the animation timer registration run in the right thread; + QObject signalSource; + connect(&signalSource, &QObject::destroyed, + helper, &CallbackRegistrationHelper::registerAnimationTimerCallback, + Qt::QueuedConnection); } QQuickProfiler::~QQuickProfiler() diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h index 54d734a1c2..480a2ac3fb 100644 --- a/src/quick/util/qquickprofiler_p.h +++ b/src/quick/util/qquickprofiler_p.h @@ -325,6 +325,9 @@ public: virtual ~QQuickProfiler(); +signals: + void dataReady(const QVector &data); + protected: friend class QQuickProfilerAdapter; @@ -342,10 +345,6 @@ protected: m_data.append(message); } -signals: - void dataReady(const QVector &data); - -protected slots: void startProfilingImpl(quint64 features); void stopProfilingImpl(); void reportDataImpl(bool trackLocations); -- cgit v1.2.3