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

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