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: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Ulf Hermann
2014-06-04 18:23:07 +02:00
parent a5863aba87
commit 6d41c6922f
9 changed files with 204 additions and 208 deletions

View File

@@ -0,0 +1,140 @@
/****************************************************************************
**
** 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()
}
}
}

View File

@@ -39,7 +39,6 @@ Rectangle {
property int singleRowHeight: 30 property int singleRowHeight: 30
property alias selectionLocked : view.selectionLocked property alias selectionLocked : view.selectionLocked
signal updateLockButton
property bool lockItemSelection : false property bool lockItemSelection : false
property real mainviewTimePerPixel : 0 property real mainviewTimePerPixel : 0
@@ -49,7 +48,6 @@ Rectangle {
property int lineNumber: -1 property int lineNumber: -1
property int columnNumber: 0 property int columnNumber: 0
signal updateRangeButton
property bool selectionRangeMode: false property bool selectionRangeMode: false
property bool selectionRangeReady: selectionRange.ready property bool selectionRangeReady: selectionRange.ready
@@ -115,18 +113,16 @@ Rectangle {
view.startTime = view.endTime = 0; view.startTime = view.endTime = 0;
hideRangeDetails(); hideRangeDetails();
selectionRangeMode = false; selectionRangeMode = false;
updateRangeButton(); buttonsBar.updateRangeButton(selectionRangeMode);
zoomControl.setRange(0,0); zoomControl.setRange(0,0);
zoomSlider.externalUpdate = true; zoomSlider.externalUpdate = true;
zoomSlider.value = zoomSlider.minimumValue; zoomSlider.value = zoomSlider.minimumValue;
overview.clear();
timeDisplay.clear();
} }
function nextEvent() { function enableButtonsBar(enable) {
view.selectNext(); buttonsBar.enabled = enable;
}
function prevEvent() {
view.selectPrev();
} }
function recenter( centerPoint ) { function recenter( centerPoint ) {
@@ -186,18 +182,19 @@ Rectangle {
onSelectionRangeModeChanged: { onSelectionRangeModeChanged: {
selectionRangeControl.enabled = selectionRangeMode; selectionRangeControl.enabled = selectionRangeMode;
selectionRange.reset(); selectionRange.reset();
buttonsBar.updateRangeButton(selectionRangeMode);
} }
onSelectionLockedChanged: { onSelectionLockedChanged: {
updateLockButton(); buttonsBar.updateLockButton(selectionLocked);
} }
Flickable { Flickable {
id: labelsflick id: labelsflick
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
interactive: false interactive: false
anchors.top: parent.top anchors.top: buttonsBar.bottom
anchors.bottom: parent.bottom anchors.bottom: overview.top
anchors.left: parent.left anchors.left: parent.left
width: labels.width width: labels.width
contentY: flick.contentY contentY: flick.contentY
@@ -229,11 +226,33 @@ Rectangle {
id: labelsborder id: labelsborder
anchors.left: labelsflick.right anchors.left: labelsflick.right
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: overview.top
width: 1 width: 1
color: "#858585" 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 { Flickable {
id: flick id: flick
contentHeight: labels.height contentHeight: labels.height
@@ -387,8 +406,8 @@ Rectangle {
id: scroller id: scroller
contentItem: flick contentItem: flick
anchors.left: labelsborder.right anchors.left: labelsborder.right
anchors.top: parent.top anchors.top: timeDisplay.bottom
anchors.bottom: parent.bottom anchors.bottom: overview.top
anchors.right: parent.right anchors.right: parent.right
} }
@@ -406,14 +425,15 @@ Rectangle {
} }
Rectangle { Rectangle {
id: zoomSliderToolBar
objectName: "zoomSliderToolBar" objectName: "zoomSliderToolBar"
color: "#9b9b9b" color: "#9b9b9b"
enabled: false enabled: buttonsBar.enabled
visible: false visible: false
width: labels.width width: labels.width
height: 24 height: 24
x: 0 anchors.left: parent.left
y: 0 anchors.top: buttonsBar.bottom
function updateZoomLevel() { function updateZoomLevel() {
zoomSlider.externalUpdate = true; 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
}
} }

View File

@@ -60,7 +60,6 @@ RangeMover {
onRangeDoubleClicked: { onRangeDoubleClicked: {
zoomControl.setRange(startTime, startTime + duration); zoomControl.setRange(startTime, startTime + duration);
root.selectionRangeMode = false; root.selectionRangeMode = false;
root.updateRangeButton();
} }
function reset() { function reset() {

View File

@@ -55,18 +55,17 @@ Canvas {
context.fillStyle = "white"; context.fillStyle = "white";
context.fillRect(0, 0, width, height); context.fillRect(0, 0, width, height);
var realWidth = width - 1; // account for left border
var totalTime = Math.max(1, endTime - startTime); var totalTime = Math.max(1, endTime - startTime);
var spacing = realWidth / totalTime; var spacing = width / totalTime;
var initialBlockLength = 120; 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 pixelsPerBlock = timePerBlock * spacing;
var pixelsPerSection = pixelsPerBlock / 5; var pixelsPerSection = pixelsPerBlock / 5;
var blockCount = realWidth / pixelsPerBlock; var blockCount = width / pixelsPerBlock;
var realStartTime = Math.floor(startTime/timePerBlock) * timePerBlock; var realStartTime = Math.floor(startTime/timePerBlock) * timePerBlock;
var realStartPos = (startTime - realStartTime) * spacing - 1; var startPos = (startTime - realStartTime) * spacing;
var timePerPixel = timePerBlock/pixelsPerBlock; var timePerPixel = timePerBlock/pixelsPerBlock;
@@ -75,7 +74,7 @@ Canvas {
context.fillStyle = "#000000"; context.fillStyle = "#000000";
context.font = "8px sans-serif"; context.font = "8px sans-serif";
for (var ii = 0; ii < blockCount+1; ii++) { 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.fillStyle = (ii+initialColor)%2 ? "#E6E6E6":"white";
context.fillRect(x, 0, pixelsPerBlock, height); context.fillRect(x, 0, pixelsPerBlock, height);
@@ -95,10 +94,6 @@ Canvas {
context.moveTo(0, height-1); context.moveTo(0, height-1);
context.lineTo(width, height-1); context.lineTo(width, height-1);
context.stroke(); context.stroke();
// left border
context.fillStyle = "#858585";
context.fillRect(0, 0, 1, height);
} }
function clear() function clear()

View File

@@ -26,5 +26,6 @@
<file>ico_next.png</file> <file>ico_next.png</file>
<file>ico_rangeselection.png</file> <file>ico_rangeselection.png</file>
<file>ico_rangeselected.png</file> <file>ico_rangeselected.png</file>
<file>ButtonsBar.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -74,6 +74,7 @@ RESOURCES += \
qml/qmlprofiler.qrc qml/qmlprofiler.qrc
OTHER_FILES += \ OTHER_FILES += \
qml/ButtonsBar.qml \
qml/Detail.qml \ qml/Detail.qml \
qml/CategoryLabel.qml \ qml/CategoryLabel.qml \
qml/MainView.qml \ qml/MainView.qml \

View File

@@ -62,6 +62,7 @@ QtcPlugin {
name: "QML" name: "QML"
prefix: "qml/" prefix: "qml/"
files: [ files: [
"ButtonsBar.qml",
"Detail.qml", "Detail.qml",
"CategoryLabel.qml", "CategoryLabel.qml",
"MainView.qml", "MainView.qml",

View File

@@ -151,8 +151,6 @@ public:
~QmlProfilerTraceViewPrivate() ~QmlProfilerTraceViewPrivate()
{ {
delete m_mainView; delete m_mainView;
delete m_timebar;
delete m_overview;
} }
QmlProfilerTraceView *q; QmlProfilerTraceView *q;
@@ -164,16 +162,11 @@ public:
QSize m_sizeHint; QSize m_sizeHint;
QQuickView *m_mainView; QQuickView *m_mainView;
QQuickView *m_timebar;
QQuickView *m_overview;
QmlProfilerModelManager *m_modelManager; QmlProfilerModelManager *m_modelManager;
TimelineModelAggregator *m_modelProxy; TimelineModelAggregator *m_modelProxy;
ZoomControl *m_zoomControl; ZoomControl *m_zoomControl;
QToolButton *m_buttonRange;
QToolButton *m_buttonLock;
}; };
QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *modelManager, QmlProfilerStateManager *profilerState) QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *modelManager, QmlProfilerStateManager *profilerState)
@@ -193,28 +186,9 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT
QWidget *mainViewContainer = QWidget::createWindowContainer(d->m_mainView); QWidget *mainViewContainer = QWidget::createWindowContainer(d->m_mainView);
mainViewContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); mainViewContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QHBoxLayout *toolsLayout = new QHBoxLayout; enableToolbar(false);
d->m_timebar = new QmlProfilerQuickView(this);
d->m_timebar->setResizeMode(QQuickView::SizeRootObjectToView);
QWidget *timeBarContainer = QWidget::createWindowContainer(d->m_timebar);
timeBarContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
timeBarContainer->setFixedHeight(24);
d->m_overview = new QmlProfilerQuickView(this);
d->m_overview->setResizeMode(QQuickView::SizeRootObjectToView);
QWidget *overviewContainer = QWidget::createWindowContainer(d->m_overview);
overviewContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
overviewContainer->setFixedHeight(50);
toolsLayout->addWidget(createToolbar());
toolsLayout->addWidget(timeBarContainer);
emit enableToolbar(false);
groupLayout->addLayout(toolsLayout);
groupLayout->addWidget(mainViewContainer); groupLayout->addWidget(mainViewContainer);
groupLayout->addWidget(overviewContainer);
setLayout(groupLayout); setLayout(groupLayout);
d->m_profilerTool = profilerTool; d->m_profilerTool = profilerTool;
@@ -226,9 +200,6 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT
this, SLOT(profilerDataModelStateChanged())); this, SLOT(profilerDataModelStateChanged()));
d->m_mainView->rootContext()->setContextProperty(QLatin1String("qmlProfilerModelProxy"), d->m_mainView->rootContext()->setContextProperty(QLatin1String("qmlProfilerModelProxy"),
d->m_modelProxy); d->m_modelProxy);
d->m_overview->rootContext()->setContextProperty(QLatin1String("qmlProfilerModelProxy"),
d->m_modelProxy);
d->m_profilerState = profilerState; d->m_profilerState = profilerState;
// Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin // Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin
@@ -245,98 +216,11 @@ QmlProfilerTraceView::~QmlProfilerTraceView()
void QmlProfilerTraceView::reset() void QmlProfilerTraceView::reset()
{ {
d->m_mainView->rootContext()->setContextProperty(QLatin1String("zoomControl"), d->m_zoomControl); d->m_mainView->rootContext()->setContextProperty(QLatin1String("zoomControl"), d->m_zoomControl);
d->m_timebar->rootContext()->setContextProperty(QLatin1String("zoomControl"), d->m_zoomControl);
d->m_overview->rootContext()->setContextProperty(QLatin1String("zoomControl"), d->m_zoomControl);
d->m_timebar->setSource(QUrl(QLatin1String("qrc:/qmlprofiler/TimeDisplay.qml")));
d->m_overview->setSource(QUrl(QLatin1String("qrc:/qmlprofiler/Overview.qml")));
d->m_mainView->setSource(QUrl(QLatin1String("qrc:/qmlprofiler/MainView.qml"))); d->m_mainView->setSource(QUrl(QLatin1String("qrc:/qmlprofiler/MainView.qml")));
QQuickItem *rootObject = d->m_mainView->rootObject(); QQuickItem *rootObject = d->m_mainView->rootObject();
connect(rootObject, SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition())); connect(rootObject, SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition()));
connect(rootObject, SIGNAL(updateRangeButton()), this, SLOT(updateRangeButton()));
connect(rootObject, SIGNAL(updateLockButton()), this, SLOT(updateLockButton()));
connect(this, SIGNAL(jumpToPrev()), rootObject, SLOT(prevEvent()));
connect(this, SIGNAL(jumpToNext()), rootObject, SLOT(nextEvent()));
connect(rootObject, SIGNAL(changeToolTip(QString)), this, SLOT(updateToolTip(QString))); connect(rootObject, SIGNAL(changeToolTip(QString)), this, SLOT(updateToolTip(QString)));
connect(this, SIGNAL(enableToolbar(bool)), this, SLOT(setZoomSliderEnabled(bool)));
connect(this, SIGNAL(showZoomSlider(bool)), this, SLOT(setZoomSliderVisible(bool)));
}
void QmlProfilerTraceView::setZoomSliderEnabled(bool enabled)
{
QQuickItem *zoomSlider = d->m_mainView->rootObject()->findChild<QQuickItem*>(QLatin1String("zoomSliderToolBar"));
if (zoomSlider->isEnabled() != enabled)
zoomSlider->setEnabled(enabled);
}
void QmlProfilerTraceView::setZoomSliderVisible(bool visible)
{
QQuickItem *zoomSlider = d->m_mainView->rootObject()->findChild<QQuickItem*>(QLatin1String("zoomSliderToolBar"));
if (zoomSlider->isVisible() != visible)
zoomSlider->setVisible(visible);
}
QWidget *QmlProfilerTraceView::createToolbar()
{
Utils::StyledBar *bar = new Utils::StyledBar(this);
bar->setStyleSheet(QLatin1String("background: #9B9B9B"));
bar->setSingleRow(true);
bar->setFixedWidth(150);
bar->setFixedHeight(24);
QHBoxLayout *toolBarLayout = new QHBoxLayout(bar);
toolBarLayout->setMargin(0);
toolBarLayout->setSpacing(0);
QToolButton *buttonPrev= new QToolButton;
buttonPrev->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_prev.png")));
buttonPrev->setToolTip(tr("Jump to previous event."));
connect(buttonPrev, SIGNAL(clicked()), this, SIGNAL(jumpToPrev()));
connect(this, SIGNAL(enableToolbar(bool)), buttonPrev, SLOT(setEnabled(bool)));
QToolButton *buttonNext= new QToolButton;
buttonNext->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_next.png")));
buttonNext->setToolTip(tr("Jump to next event."));
connect(buttonNext, SIGNAL(clicked()), this, SIGNAL(jumpToNext()));
connect(this, SIGNAL(enableToolbar(bool)), buttonNext, SLOT(setEnabled(bool)));
QToolButton *buttonZoomControls = new QToolButton;
buttonZoomControls->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_zoom.png")));
buttonZoomControls->setToolTip(tr("Show zoom slider."));
buttonZoomControls->setCheckable(true);
buttonZoomControls->setChecked(false);
connect(buttonZoomControls, SIGNAL(toggled(bool)), this, SIGNAL(showZoomSlider(bool)));
connect(this, SIGNAL(enableToolbar(bool)), buttonZoomControls, SLOT(setEnabled(bool)));
d->m_buttonRange = new QToolButton;
d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselection.png")));
d->m_buttonRange->setToolTip(tr("Select range."));
d->m_buttonRange->setCheckable(true);
d->m_buttonRange->setChecked(false);
connect(d->m_buttonRange, SIGNAL(clicked(bool)), this, SLOT(toggleRangeMode(bool)));
connect(this, SIGNAL(enableToolbar(bool)), d->m_buttonRange, SLOT(setEnabled(bool)));
connect(this, SIGNAL(rangeModeChanged(bool)), d->m_buttonRange, SLOT(setChecked(bool)));
d->m_buttonLock = new QToolButton;
d->m_buttonLock->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_selectionmode.png")));
d->m_buttonLock->setToolTip(tr("View event information on mouseover."));
d->m_buttonLock->setCheckable(true);
d->m_buttonLock->setChecked(false);
connect(d->m_buttonLock, SIGNAL(clicked(bool)), this, SLOT(toggleLockMode(bool)));
connect(this, SIGNAL(enableToolbar(bool)), d->m_buttonLock, SLOT(setEnabled(bool)));
connect(this, SIGNAL(lockModeChanged(bool)), d->m_buttonLock, SLOT(setChecked(bool)));
toolBarLayout->addWidget(buttonPrev);
toolBarLayout->addWidget(buttonNext);
toolBarLayout->addWidget(new Utils::StyledSeparator());
toolBarLayout->addWidget(buttonZoomControls);
toolBarLayout->addWidget(new Utils::StyledSeparator());
toolBarLayout->addWidget(d->m_buttonRange);
toolBarLayout->addWidget(d->m_buttonLock);
return bar;
} }
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
@@ -348,6 +232,12 @@ bool QmlProfilerTraceView::hasValidSelection() const
return false; return false;
} }
void QmlProfilerTraceView::enableToolbar(bool enable)
{
QMetaObject::invokeMethod(d->m_mainView->rootObject(), "enableButtonsBar",
Q_ARG(QVariant,QVariant(enable)));
}
qint64 QmlProfilerTraceView::selectionStart() const qint64 QmlProfilerTraceView::selectionStart() const
{ {
QQuickItem *rootObject = d->m_mainView->rootObject(); QQuickItem *rootObject = d->m_mainView->rootObject();
@@ -367,8 +257,6 @@ qint64 QmlProfilerTraceView::selectionEnd() const
void QmlProfilerTraceView::clear() void QmlProfilerTraceView::clear()
{ {
QMetaObject::invokeMethod(d->m_mainView->rootObject(), "clear"); QMetaObject::invokeMethod(d->m_mainView->rootObject(), "clear");
QMetaObject::invokeMethod(d->m_overview->rootObject(), "clear");
QMetaObject::invokeMethod(d->m_timebar->rootObject(), "clear");
} }
void QmlProfilerTraceView::selectByHash(const QString &hash) void QmlProfilerTraceView::selectByHash(const QString &hash)
@@ -401,47 +289,6 @@ void QmlProfilerTraceView::updateCursorPosition()
rootObject->property("columnNumber").toInt()); rootObject->property("columnNumber").toInt());
} }
/////////////////////////////////////////////////////////
// Toolbar buttons
void QmlProfilerTraceView::toggleRangeMode(bool active)
{
QQuickItem *rootObject = d->m_mainView->rootObject();
bool rangeMode = rootObject->property("selectionRangeMode").toBool();
if (active != rangeMode) {
if (active)
d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselected.png")));
else
d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselection.png")));
rootObject->setProperty("selectionRangeMode", QVariant(active));
}
}
void QmlProfilerTraceView::updateRangeButton()
{
bool rangeMode = d->m_mainView->rootObject()->property("selectionRangeMode").toBool();
if (rangeMode)
d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselected.png")));
else
d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselection.png")));
emit rangeModeChanged(rangeMode);
}
void QmlProfilerTraceView::toggleLockMode(bool active)
{
QQuickItem *rootObject = d->m_mainView->rootObject();
bool lockMode = !rootObject->property("selectionLocked").toBool();
if (active != lockMode) {
rootObject->setProperty("selectionLocked", QVariant(!active));
rootObject->setProperty("selectedItem", QVariant(-1));
}
}
void QmlProfilerTraceView::updateLockButton()
{
bool lockMode = !d->m_mainView->rootObject()->property("selectionLocked").toBool();
emit lockModeChanged(lockMode);
}
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
// Zoom control // Zoom control
void QmlProfilerTraceView::updateRange() void QmlProfilerTraceView::updateRange()
@@ -538,12 +385,12 @@ void QmlProfilerTraceView::profilerDataModelStateChanged()
case QmlProfilerDataState::Empty: break; case QmlProfilerDataState::Empty: break;
case QmlProfilerDataState::ClearingData: case QmlProfilerDataState::ClearingData:
d->m_mainView->hide(); d->m_mainView->hide();
emit enableToolbar(false); enableToolbar(false);
break; break;
case QmlProfilerDataState::AcquiringData: break; case QmlProfilerDataState::AcquiringData: break;
case QmlProfilerDataState::ProcessingData: break; case QmlProfilerDataState::ProcessingData: break;
case QmlProfilerDataState::Done: case QmlProfilerDataState::Done:
emit enableToolbar(true); enableToolbar(true);
d->m_mainView->show(); d->m_mainView->show();
break; break;
default: default:

View File

@@ -105,10 +105,6 @@ public slots:
private slots: private slots:
void updateCursorPosition(); void updateCursorPosition();
void toggleRangeMode(bool);
void updateRangeButton();
void toggleLockMode(bool);
void updateLockButton();
void updateRange(); void updateRange();
@@ -121,24 +117,12 @@ protected:
virtual void mousePressEvent(QMouseEvent *event); virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event); virtual void mouseReleaseEvent(QMouseEvent *event);
private slots:
void setZoomSliderEnabled(bool enabled);
void setZoomSliderVisible(bool visible);
signals: signals:
void gotoSourceLocation(const QString &fileUrl, int lineNumber, int columNumber); 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(); void resized();
private: private:
QWidget *createToolbar(); void enableToolbar(bool);
private: private:
class QmlProfilerTraceViewPrivate; class QmlProfilerTraceViewPrivate;