summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@digia.com>2014-06-04 18:23:07 +0200
committerUlf Hermann <ulf.hermann@digia.com>2014-06-06 14:21:28 +0200
commit6d41c6922fc00177a07d1f378c41f1031f1ccade (patch)
tree6c9bdc1a1d105de73dbc8ddf254e433c4434c9eb
parenta5863aba87072bfe872dc7e6f08f3442141d1492 (diff)
downloadqt-creator-6d41c6922fc00177a07d1f378c41f1031f1ccade.tar.gz
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>
-rw-r--r--src/plugins/qmlprofiler/qml/ButtonsBar.qml140
-rw-r--r--src/plugins/qmlprofiler/qml/MainView.qml64
-rw-r--r--src/plugins/qmlprofiler/qml/SelectionRange.qml1
-rw-r--r--src/plugins/qmlprofiler/qml/TimeDisplay.qml15
-rw-r--r--src/plugins/qmlprofiler/qml/qmlprofiler.qrc1
-rw-r--r--src/plugins/qmlprofiler/qmlprofiler.pro1
-rw-r--r--src/plugins/qmlprofiler/qmlprofiler.qbs1
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertraceview.cpp171
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertraceview.h18
9 files changed, 204 insertions, 208 deletions
diff --git a/src/plugins/qmlprofiler/qml/ButtonsBar.qml b/src/plugins/qmlprofiler/qml/ButtonsBar.qml
new file mode 100644
index 0000000000..8f703e997b
--- /dev/null
+++ b/src/plugins/qmlprofiler/qml/ButtonsBar.qml
@@ -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()
+ }
+ }
+}
diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml
index ad4f364c66..b861b2efb0 100644
--- a/src/plugins/qmlprofiler/qml/MainView.qml
+++ b/src/plugins/qmlprofiler/qml/MainView.qml
@@ -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
+ }
}
diff --git a/src/plugins/qmlprofiler/qml/SelectionRange.qml b/src/plugins/qmlprofiler/qml/SelectionRange.qml
index 7931bdea3a..c8b55fa892 100644
--- a/src/plugins/qmlprofiler/qml/SelectionRange.qml
+++ b/src/plugins/qmlprofiler/qml/SelectionRange.qml
@@ -60,7 +60,6 @@ RangeMover {
onRangeDoubleClicked: {
zoomControl.setRange(startTime, startTime + duration);
root.selectionRangeMode = false;
- root.updateRangeButton();
}
function reset() {
diff --git a/src/plugins/qmlprofiler/qml/TimeDisplay.qml b/src/plugins/qmlprofiler/qml/TimeDisplay.qml
index 38548e7bb9..df694e1ecb 100644
--- a/src/plugins/qmlprofiler/qml/TimeDisplay.qml
+++ b/src/plugins/qmlprofiler/qml/TimeDisplay.qml
@@ -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()
diff --git a/src/plugins/qmlprofiler/qml/qmlprofiler.qrc b/src/plugins/qmlprofiler/qml/qmlprofiler.qrc
index 1e45c14065..dca00fa3ca 100644
--- a/src/plugins/qmlprofiler/qml/qmlprofiler.qrc
+++ b/src/plugins/qmlprofiler/qml/qmlprofiler.qrc
@@ -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>
diff --git a/src/plugins/qmlprofiler/qmlprofiler.pro b/src/plugins/qmlprofiler/qmlprofiler.pro
index 98ddfcf431..981fbfd8b1 100644
--- a/src/plugins/qmlprofiler/qmlprofiler.pro
+++ b/src/plugins/qmlprofiler/qmlprofiler.pro
@@ -74,6 +74,7 @@ RESOURCES += \
qml/qmlprofiler.qrc
OTHER_FILES += \
+ qml/ButtonsBar.qml \
qml/Detail.qml \
qml/CategoryLabel.qml \
qml/MainView.qml \
diff --git a/src/plugins/qmlprofiler/qmlprofiler.qbs b/src/plugins/qmlprofiler/qmlprofiler.qbs
index 8ed3414959..d6dc2b6be3 100644
--- a/src/plugins/qmlprofiler/qmlprofiler.qbs
+++ b/src/plugins/qmlprofiler/qmlprofiler.qbs
@@ -62,6 +62,7 @@ QtcPlugin {
name: "QML"
prefix: "qml/"
files: [
+ "ButtonsBar.qml",
"Detail.qml",
"CategoryLabel.qml",
"MainView.qml",
diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
index 91428fe7e9..5405f0ad0e 100644
--- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
@@ -151,8 +151,6 @@ public:
~QmlProfilerTraceViewPrivate()
{
delete m_mainView;
- delete m_timebar;
- delete m_overview;
}
QmlProfilerTraceView *q;
@@ -164,16 +162,11 @@ public:
QSize m_sizeHint;
QQuickView *m_mainView;
- QQuickView *m_timebar;
- QQuickView *m_overview;
QmlProfilerModelManager *m_modelManager;
TimelineModelAggregator *m_modelProxy;
ZoomControl *m_zoomControl;
-
- QToolButton *m_buttonRange;
- QToolButton *m_buttonLock;
};
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);
mainViewContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- QHBoxLayout *toolsLayout = new QHBoxLayout;
-
- 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);
+ enableToolbar(false);
- toolsLayout->addWidget(createToolbar());
- toolsLayout->addWidget(timeBarContainer);
- emit enableToolbar(false);
-
- groupLayout->addLayout(toolsLayout);
groupLayout->addWidget(mainViewContainer);
- groupLayout->addWidget(overviewContainer);
-
setLayout(groupLayout);
d->m_profilerTool = profilerTool;
@@ -226,9 +200,6 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT
this, SLOT(profilerDataModelStateChanged()));
d->m_mainView->rootContext()->setContextProperty(QLatin1String("qmlProfilerModelProxy"),
d->m_modelProxy);
- d->m_overview->rootContext()->setContextProperty(QLatin1String("qmlProfilerModelProxy"),
- d->m_modelProxy);
-
d->m_profilerState = profilerState;
// Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin
@@ -245,98 +216,11 @@ QmlProfilerTraceView::~QmlProfilerTraceView()
void QmlProfilerTraceView::reset()
{
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")));
QQuickItem *rootObject = d->m_mainView->rootObject();
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(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;
}
+void QmlProfilerTraceView::enableToolbar(bool enable)
+{
+ QMetaObject::invokeMethod(d->m_mainView->rootObject(), "enableButtonsBar",
+ Q_ARG(QVariant,QVariant(enable)));
+}
+
qint64 QmlProfilerTraceView::selectionStart() const
{
QQuickItem *rootObject = d->m_mainView->rootObject();
@@ -367,8 +257,6 @@ qint64 QmlProfilerTraceView::selectionEnd() const
void QmlProfilerTraceView::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)
@@ -401,47 +289,6 @@ void QmlProfilerTraceView::updateCursorPosition()
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
void QmlProfilerTraceView::updateRange()
@@ -538,12 +385,12 @@ void QmlProfilerTraceView::profilerDataModelStateChanged()
case QmlProfilerDataState::Empty: break;
case QmlProfilerDataState::ClearingData:
d->m_mainView->hide();
- emit enableToolbar(false);
+ enableToolbar(false);
break;
case QmlProfilerDataState::AcquiringData: break;
case QmlProfilerDataState::ProcessingData: break;
case QmlProfilerDataState::Done:
- emit enableToolbar(true);
+ enableToolbar(true);
d->m_mainView->show();
break;
default:
diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.h b/src/plugins/qmlprofiler/qmlprofilertraceview.h
index e599102079..409f8eb38c 100644
--- a/src/plugins/qmlprofiler/qmlprofilertraceview.h
+++ b/src/plugins/qmlprofiler/qmlprofilertraceview.h
@@ -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;