diff --git a/src/plugins/qmlprofiler/qmlnote.cpp b/src/plugins/qmlprofiler/qmlnote.cpp index ad21cf3f566..d798fe48ff8 100644 --- a/src/plugins/qmlprofiler/qmlnote.cpp +++ b/src/plugins/qmlprofiler/qmlnote.cpp @@ -30,12 +30,12 @@ namespace QmlProfiler { QDataStream &operator>>(QDataStream &stream, QmlNote ¬e) { - return stream >> note.typeIndex >> note.startTime >> note.duration >> note.text; + return stream >> note.m_typeIndex >> note.m_startTime >> note.m_duration >> note.m_text; } QDataStream &operator<<(QDataStream &stream, const QmlNote ¬e) { - return stream << note.typeIndex << note.startTime << note.duration << note.text; + return stream << note.m_typeIndex << note.m_startTime << note.m_duration << note.m_text; } } // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/qmlnote.h b/src/plugins/qmlprofiler/qmlnote.h index 85ea3da1ac2..e2d007d20ff 100644 --- a/src/plugins/qmlprofiler/qmlnote.h +++ b/src/plugins/qmlprofiler/qmlnote.h @@ -29,16 +29,29 @@ namespace QmlProfiler { -struct QmlNote { +class QmlNote { + +public: QmlNote(int typeIndex = -1, qint64 startTime = -1, qint64 duration = -1, const QString &text = QString()) : - typeIndex(typeIndex), startTime(startTime), duration(duration), text(text) + m_typeIndex(typeIndex), m_startTime(startTime), m_duration(duration), m_text(text) {} - int typeIndex; - qint64 startTime; - qint64 duration; - QString text; + int typeIndex() const { return m_typeIndex; } + qint64 startTime() const { return m_startTime; } + qint64 duration() const { return m_duration; } + QString text() const { return m_text; } + + void setText(const QString &text) { m_text = text; } + +private: + friend QDataStream &operator>>(QDataStream &stream, QmlNote ¬e); + friend QDataStream &operator<<(QDataStream &stream, const QmlNote ¬e); + + int m_typeIndex; + qint64 m_startTime; + qint64 m_duration; + QString m_text; }; QDataStream &operator>>(QDataStream &stream, QmlNote ¬e); diff --git a/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp b/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp index b26caeb1b5e..e67f6bd3724 100644 --- a/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilernotesmodel.cpp @@ -67,7 +67,7 @@ void QmlProfilerNotesModel::loadData() TimelineNotesModel::clear(); for (int i = 0; i != m_notes.size(); ++i) { const QmlNote ¬e = m_notes[i]; - addQmlNote(note.typeIndex, note.startTime, note.duration, note.text); + addQmlNote(note.typeIndex(), note.startTime(), note.duration(), note.text()); } resetModified(); blockSignals(false); diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp index ede4af154f1..534c74c04bb 100644 --- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp @@ -525,14 +525,14 @@ void QmlProfilerFileReader::loadNotes(QXmlStreamReader &stream) if (elementName == _("note")) { updateProgress(stream.device()); QXmlStreamAttributes attrs = stream.attributes(); - currentNote.startTime = attrs.value(_("startTime")).toLongLong(); - currentNote.duration = attrs.value(_("duration")).toLongLong(); - currentNote.typeIndex = attrs.value(_("eventIndex")).toInt(); + currentNote = QmlNote(attrs.value(_("eventIndex")).toInt(), + attrs.value(_("startTime")).toLongLong(), + attrs.value(_("duration")).toLongLong()); } break; } case QXmlStreamReader::Characters: { - currentNote.text = stream.text().toString(); + currentNote.setText(stream.text().toString()); break; } case QXmlStreamReader::EndElement: { @@ -747,10 +747,10 @@ void QmlProfilerFileWriter::saveQtd(QIODevice *device) const QmlNote ¬e = m_notes[noteIndex]; stream.writeStartElement(_("note")); - stream.writeAttribute(_("startTime"), QString::number(note.startTime)); - stream.writeAttribute(_("duration"), QString::number(note.duration)); - stream.writeAttribute(_("eventIndex"), QString::number(note.typeIndex)); - stream.writeCharacters(note.text); + stream.writeAttribute(_("startTime"), QString::number(note.startTime())); + stream.writeAttribute(_("duration"), QString::number(note.duration())); + stream.writeAttribute(_("eventIndex"), QString::number(note.typeIndex())); + stream.writeCharacters(note.text()); stream.writeEndElement(); // note incrementProgress(); }