2011-03-25 09:25:17 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
2011-05-06 15:05:37 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-07-06 15:48:52 +00:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-07-06 15:48:52 +00:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2011-03-25 09:25:17 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-07-06 15:48:52 +00:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2011-03-25 09:25:17 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-05-06 15:05:37 +02:00
|
|
|
** Nokia at info@qt.nokia.com.
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2011-03-25 09:26:55 +01:00
|
|
|
import QtQuick 1.0
|
2011-03-11 12:22:57 +01:00
|
|
|
import Monitor 1.0
|
|
|
|
|
import "MainView.js" as Plotter
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: root
|
|
|
|
|
|
2011-07-25 16:16:09 +02:00
|
|
|
property bool dataAvailable: true;
|
2011-07-26 13:56:14 +02:00
|
|
|
property int eventCount: 0;
|
|
|
|
|
property real progress: 0;
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2011-09-23 15:58:41 +02:00
|
|
|
property bool mouseOverSelection : true
|
|
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
// move the cursor in the editor
|
|
|
|
|
signal updateCursorPosition
|
|
|
|
|
property string fileName: ""
|
|
|
|
|
property int lineNumber: -1
|
|
|
|
|
function gotoSourceLocation(file,line) {
|
|
|
|
|
root.fileName = file;
|
|
|
|
|
root.lineNumber = line;
|
|
|
|
|
root.updateCursorPosition();
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 18:19:08 +02:00
|
|
|
function clearData() {
|
2011-04-06 16:04:18 +02:00
|
|
|
Plotter.reset();
|
|
|
|
|
view.clearData();
|
2011-07-05 15:50:32 +02:00
|
|
|
root.dataAvailable = false;
|
2011-07-11 16:05:37 +02:00
|
|
|
root.eventCount = 0;
|
2011-04-06 16:04:18 +02:00
|
|
|
rangeMover.x = 2
|
|
|
|
|
rangeMover.opacity = 0
|
2011-09-23 15:58:41 +02:00
|
|
|
hideRangeDetails();
|
2011-04-06 16:04:18 +02:00
|
|
|
}
|
|
|
|
|
|
2011-06-24 18:19:08 +02:00
|
|
|
function clearAll() {
|
|
|
|
|
clearData();
|
|
|
|
|
selectedEventIndex = -1;
|
|
|
|
|
canvas.requestPaint();
|
|
|
|
|
view.visible = false;
|
|
|
|
|
root.elapsedTime = 0;
|
|
|
|
|
root.updateTimer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
property int selectedEventIndex : -1;
|
|
|
|
|
property bool mouseTracking: false;
|
|
|
|
|
|
2011-06-24 18:19:08 +02:00
|
|
|
onSelectedEventIndexChanged: {
|
2011-07-26 13:56:14 +02:00
|
|
|
if ((!mouseTracking) && eventCount > 0
|
|
|
|
|
&& selectedEventIndex > -1 && selectedEventIndex < eventCount) {
|
2011-06-24 18:19:08 +02:00
|
|
|
// re-center flickable if necessary
|
|
|
|
|
var xs = Plotter.xScale(canvas);
|
2011-07-26 13:56:14 +02:00
|
|
|
var startTime = qmlEventList.firstTimeMark();
|
|
|
|
|
var eventStartTime = qmlEventList.getStartTime(selectedEventIndex);
|
|
|
|
|
var eventDuration = qmlEventList.getDuration(selectedEventIndex);
|
|
|
|
|
if (rangeMover.value + startTime > eventStartTime) {
|
2011-06-24 18:19:08 +02:00
|
|
|
rangeMover.x = Math.max(0,
|
2011-07-26 13:56:14 +02:00
|
|
|
Math.floor((eventStartTime - startTime) / xs - canvas.canvasWindow.x - rangeMover.zoomWidth/2) );
|
|
|
|
|
} else if (rangeMover.value + startTime + rangeMover.zoomWidth * xs < eventStartTime + eventDuration) {
|
|
|
|
|
rangeMover.x = Math.floor((eventStartTime + eventDuration - startTime) / xs - canvas.canvasWindow.x - rangeMover.zoomWidth/2);
|
2011-06-24 18:19:08 +02:00
|
|
|
}
|
|
|
|
|
}
|
2011-09-23 15:58:41 +02:00
|
|
|
|
|
|
|
|
if (selectedEventIndex == -1) {
|
|
|
|
|
selectionHighlight.visible = false;
|
|
|
|
|
}
|
2011-06-24 18:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function nextEvent() {
|
2011-07-26 13:56:14 +02:00
|
|
|
if (eventCount > 0) {
|
2011-06-24 18:19:08 +02:00
|
|
|
++selectedEventIndex;
|
2011-07-26 13:56:14 +02:00
|
|
|
if (selectedEventIndex >= eventCount)
|
2011-06-24 18:19:08 +02:00
|
|
|
selectedEventIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prevEvent() {
|
2011-07-26 13:56:14 +02:00
|
|
|
if (eventCount > 0) {
|
2011-06-24 18:19:08 +02:00
|
|
|
--selectedEventIndex;
|
|
|
|
|
if (selectedEventIndex < 0)
|
2011-07-26 13:56:14 +02:00
|
|
|
selectedEventIndex = eventCount - 1;
|
2011-06-24 18:19:08 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-27 18:25:50 +02:00
|
|
|
function zoomIn() {
|
|
|
|
|
// 10%
|
|
|
|
|
var newZoom = rangeMover.zoomWidth / 1.1;
|
|
|
|
|
|
|
|
|
|
// 0.1 ms minimum zoom
|
|
|
|
|
if (newZoom * Plotter.xScale(canvas) > 100000) {
|
|
|
|
|
rangeMover.zoomWidth = newZoom
|
|
|
|
|
rangeMover.updateZoomControls();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function zoomOut() {
|
|
|
|
|
// 10%
|
|
|
|
|
var newZoom = rangeMover.zoomWidth * 1.1;
|
|
|
|
|
if (newZoom > canvas.width)
|
|
|
|
|
newZoom = canvas.width;
|
|
|
|
|
if (newZoom + rangeMover.x > canvas.width)
|
|
|
|
|
rangeMover.x = canvas.width - newZoom;
|
|
|
|
|
rangeMover.zoomWidth = newZoom;
|
|
|
|
|
rangeMover.updateZoomControls();
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
Connections {
|
2011-07-26 13:56:14 +02:00
|
|
|
target: qmlEventList
|
|
|
|
|
onCountChanged: {
|
|
|
|
|
eventCount = qmlEventList.count();
|
|
|
|
|
if (eventCount == 0)
|
|
|
|
|
root.clearAll();
|
|
|
|
|
if (eventCount > 1) {
|
|
|
|
|
root.progress = Math.min(1.0,
|
|
|
|
|
(qmlEventList.lastTimeMark() - qmlEventList.firstTimeMark()) / root.elapsedTime * 1e-9 ) * 0.5;
|
|
|
|
|
} else
|
|
|
|
|
root.progress = 0;
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
|
2011-07-26 13:56:14 +02:00
|
|
|
onParsingStatusChanged: {
|
|
|
|
|
root.dataAvailable = false;
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
|
2011-07-26 13:56:14 +02:00
|
|
|
onDataReady: {
|
|
|
|
|
if (eventCount > 0) {
|
|
|
|
|
view.clearData();
|
|
|
|
|
view.rebuildCache();
|
|
|
|
|
}
|
2011-04-06 16:04:18 +02:00
|
|
|
}
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
|
2011-03-24 12:42:15 +01:00
|
|
|
// Elapsed
|
|
|
|
|
property real elapsedTime;
|
|
|
|
|
signal updateTimer;
|
|
|
|
|
Timer {
|
2011-07-21 11:24:49 +02:00
|
|
|
id: elapsedTimer
|
2011-03-24 12:42:15 +01:00
|
|
|
property date startDate
|
|
|
|
|
property bool reset: true
|
|
|
|
|
running: connection.recording
|
|
|
|
|
repeat: true
|
|
|
|
|
onRunningChanged: if (running) reset = true
|
|
|
|
|
interval: 100
|
|
|
|
|
triggeredOnStart: true
|
|
|
|
|
onTriggered: {
|
|
|
|
|
if (reset) {
|
|
|
|
|
startDate = new Date()
|
|
|
|
|
reset = false
|
|
|
|
|
}
|
|
|
|
|
var time = (new Date() - startDate)/1000
|
|
|
|
|
root.elapsedTime = time.toFixed(1);
|
|
|
|
|
root.updateTimer();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-20 18:11:17 +02:00
|
|
|
// time markers
|
|
|
|
|
TimeDisplay {
|
|
|
|
|
height: flick.height + labels.y
|
|
|
|
|
anchors.left: flick.left
|
|
|
|
|
anchors.right: flick.right
|
2011-07-26 13:56:14 +02:00
|
|
|
startTime: rangeMover.x * Plotter.xScale(canvas) + qmlEventList.firstTimeMark();
|
|
|
|
|
endTime: (rangeMover.x + rangeMover.zoomWidth) * Plotter.xScale(canvas) + qmlEventList.firstTimeMark();
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
|
2011-06-24 18:19:08 +02:00
|
|
|
function hideRangeDetails() {
|
|
|
|
|
rangeDetails.visible = false
|
|
|
|
|
rangeDetails.duration = ""
|
|
|
|
|
rangeDetails.label = ""
|
|
|
|
|
rangeDetails.type = ""
|
|
|
|
|
rangeDetails.file = ""
|
|
|
|
|
rangeDetails.line = -1
|
2011-09-23 15:58:41 +02:00
|
|
|
|
|
|
|
|
root.mouseOverSelection = true;
|
|
|
|
|
selectionHighlight.visible = false;
|
2011-06-24 18:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
//our main interaction view
|
|
|
|
|
Flickable {
|
|
|
|
|
id: flick
|
|
|
|
|
anchors.top: parent.top
|
2011-06-20 18:11:17 +02:00
|
|
|
anchors.topMargin: labels.y
|
2011-03-11 12:22:57 +01:00
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.left: labels.right
|
|
|
|
|
anchors.bottom: canvas.top
|
|
|
|
|
contentWidth: view.totalWidth
|
2011-06-09 14:54:56 +02:00
|
|
|
contentHeight: height
|
2011-05-17 18:03:59 +02:00
|
|
|
flickableDirection: Flickable.HorizontalFlick
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2011-06-10 16:21:10 +02:00
|
|
|
clip:true
|
|
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
TimelineView {
|
|
|
|
|
id: view
|
|
|
|
|
|
2011-07-26 13:56:14 +02:00
|
|
|
eventList: qmlEventList;
|
|
|
|
|
onEventListChanged: Plotter.qmlEventList = qmlEventList;
|
|
|
|
|
|
2011-05-17 18:03:59 +02:00
|
|
|
width: flick.width;
|
2011-06-09 14:54:56 +02:00
|
|
|
height: flick.contentHeight;
|
2011-03-11 12:22:57 +01:00
|
|
|
|
|
|
|
|
startX: flick.contentX
|
|
|
|
|
onStartXChanged: {
|
|
|
|
|
var newX = startTime / Plotter.xScale(canvas) - canvas.canvasWindow.x;
|
|
|
|
|
if (Math.abs(rangeMover.x - newX) > .01)
|
|
|
|
|
rangeMover.x = newX
|
|
|
|
|
if (Math.abs(startX - flick.contentX) > .01)
|
|
|
|
|
flick.contentX = startX
|
|
|
|
|
}
|
|
|
|
|
startTime: rangeMover.value
|
2011-06-27 18:25:50 +02:00
|
|
|
endTime: startTime + (rangeMover.zoomWidth*Plotter.xScale(canvas))
|
2011-09-23 15:58:41 +02:00
|
|
|
onEndTimeChanged: {
|
|
|
|
|
updateTimeline();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
property real timeSpan: endTime - startTime
|
|
|
|
|
onTimeSpanChanged: {
|
|
|
|
|
if (selectedEventIndex != -1 && selectionHighlight.visible) {
|
|
|
|
|
var spacing = flick.width / timeSpan;
|
|
|
|
|
selectionHighlight.x = (qmlEventList.getStartTime(selectedEventIndex) - qmlEventList.firstTimeMark()) * spacing;
|
|
|
|
|
selectionHighlight.width = qmlEventList.getDuration(selectedEventIndex) * spacing;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2011-07-26 13:56:14 +02:00
|
|
|
onCachedProgressChanged: root.progress = 0.5 + cachedProgress * 0.5;
|
|
|
|
|
onCacheReady: {
|
|
|
|
|
root.progress = 1.0;
|
|
|
|
|
root.dataAvailable = true;
|
|
|
|
|
if (root.eventCount > 0) {
|
|
|
|
|
view.visible = true;
|
|
|
|
|
view.updateTimeline();
|
|
|
|
|
canvas.requestPaint();
|
|
|
|
|
rangeMover.x = 1 //### hack to get view to display things immediately
|
|
|
|
|
rangeMover.x = 0
|
|
|
|
|
rangeMover.opacity = 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
delegate: Rectangle {
|
|
|
|
|
id: obj
|
2011-09-23 15:58:41 +02:00
|
|
|
property color myColor: Plotter.colors[type]
|
2011-03-11 12:22:57 +01:00
|
|
|
|
|
|
|
|
function conditionalHide() {
|
|
|
|
|
if (!mouseArea.containsMouse)
|
|
|
|
|
mouseArea.exited()
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-27 17:12:25 +02:00
|
|
|
property int baseY: type * view.height / labels.rowCount;
|
|
|
|
|
property int baseHeight: view.height / labels.rowCount
|
|
|
|
|
y: baseY + (nestingLevel-1)*(baseHeight / nestingDepth);
|
|
|
|
|
height: baseHeight / nestingDepth;
|
2011-03-11 12:22:57 +01:00
|
|
|
gradient: Gradient {
|
|
|
|
|
GradientStop { position: 0.0; color: myColor }
|
|
|
|
|
GradientStop { position: 0.5; color: Qt.darker(myColor, 1.1) }
|
|
|
|
|
GradientStop { position: 1.0; color: myColor }
|
|
|
|
|
}
|
|
|
|
|
smooth: true
|
2011-06-24 18:19:08 +02:00
|
|
|
|
|
|
|
|
property bool componentIsCompleted: false
|
2011-06-24 18:19:08 +02:00
|
|
|
Component.onCompleted: {
|
|
|
|
|
componentIsCompleted = true;
|
|
|
|
|
updateDetails();
|
|
|
|
|
}
|
2011-06-24 18:19:08 +02:00
|
|
|
|
|
|
|
|
property bool isSelected: root.selectedEventIndex == index;
|
2011-06-24 18:19:08 +02:00
|
|
|
onIsSelectedChanged: updateDetails();
|
|
|
|
|
function updateDetails() {
|
2011-06-24 18:19:08 +02:00
|
|
|
if (!root.mouseTracking && componentIsCompleted) {
|
|
|
|
|
if (isSelected) {
|
|
|
|
|
enableSelected(0, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function enableSelected(x,y) {
|
2011-07-26 13:56:14 +02:00
|
|
|
rangeDetails.duration = qmlEventList.getDuration(index)/1000.0;
|
|
|
|
|
rangeDetails.label = qmlEventList.getDetails(index);
|
|
|
|
|
rangeDetails.file = qmlEventList.getFilename(index);
|
|
|
|
|
rangeDetails.line = qmlEventList.getLine(index);
|
2011-06-24 18:19:08 +02:00
|
|
|
rangeDetails.type = Plotter.names[type]
|
|
|
|
|
|
|
|
|
|
rangeDetails.visible = true
|
|
|
|
|
|
2011-09-23 15:58:41 +02:00
|
|
|
selectionHighlight.x = obj.x;
|
|
|
|
|
selectionHighlight.y = obj.y;
|
|
|
|
|
selectionHighlight.width = width;
|
|
|
|
|
selectionHighlight.height = height;
|
|
|
|
|
selectionHighlight.visible = true;
|
2011-06-24 18:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
MouseArea {
|
|
|
|
|
id: mouseArea
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
onEntered: {
|
2011-09-23 15:58:41 +02:00
|
|
|
if (root.mouseOverSelection) {
|
|
|
|
|
root.mouseTracking = true;
|
|
|
|
|
root.selectedEventIndex = index;
|
|
|
|
|
enableSelected(mouseX, y);
|
|
|
|
|
root.mouseTracking = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPressed: {
|
2011-06-24 18:19:08 +02:00
|
|
|
root.mouseTracking = true;
|
|
|
|
|
root.selectedEventIndex = index;
|
|
|
|
|
enableSelected(mouseX, y);
|
|
|
|
|
root.mouseTracking = false;
|
|
|
|
|
|
2011-09-23 15:58:41 +02:00
|
|
|
root.mouseOverSelection = false;
|
|
|
|
|
root.gotoSourceLocation(rangeDetails.file, rangeDetails.line);
|
|
|
|
|
}
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
}
|
2011-09-23 15:58:41 +02:00
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: selectionHighlight
|
|
|
|
|
color:"transparent"
|
|
|
|
|
border.width: 2
|
|
|
|
|
border.color: "blue"
|
|
|
|
|
radius: 2
|
|
|
|
|
visible: false
|
|
|
|
|
z:1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
width: parent.width
|
|
|
|
|
height: parent.height
|
|
|
|
|
x: flick.contentX
|
|
|
|
|
onClicked: root.hideRangeDetails();
|
|
|
|
|
}
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//popup showing the details for the hovered range
|
|
|
|
|
RangeDetails {
|
|
|
|
|
id: rangeDetails
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: labels
|
|
|
|
|
width: 150
|
|
|
|
|
color: "#dcdcdc"
|
2011-06-24 18:19:08 +02:00
|
|
|
y: 24
|
2011-06-20 18:11:17 +02:00
|
|
|
height: flick.height
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2011-06-09 14:54:56 +02:00
|
|
|
property int rowCount: 5
|
|
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
Column {
|
2011-06-09 14:54:56 +02:00
|
|
|
id: col
|
2011-03-11 12:22:57 +01:00
|
|
|
//### change to use Repeater + Plotter.names?
|
2011-08-18 15:17:53 +02:00
|
|
|
Label { text: qsTr("Painting"); height: labels.height/labels.rowCount}
|
|
|
|
|
Label { text: qsTr("Compiling"); height: labels.height/labels.rowCount }
|
|
|
|
|
Label { text: qsTr("Creating"); height: labels.height/labels.rowCount }
|
|
|
|
|
Label { text: qsTr("Binding"); height: labels.height/labels.rowCount }
|
|
|
|
|
Label { text: qsTr("Signal Handler"); height: labels.height/labels.rowCount }
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//right border divider
|
|
|
|
|
Rectangle {
|
|
|
|
|
width: 1
|
|
|
|
|
height: parent.height
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
color: "#cccccc"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//bottom border divider
|
|
|
|
|
Rectangle {
|
|
|
|
|
height: 1
|
|
|
|
|
width: parent.width
|
|
|
|
|
anchors.bottom: canvas.top
|
|
|
|
|
color: "#cccccc"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//"overview" graph at the bottom
|
|
|
|
|
TiledCanvas {
|
|
|
|
|
id: canvas
|
|
|
|
|
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
width: parent.width; height: 50
|
|
|
|
|
|
|
|
|
|
property int canvasWidth: width
|
|
|
|
|
|
|
|
|
|
canvasSize {
|
|
|
|
|
width: canvasWidth
|
|
|
|
|
height: canvas.height
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tileSize.width: width
|
|
|
|
|
tileSize.height: height
|
|
|
|
|
|
|
|
|
|
canvasWindow.width: width
|
2011-06-20 18:11:17 +02:00
|
|
|
canvasWindow.height: height
|
2011-03-11 12:22:57 +01:00
|
|
|
|
|
|
|
|
onDrawRegion: {
|
2011-07-05 15:50:32 +02:00
|
|
|
if (root.dataAvailable)
|
2011-03-11 12:22:57 +01:00
|
|
|
Plotter.plot(canvas, ctxt, region);
|
|
|
|
|
else
|
|
|
|
|
Plotter.drawGraph(canvas, ctxt, region) //just draw the background
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//moves the range mover to the position of a click
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: canvas
|
|
|
|
|
//### ideally we could press to position then immediately drag
|
2011-06-27 18:25:50 +02:00
|
|
|
onPressed: rangeMover.x = mouse.x - rangeMover.zoomWidth/2
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RangeMover {
|
|
|
|
|
id: rangeMover
|
|
|
|
|
opacity: 0
|
|
|
|
|
anchors.top: canvas.top
|
|
|
|
|
}
|
2011-06-27 18:33:20 +02:00
|
|
|
|
|
|
|
|
// the next elements are here because I want them rendered on top of the other
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: timeDisplayLabel
|
|
|
|
|
color: "lightsteelblue"
|
|
|
|
|
border.color: Qt.darker(color)
|
|
|
|
|
border.width: 1
|
|
|
|
|
radius: 2
|
|
|
|
|
height: Math.max(labels.y-2, timeDisplayText.height);
|
|
|
|
|
y: timeDisplayEnd.visible ? flick.height - 1 : 1
|
|
|
|
|
width: timeDisplayText.width + 10 + ( timeDisplayEnd.visible ? timeDisplayCloseControl.width + 10 : 0 )
|
|
|
|
|
visible: false
|
|
|
|
|
|
|
|
|
|
function hideAll() {
|
|
|
|
|
timeDisplayBegin.visible = false;
|
|
|
|
|
timeDisplayEnd.visible = false;
|
|
|
|
|
timeDisplayLabel.visible = false;
|
|
|
|
|
}
|
|
|
|
|
Text {
|
|
|
|
|
id: timeDisplayText
|
|
|
|
|
x: 5
|
|
|
|
|
y: parent.height/2 - height/2 + 1
|
|
|
|
|
font.pointSize: 8
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
id: timeDisplayCloseControl
|
|
|
|
|
text:"X"
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.rightMargin: 3
|
|
|
|
|
y: parent.height/2 - height/2 + 1
|
|
|
|
|
visible: timeDisplayEnd.visible
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
onClicked: {
|
|
|
|
|
timeDisplayLabel.hideAll();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: timeDisplayBegin
|
|
|
|
|
width: 1
|
|
|
|
|
color: Qt.rgba(0,0,64,0.7);
|
|
|
|
|
height: flick.height + labels.y
|
|
|
|
|
visible: false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: timeDisplayEnd
|
|
|
|
|
width: 1
|
|
|
|
|
color: Qt.rgba(0,0,64,0.7);
|
|
|
|
|
height: flick.height + labels.y
|
|
|
|
|
visible: false
|
|
|
|
|
}
|
2011-07-11 16:05:37 +02:00
|
|
|
|
|
|
|
|
StatusDisplay {
|
|
|
|
|
anchors.centerIn: flick
|
|
|
|
|
}
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|