forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -105,8 +105,7 @@ private:
|
||||
bool checkForUnsavedNotes();
|
||||
void restoreFeatureVisibility();
|
||||
void setButtonsEnabled(bool enable);
|
||||
void createTextMarks();
|
||||
void clearTextMarks();
|
||||
void createInitialTextMarks();
|
||||
|
||||
void initialize();
|
||||
void finalize();
|
||||
|
Reference in New Issue
Block a user