aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2013-06-11 16:18:02 +0200
committerChristiaan Janssen <christiaan.janssen@digia.com>2013-06-13 13:27:37 +0300
commitc045b43e13ad33c65709db6f717f399d3b1cf5f8 (patch)
tree017bd3d576214dc12c5db9f6740aaed2b0da9d2c
parent6f279f122548cba18e9466157fa7727d756baf28 (diff)
Re-enable navigation to file in timeline
Change-Id: I6e794ee98380fa8543fc0266bd8cec7b525e1e68 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
-rw-r--r--plugins/qmlprofiler/abstracttimelinemodel.h3
-rw-r--r--plugins/qmlprofiler/qml/MainView.qml22
-rw-r--r--plugins/qmlprofiler/qml/RangeDetails.qml13
-rw-r--r--plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp6
-rw-r--r--plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h1
-rw-r--r--plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp15
-rw-r--r--plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h1
-rw-r--r--plugins/qmlprofiler/timelinemodelaggregator.cpp5
-rw-r--r--plugins/qmlprofiler/timelinemodelaggregator.h1
-rw-r--r--plugins/qmlprofiler/timelinerenderer.cpp20
-rw-r--r--plugins/qmlprofiler/timelinerenderer.h4
-rw-r--r--plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp6
-rw-r--r--plugins/qmlprofilerextended/scenegraphtimelinemodel.h1
13 files changed, 56 insertions, 42 deletions
diff --git a/plugins/qmlprofiler/abstracttimelinemodel.h b/plugins/qmlprofiler/abstracttimelinemodel.h
index 4a679e0ae1..7ef5dc821e 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 efb6d0365e..f1420d3be5 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 ef1a19234b..c066b06bde 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 75e1710d9f..466c3461ea 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 bdfbbb6d6a..03b7343318 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 66cf866c16..dc3bc8752e 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 616013e8d9..2ee1610388 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 5391da5696..99c284aea8 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 7468d06613..4f650bb4a5 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 0fe4674206..741e357989 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 e43b1473ef..128f191d88 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 7446638c55..e233c08533 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 255ff936d5..ff6e72cf1d 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();