forked from qt-creator/qt-creator
Report supported features from timeline models
Also add a stub input events model to represent that feature. Change-Id: Idd05b9452b7c6920779e72966ce62c0a1decaeef Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
47
plugins/qmlprofilerextension/inputeventsmodel.cpp
Normal file
47
plugins/qmlprofilerextension/inputeventsmodel.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc
|
||||
** All rights reserved.
|
||||
** For any questions to Digia, please use contact form at http://qt.digia.com <http://qt.digia.com/>
|
||||
**
|
||||
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on.
|
||||
**
|
||||
** Licensees holding valid Qt Enterprise licenses may use this file in
|
||||
** accordance with the Qt Enterprise License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please use
|
||||
** contact form at http://qt.digia.com <http://qt.digia.com/>
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "inputeventsmodel.h"
|
||||
#include "qmldebug/qmlprofilereventtypes.h"
|
||||
#include "qmlprofiler/qmlprofilermodelmanager.h"
|
||||
#include "qmlprofiler/abstracttimelinemodel_p.h"
|
||||
|
||||
namespace QmlProfilerExtension {
|
||||
namespace Internal {
|
||||
|
||||
using namespace QmlProfiler;
|
||||
|
||||
class InputEventsModel::InputEventsModelPrivate : public AbstractTimelineModelPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(InputEventsModel)
|
||||
};
|
||||
|
||||
InputEventsModel::InputEventsModel(QObject *parent)
|
||||
: AbstractTimelineModel(new InputEventsModelPrivate(),
|
||||
tr(QmlProfilerModelManager::featureName(QmlDebug::ProfileInputEvents)),
|
||||
QmlDebug::Event, QmlDebug::MaximumRangeType, parent)
|
||||
{
|
||||
}
|
||||
|
||||
quint64 InputEventsModel::features() const
|
||||
{
|
||||
return 1 << QmlDebug::ProfileInputEvents;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
48
plugins/qmlprofilerextension/inputeventsmodel.h
Normal file
48
plugins/qmlprofilerextension/inputeventsmodel.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc
|
||||
** All rights reserved.
|
||||
** For any questions to Digia, please use contact form at http://qt.digia.com <http://qt.digia.com/>
|
||||
**
|
||||
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on.
|
||||
**
|
||||
** Licensees holding valid Qt Enterprise licenses may use this file in
|
||||
** accordance with the Qt Enterprise License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please use
|
||||
** contact form at http://qt.digia.com <http://qt.digia.com/>
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef INPUTEVENTSMODEL_H
|
||||
#define INPUTEVENTSMODEL_H
|
||||
|
||||
#include "qmlprofiler/abstracttimelinemodel.h"
|
||||
|
||||
namespace QmlProfilerExtension {
|
||||
namespace Internal {
|
||||
|
||||
class InputEventsModel : public QmlProfiler::AbstractTimelineModel
|
||||
{
|
||||
Q_OBJECT
|
||||
class InputEventsModelPrivate;
|
||||
Q_DECLARE_PRIVATE(InputEventsModel)
|
||||
|
||||
public:
|
||||
InputEventsModel(QObject *parent = 0);
|
||||
quint64 features() const;
|
||||
|
||||
int rowCount() const {return 0;}
|
||||
int eventId(int) const {return -1;}
|
||||
QColor color(int) const {return QColor();}
|
||||
QVariantList labels() const {return QVariantList();}
|
||||
QVariantMap details(int) const {return QVariantMap();}
|
||||
int row(int) const {return -1;}
|
||||
void loadData() {}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
#endif // INPUTEVENTSMODEL_H
|
@@ -40,11 +40,18 @@ private:
|
||||
};
|
||||
|
||||
MemoryUsageModel::MemoryUsageModel(QObject *parent)
|
||||
: AbstractTimelineModel(new MemoryUsageModelPrivate(), QLatin1String("Memory Usage"),
|
||||
: AbstractTimelineModel(new MemoryUsageModelPrivate(),
|
||||
tr(QmlProfilerModelManager::featureName(QmlDebug::ProfileMemory)),
|
||||
QmlDebug::MemoryAllocation, QmlDebug::MaximumRangeType, parent)
|
||||
{
|
||||
}
|
||||
|
||||
quint64 MemoryUsageModel::features() const
|
||||
{
|
||||
// Will listen to all range events, too, to determine context.
|
||||
return (1 << QmlDebug::ProfileMemory) | QmlDebug::Constants::QML_JS_RANGE_FEATURES;
|
||||
}
|
||||
|
||||
int MemoryUsageModel::rowCount() const
|
||||
{
|
||||
return isEmpty() ? 1 : 3;
|
||||
|
@@ -49,6 +49,7 @@ public:
|
||||
};
|
||||
|
||||
MemoryUsageModel(QObject *parent = 0);
|
||||
quint64 features() const;
|
||||
|
||||
int rowCount() const;
|
||||
int rowMaxValue(int rowNumber) const;
|
||||
|
@@ -80,7 +80,8 @@ private:
|
||||
};
|
||||
|
||||
PixmapCacheModel::PixmapCacheModel(QObject *parent)
|
||||
: AbstractTimelineModel(new PixmapCacheModelPrivate(), QLatin1String("Pixmap Cache"),
|
||||
: AbstractTimelineModel(new PixmapCacheModelPrivate(),
|
||||
tr(QmlProfilerModelManager::featureName(QmlDebug::ProfilePixmapCache)),
|
||||
QmlDebug::PixmapCacheEvent, QmlDebug::MaximumRangeType, parent)
|
||||
{
|
||||
Q_D(PixmapCacheModel);
|
||||
@@ -88,6 +89,11 @@ PixmapCacheModel::PixmapCacheModel(QObject *parent)
|
||||
d->maxCacheSize = 1;
|
||||
}
|
||||
|
||||
quint64 PixmapCacheModel::features() const
|
||||
{
|
||||
return 1 << QmlDebug::ProfilePixmapCache;
|
||||
}
|
||||
|
||||
int PixmapCacheModel::rowCount() const
|
||||
{
|
||||
Q_D(const PixmapCacheModel);
|
||||
|
@@ -54,6 +54,7 @@ public:
|
||||
};
|
||||
|
||||
PixmapCacheModel(QObject *parent = 0);
|
||||
quint64 features() const;
|
||||
|
||||
int rowCount() const;
|
||||
int rowMaxValue(int rowNumber) const;
|
||||
|
@@ -12,14 +12,16 @@ DEFINES += QMLPROFILEREXTENSION_LIBRARY
|
||||
SOURCES += qmlprofilerextensionplugin.cpp \
|
||||
scenegraphtimelinemodel.cpp \
|
||||
pixmapcachemodel.cpp \
|
||||
memoryusagemodel.cpp
|
||||
memoryusagemodel.cpp \
|
||||
inputeventsmodel.cpp
|
||||
|
||||
HEADERS += qmlprofilerextensionplugin.h \
|
||||
qmlprofilerextension_global.h \
|
||||
qmlprofilerextensionconstants.h \
|
||||
scenegraphtimelinemodel.h \
|
||||
pixmapcachemodel.h \
|
||||
memoryusagemodel.h
|
||||
memoryusagemodel.h \
|
||||
inputeventsmodel.h
|
||||
|
||||
OTHER_FILES += \
|
||||
QmlProfilerExtension.json
|
||||
|
@@ -41,6 +41,7 @@
|
||||
#include "scenegraphtimelinemodel.h"
|
||||
#include "pixmapcachemodel.h"
|
||||
#include "memoryusagemodel.h"
|
||||
#include "inputeventsmodel.h"
|
||||
|
||||
using namespace QmlProfilerExtension::Internal;
|
||||
|
||||
@@ -74,6 +75,7 @@ bool QmlProfilerExtensionPlugin::initialize(const QStringList &arguments, QStrin
|
||||
addAutoReleasedObject(new PixmapCacheModel);
|
||||
addAutoReleasedObject(new SceneGraphTimelineModel);
|
||||
addAutoReleasedObject(new MemoryUsageModel);
|
||||
addAutoReleasedObject(new InputEventsModel);
|
||||
} else {
|
||||
qWarning() << "Invalid license, disabling QML Profiler Enterprise features";
|
||||
}
|
||||
|
@@ -116,11 +116,17 @@ SceneGraphTimelineModel::SceneGraphTimelineModelPrivate::SceneGraphTimelineModel
|
||||
}
|
||||
|
||||
SceneGraphTimelineModel::SceneGraphTimelineModel(QObject *parent)
|
||||
: AbstractTimelineModel(new SceneGraphTimelineModelPrivate, tr("Scene Graph"),
|
||||
: AbstractTimelineModel(new SceneGraphTimelineModelPrivate,
|
||||
tr(QmlProfilerModelManager::featureName(QmlDebug::ProfileSceneGraph)),
|
||||
QmlDebug::SceneGraphFrame, QmlDebug::MaximumRangeType, parent)
|
||||
{
|
||||
}
|
||||
|
||||
quint64 SceneGraphTimelineModel::features() const
|
||||
{
|
||||
return 1 << QmlDebug::ProfileSceneGraph;
|
||||
}
|
||||
|
||||
int SceneGraphTimelineModel::rowCount() const
|
||||
{
|
||||
Q_D(const SceneGraphTimelineModel);
|
||||
|
@@ -42,6 +42,7 @@ public:
|
||||
};
|
||||
|
||||
SceneGraphTimelineModel(QObject *parent = 0);
|
||||
quint64 features() const;
|
||||
|
||||
int rowCount() const;
|
||||
|
||||
|
Reference in New Issue
Block a user