forked from qt-creator/qt-creator
Re-enable navigation to file in timeline
Change-Id: I6e794ee98380fa8543fc0266bd8cec7b525e1e68 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
This commit is contained in:
committed by
Christiaan Janssen
parent
6f279f1225
commit
c045b43e13
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -415,6 +415,12 @@ const QVariantList PaintEventsModelProxy::getEventDetails(int index) const
|
||||
return result;
|
||||
}
|
||||
|
||||
const QVariantMap PaintEventsModelProxy::getEventLocation(int /*index*/) const
|
||||
{
|
||||
QVariantMap map;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user