diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-09-08 18:33:02 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@digia.com> | 2014-09-15 12:29:13 +0300 |
commit | 4f0e7208933d502804d070bceec19f6396d931bb (patch) | |
tree | e2acf20762d25946dc4cf8115804b905cba65302 | |
parent | 2360ecb657e4563179ed898e4201a3fd426a200f (diff) | |
download | qt-creator-4f0e7208933d502804d070bceec19f6396d931bb.tar.gz |
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>
10 files changed, 126 insertions, 5 deletions
diff --git a/plugins/qmlprofilerextension/inputeventsmodel.cpp b/plugins/qmlprofilerextension/inputeventsmodel.cpp new file mode 100644 index 0000000000..31ad5585c9 --- /dev/null +++ b/plugins/qmlprofilerextension/inputeventsmodel.cpp @@ -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; +} + +} +} diff --git a/plugins/qmlprofilerextension/inputeventsmodel.h b/plugins/qmlprofilerextension/inputeventsmodel.h new file mode 100644 index 0000000000..2cd77ada63 --- /dev/null +++ b/plugins/qmlprofilerextension/inputeventsmodel.h @@ -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 diff --git a/plugins/qmlprofilerextension/memoryusagemodel.cpp b/plugins/qmlprofilerextension/memoryusagemodel.cpp index 4f51c3b073..332ad80645 100644 --- a/plugins/qmlprofilerextension/memoryusagemodel.cpp +++ b/plugins/qmlprofilerextension/memoryusagemodel.cpp @@ -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; diff --git a/plugins/qmlprofilerextension/memoryusagemodel.h b/plugins/qmlprofilerextension/memoryusagemodel.h index 6118634615..03eec96f05 100644 --- a/plugins/qmlprofilerextension/memoryusagemodel.h +++ b/plugins/qmlprofilerextension/memoryusagemodel.h @@ -49,6 +49,7 @@ public: }; MemoryUsageModel(QObject *parent = 0); + quint64 features() const; int rowCount() const; int rowMaxValue(int rowNumber) const; diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.cpp b/plugins/qmlprofilerextension/pixmapcachemodel.cpp index 5be3b6cc27..fff5cab4e0 100644 --- a/plugins/qmlprofilerextension/pixmapcachemodel.cpp +++ b/plugins/qmlprofilerextension/pixmapcachemodel.cpp @@ -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); diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.h b/plugins/qmlprofilerextension/pixmapcachemodel.h index 666dd4f2f6..e37997a03c 100644 --- a/plugins/qmlprofilerextension/pixmapcachemodel.h +++ b/plugins/qmlprofilerextension/pixmapcachemodel.h @@ -54,6 +54,7 @@ public: }; PixmapCacheModel(QObject *parent = 0); + quint64 features() const; int rowCount() const; int rowMaxValue(int rowNumber) const; diff --git a/plugins/qmlprofilerextension/qmlprofilerextension.pro b/plugins/qmlprofilerextension/qmlprofilerextension.pro index b0e4e2ad0b..22ef6d6912 100644 --- a/plugins/qmlprofilerextension/qmlprofilerextension.pro +++ b/plugins/qmlprofilerextension/qmlprofilerextension.pro @@ -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 diff --git a/plugins/qmlprofilerextension/qmlprofilerextensionplugin.cpp b/plugins/qmlprofilerextension/qmlprofilerextensionplugin.cpp index 05b877cf58..5bd03c34f0 100644 --- a/plugins/qmlprofilerextension/qmlprofilerextensionplugin.cpp +++ b/plugins/qmlprofilerextension/qmlprofilerextensionplugin.cpp @@ -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"; } diff --git a/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp b/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp index 41565a725d..565116d410 100644 --- a/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp +++ b/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp @@ -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); diff --git a/plugins/qmlprofilerextension/scenegraphtimelinemodel.h b/plugins/qmlprofilerextension/scenegraphtimelinemodel.h index 71ef32d20a..0bf3aecd98 100644 --- a/plugins/qmlprofilerextension/scenegraphtimelinemodel.h +++ b/plugins/qmlprofilerextension/scenegraphtimelinemodel.h @@ -42,6 +42,7 @@ public: }; SceneGraphTimelineModel(QObject *parent = 0); + quint64 features() const; int rowCount() const; |