QmlProfiler: Convert connections to Qt5 style

Change-Id: I1a490add706cd0cfce3f243e4ebc32a8c9a975c7
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-10-30 12:35:17 +01:00
parent 4b8a14e10f
commit b4e6591188
15 changed files with 176 additions and 158 deletions

View File

@@ -70,7 +70,7 @@ public:
void advertisePlugins(); void advertisePlugins();
void flush(); void flush();
public Q_SLOTS: public slots:
void connected(); void connected();
void disconnected(); void disconnected();
void error(QAbstractSocket::SocketError error); void error(QAbstractSocket::SocketError error);
@@ -176,7 +176,8 @@ void QmlDebugConnectionPrivate::readyRead()
if (!validHello) { if (!validHello) {
qWarning("QML Debug Client: Invalid hello message"); qWarning("QML Debug Client: Invalid hello message");
QObject::disconnect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); QObject::disconnect(protocol, &QPacketProtocol::readyRead,
this, &QmlDebugConnectionPrivate::readyRead);
return; return;
} }
gotHello = true; gotHello = true;
@@ -324,13 +325,13 @@ void QmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
socket->setProxy(QNetworkProxy::NoProxy); socket->setProxy(QNetworkProxy::NoProxy);
d->device = socket; d->device = socket;
d->protocol = new QPacketProtocol(d->device, this); d->protocol = new QPacketProtocol(d->device, this);
connect(d->protocol, SIGNAL(readyRead()), d, SLOT(readyRead())); connect(d->protocol, &QPacketProtocol::readyRead, d, &QmlDebugConnectionPrivate::readyRead);
connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), connect(socket, &QAbstractSocket::stateChanged,
d, SLOT(stateChanged(QAbstractSocket::SocketState))); d, &QmlDebugConnectionPrivate::stateChanged);
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), connect(socket, static_cast<void (QTcpSocket::*)(QAbstractSocket::SocketError)>
d, SLOT(error(QAbstractSocket::SocketError))); (&QAbstractSocket::error), d, &QmlDebugConnectionPrivate::error);
connect(socket, SIGNAL(connected()), d, SLOT(connected())); connect(socket, &QAbstractSocket::connected, d, &QmlDebugConnectionPrivate::connected);
connect(socket, SIGNAL(disconnected()), d, SLOT(disconnected())); connect(socket, &QAbstractSocket::disconnected, d, &QmlDebugConnectionPrivate::disconnected);
socket->connectToHost(hostName, port); socket->connectToHost(hostName, port);
} }

View File

@@ -87,8 +87,8 @@ QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebugConnection *client, quint
, d(new QmlProfilerTraceClientPrivate(this, client)) , d(new QmlProfilerTraceClientPrivate(this, client))
{ {
d->requestedFeatures = features; d->requestedFeatures = features;
connect(&d->engineControl, SIGNAL(engineAboutToBeAdded(int,QString)), connect(&d->engineControl, &QmlEngineControlClient::engineAboutToBeAdded,
this, SLOT(sendRecordingStatus(int))); this, &QmlProfilerTraceClient::sendRecordingStatus);
} }
QmlProfilerTraceClient::~QmlProfilerTraceClient() QmlProfilerTraceClient::~QmlProfilerTraceClient()
@@ -116,9 +116,9 @@ void QmlProfilerTraceClient::clearData()
emit cleared(); emit cleared();
} }
void QmlProfilerTraceClient::sendRecordingStatus(int engineId) void QmlProfilerTraceClient::sendRecordingStatus()
{ {
d->sendRecordingStatus(engineId); d->sendRecordingStatus(-1);
} }
bool QmlProfilerTraceClient::isEnabled() const bool QmlProfilerTraceClient::isEnabled() const

View File

@@ -61,7 +61,7 @@ public:
public slots: public slots:
void clearData(); void clearData();
void sendRecordingStatus(int engineId = -1); void sendRecordingStatus();
void setRequestedFeatures(quint64 features); void setRequestedFeatures(quint64 features);
void setFlushInterval(quint32 flushInterval); void setFlushInterval(quint32 flushInterval);

View File

