Commit efa7e7a4 authored by Christiaan Janssen's avatar Christiaan Janssen
Browse files

QmlProfiler: changed labels in context menu for statistics



Change-Id: I125016944130c7171423e2dec80b2b03832cd282
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent d09b3b90
...@@ -117,6 +117,8 @@ QmlProfilerEventsWidget::QmlProfilerEventsWidget(QmlJsDebugClient::QmlProfilerEv ...@@ -117,6 +117,8 @@ QmlProfilerEventsWidget::QmlProfilerEventsWidget(QmlJsDebugClient::QmlProfilerEv
connect(model,SIGNAL(dataReady()),m_eventChildren,SLOT(clear())); connect(model,SIGNAL(dataReady()),m_eventChildren,SLOT(clear()));
connect(model,SIGNAL(dataReady()),m_eventParents,SLOT(clear())); connect(model,SIGNAL(dataReady()),m_eventParents,SLOT(clear()));
} }
m_globalStatsEnabled = true;
} }
QmlProfilerEventsWidget::~QmlProfilerEventsWidget() QmlProfilerEventsWidget::~QmlProfilerEventsWidget()
...@@ -143,6 +145,7 @@ void QmlProfilerEventsWidget::getStatisticsInRange(qint64 rangeStart, qint64 ran ...@@ -143,6 +145,7 @@ void QmlProfilerEventsWidget::getStatisticsInRange(qint64 rangeStart, qint64 ran
{ {
clear(); clear();
m_eventTree->getStatisticsInRange(rangeStart, rangeEnd); m_eventTree->getStatisticsInRange(rangeStart, rangeEnd);
m_globalStatsEnabled = m_eventTree->isRangeGlobal(rangeStart, rangeEnd);
} }
QModelIndex QmlProfilerEventsWidget::selectedItem() const QModelIndex QmlProfilerEventsWidget::selectedItem() const
...@@ -178,6 +181,11 @@ void QmlProfilerEventsWidget::updateSelectedEvent(int eventId) const ...@@ -178,6 +181,11 @@ void QmlProfilerEventsWidget::updateSelectedEvent(int eventId) const
m_eventTree->selectEvent(eventId); m_eventTree->selectEvent(eventId);
} }
bool QmlProfilerEventsWidget::hasGlobalStats() const
{
return m_globalStatsEnabled;
}
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
class QmlProfilerEventsMainView::QmlProfilerEventsMainViewPrivate class QmlProfilerEventsMainView::QmlProfilerEventsMainViewPrivate
...@@ -553,6 +561,11 @@ void QmlProfilerEventsMainView::getStatisticsInRange(qint64 rangeStart, qint64 r ...@@ -553,6 +561,11 @@ void QmlProfilerEventsMainView::getStatisticsInRange(qint64 rangeStart, qint64 r
buildModel(); buildModel();
} }
bool QmlProfilerEventsMainView::isRangeGlobal(qint64 rangeStart, qint64 rangeEnd) const
{
return d->m_eventStatistics->traceStartTime() == rangeStart && d->m_eventStatistics->traceEndTime() == rangeEnd;
}
int QmlProfilerEventsMainView::selectedEventId() const int QmlProfilerEventsMainView::selectedEventId() const
{ {
QModelIndex index = selectedItem(); QModelIndex index = selectedItem();
...@@ -723,6 +736,7 @@ void QmlProfilerEventsParentsAndChildrenView::displayEvent(int eventId) ...@@ -723,6 +736,7 @@ void QmlProfilerEventsParentsAndChildrenView::displayEvent(int eventId)
updateHeader(); updateHeader();
resizeColumnToContents(0); resizeColumnToContents(0);
setSortingEnabled(true);
} }
void QmlProfilerEventsParentsAndChildrenView::rebuildTree(void *eventList) void QmlProfilerEventsParentsAndChildrenView::rebuildTree(void *eventList)
......
...@@ -70,6 +70,8 @@ public: ...@@ -70,6 +70,8 @@ public:
void copyTableToClipboard() const; void copyTableToClipboard() const;
void copyRowToClipboard() const; void copyRowToClipboard() const;
bool hasGlobalStats() const;
signals: signals:
void gotoSourceLocation(const QString &fileName, int lineNumber); void gotoSourceLocation(const QString &fileName, int lineNumber);
void contextMenuRequested(const QPoint &position); void contextMenuRequested(const QPoint &position);
...@@ -85,6 +87,8 @@ private: ...@@ -85,6 +87,8 @@ private:
QmlProfilerEventsMainView *m_eventTree; QmlProfilerEventsMainView *m_eventTree;
QmlProfilerEventsParentsAndChildrenView *m_eventChildren; QmlProfilerEventsParentsAndChildrenView *m_eventChildren;
QmlProfilerEventsParentsAndChildrenView *m_eventParents; QmlProfilerEventsParentsAndChildrenView *m_eventParents;
bool m_globalStatsEnabled;
}; };
class QmlProfilerEventsMainView : public QTreeView class QmlProfilerEventsMainView : public QTreeView
...@@ -134,6 +138,7 @@ public: ...@@ -134,6 +138,7 @@ public:
static QString nameForType(int typeNumber); static QString nameForType(int typeNumber);
void getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd); void getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd);
bool isRangeGlobal(qint64 rangeStart, qint64 rangeEnd) const;
int selectedEventId() const; int selectedEventId() const;
signals: signals:
......
...@@ -192,6 +192,16 @@ void QmlProfilerTool::showContextMenu(const QPoint &position) ...@@ -192,6 +192,16 @@ void QmlProfilerTool::showContextMenu(const QPoint &position)
copyTableAction = menu.addAction(tr("Copy Table")); copyTableAction = menu.addAction(tr("Copy Table"));
} }
if (sender() == d->m_traceWindow || sender() == d->m_eventsView) {
menu.addSeparator();
getLocalStatsAction = menu.addAction(tr("Limit Events Pane to Current Range"));
if (!d->m_traceWindow->hasValidSelection())
getLocalStatsAction->setEnabled(false);
getGlobalStatsAction = menu.addAction(tr("Reset Events Pane"));
if (d->m_eventsView->hasGlobalStats())
getGlobalStatsAction->setEnabled(false);
}
if (traceView) { if (traceView) {
if (traceView->getEventList()->count() > 0) { if (traceView->getEventList()->count() > 0) {
menu.addSeparator(); menu.addSeparator();
...@@ -199,13 +209,6 @@ void QmlProfilerTool::showContextMenu(const QPoint &position) ...@@ -199,13 +209,6 @@ void QmlProfilerTool::showContextMenu(const QPoint &position)
} }
} }
if (sender() == d->m_traceWindow || sender() == d->m_eventsView) {
menu.addSeparator();
if (d->m_traceWindow->hasValidSelection())
getLocalStatsAction = menu.addAction(tr("Get Stats For Current Range"));
getGlobalStatsAction = menu.addAction(tr("Get Global Statistics"));
}
QAction *selectedAction = menu.exec(position); QAction *selectedAction = menu.exec(position);
if (selectedAction) { if (selectedAction) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment