forked from qt-creator/qt-creator
QmlProfiler: Remove most of timelinemodelaggregator
Change-Id: If56940133b54905700fd51feac61d097677002c2 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
@@ -49,9 +49,6 @@ public:
|
||||
|
||||
TimelineModelAggregator *q;
|
||||
|
||||
// mapping of modelId assigned by manager to index in our list
|
||||
QList <int> modelManagerIndexMapping;
|
||||
|
||||
QList <QmlProfilerTimelineModel *> modelList;
|
||||
QmlProfilerModelManager *modelManager;
|
||||
};
|
||||
@@ -59,7 +56,7 @@ public:
|
||||
TimelineModelAggregator::TimelineModelAggregator(QObject *parent)
|
||||
: QObject(parent), d(new TimelineModelAggregatorPrivate(this))
|
||||
{
|
||||
connect(this,SIGNAL(modelsChanged(int,int)),this,SIGNAL(heightChanged()));
|
||||
connect(this,SIGNAL(modelsChanged()),this,SIGNAL(heightChanged()));
|
||||
connect(this,SIGNAL(stateChanged()),this,SIGNAL(heightChanged()));
|
||||
}
|
||||
|
||||
@@ -76,7 +73,6 @@ int TimelineModelAggregator::height() const
|
||||
void TimelineModelAggregator::setModelManager(QmlProfilerModelManager *modelManager)
|
||||
{
|
||||
d->modelManager = modelManager;
|
||||
connect(modelManager,SIGNAL(stateChanged()),this,SLOT(dataChanged()));
|
||||
connect(modelManager,SIGNAL(dataAvailable()),this,SIGNAL(dataAvailable()));
|
||||
|
||||
// external models pushed on top
|
||||
@@ -98,16 +94,10 @@ void TimelineModelAggregator::setModelManager(QmlProfilerModelManager *modelMana
|
||||
|
||||
void TimelineModelAggregator::addModel(QmlProfilerTimelineModel *m)
|
||||
{
|
||||
while (d->modelManagerIndexMapping.size() <= m->modelId())
|
||||
d->modelManagerIndexMapping.append(-1);
|
||||
d->modelManagerIndexMapping[m->modelId()] = d->modelList.size();
|
||||
d->modelList << m;
|
||||
connect(m,SIGNAL(expandedChanged()),this,SIGNAL(expandedChanged()));
|
||||
connect(m,SIGNAL(hiddenChanged()),this,SIGNAL(hiddenChanged()));
|
||||
connect(m,SIGNAL(rowHeightChanged()),this,SIGNAL(rowHeightChanged()));
|
||||
connect(m,SIGNAL(heightChanged()),this,SIGNAL(heightChanged()));
|
||||
d->modelManager->notesModel()->addTimelineModel(m);
|
||||
emit modelsChanged(d->modelList.length(), d->modelList.length());
|
||||
emit modelsChanged();
|
||||
}
|
||||
|
||||
const QmlProfilerTimelineModel *TimelineModelAggregator::model(int modelIndex) const
|
||||
@@ -123,29 +113,11 @@ QVariantList TimelineModelAggregator::models() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::modelIndexFromManagerIndex(int modelManagerIndex) const
|
||||
{
|
||||
return d->modelManagerIndexMapping[modelManagerIndex];
|
||||
}
|
||||
|
||||
QmlProfilerNotesModel *TimelineModelAggregator::notes() const
|
||||
{
|
||||
return d->modelManager->notesModel();
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::count(int modelIndex) const
|
||||
{
|
||||
return d->modelList[modelIndex]->count();
|
||||
}
|
||||
|
||||
bool TimelineModelAggregator::isEmpty() const
|
||||
{
|
||||
foreach (const QmlProfilerTimelineModel *modelProxy, d->modelList)
|
||||
if (!modelProxy->isEmpty())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::modelOffset(int modelIndex) const
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -154,218 +126,6 @@ int TimelineModelAggregator::modelOffset(int modelIndex) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::rowHeight(int modelIndex, int row) const
|
||||
{
|
||||
return d->modelList[modelIndex]->rowHeight(row);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::rowOffset(int modelIndex, int row) const
|
||||
{
|
||||
return d->modelList[modelIndex]->rowOffset(row);
|
||||
}
|
||||
|
||||
void TimelineModelAggregator::setRowHeight(int modelIndex, int row, int height)
|
||||
{
|
||||
d->modelList[modelIndex]->setRowHeight(row, height);
|
||||
}
|
||||
|
||||
bool TimelineModelAggregator::expanded(int modelIndex) const
|
||||
{
|
||||
return d->modelList[modelIndex]->expanded();
|
||||
}
|
||||
|
||||
void TimelineModelAggregator::setExpanded(int modelIndex, bool expanded)
|
||||
{
|
||||
d->modelList[modelIndex]->setExpanded(expanded);
|
||||
}
|
||||
|
||||
bool TimelineModelAggregator::hidden(int modelIndex) const
|
||||
{
|
||||
return d->modelList[modelIndex]->hidden();
|
||||
}
|
||||
|
||||
void TimelineModelAggregator::setHidden(int modelIndex, bool hidden)
|
||||
{
|
||||
d->modelList[modelIndex]->setHidden(hidden);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::rowCount(int modelIndex) const
|
||||
{
|
||||
return d->modelList[modelIndex]->rowCount();
|
||||
}
|
||||
|
||||
QString TimelineModelAggregator::displayName(int modelIndex) const
|
||||
{
|
||||
return d->modelList[modelIndex]->displayName();
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::rowMinValue(int modelIndex, int row) const
|
||||
{
|
||||
return d->modelList[modelIndex]->rowMinValue(row);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::rowMaxValue(int modelIndex, int row) const
|
||||
{
|
||||
return d->modelList[modelIndex]->rowMaxValue(row);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::firstIndex(int modelIndex, qint64 startTime) const
|
||||
{
|
||||
return d->modelList[modelIndex]->firstIndex(startTime);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::lastIndex(int modelIndex, qint64 endTime) const
|
||||
{
|
||||
return d->modelList[modelIndex]->lastIndex(endTime);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::row(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->row(index);
|
||||
}
|
||||
|
||||
qint64 TimelineModelAggregator::duration(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->duration(index);
|
||||
}
|
||||
|
||||
qint64 TimelineModelAggregator::startTime(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->startTime(index);
|
||||
}
|
||||
|
||||
qint64 TimelineModelAggregator::endTime(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->endTime(index);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::selectionId(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->selectionId(index);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::typeId(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->typeId(index);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::bindingLoopDest(int modelIndex,int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->bindingLoopDest(index);
|
||||
}
|
||||
|
||||
QColor TimelineModelAggregator::color(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->color(index);
|
||||
}
|
||||
|
||||
float TimelineModelAggregator::relativeHeight(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->relativeHeight(index);
|
||||
}
|
||||
|
||||
QVariantList TimelineModelAggregator::labels(int modelIndex) const
|
||||
{
|
||||
return d->modelList[modelIndex]->labels();
|
||||
}
|
||||
|
||||
QVariantMap TimelineModelAggregator::details(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->details(index);
|
||||
}
|
||||
|
||||
QVariantMap TimelineModelAggregator::location(int modelIndex, int index) const
|
||||
{
|
||||
return d->modelList[modelIndex]->location(index);
|
||||
}
|
||||
|
||||
bool TimelineModelAggregator::handlesTypeId(int modelIndex, int typeIndex) const
|
||||
{
|
||||
return d->modelList[modelIndex]->handlesTypeId(typeIndex);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::selectionIdForLocation(int modelIndex, const QString &filename,
|
||||
int line, int column) const
|
||||
{
|
||||
return d->modelList[modelIndex]->selectionIdForLocation(filename, line, column);
|
||||
}
|
||||
|
||||
void TimelineModelAggregator::swapModels(int modelIndex1, int modelIndex2)
|
||||
{
|
||||
QmlProfilerTimelineModel *&model1 = d->modelList[modelIndex1];
|
||||
QmlProfilerTimelineModel *&model2 = d->modelList[modelIndex2];
|
||||
std::swap(d->modelManagerIndexMapping[model1->modelId()],
|
||||
d->modelManagerIndexMapping[model2->modelId()]);
|
||||
std::swap(model1, model2);
|
||||
emit modelsChanged(modelIndex1, modelIndex2);
|
||||
}
|
||||
|
||||
QString TimelineModelAggregator::noteText(int noteId) const
|
||||
{
|
||||
return d->modelManager->notesModel()->text(noteId);
|
||||
}
|
||||
|
||||
QString TimelineModelAggregator::noteText(int modelIndex, int index) const
|
||||
{
|
||||
int managerId = d->modelList[modelIndex]->modelId();
|
||||
int noteId = d->modelManager->notesModel()->get(managerId, index);
|
||||
return noteId != -1 ? noteText(noteId) : QString();
|
||||
}
|
||||
|
||||
void TimelineModelAggregator::setNoteText(int noteId, const QString &text)
|
||||
{
|
||||
if (text.length() > 0) {
|
||||
notes()->update(noteId, text);
|
||||
} else {
|
||||
notes()->remove(noteId);
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineModelAggregator::setNoteText(int modelIndex, int index, const QString &text)
|
||||
{
|
||||
int managerId = d->modelList[modelIndex]->modelId();
|
||||
QmlProfilerNotesModel *notesModel = notes();
|
||||
int noteId = notesModel->get(managerId, index);
|
||||
if (noteId == -1) {
|
||||
if (text.length() > 0)
|
||||
notesModel->add(managerId, index, text);
|
||||
} else {
|
||||
setNoteText(noteId, text);
|
||||
}
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::noteTimelineModel(int noteIndex) const
|
||||
{
|
||||
return d->modelManagerIndexMapping[notes()->timelineModel(noteIndex)];
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::noteTimelineIndex(int noteIndex) const
|
||||
{
|
||||
return notes()->timelineIndex(noteIndex);
|
||||
}
|
||||
|
||||
QVariantList TimelineModelAggregator::notesByTimelineModel(int modelIndex) const
|
||||
{
|
||||
int managerId = d->modelList[modelIndex]->modelId();
|
||||
return notes()->byTimelineModel(managerId);
|
||||
}
|
||||
|
||||
QVariantList TimelineModelAggregator::notesByTypeId(int typeId) const
|
||||
{
|
||||
return notes()->byTypeId(typeId);
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::noteCount() const
|
||||
{
|
||||
return notes()->count();
|
||||
}
|
||||
|
||||
void TimelineModelAggregator::dataChanged()
|
||||
{
|
||||
// this is a slot connected for every modelproxy
|
||||
// nothing to do here, each model will take care of itself
|
||||
}
|
||||
|
||||
int TimelineModelAggregator::modelCount() const
|
||||
{
|
||||
return d->modelList.count();
|
||||
|
||||
@@ -52,63 +52,12 @@ public:
|
||||
void addModel(QmlProfilerTimelineModel *m);
|
||||
const QmlProfilerTimelineModel *model(int modelIndex) const;
|
||||
QVariantList models() const;
|
||||
int modelIndexFromManagerIndex(int modelManagerIndex) const;
|
||||
|
||||
QmlProfilerNotesModel *notes() const;
|
||||
Q_INVOKABLE int count(int modelIndex) const;
|
||||
void clear();
|
||||
Q_INVOKABLE int modelCount() const;
|
||||
|
||||
Q_INVOKABLE bool isEmpty() const;
|
||||
int modelCount() const;
|
||||
|
||||
Q_INVOKABLE int modelOffset(int modelIndex) const;
|
||||
Q_INVOKABLE int rowHeight(int modelIndex, int row) const;
|
||||
Q_INVOKABLE void setRowHeight(int modelIndex, int row, int height);
|
||||
Q_INVOKABLE int rowOffset(int modelIndex, int row) const;
|
||||
|
||||
Q_INVOKABLE bool expanded(int modelIndex) const;
|
||||
Q_INVOKABLE void setExpanded(int modelIndex, bool expanded);
|
||||
|
||||
Q_INVOKABLE bool hidden(int modelIndex) const;
|
||||
Q_INVOKABLE void setHidden(int modelIndex, bool hidden);
|
||||
|
||||
Q_INVOKABLE int rowCount(int modelIndex) const;
|
||||
Q_INVOKABLE QString displayName(int modelIndex) const;
|
||||
Q_INVOKABLE int rowMinValue(int modelIndex, int row) const;
|
||||
Q_INVOKABLE int rowMaxValue(int modelIndex, int row) const;
|
||||
|
||||
Q_INVOKABLE int firstIndex(int modelIndex, qint64 startTime) const;
|
||||
Q_INVOKABLE int lastIndex(int modelIndex, qint64 endTime) const;
|
||||
|
||||
Q_INVOKABLE int row(int modelIndex, int index) const;
|
||||
Q_INVOKABLE qint64 duration(int modelIndex, int index) const;
|
||||
Q_INVOKABLE qint64 startTime(int modelIndex, int index) const;
|
||||
Q_INVOKABLE qint64 endTime(int modelIndex, int index) const;
|
||||
Q_INVOKABLE int selectionId(int modelIndex, int index) const;
|
||||
Q_INVOKABLE int typeId(int modelIndex, int index) const;
|
||||
Q_INVOKABLE int bindingLoopDest(int modelIndex, int index) const;
|
||||
Q_INVOKABLE QColor color(int modelIndex, int index) const;
|
||||
Q_INVOKABLE float relativeHeight(int modelIndex, int index) const;
|
||||
|
||||
Q_INVOKABLE QVariantList labels(int modelIndex) const;
|
||||
|
||||
Q_INVOKABLE QVariantMap details(int modelIndex, int index) const;
|
||||
Q_INVOKABLE QVariantMap location(int modelIndex, int index) const;
|
||||
|
||||
Q_INVOKABLE bool handlesTypeId(int modelIndex, int typeIndex) const;
|
||||
Q_INVOKABLE int selectionIdForLocation(int modelIndex, const QString &filename, int line,
|
||||
int column) const;
|
||||
|
||||
Q_INVOKABLE void swapModels(int modelIndex1, int modelIndex2);
|
||||
Q_INVOKABLE QString noteText(int noteId) const;
|
||||
Q_INVOKABLE QString noteText(int modelIndex, int index) const;
|
||||
Q_INVOKABLE void setNoteText(int noteId, const QString &text);
|
||||
Q_INVOKABLE void setNoteText(int modelIndex, int index, const QString &text);
|
||||
Q_INVOKABLE int noteTimelineModel(int noteIndex) const;
|
||||
Q_INVOKABLE int noteTimelineIndex(int noteIndex) const;
|
||||
Q_INVOKABLE QVariantList notesByTimelineModel(int modelIndex) const;
|
||||
Q_INVOKABLE QVariantList notesByTypeId(int typeId) const;
|
||||
Q_INVOKABLE int noteCount() const;
|
||||
|
||||
Q_INVOKABLE QVariantMap nextItem(int selectedModel, int selectedItem, qint64 time) const;
|
||||
Q_INVOKABLE QVariantMap prevItem(int selectedModel, int selectedItem, qint64 time) const;
|
||||
@@ -116,16 +65,10 @@ public:
|
||||
signals:
|
||||
void dataAvailable();
|
||||
void stateChanged();
|
||||
void expandedChanged();
|
||||
void hiddenChanged();
|
||||
void rowHeightChanged();
|
||||
void notesChanged(int typeId, int modelIndex, int eventIndex);
|
||||
void modelsChanged(int modelIndex1, int modelIndex2);
|
||||
void modelsChanged();
|
||||
void heightChanged();
|
||||
|
||||
protected slots:
|
||||
void dataChanged();
|
||||
|
||||
private:
|
||||
class TimelineModelAggregatorPrivate;
|
||||
TimelineModelAggregatorPrivate *d;
|
||||
|
||||
Reference in New Issue
Block a user