2011-06-28 15:51:20 +02:00
|
|
|
/**************************************************************************
|
|
|
|
**
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
**
|
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2011-06-28 15:51:20 +02:00
|
|
|
**
|
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
**
|
2011-07-06 15:48:52 +00:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2011-06-28 15:51:20 +02:00
|
|
|
**
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-07-06 15:48:52 +00:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2011-06-28 15:51:20 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2011-07-06 15:48:52 +00:00
|
|
|
** Other Usage
|
|
|
|
**
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
**
|
2011-06-28 15:51:20 +02:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2011-06-28 15:51:20 +02:00
|
|
|
**
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
#ifndef QMLPROFILERTRACECLIENT_H
|
|
|
|
#define QMLPROFILERTRACECLIENT_H
|
|
|
|
|
2011-08-05 11:12:27 +02:00
|
|
|
#include "qdeclarativedebugclient.h"
|
|
|
|
#include "qmlprofilereventtypes.h"
|
|
|
|
#include "qmljsdebugclient_global.h"
|
|
|
|
|
2011-06-28 15:51:20 +02:00
|
|
|
#include <QtCore/QStack>
|
|
|
|
#include <QtCore/QStringList>
|
|
|
|
|
2011-08-05 11:12:27 +02:00
|
|
|
namespace QmlJsDebugClient {
|
2011-06-28 15:51:20 +02:00
|
|
|
|
2011-08-05 11:12:27 +02:00
|
|
|
struct QMLJSDEBUGCLIENT_EXPORT Location
|
2011-06-28 15:51:20 +02:00
|
|
|
{
|
|
|
|
Location() : line(-1) {}
|
|
|
|
Location(const QString &file, int lineNumber) : fileName(file), line(lineNumber) {}
|
|
|
|
QString fileName;
|
|
|
|
int line;
|
|
|
|
};
|
|
|
|
|
2011-08-05 11:12:27 +02:00
|
|
|
class QMLJSDEBUGCLIENT_EXPORT QmlProfilerTraceClient : public QmlJsDebugClient::QDeclarativeDebugClient
|
2011-06-28 15:51:20 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(bool recording READ isRecording WRITE setRecording NOTIFY recordingChanged)
|
|
|
|
|
2011-07-28 10:51:51 +02:00
|
|
|
// don't hide by signal
|
|
|
|
using QObject::event;
|
|
|
|
|
2011-06-28 15:51:20 +02:00
|
|
|
public:
|
2011-08-05 12:58:43 +02:00
|
|
|
QmlProfilerTraceClient(QDeclarativeDebugConnection *client);
|
|
|
|
~QmlProfilerTraceClient();
|
2011-06-28 15:51:20 +02:00
|
|
|
|
|
|
|
enum EventType {
|
|
|
|
FramePaint,
|
|
|
|
Mouse,
|
|
|
|
Key,
|
2011-09-22 16:58:59 +02:00
|
|
|
AnimationFrame,
|
|
|
|
EndTrace,
|
2011-11-02 16:57:31 +01:00
|
|
|
StartTrace,
|
2011-06-28 15:51:20 +02:00
|
|
|
|
|
|
|
MaximumEventType
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Message {
|
|
|
|
Event,
|
|
|
|
RangeStart,
|
|
|
|
RangeData,
|
|
|
|
RangeLocation,
|
|
|
|
RangeEnd,
|
|
|
|
Complete,
|
|
|
|
|
|
|
|
MaximumMessage
|
|
|
|
};
|
|
|
|
|
2011-08-05 12:58:43 +02:00
|
|
|
bool isRecording() const;
|
2011-06-28 15:51:20 +02:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setRecording(bool);
|
2011-08-05 12:58:43 +02:00
|
|
|
void clearData();
|
2011-06-28 15:51:20 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void complete();
|
2011-08-05 12:58:43 +02:00
|
|
|
void gap(qint64 time);
|
2011-06-28 15:51:20 +02:00
|
|
|
void event(int event, qint64 time);
|
2011-09-22 16:58:59 +02:00
|
|
|
void traceFinished( qint64 time );
|
2011-11-02 16:57:31 +01:00
|
|
|
void traceStarted( qint64 time );
|
2011-07-26 13:56:14 +02:00
|
|
|
void range(int type, qint64 startTime, qint64 length,
|
2011-06-28 15:51:20 +02:00
|
|
|
const QStringList &data, const QString &fileName, int line);
|
|
|
|
|
|
|
|
void recordingChanged(bool arg);
|
|
|
|
|
|
|
|
void enabled();
|
2011-08-05 12:58:43 +02:00
|
|
|
void cleared();
|
2011-06-28 15:51:20 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void statusChanged(Status);
|
|
|
|
virtual void messageReceived(const QByteArray &);
|
|
|
|
|
|
|
|
private:
|
2011-08-05 12:58:43 +02:00
|
|
|
class QmlProfilerTraceClientPrivate *d;
|
2011-06-28 15:51:20 +02:00
|
|
|
};
|
|
|
|
|
2011-08-05 11:12:27 +02:00
|
|
|
} // namespace QmlJsDebugClient
|
2011-06-28 15:51:20 +02:00
|
|
|
|
|
|
|
#endif // QMLPROFILERTRACECLIENT_H
|