forked from qt-creator/qt-creator
QmlProfiler: Reduce external interface of QQmlProfilerEventsWidget
Change-Id: I06a610cca606b98bc3f5741c1363b98f2b28d7eb Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -262,7 +262,7 @@ void QmlProfilerEventsWidget::clear()
|
||||
d->m_eventParents->clear();
|
||||
}
|
||||
|
||||
void QmlProfilerEventsWidget::getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd)
|
||||
void QmlProfilerEventsWidget::restrictToRange(qint64 rangeStart, qint64 rangeEnd)
|
||||
{
|
||||
d->rangeStart = rangeStart;
|
||||
d->rangeEnd = rangeEnd;
|
||||
@@ -310,7 +310,7 @@ void QmlProfilerEventsWidget::contextMenuEvent(QContextMenuEvent *ev)
|
||||
if (!d->m_viewContainer->hasValidSelection())
|
||||
getLocalStatsAction->setEnabled(false);
|
||||
getGlobalStatsAction = menu.addAction(tr("Show Full Range"));
|
||||
if (hasGlobalStats())
|
||||
if (!isRestrictedToRange())
|
||||
getGlobalStatsAction->setEnabled(false);
|
||||
|
||||
QAction *selectedAction = menu.exec(position);
|
||||
@@ -321,22 +321,16 @@ void QmlProfilerEventsWidget::contextMenuEvent(QContextMenuEvent *ev)
|
||||
if (selectedAction == copyTableAction)
|
||||
copyTableToClipboard();
|
||||
if (selectedAction == getLocalStatsAction) {
|
||||
getStatisticsInRange(d->m_viewContainer->selectionStart(),
|
||||
d->m_viewContainer->selectionEnd());
|
||||
restrictToRange(d->m_viewContainer->selectionStart(),
|
||||
d->m_viewContainer->selectionEnd());
|
||||
}
|
||||
if (selectedAction == getGlobalStatsAction)
|
||||
getStatisticsInRange(-1, -1);
|
||||
restrictToRange(-1, -1);
|
||||
if (selectedAction == showExtendedStatsAction)
|
||||
setShowExtendedStatistics(!showExtendedStatistics());
|
||||
}
|
||||
}
|
||||
|
||||
void QmlProfilerEventsWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
emit resized();
|
||||
}
|
||||
|
||||
bool QmlProfilerEventsWidget::mouseOnTable(const QPoint &position) const
|
||||
{
|
||||
QPoint tableTopLeft = d->m_eventTree->mapToGlobal(QPoint(0,0));
|
||||
@@ -354,7 +348,7 @@ void QmlProfilerEventsWidget::copyRowToClipboard() const
|
||||
d->m_eventTree->copyRowToClipboard();
|
||||
}
|
||||
|
||||
void QmlProfilerEventsWidget::selectByTypeId(int typeIndex) const
|
||||
void QmlProfilerEventsWidget::selectByTypeId(int typeIndex)
|
||||
{
|
||||
if (d->m_eventTree->selectedTypeId() != typeIndex)
|
||||
d->m_eventTree->selectType(typeIndex);
|
||||
@@ -371,9 +365,9 @@ void QmlProfilerEventsWidget::onVisibleFeaturesChanged(quint64 features)
|
||||
d->modelProxy->limitToRange(d->rangeStart, d->rangeEnd);
|
||||
}
|
||||
|
||||
bool QmlProfilerEventsWidget::hasGlobalStats() const
|
||||
bool QmlProfilerEventsWidget::isRestrictedToRange() const
|
||||
{
|
||||
return d->rangeStart == -1 && d->rangeEnd == -1;
|
||||
return d->rangeStart != -1 || d->rangeEnd != -1;
|
||||
}
|
||||
|
||||
void QmlProfilerEventsWidget::setShowExtendedStatistics(bool show)
|
||||
|
||||
@@ -88,31 +88,28 @@ public:
|
||||
~QmlProfilerEventsWidget();
|
||||
|
||||
void clear();
|
||||
|
||||
void getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd);
|
||||
QModelIndex selectedModelIndex() const;
|
||||
bool mouseOnTable(const QPoint &position) const;
|
||||
void copyTableToClipboard() const;
|
||||
void copyRowToClipboard() const;
|
||||
|
||||
bool hasGlobalStats() const;
|
||||
void setShowExtendedStatistics(bool show);
|
||||
bool showExtendedStatistics() const;
|
||||
void restrictToRange(qint64 rangeStart, qint64 rangeEnd);
|
||||
bool isRestrictedToRange() const;
|
||||
|
||||
signals:
|
||||
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
|
||||
void typeSelected(int typeIndex);
|
||||
void resized();
|
||||
|
||||
public slots:
|
||||
void selectByTypeId(int typeIndex) const;
|
||||
void selectByTypeId(int typeIndex);
|
||||
void onVisibleFeaturesChanged(quint64 features);
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *ev);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private:
|
||||
QModelIndex selectedModelIndex() const;
|
||||
void copyTableToClipboard() const;
|
||||
void copyRowToClipboard() const;
|
||||
bool mouseOnTable(const QPoint &position) const;
|
||||
void setShowExtendedStatistics(bool show);
|
||||
bool showExtendedStatistics() const;
|
||||
|
||||
class QmlProfilerEventsWidgetPrivate;
|
||||
QmlProfilerEventsWidgetPrivate *d;
|
||||
};
|
||||
|
||||
@@ -253,7 +253,7 @@ void QmlProfilerTraceView::showContextMenu(QPoint position)
|
||||
getLocalStatsAction->setEnabled(false);
|
||||
|
||||
QAction *getGlobalStatsAction = menu.addAction(tr("Show Full Range in Events Pane"));
|
||||
if (d->m_viewContainer->hasGlobalStats())
|
||||
if (!d->m_viewContainer->isEventsRestrictedToRange())
|
||||
getGlobalStatsAction->setEnabled(false);
|
||||
|
||||
if (d->m_zoomControl->traceDuration() > 0) {
|
||||
@@ -269,12 +269,11 @@ void QmlProfilerTraceView::showContextMenu(QPoint position)
|
||||
d->m_zoomControl->traceEnd());
|
||||
}
|
||||
if (selectedAction == getLocalStatsAction) {
|
||||
d->m_viewContainer->getStatisticsInRange(
|
||||
d->m_viewContainer->selectionStart(),
|
||||
d->m_viewContainer->selectionEnd());
|
||||
d->m_viewContainer->restrictEventsToRange(d->m_viewContainer->selectionStart(),
|
||||
d->m_viewContainer->selectionEnd());
|
||||
}
|
||||
if (selectedAction == getGlobalStatsAction)
|
||||
d->m_viewContainer->getStatisticsInRange(-1, -1);
|
||||
d->m_viewContainer->restrictEventsToRange(-1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,14 +139,14 @@ qint64 QmlProfilerViewManager::selectionEnd() const
|
||||
return d->traceView->selectionEnd();
|
||||
}
|
||||
|
||||
bool QmlProfilerViewManager::hasGlobalStats() const
|
||||
bool QmlProfilerViewManager::isEventsRestrictedToRange() const
|
||||
{
|
||||
return d->eventsView->hasGlobalStats();
|
||||
return d->eventsView->isRestrictedToRange();
|
||||
}
|
||||
|
||||
void QmlProfilerViewManager::getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd)
|
||||
void QmlProfilerViewManager::restrictEventsToRange(qint64 rangeStart, qint64 rangeEnd)
|
||||
{
|
||||
d->eventsView->getStatisticsInRange(rangeStart, rangeEnd);
|
||||
d->eventsView->restrictToRange(rangeStart, rangeEnd);
|
||||
}
|
||||
|
||||
void QmlProfilerViewManager::raiseTimeline()
|
||||
|
||||
@@ -57,8 +57,8 @@ public:
|
||||
bool hasValidSelection() const;
|
||||
qint64 selectionStart() const;
|
||||
qint64 selectionEnd() const;
|
||||
bool hasGlobalStats() const;
|
||||
void getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd);
|
||||
bool isEventsRestrictedToRange() const;
|
||||
void restrictEventsToRange(qint64 rangeStart, qint64 rangeEnd);
|
||||
|
||||
void raiseTimeline();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user