forked from qt-creator/qt-creator
Make sure that all pixmap URLs have a some event in the timeline
If that's not the case the categoryDepth() method will return a lower number of categories than getLabelsForCategory() which leads to glitches. Change-Id: I2cf4c70586af2922f061a57c5a9f4b6bd0f77903 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -395,17 +395,17 @@ void PixmapCacheModel::loadData()
|
|||||||
newEvent.urlIndex = d->pixmapUrls.count();
|
newEvent.urlIndex = d->pixmapUrls.count();
|
||||||
d->pixmapUrls << event.location.filename;
|
d->pixmapUrls << event.location.filename;
|
||||||
d->pixmapSizes << QPair<int, int>(0,0); // default value
|
d->pixmapSizes << QPair<int, int>(0,0); // default value
|
||||||
pixmapStartPoints << d->eventList.count(); // index to the starting point
|
pixmapStartPoints << -1; // dummy value to be filled by load event
|
||||||
}
|
|
||||||
|
|
||||||
if (newEvent.pixmapEventType == PixmapSizeKnown) { // pixmap size
|
|
||||||
d->pixmapSizes[newEvent.urlIndex] = QPair<int,int>((int)event.numericData1, (int)event.numericData2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newEvent.eventId = newEvent.urlIndex + 1;
|
newEvent.eventId = newEvent.urlIndex + 1;
|
||||||
|
newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
|
||||||
|
|
||||||
// Cache Size Changed Event
|
switch (newEvent.pixmapEventType) {
|
||||||
if (newEvent.pixmapEventType == PixmapCacheCountChanged) {
|
case PixmapSizeKnown: // pixmap size
|
||||||
|
d->pixmapSizes[newEvent.urlIndex] = QPair<int,int>((int)event.numericData1, (int)event.numericData2);
|
||||||
|
break;
|
||||||
|
case PixmapCacheCountChanged: {// Cache Size Changed Event
|
||||||
newEvent.startTime = event.startTime + 1; // delay 1 ns for proper sorting
|
newEvent.startTime = event.startTime + 1; // delay 1 ns for proper sorting
|
||||||
newEvent.eventId = 0;
|
newEvent.eventId = 0;
|
||||||
newEvent.rowNumberExpanded = 1;
|
newEvent.rowNumberExpanded = 1;
|
||||||
@@ -424,18 +424,16 @@ void PixmapCacheModel::loadData()
|
|||||||
newEvent.cacheSize = prevSize + pixSize;
|
newEvent.cacheSize = prevSize + pixSize;
|
||||||
d->eventList << newEvent;
|
d->eventList << newEvent;
|
||||||
lastCacheSizeEvent = d->eventList.count() - 1;
|
lastCacheSizeEvent = d->eventList.count() - 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case PixmapLoadingStarted: // Load
|
||||||
// Load
|
|
||||||
if (newEvent.pixmapEventType == PixmapLoadingStarted) {
|
|
||||||
pixmapStartPoints[newEvent.urlIndex] = d->eventList.count();
|
pixmapStartPoints[newEvent.urlIndex] = d->eventList.count();
|
||||||
newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
|
|
||||||
d->eventList << newEvent;
|
d->eventList << newEvent;
|
||||||
}
|
break;
|
||||||
|
case PixmapLoadingFinished:
|
||||||
if (newEvent.pixmapEventType == PixmapLoadingFinished || newEvent.pixmapEventType == PixmapLoadingError) {
|
case PixmapLoadingError: {
|
||||||
int loadIndex = pixmapStartPoints[newEvent.urlIndex];
|
int loadIndex = pixmapStartPoints[newEvent.urlIndex];
|
||||||
if (!isNewEntry) {
|
if (!isNewEntry && loadIndex != -1) {
|
||||||
d->eventList[loadIndex].duration = event.startTime - d->eventList[loadIndex].startTime;
|
d->eventList[loadIndex].duration = event.startTime - d->eventList[loadIndex].startTime;
|
||||||
} else {
|
} else {
|
||||||
// if it's a new entry it means that we don't have a corresponding start
|
// if it's a new entry it means that we don't have a corresponding start
|
||||||
@@ -443,12 +441,18 @@ void PixmapCacheModel::loadData()
|
|||||||
newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
|
newEvent.rowNumberExpanded = newEvent.urlIndex + 2;
|
||||||
newEvent.startTime = traceStartTime();
|
newEvent.startTime = traceStartTime();
|
||||||
newEvent.duration = event.startTime - traceStartTime();
|
newEvent.duration = event.startTime - traceStartTime();
|
||||||
|
loadIndex = d->eventList.count();
|
||||||
d->eventList << newEvent;
|
d->eventList << newEvent;
|
||||||
|
pixmapStartPoints[newEvent.urlIndex] = loadIndex;
|
||||||
}
|
}
|
||||||
if (event.bindingType == PixmapLoadingFinished)
|
if (event.bindingType == PixmapLoadingFinished)
|
||||||
d->eventList[loadIndex].cacheSize = 1; // use count to mark success
|
d->eventList[loadIndex].cacheSize = 1; // use count to mark success
|
||||||
else
|
else
|
||||||
d->eventList[loadIndex].cacheSize = -1; // ... or failure
|
d->eventList[loadIndex].cacheSize = -1; // ... or failure
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_modelManager->modelProxyCountUpdated(m_modelId, d->eventList.count(), 2*simpleModel->getEvents().count());
|
m_modelManager->modelProxyCountUpdated(m_modelId, d->eventList.count(), 2*simpleModel->getEvents().count());
|
||||||
|
Reference in New Issue
Block a user