diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-03-27 17:39:17 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-04-17 12:15:38 +0000 |
commit | 507c2d6b5b36fae467f7a1d71ac80c9086a5f55b (patch) | |
tree | 5dddd8f2f9070440a1793c6c4ac5a9ff3a182a4e /src/plugins/qmlprofiler/qmleventtype.cpp | |
parent | 5c8c208f265c2294883917595226393bd57b7ec4 (diff) |
Move parts of QmlEvent and QmlEventType to timeline
Timeline will become a generic trace handling library. It needs some
abstract concept of events and event types.
Move operator== and operator!= for QmlEvent into the test as we don't
use them anywhere else.
Move the operators for QmlEventType to QmlProfilerTraceClient. We want
to get rid of the hash there as soon as we can assume that no
application we want to profile doesn't support server type IDs.
Change-Id: Icde4e3e7634e387171dc1d8bef7bbe8e71684a1a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/qmleventtype.cpp')
-rw-r--r-- | src/plugins/qmlprofiler/qmleventtype.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/plugins/qmlprofiler/qmleventtype.cpp b/src/plugins/qmlprofiler/qmleventtype.cpp index 0649379f857..c8cb6d2ae77 100644 --- a/src/plugins/qmlprofiler/qmleventtype.cpp +++ b/src/plugins/qmlprofiler/qmleventtype.cpp @@ -32,8 +32,10 @@ QDataStream &operator>>(QDataStream &stream, QmlEventType &type) { quint8 message; quint8 rangeType; - stream >> type.m_displayName >> type.m_data >> type.m_location >> message >> rangeType + QString displayName; + stream >> displayName >> type.m_data >> type.m_location >> message >> rangeType >> type.m_detailType; + type.setDisplayName(displayName); type.m_message = static_cast<Message>(message); type.m_rangeType = static_cast<RangeType>(rangeType); return stream; @@ -41,16 +43,16 @@ QDataStream &operator>>(QDataStream &stream, QmlEventType &type) QDataStream &operator<<(QDataStream &stream, const QmlEventType &type) { - return stream << type.m_displayName << type.m_data << type.m_location + return stream << type.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 +static ProfileFeature qmlFeatureFromType(Message message, RangeType rangeType, int detailType) { - switch (m_message) { + switch (message) { case Event: { - switch (m_detailType) { + switch (detailType) { case Mouse: case Key: return ProfileInputEvents; @@ -69,9 +71,18 @@ ProfileFeature QmlEventType::feature() const case DebugMessage: return ProfileDebugMessages; default: - return featureFromRangeType(m_rangeType); + return featureFromRangeType(rangeType); } } +QmlEventType::QmlEventType(Message message, RangeType rangeType, int detailType, + const QmlEventLocation &location, const QString &data, + const QString displayName) : + TraceEventType(qmlFeatureFromType(message, rangeType, detailType)), + m_data(data), m_location(location), m_message(message), + m_rangeType(rangeType), m_detailType(detailType) +{ + setDisplayName(displayName); +} } // namespace QmlProfiler |