forked from qt-creator/qt-creator
QmlProfiler: Move EventList to qmljsdebugclient library
Change-Id: Icbd24ffeb51db0f098d8fe9c62a0a889a722f760 Reviewed-on: http://codereview.qt.nokia.com/3222 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
This commit is contained in:
@@ -12,13 +12,15 @@ HEADERS += \
|
||||
$$PWD/qdeclarativedebugclient.h \
|
||||
$$PWD/qmljsdebugclient_global.h \
|
||||
$$PWD/qmlprofilertraceclient.h \
|
||||
$$PWD/qmlprofilereventtypes.h
|
||||
$$PWD/qmlprofilereventtypes.h \
|
||||
$$PWD/qmlprofilereventlist.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/qdeclarativeenginedebug.cpp \
|
||||
$$PWD/qpacketprotocol.cpp \
|
||||
$$PWD/qdeclarativedebugclient.cpp \
|
||||
$$PWD/qmlprofilertraceclient.cpp
|
||||
$$PWD/qmlprofilertraceclient.cpp \
|
||||
$$PWD/qmlprofilereventlist.cpp
|
||||
|
||||
OTHER_FILES += \
|
||||
$$PWD/qmljsdebugclient.pri \
|
||||
|
@@ -32,7 +32,6 @@
|
||||
|
||||
#include "qmlprofilereventlist.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QtAlgorithms>
|
||||
@@ -44,13 +43,10 @@
|
||||
#include <QtCore/QXmlStreamWriter>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
namespace QmlJsDebugClient {
|
||||
|
||||
#define MIN_LEVEL 1
|
||||
|
||||
@@ -590,16 +586,16 @@ int QmlProfilerEventList::count() const
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void QmlProfilerEventList::save(const QString &filename) const
|
||||
void QmlProfilerEventList::save(const QString &filename)
|
||||
{
|
||||
if (count() == 0) {
|
||||
showErrorDialog(tr("No data to save"));
|
||||
emit error(tr("No data to save"));
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
showErrorDialog(tr("Could not open %1 for writing").arg(filename));
|
||||
emit error(tr("Could not open %1 for writing").arg(filename));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -659,7 +655,7 @@ void QmlProfilerEventList::load()
|
||||
QFile file(filename);
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
showErrorDialog(tr("Could not open %1 for reading").arg(filename));
|
||||
emit error(tr("Could not open %1 for reading").arg(filename));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -761,7 +757,7 @@ void QmlProfilerEventList::load()
|
||||
file.close();
|
||||
|
||||
if (stream.hasError()) {
|
||||
showErrorDialog(tr("Error while parsing %1").arg(filename));
|
||||
emit error(tr("Error while parsing %1").arg(filename));
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
@@ -794,19 +790,6 @@ void QmlProfilerEventList::load()
|
||||
postProcess();
|
||||
}
|
||||
|
||||
void QmlProfilerEventList::showErrorDialog(const QString &st ) const
|
||||
{
|
||||
Core::ICore * const core = Core::ICore::instance();
|
||||
QMessageBox *errorDialog = new QMessageBox(core->mainWindow());
|
||||
errorDialog->setIcon(QMessageBox::Warning);
|
||||
errorDialog->setWindowTitle(tr("QML Profiler"));
|
||||
errorDialog->setText( st );
|
||||
errorDialog->setStandardButtons(QMessageBox::Ok);
|
||||
errorDialog->setDefaultButton(QMessageBox::Ok);
|
||||
errorDialog->setModal(false);
|
||||
errorDialog->show();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////
|
||||
qint64 QmlProfilerEventList::getStartTime(int index) const {
|
||||
return d->m_startTimeSortedList[index].startTime;
|
||||
@@ -845,5 +828,4 @@ QString QmlProfilerEventList::getDetails(int index) const {
|
||||
}
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProfiler
|
||||
} // namespace QmlJsDebugClient
|
@@ -33,14 +33,15 @@
|
||||
#ifndef QMLPROFILEREVENTLIST_H
|
||||
#define QMLPROFILEREVENTLIST_H
|
||||
|
||||
#include <QObject>
|
||||
#include "qmlprofilereventtypes.h"
|
||||
#include "qmljsdebugclient_global.h"
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include "qmljsdebugclient/qmlprofilereventtypes.h"
|
||||
#include <QtCore/QObject>
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
namespace QmlJsDebugClient {
|
||||
|
||||
struct QmlEventData
|
||||
struct QMLJSDEBUGCLIENT_EXPORT QmlEventData
|
||||
{
|
||||
QString displayname;
|
||||
QString filename;
|
||||
@@ -70,7 +71,7 @@ enum ParsingStatus {
|
||||
DoneStatus = 5
|
||||
};
|
||||
|
||||
class QmlProfilerEventList : public QObject
|
||||
class QMLJSDEBUGCLIENT_EXPORT QmlProfilerEventList : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -105,13 +106,14 @@ signals:
|
||||
void dataReady();
|
||||
void countChanged();
|
||||
void parsingStatusChanged();
|
||||
void error(const QString &error);
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
void addRangedEvent(int type, qint64 startTime, qint64 length,
|
||||
const QStringList &data, const QString &fileName, int line);
|
||||
void complete();
|
||||
void save(const QString &filename) const;
|
||||
void save(const QString &filename);
|
||||
void load(const QString &filename);
|
||||
void setFilename(const QString &filename);
|
||||
void load();
|
||||
@@ -132,7 +134,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProfiler
|
||||
} // namespace QmlJsDebugClient
|
||||
|
||||
#endif // QMLPROFILEREVENTLIST_H
|
@@ -27,8 +27,7 @@ SOURCES += \
|
||||
codaqmlprofilerrunner.cpp \
|
||||
remotelinuxqmlprofilerrunner.cpp \
|
||||
qmlprofilereventview.cpp \
|
||||
qmlprofilerruncontrolfactory.cpp \
|
||||
qmlprofilereventlist.cpp
|
||||
qmlprofilerruncontrolfactory.cpp
|
||||
|
||||
HEADERS += \
|
||||
qmlprofilerconstants.h \
|
||||
@@ -44,8 +43,7 @@ HEADERS += \
|
||||
codaqmlprofilerrunner.h \
|
||||
remotelinuxqmlprofilerrunner.h \
|
||||
qmlprofilereventview.h \
|
||||
qmlprofilerruncontrolfactory.h\
|
||||
qmlprofilereventlist.h
|
||||
qmlprofilerruncontrolfactory.h
|
||||
|
||||
RESOURCES += \
|
||||
qml/qml.qrc
|
||||
|
@@ -35,13 +35,13 @@
|
||||
|
||||
#include <QTreeView>
|
||||
#include <qmljsdebugclient/qmlprofilereventtypes.h>
|
||||
#include "qmlprofilereventlist.h"
|
||||
#include <qmljsdebugclient/qmlprofilereventlist.h>
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
typedef QHash<QString, QmlEventData *> QmlEventHash;
|
||||
typedef QList<QmlEventData *> QmlEventList;
|
||||
typedef QHash<QString, QmlJsDebugClient::QmlEventData *> QmlEventHash;
|
||||
typedef QList<QmlJsDebugClient::QmlEventData *> QmlEventList;
|
||||
|
||||
enum ItemRole {
|
||||
LocationRole = Qt::UserRole+1,
|
||||
@@ -77,10 +77,10 @@ public:
|
||||
MaxViewTypes
|
||||
};
|
||||
|
||||
explicit QmlProfilerEventsView(QWidget *parent, QmlProfilerEventList *model);
|
||||
explicit QmlProfilerEventsView(QWidget *parent, QmlJsDebugClient::QmlProfilerEventList *model);
|
||||
~QmlProfilerEventsView();
|
||||
|
||||
void setEventStatisticsModel( QmlProfilerEventList *model );
|
||||
void setEventStatisticsModel(QmlJsDebugClient::QmlProfilerEventList *model);
|
||||
void setFieldViewable(Fields field, bool show);
|
||||
void setViewType(ViewTypes type);
|
||||
void setShowAnonymousEvents( bool showThem );
|
||||
|
@@ -35,12 +35,12 @@
|
||||
#include "qmlprofilerplugin.h"
|
||||
#include "qmlprofilerconstants.h"
|
||||
#include "qmlprofilerattachdialog.h"
|
||||
#include "qmlprofilereventlist.h"
|
||||
#include "qmlprofilereventview.h"
|
||||
|
||||
#include "tracewindow.h"
|
||||
#include "timelineview.h"
|
||||
|
||||
#include <qmljsdebugclient/qmlprofilereventlist.h>
|
||||
#include <qmljsdebugclient/qdeclarativedebugclient.h>
|
||||
|
||||
#include <analyzerbase/analyzermanager.h>
|
||||
@@ -255,6 +255,7 @@ QWidget *QmlProfilerTool::createWidgets()
|
||||
connect(d->m_traceWindow, SIGNAL(gotoSourceLocation(QString,int)),this, SLOT(gotoSourceLocation(QString,int)));
|
||||
connect(d->m_traceWindow, SIGNAL(timeChanged(qreal)), this, SLOT(updateTimer(qreal)));
|
||||
connect(d->m_traceWindow, SIGNAL(contextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
|
||||
connect(d->m_traceWindow->getEventList(), SIGNAL(error(QString)), this, SLOT(showErrorDialog(QString)));
|
||||
|
||||
d->m_eventsView = new QmlProfilerEventsView(mw, d->m_traceWindow->getEventList());
|
||||
d->m_eventsView->setViewType(QmlProfilerEventsView::EventsView);
|
||||
@@ -582,3 +583,16 @@ void QmlProfilerTool::showLoadDialog()
|
||||
QTimer::singleShot(100, d->m_traceWindow->getEventList(), SLOT(load()));
|
||||
}
|
||||
}
|
||||
|
||||
void QmlProfilerTool::showErrorDialog(const QString &error)
|
||||
{
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
QMessageBox *errorDialog = new QMessageBox(core->mainWindow());
|
||||
errorDialog->setIcon(QMessageBox::Warning);
|
||||
errorDialog->setWindowTitle(tr("QML Profiler"));
|
||||
errorDialog->setText(error);
|
||||
errorDialog->setStandardButtons(QMessageBox::Ok);
|
||||
errorDialog->setDefaultButton(QMessageBox::Ok);
|
||||
errorDialog->setModal(false);
|
||||
errorDialog->show();
|
||||
}
|
||||
|
@@ -90,6 +90,7 @@ private slots:
|
||||
void connectionStateChanged();
|
||||
void showSaveDialog();
|
||||
void showLoadDialog();
|
||||
void showErrorDialog(const QString &error);
|
||||
|
||||
private:
|
||||
void connectToClient();
|
||||
|
@@ -35,7 +35,7 @@
|
||||
|
||||
#include <QtDeclarative/QDeclarativeItem>
|
||||
#include <QtScript/QScriptValue>
|
||||
#include <qmlprofilereventlist.h>
|
||||
#include <qmljsdebugclient/qmlprofilereventlist.h>
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
@@ -81,10 +81,10 @@ public:
|
||||
|
||||
qreal cachedProgress() const;
|
||||
|
||||
QmlProfilerEventList *eventList() const { return m_eventList; }
|
||||
QmlJsDebugClient::QmlProfilerEventList *eventList() const { return m_eventList; }
|
||||
void setEventList(QObject *eventList)
|
||||
{
|
||||
m_eventList = qobject_cast<QmlProfilerEventList *>(eventList);
|
||||
m_eventList = qobject_cast<QmlJsDebugClient::QmlProfilerEventList *>(eventList);
|
||||
emit eventListChanged(m_eventList);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ signals:
|
||||
void endTimeChanged(qint64 arg);
|
||||
void startXChanged(qreal arg);
|
||||
void totalWidthChanged(qreal arg);
|
||||
void eventListChanged(QmlProfilerEventList *list);
|
||||
void eventListChanged(QmlJsDebugClient::QmlProfilerEventList *list);
|
||||
|
||||
void cachedProgressChanged();
|
||||
void cacheReady();
|
||||
@@ -157,7 +157,7 @@ private:
|
||||
int prevMin;
|
||||
int prevMax;
|
||||
|
||||
QmlProfilerEventList *m_eventList;
|
||||
QmlJsDebugClient::QmlProfilerEventList *m_eventList;
|
||||
|
||||
qreal m_totalWidth;
|
||||
int m_lastCachedIndex;
|
||||
|
@@ -33,9 +33,8 @@
|
||||
#include "tracewindow.h"
|
||||
|
||||
#include "qmlprofilerplugin.h"
|
||||
#include "qmlprofilereventlist.h"
|
||||
|
||||
#include <qmljsdebugclient/qdeclarativedebugclient.h>
|
||||
#include <qmljsdebugclient/qmlprofilereventlist.h>
|
||||
#include <qmljsdebugclient/qmlprofilertraceclient.h>
|
||||
#include <utils/styledbar.h>
|
||||
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#define TRACEWINDOW_H
|
||||
|
||||
#include <qmljsdebugclient/qmlprofilertraceclient.h>
|
||||
#include "qmlprofilereventlist.h"
|
||||
#include <qmljsdebugclient/qmlprofilereventlist.h>
|
||||
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtGui/QWidget>
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
|
||||
void reset(QmlJsDebugClient::QDeclarativeDebugConnection *conn);
|
||||
|
||||
QmlProfilerEventList *getEventList() const;
|
||||
QmlJsDebugClient::QmlProfilerEventList *getEventList() const;
|
||||
|
||||
void setRecording(bool recording);
|
||||
bool isRecording() const;
|
||||
@@ -91,7 +91,7 @@ private:
|
||||
QSize m_sizeHint;
|
||||
|
||||
QDeclarativeView *m_view;
|
||||
QmlProfilerEventList *m_eventList;
|
||||
QmlJsDebugClient::QmlProfilerEventList *m_eventList;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user