diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-05-29 18:04:07 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-05-30 07:49:38 +0000 |
commit | 5e66f834e3a0ded8f6124f7b04aedbaf846cabd6 (patch) | |
tree | 5062e78ba5f41828c0858bb4ff097053648bf181 | |
parent | fe09fc239c7a12b5bb7f929ec6ed24b6aab89669 (diff) | |
download | qt-creator-5e66f834e3a0ded8f6124f7b04aedbaf846cabd6.tar.gz |
QmlProfiler: Keep text marks when replaying events
The text marks are conceptually part of the type storage, not the event
storage. We need to hide them on initialize and show them again on
finalize, though, so that they get updated.
Task-number: QTCREATORBUG-20506
Change-Id: I5fe50110b99ea81b9a7585758a30fcad98bfcaa3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp | 13 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilermodelmanager.h | 2 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertextmark.cpp | 12 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertextmark.h | 3 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertool.cpp | 10 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertool.h | 3 |
6 files changed, 33 insertions, 10 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index 824ac1540c..3940710e5a 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -202,12 +202,24 @@ void QmlProfilerModelManager::replayQmlEvents(QmlEventLoader loader, } } +void QmlProfilerModelManager::initialize() +{ + d->textMarkModel->hideTextMarks(); + TimelineTraceManager::initialize(); +} + void QmlProfilerModelManager::clearEventStorage() { TimelineTraceManager::clearEventStorage(); emit traceChanged(); } +void QmlProfilerModelManager::clearTypeStorage() +{ + d->textMarkModel->clear(); + TimelineTraceManager::clearTypeStorage(); +} + static QString getDisplayName(const QmlEventType &event) { if (event.location().filename().isEmpty()) { @@ -261,6 +273,7 @@ void QmlProfilerModelManager::finalize() // which happens on stateChanged(Done). TimelineTraceManager::finalize(); + d->textMarkModel->showTextMarks(); emit traceChanged(); } diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h index 42a135916d..6d73a08d51 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.h +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.h @@ -66,6 +66,7 @@ public: void replayQmlEvents(QmlEventLoader loader, Initializer initializer, Finalizer finalizer, ErrorHandler errorHandler, QFutureInterface<void> &future) const; + void initialize() override; void finalize() override; void populateFileFinder(const ProjectExplorer::Target *target = nullptr); @@ -92,6 +93,7 @@ private: void restrictByFilter(QmlEventFilter filter); void clearEventStorage() final; + void clearTypeStorage() final; Timeline::TimelineTraceFile *createTraceFile() override; void replayEvents(TraceEventLoader loader, Initializer initializer, Finalizer finalizer, diff --git a/src/plugins/qmlprofiler/qmlprofilertextmark.cpp b/src/plugins/qmlprofiler/qmlprofilertextmark.cpp index 2112bd172a..2117373450 100644 --- a/src/plugins/qmlprofiler/qmlprofilertextmark.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertextmark.cpp @@ -119,6 +119,18 @@ void QmlProfilerTextMarkModel::createMarks(QmlProfilerViewManager *viewManager, } } +void QmlProfilerTextMarkModel::showTextMarks() +{ + for (QmlProfilerTextMark *mark : qAsConst(m_marks)) + mark->setVisible(true); +} + +void QmlProfilerTextMarkModel::hideTextMarks() +{ + for (QmlProfilerTextMark *mark : qAsConst(m_marks)) + mark->setVisible(false); +} + bool QmlProfilerTextMark::addToolTipContent(QLayout *target) const { QGridLayout *layout = new QGridLayout; diff --git a/src/plugins/qmlprofiler/qmlprofilertextmark.h b/src/plugins/qmlprofiler/qmlprofilertextmark.h index 09beb9bf88..8ed4576ea1 100644 --- a/src/plugins/qmlprofiler/qmlprofilertextmark.h +++ b/src/plugins/qmlprofiler/qmlprofilertextmark.h @@ -59,6 +59,9 @@ public: void addTextMarkId(int typeId, const QmlEventLocation &location); void createMarks(QmlProfilerViewManager *viewManager, const QString &fileName); + void showTextMarks(); + void hideTextMarks(); + private: struct TextMarkId { int typeId; diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index b00379d24d..af0ae935a8 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -471,18 +471,13 @@ void QmlProfilerTool::setButtonsEnabled(bool enable) d->m_recordFeaturesMenu->setEnabled(enable); } -void QmlProfilerTool::createTextMarks() +void QmlProfilerTool::createInitialTextMarks() { QmlProfilerTextMarkModel *model = d->m_profilerModelManager->textMarkModel(); foreach (IDocument *document, DocumentModel::openedDocuments()) model->createMarks(d->m_viewContainer, document->filePath().toString()); } -void QmlProfilerTool::clearTextMarks() -{ - d->m_profilerModelManager->textMarkModel()->clear(); -} - bool QmlProfilerTool::prepareTool() { if (d->m_profilerState->clientRecording()) { @@ -757,14 +752,13 @@ void QmlProfilerTool::initialize() void QmlProfilerTool::finalize() { updateTimeDisplay(); - createTextMarks(); + createInitialTextMarks(); setButtonsEnabled(true); d->m_recordButton->setEnabled(true); } void QmlProfilerTool::clear() { - clearTextMarks(); clearDisplay(); setButtonsEnabled(true); d->m_recordButton->setEnabled(true); diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h index 4e6984f65e..c96a40587f 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.h +++ b/src/plugins/qmlprofiler/qmlprofilertool.h @@ -105,8 +105,7 @@ private: bool checkForUnsavedNotes(); void restoreFeatureVisibility(); void setButtonsEnabled(bool enable); - void createTextMarks(); - void clearTextMarks(); + void createInitialTextMarks(); void initialize(); void finalize(); |