@@ -109,26 +109,26 @@ public:
{ {
Q_ASSERT(4 == sizeof(qint32)); Q_ASSERT(4 == sizeof(qint32));
QObject::connect(this, SIGNAL(readyRead()), QObject::connect(this, &QPacketProtocolPrivate::readyRead,
parent, SIGNAL(readyRead())); parent, &QPacketProtocol::readyRead);
QObject::connect(this, SIGNAL(packetWritten()), QObject::connect(this, &QPacketProtocolPrivate::packetWritten,
parent, SIGNAL(packetWritten())); parent, &QPacketProtocol::packetWritten);
QObject::connect(this, SIGNAL(invalidPacket()), QObject::connect(this, &QPacketProtocolPrivate::invalidPacket,
parent, SIGNAL(invalidPacket())); parent, &QPacketProtocol::invalidPacket);
QObject::connect(dev, SIGNAL(readyRead()), QObject::connect(dev, &QIODevice::readyRead,
this, SLOT(readyToRead())); this, &QPacketProtocolPrivate::readyToRead);
QObject::connect(dev, SIGNAL(aboutToClose()), QObject::connect(dev, &QIODevice::aboutToClose,
this, SLOT(aboutToClose())); this, &QPacketProtocolPrivate::aboutToClose);
QObject::connect(dev, SIGNAL(bytesWritten(qint64)), QObject::connect(dev, &QIODevice::bytesWritten,
this, SLOT(bytesWritten(qint64))); this, &QPacketProtocolPrivate::bytesWritten);
} }
Q_SIGNALS: signals:
void readyRead(); void readyRead();
void packetWritten(); void packetWritten();
void invalidPacket(); void invalidPacket();
public Q_SLOTS: public slots:
void aboutToClose() void aboutToClose()
{ {
inProgress.clear(); inProgress.clear();
@@ -168,12 +168,12 @@ public Q_SLOTS:
// Check sizing constraints // Check sizing constraints
if (inProgressSize > maxPacketSize) { if (inProgressSize > maxPacketSize) {
QObject::disconnect(dev, SIGNAL(readyRead()), QObject::disconnect(dev, &QIODevice::readyRead,
this, SLOT(readyToRead())); this, &QPacketProtocolPrivate::readyToRead);
QObject::disconnect(dev, SIGNAL(aboutToClose()), QObject::disconnect(dev, &QIODevice::aboutToClose,
this, SLOT(aboutToClose())); this, &QPacketProtocolPrivate::aboutToClose);
QObject::disconnect(dev, SIGNAL(bytesWritten(qint64)), QObject::disconnect(dev, &QIODevice::bytesWritten,
this, SLOT(bytesWritten(qint64))); this, &QPacketProtocolPrivate::bytesWritten);
dev = 0; dev = 0;
emit invalidPacket(); emit invalidPacket();
return; return;

View File

@@ -69,7 +69,7 @@ public:
QIODevice *device(); QIODevice *device();
Q_SIGNALS: signals:
void readyRead(); void readyRead();
void invalidPacket(); void invalidPacket();
void packetWritten(); void packetWritten();

View File

@@ -82,12 +82,13 @@ Analyzer::AnalyzerRunControl *LocalQmlProfilerRunner::createLocalRunControl(
LocalQmlProfilerRunner *runner = new LocalQmlProfilerRunner(conf, engine); LocalQmlProfilerRunner *runner = new LocalQmlProfilerRunner(conf, engine);
QObject::connect(runner, SIGNAL(stopped()), engine, SLOT(notifyRemoteFinished())); QObject::connect(runner, &LocalQmlProfilerRunner::stopped,
QObject::connect(runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)), engine, &QmlProfilerRunControl::notifyRemoteFinished);
engine, SLOT(logApplicationMessage(QString,Utils::OutputFormat))); QObject::connect(runner, &LocalQmlProfilerRunner::appendMessage,
QObject::connect(engine, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)), runner, engine, &QmlProfilerRunControl::logApplicationMessage);
SLOT(start())); QObject::connect(engine, &Analyzer::AnalyzerRunControl::starting,
QObject::connect(rc, SIGNAL(finished()), runner, SLOT(stop())); runner, &LocalQmlProfilerRunner::start);
QObject::connect(rc, &RunControl::finished, runner, &LocalQmlProfilerRunner::stop);
return rc; return rc;
} }
@@ -109,8 +110,8 @@ LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuratio
m_configuration(configuration), m_configuration(configuration),
m_engine(engine) m_engine(engine)
{ {
connect(&m_launcher, SIGNAL(appendMessage(QString,Utils::OutputFormat)), connect(&m_launcher, &ApplicationLauncher::appendMessage,
this, SIGNAL(appendMessage(QString,Utils::OutputFormat))); this, &LocalQmlProfilerRunner::appendMessage);
} }
LocalQmlProfilerRunner::~LocalQmlProfilerRunner() LocalQmlProfilerRunner::~LocalQmlProfilerRunner()
@@ -132,8 +133,8 @@ void LocalQmlProfilerRunner::start()
m_launcher.setWorkingDirectory(m_configuration.workingDirectory); m_launcher.setWorkingDirectory(m_configuration.workingDirectory);
m_launcher.setEnvironment(m_configuration.environment); m_launcher.setEnvironment(m_configuration.environment);
connect(&m_launcher, SIGNAL(processExited(int,QProcess::ExitStatus)), connect(&m_launcher, &ApplicationLauncher::processExited,
this, SLOT(spontaneousStop(int,QProcess::ExitStatus))); this, &LocalQmlProfilerRunner::spontaneousStop);
m_launcher.start(ApplicationLauncher::Gui, m_configuration.executable, arguments); m_launcher.start(ApplicationLauncher::Gui, m_configuration.executable, arguments);
emit started(); emit started();
@@ -148,8 +149,8 @@ void LocalQmlProfilerRunner::spontaneousStop(int exitCode, QProcess::ExitStatus
qWarning("QmlProfiler: Application exited (exit code %d).", exitCode); qWarning("QmlProfiler: Application exited (exit code %d).", exitCode);
} }
disconnect(&m_launcher, SIGNAL(processExited(int,QProcess::ExitStatus)), disconnect(&m_launcher, &ApplicationLauncher::processExited,
this, SLOT(spontaneousStop(int,QProcess::ExitStatus))); this, &LocalQmlProfilerRunner::spontaneousStop);
emit stopped(); emit stopped();
} }

