diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-03-06 16:12:02 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@digia.com> | 2014-03-10 12:41:43 +0100 |
commit | 16bfbceebaf7d0159d2a8436026dc7bbe4200150 (patch) | |
tree | 7391443669885b7d3d575b6b9719d7ef5813e6c0 /src/plugins/qmlprofiler/qmlprofilereventview.cpp | |
parent | 64af5c12e004b6e392e7f0c539ef3b02f7d2a564 (diff) | |
download | qt-creator-16bfbceebaf7d0159d2a8436026dc7bbe4200150.tar.gz |
QmlProfiler: Allow filtering either JS or QML from the events view
As a lot of events show up as QML bindings and signals and as
JavaScript functions the events view can be hard to navigate. This
change allows the user to either filter out JavaScript events and make
it look like the old QML events view or filter out QML events and make
it look like the old V8 JavaScript view.
Change-Id: I9e0c1184da21263ae174f322b8fcd8ee5ca13f6d
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilereventview.cpp')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilereventview.cpp | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp index 0a3f685ef5..7fdbc61458 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -111,7 +111,8 @@ public: QmlProfilerEventRelativesView *m_eventParents; QmlProfilerEventsModelProxy *modelProxy; - bool globalStats; + qint64 rangeStart; + qint64 rangeEnd; }; QmlProfilerEventsWidget::QmlProfilerEventsWidget(QWidget *parent, @@ -164,7 +165,7 @@ QmlProfilerEventsWidget::QmlProfilerEventsWidget(QWidget *parent, d->m_profilerTool = profilerTool; d->m_viewContainer = container; - d->globalStats = true; + d->rangeStart = d->rangeEnd = -1; } QmlProfilerEventsWidget::~QmlProfilerEventsWidget() @@ -186,8 +187,9 @@ void QmlProfilerEventsWidget::clear() void QmlProfilerEventsWidget::getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd) { + d->rangeStart = rangeStart; + d->rangeEnd = rangeEnd; d->modelProxy->limitToRange(rangeStart, rangeEnd); - d->globalStats = (rangeStart == -1) && (rangeEnd == -1); } QModelIndex QmlProfilerEventsWidget::selectedItem() const @@ -203,6 +205,8 @@ void QmlProfilerEventsWidget::contextMenuEvent(QContextMenuEvent *ev) QAction *copyRowAction = 0; QAction *copyTableAction = 0; QAction *showExtendedStatsAction = 0; + QAction *showJavaScriptAction = 0; + QAction *showQmlAction = 0; QAction *getLocalStatsAction = 0; QAction *getGlobalStatsAction = 0; @@ -227,13 +231,21 @@ void QmlProfilerEventsWidget::contextMenuEvent(QContextMenuEvent *ev) } menu.addSeparator(); - getLocalStatsAction = menu.addAction(tr("Limit Events Pane to Current Range")); + getLocalStatsAction = menu.addAction(tr("Limit to Current Range")); if (!d->m_viewContainer->hasValidSelection()) getLocalStatsAction->setEnabled(false); - getGlobalStatsAction = menu.addAction(tr("Reset Events Pane")); + getGlobalStatsAction = menu.addAction(tr("Show Full Range")); if (hasGlobalStats()) getGlobalStatsAction->setEnabled(false); + showJavaScriptAction = menu.addAction(tr("Show JavaScript Events")); + showJavaScriptAction->setCheckable(true); + showJavaScriptAction->setChecked(showJavaScript()); + + showQmlAction = menu.addAction(tr("Show QML Events")); + showQmlAction->setCheckable(true); + showQmlAction->setChecked(showQml()); + QAction *selectedAction = menu.exec(position); if (selectedAction) { @@ -249,6 +261,10 @@ void QmlProfilerEventsWidget::contextMenuEvent(QContextMenuEvent *ev) getStatisticsInRange(-1, -1); if (selectedAction == showExtendedStatsAction) setShowExtendedStatistics(!showExtendedStatistics()); + if (selectedAction == showJavaScriptAction) + setShowJavaScript(showJavaScriptAction->isChecked()); + if (selectedAction == showQmlAction) + setShowQml(showQmlAction->isChecked()); } } @@ -288,7 +304,7 @@ void QmlProfilerEventsWidget::selectBySourceLocation(const QString &filename, in bool QmlProfilerEventsWidget::hasGlobalStats() const { - return d->globalStats; + return d->rangeStart == -1 && d->rangeEnd == -1; } void QmlProfilerEventsWidget::setShowExtendedStatistics(bool show) @@ -301,6 +317,34 @@ bool QmlProfilerEventsWidget::showExtendedStatistics() const return d->m_eventTree->showExtendedStatistics(); } +void QmlProfilerEventsWidget::setShowJavaScript(bool show) +{ + d->modelProxy->setEventTypeAccepted(QmlDebug::Javascript, show); + d->modelProxy->limitToRange(d->rangeStart, d->rangeEnd); +} + +void QmlProfilerEventsWidget::setShowQml(bool show) +{ + d->modelProxy->setEventTypeAccepted(QmlDebug::Binding, show); + d->modelProxy->setEventTypeAccepted(QmlDebug::HandlingSignal, show); + d->modelProxy->setEventTypeAccepted(QmlDebug::Compiling, show); + d->modelProxy->setEventTypeAccepted(QmlDebug::Creating, show); + d->modelProxy->limitToRange(d->rangeStart, d->rangeEnd); +} + +bool QmlProfilerEventsWidget::showJavaScript() const +{ + return d->modelProxy->eventTypeAccepted(QmlDebug::Javascript); +} + +bool QmlProfilerEventsWidget::showQml() const +{ + return d->modelProxy->eventTypeAccepted(QmlDebug::Binding) && + d->modelProxy->eventTypeAccepted(QmlDebug::HandlingSignal) && + d->modelProxy->eventTypeAccepted(QmlDebug::Compiling) && + d->modelProxy->eventTypeAccepted(QmlDebug::Creating); +} + //////////////////////////////////////////////////////////////////////////////////// class QmlProfilerEventsMainView::QmlProfilerEventsMainViewPrivate @@ -781,6 +825,9 @@ QmlProfilerEventRelativesView::QmlProfilerEventRelativesView(QmlProfilerModelMan updateHeader(); connect(this,SIGNAL(clicked(QModelIndex)), this,SLOT(jumpToItem(QModelIndex))); + + // Clear when new data available as the selection may be invalid now. + connect(d->modelProxy, SIGNAL(dataAvailable()), this, SLOT(clear())); } QmlProfilerEventRelativesView::~QmlProfilerEventRelativesView() |