2011-03-11 12:22:57 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-03-25 09:25:17 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2011-03-11 12:22:57 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2011-03-11 12:22:57 +01: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-03-11 12:22:57 +01:00
|
|
|
**
|
2011-03-25 09:25:17 +01: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-03-25 09:25:17 +01: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-03-25 09:25:17 +01: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-03-11 12:22:57 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
2011-03-25 09:25:17 +01:00
|
|
|
|
|
|
|
|
#ifndef TRACEWINDOW_H
|
|
|
|
|
#define TRACEWINDOW_H
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2011-08-05 11:12:27 +02:00
|
|
|
#include <qmljsdebugclient/qmlprofilertraceclient.h>
|
2011-08-18 16:10:33 +02:00
|
|
|
#include <qmljsdebugclient/qmlprofilereventlist.h>
|
2011-03-25 09:21:00 +01:00
|
|
|
|
2011-09-27 14:38:22 +02:00
|
|
|
#include <qmljsdebugclient/qv8profilerclient.h>
|
|
|
|
|
|
2011-05-18 17:05:49 +02:00
|
|
|
#include <QtCore/QPointer>
|
|
|
|
|
#include <QtGui/QWidget>
|
2011-10-19 14:28:21 +02:00
|
|
|
#include <QtGui/QToolButton>
|
2011-03-25 09:21:00 +01:00
|
|
|
|
2011-10-20 17:38:24 +02:00
|
|
|
#include <QtCore/QEvent>
|
2011-11-16 16:08:05 +01:00
|
|
|
#include <QtDeclarative/QDeclarativeView>
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2011-03-25 09:21:00 +01:00
|
|
|
namespace QmlProfiler {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2011-10-20 17:38:24 +02:00
|
|
|
class MouseWheelResizer : public QObject {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
MouseWheelResizer(QObject *parent=0):QObject(parent){}
|
|
|
|
|
protected:
|
|
|
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
|
|
|
|
signals:
|
|
|
|
|
void mouseWheelMoved(int x, int y, int delta);
|
|
|
|
|
};
|
|
|
|
|
|
2011-10-11 17:52:39 +02:00
|
|
|
// centralized zoom control
|
|
|
|
|
class ZoomControl : public QObject {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
ZoomControl(QObject *parent=0):QObject(parent),m_startTime(0),m_endTime(0) {}
|
|
|
|
|
~ZoomControl(){}
|
|
|
|
|
|
2011-10-20 17:38:24 +02:00
|
|
|
Q_INVOKABLE void setRange(qint64 startTime, qint64 endTime);
|
2011-10-11 17:52:39 +02:00
|
|
|
Q_INVOKABLE qint64 startTime() { return m_startTime; }
|
|
|
|
|
Q_INVOKABLE qint64 endTime() { return m_endTime; }
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void rangeChanged();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
qint64 m_startTime;
|
|
|
|
|
qint64 m_endTime;
|
|
|
|
|
};
|
|
|
|
|
|
2011-11-16 16:08:05 +01:00
|
|
|
class ScrollableDeclarativeView : public QDeclarativeView
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit ScrollableDeclarativeView(QWidget *parent = 0);
|
|
|
|
|
~ScrollableDeclarativeView();
|
|
|
|
|
protected:
|
|
|
|
|
void scrollContentsBy(int dx, int dy);
|
|
|
|
|
};
|
|
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
class TraceWindow : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2011-05-18 17:05:49 +02:00
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
public:
|
|
|
|
|
TraceWindow(QWidget *parent = 0);
|
|
|
|
|
~TraceWindow();
|
|
|
|
|
|
2011-06-28 15:51:20 +02:00
|
|
|
void reset(QmlJsDebugClient::QDeclarativeDebugConnection *conn);
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2011-08-18 16:10:33 +02:00
|
|
|
QmlJsDebugClient::QmlProfilerEventList *getEventList() const;
|
2011-11-08 16:54:23 +01:00
|
|
|
ZoomControl *rangeTimes() const;
|
2011-07-26 13:56:14 +02:00
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
void setRecording(bool recording);
|
2011-04-06 12:26:19 +02:00
|
|
|
bool isRecording() const;
|
2011-10-20 17:38:24 +02:00
|
|
|
void viewAll();
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2011-11-08 16:54:23 +01:00
|
|
|
bool hasValidSelection() const;
|
|
|
|
|
qint64 selectionStart() const;
|
|
|
|
|
qint64 selectionEnd() const;
|
2011-11-28 16:30:30 +01:00
|
|
|
double profiledTime() const;
|
2011-06-24 18:19:08 +02:00
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
public slots:
|
|
|
|
|
void updateCursorPosition();
|
2011-03-24 12:42:15 +01:00
|
|
|
void updateTimer();
|
2011-04-06 16:04:18 +02:00
|
|
|
void clearDisplay();
|
2011-07-05 15:50:32 +02:00
|
|
|
void updateToolbar();
|
2011-10-19 14:28:21 +02:00
|
|
|
void toggleRangeMode(bool);
|
2011-10-26 11:32:01 +02:00
|
|
|
void toggleLockMode(bool);
|
2011-10-19 14:28:21 +02:00
|
|
|
void updateRangeButton();
|
2011-10-26 11:32:01 +02:00
|
|
|
void updateLockButton();
|
2011-10-20 17:38:24 +02:00
|
|
|
void setZoomLevel(int zoomLevel);
|
|
|
|
|
void updateRange();
|
|
|
|
|
void mouseWheelMoved(int x, int y, int delta);
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2011-09-27 14:38:22 +02:00
|
|
|
void qmlComplete();
|
|
|
|
|
void v8Complete();
|
2011-11-09 12:57:41 +01:00
|
|
|
void selectNextEvent(int eventId);
|
2011-11-28 16:30:30 +01:00
|
|
|
void updateProfilerState();
|
2012-01-13 12:25:53 +01:00
|
|
|
void updateToolTip(const QString &text);
|
2011-09-27 14:38:22 +02:00
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
signals:
|
|
|
|
|
void viewUpdated();
|
2011-11-28 16:30:30 +01:00
|
|
|
void profilerStateChanged(bool qmlActive, bool v8active);
|
2011-04-01 13:57:49 +02:00
|
|
|
void gotoSourceLocation(const QString &fileUrl, int lineNumber);
|
2011-07-26 13:56:14 +02:00
|
|
|
void range(int type, qint64 startTime, qint64 length, const QStringList &data, const QString &fileName, int line);
|
2011-09-27 14:38:22 +02:00
|
|
|
void v8range(int depth,const QString &function,const QString &filename,
|
|
|
|
|
int lineNumber, double totalTime, double selfTime);
|
2011-09-22 16:58:59 +02:00
|
|
|
void traceFinished(qint64);
|
2011-11-02 16:57:31 +01:00
|
|
|
void traceStarted(qint64);
|
2011-12-14 16:44:33 +01:00
|
|
|
void frameEvent(qint64, int, int);
|
2011-09-27 14:38:22 +02:00
|
|
|
|
2011-06-24 18:19:08 +02:00
|
|
|
void internalClearDisplay();
|
2011-06-24 18:19:08 +02:00
|
|
|
void jumpToPrev();
|
|
|
|
|
void jumpToNext();
|
2011-10-19 14:28:21 +02:00
|
|
|
void rangeModeChanged(bool);
|
2011-10-26 11:32:01 +02:00
|
|
|
void lockModeChanged(bool);
|
2011-07-05 15:50:32 +02:00
|
|
|
void enableToolbar(bool);
|
2011-10-20 17:38:24 +02:00
|
|
|
void zoomLevelChanged(int);
|
|
|
|
|
void updateViewZoom(QVariant zoomLevel);
|
|
|
|
|
void wheelZoom(QVariant wheelCenter, QVariant wheelDelta);
|
|
|
|
|
void globalZoom();
|
2011-06-24 18:19:08 +02:00
|
|
|
|
2011-07-26 13:56:14 +02:00
|
|
|
void contextMenuRequested(const QPoint& position);
|
2011-11-09 12:57:41 +01:00
|
|
|
void selectNextEventInDisplay(QVariant eventId);
|
|
|
|
|
void selectedEventIdChanged(int eventId);
|
2011-07-26 13:56:14 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void contextMenuEvent(QContextMenuEvent *);
|
2011-10-11 17:52:39 +02:00
|
|
|
QWidget *createToolbar();
|
2011-10-20 17:38:24 +02:00
|
|
|
QWidget *createZoomToolbar();
|
2011-11-28 16:30:30 +01:00
|
|
|
void connectClientSignals();
|
|
|
|
|
void disconnectClientSignals();
|
2011-10-11 17:52:39 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void resizeEvent(QResizeEvent *event);
|
2011-07-26 13:56:14 +02:00
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
private:
|
2011-08-05 11:12:27 +02:00
|
|
|
QWeakPointer<QmlJsDebugClient::QmlProfilerTraceClient> m_plugin;
|
2011-09-27 14:38:22 +02:00
|
|
|
QWeakPointer<QmlJsDebugClient::QV8ProfilerClient> m_v8plugin;
|
2011-03-11 12:22:57 +01:00
|
|
|
QSize m_sizeHint;
|
|
|
|
|
|
2011-11-16 16:08:05 +01:00
|
|
|
ScrollableDeclarativeView *m_mainView;
|
2011-10-11 17:52:39 +02:00
|
|
|
QDeclarativeView *m_timebar;
|
|
|
|
|
QDeclarativeView *m_overview;
|
2011-08-18 16:10:33 +02:00
|
|
|
QmlJsDebugClient::QmlProfilerEventList *m_eventList;
|
2011-09-27 14:38:22 +02:00
|
|
|
bool m_qmlDataReady;
|
|
|
|
|
bool m_v8DataReady;
|
2011-11-28 16:30:30 +01:00
|
|
|
double m_profiledTime;
|
2011-10-11 17:52:39 +02:00
|
|
|
|
|
|
|
|
QWeakPointer<ZoomControl> m_zoomControl;
|
2011-10-19 14:28:21 +02:00
|
|
|
|
|
|
|
|
QToolButton *m_buttonRange;
|
2011-10-26 11:32:01 +02:00
|
|
|
QToolButton *m_buttonLock;
|
2011-10-20 17:38:24 +02:00
|
|
|
QWidget *m_zoomToolbar;
|
|
|
|
|
int m_currentZoomLevel;
|
2011-03-11 12:22:57 +01:00
|
|
|
};
|
|
|
|
|
|
2011-03-25 09:21:00 +01:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlProfiler
|
|
|
|
|
|
2011-03-25 09:25:17 +01:00
|
|
|
#endif // TRACEWINDOW_H
|
2011-03-11 12:22:57 +01:00
|
|
|
|