forked from qt-creator/qt-creator
Don't save minCacheSize and properly initialize maxCacheSize
minCacheSize wasn't used anywhere and a maxCacheSize <= 0 is useless and may lead to wrong height values for cache events. Change-Id: Iee8c95197a7851bd41238e8e465bf6fd5b994573 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -67,7 +67,7 @@ class PixmapCacheModel::PixmapCacheModelPrivate :
|
|||||||
SingleCategoryTimelineModel::SingleCategoryTimelineModelPrivate>
|
SingleCategoryTimelineModel::SingleCategoryTimelineModelPrivate>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void computeCacheSizes();
|
void computeMaxCacheSize();
|
||||||
void resizeUnfinishedLoads();
|
void resizeUnfinishedLoads();
|
||||||
void flattenLoads();
|
void flattenLoads();
|
||||||
void computeRowCounts();
|
void computeRowCounts();
|
||||||
@@ -79,7 +79,6 @@ public:
|
|||||||
int collapsedRowCount;
|
int collapsedRowCount;
|
||||||
void addVP(QVariantList &l, QString label, qint64 time) const;
|
void addVP(QVariantList &l, QString label, qint64 time) const;
|
||||||
|
|
||||||
qint64 minCacheSize;
|
|
||||||
qint64 maxCacheSize;
|
qint64 maxCacheSize;
|
||||||
private:
|
private:
|
||||||
Q_DECLARE_PUBLIC(PixmapCacheModel)
|
Q_DECLARE_PUBLIC(PixmapCacheModel)
|
||||||
@@ -93,6 +92,7 @@ PixmapCacheModel::PixmapCacheModel(QObject *parent)
|
|||||||
Q_D(PixmapCacheModel);
|
Q_D(PixmapCacheModel);
|
||||||
d->collapsedRowCount = 1;
|
d->collapsedRowCount = 1;
|
||||||
d->expandedRowCount = 1;
|
d->expandedRowCount = 1;
|
||||||
|
d->maxCacheSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PixmapCacheModel::categoryDepth(int categoryIndex) const
|
int PixmapCacheModel::categoryDepth(int categoryIndex) const
|
||||||
@@ -484,7 +484,7 @@ void PixmapCacheModel::loadData()
|
|||||||
|
|
||||||
d->resizeUnfinishedLoads();
|
d->resizeUnfinishedLoads();
|
||||||
|
|
||||||
d->computeCacheSizes();
|
d->computeMaxCacheSize();
|
||||||
d->flattenLoads();
|
d->flattenLoads();
|
||||||
d->computeRowCounts();
|
d->computeRowCounts();
|
||||||
d->computeNesting();
|
d->computeNesting();
|
||||||
@@ -499,20 +499,18 @@ void PixmapCacheModel::clear()
|
|||||||
d->pixmaps.clear();
|
d->pixmaps.clear();
|
||||||
d->collapsedRowCount = 1;
|
d->collapsedRowCount = 1;
|
||||||
d->expandedRowCount = 1;
|
d->expandedRowCount = 1;
|
||||||
|
d->maxCacheSize = 1;
|
||||||
d->expanded = false;
|
d->expanded = false;
|
||||||
|
|
||||||
d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1);
|
d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixmapCacheModel::PixmapCacheModelPrivate::computeCacheSizes()
|
void PixmapCacheModel::PixmapCacheModelPrivate::computeMaxCacheSize()
|
||||||
{
|
{
|
||||||
minCacheSize = -1;
|
maxCacheSize = 1;
|
||||||
maxCacheSize = -1;
|
|
||||||
foreach (const PixmapCacheModel::PixmapCacheEvent &event, ranges) {
|
foreach (const PixmapCacheModel::PixmapCacheEvent &event, ranges) {
|
||||||
if (event.pixmapEventType == PixmapCacheModel::PixmapCacheCountChanged) {
|
if (event.pixmapEventType == PixmapCacheModel::PixmapCacheCountChanged) {
|
||||||
if (minCacheSize == -1 || event.cacheSize < minCacheSize)
|
if (event.cacheSize > maxCacheSize)
|
||||||
minCacheSize = event.cacheSize;
|
|
||||||
if (maxCacheSize == -1 || event.cacheSize > maxCacheSize)
|
|
||||||
maxCacheSize = event.cacheSize;
|
maxCacheSize = event.cacheSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user