View File

@@ -77,8 +77,8 @@ QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) :
verticalLayout->addLayout(formLayout); verticalLayout->addLayout(formLayout);
verticalLayout->addWidget(buttonBox); verticalLayout->addWidget(buttonBox);
connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, SIGNAL(rejected()), SLOT(reject())); connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
} }
QmlProfilerAttachDialog::~QmlProfilerAttachDialog() QmlProfilerAttachDialog::~QmlProfilerAttachDialog()

View File

@@ -81,7 +81,7 @@ QmlProfilerClientManager::QmlProfilerClientManager(QObject *parent) :
d->modelManager = 0; d->modelManager = 0;
d->connectionTimer.setInterval(200); d->connectionTimer.setInterval(200);
connect(&d->connectionTimer, SIGNAL(timeout()), SLOT(tryToConnect())); connect(&d->connectionTimer, &QTimer::timeout, this, &QmlProfilerClientManager::tryToConnect);
} }
QmlProfilerClientManager::~QmlProfilerClientManager() QmlProfilerClientManager::~QmlProfilerClientManager()
@@ -131,10 +131,14 @@ void QmlProfilerClientManager::connectClient(quint16 port)
d->connection = new QmlDebugConnection; d->connection = new QmlDebugConnection;
enableServices(); enableServices();
connect(d->connection, SIGNAL(stateMessage(QString)), this, SLOT(logState(QString))); connect(d->connection, &QmlDebugConnection::stateMessage,
connect(d->connection, SIGNAL(errorMessage(QString)), this, SLOT(logState(QString))); this, &QmlProfilerClientManager::logState);
connect(d->connection, SIGNAL(opened()), this, SLOT(qmlDebugConnectionOpened())); connect(d->connection, &QmlDebugConnection::errorMessage,
connect(d->connection, SIGNAL(closed()), this, SLOT(qmlDebugConnectionClosed())); this, &QmlProfilerClientManager::logState);
connect(d->connection, &QmlDebugConnection::opened,
this, &QmlProfilerClientManager::qmlDebugConnectionOpened);
connect(d->connection, &QmlDebugConnection::closed,
this, &QmlProfilerClientManager::qmlDebugConnectionClosed);
d->connectionTimer.start(); d->connectionTimer.start();
d->tcpPort = port; d->tcpPort = port;
} }
@@ -157,24 +161,18 @@ void QmlProfilerClientManager::connectClientSignals()
{ {
QTC_ASSERT(d->profilerState, return); QTC_ASSERT(d->profilerState, return);
if (d->qmlclientplugin) { if (d->qmlclientplugin) {
connect(d->qmlclientplugin.data(), SIGNAL(complete(qint64)), connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::complete,
this, SLOT(qmlComplete(qint64))); this, &QmlProfilerClientManager::qmlComplete);
connect(d->qmlclientplugin.data(), connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::rangedEvent,
SIGNAL(rangedEvent(QmlDebug::Message,QmlDebug::RangeType,int,qint64,qint64, d->modelManager, &QmlProfilerModelManager::addQmlEvent);
QString,QmlDebug::QmlEventLocation,qint64,qint64,qint64, connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::traceFinished,
qint64,qint64)), d->modelManager->traceTime(), &QmlProfilerTraceTime::increaseEndTime);
d->modelManager, connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::traceStarted,
SLOT(addQmlEvent(QmlDebug::Message,QmlDebug::RangeType,int,qint64,qint64, d->modelManager->traceTime(), &QmlProfilerTraceTime::decreaseStartTime);
QString,QmlDebug::QmlEventLocation,qint64,qint64,qint64,qint64, connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::enabledChanged,
qint64))); d->qmlclientplugin.data(), &QmlProfilerTraceClient::sendRecordingStatus);
connect(d->qmlclientplugin.data(), SIGNAL(traceFinished(qint64,QList<int>)), connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordingChanged,
d->modelManager->traceTime(), SLOT(increaseEndTime(qint64))); d->profilerState, &QmlProfilerStateManager::setServerRecording);
connect(d->qmlclientplugin.data(), SIGNAL(traceStarted(qint64,QList<int>)),
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->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged, connect(d->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged,
d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures); d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures);
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged, connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged,
@@ -185,23 +183,19 @@ void QmlProfilerClientManager::connectClientSignals()
void QmlProfilerClientManager::disconnectClientSignals() void QmlProfilerClientManager::disconnectClientSignals()
{ {
if (d->qmlclientplugin) { if (d->qmlclientplugin) {
disconnect(d->qmlclientplugin.data(), SIGNAL(complete(qint64)), disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::complete,
this, SLOT(qmlComplete(qint64))); this, &QmlProfilerClientManager::qmlComplete);
disconnect(d->qmlclientplugin.data(), disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::rangedEvent,
SIGNAL(rangedEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation, d->modelManager, &QmlProfilerModelManager::addQmlEvent);
qint64,qint64,qint64,qint64,qint64)), disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::traceFinished,
d->modelManager, d->modelManager->traceTime(), &QmlProfilerTraceTime::increaseEndTime);
SLOT(addQmlEvent(int,int,qint64,qint64,QStringList,QmlDebug::QmlEventLocation, disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::traceStarted,
qint64,qint64,qint64,qint64,qint64))); d->modelManager->traceTime(), &QmlProfilerTraceTime::decreaseStartTime);
disconnect(d->qmlclientplugin.data(), SIGNAL(traceFinished(qint64)), disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::enabledChanged,
d->modelManager->traceTime(), SLOT(increaseEndTime(qint64))); d->qmlclientplugin.data(), &QmlProfilerTraceClient::sendRecordingStatus);
disconnect(d->qmlclientplugin.data(), SIGNAL(traceStarted(qint64)),
d->modelManager->traceTime(), SLOT(decreaseStartTime(qint64)));
disconnect(d->qmlclientplugin.data(), SIGNAL(enabledChanged()),
d->qmlclientplugin.data(), SLOT(sendRecordingStatus()));
// fixme: this should be unified for both clients // fixme: this should be unified for both clients
disconnect(d->qmlclientplugin.data(), SIGNAL(recordingChanged(bool)), disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordingChanged,
d->profilerState, SLOT(setServerRecording(bool))); d->profilerState, &QmlProfilerStateManager::setServerRecording);
disconnect(d->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged, disconnect(d->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged,
d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures); d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures);
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged, disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged,
@@ -254,8 +248,8 @@ void QmlProfilerClientManager::tryToConnect()
infoBox->setDefaultButton(QMessageBox::Retry); infoBox->setDefaultButton(QMessageBox::Retry);
infoBox->setModal(true); infoBox->setModal(true);
connect(infoBox, SIGNAL(finished(int)), connect(infoBox, &QDialog::finished,
this, SLOT(retryMessageBoxFinished(int))); this, &QmlProfilerClientManager::retryMessageBoxFinished);
infoBox->show(); infoBox->show();
} else { } else {
@@ -321,20 +315,20 @@ void QmlProfilerClientManager::qmlComplete(qint64 maximumTime)
void QmlProfilerClientManager::registerProfilerStateManager( QmlProfilerStateManager *profilerState ) void QmlProfilerClientManager::registerProfilerStateManager( QmlProfilerStateManager *profilerState )
{ {
if (d->profilerState) { if (d->profilerState) {
disconnect(d->profilerState, SIGNAL(stateChanged()), disconnect(d->profilerState, &QmlProfilerStateManager::stateChanged,
this, SLOT(profilerStateChanged())); this, &QmlProfilerClientManager::profilerStateChanged);
disconnect(d->profilerState, SIGNAL(clientRecordingChanged()), disconnect(d->profilerState, &QmlProfilerStateManager::clientRecordingChanged,
this, SLOT(clientRecordingChanged())); this, &QmlProfilerClientManager::clientRecordingChanged);
} }
d->profilerState = profilerState; d->profilerState = profilerState;
// connect // connect
if (d->profilerState) { if (d->profilerState) {
connect(d->profilerState, SIGNAL(stateChanged()), connect(d->profilerState, &QmlProfilerStateManager::stateChanged,
this, SLOT(profilerStateChanged())); this, &QmlProfilerClientManager::profilerStateChanged);
connect(d->profilerState, SIGNAL(clientRecordingChanged()), connect(d->profilerState, &QmlProfilerStateManager::clientRecordingChanged,
this, SLOT(clientRecordingChanged())); this, &QmlProfilerClientManager::clientRecordingChanged);
} }
} }

View File

@@ -143,9 +143,9 @@ void QmlProfilerDetailsRewriter::requestDetailsForLocation(int requestId,
if (!d->m_pendingDocs.contains(localFile)) { if (!d->m_pendingDocs.contains(localFile)) {
if (d->m_pendingDocs.isEmpty()) if (d->m_pendingDocs.isEmpty())
connect(QmlJS::ModelManagerInterface::instance(), connect(QmlJS::ModelManagerInterface::instance(),
SIGNAL(documentUpdated(QmlJS::Document::Ptr)), &QmlJS::ModelManagerInterface::documentUpdated,
this, this,
SLOT(documentReady(QmlJS::Document::Ptr))); &QmlProfilerDetailsRewriter::documentReady);
d->m_pendingDocs << localFile; d->m_pendingDocs << localFile;
} }
@@ -207,9 +207,9 @@ void QmlProfilerDetailsRewriter::documentReady(QmlJS::Document::Ptr doc)
if (d->m_pendingDocs.isEmpty()) { if (d->m_pendingDocs.isEmpty()) {
disconnect(QmlJS::ModelManagerInterface::instance(), disconnect(QmlJS::ModelManagerInterface::instance(),
SIGNAL(documentUpdated(QmlJS::Document::Ptr)), &QmlJS::ModelManagerInterface::documentUpdated,
this, this,
SLOT(documentReady(QmlJS::Document::Ptr))); &QmlProfilerDetailsRewriter::documentReady);
emit eventDetailsChanged(); emit eventDetailsChanged();
d->m_filesCache.clear(); d->m_filesCache.clear();
} }

View File

@@ -69,9 +69,10 @@ QmlProfilerEventsModelProxy::QmlProfilerEventsModelProxy(QmlProfilerModelManager
: QObject(parent), d(new QmlProfilerEventsModelProxyPrivate(this)) : QObject(parent), d(new QmlProfilerEventsModelProxyPrivate(this))
{ {
d->modelManager = modelManager; d->modelManager = modelManager;
connect(modelManager->qmlModel(), SIGNAL(changed()), this, SLOT(dataChanged())); connect(modelManager->qmlModel(), &QmlProfilerDataModel::changed,
connect(modelManager->notesModel(), SIGNAL(changed(int,int,int)), this, &QmlProfilerEventsModelProxy::dataChanged);
this, SLOT(notesChanged(int))); connect(modelManager->notesModel(), &Timeline::TimelineNotesModel::changed,
this, &QmlProfilerEventsModelProxy::notesChanged);
d->modelId = modelManager->registerModelProxy(); d->modelId = modelManager->registerModelProxy();
// We're iterating twice in loadData. // 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 // Load the child models whenever the parent model is done to get the filtering for JS/QML
// right. // right.
connect(m_eventsModel, SIGNAL(dataAvailable()), this, SLOT(dataChanged())); connect(m_eventsModel, &QmlProfilerEventsModelProxy::dataAvailable,
this, &QmlProfilerEventRelativesModelProxy::dataChanged);
} }
QmlProfilerEventRelativesModelProxy::~QmlProfilerEventRelativesModelProxy() QmlProfilerEventRelativesModelProxy::~QmlProfilerEventRelativesModelProxy()

View File

@@ -191,8 +191,10 @@ QmlProfilerEventsWidget::QmlProfilerEventsWidget(QWidget *parent,
d->modelProxy = new QmlProfilerEventsModelProxy(profilerModelManager, this); d->modelProxy = new QmlProfilerEventsModelProxy(profilerModelManager, this);
d->m_eventTree = new QmlProfilerEventsMainView(this, d->modelProxy); 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, &QmlProfilerEventsMainView::gotoSourceLocation,
connect(d->m_eventTree, SIGNAL(typeSelected(int)), this, SIGNAL(typeSelected(int))); this, &QmlProfilerEventsWidget::gotoSourceLocation);
connect(d->m_eventTree, &QmlProfilerEventsMainView::typeSelected,
this, &QmlProfilerEventsWidget::typeSelected);
d->m_eventChildren = new QmlProfilerEventRelativesView( d->m_eventChildren = new QmlProfilerEventRelativesView(
new QmlProfilerEventChildrenModelProxy(profilerModelManager, d->modelProxy, this), new QmlProfilerEventChildrenModelProxy(profilerModelManager, d->modelProxy, this),
@@ -200,10 +202,14 @@ QmlProfilerEventsWidget::QmlProfilerEventsWidget(QWidget *parent,
d->m_eventParents = new QmlProfilerEventRelativesView( d->m_eventParents = new QmlProfilerEventRelativesView(
new QmlProfilerEventParentsModelProxy(profilerModelManager, d->modelProxy, this), new QmlProfilerEventParentsModelProxy(profilerModelManager, d->modelProxy, this),
this); this);
connect(d->m_eventTree, SIGNAL(typeSelected(int)), d->m_eventChildren, SLOT(displayType(int))); connect(d->m_eventTree, &QmlProfilerEventsMainView::typeSelected,
connect(d->m_eventTree, SIGNAL(typeSelected(int)), d->m_eventParents, SLOT(displayType(int))); d->m_eventChildren, &QmlProfilerEventRelativesView::displayType);
connect(d->m_eventChildren, SIGNAL(typeClicked(int)), d->m_eventTree, SLOT(selectType(int))); connect(d->m_eventTree, &QmlProfilerEventsMainView::typeSelected,
connect(d->m_eventParents, SIGNAL(typeClicked(int)), d->m_eventTree, SLOT(selectType(int))); 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 // widget arrangement
QVBoxLayout *groupLayout = new QVBoxLayout; QVBoxLayout *groupLayout = new QVBoxLayout;
@@ -403,11 +409,13 @@ QmlProfilerEventsMainView::QmlProfilerEventsMainView(QWidget *parent,
d->m_model = new QStandardItemModel(this); d->m_model = new QStandardItemModel(this);
d->m_model->setSortRole(SortRole); d->m_model->setSortRole(SortRole);
setModel(d->m_model); setModel(d->m_model);
connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(jumpToItem(QModelIndex))); connect(this, &QAbstractItemView::activated, this, &QmlProfilerEventsMainView::jumpToItem);
d->modelProxy = modelProxy; d->modelProxy = modelProxy;
connect(d->modelProxy,SIGNAL(dataAvailable()), this, SLOT(buildModel())); connect(d->modelProxy, &QmlProfilerEventsModelProxy::dataAvailable,
connect(d->modelProxy,SIGNAL(notesAvailable(int)), this, SLOT(updateNotes(int))); this, &QmlProfilerEventsMainView::buildModel);
connect(d->modelProxy, &QmlProfilerEventsModelProxy::notesAvailable,
this, &QmlProfilerEventsMainView::updateNotes);
d->m_firstNumericColumn = 0; d->m_firstNumericColumn = 0;
d->m_preventSelectBounce = false; d->m_preventSelectBounce = false;
d->m_showExtendedStatistics = false; d->m_showExtendedStatistics = false;
@@ -884,10 +892,11 @@ QmlProfilerEventRelativesView::QmlProfilerEventRelativesView(
setRootIsDecorated(false); setRootIsDecorated(false);
updateHeader(); 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. // 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() QmlProfilerEventRelativesView::~QmlProfilerEventRelativesView()

View File

@@ -88,15 +88,16 @@ QmlProfilerRunControl::QmlProfilerRunControl(const AnalyzerStartParameters &sp,
// (application output might be redirected / blocked) // (application output might be redirected / blocked)
d->m_noDebugOutputTimer.setSingleShot(true); d->m_noDebugOutputTimer.setSingleShot(true);
d->m_noDebugOutputTimer.setInterval(4000); 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()); d->m_outputParser.setNoOutputText(ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput());
connect(&d->m_outputParser, SIGNAL(waitingForConnectionOnPort(quint16)), connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
this, SLOT(processIsRunning(quint16))); this, &QmlProfilerRunControl::processIsRunning);
connect(&d->m_outputParser, SIGNAL(noOutputMessage()), connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::noOutputMessage,
this, SLOT(processIsRunning())); this, [this](){processIsRunning(0);});
connect(&d->m_outputParser, SIGNAL(errorMessage(QString)), connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::errorMessage,
this, SLOT(wrongSetupMessageBox(QString))); this, &QmlProfilerRunControl::wrongSetupMessageBox);
} }
QmlProfilerRunControl::~QmlProfilerRunControl() QmlProfilerRunControl::~QmlProfilerRunControl()
@@ -203,8 +204,8 @@ void QmlProfilerRunControl::wrongSetupMessageBox(const QString &errorMessage)
infoBox->setDefaultButton(QMessageBox::Ok); infoBox->setDefaultButton(QMessageBox::Ok);
infoBox->setModal(true); infoBox->setModal(true);
connect(infoBox, SIGNAL(finished(int)), connect(infoBox, &QDialog::finished,
this, SLOT(wrongSetupMessageBoxFinished(int))); this, &QmlProfilerRunControl::wrongSetupMessageBoxFinished);
infoBox->show(); infoBox->show();
@@ -242,13 +243,15 @@ void QmlProfilerRunControl::registerProfilerStateManager( QmlProfilerStateManage
{ {
// disconnect old // disconnect old
if (d->m_profilerState) 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; d->m_profilerState = profilerState;
// connect // connect
if (d->m_profilerState) 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() void QmlProfilerRunControl::profilerStateChanged()

View File

@@ -59,17 +59,14 @@ signals:
public slots: public slots:
bool startEngine(); bool startEngine();
void stopEngine(); void stopEngine();
void cancelProcess();
void notifyRemoteFinished();
void logApplicationMessage(const QString &msg, Utils::OutputFormat format);
private slots: private slots:
void notifyRemoteFinished();
void cancelProcess();
void logApplicationMessage(const QString &msg, Utils::OutputFormat format);
void wrongSetupMessageBox(const QString &errorMessage); void wrongSetupMessageBox(const QString &errorMessage);
void wrongSetupMessageBoxFinished(int); void wrongSetupMessageBoxFinished(int);
void processIsRunning(quint16 port = 0); void processIsRunning(quint16 port);
private slots:
void profilerStateChanged(); void profilerStateChanged();
private: private:

View File

@@ -142,19 +142,25 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
d->m_displayFeaturesMenu = 0; d->m_displayFeaturesMenu = 0;
d->m_profilerState = new QmlProfilerStateManager(this); d->m_profilerState = new QmlProfilerStateManager(this);
connect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged())); connect(d->m_profilerState, &QmlProfilerStateManager::stateChanged,
connect(d->m_profilerState, SIGNAL(clientRecordingChanged()), this, SLOT(clientRecordingChanged())); this, &QmlProfilerTool::profilerStateChanged);
connect(d->m_profilerState, SIGNAL(serverRecordingChanged()), this, SLOT(serverRecordingChanged())); connect(d->m_profilerState, &QmlProfilerStateManager::clientRecordingChanged,
this, &QmlProfilerTool::clientRecordingChanged);
connect(d->m_profilerState, &QmlProfilerStateManager::serverRecordingChanged,
this, &QmlProfilerTool::serverRecordingChanged);
connect(d->m_profilerState, &QmlProfilerStateManager::recordedFeaturesChanged, connect(d->m_profilerState, &QmlProfilerStateManager::recordedFeaturesChanged,
this, &QmlProfilerTool::setRecordedFeatures); this, &QmlProfilerTool::setRecordedFeatures);
d->m_profilerConnections = new QmlProfilerClientManager(this); d->m_profilerConnections = new QmlProfilerClientManager(this);
d->m_profilerConnections->registerProfilerStateManager(d->m_profilerState); 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); d->m_profilerModelManager = new QmlProfilerModelManager(&d->m_projectFinder, this);
connect(d->m_profilerModelManager, SIGNAL(stateChanged()), this, SLOT(profilerDataModelStateChanged())); connect(d->m_profilerModelManager, &QmlProfilerModelManager::stateChanged,
connect(d->m_profilerModelManager, SIGNAL(error(QString)), this, SLOT(showErrorDialog(QString))); this, &QmlProfilerTool::profilerDataModelStateChanged);
connect(d->m_profilerModelManager, &QmlProfilerModelManager::error,
this, &QmlProfilerTool::showErrorDialog);
connect(d->m_profilerModelManager, &QmlProfilerModelManager::availableFeaturesChanged, connect(d->m_profilerModelManager, &QmlProfilerModelManager::availableFeaturesChanged,
this, &QmlProfilerTool::setAvailableFeatures); this, &QmlProfilerTool::setAvailableFeatures);
connect(d->m_profilerModelManager, &QmlProfilerModelManager::saveFinished, 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); QAction *act = d->m_loadQmlTrace = new QAction(tr("Load QML Trace"), options);
command = ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.LoadQMLTrace"); 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); options->addAction(command);
act = d->m_saveQmlTrace = new QAction(tr("Save QML Trace"), options); act = d->m_saveQmlTrace = new QAction(tr("Save QML Trace"), options);
d->m_saveQmlTrace->setEnabled(false); d->m_saveQmlTrace->setEnabled(false);
command = ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.SaveQMLTrace"); 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); options->addAction(command);
d->m_recordingTimer.setInterval(100); 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() QmlProfilerTool::~QmlProfilerTool()
@@ -226,8 +232,10 @@ AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParamet
populateFileFinder(projectDirectory, sp.sysroot); populateFileFinder(projectDirectory, sp.sysroot);
connect(engine, SIGNAL(processRunning(quint16)), d->m_profilerConnections, SLOT(connectClient(quint16))); connect(engine, &QmlProfilerRunControl::processRunning,
connect(d->m_profilerConnections, SIGNAL(connectionFailed()), engine, SLOT(cancelProcess())); d->m_profilerConnections, &QmlProfilerClientManager::connectClient);
connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionFailed,
engine, &QmlProfilerRunControl::cancelProcess);
return engine; return engine;
} }
@@ -250,8 +258,8 @@ QWidget *QmlProfilerTool::createWidgets()
this, this,
d->m_profilerModelManager, d->m_profilerModelManager,
d->m_profilerState); d->m_profilerState);
connect(d->m_viewContainer, SIGNAL(gotoSourceLocation(QString,int,int)), connect(d->m_viewContainer, &QmlProfilerViewManager::gotoSourceLocation,
this, SLOT(gotoSourceLocation(QString,int,int))); this, &QmlProfilerTool::gotoSourceLocation);
// //
// Toolbar // Toolbar
@@ -266,13 +274,14 @@ QWidget *QmlProfilerTool::createWidgets()
d->m_recordButton = new QToolButton(toolbarWidget); d->m_recordButton = new QToolButton(toolbarWidget);
d->m_recordButton->setCheckable(true); 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_recordButton->setChecked(true);
d->m_recordFeaturesMenu = new QMenu(d->m_recordButton); d->m_recordFeaturesMenu = new QMenu(d->m_recordButton);
d->m_recordButton->setMenu(d->m_recordFeaturesMenu); d->m_recordButton->setMenu(d->m_recordFeaturesMenu);
d->m_recordButton->setPopupMode(QToolButton::MenuButtonPopup); d->m_recordButton->setPopupMode(QToolButton::MenuButtonPopup);
connect(d->m_recordFeaturesMenu, SIGNAL(triggered(QAction*)), connect(d->m_recordFeaturesMenu, &QMenu::triggered,
this, SLOT(toggleRequestedFeature(QAction*))); this, &QmlProfilerTool::toggleRequestedFeature);
setRecording(d->m_profilerState->clientRecording()); setRecording(d->m_profilerState->clientRecording());
layout->addWidget(d->m_recordButton); layout->addWidget(d->m_recordButton);
@@ -768,7 +777,7 @@ void QmlProfilerTool::profilerStateChanged()
case QmlProfilerStateManager::AppDying : { case QmlProfilerStateManager::AppDying : {
// If already disconnected when dying, check again that all data was read // If already disconnected when dying, check again that all data was read
if (!d->m_profilerConnections->isConnected()) if (!d->m_profilerConnections->isConnected())
QTimer::singleShot(0, this, SLOT(clientsDisconnected())); QTimer::singleShot(0, this, &QmlProfilerTool::clientsDisconnected);
break; break;
} }
case QmlProfilerStateManager::Idle : case QmlProfilerStateManager::Idle :

