summaryrefslogtreecommitdiff
path: root/src/plugins/qmlprofiler/qml
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2013-12-10 12:53:20 +0100
committerErik Verbruggen <erik.verbruggen@digia.com>2013-12-10 12:53:20 +0100
commit9f831dde07cb2411808534e76669b28a1b76e21d (patch)
treeed6252d64c9a3ab27aa93786272cda1b6008f3c7 /src/plugins/qmlprofiler/qml
parentcdac81f896ef4b052d76f96485a08e6ec13696b8 (diff)
parentea1a92484ac99057b06130a012164bf9788650e9 (diff)
downloadqt-creator-wip/clang.tar.gz
Merge remote-tracking branch 'origin/master' into wip/clangwip/clang
Change-Id: I8a2c8068a3f2b15034fb1bf6304c9a0f3f0e3c8f
Diffstat (limited to 'src/plugins/qmlprofiler/qml')
-rw-r--r--src/plugins/qmlprofiler/qml/CategoryLabel.qml2
-rw-r--r--src/plugins/qmlprofiler/qml/MainView.qml31
-rw-r--r--src/plugins/qmlprofiler/qml/Overview.qml13
-rw-r--r--src/plugins/qmlprofiler/qml/SelectionRange.qml21
-rw-r--r--src/plugins/qmlprofiler/qml/TimeDisplay.qml61
-rw-r--r--src/plugins/qmlprofiler/qml/TimeMarks.qml61
6 files changed, 103 insertions, 86 deletions
diff --git a/src/plugins/qmlprofiler/qml/CategoryLabel.qml b/src/plugins/qmlprofiler/qml/CategoryLabel.qml
index f8cc12d859..5837918344 100644
--- a/src/plugins/qmlprofiler/qml/CategoryLabel.qml
+++ b/src/plugins/qmlprofiler/qml/CategoryLabel.qml
@@ -47,7 +47,7 @@ Item {
onExpandedChanged: {
qmlProfilerModelProxy.setExpanded(modelIndex, categoryIndex, expanded);
- backgroundMarks.requestRedraw();
+ backgroundMarks.requestPaint();
getDescriptions();
updateHeight();
}
diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml
index e8bce8ea0d..c7e12a3de7 100644
--- a/src/plugins/qmlprofiler/qml/MainView.qml
+++ b/src/plugins/qmlprofiler/qml/MainView.qml
@@ -76,19 +76,12 @@ Rectangle {
onRangeChanged: {
var startTime = zoomControl.startTime();
var endTime = zoomControl.endTime();
- var duration = Math.abs(endTime - startTime);
- mainviewTimePerPixel = duration / root.width;
+ mainviewTimePerPixel = Math.abs(endTime - startTime) / root.width;
backgroundMarks.updateMarks(startTime, endTime);
view.updateFlickRange(startTime, endTime);
- if (duration > 0) {
- var candidateWidth = qmlProfilerModelProxy.traceDuration() *
- flick.width / duration;
- if (flick.contentWidth !== candidateWidth)
- flick.contentWidth = candidateWidth;
- }
-
+ flick.setContentWidth();
}
}
@@ -309,8 +302,11 @@ Rectangle {
boundsBehavior: Flickable.StopAtBounds
// ScrollView will try to deinteractivate it. We don't want that
- // as the horizontal flickable is interactive, too.
- onInteractiveChanged: interactive = true
+ // as the horizontal flickable is interactive, too. We do occasionally
+ // switch to non-interactive ourselves, though.
+ property bool stayInteractive: true
+ onInteractiveChanged: interactive = stayInteractive
+ onStayInteractiveChanged: interactive = stayInteractive
// ***** child items
TimeMarks {
@@ -322,6 +318,12 @@ Rectangle {
}
Flickable {
+ function setContentWidth() {
+ var duration = Math.abs(zoomControl.endTime() - zoomControl.startTime());
+ if (duration > 0)
+ contentWidth = qmlProfilerModelProxy.traceDuration() * width / duration;
+ }
+
id: flick
anchors.top: parent.top
anchors.topMargin: labels.y
@@ -333,6 +335,8 @@ Rectangle {
boundsBehavior: Flickable.StopAtBounds
onContentXChanged: view.updateZoomControl()
+ onWidthChanged: setContentWidth()
+
clip:true
SelectionRange {
@@ -429,6 +433,9 @@ Rectangle {
onPressed: {
selectionRange.pressedOnCreation();
}
+ onCanceled: {
+ selectionRange.releasedOnCreation();
+ }
onPositionChanged: {
selectionRange.movedOnCreation();
}
@@ -508,8 +515,6 @@ Rectangle {
x: 0
y: 0
- function toggleEnabled() {enabled = !enabled}
- function toggleVisible() {visible = !visible}
function updateZoomLevel() {
zoomSlider.externalUpdate = true;
zoomSlider.value = Math.pow((view.endTime - view.startTime) / qmlProfilerModelProxy.traceDuration(), 1 / zoomSlider.exponent) * zoomSlider.maximumValue;
diff --git a/src/plugins/qmlprofiler/qml/Overview.qml b/src/plugins/qmlprofiler/qml/Overview.qml
index 2168ea79ad..51d1fdb1f6 100644
--- a/src/plugins/qmlprofiler/qml/Overview.qml
+++ b/src/plugins/qmlprofiler/qml/Overview.qml
@@ -31,9 +31,10 @@ import QtQuick 2.1
import Monitor 1.0
import "Overview.js" as Plotter
-Canvas2D {
+Canvas {
id: canvas
objectName: "Overview"
+ contextType: "2d"
// ***** properties
height: 50
@@ -45,7 +46,7 @@ Canvas2D {
function clearDisplay()
{
dataReady = false;
- requestRedraw();
+ requestPaint();
}
function updateRange() {
@@ -84,18 +85,18 @@ Canvas2D {
target: qmlProfilerModelProxy
onDataAvailable: {
dataReady = true;
- requestRedraw();
+ requestPaint();
}
}
// ***** slots
- onDrawRegion: {
+ onPaint: {
Plotter.qmlProfilerModelProxy = qmlProfilerModelProxy;
if (dataReady) {
- Plotter.plot(canvas, ctxt, region);
+ Plotter.plot(canvas, context, region);
} else {
- Plotter.drawGraph(canvas, ctxt, region) //just draw the background
+ Plotter.drawGraph(canvas, context, region) //just draw the background
}
}
diff --git a/src/plugins/qmlprofiler/qml/SelectionRange.qml b/src/plugins/qmlprofiler/qml/SelectionRange.qml
index 78e09cfb40..381aa27c74 100644
--- a/src/plugins/qmlprofiler/qml/SelectionRange.qml
+++ b/src/plugins/qmlprofiler/qml/SelectionRange.qml
@@ -42,6 +42,7 @@ RangeMover {
property real duration: Math.max(getWidth() * viewTimePerPixel, 500)
property real viewTimePerPixel: 1
property int creationState : 0
+ property int creationReference : 0
Connections {
target: zoomControl
@@ -65,6 +66,7 @@ RangeMover {
function reset(setVisible) {
setRight(getLeft() + 1);
creationState = 0;
+ creationReference = 0;
visible = setVisible;
}
@@ -75,18 +77,21 @@ RangeMover {
pos = width;
switch (creationState) {
- case 1: {
+ case 1:
+ creationReference = pos;
setLeft(pos);
setRight(pos + 1);
break;
- }
- case 2: {
- setLeft(Math.min(getLeft(), pos));
- setRight(Math.max(getRight(), pos));
+ case 2:
+ if (pos > creationReference) {
+ setLeft(creationReference);
+ setRight(pos);
+ } else if (pos < creationReference) {
+ setLeft(pos);
+ setRight(creationReference);
+ }
break;
}
- default: return;
- }
}
@@ -104,6 +109,7 @@ RangeMover {
function releasedOnCreation() {
if (selectionRange.creationState === 2) {
flick.interactive = true;
+ vertflick.stayInteractive = true;
selectionRange.creationState = 3;
selectionRangeControl.enabled = false;
}
@@ -112,6 +118,7 @@ RangeMover {
function pressedOnCreation() {
if (selectionRange.creationState === 1) {
flick.interactive = false;
+ vertflick.stayInteractive = false;
selectionRange.setPos(selectionRangeControl.mouseX + flick.contentX);
selectionRange.creationState = 2;
}
diff --git a/src/plugins/qmlprofiler/qml/TimeDisplay.qml b/src/plugins/qmlprofiler/qml/TimeDisplay.qml
index c7340cfa39..97c469f5d3 100644
--- a/src/plugins/qmlprofiler/qml/TimeDisplay.qml
+++ b/src/plugins/qmlprofiler/qml/TimeDisplay.qml
@@ -30,9 +30,10 @@
import QtQuick 2.1
import Monitor 1.0
-Canvas2D {
+Canvas {
id: timeDisplay
objectName: "TimeDisplay"
+ contextType: "2d"
property real startTime : 0
property real endTime : 0
@@ -43,13 +44,13 @@ Canvas2D {
onRangeChanged: {
startTime = zoomControl.startTime();
endTime = zoomControl.endTime();
- requestRedraw();
+ requestPaint();
}
}
- onDrawRegion: {
- ctxt.fillStyle = "white";
- ctxt.fillRect(0, 0, width, height);
+ onPaint: {
+ context.fillStyle = "white";
+ context.fillRect(0, 0, width, height);
var totalTime = endTime - startTime;
var spacing = width / totalTime;
@@ -67,50 +68,50 @@ Canvas2D {
var initialColor = Math.floor(realStartTime/timePerBlock) % 2;
- ctxt.fillStyle = "#000000";
- ctxt.font = "8px sans-serif";
+ context.fillStyle = "#000000";
+ context.font = "8px sans-serif";
for (var ii = 0; ii < blockCount+1; ii++) {
var x = Math.floor(ii*pixelsPerBlock - realStartPos);
- ctxt.fillStyle = (ii+initialColor)%2 ? "#E6E6E6":"white";
- ctxt.fillRect(x, 0, pixelsPerBlock, height);
+ context.fillStyle = (ii+initialColor)%2 ? "#E6E6E6":"white";
+ context.fillRect(x, 0, pixelsPerBlock, height);
- ctxt.strokeStyle = "#B0B0B0";
- ctxt.beginPath();
- ctxt.moveTo(x, 0);
- ctxt.lineTo(x, height);
- ctxt.stroke();
+ context.strokeStyle = "#B0B0B0";
+ context.beginPath();
+ context.moveTo(x, 0);
+ context.lineTo(x, height);
+ context.stroke();
- ctxt.fillStyle = "#000000";
- ctxt.fillText(prettyPrintTime(ii*timePerBlock + realStartTime), x + 5, height/2 + 5);
+ context.fillStyle = "#000000";
+ context.fillText(prettyPrintTime(ii*timePerBlock + realStartTime), x + 5, height/2 + 5);
}
- ctxt.strokeStyle = "#525252";
- ctxt.beginPath();
- ctxt.moveTo(0, height-1);
- ctxt.lineTo(width, height-1);
- ctxt.stroke();
+ context.strokeStyle = "#525252";
+ context.beginPath();
+ context.moveTo(0, height-1);
+ context.lineTo(width, height-1);
+ context.stroke();
// gradient borders
var gradientDark = "rgba(0, 0, 0, 0.53125)";
var gradientClear = "rgba(0, 0, 0, 0)";
- var grad = ctxt.createLinearGradient(0, 0, 0, 6);
+ var grad = context.createLinearGradient(0, 0, 0, 6);
grad.addColorStop(0,gradientDark);
grad.addColorStop(1,gradientClear);
- ctxt.fillStyle = grad;
- ctxt.fillRect(0, 0, width, 6);
+ context.fillStyle = grad;
+ context.fillRect(0, 0, width, 6);
- grad = ctxt.createLinearGradient(0, 0, 6, 0);
+ grad = context.createLinearGradient(0, 0, 6, 0);
grad.addColorStop(0,gradientDark);
grad.addColorStop(1,gradientClear);
- ctxt.fillStyle = grad;
- ctxt.fillRect(0, 0, 6, height);
+ context.fillStyle = grad;
+ context.fillRect(0, 0, 6, height);
- grad = ctxt.createLinearGradient(width, 0, width-6, 0);
+ grad = context.createLinearGradient(width, 0, width-6, 0);
grad.addColorStop(0,gradientDark);
grad.addColorStop(1,gradientClear);
- ctxt.fillStyle = grad;
- ctxt.fillRect(width-6, 0, 6, height);
+ context.fillStyle = grad;
+ context.fillRect(width-6, 0, 6, height);
}
function prettyPrintTime( t )
diff --git a/src/plugins/qmlprofiler/qml/TimeMarks.qml b/src/plugins/qmlprofiler/qml/TimeMarks.qml
index 433d35578f..2cef16edf4 100644
--- a/src/plugins/qmlprofiler/qml/TimeMarks.qml
+++ b/src/plugins/qmlprofiler/qml/TimeMarks.qml
@@ -30,9 +30,10 @@
import QtQuick 2.1
import Monitor 1.0
-Canvas2D {
- id: timeDisplay
+Canvas {
+ id: timeMarks
objectName: "TimeMarks"
+ contextType: "2d"
property real startTime
property real endTime
@@ -40,11 +41,13 @@ Canvas2D {
Connections {
target: labels
- onHeightChanged: { requestRedraw(); }
+ onHeightChanged: requestPaint()
}
- onDrawRegion: {
- drawBackgroundBars( ctxt, region );
+ onYChanged: requestPaint()
+
+ onPaint: {
+ drawBackgroundBars( context, region );
var totalTime = endTime - startTime;
var spacing = width / totalTime;
@@ -63,23 +66,23 @@ Canvas2D {
var lineStart = y < 0 ? -y : 0;
var lineEnd = Math.min(height, labels.height - y);
- ctxt.fillStyle = "#000000";
- ctxt.font = "8px sans-serif";
+ context.fillStyle = "#000000";
+ context.font = "8px sans-serif";
for (var ii = 0; ii < blockCount+1; ii++) {
var x = Math.floor(ii*pixelsPerBlock - realStartPos);
- ctxt.strokeStyle = "#B0B0B0";
- ctxt.beginPath();
- ctxt.moveTo(x, lineStart);
- ctxt.lineTo(x, lineEnd);
- ctxt.stroke();
+ context.strokeStyle = "#B0B0B0";
+ context.beginPath();
+ context.moveTo(x, lineStart);
+ context.lineTo(x, lineEnd);
+ context.stroke();
- ctxt.strokeStyle = "#CCCCCC";
+ context.strokeStyle = "#CCCCCC";
for (var jj=1; jj < 5; jj++) {
var xx = Math.floor(ii*pixelsPerBlock + jj*pixelsPerSection - realStartPos);
- ctxt.beginPath();
- ctxt.moveTo(xx, lineStart);
- ctxt.lineTo(xx, lineEnd);
- ctxt.stroke();
+ context.beginPath();
+ context.moveTo(xx, lineStart);
+ context.lineTo(xx, lineEnd);
+ context.stroke();
}
}
}
@@ -88,19 +91,19 @@ Canvas2D {
if (startTime !== start || endTime !== end) {
startTime = start;
endTime = end;
- requestRedraw();
+ requestPaint();
}
}
- function drawBackgroundBars( ctxt, region ) {
+ function drawBackgroundBars( context, region ) {
var colorIndex = true;
// row background
var backgroundOffset = y < 0 ? -y : -(y % (2 * root.singleRowHeight));
for (var currentY= backgroundOffset; currentY < Math.min(height, labels.height - y); currentY += root.singleRowHeight) {
- ctxt.fillStyle = colorIndex ? "#f0f0f0" : "white";
- ctxt.strokeStyle = colorIndex ? "#f0f0f0" : "white";
- ctxt.fillRect(0, currentY, width, root.singleRowHeight);
+ context.fillStyle = colorIndex ? "#f0f0f0" : "white";
+ context.strokeStyle = colorIndex ? "#f0f0f0" : "white";
+ context.fillRect(0, currentY, width, root.singleRowHeight);
colorIndex = !colorIndex;
}
@@ -112,18 +115,18 @@ Canvas2D {
if (cumulatedHeight < y)
continue;
- ctxt.strokeStyle = "#B0B0B0";
- ctxt.beginPath();
- ctxt.moveTo(0, cumulatedHeight - y);
- ctxt.lineTo(width, cumulatedHeight - y);
- ctxt.stroke();
+ context.strokeStyle = "#B0B0B0";
+ context.beginPath();
+ context.moveTo(0, cumulatedHeight - y);
+ context.lineTo(width, cumulatedHeight - y);
+ context.stroke();
}
}
// bottom
if (height > labels.height - y) {
- ctxt.fillStyle = "#f5f5f5";
- ctxt.fillRect(0, labels.height - y, width, Math.min(height - labels.height + y, labelsTail.height));
+ context.fillStyle = "#f5f5f5";
+ context.fillRect(0, labels.height - y, width, Math.min(height - labels.height + y, labelsTail.height));
}
}
}