forked from qt-creator/qt-creator
QmlProfiler: Modernize
modernize-* Change-Id: Ibdf9c0ae91bf8a622facc7f323112b550f532f15 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -262,7 +262,7 @@ FlameGraphData *FlameGraphModel::pushChild(FlameGraphData *parent, const QmlEven
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FlameGraphData *child = new FlameGraphData(parent, data.typeIndex());
|
auto child = new FlameGraphData(parent, data.typeIndex());
|
||||||
parent->children.append(child);
|
parent->children.append(child);
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
@@ -270,7 +270,7 @@ FlameGraphData *FlameGraphModel::pushChild(FlameGraphData *parent, const QmlEven
|
|||||||
QModelIndex FlameGraphModel::index(int row, int column, const QModelIndex &parent) const
|
QModelIndex FlameGraphModel::index(int row, int column, const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if (parent.isValid()) {
|
if (parent.isValid()) {
|
||||||
FlameGraphData *parentData = static_cast<FlameGraphData *>(parent.internalPointer());
|
auto parentData = static_cast<const FlameGraphData *>(parent.internalPointer());
|
||||||
return createIndex(row, column, parentData->children[row]);
|
return createIndex(row, column, parentData->children[row]);
|
||||||
} else {
|
} else {
|
||||||
return createIndex(row, column, row >= 0 ? m_stackBottom.children[row] : nullptr);
|
return createIndex(row, column, row >= 0 ? m_stackBottom.children[row] : nullptr);
|
||||||
@@ -280,7 +280,7 @@ QModelIndex FlameGraphModel::index(int row, int column, const QModelIndex &paren
|
|||||||
QModelIndex FlameGraphModel::parent(const QModelIndex &child) const
|
QModelIndex FlameGraphModel::parent(const QModelIndex &child) const
|
||||||
{
|
{
|
||||||
if (child.isValid()) {
|
if (child.isValid()) {
|
||||||
FlameGraphData *childData = static_cast<FlameGraphData *>(child.internalPointer());
|
auto childData = static_cast<const FlameGraphData *>(child.internalPointer());
|
||||||
return childData->parent == &m_stackBottom ? QModelIndex() :
|
return childData->parent == &m_stackBottom ? QModelIndex() :
|
||||||
createIndex(0, 0, childData->parent);
|
createIndex(0, 0, childData->parent);
|
||||||
} else {
|
} else {
|
||||||
@@ -291,7 +291,7 @@ QModelIndex FlameGraphModel::parent(const QModelIndex &child) const
|
|||||||
int FlameGraphModel::rowCount(const QModelIndex &parent) const
|
int FlameGraphModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if (parent.isValid()) {
|
if (parent.isValid()) {
|
||||||
FlameGraphData *parentData = static_cast<FlameGraphData *>(parent.internalPointer());
|
auto parentData = static_cast<const FlameGraphData *>(parent.internalPointer());
|
||||||
return parentData->children.count();
|
return parentData->children.count();
|
||||||
} else {
|
} else {
|
||||||
return m_stackBottom.children.count();
|
return m_stackBottom.children.count();
|
||||||
@@ -306,7 +306,7 @@ int FlameGraphModel::columnCount(const QModelIndex &parent) const
|
|||||||
|
|
||||||
QVariant FlameGraphModel::data(const QModelIndex &index, int role) const
|
QVariant FlameGraphModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
FlameGraphData *data = static_cast<FlameGraphData *>(index.internalPointer());
|
auto data = static_cast<const FlameGraphData *>(index.internalPointer());
|
||||||
return lookup(data ? *data : m_stackBottom, role);
|
return lookup(data ? *data : m_stackBottom, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -85,13 +85,12 @@ void FlameGraphView::onVisibleFeaturesChanged(quint64 features)
|
|||||||
void FlameGraphView::contextMenuEvent(QContextMenuEvent *ev)
|
void FlameGraphView::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *getGlobalStatsAction = nullptr;
|
|
||||||
|
|
||||||
QPoint position = ev->globalPos();
|
QPoint position = ev->globalPos();
|
||||||
|
|
||||||
menu.addActions(QmlProfilerTool::profilerContextMenuActions());
|
menu.addActions(QmlProfilerTool::profilerContextMenuActions());
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
getGlobalStatsAction = menu.addAction(tr("Show Full Range"));
|
QAction *getGlobalStatsAction = menu.addAction(tr("Show Full Range"));
|
||||||
if (!m_model->modelManager()->isRestrictedToRange())
|
if (!m_model->modelManager()->isRestrictedToRange())
|
||||||
getGlobalStatsAction->setEnabled(false);
|
getGlobalStatsAction->setEnabled(false);
|
||||||
|
|
||||||
|
@@ -73,11 +73,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct RangeStackFrame {
|
struct RangeStackFrame {
|
||||||
RangeStackFrame() : originTypeIndex(-1), startTime(-1) {}
|
RangeStackFrame() = default;
|
||||||
RangeStackFrame(int originTypeIndex, qint64 startTime) :
|
RangeStackFrame(int originTypeIndex, qint64 startTime) :
|
||||||
originTypeIndex(originTypeIndex), startTime(startTime) {}
|
originTypeIndex(originTypeIndex), startTime(startTime) {}
|
||||||
int originTypeIndex;
|
int originTypeIndex = -1;
|
||||||
qint64 startTime;
|
qint64 startTime = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EventContinuation {
|
enum EventContinuation {
|
||||||
|
@@ -166,7 +166,7 @@ QVariantMap PixmapCacheModel::details(int index) const
|
|||||||
void PixmapCacheModel::loadEvent(const QmlEvent &event, const QmlEventType &type)
|
void PixmapCacheModel::loadEvent(const QmlEvent &event, const QmlEventType &type)
|
||||||
{
|
{
|
||||||
Item newEvent;
|
Item newEvent;
|
||||||
const PixmapEventType pixmapType = static_cast<PixmapEventType>(type.detailType());
|
const auto pixmapType = static_cast<PixmapEventType>(type.detailType());
|
||||||
newEvent.pixmapEventType = pixmapType;
|
newEvent.pixmapEventType = pixmapType;
|
||||||
qint64 pixmapStartTime = event.timestamp();
|
qint64 pixmapStartTime = event.timestamp();
|
||||||
|
|
||||||
@@ -443,13 +443,11 @@ void PixmapCacheModel::computeMaxCacheSize()
|
|||||||
void PixmapCacheModel::resizeUnfinishedLoads()
|
void PixmapCacheModel::resizeUnfinishedLoads()
|
||||||
{
|
{
|
||||||
// all the unfinished "load start" events continue till the end of the trace
|
// all the unfinished "load start" events continue till the end of the trace
|
||||||
for (auto pixmap = m_pixmaps.begin(), pixmapsEnd = m_pixmaps.end();
|
for (auto &pixmap : m_pixmaps) {
|
||||||
pixmap != pixmapsEnd; ++pixmap) {
|
for (auto &size : pixmap.sizes) {
|
||||||
for (auto size = pixmap->sizes.begin(), sizesEnd = pixmap->sizes.end(); size != sizesEnd;
|
if (size.loadState == Loading) {
|
||||||
++size) {
|
insertEnd(size.started, modelManager()->traceEnd() - startTime(size.started));
|
||||||
if (size->loadState == Loading) {
|
size.loadState = Error;
|
||||||
insertEnd(size->started, modelManager()->traceEnd() - startTime(size->started));
|
|
||||||
size->loadState = Error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -59,16 +59,16 @@ public:
|
|||||||
|
|
||||||
struct PixmapState {
|
struct PixmapState {
|
||||||
PixmapState(int width, int height, CacheState cache = Uncached) :
|
PixmapState(int width, int height, CacheState cache = Uncached) :
|
||||||
size(width, height), started(-1), loadState(Initial), cacheState(cache) {}
|
size(width, height), cacheState(cache) {}
|
||||||
PixmapState(CacheState cache = Uncached) : started(-1), loadState(Initial), cacheState(cache) {}
|
PixmapState(CacheState cache = Uncached) : cacheState(cache) {}
|
||||||
QSize size;
|
QSize size;
|
||||||
int started;
|
int started = -1;
|
||||||
LoadState loadState;
|
LoadState loadState = Initial;
|
||||||
CacheState cacheState;
|
CacheState cacheState;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Pixmap {
|
struct Pixmap {
|
||||||
Pixmap() {}
|
Pixmap() = default;
|
||||||
Pixmap(const QString &url) : url(url), sizes(1) {}
|
Pixmap(const QString &url) : url(url), sizes(1) {}
|
||||||
QString url;
|
QString url;
|
||||||
QVector<PixmapState> sizes;
|
QVector<PixmapState> sizes;
|
||||||
|
@@ -41,7 +41,7 @@ namespace QmlProfiler {
|
|||||||
struct QmlEvent : public Timeline::TraceEvent {
|
struct QmlEvent : public Timeline::TraceEvent {
|
||||||
static const qint32 staticClassId = 0x716d6c65; // 'qmle';
|
static const qint32 staticClassId = 0x716d6c65; // 'qmle';
|
||||||
|
|
||||||
QmlEvent() : TraceEvent(staticClassId), m_dataType(Inline8Bit), m_dataLength(0) {}
|
QmlEvent() : TraceEvent(staticClassId) {}
|
||||||
|
|
||||||
template<typename Number>
|
template<typename Number>
|
||||||
QmlEvent(qint64 timestamp, int typeIndex, std::initializer_list<Number> list)
|
QmlEvent(qint64 timestamp, int typeIndex, std::initializer_list<Number> list)
|
||||||
@@ -216,8 +216,8 @@ private:
|
|||||||
External64Bit = Inline64Bit | External
|
External64Bit = Inline64Bit | External
|
||||||
};
|
};
|
||||||
|
|
||||||
Type m_dataType;
|
Type m_dataType = Inline8Bit;
|
||||||
quint16 m_dataLength;
|
quint16 m_dataLength = 0;
|
||||||
|
|
||||||
static const int s_internalDataLength = 8;
|
static const int s_internalDataLength = 8;
|
||||||
union {
|
union {
|
||||||
@@ -250,7 +250,7 @@ private:
|
|||||||
typename std::enable_if<(sizeof(Number) > 1), bool>::type
|
typename std::enable_if<(sizeof(Number) > 1), bool>::type
|
||||||
squeeze(const Container &numbers)
|
squeeze(const Container &numbers)
|
||||||
{
|
{
|
||||||
typedef typename QIntegerForSize<sizeof(Number) / 2>::Signed Small;
|
using Small = typename QIntegerForSize<sizeof(Number) / 2>::Signed;
|
||||||
foreach (Number item, numbers) {
|
foreach (Number item, numbers) {
|
||||||
if (!squeezable<Number, Small>(item))
|
if (!squeezable<Number, Small>(item))
|
||||||
return false;
|
return false;
|
||||||
|
@@ -35,7 +35,7 @@ namespace QmlProfiler {
|
|||||||
class QMLPROFILER_EXPORT QmlEventLocation
|
class QMLPROFILER_EXPORT QmlEventLocation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlEventLocation() : m_line(-1),m_column(-1) {}
|
QmlEventLocation() = default;
|
||||||
QmlEventLocation(const QString &file, int lineNumber, int columnNumber) : m_filename(file),
|
QmlEventLocation(const QString &file, int lineNumber, int columnNumber) : m_filename(file),
|
||||||
m_line(lineNumber), m_column(columnNumber)
|
m_line(lineNumber), m_column(columnNumber)
|
||||||
{}
|
{}
|
||||||
@@ -60,8 +60,8 @@ private:
|
|||||||
friend QDataStream &operator<<(QDataStream &stream, const QmlEventLocation &location);
|
friend QDataStream &operator<<(QDataStream &stream, const QmlEventLocation &location);
|
||||||
|
|
||||||
QString m_filename;
|
QString m_filename;
|
||||||
int m_line;
|
int m_line = -1;
|
||||||
int m_column;
|
int m_column = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const QmlEventLocation &location1, const QmlEventLocation &location2)
|
inline bool operator==(const QmlEventLocation &location1, const QmlEventLocation &location2)
|
||||||
|
@@ -78,7 +78,7 @@ QDataStream &operator<<(QDataStream &stream, const QmlEventType &type)
|
|||||||
|
|
||||||
QmlEventType::QmlEventType(Message message, RangeType rangeType, int detailType,
|
QmlEventType::QmlEventType(Message message, RangeType rangeType, int detailType,
|
||||||
const QmlEventLocation &location, const QString &data,
|
const QmlEventLocation &location, const QString &data,
|
||||||
const QString displayName) :
|
const QString &displayName) :
|
||||||
TraceEventType(staticClassId, qmlFeatureFromType(message, rangeType, detailType)),
|
TraceEventType(staticClassId, qmlFeatureFromType(message, rangeType, detailType)),
|
||||||
m_data(data), m_location(location), m_message(message),
|
m_data(data), m_location(location), m_message(message),
|
||||||
m_rangeType(rangeType), m_detailType(detailType)
|
m_rangeType(rangeType), m_detailType(detailType)
|
||||||
|
@@ -41,7 +41,7 @@ public:
|
|||||||
|
|
||||||
QmlEventType(Message message = MaximumMessage, RangeType rangeType = MaximumRangeType,
|
QmlEventType(Message message = MaximumMessage, RangeType rangeType = MaximumRangeType,
|
||||||
int detailType = -1, const QmlEventLocation &location = QmlEventLocation(),
|
int detailType = -1, const QmlEventLocation &location = QmlEventLocation(),
|
||||||
const QString &data = QString(), const QString displayName = QString());
|
const QString &data = QString(), const QString &displayName = QString());
|
||||||
|
|
||||||
void setData(const QString &data) { m_data = data; }
|
void setData(const QString &data) { m_data = data; }
|
||||||
void setLocation(const QmlEventLocation &location) { m_location = location; }
|
void setLocation(const QmlEventLocation &location) { m_location = location; }
|
||||||
|
@@ -64,11 +64,11 @@ QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) :
|
|||||||
d->portSpinBox->setMaximum(65535);
|
d->portSpinBox->setMaximum(65535);
|
||||||
d->portSpinBox->setValue(3768);
|
d->portSpinBox->setValue(3768);
|
||||||
|
|
||||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
|
auto buttonBox = new QDialogButtonBox(this);
|
||||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||||
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||||
|
|
||||||
QLabel *hint = new QLabel(this);
|
auto hint = new QLabel(this);
|
||||||
hint->setWordWrap(true);
|
hint->setWordWrap(true);
|
||||||
hint->setTextFormat(Qt::RichText);
|
hint->setTextFormat(Qt::RichText);
|
||||||
hint->setText(tr("Select an externally started QML-debug enabled application.<p>"
|
hint->setText(tr("Select an externally started QML-debug enabled application.<p>"
|
||||||
@@ -76,11 +76,11 @@ QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) :
|
|||||||
+ "<p><tt>-qmljsdebugger=port:<port>,block,<br>"
|
+ "<p><tt>-qmljsdebugger=port:<port>,block,<br>"
|
||||||
" services:CanvasFrameRate,EngineControl,DebugMessages</tt>");
|
" services:CanvasFrameRate,EngineControl,DebugMessages</tt>");
|
||||||
|
|
||||||
QFormLayout *formLayout = new QFormLayout();
|
auto formLayout = new QFormLayout;
|
||||||
formLayout->addRow(tr("Kit:"), d->kitChooser);
|
formLayout->addRow(tr("Kit:"), d->kitChooser);
|
||||||
formLayout->addRow(tr("&Port:"), d->portSpinBox);
|
formLayout->addRow(tr("&Port:"), d->portSpinBox);
|
||||||
|
|
||||||
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
auto verticalLayout = new QVBoxLayout(this);
|
||||||
verticalLayout->addWidget(hint);
|
verticalLayout->addWidget(hint);
|
||||||
verticalLayout->addLayout(formLayout);
|
verticalLayout->addLayout(formLayout);
|
||||||
verticalLayout->addWidget(buttonBox);
|
verticalLayout->addWidget(buttonBox);
|
||||||
|
@@ -33,15 +33,15 @@ namespace Internal {
|
|||||||
|
|
||||||
class BindingLoopMaterial : public QSGMaterial {
|
class BindingLoopMaterial : public QSGMaterial {
|
||||||
public:
|
public:
|
||||||
QSGMaterialType *type() const;
|
QSGMaterialType *type() const override;
|
||||||
QSGMaterialShader *createShader() const;
|
QSGMaterialShader *createShader() const override;
|
||||||
BindingLoopMaterial();
|
BindingLoopMaterial();
|
||||||
};
|
};
|
||||||
|
|
||||||
class BindingLoopsRenderPassState : public Timeline::TimelineRenderPass::State {
|
class BindingLoopsRenderPassState : public Timeline::TimelineRenderPass::State {
|
||||||
public:
|
public:
|
||||||
BindingLoopsRenderPassState(const QmlProfilerRangeModel *model);
|
BindingLoopsRenderPassState(const QmlProfilerRangeModel *model);
|
||||||
~BindingLoopsRenderPassState();
|
~BindingLoopsRenderPassState() override;
|
||||||
|
|
||||||
BindingLoopMaterial *material() { return &m_material; }
|
BindingLoopMaterial *material() { return &m_material; }
|
||||||
void updateIndexes(int from, int to);
|
void updateIndexes(int from, int to);
|
||||||
@@ -50,8 +50,8 @@ public:
|
|||||||
int indexTo() const { return m_indexTo; }
|
int indexTo() const { return m_indexTo; }
|
||||||
|
|
||||||
QSGNode *expandedRow(int row) const { return m_expandedRows[row]; }
|
QSGNode *expandedRow(int row) const { return m_expandedRows[row]; }
|
||||||
const QVector<QSGNode *> &expandedRows() const { return m_expandedRows; }
|
const QVector<QSGNode *> &expandedRows() const override { return m_expandedRows; }
|
||||||
QSGNode *collapsedOverlay() const { return m_collapsedOverlay; }
|
QSGNode *collapsedOverlay() const override { return m_collapsedOverlay; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<QSGNode *> m_expandedRows;
|
QVector<QSGNode *> m_expandedRows;
|
||||||
@@ -70,12 +70,11 @@ struct BindlingLoopsGeometry {
|
|||||||
static const QSGGeometry::AttributeSet &point2DWithOffset();
|
static const QSGGeometry::AttributeSet &point2DWithOffset();
|
||||||
static const int maxEventsPerNode = 0xffff / 18;
|
static const int maxEventsPerNode = 0xffff / 18;
|
||||||
|
|
||||||
BindlingLoopsGeometry() : allocatedVertices(0), usedVertices(0), currentY(-1), node(nullptr) {}
|
uint allocatedVertices = 0;
|
||||||
uint allocatedVertices;
|
uint usedVertices = 0;
|
||||||
uint usedVertices;
|
float currentY = -1;
|
||||||
float currentY;
|
|
||||||
|
|
||||||
QSGGeometryNode *node;
|
QSGGeometryNode *node = nullptr;
|
||||||
Point2DWithOffset *vertexData();
|
Point2DWithOffset *vertexData();
|
||||||
|
|
||||||
void allocate(QSGMaterial *material);
|
void allocate(QSGMaterial *material);
|
||||||
@@ -90,9 +89,7 @@ const QmlProfilerBindingLoopsRenderPass *QmlProfilerBindingLoopsRenderPass::inst
|
|||||||
return &pass;
|
return &pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerBindingLoopsRenderPass::QmlProfilerBindingLoopsRenderPass()
|
QmlProfilerBindingLoopsRenderPass::QmlProfilerBindingLoopsRenderPass() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool eventOutsideRange(const QmlProfilerRangeModel *model,
|
static inline bool eventOutsideRange(const QmlProfilerRangeModel *model,
|
||||||
const Timeline::TimelineRenderState *parentState, int i)
|
const Timeline::TimelineRenderState *parentState, int i)
|
||||||
@@ -163,8 +160,7 @@ Timeline::TimelineRenderPass::State *QmlProfilerBindingLoopsRenderPass::update(
|
|||||||
Q_UNUSED(stateChanged);
|
Q_UNUSED(stateChanged);
|
||||||
Q_UNUSED(spacing);
|
Q_UNUSED(spacing);
|
||||||
|
|
||||||
const QmlProfilerRangeModel *model = qobject_cast<const QmlProfilerRangeModel *>(
|
auto model = qobject_cast<const QmlProfilerRangeModel *>(renderer->model());
|
||||||
renderer->model());
|
|
||||||
|
|
||||||
if (!model || indexFrom < 0 || indexTo > model->count() || indexFrom >= indexTo)
|
if (!model || indexFrom < 0 || indexTo > model->count() || indexFrom >= indexTo)
|
||||||
return oldState;
|
return oldState;
|
||||||
@@ -229,8 +225,7 @@ Point2DWithOffset *BindlingLoopsGeometry::vertexData()
|
|||||||
|
|
||||||
void BindlingLoopsGeometry::allocate(QSGMaterial *material)
|
void BindlingLoopsGeometry::allocate(QSGMaterial *material)
|
||||||
{
|
{
|
||||||
QSGGeometry *geometry = new QSGGeometry(BindlingLoopsGeometry::point2DWithOffset(),
|
auto geometry = new QSGGeometry(BindlingLoopsGeometry::point2DWithOffset(), usedVertices);
|
||||||
usedVertices);
|
|
||||||
Q_ASSERT(geometry->vertexData());
|
Q_ASSERT(geometry->vertexData());
|
||||||
geometry->setIndexDataPattern(QSGGeometry::StaticPattern);
|
geometry->setIndexDataPattern(QSGGeometry::StaticPattern);
|
||||||
geometry->setVertexDataPattern(QSGGeometry::StaticPattern);
|
geometry->setVertexDataPattern(QSGGeometry::StaticPattern);
|
||||||
@@ -367,7 +362,7 @@ BindingLoopsRenderPassState::BindingLoopsRenderPassState(const QmlProfilerRangeM
|
|||||||
m_collapsedOverlay->setFlag(QSGNode::OwnedByParent, false);
|
m_collapsedOverlay->setFlag(QSGNode::OwnedByParent, false);
|
||||||
m_expandedRows.reserve(model->expandedRowCount());
|
m_expandedRows.reserve(model->expandedRowCount());
|
||||||
for (int i = 0; i < model->expandedRowCount(); ++i) {
|
for (int i = 0; i < model->expandedRowCount(); ++i) {
|
||||||
QSGNode *node = new QSGNode;
|
auto node = new QSGNode;
|
||||||
node->setFlag(QSGNode::OwnedByParent, false);
|
node->setFlag(QSGNode::OwnedByParent, false);
|
||||||
m_expandedRows << node;
|
m_expandedRows << node;
|
||||||
}
|
}
|
||||||
|
@@ -478,7 +478,7 @@ int QmlProfilerEventTypeStorage::append(Timeline::TraceEventType &&type)
|
|||||||
m_types.push_back(std::move(type.asRvalueRef<QmlEventType>()));
|
m_types.push_back(std::move(type.asRvalueRef<QmlEventType>()));
|
||||||
} else {
|
} else {
|
||||||
QTC_CHECK(false);
|
QTC_CHECK(false);
|
||||||
m_types.push_back(QmlEventType());
|
m_types.emplace_back();
|
||||||
}
|
}
|
||||||
QTC_ASSERT(index <= static_cast<size_t>(std::numeric_limits<int>::max()),
|
QTC_ASSERT(index <= static_cast<size_t>(std::numeric_limits<int>::max()),
|
||||||
return std::numeric_limits<int>::max());
|
return std::numeric_limits<int>::max());
|
||||||
|
@@ -49,8 +49,8 @@ class QMLPROFILER_EXPORT QmlProfilerModelManager : public Timeline::TimelineTrac
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
typedef std::function<void(const QmlEvent &, const QmlEventType &)> QmlEventLoader;
|
using QmlEventLoader = std::function<void (const QmlEvent &, const QmlEventType &)>;
|
||||||
typedef std::function<QmlEventLoader(QmlEventLoader)> QmlEventFilter;
|
using QmlEventFilter = std::function<QmlEventLoader (QmlEventLoader)>;
|
||||||
|
|
||||||
explicit QmlProfilerModelManager(QObject *parent = nullptr);
|
explicit QmlProfilerModelManager(QObject *parent = nullptr);
|
||||||
~QmlProfilerModelManager() override;
|
~QmlProfilerModelManager() override;
|
||||||
|
@@ -37,9 +37,9 @@ class QmlProfilerOptionsPage : public Core::IOptionsPage
|
|||||||
public:
|
public:
|
||||||
QmlProfilerOptionsPage();
|
QmlProfilerOptionsPage();
|
||||||
|
|
||||||
QWidget *widget();
|
QWidget *widget() override;
|
||||||
void apply();
|
void apply() override;
|
||||||
void finish();
|
void finish() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<QWidget> m_widget;
|
QPointer<QWidget> m_widget;
|
||||||
|
@@ -115,7 +115,7 @@ void QmlProfilerPlugin::extensionsInitialized()
|
|||||||
|
|
||||||
RunControl::registerWorkerCreator(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
|
RunControl::registerWorkerCreator(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
|
||||||
[this](RunControl *runControl) {
|
[this](RunControl *runControl) {
|
||||||
QmlProfilerRunner *runner = new QmlProfilerRunner(runControl);
|
auto runner = new QmlProfilerRunner(runControl);
|
||||||
connect(runner, &QmlProfilerRunner::starting,
|
connect(runner, &QmlProfilerRunner::starting,
|
||||||
&d->m_profilerTool, &QmlProfilerTool::finalizeRunControl);
|
&d->m_profilerTool, &QmlProfilerTool::finalizeRunControl);
|
||||||
return runner;
|
return runner;
|
||||||
|
@@ -155,7 +155,7 @@ void QmlProfilerRangeModel::computeExpandedLevels()
|
|||||||
|
|
||||||
void QmlProfilerRangeModel::findBindingLoops()
|
void QmlProfilerRangeModel::findBindingLoops()
|
||||||
{
|
{
|
||||||
typedef QPair<int, int> CallStackEntry;
|
using CallStackEntry = QPair<int, int>;
|
||||||
QStack<CallStackEntry> callStack;
|
QStack<CallStackEntry> callStack;
|
||||||
|
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (int i = 0; i < count(); ++i) {
|
||||||
|
@@ -45,15 +45,10 @@ class QmlProfilerRangeModel : public QmlProfilerTimelineModel
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
struct Item {
|
struct Item {
|
||||||
Item() :
|
|
||||||
displayRowExpanded(1),
|
|
||||||
displayRowCollapsed(Constants::QML_MIN_LEVEL),
|
|
||||||
bindingLoopHead(-1) {}
|
|
||||||
|
|
||||||
// not-expanded, per type
|
// not-expanded, per type
|
||||||
int displayRowExpanded;
|
int displayRowExpanded = 1;
|
||||||
int displayRowCollapsed;
|
int displayRowCollapsed = Constants::QML_MIN_LEVEL;
|
||||||
int bindingLoopHead;
|
int bindingLoopHead = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
QmlProfilerRangeModel(QmlProfilerModelManager *manager, RangeType range,
|
QmlProfilerRangeModel(QmlProfilerModelManager *manager, RangeType range,
|
||||||
|
@@ -231,7 +231,7 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(QmlProfilerTool *profilerTool,
|
|||||||
{
|
{
|
||||||
setId("LocalQmlProfilerSupport");
|
setId("LocalQmlProfilerSupport");
|
||||||
|
|
||||||
QmlProfilerRunner *profiler = new QmlProfilerRunner(runControl);
|
auto profiler = new QmlProfilerRunner(runControl);
|
||||||
profiler->setServerUrl(serverUrl);
|
profiler->setServerUrl(serverUrl);
|
||||||
connect(profiler, &QmlProfilerRunner::starting,
|
connect(profiler, &QmlProfilerRunner::starting,
|
||||||
profilerTool, &QmlProfilerTool::finalizeRunControl);
|
profilerTool, &QmlProfilerTool::finalizeRunControl);
|
||||||
|
@@ -51,7 +51,7 @@ public:
|
|||||||
: q(qq), m_currentState(Idle), m_clientRecording(true), m_serverRecording(false),
|
: q(qq), m_currentState(Idle), m_clientRecording(true), m_serverRecording(false),
|
||||||
m_requestedFeatures(0), m_recordedFeatures(0) {}
|
m_requestedFeatures(0), m_recordedFeatures(0) {}
|
||||||
|
|
||||||
~QmlProfilerStateManagerPrivate() {}
|
~QmlProfilerStateManagerPrivate() = default;
|
||||||
|
|
||||||
QmlProfilerStateManager *q;
|
QmlProfilerStateManager *q;
|
||||||
|
|
||||||
|
@@ -62,7 +62,7 @@ QmlProfilerStateWidget::QmlProfilerStateWidget(QmlProfilerStateManager *stateMan
|
|||||||
setFrameStyle(QFrame::StyledPanel);
|
setFrameStyle(QFrame::StyledPanel);
|
||||||
|
|
||||||
// UI elements
|
// UI elements
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
resize(200,70);
|
resize(200,70);
|
||||||
|
|
||||||
d->text = new QLabel(this);
|
d->text = new QLabel(this);
|
||||||
|
@@ -40,7 +40,7 @@ public:
|
|||||||
explicit QmlProfilerStateWidget(QmlProfilerStateManager *stateManager,
|
explicit QmlProfilerStateWidget(QmlProfilerStateManager *stateManager,
|
||||||
QmlProfilerModelManager *modelManager,
|
QmlProfilerModelManager *modelManager,
|
||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
~QmlProfilerStateWidget();
|
~QmlProfilerStateWidget() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void showText(const QString &text);
|
void showText(const QString &text);
|
||||||
|
@@ -70,7 +70,7 @@ QmlProfilerStatisticsView::QmlProfilerStatisticsView(QmlProfilerModelManager *pr
|
|||||||
setObjectName(QLatin1String("QmlProfiler.Statistics.Dock"));
|
setObjectName(QLatin1String("QmlProfiler.Statistics.Dock"));
|
||||||
setWindowTitle(tr("Statistics"));
|
setWindowTitle(tr("Statistics"));
|
||||||
|
|
||||||
QmlProfilerStatisticsModel *model = new QmlProfilerStatisticsModel(profilerModelManager);
|
auto model = new QmlProfilerStatisticsModel(profilerModelManager);
|
||||||
m_mainView.reset(new QmlProfilerStatisticsMainView(model));
|
m_mainView.reset(new QmlProfilerStatisticsMainView(model));
|
||||||
connect(m_mainView.get(), &QmlProfilerStatisticsMainView::gotoSourceLocation,
|
connect(m_mainView.get(), &QmlProfilerStatisticsMainView::gotoSourceLocation,
|
||||||
this, &QmlProfilerStatisticsView::gotoSourceLocation);
|
this, &QmlProfilerStatisticsView::gotoSourceLocation);
|
||||||
@@ -99,13 +99,13 @@ QmlProfilerStatisticsView::QmlProfilerStatisticsView(QmlProfilerModelManager *pr
|
|||||||
m_callersView.get(), &QmlProfilerStatisticsRelativesView::displayType);
|
m_callersView.get(), &QmlProfilerStatisticsRelativesView::displayType);
|
||||||
|
|
||||||
// widget arrangement
|
// widget arrangement
|
||||||
QVBoxLayout *groupLayout = new QVBoxLayout;
|
auto groupLayout = new QVBoxLayout;
|
||||||
groupLayout->setContentsMargins(0,0,0,0);
|
groupLayout->setContentsMargins(0,0,0,0);
|
||||||
groupLayout->setSpacing(0);
|
groupLayout->setSpacing(0);
|
||||||
|
|
||||||
Core::MiniSplitter *splitterVertical = new Core::MiniSplitter;
|
auto splitterVertical = new Core::MiniSplitter;
|
||||||
splitterVertical->addWidget(m_mainView.get());
|
splitterVertical->addWidget(m_mainView.get());
|
||||||
Core::MiniSplitter *splitterHorizontal = new Core::MiniSplitter;
|
auto splitterHorizontal = new Core::MiniSplitter;
|
||||||
splitterHorizontal->addWidget(m_callersView.get());
|
splitterHorizontal->addWidget(m_callersView.get());
|
||||||
splitterHorizontal->addWidget(m_calleesView.get());
|
splitterHorizontal->addWidget(m_calleesView.get());
|
||||||
splitterHorizontal->setOrientation(Qt::Horizontal);
|
splitterHorizontal->setOrientation(Qt::Horizontal);
|
||||||
@@ -226,9 +226,7 @@ QmlProfilerStatisticsMainView::QmlProfilerStatisticsMainView(QmlProfilerStatisti
|
|||||||
resizeColumnToContents(MainType);
|
resizeColumnToContents(MainType);
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerStatisticsMainView::~QmlProfilerStatisticsMainView()
|
QmlProfilerStatisticsMainView::~QmlProfilerStatisticsMainView() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerStatisticsMainView::setShowExtendedStatistics(bool show)
|
void QmlProfilerStatisticsMainView::setShowExtendedStatistics(bool show)
|
||||||
{
|
{
|
||||||
@@ -274,7 +272,7 @@ void QmlProfilerStatisticsMainView::jumpToItem(int typeIndex)
|
|||||||
{
|
{
|
||||||
displayTypeIndex(typeIndex);
|
displayTypeIndex(typeIndex);
|
||||||
|
|
||||||
QSortFilterProxyModel *sortModel = qobject_cast<QSortFilterProxyModel *>(model());
|
auto sortModel = qobject_cast<const QSortFilterProxyModel *>(model());
|
||||||
QTC_ASSERT(sortModel, return);
|
QTC_ASSERT(sortModel, return);
|
||||||
|
|
||||||
QAbstractItemModel *sourceModel = sortModel->sourceModel();
|
QAbstractItemModel *sourceModel = sortModel->sourceModel();
|
||||||
@@ -294,7 +292,7 @@ void QmlProfilerStatisticsMainView::displayTypeIndex(int typeIndex)
|
|||||||
if (typeIndex < 0) {
|
if (typeIndex < 0) {
|
||||||
setCurrentIndex(QModelIndex());
|
setCurrentIndex(QModelIndex());
|
||||||
} else {
|
} else {
|
||||||
QSortFilterProxyModel *sortModel = qobject_cast<QSortFilterProxyModel *>(model());
|
auto sortModel = qobject_cast<const QSortFilterProxyModel *>(model());
|
||||||
QTC_ASSERT(sortModel, return);
|
QTC_ASSERT(sortModel, return);
|
||||||
|
|
||||||
QAbstractItemModel *sourceModel = sortModel->sourceModel();
|
QAbstractItemModel *sourceModel = sortModel->sourceModel();
|
||||||
@@ -392,9 +390,7 @@ QmlProfilerStatisticsRelativesView::QmlProfilerStatisticsRelativesView(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerStatisticsRelativesView::~QmlProfilerStatisticsRelativesView()
|
QmlProfilerStatisticsRelativesView::~QmlProfilerStatisticsRelativesView() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerStatisticsRelativesView::displayType(int typeIndex)
|
void QmlProfilerStatisticsRelativesView::displayType(int typeIndex)
|
||||||
{
|
{
|
||||||
|
@@ -75,7 +75,7 @@ class QmlProfilerStatisticsMainView : public Utils::TreeView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlProfilerStatisticsMainView(QmlProfilerStatisticsModel *model);
|
explicit QmlProfilerStatisticsMainView(QmlProfilerStatisticsModel *model);
|
||||||
~QmlProfilerStatisticsMainView();
|
~QmlProfilerStatisticsMainView() override;
|
||||||
|
|
||||||
QModelIndex selectedModelIndex() const;
|
QModelIndex selectedModelIndex() const;
|
||||||
void copyTableToClipboard() const;
|
void copyTableToClipboard() const;
|
||||||
@@ -110,7 +110,7 @@ class QmlProfilerStatisticsRelativesView : public Utils::TreeView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlProfilerStatisticsRelativesView(QmlProfilerStatisticsRelativesModel *model);
|
explicit QmlProfilerStatisticsRelativesView(QmlProfilerStatisticsRelativesModel *model);
|
||||||
~QmlProfilerStatisticsRelativesView();
|
~QmlProfilerStatisticsRelativesView() override;
|
||||||
|
|
||||||
void displayType(int typeIndex);
|
void displayType(int typeIndex);
|
||||||
void jumpToItem(int typeIndex);
|
void jumpToItem(int typeIndex);
|
||||||
|
@@ -106,15 +106,15 @@ void QmlProfilerTextMarkModel::createMarks(QmlProfilerViewManager *viewManager,
|
|||||||
});
|
});
|
||||||
|
|
||||||
int lineNumber = -1;
|
int lineNumber = -1;
|
||||||
for (auto it = ids.begin(), end = ids.end(); it != end; ++it) {
|
for (const auto &id : ids) {
|
||||||
if (it->lineNumber == lineNumber) {
|
if (id.lineNumber == lineNumber) {
|
||||||
m_marks.last()->addTypeId(it->typeId);
|
m_marks.last()->addTypeId(id.typeId);
|
||||||
} else {
|
} else {
|
||||||
lineNumber = it->lineNumber;
|
lineNumber = id.lineNumber;
|
||||||
m_marks << new QmlProfilerTextMark(viewManager,
|
m_marks << new QmlProfilerTextMark(viewManager,
|
||||||
it->typeId,
|
id.typeId,
|
||||||
FileName::fromString(fileName),
|
FileName::fromString(fileName),
|
||||||
it->lineNumber);
|
id.lineNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ void QmlProfilerTextMarkModel::hideTextMarks()
|
|||||||
|
|
||||||
bool QmlProfilerTextMark::addToolTipContent(QLayout *target) const
|
bool QmlProfilerTextMark::addToolTipContent(QLayout *target) const
|
||||||
{
|
{
|
||||||
QGridLayout *layout = new QGridLayout;
|
auto layout = new QGridLayout;
|
||||||
layout->setHorizontalSpacing(10);
|
layout->setHorizontalSpacing(10);
|
||||||
for (int row = 0, rowEnd = m_typeIds.length(); row != rowEnd; ++row) {
|
for (int row = 0, rowEnd = m_typeIds.length(); row != rowEnd; ++row) {
|
||||||
const QStringList typeDetails = m_viewManager->statisticsView()->details(m_typeIds[row]);
|
const QStringList typeDetails = m_viewManager->statisticsView()->details(m_typeIds[row]);
|
||||||
|
@@ -304,7 +304,7 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
|
|||||||
auto aspect = static_cast<QmlProfilerRunConfigurationAspect *>(
|
auto aspect = static_cast<QmlProfilerRunConfigurationAspect *>(
|
||||||
runConfiguration->aspect(Constants::SETTINGS));
|
runConfiguration->aspect(Constants::SETTINGS));
|
||||||
if (aspect) {
|
if (aspect) {
|
||||||
if (QmlProfilerSettings *settings = static_cast<QmlProfilerSettings *>(aspect->currentSettings())) {
|
if (auto settings = static_cast<const QmlProfilerSettings *>(aspect->currentSettings())) {
|
||||||
d->m_profilerConnections->setFlushInterval(settings->flushEnabled() ?
|
d->m_profilerConnections->setFlushInterval(settings->flushEnabled() ?
|
||||||
settings->flushInterval() : 0);
|
settings->flushInterval() : 0);
|
||||||
d->m_profilerModelManager->setAggregateTraces(settings->aggregateTraces());
|
d->m_profilerModelManager->setAggregateTraces(settings->aggregateTraces());
|
||||||
@@ -345,7 +345,7 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
|
|||||||
|
|
||||||
connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionFailed,
|
connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionFailed,
|
||||||
runWorker, [this, runWorker]() {
|
runWorker, [this, runWorker]() {
|
||||||
QMessageBox *infoBox = new QMessageBox(ICore::mainWindow());
|
auto infoBox = new QMessageBox(ICore::mainWindow());
|
||||||
infoBox->setIcon(QMessageBox::Critical);
|
infoBox->setIcon(QMessageBox::Critical);
|
||||||
infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME);
|
infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME);
|
||||||
|
|
||||||
@@ -513,7 +513,7 @@ ProjectExplorer::RunControl *QmlProfilerTool::attachToWaitingApplication()
|
|||||||
|
|
||||||
Id kitId;
|
Id kitId;
|
||||||
int port;
|
int port;
|
||||||
Kit *kit = 0;
|
Kit *kit = nullptr;
|
||||||
|
|
||||||
{
|
{
|
||||||
QSettings *settings = ICore::settings();
|
QSettings *settings = ICore::settings();
|
||||||
@@ -573,7 +573,7 @@ void QmlProfilerTool::logError(const QString &msg)
|
|||||||
|
|
||||||
void QmlProfilerTool::showErrorDialog(const QString &error)
|
void QmlProfilerTool::showErrorDialog(const QString &error)
|
||||||
{
|
{
|
||||||
QMessageBox *errorDialog = new QMessageBox(ICore::mainWindow());
|
auto errorDialog = new QMessageBox(ICore::mainWindow());
|
||||||
errorDialog->setIcon(QMessageBox::Warning);
|
errorDialog->setIcon(QMessageBox::Warning);
|
||||||
errorDialog->setWindowTitle(tr("QML Profiler"));
|
errorDialog->setWindowTitle(tr("QML Profiler"));
|
||||||
errorDialog->setText(error);
|
errorDialog->setText(error);
|
||||||
@@ -780,7 +780,7 @@ QList <QAction *> QmlProfilerTool::profilerContextMenuActions()
|
|||||||
|
|
||||||
void QmlProfilerTool::showNonmodalWarning(const QString &warningMsg)
|
void QmlProfilerTool::showNonmodalWarning(const QString &warningMsg)
|
||||||
{
|
{
|
||||||
QMessageBox *noExecWarning = new QMessageBox(ICore::mainWindow());
|
auto noExecWarning = new QMessageBox(ICore::mainWindow());
|
||||||
noExecWarning->setIcon(QMessageBox::Warning);
|
noExecWarning->setIcon(QMessageBox::Warning);
|
||||||
noExecWarning->setWindowTitle(tr("QML Profiler"));
|
noExecWarning->setWindowTitle(tr("QML Profiler"));
|
||||||
noExecWarning->setText(warningMsg);
|
noExecWarning->setText(warningMsg);
|
||||||
|
@@ -70,8 +70,6 @@
|
|||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -120,7 +118,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QVBoxLayout *groupLayout = new QVBoxLayout;
|
auto groupLayout = new QVBoxLayout;
|
||||||
groupLayout->setContentsMargins(0, 0, 0, 0);
|
groupLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
groupLayout->setSpacing(0);
|
groupLayout->setSpacing(0);
|
||||||
|
|
||||||
@@ -136,7 +134,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
|
|||||||
d->m_mainView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
d->m_mainView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
setFocusProxy(d->m_mainView);
|
setFocusProxy(d->m_mainView);
|
||||||
|
|
||||||
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
|
auto agg = new Aggregation::Aggregate;
|
||||||
agg->add(d->m_mainView);
|
agg->add(d->m_mainView);
|
||||||
agg->add(new TraceViewFindSupport(this, modelManager));
|
agg->add(new TraceViewFindSupport(this, modelManager));
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ public:
|
|||||||
QmlProfilerViewManager(QObject *parent,
|
QmlProfilerViewManager(QObject *parent,
|
||||||
QmlProfilerModelManager *modelManager,
|
QmlProfilerModelManager *modelManager,
|
||||||
QmlProfilerStateManager *profilerState);
|
QmlProfilerStateManager *profilerState);
|
||||||
~QmlProfilerViewManager();
|
~QmlProfilerViewManager() override;
|
||||||
|
|
||||||
QmlProfilerTraceView *traceView() const { return m_traceView; }
|
QmlProfilerTraceView *traceView() const { return m_traceView; }
|
||||||
QmlProfilerStatisticsView *statisticsView() const { return m_statisticsView; }
|
QmlProfilerStatisticsView *statisticsView() const { return m_statisticsView; }
|
||||||
|
@@ -36,7 +36,7 @@ class DebugMessagesModelTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DebugMessagesModelTest(QObject *parent = 0);
|
DebugMessagesModelTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
|
@@ -31,7 +31,7 @@ namespace Internal {
|
|||||||
|
|
||||||
void fakeDebugServer(QIODevice *socket)
|
void fakeDebugServer(QIODevice *socket)
|
||||||
{
|
{
|
||||||
QmlDebug::QPacketProtocol *protocol = new QmlDebug::QPacketProtocol(socket, socket);
|
auto protocol = new QmlDebug::QPacketProtocol(socket, socket);
|
||||||
QObject::connect(protocol, &QmlDebug::QPacketProtocol::readyRead, [protocol]() {
|
QObject::connect(protocol, &QmlDebug::QPacketProtocol::readyRead, [protocol]() {
|
||||||
QmlDebug::QPacket packet(QDataStream::Qt_4_7);
|
QmlDebug::QPacket packet(QDataStream::Qt_4_7);
|
||||||
const int messageId = 0;
|
const int messageId = 0;
|
||||||
|
@@ -41,7 +41,7 @@ int FlameGraphModelTest::generateData(QmlProfilerModelManager *manager,
|
|||||||
Timeline::TimelineModelAggregator *aggregator)
|
Timeline::TimelineModelAggregator *aggregator)
|
||||||
{
|
{
|
||||||
// Notes only work with timeline models
|
// Notes only work with timeline models
|
||||||
QmlProfilerRangeModel *rangeModel = new QmlProfilerRangeModel(manager, Javascript, aggregator);
|
auto rangeModel = new QmlProfilerRangeModel(manager, Javascript, aggregator);
|
||||||
int rangeModelId = rangeModel->modelId();
|
int rangeModelId = rangeModel->modelId();
|
||||||
manager->notesModel()->addTimelineModel(rangeModel);
|
manager->notesModel()->addTimelineModel(rangeModel);
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ class InputEventsModelTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
InputEventsModelTest(QObject *parent = 0);
|
InputEventsModelTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
|
@@ -37,7 +37,7 @@ class LocalQmlProfilerRunnerTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
LocalQmlProfilerRunnerTest(QObject *parent = 0);
|
LocalQmlProfilerRunnerTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void testRunner();
|
void testRunner();
|
||||||
|
@@ -36,7 +36,7 @@ class PixmapCacheModelTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PixmapCacheModelTest(QObject *parent = 0);
|
PixmapCacheModelTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
|
@@ -34,7 +34,7 @@ class QmlEventTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlEventTest(QObject *parent = 0);
|
explicit QmlEventTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void testCtors();
|
void testCtors();
|
||||||
|
@@ -33,7 +33,7 @@ class QmlEventLocationTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlEventLocationTest(QObject *parent = 0);
|
explicit QmlEventLocationTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void testCtor();
|
void testCtor();
|
||||||
|
@@ -33,7 +33,7 @@ class QmlEventTypeTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlEventTypeTest(QObject *parent = 0);
|
explicit QmlEventTypeTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void testAccessors();
|
void testAccessors();
|
||||||
|
@@ -35,7 +35,7 @@ class QmlNoteTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlNoteTest(QObject *parent = 0);
|
explicit QmlNoteTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void testAccessors();
|
void testAccessors();
|
||||||
|
@@ -36,7 +36,7 @@ class QmlProfilerAnimationsModelTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlProfilerAnimationsModelTest(QObject *parent = 0);
|
explicit QmlProfilerAnimationsModelTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
|
@@ -78,7 +78,7 @@ void QmlProfilerBindingLoopsRenderPassTest::testInstance()
|
|||||||
const QmlProfilerBindingLoopsRenderPass *inst = QmlProfilerBindingLoopsRenderPass::instance();
|
const QmlProfilerBindingLoopsRenderPass *inst = QmlProfilerBindingLoopsRenderPass::instance();
|
||||||
const QmlProfilerBindingLoopsRenderPass *inst2 = QmlProfilerBindingLoopsRenderPass::instance();
|
const QmlProfilerBindingLoopsRenderPass *inst2 = QmlProfilerBindingLoopsRenderPass::instance();
|
||||||
QCOMPARE(inst, inst2);
|
QCOMPARE(inst, inst2);
|
||||||
QVERIFY(inst != 0);
|
QVERIFY(inst != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerBindingLoopsRenderPassTest::testUpdate()
|
void QmlProfilerBindingLoopsRenderPassTest::testUpdate()
|
||||||
@@ -86,43 +86,43 @@ void QmlProfilerBindingLoopsRenderPassTest::testUpdate()
|
|||||||
const QmlProfilerBindingLoopsRenderPass *inst = QmlProfilerBindingLoopsRenderPass::instance();
|
const QmlProfilerBindingLoopsRenderPass *inst = QmlProfilerBindingLoopsRenderPass::instance();
|
||||||
Timeline::TimelineAbstractRenderer renderer;
|
Timeline::TimelineAbstractRenderer renderer;
|
||||||
Timeline::TimelineRenderState parentState(0, 8, 1, 1);
|
Timeline::TimelineRenderState parentState(0, 8, 1, 1);
|
||||||
Timeline::TimelineRenderPass::State *nullState = 0;
|
Timeline::TimelineRenderPass::State *nullState = nullptr;
|
||||||
QSGNode *nullNode = 0;
|
QSGNode *nullNode = nullptr;
|
||||||
Timeline::TimelineRenderPass::State *result =
|
Timeline::TimelineRenderPass::State *result =
|
||||||
inst->update(&renderer, &parentState, 0, 0, 0, true, 1);
|
inst->update(&renderer, &parentState, nullptr, 0, 0, true, 1);
|
||||||
QCOMPARE(result, nullState);
|
QCOMPARE(result, nullState);
|
||||||
|
|
||||||
QmlProfilerModelManager manager;
|
QmlProfilerModelManager manager;
|
||||||
Timeline::TimelineModelAggregator aggregator;
|
Timeline::TimelineModelAggregator aggregator;
|
||||||
DummyModel model(&manager, &aggregator);
|
DummyModel model(&manager, &aggregator);
|
||||||
renderer.setModel(&model);
|
renderer.setModel(&model);
|
||||||
result = inst->update(&renderer, &parentState, 0, 0, 0, true, 1);
|
result = inst->update(&renderer, &parentState, nullptr, 0, 0, true, 1);
|
||||||
QCOMPARE(result, nullState);
|
QCOMPARE(result, nullState);
|
||||||
|
|
||||||
model.loadData();
|
model.loadData();
|
||||||
result = inst->update(&renderer, &parentState, 0, 0, 0, true, 1);
|
result = inst->update(&renderer, &parentState, nullptr, 0, 0, true, 1);
|
||||||
QCOMPARE(result, nullState);
|
QCOMPARE(result, nullState);
|
||||||
|
|
||||||
result = inst->update(&renderer, &parentState, 0, 2, 9, true, 1);
|
result = inst->update(&renderer, &parentState, nullptr, 2, 9, true, 1);
|
||||||
QVERIFY(result != nullState);
|
QVERIFY(result != nullState);
|
||||||
QCOMPARE(result->expandedOverlay(), nullNode);
|
QCOMPARE(result->expandedOverlay(), nullNode);
|
||||||
QVERIFY(result->collapsedOverlay() != nullNode);
|
QVERIFY(result->collapsedOverlay() != nullNode);
|
||||||
QCOMPARE(result->expandedRows().count(), 2); // all the loops are in one row
|
QCOMPARE(result->expandedRows().count(), 2); // all the loops are in one row
|
||||||
QCOMPARE(result->collapsedRows().count(), 0); // it's an overlay
|
QCOMPARE(result->collapsedRows().count(), 0); // it's an overlay
|
||||||
QCOMPARE(result->expandedRows()[1]->childCount(), 1);
|
QCOMPARE(result->expandedRows()[1]->childCount(), 1);
|
||||||
QSGGeometryNode *node = static_cast<QSGGeometryNode *>(result->expandedRows()[1]->firstChild());
|
auto node = static_cast<const QSGGeometryNode *>(result->expandedRows()[1]->firstChild());
|
||||||
QSGMaterial *material1 = node->material();
|
QSGMaterial *material1 = node->material();
|
||||||
QVERIFY(material1 != 0);
|
QVERIFY(material1 != nullptr);
|
||||||
QCOMPARE(node->geometry()->vertexCount(), 7 * 4);
|
QCOMPARE(node->geometry()->vertexCount(), 7 * 4);
|
||||||
node = static_cast<QSGGeometryNode *>(result->collapsedOverlay()->firstChild());
|
node = static_cast<QSGGeometryNode *>(result->collapsedOverlay()->firstChild());
|
||||||
QSGMaterial *material2 = node->material();
|
QSGMaterial *material2 = node->material();
|
||||||
QCOMPARE(node->geometry()->vertexCount(), 7 * 18);
|
QCOMPARE(node->geometry()->vertexCount(), 7 * 18);
|
||||||
QVERIFY(material2 != 0);
|
QVERIFY(material2 != nullptr);
|
||||||
QCOMPARE(material1->type(), material2->type());
|
QCOMPARE(material1->type(), material2->type());
|
||||||
QSGMaterialShader *shader1 = material1->createShader();
|
QSGMaterialShader *shader1 = material1->createShader();
|
||||||
QVERIFY(shader1 != 0);
|
QVERIFY(shader1 != nullptr);
|
||||||
QSGMaterialShader *shader2 = material2->createShader();
|
QSGMaterialShader *shader2 = material2->createShader();
|
||||||
QVERIFY(shader2 != 0);
|
QVERIFY(shader2 != nullptr);
|
||||||
QCOMPARE(shader1->attributeNames(), shader2->attributeNames());
|
QCOMPARE(shader1->attributeNames(), shader2->attributeNames());
|
||||||
|
|
||||||
delete shader1;
|
delete shader1;
|
||||||
|
@@ -34,7 +34,7 @@ class QmlProfilerBindingLoopsRenderPassTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlProfilerBindingLoopsRenderPassTest(QObject *parent = 0);
|
explicit QmlProfilerBindingLoopsRenderPassTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void testInstance();
|
void testInstance();
|
||||||
|
@@ -37,7 +37,7 @@ class QmlProfilerClientManagerTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlProfilerClientManagerTest(QObject *parent = 0);
|
explicit QmlProfilerClientManagerTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void testConnectionFailure_data();
|
void testConnectionFailure_data();
|
||||||
|
@@ -36,7 +36,7 @@ class QmlProfilerConfigWidgetTest : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlProfilerConfigWidgetTest(QObject *parent = 0);
|
explicit QmlProfilerConfigWidgetTest(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void testUpdateFromSettings();
|
void testUpdateFromSettings();
|
||||||
|
Reference in New Issue
Block a user