View File

@@ -93,16 +93,18 @@ void QmlProfilerViewManager::createViews()
this, this,
d->profilerModelManager); d->profilerModelManager);
d->traceView->setWindowTitle(tr("Timeline")); d->traceView->setWindowTitle(tr("Timeline"));
connect(d->traceView, SIGNAL(gotoSourceLocation(QString,int,int)), connect(d->traceView, &QmlProfilerTraceView::gotoSourceLocation,
this, SIGNAL(gotoSourceLocation(QString,int,int))); this, &QmlProfilerViewManager::gotoSourceLocation);
d->eventsView = new QmlProfilerEventsWidget(mw, d->profilerTool, this, d->eventsView = new QmlProfilerEventsWidget(mw, d->profilerTool, this,
d->profilerModelManager); d->profilerModelManager);
d->eventsView->setWindowTitle(tr("Events")); d->eventsView->setWindowTitle(tr("Events"));
connect(d->eventsView, SIGNAL(gotoSourceLocation(QString,int,int)), this, connect(d->eventsView, &QmlProfilerEventsWidget::gotoSourceLocation,
SIGNAL(gotoSourceLocation(QString,int,int))); this, &QmlProfilerViewManager::gotoSourceLocation);
connect(d->eventsView, SIGNAL(typeSelected(int)), d->traceView, SLOT(selectByTypeId(int))); connect(d->eventsView, &QmlProfilerEventsWidget::typeSelected,
connect(d->traceView, SIGNAL(typeSelected(int)), d->eventsView, SLOT(selectByTypeId(int))); d->traceView, &QmlProfilerTraceView::selectByTypeId);
connect(d->traceView, &QmlProfilerTraceView::typeSelected,
d->eventsView, &QmlProfilerEventsWidget::selectByTypeId);
connect(d->profilerModelManager, &QmlProfilerModelManager::visibleFeaturesChanged, connect(d->profilerModelManager, &QmlProfilerModelManager::visibleFeaturesChanged,
d->eventsView, &QmlProfilerEventsWidget::onVisibleFeaturesChanged); d->eventsView, &QmlProfilerEventsWidget::onVisibleFeaturesChanged);