QmlProfiler: changed labels in context menu for statistics

Change-Id: I125016944130c7171423e2dec80b2b03832cd282
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Christiaan Janssen
2011-11-10 11:19:22 +01:00
parent d09b3b903d
commit efa7e7a43a
3 changed files with 29 additions and 7 deletions

View File

@@ -117,6 +117,8 @@ QmlProfilerEventsWidget::QmlProfilerEventsWidget(QmlJsDebugClient::QmlProfilerEv
connect(model,SIGNAL(dataReady()),m_eventChildren,SLOT(clear()));
connect(model,SIGNAL(dataReady()),m_eventParents,SLOT(clear()));
}
m_globalStatsEnabled = true;
}
QmlProfilerEventsWidget::~QmlProfilerEventsWidget()
@@ -143,6 +145,7 @@ void QmlProfilerEventsWidget::getStatisticsInRange(qint64 rangeStart, qint64 ran
{
clear();
m_eventTree->getStatisticsInRange(rangeStart, rangeEnd);
m_globalStatsEnabled = m_eventTree->isRangeGlobal(rangeStart, rangeEnd);
}
QModelIndex QmlProfilerEventsWidget::selectedItem() const
@@ -178,6 +181,11 @@ void QmlProfilerEventsWidget::updateSelectedEvent(int eventId) const
m_eventTree->selectEvent(eventId);
}
bool QmlProfilerEventsWidget::hasGlobalStats() const
{
return m_globalStatsEnabled;
}
////////////////////////////////////////////////////////////////////////////////////
class QmlProfilerEventsMainView::QmlProfilerEventsMainViewPrivate
@@ -553,6 +561,11 @@ void QmlProfilerEventsMainView::getStatisticsInRange(qint64 rangeStart, qint64 r
buildModel();
}
bool QmlProfilerEventsMainView::isRangeGlobal(qint64 rangeStart, qint64 rangeEnd) const
{
return d->m_eventStatistics->traceStartTime() == rangeStart && d->m_eventStatistics->traceEndTime() == rangeEnd;
}
int QmlProfilerEventsMainView::selectedEventId() const
{
QModelIndex index = selectedItem();
@@ -723,6 +736,7 @@ void QmlProfilerEventsParentsAndChildrenView::displayEvent(int eventId)
updateHeader();
resizeColumnToContents(0);
setSortingEnabled(true);
}
void QmlProfilerEventsParentsAndChildrenView::rebuildTree(void *eventList)

View File

@@ -70,6 +70,8 @@ public:
void copyTableToClipboard() const;
void copyRowToClipboard() const;
bool hasGlobalStats() const;
signals:
void gotoSourceLocation(const QString &fileName, int lineNumber);
void contextMenuRequested(const QPoint &position);
@@ -85,6 +87,8 @@ private:
QmlProfilerEventsMainView *m_eventTree;
QmlProfilerEventsParentsAndChildrenView *m_eventChildren;
QmlProfilerEventsParentsAndChildrenView *m_eventParents;
bool m_globalStatsEnabled;
};
class QmlProfilerEventsMainView : public QTreeView
@@ -134,6 +138,7 @@ public:
static QString nameForType(int typeNumber);
void getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd);
bool isRangeGlobal(qint64 rangeStart, qint64 rangeEnd) const;
int selectedEventId() const;
signals:

View File

@@ -192,6 +192,16 @@ void QmlProfilerTool::showContextMenu(const QPoint &position)
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->getEventList()->count() > 0) {
menu.addSeparator();
@@ -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);
if (selectedAction) {