Commit 6d41c692 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: put all of the traceview in one QQuickView

Having multiple views not only is bad for performance but also creates
difficult to debug problems on some hardware configurations and is
fairly confusing.

Task-number: QTBUG-38222
Change-Id: I885e800b1ededab9137874105e3b2f9ec88a06e8
Reviewed-by: default avatarJocelyn Turcotte <jocelyn.turcotte@digia.com>
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent a5863aba
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** 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
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, 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.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import QtQuick.Controls.Styles 1.2
ToolBar {
id: buttons
signal jumpToPrev()
signal jumpToNext()
signal zoomControlChanged()
signal rangeSelectChanged()
signal lockChanged()
function updateLockButton(locked) {
lockButton.checked = !locked;
}
function lockButtonChecked() {
return lockButton.checked;
}
function updateRangeButton(rangeMode) {
rangeButton.checked = rangeMode;
}
function rangeButtonChecked() {
return rangeButton.checked
}
style: ToolBarStyle {
padding {
left: 0
right: 0
top: 0
bottom: 0
}
background: Rectangle {
anchors.fill: parent
color: "#9B9B9B"
}
}
RowLayout {
spacing: 0
anchors.fill: parent
ToolButton {
id: jumpToPrevButton
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: 30
iconSource: "qrc:/qmlprofiler/ico_prev.png"
tooltip: qsTr("Jump to previous event.")
onClicked: buttons.jumpToPrev()
}
ToolButton {
id: jumpToNextButton
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: 30
iconSource: "qrc:/qmlprofiler/ico_next.png"
tooltip: qsTr("Jump to next event.")
onClicked: buttons.jumpToNext()
}
ToolButton {
id: zoomControlButton
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: 30
iconSource: "qrc:/qmlprofiler/ico_zoom.png"
tooltip: qsTr("Show zoom slider.")
checkable: true
checked: false
onCheckedChanged: buttons.zoomControlChanged()
}
ToolButton {
id: rangeButton
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: 30
iconSource: checked ? "qrc:/qmlprofiler/ico_rangeselected.png" :
"qrc:/qmlprofiler/ico_rangeselection.png"
tooltip: qsTr("Select range.")
checkable: true
checked: false
onCheckedChanged: buttons.rangeSelectChanged()
}
ToolButton {
id: lockButton
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: 30
iconSource: "qrc:/qmlprofiler/ico_selectionmode.png"
tooltip: qsTr("View event information on mouseover.")
checkable: true
checked: false
onCheckedChanged: buttons.lockChanged()
}
}
}
......@@ -39,7 +39,6 @@ Rectangle {
property int singleRowHeight: 30
property alias selectionLocked : view.selectionLocked
signal updateLockButton
property bool lockItemSelection : false
property real mainviewTimePerPixel : 0
......@@ -49,7 +48,6 @@ Rectangle {
property int lineNumber: -1
property int columnNumber: 0
signal updateRangeButton
property bool selectionRangeMode: false
property bool selectionRangeReady: selectionRange.ready
......@@ -115,18 +113,16 @@ Rectangle {
view.startTime = view.endTime = 0;
hideRangeDetails();
selectionRangeMode = false;
updateRangeButton();
buttonsBar.updateRangeButton(selectionRangeMode);
zoomControl.setRange(0,0);
zoomSlider.externalUpdate = true;
zoomSlider.value = zoomSlider.minimumValue;
overview.clear();
timeDisplay.clear();
}
function nextEvent() {
view.selectNext();
}
function prevEvent() {
view.selectPrev();
function enableButtonsBar(enable) {
buttonsBar.enabled = enable;
}
function recenter( centerPoint ) {
......@@ -186,18 +182,19 @@ Rectangle {
onSelectionRangeModeChanged: {
selectionRangeControl.enabled = selectionRangeMode;
selectionRange.reset();
buttonsBar.updateRangeButton(selectionRangeMode);
}
onSelectionLockedChanged: {
updateLockButton();
buttonsBar.updateLockButton(selectionLocked);
}
Flickable {
id: labelsflick
flickableDirection: Flickable.VerticalFlick
interactive: false
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.top: buttonsBar.bottom
anchors.bottom: overview.top
anchors.left: parent.left
width: labels.width
contentY: flick.contentY
......@@ -229,11 +226,33 @@ Rectangle {
id: labelsborder
anchors.left: labelsflick.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.bottom: overview.top
width: 1
color: "#858585"
}
ButtonsBar {
id: buttonsBar
enabled: false
anchors.top: parent.top
anchors.left: parent.left
width: 150
height: 24
onZoomControlChanged: zoomSliderToolBar.visible = !zoomSliderToolBar.visible
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
}
Flickable {
id: flick
contentHeight: labels.height
......@@ -387,8 +406,8 @@ Rectangle {
id: scroller
contentItem: flick
anchors.left: labelsborder.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.top: timeDisplay.bottom
anchors.bottom: overview.top
anchors.right: parent.right
}
......@@ -406,14 +425,15 @@ Rectangle {
}
Rectangle {
id: zoomSliderToolBar
objectName: "zoomSliderToolBar"
color: "#9b9b9b"
enabled: false
enabled: buttonsBar.enabled
visible: false
width: labels.width
height: 24
x: 0
y: 0
anchors.left: parent.left
anchors.top: buttonsBar.bottom
function updateZoomLevel() {
zoomSlider.externalUpdate = true;
......@@ -460,4 +480,12 @@ Rectangle {
}
}
}
Overview {
id: overview
height: 50
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
}
}
......@@ -60,7 +60,6 @@ RangeMover {
onRangeDoubleClicked: {
zoomControl.setRange(startTime, startTime + duration);
root.selectionRangeMode = false;
root.updateRangeButton();
}
function reset() {
......
......@@ -55,18 +55,17 @@ Canvas {
context.fillStyle = "white";
context.fillRect(0, 0, width, height);
var realWidth = width - 1; // account for left border
var totalTime = Math.max(1, endTime - startTime);
var spacing = realWidth / totalTime;
var spacing = width / totalTime;
var initialBlockLength = 120;
var timePerBlock = Math.pow(2, Math.floor( Math.log( totalTime / realWidth * initialBlockLength ) / Math.LN2 ) );
var timePerBlock = Math.pow(2, Math.floor( Math.log( totalTime / width * initialBlockLength ) / Math.LN2 ) );
var pixelsPerBlock = timePerBlock * spacing;
var pixelsPerSection = pixelsPerBlock / 5;
var blockCount = realWidth / pixelsPerBlock;
var blockCount = width / pixelsPerBlock;
var realStartTime = Math.floor(startTime/timePerBlock) * timePerBlock;
var realStartPos = (startTime - realStartTime) * spacing - 1;
var startPos = (startTime - realStartTime) * spacing;
var timePerPixel = timePerBlock/pixelsPerBlock;
......@@ -75,7 +74,7 @@ Canvas {
context.fillStyle = "#000000";
context.font = "8px sans-serif";
for (var ii = 0; ii < blockCount+1; ii++) {
var x = Math.floor(ii*pixelsPerBlock - realStartPos);
var x = Math.floor(ii*pixelsPerBlock - startPos);
context.fillStyle = (ii+initialColor)%2 ? "#E6E6E6":"white";
context.fillRect(x, 0, pixelsPerBlock, height);
......@@ -95,10 +94,6 @@ Canvas {
context.moveTo(0, height-1);
context.lineTo(width, height-1);
context.stroke();
// left border
context.fillStyle = "#858585";
context.fillRect(0, 0, 1, height);
}
function clear()
......
......@@ -26,5 +26,6 @@
<file>ico_next.png</file>
<file>ico_rangeselection.png</file>
<file>ico_rangeselected.png</file>
<file>ButtonsBar.qml</file>
</qresource>
</RCC>
......@@ -74,6 +74,7 @@ RESOURCES += \
qml/qmlprofiler.qrc
OTHER_FILES += \
qml/ButtonsBar.qml \
qml/Detail.qml \
qml/CategoryLabel.qml \
qml/MainView.qml \
......
......@@ -62,6 +62,7 @@ QtcPlugin {
name: "QML"
prefix: "qml/"
files: [
"ButtonsBar.qml",
"Detail.qml",
"CategoryLabel.qml",
"MainView.qml",
......
......@@ -105,10 +105,6 @@ public slots:
private slots:
void updateCursorPosition();
void toggleRangeMode(bool);
void updateRangeButton();
void toggleLockMode(bool);
void updateLockButton();
void updateRange();
......@@ -121,24 +117,12 @@ protected:
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
private slots:
void setZoomSliderEnabled(bool enabled);
void setZoomSliderVisible(bool visible);
signals:
void gotoSourceLocation(const QString &fileUrl, int lineNumber, int columNumber);
void jumpToPrev();
void jumpToNext();
void rangeModeChanged(bool);
void lockModeChanged(bool);
void enableToolbar(bool);
void showZoomSlider(bool);
void resized();
private:
QWidget *createToolbar();
void enableToolbar(bool);
private:
class QmlProfilerTraceViewPrivate;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment