From c045b43e13ad33c65709db6f717f399d3b1cf5f8 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 11 Jun 2013 16:18:02 +0200 Subject: Re-enable navigation to file in timeline Change-Id: I6e794ee98380fa8543fc0266bd8cec7b525e1e68 Reviewed-by: Christiaan Janssen --- plugins/qmlprofiler/abstracttimelinemodel.h | 3 +++ plugins/qmlprofiler/qml/MainView.qml | 22 ++++------------------ plugins/qmlprofiler/qml/RangeDetails.qml | 13 +++++++++++++ .../qmlprofilerpainteventsmodelproxy.cpp | 6 ++++++ .../qmlprofiler/qmlprofilerpainteventsmodelproxy.h | 1 + .../qmlprofiler/qmlprofilertimelinemodelproxy.cpp | 15 +++++++++++++++ .../qmlprofiler/qmlprofilertimelinemodelproxy.h | 1 + plugins/qmlprofiler/timelinemodelaggregator.cpp | 5 +++++ plugins/qmlprofiler/timelinemodelaggregator.h | 1 + plugins/qmlprofiler/timelinerenderer.cpp | 20 -------------------- plugins/qmlprofiler/timelinerenderer.h | 4 ---- .../scenegraphtimelinemodel.cpp | 6 ++++++ .../qmlprofilerextended/scenegraphtimelinemodel.h | 1 + 13 files changed, 56 insertions(+), 42 deletions(-) diff --git a/plugins/qmlprofiler/abstracttimelinemodel.h b/plugins/qmlprofiler/abstracttimelinemodel.h index 4a679e0ae1a..7ef5dc821e5 100644 --- a/plugins/qmlprofiler/abstracttimelinemodel.h +++ b/plugins/qmlprofiler/abstracttimelinemodel.h @@ -88,6 +88,9 @@ public: Q_INVOKABLE virtual const QVariantList getEventDetails(int index) const = 0; + // returned map should contain "file", "line", "column" properties, or be empty + Q_INVOKABLE virtual const QVariantMap getEventLocation(int index) const = 0; + signals: void countChanged(); void dataAvailable(); diff --git a/plugins/qmlprofiler/qml/MainView.qml b/plugins/qmlprofiler/qml/MainView.qml index efb6d0365e2..f1420d3be59 100644 --- a/plugins/qmlprofiler/qml/MainView.qml +++ b/plugins/qmlprofiler/qml/MainView.qml @@ -436,18 +436,8 @@ Rectangle { onSelectedItemChanged: { if (selectedItem !== -1) { // display details - /* - rangeDetails.duration = qmlProfilerDataModel.getDuration(selectedItem)/1000.0; - rangeDetails.label = qmlProfilerDataModel.getDetails(selectedItem); - rangeDetails.file = qmlProfilerDataModel.getFilename(selectedItem); - rangeDetails.line = qmlProfilerDataModel.getLine(selectedItem); - rangeDetails.column = qmlProfilerDataModel.getColumn(selectedItem); - rangeDetails.type = root.names[qmlProfilerDataModel.getType(selectedItem)]; - rangeDetails.isBindingLoop = qmlProfilerDataModel.getBindingLoopDest(selectedItem)!==-1; - - rangeDetails.visible = true; -*/ rangeDetails.showInfo(qmlProfilerModelProxy.getEventDetails(selectedModel, selectedItem)); + rangeDetails.setLocation(qmlProfilerModelProxy.getEventLocation(selectedModel, selectedItem)); // center view (horizontally) var windowLength = view.endTime - view.startTime; @@ -481,13 +471,9 @@ Rectangle { } onItemPressed: { - if (pressedItem !== -1) { - /* - root.gotoSourceLocation(qmlProfilerDataModel.getFilename(pressedItem), - qmlProfilerDataModel.getLine(pressedItem), - qmlProfilerDataModel.getColumn(pressedItem)); - */ - } + var location = qmlProfilerModelProxy.getEventLocation(modelIndex, pressedItem); + if (location.hasOwnProperty("file")) // not empty + root.gotoSourceLocation(location.file, location.line, location.column); } // hack to pass mouse events to the other mousearea if enabled diff --git a/plugins/qmlprofiler/qml/RangeDetails.qml b/plugins/qmlprofiler/qml/RangeDetails.qml index ef1a19234bf..c066b06bde1 100644 --- a/plugins/qmlprofiler/qml/RangeDetails.qml +++ b/plugins/qmlprofiler/qml/RangeDetails.qml @@ -82,6 +82,19 @@ Item { rangeDetails.visible = true; } + function setLocation(location) { + if (location.hasOwnProperty("file")) { // not empty + file = location.file; + line = location.line; + column = location.column; + } else { + // reset to default values + file = ""; + line = 0; + column = -1; + } + } + function fitInView() { // don't reposition if it does not fit if (root.width < width || root.candidateHeight < height) diff --git a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp index 75e1710d9f0..466c3461ea1 100644 --- a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp +++ b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp @@ -415,6 +415,12 @@ const QVariantList PaintEventsModelProxy::getEventDetails(int index) const return result; } +const QVariantMap PaintEventsModelProxy::getEventLocation(int /*index*/) const +{ + QVariantMap map; + return map; +} + } } diff --git a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h index bdfbbb6d6a3..03b73433185 100644 --- a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h +++ b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h @@ -100,6 +100,7 @@ public: Q_INVOKABLE const QVariantList getLabelsForCategory(int category) const; Q_INVOKABLE const QVariantList getEventDetails(int index) const; + Q_INVOKABLE const QVariantMap getEventLocation(int index) const; private slots: bool eventAccepted(const QmlProfilerSimpleModel::QmlEventData &event) const; diff --git a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp index 66cf866c16b..dc3bc8752e8 100644 --- a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp +++ b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp @@ -657,5 +657,20 @@ const QVariantList BasicTimelineModel::getEventDetails(int index) const return result; } +const QVariantMap BasicTimelineModel::getEventLocation(int index) const +{ + QVariantMap result; + int eventId = getEventId(index); + + QmlDebug::QmlEventLocation location + = d->eventDict.at(eventId).location; + + result.insert(QLatin1String("file"), location.filename); + result.insert(QLatin1String("line"), location.line); + result.insert(QLatin1String("column"), location.column); + + return result; +} + } } diff --git a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h index 616013e8d91..2ee1610388f 100644 --- a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h +++ b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h @@ -145,6 +145,7 @@ public: Q_INVOKABLE const QVariantList getLabelsForCategory(int category) const; Q_INVOKABLE const QVariantList getEventDetails(int index) const; + Q_INVOKABLE const QVariantMap getEventLocation(int index) const; private slots: bool eventAccepted(const QmlProfilerSimpleModel::QmlEventData &event) const; diff --git a/plugins/qmlprofiler/timelinemodelaggregator.cpp b/plugins/qmlprofiler/timelinemodelaggregator.cpp index 5391da5696c..99c284aea86 100644 --- a/plugins/qmlprofiler/timelinemodelaggregator.cpp +++ b/plugins/qmlprofiler/timelinemodelaggregator.cpp @@ -280,6 +280,11 @@ const QVariantList TimelineModelAggregator::getEventDetails(int modelIndex, int return d->modelList[modelIndex]->getEventDetails(index); } +const QVariantMap TimelineModelAggregator::getEventLocation(int modelIndex, int index) const +{ + return d->modelList[modelIndex]->getEventLocation(index); +} + void TimelineModelAggregator::dataChanged() { // this is a slot connected for every modelproxy diff --git a/plugins/qmlprofiler/timelinemodelaggregator.h b/plugins/qmlprofiler/timelinemodelaggregator.h index 7468d066135..4f650bb4a51 100644 --- a/plugins/qmlprofiler/timelinemodelaggregator.h +++ b/plugins/qmlprofiler/timelinemodelaggregator.h @@ -88,6 +88,7 @@ public: Q_INVOKABLE const QVariantList getLabelsForCategory(int modelIndex, int category) const; Q_INVOKABLE const QVariantList getEventDetails(int modelIndex, int index) const; + Q_INVOKABLE const QVariantMap getEventLocation(int modelIndex, int index) const; Q_INVOKABLE int modelIndexForCategory(int absoluteCategoryIndex) const; Q_INVOKABLE int correctedCategoryIndexForModel(int modelIndex, int absoluteCategoryIndex) const; diff --git a/plugins/qmlprofiler/timelinerenderer.cpp b/plugins/qmlprofiler/timelinerenderer.cpp index 0fe46742068..741e3579895 100644 --- a/plugins/qmlprofiler/timelinerenderer.cpp +++ b/plugins/qmlprofiler/timelinerenderer.cpp @@ -363,26 +363,6 @@ void TimelineRenderer::clearData() m_selectionLocked = true; } -qint64 TimelineRenderer::getDuration(int index) const -{ - return 0; -} - -QString TimelineRenderer::getFilename(int index) const -{ - return QString(); -} - -int TimelineRenderer::getLine(int index) const -{ - return 0; -} - -QString TimelineRenderer::getDetails(int index) const -{ - return QString(); -} - int TimelineRenderer::getYPosition(int modelIndex, int index) const { Q_ASSERT(m_profilerModelProxy); diff --git a/plugins/qmlprofiler/timelinerenderer.h b/plugins/qmlprofiler/timelinerenderer.h index e43b1473ef7..128f191d889 100644 --- a/plugins/qmlprofiler/timelinerenderer.h +++ b/plugins/qmlprofiler/timelinerenderer.h @@ -102,10 +102,6 @@ public: emit profilerModelProxyChanged(m_profilerModelProxy); } - Q_INVOKABLE qint64 getDuration(int index) const; - Q_INVOKABLE QString getFilename(int index) const; - Q_INVOKABLE int getLine(int index) const; - Q_INVOKABLE QString getDetails(int index) const; Q_INVOKABLE int getYPosition(int modelIndex, int index) const; Q_INVOKABLE void selectNext(); diff --git a/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp b/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp index 7446638c55a..e233c08533a 100644 --- a/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp +++ b/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp @@ -346,6 +346,12 @@ const QVariantList SceneGraphTimelineModel::getEventDetails(int index) const return result; } +const QVariantMap SceneGraphTimelineModel::getEventLocation(int /*index*/) const +{ + QVariantMap map; + return map; +} + bool compareStartTimes(const SceneGraphTimelineModel::SceneGraphEvent&t1, const SceneGraphTimelineModel::SceneGraphEvent &t2) { return t1.startTime < t2.startTime; diff --git a/plugins/qmlprofilerextended/scenegraphtimelinemodel.h b/plugins/qmlprofilerextended/scenegraphtimelinemodel.h index 255ff936d54..ff6e72cf1d7 100644 --- a/plugins/qmlprofilerextended/scenegraphtimelinemodel.h +++ b/plugins/qmlprofilerextended/scenegraphtimelinemodel.h @@ -81,6 +81,7 @@ public: Q_INVOKABLE const QVariantList getLabelsForCategory(int category) const; Q_INVOKABLE const QVariantList getEventDetails(int index) const; + Q_INVOKABLE const QVariantMap getEventLocation(int index) const; void loadData(); void clear(); -- cgit v1.2.3