QmlProfiler: Use generic timeline classes where applicable.

Change-Id: I7bab7b20f3467f000a7ba4917919caa8f15ecf22
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2014-12-05 17:33:21 +01:00
parent 13c5cee372
commit dcbd4ac1c6
6 changed files with 62 additions and 53 deletions

View File

@@ -47,9 +47,9 @@ void QmlProfilerNotesModel::setModelManager(QmlProfilerModelManager *modelManage
m_modelManager = modelManager;
}
void QmlProfilerNotesModel::addTimelineModel(const QmlProfilerTimelineModel *timelineModel)
void QmlProfilerNotesModel::addTimelineModel(const TimelineModel *timelineModel)
{
connect(timelineModel, &QmlProfilerTimelineModel::destroyed,
connect(timelineModel, &TimelineModel::destroyed,
this, &QmlProfilerNotesModel::removeTimelineModel);
m_timelineModels.insert(timelineModel->modelId(), timelineModel);
}
@@ -111,7 +111,7 @@ int QmlProfilerNotesModel::get(int timelineModel, int timelineIndex) const
int QmlProfilerNotesModel::add(int timelineModel, int timelineIndex, const QString &text)
{
const QmlProfilerTimelineModel *model = m_timelineModels[timelineModel];
const TimelineModel *model = m_timelineModels[timelineModel];
int typeId = model->typeId(timelineIndex);
Note note = { text, timelineModel, timelineIndex };
m_data << note;
@@ -160,10 +160,8 @@ int QmlProfilerNotesModel::add(int typeId, qint64 start, qint64 duration, const
{
int timelineModel = -1;
int timelineIndex = -1;
const QVector<QmlProfilerDataModel::QmlEventTypeData> &types =
m_modelManager->qmlModel()->getEventTypes();
foreach (const QmlProfilerTimelineModel *model, m_timelineModels) {
if (model->accepted(types[typeId])) {
foreach (const TimelineModel *model, m_timelineModels) {
if (model->handlesTypeId(typeId)) {
for (int i = model->firstIndex(start); i <= model->lastIndex(start + duration); ++i) {
if (i < 0)
continue;
@@ -237,7 +235,7 @@ void QmlProfilerNotesModel::saveData()
if (it == m_timelineModels.end())
continue;
const QmlProfilerTimelineModel *model = it.value();
const TimelineModel *model = it.value();
QmlProfilerDataModel::QmlEventNoteData save = {
model->typeId(note.timelineIndex), model->startTime(note.timelineIndex),
model->duration(note.timelineIndex), note.text