forked from qt-creator/qt-creator
QmlProfiler: De-pimpl QmlProfilerViewManager
The change is purely mechanical. QmlProfilerViewManager is an internal class, not even extra #includes are needed. Change-Id: Ia28b3a90c8c7dfeb1eb2510b4030c566bc264a46 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -26,14 +26,10 @@
|
|||||||
#include "qmlprofilerviewmanager.h"
|
#include "qmlprofilerviewmanager.h"
|
||||||
|
|
||||||
#include "qmlprofilertool.h"
|
#include "qmlprofilertool.h"
|
||||||
#include "qmlprofilerstatemanager.h"
|
|
||||||
#include "qmlprofilermodelmanager.h"
|
|
||||||
#include "qmlprofilerstatewidget.h"
|
#include "qmlprofilerstatewidget.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <debugger/analyzer/analyzermanager.h>
|
#include <debugger/analyzer/analyzermanager.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
|
|
||||||
@@ -43,48 +39,27 @@ using namespace Utils;
|
|||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlProfilerViewManager::QmlProfilerViewManagerPrivate {
|
|
||||||
public:
|
|
||||||
QmlProfilerTraceView *traceView;
|
|
||||||
QmlProfilerStatisticsView *statisticsView;
|
|
||||||
FlameGraphView *flameGraphView;
|
|
||||||
QmlProfilerStateManager *profilerState;
|
|
||||||
QmlProfilerModelManager *profilerModelManager;
|
|
||||||
};
|
|
||||||
|
|
||||||
QmlProfilerViewManager::QmlProfilerViewManager(QObject *parent,
|
QmlProfilerViewManager::QmlProfilerViewManager(QObject *parent,
|
||||||
QmlProfilerModelManager *modelManager,
|
QmlProfilerModelManager *modelManager,
|
||||||
QmlProfilerStateManager *profilerState)
|
QmlProfilerStateManager *profilerState)
|
||||||
: QObject(parent), d(new QmlProfilerViewManagerPrivate)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
setObjectName(QLatin1String("QML Profiler View Manager"));
|
setObjectName("QML Profiler View Manager");
|
||||||
d->traceView = nullptr;
|
m_profilerState = profilerState;
|
||||||
d->statisticsView = nullptr;
|
m_profilerModelManager = modelManager;
|
||||||
d->flameGraphView = nullptr;
|
|
||||||
d->profilerState = profilerState;
|
|
||||||
d->profilerModelManager = modelManager;
|
|
||||||
createViews();
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlProfilerViewManager::~QmlProfilerViewManager()
|
QTC_ASSERT(m_profilerModelManager, return);
|
||||||
{
|
QTC_ASSERT(m_profilerState, return);
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerViewManager::createViews()
|
m_traceView = new QmlProfilerTraceView(0, this, m_profilerModelManager);
|
||||||
{
|
connect(m_traceView, &QmlProfilerTraceView::gotoSourceLocation,
|
||||||
QTC_ASSERT(d->profilerModelManager, return);
|
|
||||||
QTC_ASSERT(d->profilerState, return);
|
|
||||||
|
|
||||||
d->traceView = new QmlProfilerTraceView(0, this, d->profilerModelManager);
|
|
||||||
connect(d->traceView, &QmlProfilerTraceView::gotoSourceLocation,
|
|
||||||
this, &QmlProfilerViewManager::gotoSourceLocation);
|
this, &QmlProfilerViewManager::gotoSourceLocation);
|
||||||
connect(d->traceView, &QmlProfilerTraceView::typeSelected,
|
connect(m_traceView, &QmlProfilerTraceView::typeSelected,
|
||||||
this, &QmlProfilerViewManager::typeSelected);
|
this, &QmlProfilerViewManager::typeSelected);
|
||||||
connect(this, &QmlProfilerViewManager::typeSelected,
|
connect(this, &QmlProfilerViewManager::typeSelected,
|
||||||
d->traceView, &QmlProfilerTraceView::selectByTypeId);
|
m_traceView, &QmlProfilerTraceView::selectByTypeId);
|
||||||
|
|
||||||
new QmlProfilerStateWidget(d->profilerState, d->profilerModelManager, d->traceView);
|
new QmlProfilerStateWidget(m_profilerState, m_profilerModelManager, m_traceView);
|
||||||
|
|
||||||
auto perspective = new Utils::Perspective;
|
auto perspective = new Utils::Perspective;
|
||||||
perspective->setName(tr("QML Profiler"));
|
perspective->setName(tr("QML Profiler"));
|
||||||
@@ -94,58 +69,43 @@ void QmlProfilerViewManager::createViews()
|
|||||||
this, &QmlProfilerViewManager::typeSelected);
|
this, &QmlProfilerViewManager::typeSelected);
|
||||||
connect(this, &QmlProfilerViewManager::typeSelected,
|
connect(this, &QmlProfilerViewManager::typeSelected,
|
||||||
view, &QmlProfilerEventsView::selectByTypeId);
|
view, &QmlProfilerEventsView::selectByTypeId);
|
||||||
connect(d->profilerModelManager, &QmlProfilerModelManager::visibleFeaturesChanged,
|
connect(m_profilerModelManager, &QmlProfilerModelManager::visibleFeaturesChanged,
|
||||||
view, &QmlProfilerEventsView::onVisibleFeaturesChanged);
|
view, &QmlProfilerEventsView::onVisibleFeaturesChanged);
|
||||||
connect(view, &QmlProfilerEventsView::gotoSourceLocation,
|
connect(view, &QmlProfilerEventsView::gotoSourceLocation,
|
||||||
this, &QmlProfilerViewManager::gotoSourceLocation);
|
this, &QmlProfilerViewManager::gotoSourceLocation);
|
||||||
connect(view, &QmlProfilerEventsView::showFullRange,
|
connect(view, &QmlProfilerEventsView::showFullRange,
|
||||||
this, [this](){ d->profilerModelManager->restrictToRange(-1, -1);});
|
this, [this](){ m_profilerModelManager->restrictToRange(-1, -1);});
|
||||||
new QmlProfilerStateWidget(d->profilerState, d->profilerModelManager, view);
|
new QmlProfilerStateWidget(m_profilerState, m_profilerModelManager, view);
|
||||||
};
|
};
|
||||||
|
|
||||||
d->statisticsView = new QmlProfilerStatisticsView(d->profilerModelManager);
|
m_statisticsView = new QmlProfilerStatisticsView(m_profilerModelManager);
|
||||||
prepareEventsView(d->statisticsView);
|
prepareEventsView(m_statisticsView);
|
||||||
d->flameGraphView = new FlameGraphView(d->profilerModelManager);
|
m_flameGraphView = new FlameGraphView(m_profilerModelManager);
|
||||||
prepareEventsView(d->flameGraphView);
|
prepareEventsView(m_flameGraphView);
|
||||||
|
|
||||||
QByteArray anchorDockId;
|
QByteArray anchorDockId;
|
||||||
if (d->traceView->isUsable()) {
|
if (m_traceView->isUsable()) {
|
||||||
anchorDockId = d->traceView->objectName().toLatin1();
|
anchorDockId = m_traceView->objectName().toLatin1();
|
||||||
perspective->addOperation({anchorDockId, d->traceView, {}, Perspective::SplitVertical});
|
perspective->addOperation({anchorDockId, m_traceView, {}, Perspective::SplitVertical});
|
||||||
perspective->addOperation({d->flameGraphView->objectName().toLatin1(), d->flameGraphView,
|
perspective->addOperation({m_flameGraphView->objectName().toLatin1(), m_flameGraphView,
|
||||||
anchorDockId, Perspective::AddToTab});
|
anchorDockId, Perspective::AddToTab});
|
||||||
} else {
|
} else {
|
||||||
anchorDockId = d->flameGraphView->objectName().toLatin1();
|
anchorDockId = m_flameGraphView->objectName().toLatin1();
|
||||||
perspective->addOperation({anchorDockId, d->flameGraphView, {},
|
perspective->addOperation({anchorDockId, m_flameGraphView, {},
|
||||||
Perspective::SplitVertical});
|
Perspective::SplitVertical});
|
||||||
}
|
}
|
||||||
perspective->addOperation({d->statisticsView->objectName().toLatin1(), d->statisticsView,
|
perspective->addOperation({m_statisticsView->objectName().toLatin1(), m_statisticsView,
|
||||||
anchorDockId, Perspective::AddToTab});
|
anchorDockId, Perspective::AddToTab});
|
||||||
perspective->addOperation({anchorDockId, 0, {}, Perspective::Raise});
|
perspective->addOperation({anchorDockId, 0, {}, Perspective::Raise});
|
||||||
|
|
||||||
Debugger::registerPerspective(Constants::QmlProfilerPerspectiveId, perspective);
|
Debugger::registerPerspective(Constants::QmlProfilerPerspectiveId, perspective);
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerTraceView *QmlProfilerViewManager::traceView() const
|
|
||||||
{
|
|
||||||
return d->traceView;
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlProfilerStatisticsView *QmlProfilerViewManager::statisticsView() const
|
|
||||||
{
|
|
||||||
return d->statisticsView;
|
|
||||||
}
|
|
||||||
|
|
||||||
FlameGraphView *QmlProfilerViewManager::flameGraphView() const
|
|
||||||
{
|
|
||||||
return d->flameGraphView;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerViewManager::clear()
|
void QmlProfilerViewManager::clear()
|
||||||
{
|
{
|
||||||
d->traceView->clear();
|
m_traceView->clear();
|
||||||
d->flameGraphView->clear();
|
m_flameGraphView->clear();
|
||||||
d->statisticsView->clear();
|
m_statisticsView->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -28,12 +28,10 @@
|
|||||||
#include "qmlprofilerstatisticsview.h"
|
#include "qmlprofilerstatisticsview.h"
|
||||||
#include "qmlprofilertraceview.h"
|
#include "qmlprofilertraceview.h"
|
||||||
#include "flamegraphview.h"
|
#include "flamegraphview.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
class QmlProfilerModelManager;
|
|
||||||
class QmlProfilerStateManager;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlProfilerTool;
|
class QmlProfilerTool;
|
||||||
@@ -41,19 +39,16 @@ class QmlProfilerTool;
|
|||||||
class QmlProfilerViewManager : public QObject
|
class QmlProfilerViewManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QmlProfilerViewManager(QObject *parent,
|
QmlProfilerViewManager(QObject *parent,
|
||||||
QmlProfilerModelManager *modelManager,
|
QmlProfilerModelManager *modelManager,
|
||||||
QmlProfilerStateManager *profilerState);
|
QmlProfilerStateManager *profilerState);
|
||||||
~QmlProfilerViewManager();
|
|
||||||
|
|
||||||
void createViews();
|
QmlProfilerTraceView *traceView() const { return m_traceView; }
|
||||||
|
QmlProfilerStatisticsView *statisticsView() const { return m_statisticsView; }
|
||||||
|
FlameGraphView *flameGraphView() const { return m_flameGraphView; }
|
||||||
|
|
||||||
QmlProfilerTraceView *traceView() const;
|
|
||||||
QmlProfilerStatisticsView *statisticsView() const;
|
|
||||||
FlameGraphView *flameGraphView() const;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -61,8 +56,11 @@ signals:
|
|||||||
void gotoSourceLocation(QString,int,int);
|
void gotoSourceLocation(QString,int,int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class QmlProfilerViewManagerPrivate;
|
QmlProfilerTraceView *m_traceView = nullptr;
|
||||||
QmlProfilerViewManagerPrivate *d;
|
QmlProfilerStatisticsView *m_statisticsView = nullptr;
|
||||||
|
FlameGraphView *m_flameGraphView = nullptr;
|
||||||
|
QmlProfilerStateManager *m_profilerState = nullptr;
|
||||||
|
QmlProfilerModelManager *m_profilerModelManager = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user