QmlProfiler: Sanitize the signal exchange between models a bit

The model manager should only set its state to 'Done' if all models are
actually done. When that is the case it can safely emit dataAvailable,
too, freeing us of the need to apply a heuristic to the progress
percentage. In order to have a unified interface to the completion of
model processing an abstract base class for QML and V8 models is
introduced.

Task-number: QTCREATORBUG-11466
Change-Id: Id89c7ef5e24004baab7f37ee5486b69e7611aee0
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Ulf Hermann
2014-02-12 17:35:08 +01:00
parent 5d2654e4e4
commit 47ce17b1ba
15 changed files with 171 additions and 62 deletions

View File

@@ -39,12 +39,9 @@
namespace QmlProfiler {
QmlProfilerSimpleModel::QmlProfilerSimpleModel(QObject *parent)
: QObject(parent)
QmlProfilerSimpleModel::QmlProfilerSimpleModel(QmlProfilerModelManager *parent)
: QmlProfilerBaseModel(parent)
{
m_modelManager = qobject_cast<QmlProfilerModelManager *>(parent);
Q_ASSERT(m_modelManager);
m_modelId = m_modelManager->registerModelProxy();
}
QmlProfilerSimpleModel::~QmlProfilerSimpleModel()
@@ -53,9 +50,8 @@ QmlProfilerSimpleModel::~QmlProfilerSimpleModel()
void QmlProfilerSimpleModel::clear()
{
m_modelManager->modelProxyCountUpdated(m_modelId, 0, 1);
eventList.clear();
emit changed();
QmlProfilerBaseModel::clear();
}
bool QmlProfilerSimpleModel::isEmpty() const
@@ -98,12 +94,6 @@ qint64 QmlProfilerSimpleModel::lastTimeMark() const
return eventList.last().startTime + eventList.last().duration;
}
void QmlProfilerSimpleModel::complete()
{
m_modelManager->modelProxyCountUpdated(m_modelId, isEmpty() ? 0 : 1, 1);
emit changed();
}
QString QmlProfilerSimpleModel::getHashString(const QmlProfilerSimpleModel::QmlEventData &event)
{
return QString::fromLatin1("%1:%2:%3:%4:%5").arg(