2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
2014-10-01 13:21:18 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2011-03-25 09:25:17 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-03-25 09:25:17 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-03-25 09:25:17 +01:00
|
|
|
|
2013-09-03 12:53:48 +02:00
|
|
|
import QtQuick 2.1
|
2011-03-11 12:22:57 +01:00
|
|
|
import Monitor 1.0
|
2013-11-12 12:44:54 +01:00
|
|
|
import QtQuick.Controls 1.0
|
2011-03-11 12:22:57 +01:00
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: root
|
|
|
|
|
|
2011-10-11 17:52:39 +02:00
|
|
|
// ***** properties
|
|
|
|
|
|
2011-10-26 11:32:01 +02:00
|
|
|
property alias selectionLocked : view.selectionLocked
|
2011-11-09 12:57:41 +01:00
|
|
|
property bool lockItemSelection : false
|
2011-09-23 15:58:41 +02:00
|
|
|
|
2014-10-14 16:44:45 +02:00
|
|
|
property real mainviewTimePerPixel: zoomControl.rangeDuration / root.width
|
2011-10-11 17:52:39 +02:00
|
|
|
|
2011-03-11 12:22:57 +01:00
|
|
|
signal updateCursorPosition
|
|
|
|
|
property string fileName: ""
|
|
|
|
|
property int lineNumber: -1
|
2012-01-12 16:36:40 +01:00
|
|
|
property int columnNumber: 0
|
2014-09-29 16:24:34 +02:00
|
|
|
property int typeId: -1
|
2011-10-11 17:52:39 +02:00
|
|
|
|
2011-10-19 14:28:21 +02:00
|
|
|
property bool selectionRangeMode: false
|
|
|
|
|
|
2011-11-08 16:54:23 +01:00
|
|
|
property bool selectionRangeReady: selectionRange.ready
|
2013-09-03 12:56:29 +02:00
|
|
|
property real selectionRangeStart: selectionRange.startTime
|
|
|
|
|
property real selectionRangeEnd: selectionRange.startTime + selectionRange.duration
|
2011-11-08 16:54:23 +01:00
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
color: "#dcdcdc"
|
|
|
|
|
|
2011-10-11 17:52:39 +02:00
|
|
|
// ***** connections with external objects
|
|
|
|
|
Connections {
|
|
|
|
|
target: zoomControl
|
|
|
|
|
onRangeChanged: {
|
2014-10-14 16:44:45 +02:00
|
|
|
backgroundMarks.updateMarks(zoomControl.rangeStart, zoomControl.rangeEnd);
|
|
|
|
|
zoomSliderToolBar.updateZoomLevel();
|
2014-03-28 16:11:16 +01:00
|
|
|
view.updateWindow();
|
|
|
|
|
}
|
|
|
|
|
onWindowChanged: {
|
|
|
|
|
view.updateWindow();
|
2011-10-11 17:52:39 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2011-10-11 17:52:39 +02:00
|
|
|
Connections {
|
2013-08-08 13:28:08 +02:00
|
|
|
target: qmlProfilerModelProxy
|
|
|
|
|
onDataAvailable: {
|
|
|
|
|
view.clearData();
|
2014-10-14 16:44:45 +02:00
|
|
|
zoomControl.setRange(zoomControl.traceStart,
|
|
|
|
|
zoomControl.traceStart + zoomControl.traceDuration / 10);
|
2014-03-25 17:10:25 +01:00
|
|
|
view.requestPaint();
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
2014-07-08 12:49:56 +02:00
|
|
|
onStateChanged: backgroundMarks.requestPaint()
|
2014-08-27 12:11:26 +02:00
|
|
|
onModelsChanged: backgroundMarks.requestPaint()
|
2014-06-23 17:08:15 +02:00
|
|
|
onExpandedChanged: backgroundMarks.requestPaint()
|
|
|
|
|
onRowHeightChanged: backgroundMarks.requestPaint()
|
2011-10-11 17:52:39 +02:00
|
|
|
}
|
|
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2011-10-11 17:52:39 +02:00
|
|
|
// ***** functions
|
2012-01-12 16:36:40 +01:00
|
|
|
function gotoSourceLocation(file,line,column) {
|
2013-08-08 13:28:08 +02:00
|
|
|
if (file !== undefined) {
|
|
|
|
|
root.fileName = file;
|
|
|
|
|
root.lineNumber = line;
|
|
|
|
|
root.columnNumber = column;
|
|
|
|
|
}
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|
|
|
|
|
|
2014-03-25 17:10:25 +01:00
|
|
|
function clear() {
|
|
|
|
|
flick.contentY = 0;
|
|
|
|
|
flick.contentX = 0;
|
|
|
|
|
flick.contentWidth = 0;
|
2011-04-06 16:04:18 +02:00
|
|
|
view.clearData();
|
2014-09-25 12:50:10 +02:00
|
|
|
rangeDetails.hide();
|
2011-11-16 16:08:05 +01:00
|
|
|
selectionRangeMode = false;
|
2014-06-04 18:23:07 +02:00
|
|
|
buttonsBar.updateRangeButton(selectionRangeMode);
|
2014-03-25 17:10:25 +01:00
|
|
|
zoomSlider.externalUpdate = true;
|
|
|
|
|
zoomSlider.value = zoomSlider.minimumValue;
|
2014-06-04 18:23:07 +02:00
|
|
|
overview.clear();
|
|
|
|
|
timeDisplay.clear();
|
2011-06-24 18:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
2014-06-04 18:23:07 +02:00
|
|
|
function enableButtonsBar(enable) {
|
|
|
|
|
buttonsBar.enabled = enable;
|
2011-06-24 18:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
2011-10-19 14:28:21 +02:00
|
|
|
function recenter( centerPoint ) {
|
2014-10-14 16:44:45 +02:00
|
|
|
var newStart = Math.floor(centerPoint - zoomControl.rangeDuration / 2);
|
|
|
|
|
zoomControl.setRange(Math.max(newStart, zoomControl.traceStart),
|
|
|
|
|
Math.min(newStart + zoomControl.rangeDuration, zoomControl.traceEnd));
|
2011-10-19 14:28:21 +02:00
|
|
|
}
|
|
|
|
|
|
2014-03-26 11:25:10 +01:00
|
|
|
function recenterOnItem(modelIndex, itemIndex)
|
2011-11-03 16:15:50 +01:00
|
|
|
{
|
2011-11-09 12:57:41 +01:00
|
|
|
if (itemIndex === -1)
|
|
|
|
|
return;
|
|
|
|
|
|
2011-11-03 16:15:50 +01:00
|
|
|
// if item is outside of the view, jump back to its position
|
2014-10-14 16:44:45 +02:00
|
|
|
if (qmlProfilerModelProxy.endTime(modelIndex, itemIndex) < zoomControl.rangeStart ||
|
|
|
|
|
qmlProfilerModelProxy.startTime(modelIndex, itemIndex) > zoomControl.rangeEnd) {
|
2014-07-08 14:43:15 +02:00
|
|
|
recenter((qmlProfilerModelProxy.startTime(modelIndex, itemIndex) +
|
|
|
|
|
qmlProfilerModelProxy.endTime(modelIndex, itemIndex)) / 2);
|
2011-11-03 16:15:50 +01:00
|
|
|
}
|
2014-09-29 16:49:31 +02:00
|
|
|
var row = qmlProfilerModelProxy.row(modelIndex, itemIndex);
|
|
|
|
|
var totalRowOffset = qmlProfilerModelProxy.modelOffset(modelIndex) +
|
|
|
|
|
qmlProfilerModelProxy.rowOffset(modelIndex, row);
|
|
|
|
|
if (totalRowOffset > flick.contentY + flick.height ||
|
|
|
|
|
totalRowOffset + qmlProfilerModelProxy.rowHeight(modelIndex, row) < flick.contentY)
|
|
|
|
|
flick.contentY = Math.min(flick.contentHeight - flick.height,
|
|
|
|
|
Math.max(0, totalRowOffset - flick.height / 2));
|
2011-11-03 16:15:50 +01:00
|
|
|
}
|
|
|
|
|
|
2014-08-29 16:32:42 +02:00
|
|
|
function selectBySelectionId(modelIndex, selectionId)
|
2011-11-09 12:57:41 +01:00
|
|
|
{
|
2014-09-29 12:34:54 +02:00
|
|
|
if (selectionId === -1 || (modelIndex === view.selectedModel && view.selectedItem !== -1 &&
|
2014-08-29 16:32:42 +02:00
|
|
|
selectionId === qmlProfilerModelProxy.selectionId(modelIndex, view.selectedItem)))
|
2014-04-03 11:15:56 +02:00
|
|
|
return;
|
|
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
// this is a slot responding to events from the other pane
|
|
|
|
|
// which tracks only events from the basic model
|
2011-11-09 12:57:41 +01:00
|
|
|
if (!lockItemSelection) {
|
|
|
|
|
lockItemSelection = true;
|
2014-09-29 18:20:26 +02:00
|
|
|
var itemIndex = -1;
|
|
|
|
|
var notes = qmlProfilerModelProxy.notesByTypeId(selectionId);
|
|
|
|
|
if (notes.length !== 0) {
|
|
|
|
|
itemIndex = qmlProfilerModelProxy.noteTimelineIndex(notes[0]);
|
|
|
|
|
// for some models typeId != selectionId. In that case we cannot select the noted
|
|
|
|
|
// events. This is purely theoretical as their data doesn't show up in the events
|
|
|
|
|
// view so that we cannot receive a selection event for them.
|
|
|
|
|
if (qmlProfilerModelProxy.typeId(modelIndex, itemIndex) !== selectionId)
|
|
|
|
|
itemIndex = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (itemIndex === -1)
|
|
|
|
|
itemIndex = view.nextItemFromSelectionId(modelIndex, selectionId);
|
2011-11-09 12:57:41 +01:00
|
|
|
// select an item, lock to it, and recenter if necessary
|
2014-08-29 16:32:42 +02:00
|
|
|
view.selectFromEventIndex(modelIndex, itemIndex); // triggers recentering
|
2014-03-26 11:47:52 +01:00
|
|
|
if (itemIndex !== -1)
|
|
|
|
|
view.selectionLocked = true;
|
2011-11-09 12:57:41 +01:00
|
|
|
lockItemSelection = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-11 17:52:39 +02:00
|
|
|
// ***** slots
|
2011-10-19 14:28:21 +02:00
|
|
|
onSelectionRangeModeChanged: {
|
|
|
|
|
selectionRangeControl.enabled = selectionRangeMode;
|
2014-02-20 15:22:22 +01:00
|
|
|
selectionRange.reset();
|
2014-06-04 18:23:07 +02:00
|
|
|
buttonsBar.updateRangeButton(selectionRangeMode);
|
2011-10-19 14:28:21 +02:00
|
|
|
}
|
|
|
|
|
|
2011-10-26 11:32:01 +02:00
|
|
|
onSelectionLockedChanged: {
|
2014-06-04 18:23:07 +02:00
|
|
|
buttonsBar.updateLockButton(selectionLocked);
|
2011-10-26 11:32:01 +02:00
|
|
|
}
|
|
|
|
|
|
2014-06-23 15:46:40 +02:00
|
|
|
focus: true
|
|
|
|
|
property bool shiftPressed: false;
|
|
|
|
|
Keys.onPressed: shiftPressed = (event.key === Qt.Key_Shift);
|
|
|
|
|
Keys.onReleased: shiftPressed = false;
|
|
|
|
|
|
2013-11-08 12:05:18 +01:00
|
|
|
Flickable {
|
2014-02-27 12:14:45 +01:00
|
|
|
id: labelsflick
|
2013-11-08 12:05:18 +01:00
|
|
|
flickableDirection: Flickable.VerticalFlick
|
2014-02-27 12:14:45 +01:00
|
|
|
interactive: false
|
2014-06-04 18:23:07 +02:00
|
|
|
anchors.top: buttonsBar.bottom
|
|
|
|
|
anchors.bottom: overview.top
|
2014-02-27 12:14:45 +01:00
|
|
|
anchors.left: parent.left
|
|
|
|
|
width: labels.width
|
|
|
|
|
contentY: flick.contentY
|
|
|
|
|
|
2014-03-04 17:56:14 +01:00
|
|
|
// reserve some more space than needed to prevent weird effects when resizing
|
|
|
|
|
contentHeight: labels.height + height
|
|
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
Rectangle {
|
|
|
|
|
id: labels
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
width: 150
|
|
|
|
|
color: root.color
|
|
|
|
|
height: col.height
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
property int rowCount: qmlProfilerModelProxy.modelCount();
|
2014-02-27 12:14:45 +01:00
|
|
|
|
|
|
|
|
Column {
|
|
|
|
|
id: col
|
2014-08-27 12:11:26 +02:00
|
|
|
|
|
|
|
|
// Dispatch the cursor shape to all labels. When dragging the DropArea receiving
|
|
|
|
|
// the drag events is not necessarily related to the MouseArea receiving the mouse
|
|
|
|
|
// events, so we can't use the drag events to determine the cursor shape.
|
|
|
|
|
property bool dragging: false
|
|
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
Repeater {
|
|
|
|
|
model: labels.rowCount
|
2014-06-23 15:46:40 +02:00
|
|
|
delegate: CategoryLabel {
|
2014-08-27 12:11:26 +02:00
|
|
|
dragging: col.dragging
|
2014-06-23 15:46:40 +02:00
|
|
|
reverseSelect: root.shiftPressed
|
2014-08-27 12:11:26 +02:00
|
|
|
onDragStarted: col.dragging = true
|
|
|
|
|
onDragStopped: col.dragging = false
|
|
|
|
|
draggerParent: labels
|
2014-06-23 15:46:40 +02:00
|
|
|
}
|
2014-02-27 12:14:45 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// border between labels and timeline
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: labelsborder
|
|
|
|
|
anchors.left: labelsflick.right
|
|
|
|
|
anchors.top: parent.top
|
2014-06-04 18:23:07 +02:00
|
|
|
anchors.bottom: overview.top
|
2014-02-27 12:14:45 +01:00
|
|
|
width: 1
|
|
|
|
|
color: "#858585"
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-04 18:23:07 +02:00
|
|
|
ButtonsBar {
|
|
|
|
|
id: buttonsBar
|
|
|
|
|
enabled: false
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
width: 150
|
|
|
|
|
height: 24
|
|
|
|
|
onZoomControlChanged: zoomSliderToolBar.visible = !zoomSliderToolBar.visible
|
2014-09-11 11:44:27 +02:00
|
|
|
onFilterMenuChanged: filterMenu.visible = !filterMenu.visible
|
2014-06-04 18:23:07 +02:00
|
|
|
onJumpToNext: view.selectNext();
|
|
|
|
|
onJumpToPrev: view.selectPrev();
|
|
|
|
|
onRangeSelectChanged: selectionRangeMode = rangeButtonChecked();
|
|
|
|
|
onLockChanged: selectionLocked = !lockButtonChecked();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TimeDisplay {
|
|
|
|
|
id: timeDisplay
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: labelsborder.right
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
height: 24
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
Flickable {
|
|
|
|
|
id: flick
|
2013-11-08 12:05:18 +01:00
|
|
|
contentHeight: labels.height
|
2014-10-14 16:44:45 +02:00
|
|
|
contentWidth: zoomControl.windowDuration * width / Math.max(1, zoomControl.rangeDuration)
|
2014-02-27 12:14:45 +01:00
|
|
|
flickableDirection: Flickable.HorizontalAndVerticalFlick
|
2013-11-14 13:06:44 +01:00
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
2014-02-27 12:14:45 +01:00
|
|
|
clip:true
|
2013-11-14 13:06:44 +01:00
|
|
|
|
|
|
|
|
// ScrollView will try to deinteractivate it. We don't want that
|
2013-11-20 15:57:07 +01:00
|
|
|
// 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
|
2012-02-24 10:47:17 +01:00
|
|
|
|
2013-11-11 16:55:15 +01:00
|
|
|
// ***** child items
|
|
|
|
|
TimeMarks {
|
|
|
|
|
id: backgroundMarks
|
2014-02-27 12:14:45 +01:00
|
|
|
y: flick.contentY
|
|
|
|
|
x: flick.contentX
|
|
|
|
|
height: flick.height
|
|
|
|
|
width: scroller.width
|
2011-10-11 17:52:39 +02:00
|
|
|
}
|
|
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
SelectionRange {
|
|
|
|
|
id: selectionRange
|
|
|
|
|
visible: root.selectionRangeMode && creationState !== 0
|
|
|
|
|
z: 2
|
|
|
|
|
}
|
2011-09-23 15:58:41 +02:00
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
TimelineRenderer {
|
|
|
|
|
id: view
|
2011-06-24 18:19:08 +02:00
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
profilerModelProxy: qmlProfilerModelProxy
|
2014-10-14 16:44:45 +02:00
|
|
|
zoomer: zoomControl
|
2011-06-24 18:19:08 +02:00
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
x: flick.contentX
|
|
|
|
|
y: flick.contentY
|
2011-06-24 18:19:08 +02:00
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
// paint "under" the vertical scrollbar, so that it always matches with the timemarks
|
|
|
|
|
width: scroller.width
|
|
|
|
|
height: flick.height
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
onYChanged: requestPaint()
|
|
|
|
|
onHeightChanged: requestPaint()
|
2014-03-03 14:04:50 +01:00
|
|
|
property bool recursionGuard: false
|
2011-10-19 14:28:21 +02:00
|
|
|
|
2014-07-10 12:19:36 +02:00
|
|
|
property int intX: x
|
|
|
|
|
property int intWidth: width
|
|
|
|
|
onIntXChanged: {
|
2014-03-03 14:04:50 +01:00
|
|
|
if (recursionGuard)
|
|
|
|
|
return;
|
|
|
|
|
|
2014-10-14 16:44:45 +02:00
|
|
|
recursionGuard = true;
|
|
|
|
|
|
|
|
|
|
var newStartTime = intX * zoomControl.rangeDuration / intWidth +
|
|
|
|
|
zoomControl.windowStart;
|
|
|
|
|
if (Math.abs(newStartTime - zoomControl.rangeStart) >= 1) {
|
|
|
|
|
var newEndTime = (intX + intWidth) * zoomControl.rangeDuration / intWidth +
|
|
|
|
|
zoomControl.windowStart;
|
2014-02-27 12:14:45 +01:00
|
|
|
zoomControl.setRange(newStartTime, newEndTime);
|
2013-11-11 16:55:15 +01:00
|
|
|
}
|
2014-10-14 16:44:45 +02:00
|
|
|
recursionGuard = false;
|
2011-10-26 11:32:01 +02:00
|
|
|
}
|
2014-02-27 12:14:45 +01:00
|
|
|
|
2014-03-28 16:11:16 +01:00
|
|
|
function updateWindow() {
|
2014-10-14 16:44:45 +02:00
|
|
|
if (recursionGuard || zoomControl.rangeDuration <= 0)
|
2014-03-03 14:04:50 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
recursionGuard = true;
|
|
|
|
|
|
2014-10-14 16:44:45 +02:00
|
|
|
// This triggers an unwanted automatic change in contentX. We ignore that by
|
|
|
|
|
// checking recursionGuard in this function and in updateZoomControl.
|
|
|
|
|
flick.contentWidth = zoomControl.windowDuration * intWidth /
|
|
|
|
|
zoomControl.rangeDuration;
|
2014-03-03 14:04:50 +01:00
|
|
|
|
2014-10-14 16:44:45 +02:00
|
|
|
var newStartX = (zoomControl.rangeStart - zoomControl.windowStart) * intWidth /
|
|
|
|
|
zoomControl.rangeDuration;
|
|
|
|
|
|
|
|
|
|
if (isFinite(newStartX) && Math.abs(newStartX - flick.contentX) >= 1)
|
|
|
|
|
flick.contentX = newStartX;
|
2014-03-03 14:04:50 +01:00
|
|
|
|
|
|
|
|
recursionGuard = false;
|
2011-10-19 14:28:21 +02:00
|
|
|
}
|
2011-03-11 12:22:57 +01:00
|
|
|
|
2014-03-26 11:47:52 +01:00
|
|
|
onSelectionChanged: {
|
2014-02-27 12:14:45 +01:00
|
|
|
if (selectedItem !== -1) {
|
|
|
|
|
// display details
|
2014-09-25 12:50:10 +02:00
|
|
|
rangeDetails.showInfo(selectedModel, selectedItem);
|
2013-11-11 16:55:15 +01:00
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
// center view (horizontally)
|
2014-03-26 11:41:46 +01:00
|
|
|
recenterOnItem(selectedModel, selectedItem);
|
2014-03-26 11:36:13 +01:00
|
|
|
if (!lockItemSelection) {
|
|
|
|
|
lockItemSelection = true;
|
|
|
|
|
// update in other views
|
2014-07-08 14:43:15 +02:00
|
|
|
var eventLocation = qmlProfilerModelProxy.location(view.selectedModel,
|
|
|
|
|
view.selectedItem);
|
2014-03-26 11:36:13 +01:00
|
|
|
gotoSourceLocation(eventLocation.file, eventLocation.line,
|
|
|
|
|
eventLocation.column);
|
2014-09-29 16:24:34 +02:00
|
|
|
root.typeId = qmlProfilerModelProxy.typeId(view.selectedModel,
|
|
|
|
|
view.selectedItem);
|
|
|
|
|
root.updateCursorPosition();
|
2014-03-26 11:36:13 +01:00
|
|
|
lockItemSelection = false;
|
2014-02-27 12:14:45 +01:00
|
|
|
}
|
|
|
|
|
} else {
|
2014-09-25 12:50:10 +02:00
|
|
|
rangeDetails.hide();
|
2013-11-11 16:55:15 +01:00
|
|
|
}
|
2011-10-11 17:52:39 +02:00
|
|
|
}
|
2011-07-11 16:05:37 +02:00
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
onItemPressed: {
|
2014-07-08 14:43:15 +02:00
|
|
|
var location = qmlProfilerModelProxy.location(modelIndex, pressedItem);
|
2014-02-27 12:14:45 +01:00
|
|
|
if (location.hasOwnProperty("file")) // not empty
|
|
|
|
|
root.gotoSourceLocation(location.file, location.line, location.column);
|
2014-09-29 16:24:34 +02:00
|
|
|
root.typeId = qmlProfilerModelProxy.typeId(modelIndex, pressedItem);
|
|
|
|
|
root.updateCursorPosition();
|
2014-02-27 12:14:45 +01:00
|
|
|
}
|
2013-11-11 16:55:15 +01:00
|
|
|
|
2014-02-27 12:14:45 +01:00
|
|
|
// hack to pass mouse events to the other mousearea if enabled
|
2014-07-08 14:46:17 +02:00
|
|
|
startDragArea: selectionRange.ready ? selectionRange.rangeLeft : -x
|
|
|
|
|
endDragArea: selectionRange.ready ? selectionRange.rangeRight : -x - 1
|
2014-02-27 12:14:45 +01:00
|
|
|
}
|
|
|
|
|
MouseArea {
|
|
|
|
|
id: selectionRangeControl
|
|
|
|
|
enabled: false
|
|
|
|
|
width: flick.width
|
|
|
|
|
height: flick.height
|
|
|
|
|
x: flick.contentX
|
|
|
|
|
y: flick.contentY
|
|
|
|
|
hoverEnabled: enabled
|
|
|
|
|
z: 2
|
|
|
|
|
|
|
|
|
|
onReleased: {
|
|
|
|
|
selectionRange.releasedOnCreation();
|
|
|
|
|
}
|
|
|
|
|
onPressed: {
|
|
|
|
|
selectionRange.pressedOnCreation();
|
|
|
|
|
}
|
|
|
|
|
onCanceled: {
|
|
|
|
|
selectionRange.releasedOnCreation();
|
|
|
|
|
}
|
|
|
|
|
onPositionChanged: {
|
|
|
|
|
selectionRange.movedOnCreation();
|
|
|
|
|
}
|
2011-11-16 16:08:05 +01:00
|
|
|
}
|
|
|
|
|
}
|
2013-11-08 12:05:18 +01:00
|
|
|
|
2013-11-14 13:06:44 +01:00
|
|
|
ScrollView {
|
2014-02-27 12:14:45 +01:00
|
|
|
id: scroller
|
|
|
|
|
contentItem: flick
|
|
|
|
|
anchors.left: labelsborder.right
|
2014-06-04 18:23:07 +02:00
|
|
|
anchors.top: timeDisplay.bottom
|
|
|
|
|
anchors.bottom: overview.top
|
2014-02-27 12:14:45 +01:00
|
|
|
anchors.right: parent.right
|
2013-11-14 13:06:44 +01:00
|
|
|
}
|
|
|
|
|
|
2013-11-08 12:05:18 +01:00
|
|
|
SelectionRangeDetails {
|
|
|
|
|
id: selectionRangeDetails
|
2014-02-20 15:22:22 +01:00
|
|
|
visible: selectionRange.visible
|
2013-11-08 12:05:18 +01:00
|
|
|
startTime: selectionRange.startTimeString
|
|
|
|
|
duration: selectionRange.durationString
|
|
|
|
|
endTime: selectionRange.endTimeString
|
2014-07-08 14:46:17 +02:00
|
|
|
showDuration: selectionRange.rangeWidth > 1
|
2013-11-08 12:05:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RangeDetails {
|
|
|
|
|
id: rangeDetails
|
|
|
|
|
}
|
2011-11-16 16:08:05 +01:00
|
|
|
|
2014-09-11 11:44:27 +02:00
|
|
|
Rectangle {
|
|
|
|
|
id: filterMenu
|
|
|
|
|
color: "#9b9b9b"
|
|
|
|
|
enabled: buttonsBar.enabled
|
|
|
|
|
visible: false
|
|
|
|
|
width: labels.width
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.top: buttonsBar.bottom
|
|
|
|
|
height: qmlProfilerModelProxy.modelCount() * buttonsBar.height
|
|
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
|
id: filterMenuInner
|
|
|
|
|
model: qmlProfilerModelProxy.models
|
|
|
|
|
CheckBox {
|
|
|
|
|
anchors.left: filterMenu.left
|
|
|
|
|
anchors.right: filterMenu.right
|
|
|
|
|
height: buttonsBar.height
|
|
|
|
|
y: index * height
|
|
|
|
|
text: qmlProfilerModelProxy.models[index].displayName
|
|
|
|
|
enabled: !qmlProfilerModelProxy.models[index].empty
|
|
|
|
|
checked: enabled && !qmlProfilerModelProxy.models[index].hidden
|
|
|
|
|
onCheckedChanged: qmlProfilerModelProxy.models[index].hidden = !checked
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-12 12:44:54 +01:00
|
|
|
Rectangle {
|
2014-06-04 18:23:07 +02:00
|
|
|
id: zoomSliderToolBar
|
2013-11-12 12:44:54 +01:00
|
|
|
objectName: "zoomSliderToolBar"
|
|
|
|
|
color: "#9b9b9b"
|
2014-06-04 18:23:07 +02:00
|
|
|
enabled: buttonsBar.enabled
|
2013-11-12 12:44:54 +01:00
|
|
|
visible: false
|
|
|
|
|
width: labels.width
|
2014-09-11 11:44:27 +02:00
|
|
|
height: buttonsBar.height
|
2014-06-04 18:23:07 +02:00
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.top: buttonsBar.bottom
|
2013-11-12 12:44:54 +01:00
|
|
|
|
2013-11-12 16:12:43 +01:00
|
|
|
function updateZoomLevel() {
|
|
|
|
|
zoomSlider.externalUpdate = true;
|
2014-10-14 16:44:45 +02:00
|
|
|
zoomSlider.value = Math.pow(zoomControl.rangeDuration /
|
|
|
|
|
Math.max(1, zoomControl.windowDuration),
|
2014-03-28 16:11:16 +01:00
|
|
|
1 / zoomSlider.exponent) * zoomSlider.maximumValue;
|
2013-11-12 16:12:43 +01:00
|
|
|
}
|
|
|
|
|
|
2013-11-12 12:44:54 +01:00
|
|
|
|
|
|
|
|
Slider {
|
|
|
|
|
id: zoomSlider
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
minimumValue: 1
|
|
|
|
|
maximumValue: 10000
|
|
|
|
|
stepSize: 100
|
|
|
|
|
|
2013-11-12 16:12:43 +01:00
|
|
|
property int exponent: 3
|
|
|
|
|
property bool externalUpdate: false
|
|
|
|
|
property int minWindowLength: 1e5 // 0.1 ms
|
|
|
|
|
|
|
|
|
|
onValueChanged: {
|
2014-10-14 16:44:45 +02:00
|
|
|
if (externalUpdate || zoomControl.windowEnd <= zoomControl.windowStart) {
|
2013-11-12 16:12:43 +01:00
|
|
|
// Zoom range is independently updated. We shouldn't mess
|
|
|
|
|
// with it here as otherwise we might introduce rounding
|
|
|
|
|
// or arithmetic errors.
|
|
|
|
|
externalUpdate = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var windowLength = Math.max(
|
2014-10-14 16:44:45 +02:00
|
|
|
Math.pow(value / maximumValue, exponent) * zoomControl.windowDuration,
|
2013-11-12 16:12:43 +01:00
|
|
|
minWindowLength);
|
|
|
|
|
|
2014-10-14 16:44:45 +02:00
|
|
|
var fixedPoint = (zoomControl.rangeStart + zoomControl.rangeEnd) / 2;
|
2013-11-12 16:12:43 +01:00
|
|
|
if (view.selectedItem !== -1) {
|
|
|
|
|
// center on selected item if it's inside the current screen
|
2014-07-08 14:43:15 +02:00
|
|
|
var newFixedPoint = qmlProfilerModelProxy.startTime(view.selectedModel, view.selectedItem);
|
2014-10-14 16:44:45 +02:00
|
|
|
if (newFixedPoint >= zoomControl.rangeStart &&
|
|
|
|
|
newFixedPoint < zoomControl.rangeEnd)
|
2013-11-12 16:12:43 +01:00
|
|
|
fixedPoint = newFixedPoint;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-14 16:44:45 +02:00
|
|
|
var startTime = Math.max(zoomControl.windowStart, fixedPoint - windowLength / 2)
|
2013-11-12 16:12:43 +01:00
|
|
|
zoomControl.setRange(startTime, startTime + windowLength);
|
|
|
|
|
}
|
2013-11-12 12:44:54 +01:00
|
|
|
}
|
|
|
|
|
}
|
2014-06-04 18:23:07 +02:00
|
|
|
|
|
|
|
|
Overview {
|
|
|
|
|
id: overview
|
|
|
|
|
height: 50
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
}
|
2011-03-11 12:22:57 +01:00
|
|
|
}
|