From b4e6591188160a29ba87580cbf689051b4ee9aaa Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 30 Oct 2015 12:35:17 +0100 Subject: [PATCH] QmlProfiler: Convert connections to Qt5 style Change-Id: I1a490add706cd0cfce3f243e4ebc32a8c9a975c7 Reviewed-by: Joerg Bornemann --- src/libs/qmldebug/qmldebugclient.cpp | 19 ++-- src/libs/qmldebug/qmlprofilertraceclient.cpp | 8 +- src/libs/qmldebug/qmlprofilertraceclient.h | 2 +- src/libs/qmldebug/qpacketprotocol.cpp | 40 ++++---- src/libs/qmldebug/qpacketprotocol.h | 2 +- .../qmlprofiler/localqmlprofilerrunner.cpp | 25 ++--- .../qmlprofiler/qmlprofilerattachdialog.cpp | 4 +- .../qmlprofiler/qmlprofilerclientmanager.cpp | 92 +++++++++---------- .../qmlprofilerdetailsrewriter.cpp | 8 +- .../qmlprofilereventsmodelproxy.cpp | 10 +- .../qmlprofiler/qmlprofilereventview.cpp | 31 ++++--- .../qmlprofiler/qmlprofilerruncontrol.cpp | 25 ++--- .../qmlprofiler/qmlprofilerruncontrol.h | 11 +-- src/plugins/qmlprofiler/qmlprofilertool.cpp | 43 +++++---- .../qmlprofiler/qmlprofilerviewmanager.cpp | 14 +-- 15 files changed, 176 insertions(+), 158 deletions(-) diff --git a/src/libs/qmldebug/qmldebugclient.cpp b/src/libs/qmldebug/qmldebugclient.cpp index 2f5b7976cd7..f86d10fd50c 100644 --- a/src/libs/qmldebug/qmldebugclient.cpp +++ b/src/libs/qmldebug/qmldebugclient.cpp @@ -70,7 +70,7 @@ public: void advertisePlugins(); void flush(); -public Q_SLOTS: +public slots: void connected(); void disconnected(); void error(QAbstractSocket::SocketError error); @@ -176,7 +176,8 @@ void QmlDebugConnectionPrivate::readyRead() if (!validHello) { qWarning("QML Debug Client: Invalid hello message"); - QObject::disconnect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); + QObject::disconnect(protocol, &QPacketProtocol::readyRead, + this, &QmlDebugConnectionPrivate::readyRead); return; } gotHello = true; @@ -324,13 +325,13 @@ void QmlDebugConnection::connectToHost(const QString &hostName, quint16 port) socket->setProxy(QNetworkProxy::NoProxy); d->device = socket; d->protocol = new QPacketProtocol(d->device, this); - connect(d->protocol, SIGNAL(readyRead()), d, SLOT(readyRead())); - connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), - d, SLOT(stateChanged(QAbstractSocket::SocketState))); - connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), - d, SLOT(error(QAbstractSocket::SocketError))); - connect(socket, SIGNAL(connected()), d, SLOT(connected())); - connect(socket, SIGNAL(disconnected()), d, SLOT(disconnected())); + connect(d->protocol, &QPacketProtocol::readyRead, d, &QmlDebugConnectionPrivate::readyRead); + connect(socket, &QAbstractSocket::stateChanged, + d, &QmlDebugConnectionPrivate::stateChanged); + connect(socket, static_cast + (&QAbstractSocket::error), d, &QmlDebugConnectionPrivate::error); + connect(socket, &QAbstractSocket::connected, d, &QmlDebugConnectionPrivate::connected); + connect(socket, &QAbstractSocket::disconnected, d, &QmlDebugConnectionPrivate::disconnected); socket->connectToHost(hostName, port); } diff --git a/src/libs/qmldebug/qmlprofilertraceclient.cpp b/src/libs/qmldebug/qmlprofilertraceclient.cpp index 6c222e91a87..522dbceaf92 100644 --- a/src/libs/qmldebug/qmlprofilertraceclient.cpp +++ b/src/libs/qmldebug/qmlprofilertraceclient.cpp @@ -87,8 +87,8 @@ QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebugConnection *client, quint , d(new QmlProfilerTraceClientPrivate(this, client)) { d->requestedFeatures = features; - connect(&d->engineControl, SIGNAL(engineAboutToBeAdded(int,QString)), - this, SLOT(sendRecordingStatus(int))); + connect(&d->engineControl, &QmlEngineControlClient::engineAboutToBeAdded, + this, &QmlProfilerTraceClient::sendRecordingStatus); } QmlProfilerTraceClient::~QmlProfilerTraceClient() @@ -116,9 +116,9 @@ void QmlProfilerTraceClient::clearData() emit cleared(); } -void QmlProfilerTraceClient::sendRecordingStatus(int engineId) +void QmlProfilerTraceClient::sendRecordingStatus() { - d->sendRecordingStatus(engineId); + d->sendRecordingStatus(-1); } bool QmlProfilerTraceClient::isEnabled() const diff --git a/src/libs/qmldebug/qmlprofilertraceclient.h b/src/libs/qmldebug/qmlprofilertraceclient.h index 71def3772d4..d4226683163 100644 --- a/src/libs/qmldebug/qmlprofilertraceclient.h +++ b/src/libs/qmldebug/qmlprofilertraceclient.h @@ -61,7 +61,7 @@ public: public slots: void clearData(); - void sendRecordingStatus(int engineId = -1); + void sendRecordingStatus(); void setRequestedFeatures(quint64 features); void setFlushInterval(quint32 flushInterval); diff --git a/src/libs/qmldebug/qpacketprotocol.cpp b/src/libs/qmldebug/qpacketprotocol.cpp index 6ec50f7b02e..4848fa7d480 100644 --- a/src/libs/qmldebug/qpacketprotocol.cpp +++ b/src/libs/qmldebug/qpacketprotocol.cpp @@ -109,26 +109,26 @@ public: { Q_ASSERT(4 == sizeof(qint32)); - QObject::connect(this, SIGNAL(readyRead()), - parent, SIGNAL(readyRead())); - QObject::connect(this, SIGNAL(packetWritten()), - parent, SIGNAL(packetWritten())); - QObject::connect(this, SIGNAL(invalidPacket()), - parent, SIGNAL(invalidPacket())); - 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(this, &QPacketProtocolPrivate::readyRead, + parent, &QPacketProtocol::readyRead); + QObject::connect(this, &QPacketProtocolPrivate::packetWritten, + parent, &QPacketProtocol::packetWritten); + QObject::connect(this, &QPacketProtocolPrivate::invalidPacket, + parent, &QPacketProtocol::invalidPacket); + QObject::connect(dev, &QIODevice::readyRead, + this, &QPacketProtocolPrivate::readyToRead); + QObject::connect(dev, &QIODevice::aboutToClose, + this, &QPacketProtocolPrivate::aboutToClose); + QObject::connect(dev, &QIODevice::bytesWritten, + this, &QPacketProtocolPrivate::bytesWritten); } -Q_SIGNALS: +signals: void readyRead(); void packetWritten(); void invalidPacket(); -public Q_SLOTS: +public slots: void aboutToClose() { inProgress.clear(); @@ -168,12 +168,12 @@ public Q_SLOTS: // Check sizing constraints if (inProgressSize > maxPacketSize) { - QObject::disconnect(dev, SIGNAL(readyRead()), - this, SLOT(readyToRead())); - QObject::disconnect(dev, SIGNAL(aboutToClose()), - this, SLOT(aboutToClose())); - QObject::disconnect(dev, SIGNAL(bytesWritten(qint64)), - this, SLOT(bytesWritten(qint64))); + QObject::disconnect(dev, &QIODevice::readyRead, + this, &QPacketProtocolPrivate::readyToRead); + QObject::disconnect(dev, &QIODevice::aboutToClose, + this, &QPacketProtocolPrivate::aboutToClose); + QObject::disconnect(dev, &QIODevice::bytesWritten, + this, &QPacketProtocolPrivate::bytesWritten); dev = 0; emit invalidPacket(); return; diff --git a/src/libs/qmldebug/qpacketprotocol.h b/src/libs/qmldebug/qpacketprotocol.h index 1d3871f8e2d..523611a66e8 100644 --- a/src/libs/qmldebug/qpacketprotocol.h +++ b/src/libs/qmldebug/qpacketprotocol.h @@ -69,7 +69,7 @@ public: QIODevice *device(); -Q_SIGNALS: +signals: void readyRead(); void invalidPacket(); void packetWritten(); diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp index 86454d38f4a..b955645bef5 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp @@ -82,12 +82,13 @@ Analyzer::AnalyzerRunControl *LocalQmlProfilerRunner::createLocalRunControl( LocalQmlProfilerRunner *runner = new LocalQmlProfilerRunner(conf, engine); - QObject::connect(runner, SIGNAL(stopped()), engine, SLOT(notifyRemoteFinished())); - QObject::connect(runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)), - engine, SLOT(logApplicationMessage(QString,Utils::OutputFormat))); - QObject::connect(engine, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)), runner, - SLOT(start())); - QObject::connect(rc, SIGNAL(finished()), runner, SLOT(stop())); + QObject::connect(runner, &LocalQmlProfilerRunner::stopped, + engine, &QmlProfilerRunControl::notifyRemoteFinished); + QObject::connect(runner, &LocalQmlProfilerRunner::appendMessage, + engine, &QmlProfilerRunControl::logApplicationMessage); + QObject::connect(engine, &Analyzer::AnalyzerRunControl::starting, + runner, &LocalQmlProfilerRunner::start); + QObject::connect(rc, &RunControl::finished, runner, &LocalQmlProfilerRunner::stop); return rc; } @@ -109,8 +110,8 @@ LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuratio m_configuration(configuration), m_engine(engine) { - connect(&m_launcher, SIGNAL(appendMessage(QString,Utils::OutputFormat)), - this, SIGNAL(appendMessage(QString,Utils::OutputFormat))); + connect(&m_launcher, &ApplicationLauncher::appendMessage, + this, &LocalQmlProfilerRunner::appendMessage); } LocalQmlProfilerRunner::~LocalQmlProfilerRunner() @@ -132,8 +133,8 @@ void LocalQmlProfilerRunner::start() m_launcher.setWorkingDirectory(m_configuration.workingDirectory); m_launcher.setEnvironment(m_configuration.environment); - connect(&m_launcher, SIGNAL(processExited(int,QProcess::ExitStatus)), - this, SLOT(spontaneousStop(int,QProcess::ExitStatus))); + connect(&m_launcher, &ApplicationLauncher::processExited, + this, &LocalQmlProfilerRunner::spontaneousStop); m_launcher.start(ApplicationLauncher::Gui, m_configuration.executable, arguments); emit started(); @@ -148,8 +149,8 @@ void LocalQmlProfilerRunner::spontaneousStop(int exitCode, QProcess::ExitStatus qWarning("QmlProfiler: Application exited (exit code %d).", exitCode); } - disconnect(&m_launcher, SIGNAL(processExited(int,QProcess::ExitStatus)), - this, SLOT(spontaneousStop(int,QProcess::ExitStatus))); + disconnect(&m_launcher, &ApplicationLauncher::processExited, + this, &LocalQmlProfilerRunner::spontaneousStop); emit stopped(); } diff --git a/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp b/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp index d65ebe7bf02..a3e04a104ba 100644 --- a/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerattachdialog.cpp @@ -77,8 +77,8 @@ QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) : verticalLayout->addLayout(formLayout); verticalLayout->addWidget(buttonBox); - connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); } QmlProfilerAttachDialog::~QmlProfilerAttachDialog() diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp index a81b092a1db..2b09d4e289c 100644 --- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp @@ -81,7 +81,7 @@ QmlProfilerClientManager::QmlProfilerClientManager(QObject *parent) : d->modelManager = 0; d->connectionTimer.setInterval(200); - connect(&d->connectionTimer, SIGNAL(timeout()), SLOT(tryToConnect())); + connect(&d->connectionTimer, &QTimer::timeout, this, &QmlProfilerClientManager::tryToConnect); } QmlProfilerClientManager::~QmlProfilerClientManager() @@ -131,10 +131,14 @@ void QmlProfilerClientManager::connectClient(quint16 port) d->connection = new QmlDebugConnection; enableServices(); - connect(d->connection, SIGNAL(stateMessage(QString)), this, SLOT(logState(QString))); - connect(d->connection, SIGNAL(errorMessage(QString)), this, SLOT(logState(QString))); - connect(d->connection, SIGNAL(opened()), this, SLOT(qmlDebugConnectionOpened())); - connect(d->connection, SIGNAL(closed()), this, SLOT(qmlDebugConnectionClosed())); + connect(d->connection, &QmlDebugConnection::stateMessage, + this, &QmlProfilerClientManager::logState); + connect(d->connection, &QmlDebugConnection::errorMessage, + this, &QmlProfilerClientManager::logState); + connect(d->connection, &QmlDebugConnection::opened, + this, &QmlProfilerClientManager::qmlDebugConnectionOpened); + connect(d->connection, &QmlDebugConnection::closed, + this, &QmlProfilerClientManager::qmlDebugConnectionClosed); d->connectionTimer.start(); d->tcpPort = port; } @@ -157,24 +161,18 @@ void QmlProfilerClientManager::connectClientSignals() { QTC_ASSERT(d->profilerState, return); if (d->qmlclientplugin) { - connect(d->qmlclientplugin.data(), SIGNAL(complete(qint64)), - this, SLOT(qmlComplete(qint64))); - connect(d->qmlclientplugin.data(), - SIGNAL(rangedEvent(QmlDebug::Message,QmlDebug::RangeType,int,qint64,qint64, - QString,QmlDebug::QmlEventLocation,qint64,qint64,qint64, - qint64,qint64)), - d->modelManager, - SLOT(addQmlEvent(QmlDebug::Message,QmlDebug::RangeType,int,qint64,qint64, - QString,QmlDebug::QmlEventLocation,qint64,qint64,qint64,qint64, - qint64))); - connect(d->qmlclientplugin.data(), SIGNAL(traceFinished(qint64,QList)), - d->modelManager->traceTime(), SLOT(increaseEndTime(qint64))); - connect(d->qmlclientplugin.data(), SIGNAL(traceStarted(qint64,QList)), - d->modelManager->traceTime(), SLOT(decreaseStartTime(qint64))); - connect(d->qmlclientplugin.data(), SIGNAL(enabledChanged()), - d->qmlclientplugin.data(), SLOT(sendRecordingStatus())); - connect(d->qmlclientplugin.data(), SIGNAL(recordingChanged(bool)), - d->profilerState, SLOT(setServerRecording(bool))); + connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::complete, + this, &QmlProfilerClientManager::qmlComplete); + connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::rangedEvent, + d->modelManager, &QmlProfilerModelManager::addQmlEvent); + connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::traceFinished, + d->modelManager->traceTime(), &QmlProfilerTraceTime::increaseEndTime); + connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::traceStarted, + d->modelManager->traceTime(), &QmlProfilerTraceTime::decreaseStartTime); + connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::enabledChanged, + d->qmlclientplugin.data(), &QmlProfilerTraceClient::sendRecordingStatus); + connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordingChanged, + d->profilerState, &QmlProfilerStateManager::setServerRecording); connect(d->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged, d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures); connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged, @@ -185,23 +183,19 @@ void QmlProfilerClientManager::connectClientSignals() void QmlProfilerClientManager::disconnectClientSignals() { if (d->qmlclientplugin) { - disconnect(d->qmlclientplugin.data(), SIGNAL(complete(qint64)), - this, SLOT(qmlComplete(qint64))); - disconnect(d->qmlclientplugin.data(), - SIGNAL(rangedEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation, - qint64,qint64,qint64,qint64,qint64)), - d->modelManager, - SLOT(addQmlEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation, - qint64,qint64,qint64,qint64,qint64))); - disconnect(d->qmlclientplugin.data(), SIGNAL(traceFinished(qint64)), - d->modelManager->traceTime(), SLOT(increaseEndTime(qint64))); - disconnect(d->qmlclientplugin.data(), SIGNAL(traceStarted(qint64)), - d->modelManager->traceTime(), SLOT(decreaseStartTime(qint64))); - disconnect(d->qmlclientplugin.data(), SIGNAL(enabledChanged()), - d->qmlclientplugin.data(), SLOT(sendRecordingStatus())); + disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::complete, + this, &QmlProfilerClientManager::qmlComplete); + disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::rangedEvent, + d->modelManager, &QmlProfilerModelManager::addQmlEvent); + disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::traceFinished, + d->modelManager->traceTime(), &QmlProfilerTraceTime::increaseEndTime); + disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::traceStarted, + d->modelManager->traceTime(), &QmlProfilerTraceTime::decreaseStartTime); + disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::enabledChanged, + d->qmlclientplugin.data(), &QmlProfilerTraceClient::sendRecordingStatus); // fixme: this should be unified for both clients - disconnect(d->qmlclientplugin.data(), SIGNAL(recordingChanged(bool)), - d->profilerState, SLOT(setServerRecording(bool))); + disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordingChanged, + d->profilerState, &QmlProfilerStateManager::setServerRecording); disconnect(d->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged, d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures); disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged, @@ -254,8 +248,8 @@ void QmlProfilerClientManager::tryToConnect() infoBox->setDefaultButton(QMessageBox::Retry); infoBox->setModal(true); - connect(infoBox, SIGNAL(finished(int)), - this, SLOT(retryMessageBoxFinished(int))); + connect(infoBox, &QDialog::finished, + this, &QmlProfilerClientManager::retryMessageBoxFinished); infoBox->show(); } else { @@ -321,20 +315,20 @@ void QmlProfilerClientManager::qmlComplete(qint64 maximumTime) void QmlProfilerClientManager::registerProfilerStateManager( QmlProfilerStateManager *profilerState ) { if (d->profilerState) { - disconnect(d->profilerState, SIGNAL(stateChanged()), - this, SLOT(profilerStateChanged())); - disconnect(d->profilerState, SIGNAL(clientRecordingChanged()), - this, SLOT(clientRecordingChanged())); + disconnect(d->profilerState, &QmlProfilerStateManager::stateChanged, + this, &QmlProfilerClientManager::profilerStateChanged); + disconnect(d->profilerState, &QmlProfilerStateManager::clientRecordingChanged, + this, &QmlProfilerClientManager::clientRecordingChanged); } d->profilerState = profilerState; // connect if (d->profilerState) { - connect(d->profilerState, SIGNAL(stateChanged()), - this, SLOT(profilerStateChanged())); - connect(d->profilerState, SIGNAL(clientRecordingChanged()), - this, SLOT(clientRecordingChanged())); + connect(d->profilerState, &QmlProfilerStateManager::stateChanged, + this, &QmlProfilerClientManager::profilerStateChanged); + connect(d->profilerState, &QmlProfilerStateManager::clientRecordingChanged, + this, &QmlProfilerClientManager::clientRecordingChanged); } } diff --git a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp index 15c722a5b74..e4fb002af83 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp @@ -143,9 +143,9 @@ void QmlProfilerDetailsRewriter::requestDetailsForLocation(int requestId, if (!d->m_pendingDocs.contains(localFile)) { if (d->m_pendingDocs.isEmpty()) connect(QmlJS::ModelManagerInterface::instance(), - SIGNAL(documentUpdated(QmlJS::Document::Ptr)), + &QmlJS::ModelManagerInterface::documentUpdated, this, - SLOT(documentReady(QmlJS::Document::Ptr))); + &QmlProfilerDetailsRewriter::documentReady); d->m_pendingDocs << localFile; } @@ -207,9 +207,9 @@ void QmlProfilerDetailsRewriter::documentReady(QmlJS::Document::Ptr doc) if (d->m_pendingDocs.isEmpty()) { disconnect(QmlJS::ModelManagerInterface::instance(), - SIGNAL(documentUpdated(QmlJS::Document::Ptr)), + &QmlJS::ModelManagerInterface::documentUpdated, this, - SLOT(documentReady(QmlJS::Document::Ptr))); + &QmlProfilerDetailsRewriter::documentReady); emit eventDetailsChanged(); d->m_filesCache.clear(); } diff --git a/src/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp b/src/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp index ba347f23f08..0dc38782d38 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp +++ b/src/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp @@ -69,9 +69,10 @@ QmlProfilerEventsModelProxy::QmlProfilerEventsModelProxy(QmlProfilerModelManager : QObject(parent), d(new QmlProfilerEventsModelProxyPrivate(this)) { d->modelManager = modelManager; - connect(modelManager->qmlModel(), SIGNAL(changed()), this, SLOT(dataChanged())); - connect(modelManager->notesModel(), SIGNAL(changed(int,int,int)), - this, SLOT(notesChanged(int))); + connect(modelManager->qmlModel(), &QmlProfilerDataModel::changed, + this, &QmlProfilerEventsModelProxy::dataChanged); + connect(modelManager->notesModel(), &Timeline::TimelineNotesModel::changed, + this, &QmlProfilerEventsModelProxy::notesChanged); d->modelId = modelManager->registerModelProxy(); // We're iterating twice in loadData. @@ -303,7 +304,8 @@ QmlProfilerEventRelativesModelProxy::QmlProfilerEventRelativesModelProxy(QmlProf // Load the child models whenever the parent model is done to get the filtering for JS/QML // right. - connect(m_eventsModel, SIGNAL(dataAvailable()), this, SLOT(dataChanged())); + connect(m_eventsModel, &QmlProfilerEventsModelProxy::dataAvailable, + this, &QmlProfilerEventRelativesModelProxy::dataChanged); } QmlProfilerEventRelativesModelProxy::~QmlProfilerEventRelativesModelProxy() diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp index ee076ddc0c4..b461c4aec82 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -191,8 +191,10 @@ QmlProfilerEventsWidget::QmlProfilerEventsWidget(QWidget *parent, d->modelProxy = new QmlProfilerEventsModelProxy(profilerModelManager, this); d->m_eventTree = new QmlProfilerEventsMainView(this, d->modelProxy); - connect(d->m_eventTree, SIGNAL(gotoSourceLocation(QString,int,int)), this, SIGNAL(gotoSourceLocation(QString,int,int))); - connect(d->m_eventTree, SIGNAL(typeSelected(int)), this, SIGNAL(typeSelected(int))); + connect(d->m_eventTree, &QmlProfilerEventsMainView::gotoSourceLocation, + this, &QmlProfilerEventsWidget::gotoSourceLocation); + connect(d->m_eventTree, &QmlProfilerEventsMainView::typeSelected, + this, &QmlProfilerEventsWidget::typeSelected); d->m_eventChildren = new QmlProfilerEventRelativesView( new QmlProfilerEventChildrenModelProxy(profilerModelManager, d->modelProxy, this), @@ -200,10 +202,14 @@ QmlProfilerEventsWidget::QmlProfilerEventsWidget(QWidget *parent, d->m_eventParents = new QmlProfilerEventRelativesView( new QmlProfilerEventParentsModelProxy(profilerModelManager, d->modelProxy, this), this); - connect(d->m_eventTree, SIGNAL(typeSelected(int)), d->m_eventChildren, SLOT(displayType(int))); - connect(d->m_eventTree, SIGNAL(typeSelected(int)), d->m_eventParents, SLOT(displayType(int))); - connect(d->m_eventChildren, SIGNAL(typeClicked(int)), d->m_eventTree, SLOT(selectType(int))); - connect(d->m_eventParents, SIGNAL(typeClicked(int)), d->m_eventTree, SLOT(selectType(int))); + connect(d->m_eventTree, &QmlProfilerEventsMainView::typeSelected, + d->m_eventChildren, &QmlProfilerEventRelativesView::displayType); + connect(d->m_eventTree, &QmlProfilerEventsMainView::typeSelected, + d->m_eventParents, &QmlProfilerEventRelativesView::displayType); + connect(d->m_eventChildren, &QmlProfilerEventRelativesView::typeClicked, + d->m_eventTree, &QmlProfilerEventsMainView::selectType); + connect(d->m_eventParents, &QmlProfilerEventRelativesView::typeClicked, + d->m_eventTree, &QmlProfilerEventsMainView::selectType); // widget arrangement QVBoxLayout *groupLayout = new QVBoxLayout; @@ -403,11 +409,13 @@ QmlProfilerEventsMainView::QmlProfilerEventsMainView(QWidget *parent, d->m_model = new QStandardItemModel(this); d->m_model->setSortRole(SortRole); setModel(d->m_model); - connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(jumpToItem(QModelIndex))); + connect(this, &QAbstractItemView::activated, this, &QmlProfilerEventsMainView::jumpToItem); d->modelProxy = modelProxy; - connect(d->modelProxy,SIGNAL(dataAvailable()), this, SLOT(buildModel())); - connect(d->modelProxy,SIGNAL(notesAvailable(int)), this, SLOT(updateNotes(int))); + connect(d->modelProxy, &QmlProfilerEventsModelProxy::dataAvailable, + this, &QmlProfilerEventsMainView::buildModel); + connect(d->modelProxy, &QmlProfilerEventsModelProxy::notesAvailable, + this, &QmlProfilerEventsMainView::updateNotes); d->m_firstNumericColumn = 0; d->m_preventSelectBounce = false; d->m_showExtendedStatistics = false; @@ -884,10 +892,11 @@ QmlProfilerEventRelativesView::QmlProfilerEventRelativesView( setRootIsDecorated(false); updateHeader(); - connect(this,SIGNAL(activated(QModelIndex)), this,SLOT(jumpToItem(QModelIndex))); + connect(this, &QAbstractItemView::activated, this, &QmlProfilerEventRelativesView::jumpToItem); // Clear when new data available as the selection may be invalid now. - connect(d->modelProxy, SIGNAL(dataAvailable()), this, SLOT(clear())); + connect(d->modelProxy, &QmlProfilerEventRelativesModelProxy::dataAvailable, + this, &QmlProfilerEventRelativesView::clear); } QmlProfilerEventRelativesView::~QmlProfilerEventRelativesView() diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index 9a81a408c89..c6dd5523219 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -88,15 +88,16 @@ QmlProfilerRunControl::QmlProfilerRunControl(const AnalyzerStartParameters &sp, // (application output might be redirected / blocked) d->m_noDebugOutputTimer.setSingleShot(true); d->m_noDebugOutputTimer.setInterval(4000); - connect(&d->m_noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(processIsRunning())); + connect(&d->m_noDebugOutputTimer, &QTimer::timeout, + this, [this](){processIsRunning(0);}); d->m_outputParser.setNoOutputText(ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput()); - connect(&d->m_outputParser, SIGNAL(waitingForConnectionOnPort(quint16)), - this, SLOT(processIsRunning(quint16))); - connect(&d->m_outputParser, SIGNAL(noOutputMessage()), - this, SLOT(processIsRunning())); - connect(&d->m_outputParser, SIGNAL(errorMessage(QString)), - this, SLOT(wrongSetupMessageBox(QString))); + connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort, + this, &QmlProfilerRunControl::processIsRunning); + connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::noOutputMessage, + this, [this](){processIsRunning(0);}); + connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::errorMessage, + this, &QmlProfilerRunControl::wrongSetupMessageBox); } QmlProfilerRunControl::~QmlProfilerRunControl() @@ -203,8 +204,8 @@ void QmlProfilerRunControl::wrongSetupMessageBox(const QString &errorMessage) infoBox->setDefaultButton(QMessageBox::Ok); infoBox->setModal(true); - connect(infoBox, SIGNAL(finished(int)), - this, SLOT(wrongSetupMessageBoxFinished(int))); + connect(infoBox, &QDialog::finished, + this, &QmlProfilerRunControl::wrongSetupMessageBoxFinished); infoBox->show(); @@ -242,13 +243,15 @@ void QmlProfilerRunControl::registerProfilerStateManager( QmlProfilerStateManage { // disconnect old if (d->m_profilerState) - disconnect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged())); + disconnect(d->m_profilerState, &QmlProfilerStateManager::stateChanged, + this, &QmlProfilerRunControl::profilerStateChanged); d->m_profilerState = profilerState; // connect if (d->m_profilerState) - connect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged())); + connect(d->m_profilerState, &QmlProfilerStateManager::stateChanged, + this, &QmlProfilerRunControl::profilerStateChanged); } void QmlProfilerRunControl::profilerStateChanged() diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h index 14fcccef19c..f9f9d6aed57 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h @@ -59,17 +59,14 @@ signals: public slots: bool startEngine(); void stopEngine(); + void cancelProcess(); + void notifyRemoteFinished(); + void logApplicationMessage(const QString &msg, Utils::OutputFormat format); private slots: - void notifyRemoteFinished(); - - void cancelProcess(); - void logApplicationMessage(const QString &msg, Utils::OutputFormat format); void wrongSetupMessageBox(const QString &errorMessage); void wrongSetupMessageBoxFinished(int); - void processIsRunning(quint16 port = 0); - -private slots: + void processIsRunning(quint16 port); void profilerStateChanged(); private: diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 0d1bac2b5cf..d262bb3327b 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -142,19 +142,25 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) d->m_displayFeaturesMenu = 0; d->m_profilerState = new QmlProfilerStateManager(this); - connect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged())); - connect(d->m_profilerState, SIGNAL(clientRecordingChanged()), this, SLOT(clientRecordingChanged())); - connect(d->m_profilerState, SIGNAL(serverRecordingChanged()), this, SLOT(serverRecordingChanged())); + connect(d->m_profilerState, &QmlProfilerStateManager::stateChanged, + this, &QmlProfilerTool::profilerStateChanged); + connect(d->m_profilerState, &QmlProfilerStateManager::clientRecordingChanged, + this, &QmlProfilerTool::clientRecordingChanged); + connect(d->m_profilerState, &QmlProfilerStateManager::serverRecordingChanged, + this, &QmlProfilerTool::serverRecordingChanged); connect(d->m_profilerState, &QmlProfilerStateManager::recordedFeaturesChanged, this, &QmlProfilerTool::setRecordedFeatures); d->m_profilerConnections = new QmlProfilerClientManager(this); d->m_profilerConnections->registerProfilerStateManager(d->m_profilerState); - connect(d->m_profilerConnections, SIGNAL(connectionClosed()), this, SLOT(clientsDisconnected())); + connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionClosed, + this, &QmlProfilerTool::clientsDisconnected); d->m_profilerModelManager = new QmlProfilerModelManager(&d->m_projectFinder, this); - connect(d->m_profilerModelManager, SIGNAL(stateChanged()), this, SLOT(profilerDataModelStateChanged())); - connect(d->m_profilerModelManager, SIGNAL(error(QString)), this, SLOT(showErrorDialog(QString))); + connect(d->m_profilerModelManager, &QmlProfilerModelManager::stateChanged, + this, &QmlProfilerTool::profilerDataModelStateChanged); + connect(d->m_profilerModelManager, &QmlProfilerModelManager::error, + this, &QmlProfilerTool::showErrorDialog); connect(d->m_profilerModelManager, &QmlProfilerModelManager::availableFeaturesChanged, this, &QmlProfilerTool::setAvailableFeatures); connect(d->m_profilerModelManager, &QmlProfilerModelManager::saveFinished, @@ -173,17 +179,17 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) QAction *act = d->m_loadQmlTrace = new QAction(tr("Load QML Trace"), options); command = ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.LoadQMLTrace"); - connect(act, SIGNAL(triggered()), this, SLOT(showLoadDialog())); + connect(act, &QAction::triggered, this, &QmlProfilerTool::showLoadDialog); options->addAction(command); act = d->m_saveQmlTrace = new QAction(tr("Save QML Trace"), options); d->m_saveQmlTrace->setEnabled(false); command = ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.SaveQMLTrace"); - connect(act, SIGNAL(triggered()), this, SLOT(showSaveDialog())); + connect(act, &QAction::triggered, this, &QmlProfilerTool::showSaveDialog); options->addAction(command); d->m_recordingTimer.setInterval(100); - connect(&d->m_recordingTimer, SIGNAL(timeout()), this, SLOT(updateTimeDisplay())); + connect(&d->m_recordingTimer, &QTimer::timeout, this, &QmlProfilerTool::updateTimeDisplay); } QmlProfilerTool::~QmlProfilerTool() @@ -226,8 +232,10 @@ AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParamet populateFileFinder(projectDirectory, sp.sysroot); - connect(engine, SIGNAL(processRunning(quint16)), d->m_profilerConnections, SLOT(connectClient(quint16))); - connect(d->m_profilerConnections, SIGNAL(connectionFailed()), engine, SLOT(cancelProcess())); + connect(engine, &QmlProfilerRunControl::processRunning, + d->m_profilerConnections, &QmlProfilerClientManager::connectClient); + connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionFailed, + engine, &QmlProfilerRunControl::cancelProcess); return engine; } @@ -250,8 +258,8 @@ QWidget *QmlProfilerTool::createWidgets() this, d->m_profilerModelManager, d->m_profilerState); - connect(d->m_viewContainer, SIGNAL(gotoSourceLocation(QString,int,int)), - this, SLOT(gotoSourceLocation(QString,int,int))); + connect(d->m_viewContainer, &QmlProfilerViewManager::gotoSourceLocation, + this, &QmlProfilerTool::gotoSourceLocation); // // Toolbar @@ -266,13 +274,14 @@ QWidget *QmlProfilerTool::createWidgets() d->m_recordButton = new QToolButton(toolbarWidget); d->m_recordButton->setCheckable(true); - connect(d->m_recordButton,SIGNAL(clicked(bool)), this, SLOT(recordingButtonChanged(bool))); + connect(d->m_recordButton,&QAbstractButton::clicked, + this, &QmlProfilerTool::recordingButtonChanged); d->m_recordButton->setChecked(true); d->m_recordFeaturesMenu = new QMenu(d->m_recordButton); d->m_recordButton->setMenu(d->m_recordFeaturesMenu); d->m_recordButton->setPopupMode(QToolButton::MenuButtonPopup); - connect(d->m_recordFeaturesMenu, SIGNAL(triggered(QAction*)), - this, SLOT(toggleRequestedFeature(QAction*))); + connect(d->m_recordFeaturesMenu, &QMenu::triggered, + this, &QmlProfilerTool::toggleRequestedFeature); setRecording(d->m_profilerState->clientRecording()); layout->addWidget(d->m_recordButton); @@ -768,7 +777,7 @@ void QmlProfilerTool::profilerStateChanged() case QmlProfilerStateManager::AppDying : { // If already disconnected when dying, check again that all data was read if (!d->m_profilerConnections->isConnected()) - QTimer::singleShot(0, this, SLOT(clientsDisconnected())); + QTimer::singleShot(0, this, &QmlProfilerTool::clientsDisconnected); break; } case QmlProfilerStateManager::Idle : diff --git a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp index 2730d494fdf..bd9c2a2a4b0 100644 --- a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp @@ -93,16 +93,18 @@ void QmlProfilerViewManager::createViews() this, d->profilerModelManager); d->traceView->setWindowTitle(tr("Timeline")); - connect(d->traceView, SIGNAL(gotoSourceLocation(QString,int,int)), - this, SIGNAL(gotoSourceLocation(QString,int,int))); + connect(d->traceView, &QmlProfilerTraceView::gotoSourceLocation, + this, &QmlProfilerViewManager::gotoSourceLocation); d->eventsView = new QmlProfilerEventsWidget(mw, d->profilerTool, this, d->profilerModelManager); d->eventsView->setWindowTitle(tr("Events")); - connect(d->eventsView, SIGNAL(gotoSourceLocation(QString,int,int)), this, - SIGNAL(gotoSourceLocation(QString,int,int))); - connect(d->eventsView, SIGNAL(typeSelected(int)), d->traceView, SLOT(selectByTypeId(int))); - connect(d->traceView, SIGNAL(typeSelected(int)), d->eventsView, SLOT(selectByTypeId(int))); + connect(d->eventsView, &QmlProfilerEventsWidget::gotoSourceLocation, + this, &QmlProfilerViewManager::gotoSourceLocation); + connect(d->eventsView, &QmlProfilerEventsWidget::typeSelected, + d->traceView, &QmlProfilerTraceView::selectByTypeId); + connect(d->traceView, &QmlProfilerTraceView::typeSelected, + d->eventsView, &QmlProfilerEventsWidget::selectByTypeId); connect(d->profilerModelManager, &QmlProfilerModelManager::visibleFeaturesChanged, d->eventsView, &QmlProfilerEventsWidget::onVisibleFeaturesChanged);