aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/qmleventtype.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-06-06 19:51:55 +0200
committerUlf Hermann <ulf.hermann@qt.io>2016-06-10 12:43:05 +0000
commite10bc709bcde23a730ba390ceae33e84cc885266 (patch)
treeca6006c9c1d833d38aa1fab61354527205c82ac8 /src/plugins/qmlprofiler/qmleventtype.cpp
parent5718f12af5ad983924a19a6033026b16df89fd2b (diff)
QmlProfiler: Provide a sane ctor for QmlEventType and use it
... in turn, make its members private, so that we don't accidentally change them. Change-Id: Ibc65b406ee341d33f69647ed1b19e1e34f5cd535 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmlprofiler/qmleventtype.cpp')
-rw-r--r--src/plugins/qmlprofiler/qmleventtype.cpp41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/plugins/qmlprofiler/qmleventtype.cpp b/src/plugins/qmlprofiler/qmleventtype.cpp
index 3d32b1343f1..0649379f857 100644
--- a/src/plugins/qmlprofiler/qmleventtype.cpp
+++ b/src/plugins/qmlprofiler/qmleventtype.cpp
@@ -32,18 +32,45 @@ QDataStream &operator>>(QDataStream &stream, QmlEventType &type)
{
quint8 message;
quint8 rangeType;
- stream >> type.displayName >> type.data >> type.location >> message >> rangeType
- >> type.detailType;
- type.message = static_cast<Message>(message);
- type.rangeType = static_cast<RangeType>(rangeType);
+ stream >> type.m_displayName >> type.m_data >> type.m_location >> message >> rangeType
+ >> type.m_detailType;
+ type.m_message = static_cast<Message>(message);
+ type.m_rangeType = static_cast<RangeType>(rangeType);
return stream;
}
QDataStream &operator<<(QDataStream &stream, const QmlEventType &type)
{
- return stream << type.displayName << type.data << type.location
- << static_cast<quint8>(type.message) << static_cast<quint8>(type.rangeType)
- << type.detailType;
+ return stream << type.m_displayName << type.m_data << type.m_location
+ << static_cast<quint8>(type.m_message) << static_cast<quint8>(type.m_rangeType)
+ << type.m_detailType;
+}
+
+ProfileFeature QmlEventType::feature() const
+{
+ switch (m_message) {
+ case Event: {
+ switch (m_detailType) {
+ case Mouse:
+ case Key:
+ return ProfileInputEvents;
+ case AnimationFrame:
+ return ProfileAnimations;
+ default:
+ return MaximumProfileFeature;
+ }
+ }
+ case PixmapCacheEvent:
+ return ProfilePixmapCache;
+ case SceneGraphFrame:
+ return ProfileSceneGraph;
+ case MemoryAllocation:
+ return ProfileMemory;
+ case DebugMessage:
+ return ProfileDebugMessages;
+ default:
+ return featureFromRangeType(m_rangeType);
+ }
}