QmlProfiler: Visual feedback

Change-Id: Ib0d50b0699a6553079c84bbc8d67ecc3c3397bc2
Reviewed-on: http://codereview.qt.nokia.com/1594
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
This commit is contained in:
Christiaan Janssen
2011-07-11 16:05:37 +02:00
parent 5f370dfbfc
commit 54d9374a2e
4 changed files with 119 additions and 2 deletions

View File

@@ -38,6 +38,7 @@ Rectangle {
id: root
property bool dataAvailable: false;
property int eventCount: 0;
// move the cursor in the editor
signal updateCursorPosition
@@ -53,6 +54,7 @@ Rectangle {
Plotter.reset();
view.clearData();
root.dataAvailable = false;
root.eventCount = 0;
rangeMover.x = 2
rangeMover.opacity = 0
}
@@ -133,8 +135,9 @@ Rectangle {
root.clearData();
}
if (!root.dataAvailable && event === 0) //### only handle paint event
if (!root.dataAvailable && event === 0) { //### only handle paint event
Plotter.values.push(time);
}
}
onRange: {
@@ -151,6 +154,8 @@ Rectangle {
Plotter.ranges.push( { type: type, start: startTime, duration: length, label: data, fileName: fileName, line: line, nestingLevel: nestingInType, nestingDepth: Plotter.nestingDepth[type] } );
if (nestingInType == 1)
Plotter.nestingDepth[type] = 1;
root.eventCount = Plotter.ranges.length;
}
}
@@ -500,4 +505,8 @@ Rectangle {
height: flick.height + labels.y
visible: false
}
StatusDisplay {
anchors.centerIn: flick
}
}

View File

@@ -0,0 +1,106 @@
import QtQuick 1.0
import "MainView.js" as Plotter
Rectangle {
id: statusDisplay
property real percentage : 0
property int eventCount: root.eventCount
onEventCountChanged: {
if (state=="loading" && eventCount > 0 && root.elapsedTime > 0) {
percentage = Math.min(1.0,
(Plotter.ranges[Plotter.ranges.length-1].start - Plotter.ranges[0].start) / root.elapsedTime * 1e-9 );
}
}
width: 200
height: displayColumn.height + 20
visible: false;
color: "#CCD0CC"
border.width: 1
border.color: "#AAAEAA";
radius: 4
Column {
id: displayColumn
y: 10
spacing: 5
Text {
id: statusText
width: statusDisplay.width
horizontalAlignment: "AlignHCenter"
y: 10
}
Rectangle {
id: progressBar
visible: false
width: statusDisplay.width - 20
height: 20
x: 10
color: "transparent"
border.width: 1
border.color: "#AAAEAA"
Rectangle {
x: 1
y: 1
width: (parent.width-1) * statusDisplay.percentage
color: Qt.rgba(0.37 + 0.2*(1 - statusDisplay.percentage), 0.58, 0.37, 1);
height: parent.height-1
}
}
}
states: [
// no data available
State {
when: (root.eventCount == 0) && !connection.recording;
PropertyChanges {
target: statusDisplay
visible: true
}
PropertyChanges {
target: statusText
text: qsTr("No QML events recorded");
}
},
// running app
State {
when: connection.recording;
PropertyChanges {
target: statusDisplay
visible: true
}
PropertyChanges {
target: statusText
text: qsTr("Profiling application");
}
},
// loading data
State {
name: "loading"
when: (!root.dataAvailable) && (root.eventCount > 0);
PropertyChanges {
target: statusDisplay
visible: true
}
PropertyChanges {
target: statusText
text: qsTr("Loading data");
}
PropertyChanges {
target: progressBar
visible: true
}
}
]
}

View File

@@ -15,5 +15,6 @@
<file>magnifier-plus.png</file>
<file>recordOff.png</file>
<file>recordOn.png</file>
<file>StatusDisplay.qml</file>
</qresource>
</RCC>

View File

@@ -59,7 +59,8 @@ OTHER_FILES += \
qml/RangeDetails.qml \
qml/RangeMover.qml \
qml/MainView.js \
qml/TimeDisplay.qml
qml/TimeDisplay.qml \
qml/StatusDisplay.qml
FORMS += \
qmlprofilerattachdialog.ui