2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2012-02-24 10:47:17 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2012-02-24 10:47:17 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-02-24 10:47:17 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2012-02-24 10:47:17 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2012-02-24 10:47:17 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-02-24 10:47:17 +01:00
|
|
|
|
|
|
|
|
#include "qmlprofilerclientmanager.h"
|
|
|
|
|
#include "qmlprofilertool.h"
|
|
|
|
|
#include "qmlprofilerplugin.h"
|
|
|
|
|
|
2012-04-18 12:06:10 +02:00
|
|
|
#include <qmldebug/qmlprofilertraceclient.h>
|
2012-02-24 10:47:17 +01:00
|
|
|
|
|
|
|
|
#include <utils/qtcassert.h>
|
2012-09-24 13:48:18 +02:00
|
|
|
#include <QPointer>
|
2012-02-24 10:47:17 +01:00
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
#include "qmlprofilermodelmanager.h"
|
|
|
|
|
|
2012-04-18 12:06:10 +02:00
|
|
|
using namespace QmlDebug;
|
2012-02-24 10:47:17 +01:00
|
|
|
using namespace Core;
|
|
|
|
|
|
|
|
|
|
namespace QmlProfiler {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2013-08-29 19:04:29 +02:00
|
|
|
class QmlProfilerClientManager::QmlProfilerClientManagerPrivate
|
|
|
|
|
{
|
2012-02-24 10:47:17 +01:00
|
|
|
public:
|
2013-08-29 19:04:29 +02:00
|
|
|
QmlProfilerStateManager *profilerState;
|
2012-02-24 10:47:17 +01:00
|
|
|
|
2012-04-18 12:06:10 +02:00
|
|
|
QmlDebugConnection *connection;
|
2012-09-24 13:48:18 +02:00
|
|
|
QPointer<QmlProfilerTraceClient> qmlclientplugin;
|
2012-02-24 10:47:17 +01:00
|
|
|
|
|
|
|
|
QTimer connectionTimer;
|
|
|
|
|
int connectionAttempts;
|
|
|
|
|
|
|
|
|
|
QString tcpHost;
|
|
|
|
|
quint64 tcpPort;
|
|
|
|
|
QString sysroot;
|
2015-08-28 12:50:46 +02:00
|
|
|
quint32 flushInterval;
|
2012-02-24 10:47:17 +01:00
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
QmlProfilerModelManager *modelManager;
|
2012-02-24 10:47:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QmlProfilerClientManager::QmlProfilerClientManager(QObject *parent) :
|
2013-08-29 19:04:29 +02:00
|
|
|
QObject(parent), d(new QmlProfilerClientManagerPrivate)
|
2012-02-24 10:47:17 +01:00
|
|
|
{
|
2012-11-26 21:18:13 +02:00
|
|
|
setObjectName(QLatin1String("QML Profiler Connections"));
|
2012-02-24 10:47:17 +01:00
|
|
|
|
|
|
|
|
d->profilerState = 0;
|
|
|
|
|
|
|
|
|
|
d->connection = 0;
|
|
|
|
|
d->connectionAttempts = 0;
|
2015-08-28 12:50:46 +02:00
|
|
|
d->flushInterval = 0;
|
2012-02-24 10:47:17 +01:00
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
d->modelManager = 0;
|
|
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
d->connectionTimer.setInterval(200);
|
2015-10-30 12:35:17 +01:00
|
|
|
connect(&d->connectionTimer, &QTimer::timeout, this, &QmlProfilerClientManager::tryToConnect);
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QmlProfilerClientManager::~QmlProfilerClientManager()
|
|
|
|
|
{
|
|
|
|
|
delete d->connection;
|
|
|
|
|
delete d->qmlclientplugin.data();
|
|
|
|
|
delete d;
|
|
|
|
|
}
|
2013-07-30 18:35:51 +02:00
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
void QmlProfilerClientManager::setModelManager(QmlProfilerModelManager *m)
|
|
|
|
|
{
|
|
|
|
|
d->modelManager = m;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-28 12:50:46 +02:00
|
|
|
void QmlProfilerClientManager::setFlushInterval(quint32 flushInterval)
|
|
|
|
|
{
|
|
|
|
|
d->flushInterval = flushInterval;
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
void QmlProfilerClientManager::setTcpConnection(QString host, quint64 port)
|
|
|
|
|
{
|
|
|
|
|
d->tcpHost = host;
|
|
|
|
|
d->tcpPort = port;
|
2015-11-02 15:45:18 +01:00
|
|
|
disconnectClient();
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerClientManager::clearBufferedData()
|
|
|
|
|
{
|
|
|
|
|
if (d->qmlclientplugin)
|
|
|
|
|
d->qmlclientplugin.data()->clearData();
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-26 16:20:09 +02:00
|
|
|
void QmlProfilerClientManager::discardPendingData()
|
|
|
|
|
{
|
|
|
|
|
clearBufferedData();
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
void QmlProfilerClientManager::connectClient(quint16 port)
|
|
|
|
|
{
|
2015-10-30 12:28:06 +01:00
|
|
|
if (d->connection) {
|
|
|
|
|
if (port == d->tcpPort) {
|
|
|
|
|
tryToConnect();
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
delete d->connection;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-18 12:06:10 +02:00
|
|
|
d->connection = new QmlDebugConnection;
|
2012-02-24 10:47:17 +01:00
|
|
|
enableServices();
|
2015-11-16 17:05:10 +01:00
|
|
|
connect(d->connection, &QmlDebugConnection::connected,
|
2015-10-30 12:35:17 +01:00
|
|
|
this, &QmlProfilerClientManager::qmlDebugConnectionOpened);
|
2015-11-16 17:05:10 +01:00
|
|
|
connect(d->connection, &QmlDebugConnection::disconnected,
|
2015-10-30 12:35:17 +01:00
|
|
|
this, &QmlProfilerClientManager::qmlDebugConnectionClosed);
|
2015-11-16 17:29:17 +01:00
|
|
|
connect(d->connection, &QmlDebugConnection::socketError,
|
2015-11-02 15:45:18 +01:00
|
|
|
this, &QmlProfilerClientManager::qmlDebugConnectionError);
|
2015-11-16 17:29:17 +01:00
|
|
|
connect(d->connection, &QmlDebugConnection::socketStateChanged,
|
|
|
|
|
this, &QmlProfilerClientManager::qmlDebugConnectionStateChanged);
|
2012-02-24 10:47:17 +01:00
|
|
|
d->connectionTimer.start();
|
|
|
|
|
d->tcpPort = port;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerClientManager::enableServices()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->profilerState, return);
|
|
|
|
|
|
|
|
|
|
disconnectClientSignals();
|
|
|
|
|
d->profilerState->setServerRecording(false); // false by default (will be set to true when connected)
|
|
|
|
|
delete d->qmlclientplugin.data();
|
2015-06-30 15:55:33 +02:00
|
|
|
d->profilerState->setRecordedFeatures(0);
|
2014-09-09 18:22:58 +02:00
|
|
|
d->qmlclientplugin = new QmlProfilerTraceClient(d->connection,
|
2015-06-30 15:55:33 +02:00
|
|
|
d->profilerState->requestedFeatures());
|
2015-08-28 12:50:46 +02:00
|
|
|
d->qmlclientplugin->setFlushInterval(d->flushInterval);
|
2012-02-24 10:47:17 +01:00
|
|
|
connectClientSignals();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerClientManager::connectClientSignals()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->profilerState, return);
|
|
|
|
|
if (d->qmlclientplugin) {
|
2015-10-30 12:35:17 +01:00
|
|
|
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);
|
2015-06-30 15:55:33 +02:00
|
|
|
connect(d->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged,
|
|
|
|
|
d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures);
|
|
|
|
|
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged,
|
|
|
|
|
d->profilerState, &QmlProfilerStateManager::setRecordedFeatures);
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerClientManager::disconnectClientSignals()
|
|
|
|
|
{
|
|
|
|
|
if (d->qmlclientplugin) {
|
2015-10-30 12:35:17 +01:00
|
|
|
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);
|
2012-02-24 10:47:17 +01:00
|
|
|
// fixme: this should be unified for both clients
|
2015-10-30 12:35:17 +01:00
|
|
|
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordingChanged,
|
|
|
|
|
d->profilerState, &QmlProfilerStateManager::setServerRecording);
|
2015-06-30 15:55:33 +02:00
|
|
|
disconnect(d->profilerState, &QmlProfilerStateManager::requestedFeaturesChanged,
|
|
|
|
|
d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures);
|
|
|
|
|
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged,
|
|
|
|
|
d->profilerState, &QmlProfilerStateManager::setRecordedFeatures);
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerClientManager::connectToClient()
|
|
|
|
|
{
|
2015-11-16 17:05:10 +01:00
|
|
|
if (!d->connection || d->connection->isConnected() || d->connection->isConnecting())
|
2012-02-24 10:47:17 +01:00
|
|
|
return;
|
|
|
|
|
|
2012-08-22 13:27:25 +02:00
|
|
|
d->connection->connectToHost(d->tcpHost, d->tcpPort);
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
|
2012-05-11 17:19:15 +02:00
|
|
|
bool QmlProfilerClientManager::isConnected() const
|
|
|
|
|
{
|
2015-11-16 17:05:10 +01:00
|
|
|
return d->connection && d->connection->isConnected();
|
2012-05-11 17:19:15 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
void QmlProfilerClientManager::disconnectClient()
|
|
|
|
|
{
|
|
|
|
|
// this might be actually be called indirectly by QDDConnectionPrivate::readyRead(), therefore allow
|
2013-10-07 13:34:40 +02:00
|
|
|
// function to complete before deleting object
|
2012-02-24 10:47:17 +01:00
|
|
|
if (d->connection) {
|
|
|
|
|
d->connection->deleteLater();
|
|
|
|
|
d->connection = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerClientManager::tryToConnect()
|
|
|
|
|
{
|
|
|
|
|
++d->connectionAttempts;
|
|
|
|
|
|
2015-11-16 17:05:10 +01:00
|
|
|
if (d->connection && d->connection->isConnected()) {
|
2012-02-24 10:47:17 +01:00
|
|
|
d->connectionTimer.stop();
|
|
|
|
|
d->connectionAttempts = 0;
|
|
|
|
|
} else if (d->connectionAttempts == 50) {
|
|
|
|
|
d->connectionTimer.stop();
|
|
|
|
|
d->connectionAttempts = 0;
|
|
|
|
|
|
|
|
|
|
QMessageBox *infoBox = QmlProfilerTool::requestMessageBox();
|
|
|
|
|
infoBox->setIcon(QMessageBox::Critical);
|
|
|
|
|
infoBox->setWindowTitle(tr("Qt Creator"));
|
|
|
|
|
infoBox->setText(tr("Could not connect to the in-process QML profiler.\n"
|
|
|
|
|
"Do you want to retry?"));
|
|
|
|
|
infoBox->setStandardButtons(QMessageBox::Retry |
|
|
|
|
|
QMessageBox::Cancel |
|
|
|
|
|
QMessageBox::Help);
|
|
|
|
|
infoBox->setDefaultButton(QMessageBox::Retry);
|
|
|
|
|
infoBox->setModal(true);
|
|
|
|
|
|
2015-10-30 12:35:17 +01:00
|
|
|
connect(infoBox, &QDialog::finished,
|
|
|
|
|
this, &QmlProfilerClientManager::retryMessageBoxFinished);
|
2012-02-24 10:47:17 +01:00
|
|
|
|
|
|
|
|
infoBox->show();
|
|
|
|
|
} else {
|
|
|
|
|
connectToClient();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-05 17:18:11 +02:00
|
|
|
void QmlProfilerClientManager::qmlDebugConnectionOpened()
|
2012-02-24 10:47:17 +01:00
|
|
|
{
|
2014-05-05 17:18:11 +02:00
|
|
|
logState(tr("Debug connection opened"));
|
|
|
|
|
clientRecordingChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerClientManager::qmlDebugConnectionClosed()
|
|
|
|
|
{
|
|
|
|
|
logState(tr("Debug connection closed"));
|
|
|
|
|
disconnectClient();
|
|
|
|
|
emit connectionClosed();
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-16 17:29:17 +01:00
|
|
|
void QmlProfilerClientManager::qmlDebugConnectionError(QAbstractSocket::SocketError error)
|
2015-11-02 15:45:18 +01:00
|
|
|
{
|
2015-11-16 17:29:17 +01:00
|
|
|
logState(QmlDebugConnection::socketErrorToString(error));
|
2015-11-16 17:05:10 +01:00
|
|
|
if (d->connection->isConnected()) {
|
2015-11-02 15:45:18 +01:00
|
|
|
disconnectClient();
|
|
|
|
|
emit connectionClosed();
|
|
|
|
|
} else {
|
|
|
|
|
disconnectClient();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-16 17:29:17 +01:00
|
|
|
void QmlProfilerClientManager::qmlDebugConnectionStateChanged(QAbstractSocket::SocketState state)
|
|
|
|
|
{
|
|
|
|
|
logState(QmlDebugConnection::socketStateToString(state));
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-05 17:18:11 +02:00
|
|
|
void QmlProfilerClientManager::logState(const QString &msg)
|
|
|
|
|
{
|
|
|
|
|
QString state = QLatin1String("QML Profiler: ") + msg;
|
|
|
|
|
if (QmlProfilerPlugin::debugOutput)
|
|
|
|
|
qWarning() << state;
|
|
|
|
|
QmlProfilerTool::logState(state);
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerClientManager::retryMessageBoxFinished(int result)
|
|
|
|
|
{
|
2015-07-07 13:16:46 +02:00
|
|
|
if (d->connection) {
|
2015-11-16 17:05:10 +01:00
|
|
|
QTC_ASSERT(!d->connection->isConnected(), return);
|
2015-07-07 13:16:46 +02:00
|
|
|
if (d->connection->isConnecting())
|
|
|
|
|
d->connection->disconnect();
|
|
|
|
|
}
|
2015-07-06 14:33:49 +02:00
|
|
|
|
2012-02-24 10:47:17 +01:00
|
|
|
switch (result) {
|
|
|
|
|
case QMessageBox::Retry: {
|
|
|
|
|
d->connectionAttempts = 0;
|
|
|
|
|
d->connectionTimer.start();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case QMessageBox::Help: {
|
2013-01-29 15:29:55 +01:00
|
|
|
QmlProfilerTool::handleHelpRequest(QLatin1String("qthelp://org.qt-project.qtcreator/doc/creator-debugging-qml.html"));
|
2012-02-24 10:47:17 +01:00
|
|
|
// fall through
|
|
|
|
|
}
|
|
|
|
|
default: {
|
2014-05-05 17:18:11 +02:00
|
|
|
// The actual error message has already been logged.
|
|
|
|
|
logState(tr("Failed to connect!"));
|
2012-02-24 10:47:17 +01:00
|
|
|
emit connectionFailed();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-03 12:33:14 +02:00
|
|
|
void QmlProfilerClientManager::qmlComplete(qint64 maximumTime)
|
2012-02-24 10:47:17 +01:00
|
|
|
{
|
2014-10-14 16:44:45 +02:00
|
|
|
d->modelManager->traceTime()->increaseEndTime(maximumTime);
|
2015-09-10 17:11:21 +02:00
|
|
|
if (d->modelManager)
|
|
|
|
|
d->modelManager->acquiringDone();
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerClientManager::registerProfilerStateManager( QmlProfilerStateManager *profilerState )
|
|
|
|
|
{
|
|
|
|
|
if (d->profilerState) {
|
2015-10-30 12:35:17 +01:00
|
|
|
disconnect(d->profilerState, &QmlProfilerStateManager::stateChanged,
|
|
|
|
|
this, &QmlProfilerClientManager::profilerStateChanged);
|
|
|
|
|
disconnect(d->profilerState, &QmlProfilerStateManager::clientRecordingChanged,
|
|
|
|
|
this, &QmlProfilerClientManager::clientRecordingChanged);
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
d->profilerState = profilerState;
|
|
|
|
|
|
|
|
|
|
// connect
|
|
|
|
|
if (d->profilerState) {
|
2015-10-30 12:35:17 +01:00
|
|
|
connect(d->profilerState, &QmlProfilerStateManager::stateChanged,
|
|
|
|
|
this, &QmlProfilerClientManager::profilerStateChanged);
|
|
|
|
|
connect(d->profilerState, &QmlProfilerStateManager::clientRecordingChanged,
|
|
|
|
|
this, &QmlProfilerClientManager::clientRecordingChanged);
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerClientManager::profilerStateChanged()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->profilerState, return);
|
|
|
|
|
switch (d->profilerState->currentState()) {
|
|
|
|
|
case QmlProfilerStateManager::AppStopRequested :
|
2015-09-11 13:43:23 +02:00
|
|
|
if (d->profilerState->serverRecording()) {
|
|
|
|
|
if (d->qmlclientplugin)
|
|
|
|
|
d->qmlclientplugin.data()->setRecording(false);
|
|
|
|
|
} else {
|
2015-09-11 16:10:58 +02:00
|
|
|
d->profilerState->setCurrentState(QmlProfilerStateManager::Idle);
|
2015-09-11 13:43:23 +02:00
|
|
|
}
|
2012-02-24 10:47:17 +01:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlProfilerClientManager::clientRecordingChanged()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->profilerState, return);
|
2015-09-11 16:10:58 +02:00
|
|
|
if (d->qmlclientplugin)
|
|
|
|
|
d->qmlclientplugin->setRecording(d->profilerState->clientRecording());
|
2012-02-24 10:47:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlProfiler
|