From 7eca9fbc4205cc1e1c31c04674e9b9672f2b73ce Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 24 Jun 2014 11:53:19 +0200 Subject: Add scale to memory usage and pixmap cache models Change-Id: I69cb67a97b0bb3407f509db01ec2d4b9acd177db Reviewed-by: Kai Koehne --- plugins/qmlprofilerextension/memoryusagemodel.cpp | 9 ++++++++- plugins/qmlprofilerextension/memoryusagemodel.h | 1 + plugins/qmlprofilerextension/pixmapcachemodel.cpp | 12 +++++++++++- plugins/qmlprofilerextension/pixmapcachemodel.h | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/plugins/qmlprofilerextension/memoryusagemodel.cpp b/plugins/qmlprofilerextension/memoryusagemodel.cpp index 6b48d45c1e..64a6aa44f8 100644 --- a/plugins/qmlprofilerextension/memoryusagemodel.cpp +++ b/plugins/qmlprofilerextension/memoryusagemodel.cpp @@ -54,6 +54,13 @@ int MemoryUsageModel::rowCount() const return isEmpty() ? 1 : 3; } +int MemoryUsageModel::rowMaxValue(int rowNumber) const +{ + Q_D(const MemoryUsageModel); + Q_UNUSED(rowNumber); + return d->maxSize; +} + int MemoryUsageModel::getEventRow(int index) const { Q_D(const MemoryUsageModel); @@ -78,7 +85,7 @@ QColor MemoryUsageModel::getColor(int index) const float MemoryUsageModel::getHeight(int index) const { Q_D(const MemoryUsageModel); - return qMin(1.0f, (float)d->range(index).size / (float)d->maxSize * 0.85f + 0.15f); + return qMin(1.0f, (float)d->range(index).size / (float)d->maxSize); } const QVariantList MemoryUsageModel::getLabels() const diff --git a/plugins/qmlprofilerextension/memoryusagemodel.h b/plugins/qmlprofilerextension/memoryusagemodel.h index ce7fdb8b74..c256b02590 100644 --- a/plugins/qmlprofilerextension/memoryusagemodel.h +++ b/plugins/qmlprofilerextension/memoryusagemodel.h @@ -43,6 +43,7 @@ public: MemoryUsageModel(QObject *parent = 0); int rowCount() const; + int rowMaxValue(int rowNumber) const; int getEventRow(int index) const; int getEventId(int index) const; diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.cpp b/plugins/qmlprofilerextension/pixmapcachemodel.cpp index c66055aa0c..ec4da50f10 100644 --- a/plugins/qmlprofilerextension/pixmapcachemodel.cpp +++ b/plugins/qmlprofilerextension/pixmapcachemodel.cpp @@ -103,6 +103,16 @@ int PixmapCacheModel::rowCount() const return d->collapsedRowCount; } +int PixmapCacheModel::rowMaxValue(int rowNumber) const +{ + Q_D(const PixmapCacheModel); + if (rowNumber == 1) { + return d->maxCacheSize; + } else { + return AbstractTimelineModel::rowMaxValue(rowNumber); + } +} + int PixmapCacheModel::getEventRow(int index) const { Q_D(const PixmapCacheModel); @@ -131,7 +141,7 @@ float PixmapCacheModel::getHeight(int index) const { Q_D(const PixmapCacheModel); if (d->range(index).pixmapEventType == PixmapCacheCountChanged) - return 0.15 + (float)d->range(index).cacheSize * 0.85 / (float)d->maxCacheSize; + return (float)d->range(index).cacheSize / (float)d->maxCacheSize; else return 1.0f; } diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.h b/plugins/qmlprofilerextension/pixmapcachemodel.h index 688be42a1c..888a5f66ed 100644 --- a/plugins/qmlprofilerextension/pixmapcachemodel.h +++ b/plugins/qmlprofilerextension/pixmapcachemodel.h @@ -56,6 +56,7 @@ public: PixmapCacheModel(QObject *parent = 0); int rowCount() const; + int rowMaxValue(int rowNumber) const; int getEventRow(int index) const; Q_INVOKABLE int getEventId(int index) const; -- cgit v1.2.1