aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-05-29 18:04:07 +0200
committerUlf Hermann <ulf.hermann@qt.io>2018-05-30 07:49:38 +0000
commit5e66f834e3a0ded8f6124f7b04aedbaf846cabd6 (patch)
tree5062e78ba5f41828c0858bb4ff097053648bf181 /src/plugins
parentfe09fc239c7a12b5bb7f929ec6ed24b6aab89669 (diff)
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>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp13
-rw-r--r--src/plugins/qmlprofiler/qmlprofilermodelmanager.h2
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertextmark.cpp12
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertextmark.h3
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp10
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.h3
6 files changed, 33 insertions, 10 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp
index 824ac1540cd..3940710e5a8 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 42a135916d7..6d73a08d516 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 2112bd172aa..21173734505 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 09beb9bf88a..8ed4576ea19 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 b00379d24d9..af0ae935a80 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 4e6984f65e7..c96a40587f3 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();