forked from qt-creator/qt-creator
QmlProfiler: Use current restriction range when saving notes
We don't want to clear notes outside the current restriction as those are still valid and need to be available for later reloading. Change-Id: If3e75ff2b2ab9a93578c5ca63f1b4a2f539dc802 Task-number: QTCREATORBUG-16542 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -314,7 +314,7 @@ void QmlProfilerModelManager::save(const QString &filename)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->notesModel->saveData();
|
d->notesModel->saveData(d->traceTime->startTime(), d->traceTime->endTime());
|
||||||
|
|
||||||
QmlProfilerFileWriter *writer = new QmlProfilerFileWriter(this);
|
QmlProfilerFileWriter *writer = new QmlProfilerFileWriter(this);
|
||||||
writer->setTraceTime(traceTime()->startTime(), traceTime()->endTime(),
|
writer->setTraceTime(traceTime()->startTime(), traceTime()->endTime(),
|
||||||
@@ -442,7 +442,7 @@ void QmlProfilerModelManager::clear()
|
|||||||
|
|
||||||
void QmlProfilerModelManager::restrictToRange(qint64 startTime, qint64 endTime)
|
void QmlProfilerModelManager::restrictToRange(qint64 startTime, qint64 endTime)
|
||||||
{
|
{
|
||||||
d->notesModel->saveData();
|
d->notesModel->saveData(d->traceTime->startTime(), d->traceTime->endTime());
|
||||||
setState(ClearingData);
|
setState(ClearingData);
|
||||||
setVisibleFeatures(0);
|
setVisibleFeatures(0);
|
||||||
|
|
||||||
|
@@ -26,6 +26,8 @@
|
|||||||
#include "qmlprofilernotesmodel.h"
|
#include "qmlprofilernotesmodel.h"
|
||||||
#include "qmlprofilerdatamodel.h"
|
#include "qmlprofilerdatamodel.h"
|
||||||
|
|
||||||
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
|
|
||||||
QmlProfilerNotesModel::QmlProfilerNotesModel(QObject *parent) : TimelineNotesModel(parent)
|
QmlProfilerNotesModel::QmlProfilerNotesModel(QObject *parent) : TimelineNotesModel(parent)
|
||||||
@@ -74,9 +76,13 @@ void QmlProfilerNotesModel::loadData()
|
|||||||
emit changed(-1, -1, -1);
|
emit changed(-1, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerNotesModel::saveData()
|
void QmlProfilerNotesModel::saveData(qint64 startTime, qint64 endTime)
|
||||||
{
|
{
|
||||||
m_notes.clear();
|
// Keep notes that are outside the given range, overwrite the ones inside the range.
|
||||||
|
m_notes = Utils::filtered(m_notes, [startTime, endTime](const QmlNote ¬e) {
|
||||||
|
return note.startTime() > endTime || note.startTime() + note.duration() < startTime;
|
||||||
|
});
|
||||||
|
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (int i = 0; i < count(); ++i) {
|
||||||
const Timeline::TimelineModel *model = timelineModelByModelId(timelineModel(i));
|
const Timeline::TimelineModel *model = timelineModelByModelId(timelineModel(i));
|
||||||
if (!model)
|
if (!model)
|
||||||
|
@@ -38,7 +38,7 @@ public:
|
|||||||
QmlProfilerNotesModel(QObject *parent);
|
QmlProfilerNotesModel(QObject *parent);
|
||||||
|
|
||||||
void loadData();
|
void loadData();
|
||||||
void saveData();
|
void saveData(qint64 startTime, qint64 endTime);
|
||||||
|
|
||||||
const QVector<QmlNote> ¬es() const;
|
const QVector<QmlNote> ¬es() const;
|
||||||
void setNotes(const QVector<QmlNote> ¬es);
|
void setNotes(const QVector<QmlNote> ¬es);
|
||||||
|
Reference in New Issue
Block a user