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

@@ -60,17 +60,19 @@ Item {
function updateHeight() {
height = root.singleRowHeight * (1 +
(expanded ? qmlEventList.uniqueEventsOfType(typeIndex) : qmlEventList.maxNestingForType(typeIndex)));
(expanded ? qmlProfilerDataModel.uniqueEventsOfType(typeIndex) :
qmlProfilerDataModel.maxNestingForType(typeIndex)));
}
function getDescriptions() {
var desc=[];
var ids=[];
var extdesc=[];
for (var i=0; i<qmlEventList.uniqueEventsOfType(typeIndex); i++) {
desc[i] = qmlEventList.eventTextForType(typeIndex, i);
ids[i] = qmlEventList.eventIdForType(typeIndex, i);
extdesc[i] = qmlEventList.eventDisplayNameForType(typeIndex, i) + " : " + desc[i];
for (var i=0; i<qmlProfilerDataModel.uniqueEventsOfType(typeIndex); i++) {
desc[i] = qmlProfilerDataModel.eventTextForType(typeIndex, i);
ids[i] = qmlProfilerDataModel.eventIdForType(typeIndex, i);
extdesc[i] = qmlProfilerDataModel.eventDisplayNameForType(typeIndex, i) +
" : " + desc[i];
}
descriptions = desc;
eventIds = ids;
@@ -79,18 +81,18 @@ Item {
}
Connections {
target: qmlEventList
target: qmlProfilerDataModel
onReloadDetailLabels: getDescriptions();
onStateChanged: {
// Empty
if (qmlEventList.getCurrentStateFromQml() == 0) {
if (qmlProfilerDataModel.getCurrentStateFromQml() == 0) {
descriptions = [];
eventIds = [];
extdescriptions = [];
updateHeight();
} else
// Done
if (qmlEventList.getCurrentStateFromQml() == 3) {
if (qmlProfilerDataModel.getCurrentStateFromQml() == 3) {
getDescriptions();
}
}