QmlProfiler: Refactor

The code of the qmlprofiler client has become a bit too complex,
this patch reorganizes the modules in a more sensible way,
having the modules communicate with each other through a
state machine instead of the excess of signals and slots
from before.

Change-Id: I76f7313779888a1bd07a1cdb1acbf2e47aacf42a
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Christiaan Janssen
2012-02-24 10:47:17 +01:00
parent d207165f6a
commit b7304e2f2e
47 changed files with 4742 additions and 3896 deletions

View File

@@ -51,8 +51,8 @@ Canvas2D {
}
function updateRange() {
var newStartTime = Math.round(rangeMover.x * qmlEventList.traceDuration() / width) + qmlEventList.traceStartTime();
var newEndTime = Math.round((rangeMover.x + rangeMover.width) * qmlEventList.traceDuration() / width) + qmlEventList.traceStartTime();
var newStartTime = Math.round(rangeMover.x * qmlProfilerDataModel.traceDuration() / width) + qmlProfilerDataModel.traceStartTime();
var newEndTime = Math.round((rangeMover.x + rangeMover.width) * qmlProfilerDataModel.traceDuration() / width) + qmlProfilerDataModel.traceStartTime();
if (startTime !== newStartTime || endTime !== newEndTime) {
zoomControl.setRange(newStartTime, newEndTime);
}
@@ -62,13 +62,13 @@ Canvas2D {
Connections {
target: zoomControl
onRangeChanged: {
if (qmlEventList) {
if (qmlProfilerDataModel) {
startTime = zoomControl.startTime();
endTime = zoomControl.endTime();
var newRangeX = (startTime - qmlEventList.traceStartTime()) * width / qmlEventList.traceDuration();
var newRangeX = (startTime - qmlProfilerDataModel.traceStartTime()) * width / qmlProfilerDataModel.traceDuration();
if (rangeMover.x !== newRangeX)
rangeMover.x = newRangeX;
var newWidth = (endTime-startTime) * width / qmlEventList.traceDuration();
var newWidth = (endTime-startTime) * width / qmlProfilerDataModel.traceDuration();
if (rangeMover.width !== newWidth)
rangeMover.width = newWidth;
}
@@ -76,10 +76,10 @@ Canvas2D {
}
Connections {
target: qmlEventList
target: qmlProfilerDataModel
onStateChanged: {
// State is "done"
if (qmlEventList.getCurrentStateFromQml() == 3) {
if (qmlProfilerDataModel.getCurrentStateFromQml() == 3) {
dataAvailable = true;
requestRedraw();
}
@@ -88,7 +88,7 @@ Canvas2D {
// ***** slots
onDrawRegion: {
Plotter.qmlEventList = qmlEventList;
Plotter.qmlProfilerDataModel = qmlProfilerDataModel;
if (dataAvailable) {
Plotter.plot(canvas, ctxt, region);
} else {