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()
|
void QmlProfilerModelManager::clearEventStorage()
|
||||||
{
|
{
|
||||||
TimelineTraceManager::clearEventStorage();
|
TimelineTraceManager::clearEventStorage();
|
||||||
emit traceChanged();
|
emit traceChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProfilerModelManager::clearTypeStorage()
|
||||||
|
{
|
||||||
|
d->textMarkModel->clear();
|
||||||
|
TimelineTraceManager::clearTypeStorage();
|
||||||
|
}
|
||||||
|
|
||||||
static QString getDisplayName(const QmlEventType &event)
|
static QString getDisplayName(const QmlEventType &event)
|
||||||
{
|
{
|
||||||
if (event.location().filename().isEmpty()) {
|
if (event.location().filename().isEmpty()) {
|
||||||
@@ -261,6 +273,7 @@ void QmlProfilerModelManager::finalize()
|
|||||||
// which happens on stateChanged(Done).
|
// which happens on stateChanged(Done).
|
||||||
|
|
||||||
TimelineTraceManager::finalize();
|
TimelineTraceManager::finalize();
|
||||||
|
d->textMarkModel->showTextMarks();
|
||||||
emit traceChanged();
|
emit traceChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,6 +66,7 @@ public:
|
|||||||
void replayQmlEvents(QmlEventLoader loader, Initializer initializer, Finalizer finalizer,
|
void replayQmlEvents(QmlEventLoader loader, Initializer initializer, Finalizer finalizer,
|
||||||
ErrorHandler errorHandler, QFutureInterface<void> &future) const;
|
ErrorHandler errorHandler, QFutureInterface<void> &future) const;
|
||||||
|
|
||||||
|
void initialize() override;
|
||||||
void finalize() override;
|
void finalize() override;
|
||||||
|
|
||||||
void populateFileFinder(const ProjectExplorer::Target *target = nullptr);
|
void populateFileFinder(const ProjectExplorer::Target *target = nullptr);
|
||||||
@@ -92,6 +93,7 @@ private:
|
|||||||
void restrictByFilter(QmlEventFilter filter);
|
void restrictByFilter(QmlEventFilter filter);
|
||||||
|
|
||||||
void clearEventStorage() final;
|
void clearEventStorage() final;
|
||||||
|
void clearTypeStorage() final;
|
||||||
|
|
||||||
Timeline::TimelineTraceFile *createTraceFile() override;
|
Timeline::TimelineTraceFile *createTraceFile() override;
|
||||||
void replayEvents(TraceEventLoader loader, Initializer initializer, Finalizer finalizer,
|
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
|
bool QmlProfilerTextMark::addToolTipContent(QLayout *target) const
|
||||||
{
|
{
|
||||||
QGridLayout *layout = new QGridLayout;
|
QGridLayout *layout = new QGridLayout;
|
||||||
|
@@ -59,6 +59,9 @@ public:
|
|||||||
void addTextMarkId(int typeId, const QmlEventLocation &location);
|
void addTextMarkId(int typeId, const QmlEventLocation &location);
|
||||||
void createMarks(QmlProfilerViewManager *viewManager, const QString &fileName);
|
void createMarks(QmlProfilerViewManager *viewManager, const QString &fileName);
|
||||||
|
|
||||||
|
void showTextMarks();
|
||||||
|
void hideTextMarks();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct TextMarkId {
|
struct TextMarkId {
|
||||||
int typeId;
|
int typeId;
|
||||||
|
@@ -471,18 +471,13 @@ void QmlProfilerTool::setButtonsEnabled(bool enable)
|
|||||||
d->m_recordFeaturesMenu->setEnabled(enable);
|
d->m_recordFeaturesMenu->setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::createTextMarks()
|
void QmlProfilerTool::createInitialTextMarks()
|
||||||
{
|
{
|
||||||
QmlProfilerTextMarkModel *model = d->m_profilerModelManager->textMarkModel();
|
QmlProfilerTextMarkModel *model = d->m_profilerModelManager->textMarkModel();
|
||||||
foreach (IDocument *document, DocumentModel::openedDocuments())
|
foreach (IDocument *document, DocumentModel::openedDocuments())
|
||||||
model->createMarks(d->m_viewContainer, document->filePath().toString());
|
model->createMarks(d->m_viewContainer, document->filePath().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::clearTextMarks()
|
|
||||||
{
|
|
||||||
d->m_profilerModelManager->textMarkModel()->clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QmlProfilerTool::prepareTool()
|
bool QmlProfilerTool::prepareTool()
|
||||||
{
|
{
|
||||||
if (d->m_profilerState->clientRecording()) {
|
if (d->m_profilerState->clientRecording()) {
|
||||||
@@ -757,14 +752,13 @@ void QmlProfilerTool::initialize()
|
|||||||
void QmlProfilerTool::finalize()
|
void QmlProfilerTool::finalize()
|
||||||
{
|
{
|
||||||
updateTimeDisplay();
|
updateTimeDisplay();
|
||||||
createTextMarks();
|
createInitialTextMarks();
|
||||||
setButtonsEnabled(true);
|
setButtonsEnabled(true);
|
||||||
d->m_recordButton->setEnabled(true);
|
d->m_recordButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::clear()
|
void QmlProfilerTool::clear()
|
||||||
{
|
{
|
||||||
clearTextMarks();
|
|
||||||
clearDisplay();
|
clearDisplay();
|
||||||
setButtonsEnabled(true);
|
setButtonsEnabled(true);
|
||||||
d->m_recordButton->setEnabled(true);
|
d->m_recordButton->setEnabled(true);
|
||||||
|
@@ -105,8 +105,7 @@ private:
|
|||||||
bool checkForUnsavedNotes();
|
bool checkForUnsavedNotes();
|
||||||
void restoreFeatureVisibility();
|
void restoreFeatureVisibility();
|
||||||
void setButtonsEnabled(bool enable);
|
void setButtonsEnabled(bool enable);
|
||||||
void createTextMarks();
|
void createInitialTextMarks();
|
||||||
void clearTextMarks();
|
|
||||||
|
|
||||||
void initialize();
|
void initialize();
|
||||||
void finalize();
|
void finalize();
|
||||||
|
Reference in New Issue
Block a user