Commit 516c0d60 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Move timeline classes into own namespace

The new namespace "Timeline" is for classes that are supposed to go to
the generic timeline library later.

Change-Id: I1f6dce59de2c37398b1ed89473e1a94ec020104b
Reviewed-by: default avatarKai Koehne <kai.koehne@theqtcompany.com>
parent c86efd21
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
BindingLoopMaterial(); BindingLoopMaterial();
}; };
struct BindingLoopsRenderPassState : public TimelineRenderPass::State { struct BindingLoopsRenderPassState : public Timeline::TimelineRenderPass::State {
BindingLoopsRenderPassState() : indexFrom(std::numeric_limits<int>::max()), indexTo(-1) {} BindingLoopsRenderPassState() : indexFrom(std::numeric_limits<int>::max()), indexTo(-1) {}
BindingLoopMaterial material; BindingLoopMaterial material;
int indexFrom; int indexFrom;
...@@ -81,7 +81,8 @@ QmlProfilerBindingLoopsRenderPass::QmlProfilerBindingLoopsRenderPass() ...@@ -81,7 +81,8 @@ QmlProfilerBindingLoopsRenderPass::QmlProfilerBindingLoopsRenderPass()
} }
void updateNodes(const QmlProfilerRangeModel *model, int from, int to, void updateNodes(const QmlProfilerRangeModel *model, int from, int to,
const TimelineRenderState *parentState, BindingLoopsRenderPassState *state) const Timeline::TimelineRenderState *parentState,
BindingLoopsRenderPassState *state)
{ {
QVector<BindlingLoopsGeometry> expandedPerRow(model->expandedRowCount()); QVector<BindlingLoopsGeometry> expandedPerRow(model->expandedRowCount());
BindlingLoopsGeometry collapsed; BindlingLoopsGeometry collapsed;
...@@ -114,7 +115,7 @@ void updateNodes(const QmlProfilerRangeModel *model, int from, int to, ...@@ -114,7 +115,7 @@ void updateNodes(const QmlProfilerRangeModel *model, int from, int to,
state->collapsedOverlay->appendChildNode(collapsed.node); state->collapsedOverlay->appendChildNode(collapsed.node);
} }
int rowHeight = TimelineModel::defaultRowHeight(); int rowHeight = Timeline::TimelineModel::defaultRowHeight();
for (int i = from; i < to; ++i) { for (int i = from; i < to; ++i) {
int bindingLoopDest = model->bindingLoopDest(i); int bindingLoopDest = model->bindingLoopDest(i);
if (bindingLoopDest == -1) if (bindingLoopDest == -1)
...@@ -141,8 +142,9 @@ void updateNodes(const QmlProfilerRangeModel *model, int from, int to, ...@@ -141,8 +142,9 @@ void updateNodes(const QmlProfilerRangeModel *model, int from, int to,
} }
} }
TimelineRenderPass::State *QmlProfilerBindingLoopsRenderPass::update( Timeline::TimelineRenderPass::State *QmlProfilerBindingLoopsRenderPass::update(
const TimelineRenderer *renderer, const TimelineRenderState *parentState, State *oldState, const Timeline::TimelineRenderer *renderer,
const Timeline::TimelineRenderState *parentState, State *oldState,
int indexFrom, int indexTo, bool stateChanged, qreal spacing) const int indexFrom, int indexTo, bool stateChanged, qreal spacing) const
{ {
Q_UNUSED(stateChanged); Q_UNUSED(stateChanged);
...@@ -238,7 +240,7 @@ void BindlingLoopsGeometry::allocate(QSGMaterial *material) ...@@ -238,7 +240,7 @@ void BindlingLoopsGeometry::allocate(QSGMaterial *material)
void BindlingLoopsGeometry::addExpandedEvent(float itemCenter) void BindlingLoopsGeometry::addExpandedEvent(float itemCenter)
{ {
float verticalCenter = TimelineModel::defaultRowHeight() / 2.0; float verticalCenter = Timeline::TimelineModel::defaultRowHeight() / 2.0;
Point2DWithOffset *v = vertexData() + usedVertices; Point2DWithOffset *v = vertexData() + usedVertices;
v[0].set(itemCenter, verticalCenter, -1.0f, currentY); v[0].set(itemCenter, verticalCenter, -1.0f, currentY);
v[1].set(itemCenter, verticalCenter, +1.0f, currentY); v[1].set(itemCenter, verticalCenter, +1.0f, currentY);
......
...@@ -40,11 +40,12 @@ ...@@ -40,11 +40,12 @@
namespace QmlProfiler { namespace QmlProfiler {
namespace Internal { namespace Internal {
class QmlProfilerBindingLoopsRenderPass : public TimelineRenderPass class QmlProfilerBindingLoopsRenderPass : public Timeline::TimelineRenderPass
{ {
public: public:
static const QmlProfilerBindingLoopsRenderPass *instance(); static const QmlProfilerBindingLoopsRenderPass *instance();
State *update(const TimelineRenderer *renderer, const TimelineRenderState *parentState, State *update(const Timeline::TimelineRenderer *renderer,
const Timeline::TimelineRenderState *parentState,
State *oldState, int indexFrom, int indexTo, bool stateChanged, State *oldState, int indexFrom, int indexTo, bool stateChanged,
qreal spacing) const; qreal spacing) const;
protected: protected:
......
...@@ -46,7 +46,7 @@ int QmlProfilerNotesModel::add(int typeId, qint64 start, qint64 duration, const ...@@ -46,7 +46,7 @@ int QmlProfilerNotesModel::add(int typeId, qint64 start, qint64 duration, const
{ {
int timelineModel = -1; int timelineModel = -1;
int timelineIndex = -1; int timelineIndex = -1;
foreach (const TimelineModel *model, timelineModels()) { foreach (const Timeline::TimelineModel *model, timelineModels()) {
if (model->handlesTypeId(typeId)) { if (model->handlesTypeId(typeId)) {
for (int i = model->firstIndex(start); i <= model->lastIndex(start + duration); ++i) { for (int i = model->firstIndex(start); i <= model->lastIndex(start + duration); ++i) {
if (i < 0) if (i < 0)
...@@ -89,7 +89,7 @@ void QmlProfilerNotesModel::saveData() ...@@ -89,7 +89,7 @@ void QmlProfilerNotesModel::saveData()
{ {
QVector<QmlProfilerDataModel::QmlEventNoteData> notes; QVector<QmlProfilerDataModel::QmlEventNoteData> notes;
for (int i = 0; i < count(); ++i) { for (int i = 0; i < count(); ++i) {
const TimelineModel *model = timelineModelByModelId(timelineModel(i)); const Timeline::TimelineModel *model = timelineModelByModelId(timelineModel(i));
if (!model) if (!model)
continue; continue;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <QHash> #include <QHash>
namespace QmlProfiler { namespace QmlProfiler {
class QMLPROFILER_EXPORT QmlProfilerNotesModel : public TimelineNotesModel { class QMLPROFILER_EXPORT QmlProfilerNotesModel : public Timeline::TimelineNotesModel {
Q_OBJECT Q_OBJECT
public: public:
QmlProfilerNotesModel(QObject *parent); QmlProfilerNotesModel(QObject *parent);
...@@ -51,5 +51,5 @@ protected: ...@@ -51,5 +51,5 @@ protected:
int add(int typeId, qint64 startTime, qint64 duration, const QString &text); int add(int typeId, qint64 startTime, qint64 duration, const QString &text);
}; };
} } // namespace QmlProfiler
#endif // NOTESMODEL_H #endif // QMLPROFILERNOTESMODEL_H
...@@ -284,14 +284,14 @@ int QmlProfilerRangeModel::selectionIdForLocation(const QString &filename, int l ...@@ -284,14 +284,14 @@ int QmlProfilerRangeModel::selectionIdForLocation(const QString &filename, int l
return -1; return -1;
} }
QList<const TimelineRenderPass *> QmlProfilerRangeModel::supportedRenderPasses() const QList<const Timeline::TimelineRenderPass *> QmlProfilerRangeModel::supportedRenderPasses() const
{ {
if (supportsBindingLoops()) { if (supportsBindingLoops()) {
QList<const TimelineRenderPass *> passes; QList<const Timeline::TimelineRenderPass *> passes;
passes << TimelineItemsRenderPass::instance() passes << Timeline::TimelineItemsRenderPass::instance()
<< QmlProfilerBindingLoopsRenderPass::instance() << QmlProfilerBindingLoopsRenderPass::instance()
<< TimelineSelectionRenderPass::instance() << Timeline::TimelineSelectionRenderPass::instance()
<< TimelineNotesRenderPass::instance(); << Timeline::TimelineNotesRenderPass::instance();
return passes; return passes;
} else { } else {
return QmlProfilerTimelineModel::supportedRenderPasses(); return QmlProfilerTimelineModel::supportedRenderPasses();
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
int typeId(int index) const; int typeId(int index) const;
int selectionIdForLocation(const QString &filename, int line, int column) const; int selectionIdForLocation(const QString &filename, int line, int column) const;
virtual QList<const TimelineRenderPass *> supportedRenderPasses() const; virtual QList<const Timeline::TimelineRenderPass *> supportedRenderPasses() const;
protected: protected:
void loadData(); void loadData();
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
namespace QmlProfiler { namespace QmlProfiler {
class QMLPROFILER_EXPORT QmlProfilerTimelineModel : public TimelineModel { class QMLPROFILER_EXPORT QmlProfilerTimelineModel : public Timeline::TimelineModel {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QmlDebug::RangeType rangeType READ rangeType CONSTANT) Q_PROPERTY(QmlDebug::RangeType rangeType READ rangeType CONSTANT)
Q_PROPERTY(QmlDebug::Message message READ message CONSTANT) Q_PROPERTY(QmlDebug::Message message READ message CONSTANT)
......
...@@ -80,10 +80,10 @@ public: ...@@ -80,10 +80,10 @@ public:
QQuickView *m_mainView; QQuickView *m_mainView;
QmlProfilerModelManager *m_modelManager; QmlProfilerModelManager *m_modelManager;
TimelineModelAggregator *m_modelProxy; Timeline::TimelineModelAggregator *m_modelProxy;
TimelineZoomControl *m_zoomControl; Timeline::TimelineZoomControl *m_zoomControl;
}; };
QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *modelManager, QmlProfilerStateManager *profilerState) QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerModelManager *modelManager, QmlProfilerStateManager *profilerState)
...@@ -91,18 +91,18 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT ...@@ -91,18 +91,18 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT
{ {
setObjectName(QLatin1String("QML Profiler")); setObjectName(QLatin1String("QML Profiler"));
d->m_zoomControl = new TimelineZoomControl(this); d->m_zoomControl = new Timeline::TimelineZoomControl(this);
connect(modelManager->traceTime(), &QmlProfilerTraceTime::timeChanged, connect(modelManager->traceTime(), &QmlProfilerTraceTime::timeChanged,
d->m_zoomControl, &TimelineZoomControl::setTrace); d->m_zoomControl, &Timeline::TimelineZoomControl::setTrace);
QVBoxLayout *groupLayout = new QVBoxLayout; QVBoxLayout *groupLayout = new QVBoxLayout;
groupLayout->setContentsMargins(0, 0, 0, 0); groupLayout->setContentsMargins(0, 0, 0, 0);
groupLayout->setSpacing(0); groupLayout->setSpacing(0);
qmlRegisterType<TimelineRenderer>("TimelineRenderer", 1, 0, "TimelineRenderer"); qmlRegisterType<Timeline::TimelineRenderer>("TimelineRenderer", 1, 0, "TimelineRenderer");
qmlRegisterType<TimelineZoomControl>(); qmlRegisterType<Timeline::TimelineZoomControl>();
qmlRegisterType<TimelineModel>(); qmlRegisterType<Timeline::TimelineModel>();
qmlRegisterType<TimelineNotesModel>(); qmlRegisterType<Timeline::TimelineNotesModel>();
d->m_mainView = new QmlProfilerQuickView(this); d->m_mainView = new QmlProfilerQuickView(this);
d->m_mainView->setResizeMode(QQuickView::SizeRootObjectToView); d->m_mainView->setResizeMode(QQuickView::SizeRootObjectToView);
...@@ -115,7 +115,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT ...@@ -115,7 +115,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT
d->m_profilerTool = profilerTool; d->m_profilerTool = profilerTool;
d->m_viewContainer = container; d->m_viewContainer = container;
d->m_modelProxy = new TimelineModelAggregator(modelManager->notesModel(), this); d->m_modelProxy = new Timeline::TimelineModelAggregator(modelManager->notesModel(), this);
d->m_modelManager = modelManager; d->m_modelManager = modelManager;
connect(modelManager,SIGNAL(dataAvailable()), d->m_modelProxy,SIGNAL(dataAvailable())); connect(modelManager,SIGNAL(dataAvailable()), d->m_modelProxy,SIGNAL(dataAvailable()));
......
...@@ -34,8 +34,7 @@ ...@@ -34,8 +34,7 @@
#include <QSGVertexColorMaterial> #include <QSGVertexColorMaterial>
#include <QtAlgorithms> #include <QtAlgorithms>
namespace QmlProfiler { namespace Timeline {
namespace Internal {
class TimelineItemsMaterial : public QSGMaterial { class TimelineItemsMaterial : public QSGMaterial {
public: public:
...@@ -453,5 +452,4 @@ void OpaqueColoredPoint2DWithSize::set(float nx, float ny, float nw, float nh, f ...@@ -453,5 +452,4 @@ void OpaqueColoredPoint2DWithSize::set(float nx, float ny, float nw, float nh, f
r = nr; g = ng, b = nb; a = 255; r = nr; g = ng, b = nb; a = 255;
} }
} } // namespace Timeline
}
...@@ -35,8 +35,7 @@ ...@@ -35,8 +35,7 @@
#include "timelinerenderpass.h" #include "timelinerenderpass.h"
#include <QSGMaterial> #include <QSGMaterial>
namespace QmlProfiler { namespace Timeline {
namespace Internal {
class TimelineItemsRenderPass : public TimelineRenderPass class TimelineItemsRenderPass : public TimelineRenderPass
{ {
...@@ -49,8 +48,6 @@ protected: ...@@ -49,8 +48,6 @@ protected:
TimelineItemsRenderPass(); TimelineItemsRenderPass();
}; };
} } // namespace Timeline
}
#endif // TIMELINEITEMSRENDERPASS_H #endif // TIMELINEITEMSRENDERPASS_H
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <QLinkedList> #include <QLinkedList>
namespace QmlProfiler { namespace Timeline {
/*! /*!
\class QmlProfiler::TimelineModel \class QmlProfiler::TimelineModel
...@@ -623,6 +623,6 @@ int TimelineModel::TimelineModelPrivate::prevItemById(IdType idType, int id, qin ...@@ -623,6 +623,6 @@ int TimelineModel::TimelineModelPrivate::prevItemById(IdType idType, int id, qin
return -1; return -1;
} }
} } // namespace Timeline
#include "moc_timelinemodel.cpp" #include "moc_timelinemodel.cpp"
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include <QVariant> #include <QVariant>
#include <QColor> #include <QColor>
namespace QmlProfiler { namespace Timeline {
class QMLPROFILER_EXPORT TimelineModel : public QObject class QMLPROFILER_EXPORT TimelineModel : public QObject
{ {
...@@ -155,6 +155,6 @@ private: ...@@ -155,6 +155,6 @@ private:
Q_DECLARE_PRIVATE(TimelineModel) Q_DECLARE_PRIVATE(TimelineModel)
}; };
} } // namespace Timeline
#endif // TIMELINEMODEL_H #endif // TIMELINEMODEL_H
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "timelinemodel.h" #include "timelinemodel.h"
namespace QmlProfiler { namespace Timeline {
class QMLPROFILER_EXPORT TimelineModel::TimelineModelPrivate { class QMLPROFILER_EXPORT TimelineModel::TimelineModelPrivate {
public: public:
...@@ -135,5 +135,6 @@ private: ...@@ -135,5 +135,6 @@ private:
Q_DECLARE_PUBLIC(TimelineModel) Q_DECLARE_PUBLIC(TimelineModel)
}; };
} } // namespace Timeline
#endif // TIMELINEMODEL_P_H #endif // TIMELINEMODEL_P_H
...@@ -38,9 +38,7 @@ ...@@ -38,9 +38,7 @@
#include <QStringList> #include <QStringList>
#include <QVariant> #include <QVariant>
namespace QmlProfiler { namespace Timeline {
namespace Internal {
class TimelineModelAggregator::TimelineModelAggregatorPrivate { class TimelineModelAggregator::TimelineModelAggregatorPrivate {
public: public:
...@@ -219,5 +217,4 @@ QVariantMap TimelineModelAggregator::prevItem(int selectedModel, int selectedIte ...@@ -219,5 +217,4 @@ QVariantMap TimelineModelAggregator::prevItem(int selectedModel, int selectedIte
return ret; return ret;
} }
} // namespace Internal } // namespace Timeline
} // namespace QmlProfiler
...@@ -35,15 +35,14 @@ ...@@ -35,15 +35,14 @@
#include "qmlprofilermodelmanager.h" #include "qmlprofilermodelmanager.h"
#include "timelinerenderer.h" #include "timelinerenderer.h"
namespace QmlProfiler { namespace Timeline {
namespace Internal {
class TimelineModelAggregator : public QObject class TimelineModelAggregator : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(int height READ height NOTIFY heightChanged) Q_PROPERTY(int height READ height NOTIFY heightChanged)
Q_PROPERTY(QVariantList models READ models NOTIFY modelsChanged) Q_PROPERTY(QVariantList models READ models NOTIFY modelsChanged)
Q_PROPERTY(QmlProfiler::TimelineNotesModel *notes READ notes CONSTANT) Q_PROPERTY(Timeline::TimelineNotesModel *notes READ notes CONSTANT)
public: public:
TimelineModelAggregator(TimelineNotesModel *notes, QObject *parent = 0); TimelineModelAggregator(TimelineNotesModel *notes, QObject *parent = 0);
~TimelineModelAggregator(); ~TimelineModelAggregator();
...@@ -74,7 +73,6 @@ private: ...@@ -74,7 +73,6 @@ private:
TimelineModelAggregatorPrivate *d; TimelineModelAggregatorPrivate *d;
}; };
} } // namespace Timeline
}
#endif // TIMELINEMODELAGGREGATOR_H #endif // TIMELINEMODELAGGREGATOR_H
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "timelinenotesmodel_p.h" #include "timelinenotesmodel_p.h"
namespace QmlProfiler { namespace Timeline {
TimelineNotesModel::TimelineNotesModelPrivate::TimelineNotesModelPrivate(TimelineNotesModel *q) : TimelineNotesModel::TimelineNotesModelPrivate::TimelineNotesModelPrivate(TimelineNotesModel *q) :
modified(false), q_ptr(q) modified(false), q_ptr(q)
...@@ -220,6 +220,6 @@ void TimelineNotesModel::clear() ...@@ -220,6 +220,6 @@ void TimelineNotesModel::clear()
emit changed(-1, -1, -1); emit changed(-1, -1, -1);
} }
} } // namespace Timeline
#include "moc_timelinenotesmodel.cpp" #include "moc_timelinenotesmodel.cpp"
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "timelinemodel.h" #include "timelinemodel.h"
namespace QmlProfiler { namespace Timeline {
class QMLPROFILER_EXPORT TimelineNotesModel : public QObject class QMLPROFILER_EXPORT TimelineNotesModel : public QObject
{ {
...@@ -80,6 +80,6 @@ private: ...@@ -80,6 +80,6 @@ private:
Q_PRIVATE_SLOT(d_ptr, void _q_removeTimelineModel(QObject *timelineModel)) Q_PRIVATE_SLOT(d_ptr, void _q_removeTimelineModel(QObject *timelineModel))
}; };
} } // namespace Timeline
#endif // TIMELINENOTESMODEL_H #endif // TIMELINENOTESMODEL_H
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "timelinenotesmodel.h" #include "timelinenotesmodel.h"
namespace QmlProfiler { namespace Timeline {
class TimelineNotesModel::TimelineNotesModelPrivate { class TimelineNotesModel::TimelineNotesModelPrivate {
public: public:
...@@ -59,6 +59,7 @@ private: ...@@ -59,6 +59,7 @@ private:
Q_DECLARE_PUBLIC(TimelineNotesModel) Q_DECLARE_PUBLIC(TimelineNotesModel)
}; };
} } // namespace Timeline
#endif // TIMELINENOTESMODEL_P_H #endif // TIMELINENOTESMODEL_P_H
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
#include "timelinerenderstate.h" #include "timelinerenderstate.h"
#include "qmlprofilernotesmodel.h" #include "qmlprofilernotesmodel.h"
namespace QmlProfiler { namespace Timeline {
namespace Internal {
struct Point2DWithDistanceFromTop { struct Point2DWithDistanceFromTop {
float x, y, d; float x, y, d;
...@@ -255,5 +254,4 @@ void Point2DWithDistanceFromTop::set(float nx, float ny, float nd) ...@@ -255,5 +254,4 @@ void Point2DWithDistanceFromTop::set(float nx, float ny, float nd)
x = nx; y = ny; d = nd; x = nx; y = ny; d = nd;
} }
} } // namespace Timeline
}
...@@ -34,8 +34,7 @@ ...@@ -34,8 +34,7 @@
#include "timelinerenderer.h" #include "timelinerenderer.h"
#include <QSGMaterial> #include <QSGMaterial>
namespace QmlProfiler { namespace Timeline {
namespace Internal {
class TimelineNotesRenderPass : public TimelineRenderPass class TimelineNotesRenderPass : public TimelineRenderPass
{ {
...@@ -50,9 +49,7 @@ private: ...@@ -50,9 +49,7 @@ private:
TimelineNotesRenderPass(); TimelineNotesRenderPass();
}; };
} } // namespace Timeline
}
#endif // TIMELINENOTESRENDERPASS_H