forked from qt-creator/qt-creator
QmlProfiler: Remove QmlProfilerBaseModel
Now that the V8 model is gone we don't need a base model anymore. Change-Id: I35aee0627f78f417ec9c971e1c7bbf70adfc7b27 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -8,7 +8,6 @@ SOURCES += \
|
|||||||
localqmlprofilerrunner.cpp \
|
localqmlprofilerrunner.cpp \
|
||||||
qmlprofileranimationsmodel.cpp \
|
qmlprofileranimationsmodel.cpp \
|
||||||
qmlprofilerattachdialog.cpp \
|
qmlprofilerattachdialog.cpp \
|
||||||
qmlprofilerbasemodel.cpp \
|
|
||||||
qmlprofilerbindingloopsrenderpass.cpp \
|
qmlprofilerbindingloopsrenderpass.cpp \
|
||||||
qmlprofilerclientmanager.cpp \
|
qmlprofilerclientmanager.cpp \
|
||||||
qmlprofilerconfigwidget.cpp \
|
qmlprofilerconfigwidget.cpp \
|
||||||
@@ -39,8 +38,6 @@ HEADERS += \
|
|||||||
qmlprofiler_global.h \
|
qmlprofiler_global.h \
|
||||||
qmlprofileranimationsmodel.h \
|
qmlprofileranimationsmodel.h \
|
||||||
qmlprofilerattachdialog.h \
|
qmlprofilerattachdialog.h \
|
||||||
qmlprofilerbasemodel.h \
|
|
||||||
qmlprofilerbasemodel_p.h \
|
|
||||||
qmlprofilerbindingloopsrenderpass.h \
|
qmlprofilerbindingloopsrenderpass.h \
|
||||||
qmlprofilerclientmanager.h \
|
qmlprofilerclientmanager.h \
|
||||||
qmlprofilerconfigwidget.h \
|
qmlprofilerconfigwidget.h \
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ QtcPlugin {
|
|||||||
"qmlprofiler_global.h",
|
"qmlprofiler_global.h",
|
||||||
"qmlprofileranimationsmodel.h", "qmlprofileranimationsmodel.cpp",
|
"qmlprofileranimationsmodel.h", "qmlprofileranimationsmodel.cpp",
|
||||||
"qmlprofilerattachdialog.cpp", "qmlprofilerattachdialog.h",
|
"qmlprofilerattachdialog.cpp", "qmlprofilerattachdialog.h",
|
||||||
"qmlprofilerbasemodel.cpp", "qmlprofilerbasemodel.h", "qmlprofilerbasemodel_p.h",
|
|
||||||
"qmlprofilerbindingloopsrenderpass.cpp","qmlprofilerbindingloopsrenderpass.h",
|
"qmlprofilerbindingloopsrenderpass.cpp","qmlprofilerbindingloopsrenderpass.h",
|
||||||
"qmlprofilerclientmanager.cpp", "qmlprofilerclientmanager.h",
|
"qmlprofilerclientmanager.cpp", "qmlprofilerclientmanager.h",
|
||||||
"qmlprofilerconfigwidget.cpp", "qmlprofilerconfigwidget.h",
|
"qmlprofilerconfigwidget.cpp", "qmlprofilerconfigwidget.h",
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ QVariantMap QmlProfilerAnimationsModel::details(int index) const
|
|||||||
QVariantMap result;
|
QVariantMap result;
|
||||||
|
|
||||||
result.insert(QStringLiteral("displayName"), displayName());
|
result.insert(QStringLiteral("displayName"), displayName());
|
||||||
result.insert(tr("Duration"), QmlProfilerBaseModel::formatTime(duration(index)));
|
result.insert(tr("Duration"), QmlProfilerDataModel::formatTime(duration(index)));
|
||||||
result.insert(tr("Framerate"), QString::fromLatin1("%1 FPS").arg(m_data[index].framerate));
|
result.insert(tr("Framerate"), QString::fromLatin1("%1 FPS").arg(m_data[index].framerate));
|
||||||
result.insert(tr("Animations"), QString::fromLatin1("%1").arg(m_data[index].animationcount));
|
result.insert(tr("Animations"), QString::fromLatin1("%1").arg(m_data[index].animationcount));
|
||||||
result.insert(tr("Context"), tr(selectionId(index) == QmlDebug::GuiThread ? "GUI Thread" :
|
result.insert(tr("Context"), tr(selectionId(index) == QmlDebug::GuiThread ? "GUI Thread" :
|
||||||
|
|||||||
@@ -1,102 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** 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
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "qmlprofilerbasemodel.h"
|
|
||||||
#include "qmlprofilermodelmanager.h"
|
|
||||||
#include "qmlprofilerbasemodel_p.h"
|
|
||||||
|
|
||||||
namespace QmlProfiler {
|
|
||||||
|
|
||||||
QmlProfilerBaseModel::QmlProfilerBaseModel(Utils::FileInProjectFinder *fileFinder,
|
|
||||||
QmlProfilerModelManager *manager,
|
|
||||||
QmlProfilerBaseModelPrivate *dd)
|
|
||||||
: QObject(manager)
|
|
||||||
, d_ptr(dd)
|
|
||||||
{
|
|
||||||
Q_D(QmlProfilerBaseModel);
|
|
||||||
d->modelManager = manager;
|
|
||||||
d->processingDone = false;
|
|
||||||
d->detailsRewriter = new QmlProfilerDetailsRewriter(this, fileFinder);
|
|
||||||
Q_ASSERT(d->modelManager);
|
|
||||||
d->modelId = d->modelManager->registerModelProxy();
|
|
||||||
connect(d->detailsRewriter, SIGNAL(rewriteDetailsString(int,QString)),
|
|
||||||
this, SLOT(detailsChanged(int,QString)));
|
|
||||||
connect(d->detailsRewriter, SIGNAL(eventDetailsChanged()),
|
|
||||||
this, SLOT(detailsDone()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlProfilerBaseModel::~QmlProfilerBaseModel()
|
|
||||||
{
|
|
||||||
Q_D(QmlProfilerBaseModel);
|
|
||||||
delete d->detailsRewriter;
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerBaseModel::clear()
|
|
||||||
{
|
|
||||||
Q_D(QmlProfilerBaseModel);
|
|
||||||
d->detailsRewriter->clearRequests();
|
|
||||||
d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1);
|
|
||||||
d->processingDone = false;
|
|
||||||
emit changed();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QmlProfilerBaseModel::processingDone() const
|
|
||||||
{
|
|
||||||
Q_D(const QmlProfilerBaseModel);
|
|
||||||
return d->processingDone;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerBaseModel::complete()
|
|
||||||
{
|
|
||||||
Q_D(QmlProfilerBaseModel);
|
|
||||||
d->detailsRewriter->reloadDocuments();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QmlProfilerBaseModel::formatTime(qint64 timestamp)
|
|
||||||
{
|
|
||||||
if (timestamp < 1e6)
|
|
||||||
return QString::number(timestamp/1e3f,'f',3) + trUtf8(" \xc2\xb5s");
|
|
||||||
if (timestamp < 1e9)
|
|
||||||
return QString::number(timestamp/1e6f,'f',3) + tr(" ms");
|
|
||||||
|
|
||||||
return QString::number(timestamp/1e9f,'f',3) + tr(" s");
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerBaseModel::detailsDone()
|
|
||||||
{
|
|
||||||
Q_D(QmlProfilerBaseModel);
|
|
||||||
emit changed();
|
|
||||||
d->processingDone = true;
|
|
||||||
d->modelManager->modelProxyCountUpdated(d->modelId, isEmpty() ? 0 : 1, 1);
|
|
||||||
d->modelManager->complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** 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
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QMLPROFILERBASEMODEL_H
|
|
||||||
#define QMLPROFILERBASEMODEL_H
|
|
||||||
|
|
||||||
#include "qmlprofiler_global.h"
|
|
||||||
#include "qmlprofilerdetailsrewriter.h"
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
namespace QmlProfiler {
|
|
||||||
|
|
||||||
class QmlProfilerModelManager;
|
|
||||||
|
|
||||||
class QMLPROFILER_EXPORT QmlProfilerBaseModel : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
virtual ~QmlProfilerBaseModel();
|
|
||||||
|
|
||||||
virtual void complete();
|
|
||||||
virtual void clear();
|
|
||||||
virtual bool isEmpty() const = 0;
|
|
||||||
bool processingDone() const;
|
|
||||||
|
|
||||||
static QString formatTime(qint64 timestamp);
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
virtual void detailsChanged(int requestId, const QString &newString) = 0;
|
|
||||||
virtual void detailsDone();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void changed();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
class QmlProfilerBaseModelPrivate;
|
|
||||||
QmlProfilerBaseModelPrivate *d_ptr;
|
|
||||||
|
|
||||||
QmlProfilerBaseModel(Utils::FileInProjectFinder *fileFinder, QmlProfilerModelManager *manager,
|
|
||||||
QmlProfilerBaseModelPrivate *dd);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DECLARE_PRIVATE(QmlProfilerBaseModel)
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // QMLPROFILERBASEMODEL_H
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** 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
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QMLPROFILERBASEMODEL_P_H
|
|
||||||
#define QMLPROFILERBASEMODEL_P_H
|
|
||||||
|
|
||||||
#include "qmlprofilerbasemodel.h"
|
|
||||||
|
|
||||||
namespace QmlProfiler {
|
|
||||||
|
|
||||||
class QmlProfilerBaseModel::QmlProfilerBaseModelPrivate {
|
|
||||||
public:
|
|
||||||
QmlProfilerBaseModelPrivate(QmlProfilerBaseModel *qq) : q_ptr(qq) {}
|
|
||||||
virtual ~QmlProfilerBaseModelPrivate() {}
|
|
||||||
|
|
||||||
QmlProfilerModelManager *modelManager;
|
|
||||||
int modelId;
|
|
||||||
bool processingDone;
|
|
||||||
Internal::QmlProfilerDetailsRewriter *detailsRewriter;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QmlProfilerBaseModel *q_ptr;
|
|
||||||
private:
|
|
||||||
Q_DECLARE_PUBLIC(QmlProfilerBaseModel)
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // QMLPROFILERBASEMODEL_P_H
|
|
||||||
@@ -29,9 +29,10 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlprofilerdatamodel.h"
|
#include "qmlprofilerdatamodel.h"
|
||||||
#include "qmlprofilerbasemodel_p.h"
|
|
||||||
#include "qmlprofilermodelmanager.h"
|
#include "qmlprofilermodelmanager.h"
|
||||||
#include "qmlprofilernotesmodel.h"
|
#include "qmlprofilernotesmodel.h"
|
||||||
|
#include "qmlprofilerdetailsrewriter.h"
|
||||||
|
|
||||||
#include <qmldebug/qmlprofilereventtypes.h>
|
#include <qmldebug/qmlprofilereventtypes.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
@@ -40,17 +41,17 @@
|
|||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
|
|
||||||
class QmlProfilerDataModel::QmlProfilerDataModelPrivate :
|
class QmlProfilerDataModel::QmlProfilerDataModelPrivate
|
||||||
public QmlProfilerBaseModel::QmlProfilerBaseModelPrivate
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlProfilerDataModelPrivate(QmlProfilerDataModel *qq) : QmlProfilerBaseModelPrivate(qq) {}
|
|
||||||
QVector<QmlEventTypeData> eventTypes;
|
QVector<QmlEventTypeData> eventTypes;
|
||||||
QVector<QmlEventData> eventList;
|
QVector<QmlEventData> eventList;
|
||||||
QVector<QmlEventNoteData> eventNotes;
|
QVector<QmlEventNoteData> eventNotes;
|
||||||
QHash<QmlEventTypeData, int> eventTypeIds;
|
QHash<QmlEventTypeData, int> eventTypeIds;
|
||||||
private:
|
|
||||||
Q_DECLARE_PUBLIC(QmlProfilerDataModel)
|
QmlProfilerModelManager *modelManager;
|
||||||
|
int modelId;
|
||||||
|
Internal::QmlProfilerDetailsRewriter *detailsRewriter;
|
||||||
};
|
};
|
||||||
|
|
||||||
QString getDisplayName(const QmlProfilerDataModel::QmlEventTypeData &event)
|
QString getDisplayName(const QmlProfilerDataModel::QmlEventTypeData &event)
|
||||||
@@ -91,15 +92,41 @@ QString getInitialDetails(const QmlProfilerDataModel::QmlEventTypeData &event)
|
|||||||
return details;
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QmlProfilerDataModel::formatTime(qint64 timestamp)
|
||||||
|
{
|
||||||
|
if (timestamp < 1e6)
|
||||||
|
return QString::number(timestamp/1e3f,'f',3) + trUtf8(" \xc2\xb5s");
|
||||||
|
if (timestamp < 1e9)
|
||||||
|
return QString::number(timestamp/1e6f,'f',3) + tr(" ms");
|
||||||
|
|
||||||
|
return QString::number(timestamp/1e9f,'f',3) + tr(" s");
|
||||||
|
}
|
||||||
|
|
||||||
QmlProfilerDataModel::QmlProfilerDataModel(Utils::FileInProjectFinder *fileFinder,
|
QmlProfilerDataModel::QmlProfilerDataModel(Utils::FileInProjectFinder *fileFinder,
|
||||||
QmlProfilerModelManager *parent)
|
QmlProfilerModelManager *parent) :
|
||||||
: QmlProfilerBaseModel(fileFinder, parent, new QmlProfilerDataModelPrivate(this))
|
QObject(parent), d_ptr(new QmlProfilerDataModelPrivate)
|
||||||
{
|
{
|
||||||
Q_D(QmlProfilerDataModel);
|
Q_D(QmlProfilerDataModel);
|
||||||
|
Q_ASSERT(parent);
|
||||||
|
d->modelManager = parent;
|
||||||
|
d->detailsRewriter = new QmlProfilerDetailsRewriter(this, fileFinder);
|
||||||
|
d->modelId = d->modelManager->registerModelProxy();
|
||||||
|
connect(d->detailsRewriter, SIGNAL(rewriteDetailsString(int,QString)),
|
||||||
|
this, SLOT(detailsChanged(int,QString)));
|
||||||
|
connect(d->detailsRewriter, SIGNAL(eventDetailsChanged()),
|
||||||
|
this, SLOT(detailsDone()));
|
||||||
|
|
||||||
// The document loading is very expensive.
|
// The document loading is very expensive.
|
||||||
d->modelManager->setProxyCountWeight(d->modelId, 4);
|
d->modelManager->setProxyCountWeight(d->modelId, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QmlProfilerDataModel::~QmlProfilerDataModel()
|
||||||
|
{
|
||||||
|
Q_D(QmlProfilerDataModel);
|
||||||
|
delete d->detailsRewriter;
|
||||||
|
delete d;
|
||||||
|
}
|
||||||
|
|
||||||
const QVector<QmlProfilerDataModel::QmlEventData> &QmlProfilerDataModel::getEvents() const
|
const QVector<QmlProfilerDataModel::QmlEventData> &QmlProfilerDataModel::getEvents() const
|
||||||
{
|
{
|
||||||
Q_D(const QmlProfilerDataModel);
|
Q_D(const QmlProfilerDataModel);
|
||||||
@@ -151,8 +178,9 @@ void QmlProfilerDataModel::clear()
|
|||||||
d->eventTypes.clear();
|
d->eventTypes.clear();
|
||||||
d->eventTypeIds.clear();
|
d->eventTypeIds.clear();
|
||||||
d->eventNotes.clear();
|
d->eventNotes.clear();
|
||||||
// This call emits changed(). Don't emit it again here.
|
d->detailsRewriter->clearRequests();
|
||||||
QmlProfilerBaseModel::clear();
|
d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1);
|
||||||
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlProfilerDataModel::isEmpty() const
|
bool QmlProfilerDataModel::isEmpty() const
|
||||||
@@ -223,7 +251,7 @@ void QmlProfilerDataModel::complete()
|
|||||||
|
|
||||||
// Allow changed() event only after documents have been reloaded to avoid
|
// Allow changed() event only after documents have been reloaded to avoid
|
||||||
// unnecessary updates of child models.
|
// unnecessary updates of child models.
|
||||||
QmlProfilerBaseModel::complete();
|
d->detailsRewriter->reloadDocuments();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerDataModel::addQmlEvent(QmlDebug::Message message, QmlDebug::RangeType rangeType,
|
void QmlProfilerDataModel::addQmlEvent(QmlDebug::Message message, QmlDebug::RangeType rangeType,
|
||||||
@@ -280,4 +308,12 @@ void QmlProfilerDataModel::detailsChanged(int requestId, const QString &newStrin
|
|||||||
event->data = newString;
|
event->data = newString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProfilerDataModel::detailsDone()
|
||||||
|
{
|
||||||
|
Q_D(QmlProfilerDataModel);
|
||||||
|
emit changed();
|
||||||
|
d->modelManager->modelProxyCountUpdated(d->modelId, isEmpty() ? 0 : 1, 1);
|
||||||
|
d->modelManager->complete();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,12 +31,14 @@
|
|||||||
#ifndef QMLPROFILERDATAMODEL_H
|
#ifndef QMLPROFILERDATAMODEL_H
|
||||||
#define QMLPROFILERDATAMODEL_H
|
#define QMLPROFILERDATAMODEL_H
|
||||||
|
|
||||||
|
#include "qmlprofilermodelmanager.h"
|
||||||
|
|
||||||
#include <qmldebug/qmlprofilereventtypes.h>
|
#include <qmldebug/qmlprofilereventtypes.h>
|
||||||
#include "qmlprofilerbasemodel.h"
|
#include <utils/fileinprojectfinder.h>
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
|
|
||||||
class QMLPROFILER_EXPORT QmlProfilerDataModel : public QmlProfilerBaseModel
|
class QMLPROFILER_EXPORT QmlProfilerDataModel : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -67,7 +69,11 @@ public:
|
|||||||
QString text;
|
QString text;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit QmlProfilerDataModel(Utils::FileInProjectFinder *fileFinder, QmlProfilerModelManager *parent = 0);
|
static QString formatTime(qint64 timestamp);
|
||||||
|
|
||||||
|
explicit QmlProfilerDataModel(Utils::FileInProjectFinder *fileFinder,
|
||||||
|
QmlProfilerModelManager *parent);
|
||||||
|
~QmlProfilerDataModel();
|
||||||
|
|
||||||
const QVector<QmlEventData> &getEvents() const;
|
const QVector<QmlEventData> &getEvents() const;
|
||||||
const QVector<QmlEventTypeData> &getEventTypes() const;
|
const QVector<QmlEventTypeData> &getEventTypes() const;
|
||||||
@@ -77,20 +83,25 @@ public:
|
|||||||
void setNoteData(const QVector<QmlEventNoteData> ¬es);
|
void setNoteData(const QVector<QmlEventNoteData> ¬es);
|
||||||
|
|
||||||
int count() const;
|
int count() const;
|
||||||
virtual void clear();
|
void clear();
|
||||||
virtual bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
virtual void complete();
|
void complete();
|
||||||
void addQmlEvent(QmlDebug::Message message, QmlDebug::RangeType rangeType, int bindingType,
|
void addQmlEvent(QmlDebug::Message message, QmlDebug::RangeType rangeType, int bindingType,
|
||||||
qint64 startTime, qint64 duration, const QString &data,
|
qint64 startTime, qint64 duration, const QString &data,
|
||||||
const QmlDebug::QmlEventLocation &location, qint64 ndata1, qint64 ndata2,
|
const QmlDebug::QmlEventLocation &location, qint64 ndata1, qint64 ndata2,
|
||||||
qint64 ndata3, qint64 ndata4, qint64 ndata5);
|
qint64 ndata3, qint64 ndata4, qint64 ndata5);
|
||||||
qint64 lastTimeMark() const;
|
qint64 lastTimeMark() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void changed();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void detailsChanged(int requestId, const QString &newString);
|
void detailsChanged(int requestId, const QString &newString);
|
||||||
|
void detailsDone();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class QmlProfilerDataModelPrivate;
|
class QmlProfilerDataModelPrivate;
|
||||||
|
QmlProfilerDataModelPrivate *d_ptr;
|
||||||
Q_DECLARE_PRIVATE(QmlProfilerDataModel)
|
Q_DECLARE_PRIVATE(QmlProfilerDataModel)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -653,7 +653,7 @@ void QmlProfilerEventsMainView::parseModelProxy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d->m_fieldShown[TotalTime]) {
|
if (d->m_fieldShown[TotalTime]) {
|
||||||
newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(stats.duration));
|
newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(stats.duration));
|
||||||
newRow.last()->setData(QVariant(stats.duration));
|
newRow.last()->setData(QVariant(stats.duration));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,22 +663,22 @@ void QmlProfilerEventsMainView::parseModelProxy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d->m_fieldShown[TimePerCall]) {
|
if (d->m_fieldShown[TimePerCall]) {
|
||||||
newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(stats.timePerCall));
|
newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(stats.timePerCall));
|
||||||
newRow.last()->setData(QVariant(stats.timePerCall));
|
newRow.last()->setData(QVariant(stats.timePerCall));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->m_fieldShown[MedianTime]) {
|
if (d->m_fieldShown[MedianTime]) {
|
||||||
newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(stats.medianTime));
|
newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(stats.medianTime));
|
||||||
newRow.last()->setData(QVariant(stats.medianTime));
|
newRow.last()->setData(QVariant(stats.medianTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->m_fieldShown[MaxTime]) {
|
if (d->m_fieldShown[MaxTime]) {
|
||||||
newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(stats.maxTime));
|
newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(stats.maxTime));
|
||||||
newRow.last()->setData(QVariant(stats.maxTime));
|
newRow.last()->setData(QVariant(stats.maxTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->m_fieldShown[MinTime]) {
|
if (d->m_fieldShown[MinTime]) {
|
||||||
newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(stats.minTime));
|
newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(stats.minTime));
|
||||||
newRow.last()->setData(QVariant(stats.minTime));
|
newRow.last()->setData(QVariant(stats.minTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -938,7 +938,7 @@ void QmlProfilerEventRelativesView::rebuildTree(
|
|||||||
newRow << new EventsViewItem(type.displayName.isEmpty() ? tr("<bytecode>") :
|
newRow << new EventsViewItem(type.displayName.isEmpty() ? tr("<bytecode>") :
|
||||||
type.displayName);
|
type.displayName);
|
||||||
newRow << new EventsViewItem(QmlProfilerEventsMainView::nameForType(type.rangeType));
|
newRow << new EventsViewItem(QmlProfilerEventsMainView::nameForType(type.rangeType));
|
||||||
newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(event.duration));
|
newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(event.duration));
|
||||||
newRow << new EventsViewItem(QString::number(event.calls));
|
newRow << new EventsViewItem(QString::number(event.calls));
|
||||||
newRow << new EventsViewItem(type.data.isEmpty() ? tr("Source code not available") :
|
newRow << new EventsViewItem(type.data.isEmpty() ? tr("Source code not available") :
|
||||||
type.data);
|
type.data);
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ QVariantMap QmlProfilerRangeModel::details(int index) const
|
|||||||
|
|
||||||
result.insert(QStringLiteral("displayName"),
|
result.insert(QStringLiteral("displayName"),
|
||||||
tr(QmlProfilerModelManager::featureName(mainFeature())));
|
tr(QmlProfilerModelManager::featureName(mainFeature())));
|
||||||
result.insert(tr("Duration"), QmlProfilerBaseModel::formatTime(duration(index)));
|
result.insert(tr("Duration"), QmlProfilerDataModel::formatTime(duration(index)));
|
||||||
|
|
||||||
result.insert(tr("Details"), types[id].data);
|
result.insert(tr("Details"), types[id].data);
|
||||||
result.insert(tr("Location"), types[id].displayName);
|
result.insert(tr("Location"), types[id].displayName);
|
||||||
|
|||||||
Reference in New Issue
Block a user