QmlProfiler: Modernize

modernize-*

Change-Id: Ibdf9c0ae91bf8a622facc7f323112b550f532f15
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Alessandro Portale
2018-11-24 12:14:44 +01:00
parent 383f0b9fcc
commit d1df55d128
42 changed files with 112 additions and 131 deletions

View File

@@ -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);
return child;
}
@@ -270,7 +270,7 @@ FlameGraphData *FlameGraphModel::pushChild(FlameGraphData *parent, const QmlEven
QModelIndex FlameGraphModel::index(int row, int column, const QModelIndex &parent) const
{
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]);
} else {
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
{
if (child.isValid()) {
FlameGraphData *childData = static_cast<FlameGraphData *>(child.internalPointer());
auto childData = static_cast<const FlameGraphData *>(child.internalPointer());
return childData->parent == &m_stackBottom ? QModelIndex() :
createIndex(0, 0, childData->parent);
} else {
@@ -291,7 +291,7 @@ QModelIndex FlameGraphModel::parent(const QModelIndex &child) const
int FlameGraphModel::rowCount(const QModelIndex &parent) const
{
if (parent.isValid()) {
FlameGraphData *parentData = static_cast<FlameGraphData *>(parent.internalPointer());
auto parentData = static_cast<const FlameGraphData *>(parent.internalPointer());
return parentData->children.count();
} else {
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
{
FlameGraphData *data = static_cast<FlameGraphData *>(index.internalPointer());
auto data = static_cast<const FlameGraphData *>(index.internalPointer());
return lookup(data ? *data : m_stackBottom, role);
}

View File

@@ -85,13 +85,12 @@ void FlameGraphView::onVisibleFeaturesChanged(quint64 features)
void FlameGraphView::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
QAction *getGlobalStatsAction = nullptr;
QPoint position = ev->globalPos();
menu.addActions(QmlProfilerTool::profilerContextMenuActions());
menu.addSeparator();
getGlobalStatsAction = menu.addAction(tr("Show Full Range"));
QAction *getGlobalStatsAction = menu.addAction(tr("Show Full Range"));
if (!m_model->modelManager()->isRestrictedToRange())
getGlobalStatsAction->setEnabled(false);

View File

@@ -73,11 +73,11 @@ public:
private:
struct RangeStackFrame {
RangeStackFrame() : originTypeIndex(-1), startTime(-1) {}
RangeStackFrame() = default;
RangeStackFrame(int originTypeIndex, qint64 startTime) :
originTypeIndex(originTypeIndex), startTime(startTime) {}
int originTypeIndex;
qint64 startTime;
int originTypeIndex = -1;
qint64 startTime = -1;
};
enum EventContinuation {

View File

@@ -166,7 +166,7 @@ QVariantMap PixmapCacheModel::details(int index) const
void PixmapCacheModel::loadEvent(const QmlEvent &event, const QmlEventType &type)
{
Item newEvent;
const PixmapEventType pixmapType = static_cast<PixmapEventType>(type.detailType());
const auto pixmapType = static_cast<PixmapEventType>(type.detailType());
newEvent.pixmapEventType = pixmapType;
qint64 pixmapStartTime = event.timestamp();
@@ -443,13 +443,11 @@ void PixmapCacheModel::computeMaxCacheSize()
void PixmapCacheModel::resizeUnfinishedLoads()
{
// all the unfinished "load start" events continue till the end of the trace
for (auto pixmap = m_pixmaps.begin(), pixmapsEnd = m_pixmaps.end();
pixmap != pixmapsEnd; ++pixmap) {
for (auto size = pixmap->sizes.begin(), sizesEnd = pixmap->sizes.end(); size != sizesEnd;
++size) {
if (size->loadState == Loading) {
insertEnd(size->started, modelManager()->traceEnd() - startTime(size->started));
size->loadState = Error;
for (auto &pixmap : m_pixmaps) {
for (auto &size : pixmap.sizes) {
if (size.loadState == Loading) {
insertEnd(size.started, modelManager()->traceEnd() - startTime(size.started));
size.loadState = Error;
}
}
}

View File

@@ -59,16 +59,16 @@ public:
struct PixmapState {
PixmapState(int width, int height, CacheState cache = Uncached) :
size(width, height), started(-1), loadState(Initial), cacheState(cache) {}
PixmapState(CacheState cache = Uncached) : started(-1), loadState(Initial), cacheState(cache) {}
size(width, height), cacheState(cache) {}
PixmapState(CacheState cache = Uncached) : cacheState(cache) {}
QSize size;
int started;
LoadState loadState;
int started = -1;
LoadState loadState = Initial;
CacheState cacheState;
};
struct Pixmap {
Pixmap() {}
Pixmap() = default;
Pixmap(const QString &url) : url(url), sizes(1) {}
QString url;
QVector<PixmapState> sizes;

View File

@@ -41,7 +41,7 @@ namespace QmlProfiler {
struct QmlEvent : public Timeline::TraceEvent {
static const qint32 staticClassId = 0x716d6c65; // 'qmle';
QmlEvent() : TraceEvent(staticClassId), m_dataType(Inline8Bit), m_dataLength(0) {}
QmlEvent() : TraceEvent(staticClassId) {}
template<typename Number>
QmlEvent(qint64 timestamp, int typeIndex, std::initializer_list<Number> list)
@@ -216,8 +216,8 @@ private:
External64Bit = Inline64Bit | External
};
Type m_dataType;
quint16 m_dataLength;
Type m_dataType = Inline8Bit;
quint16 m_dataLength = 0;
static const int s_internalDataLength = 8;
union {
@@ -250,7 +250,7 @@ private:
typename std::enable_if<(sizeof(Number) > 1), bool>::type
squeeze(const Container &numbers)
{
typedef typename QIntegerForSize<sizeof(Number) / 2>::Signed Small;
using Small = typename QIntegerForSize<sizeof(Number) / 2>::Signed;
foreach (Number item, numbers) {
if (!squeezable<Number, Small>(item))
return false;

View File

@@ -35,7 +35,7 @@ namespace QmlProfiler {
class QMLPROFILER_EXPORT QmlEventLocation
{
public:
QmlEventLocation() : m_line(-1),m_column(-1) {}
QmlEventLocation() = default;
QmlEventLocation(const QString &file, int lineNumber, int columnNumber) : m_filename(file),
m_line(lineNumber), m_column(columnNumber)
{}
@@ -60,8 +60,8 @@ private:
friend QDataStream &operator<<(QDataStream &stream, const QmlEventLocation &location);
QString m_filename;
int m_line;
int m_column;
int m_line = -1;
int m_column = -1;
};
inline bool operator==(const QmlEventLocation &location1, const QmlEventLocation &location2)

View File

@@ -78,7 +78,7 @@ QDataStream &operator<<(QDataStream &stream, const QmlEventType &type)
QmlEventType::QmlEventType(Message message, RangeType rangeType, int detailType,
const QmlEventLocation &location, const QString &data,
const QString displayName) :
const QString &displayName) :
TraceEventType(staticClassId, qmlFeatureFromType(message, rangeType, detailType)),
m_data(data), m_location(location), m_message(message),
m_rangeType(rangeType), m_detailType(detailType)

View File

@@ -41,7 +41,7 @@ public:
QmlEventType(Message message = MaximumMessage, RangeType rangeType = MaximumRangeType,
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 setLocation(const QmlEventLocation &location) { m_location = location; }

View File

@@ -64,11 +64,11 @@ QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) :
d->portSpinBox->setMaximum(65535);
d->portSpinBox->setValue(3768);
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
auto buttonBox = new QDialogButtonBox(this);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
QLabel *hint = new QLabel(this);
auto hint = new QLabel(this);
hint->setWordWrap(true);
hint->setTextFormat(Qt::RichText);
hint->setText(tr("Select an externally started QML-debug enabled application.<p>"
@@ -76,11 +76,11 @@ QmlProfilerAttachDialog::QmlProfilerAttachDialog(QWidget *parent) :
+ "<p><tt>-qmljsdebugger=port:&lt;port&gt;,block,<br>"
"&nbsp;&nbsp;services:CanvasFrameRate,EngineControl,DebugMessages</tt>");
QFormLayout *formLayout = new QFormLayout();
auto formLayout = new QFormLayout;
formLayout->addRow(tr("Kit:"), d->kitChooser);
formLayout->addRow(tr("&Port:"), d->portSpinBox);
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
auto verticalLayout = new QVBoxLayout(this);
verticalLayout->addWidget(hint);
verticalLayout->addLayout(formLayout);
verticalLayout->addWidget(buttonBox);

View File

@@ -33,15 +33,15 @@ namespace Internal {
class BindingLoopMaterial : public QSGMaterial {
public:
QSGMaterialType *type() const;
QSGMaterialShader *createShader() const;
QSGMaterialType *type() const override;
QSGMaterialShader *createShader() const override;
BindingLoopMaterial();
};
class BindingLoopsRenderPassState : public Timeline::TimelineRenderPass::State {
public:
BindingLoopsRenderPassState(const QmlProfilerRangeModel *model);
~BindingLoopsRenderPassState();
~BindingLoopsRenderPassState() override;
BindingLoopMaterial *material() { return &m_material; }
void updateIndexes(int from, int to);
@@ -50,8 +50,8 @@ public:
int indexTo() const { return m_indexTo; }
QSGNode *expandedRow(int row) const { return m_expandedRows[row]; }
const QVector<QSGNode *> &expandedRows() const { return m_expandedRows; }
QSGNode *collapsedOverlay() const { return m_collapsedOverlay; }
const QVector<QSGNode *> &expandedRows() const override { return m_expandedRows; }
QSGNode *collapsedOverlay() const override { return m_collapsedOverlay; }
private:
QVector<QSGNode *> m_expandedRows;
@@ -70,12 +70,11 @@ struct BindlingLoopsGeometry {
static const QSGGeometry::AttributeSet &point2DWithOffset();
static const int maxEventsPerNode = 0xffff / 18;
BindlingLoopsGeometry() : allocatedVertices(0), usedVertices(0), currentY(-1), node(nullptr) {}
uint allocatedVertices;
uint usedVertices;
float currentY;
uint allocatedVertices = 0;
uint usedVertices = 0;
float currentY = -1;
QSGGeometryNode *node;
QSGGeometryNode *node = nullptr;
Point2DWithOffset *vertexData();
void allocate(QSGMaterial *material);
@@ -90,9 +89,7 @@ const QmlProfilerBindingLoopsRenderPass *QmlProfilerBindingLoopsRenderPass::inst
return &pass;
}
QmlProfilerBindingLoopsRenderPass::QmlProfilerBindingLoopsRenderPass()
{
}
QmlProfilerBindingLoopsRenderPass::QmlProfilerBindingLoopsRenderPass() = default;
static inline bool eventOutsideRange(const QmlProfilerRangeModel *model,
const Timeline::TimelineRenderState *parentState, int i)
@@ -163,8 +160,7 @@ Timeline::TimelineRenderPass::State *QmlProfilerBindingLoopsRenderPass::update(
Q_UNUSED(stateChanged);
Q_UNUSED(spacing);
const QmlProfilerRangeModel *model = qobject_cast<const QmlProfilerRangeModel *>(
renderer->model());
auto model = qobject_cast<const QmlProfilerRangeModel *>(renderer->model());
if (!model || indexFrom < 0 || indexTo > model->count() || indexFrom >= indexTo)
return oldState;
@@ -229,8 +225,7 @@ Point2DWithOffset *BindlingLoopsGeometry::vertexData()
void BindlingLoopsGeometry::allocate(QSGMaterial *material)
{
QSGGeometry *geometry = new QSGGeometry(BindlingLoopsGeometry::point2DWithOffset(),
usedVertices);
auto geometry = new QSGGeometry(BindlingLoopsGeometry::point2DWithOffset(), usedVertices);
Q_ASSERT(geometry->vertexData());
geometry->setIndexDataPattern(QSGGeometry::StaticPattern);
geometry->setVertexDataPattern(QSGGeometry::StaticPattern);
@@ -367,7 +362,7 @@ BindingLoopsRenderPassState::BindingLoopsRenderPassState(const QmlProfilerRangeM
m_collapsedOverlay->setFlag(QSGNode::OwnedByParent, false);
m_expandedRows.reserve(model->expandedRowCount());
for (int i = 0; i < model->expandedRowCount(); ++i) {
QSGNode *node = new QSGNode;
auto node = new QSGNode;
node->setFlag(QSGNode::OwnedByParent, false);
m_expandedRows << node;
}

View File

@@ -478,7 +478,7 @@ int QmlProfilerEventTypeStorage::append(Timeline::TraceEventType &&type)
m_types.push_back(std::move(type.asRvalueRef<QmlEventType>()));
} else {
QTC_CHECK(false);
m_types.push_back(QmlEventType());
m_types.emplace_back();
}
QTC_ASSERT(index <= static_cast<size_t>(std::numeric_limits<int>::max()),
return std::numeric_limits<int>::max());

View File

@@ -49,8 +49,8 @@ class QMLPROFILER_EXPORT QmlProfilerModelManager : public Timeline::TimelineTrac
{
Q_OBJECT
public:
typedef std::function<void(const QmlEvent &, const QmlEventType &)> QmlEventLoader;
typedef std::function<QmlEventLoader(QmlEventLoader)> QmlEventFilter;
using QmlEventLoader = std::function<void (const QmlEvent &, const QmlEventType &)>;
using QmlEventFilter = std::function<QmlEventLoader (QmlEventLoader)>;
explicit QmlProfilerModelManager(QObject *parent = nullptr);
~QmlProfilerModelManager() override;

View File

@@ -37,9 +37,9 @@ class QmlProfilerOptionsPage : public Core::IOptionsPage
public:
QmlProfilerOptionsPage();
QWidget *widget();
void apply();
void finish();
QWidget *widget() override;
void apply() override;
void finish() override;
private:
QPointer<QWidget> m_widget;

View File

@@ -115,7 +115,7 @@ void QmlProfilerPlugin::extensionsInitialized()
RunControl::registerWorkerCreator(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
[this](RunControl *runControl) {
QmlProfilerRunner *runner = new QmlProfilerRunner(runControl);
auto runner = new QmlProfilerRunner(runControl);
connect(runner, &QmlProfilerRunner::starting,
&d->m_profilerTool, &QmlProfilerTool::finalizeRunControl);
return runner;

View File

@@ -155,7 +155,7 @@ void QmlProfilerRangeModel::computeExpandedLevels()
void QmlProfilerRangeModel::findBindingLoops()
{
typedef QPair<int, int> CallStackEntry;
using CallStackEntry = QPair<int, int>;
QStack<CallStackEntry> callStack;
for (int i = 0; i < count(); ++i) {

View File

@@ -45,15 +45,10 @@ class QmlProfilerRangeModel : public QmlProfilerTimelineModel
public:
struct Item {
Item() :
displayRowExpanded(1),
displayRowCollapsed(Constants::QML_MIN_LEVEL),
bindingLoopHead(-1) {}
// not-expanded, per type
int displayRowExpanded;
int displayRowCollapsed;
int bindingLoopHead;
int displayRowExpanded = 1;
int displayRowCollapsed = Constants::QML_MIN_LEVEL;
int bindingLoopHead = -1;
};
QmlProfilerRangeModel(QmlProfilerModelManager *manager, RangeType range,

View File

@@ -231,7 +231,7 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(QmlProfilerTool *profilerTool,
{
setId("LocalQmlProfilerSupport");
QmlProfilerRunner *profiler = new QmlProfilerRunner(runControl);
auto profiler = new QmlProfilerRunner(runControl);
profiler->setServerUrl(serverUrl);
connect(profiler, &QmlProfilerRunner::starting,
profilerTool, &QmlProfilerTool::finalizeRunControl);

View File

@@ -51,7 +51,7 @@ public:
: q(qq), m_currentState(Idle), m_clientRecording(true), m_serverRecording(false),
m_requestedFeatures(0), m_recordedFeatures(0) {}
~QmlProfilerStateManagerPrivate() {}
~QmlProfilerStateManagerPrivate() = default;
QmlProfilerStateManager *q;

View File

@@ -62,7 +62,7 @@ QmlProfilerStateWidget::QmlProfilerStateWidget(QmlProfilerStateManager *stateMan
setFrameStyle(QFrame::StyledPanel);
// UI elements
QVBoxLayout *layout = new QVBoxLayout(this);
auto layout = new QVBoxLayout(this);
resize(200,70);
d->text = new QLabel(this);

View File

@@ -40,7 +40,7 @@ public:
explicit QmlProfilerStateWidget(QmlProfilerStateManager *stateManager,
QmlProfilerModelManager *modelManager,
QWidget *parent = nullptr);
~QmlProfilerStateWidget();
~QmlProfilerStateWidget() override;
private:
void showText(const QString &text);

View File

@@ -70,7 +70,7 @@ QmlProfilerStatisticsView::QmlProfilerStatisticsView(QmlProfilerModelManager *pr
setObjectName(QLatin1String("QmlProfiler.Statistics.Dock"));
setWindowTitle(tr("Statistics"));
QmlProfilerStatisticsModel *model = new QmlProfilerStatisticsModel(profilerModelManager);
auto model = new QmlProfilerStatisticsModel(profilerModelManager);
m_mainView.reset(new QmlProfilerStatisticsMainView(model));
connect(m_mainView.get(), &QmlProfilerStatisticsMainView::gotoSourceLocation,
this, &QmlProfilerStatisticsView::gotoSourceLocation);
@@ -99,13 +99,13 @@ QmlProfilerStatisticsView::QmlProfilerStatisticsView(QmlProfilerModelManager *pr
m_callersView.get(), &QmlProfilerStatisticsRelativesView::displayType);
// widget arrangement
QVBoxLayout *groupLayout = new QVBoxLayout;
auto groupLayout = new QVBoxLayout;
groupLayout->setContentsMargins(0,0,0,0);
groupLayout->setSpacing(0);
Core::MiniSplitter *splitterVertical = new Core::MiniSplitter;
auto splitterVertical = new Core::MiniSplitter;
splitterVertical->addWidget(m_mainView.get());
Core::MiniSplitter *splitterHorizontal = new Core::MiniSplitter;
auto splitterHorizontal = new Core::MiniSplitter;
splitterHorizontal->addWidget(m_callersView.get());
splitterHorizontal->addWidget(m_calleesView.get());
splitterHorizontal->setOrientation(Qt::Horizontal);
@@ -226,9 +226,7 @@ QmlProfilerStatisticsMainView::QmlProfilerStatisticsMainView(QmlProfilerStatisti
resizeColumnToContents(MainType);
}
QmlProfilerStatisticsMainView::~QmlProfilerStatisticsMainView()
{
}
QmlProfilerStatisticsMainView::~QmlProfilerStatisticsMainView() = default;
void QmlProfilerStatisticsMainView::setShowExtendedStatistics(bool show)
{
@@ -274,7 +272,7 @@ void QmlProfilerStatisticsMainView::jumpToItem(int typeIndex)
{
displayTypeIndex(typeIndex);
QSortFilterProxyModel *sortModel = qobject_cast<QSortFilterProxyModel *>(model());
auto sortModel = qobject_cast<const QSortFilterProxyModel *>(model());
QTC_ASSERT(sortModel, return);
QAbstractItemModel *sourceModel = sortModel->sourceModel();
@@ -294,7 +292,7 @@ void QmlProfilerStatisticsMainView::displayTypeIndex(int typeIndex)
if (typeIndex < 0) {
setCurrentIndex(QModelIndex());
} else {
QSortFilterProxyModel *sortModel = qobject_cast<QSortFilterProxyModel *>(model());
auto sortModel = qobject_cast<const QSortFilterProxyModel *>(model());
QTC_ASSERT(sortModel, return);
QAbstractItemModel *sourceModel = sortModel->sourceModel();
@@ -392,9 +390,7 @@ QmlProfilerStatisticsRelativesView::QmlProfilerStatisticsRelativesView(
});
}
QmlProfilerStatisticsRelativesView::~QmlProfilerStatisticsRelativesView()
{
}
QmlProfilerStatisticsRelativesView::~QmlProfilerStatisticsRelativesView() = default;
void QmlProfilerStatisticsRelativesView::displayType(int typeIndex)
{

View File

@@ -75,7 +75,7 @@ class QmlProfilerStatisticsMainView : public Utils::TreeView
Q_OBJECT
public:
explicit QmlProfilerStatisticsMainView(QmlProfilerStatisticsModel *model);
~QmlProfilerStatisticsMainView();
~QmlProfilerStatisticsMainView() override;
QModelIndex selectedModelIndex() const;
void copyTableToClipboard() const;
@@ -110,7 +110,7 @@ class QmlProfilerStatisticsRelativesView : public Utils::TreeView
Q_OBJECT
public:
explicit QmlProfilerStatisticsRelativesView(QmlProfilerStatisticsRelativesModel *model);
~QmlProfilerStatisticsRelativesView();
~QmlProfilerStatisticsRelativesView() override;
void displayType(int typeIndex);
void jumpToItem(int typeIndex);

View File

@@ -106,15 +106,15 @@ void QmlProfilerTextMarkModel::createMarks(QmlProfilerViewManager *viewManager,
});
int lineNumber = -1;
for (auto it = ids.begin(), end = ids.end(); it != end; ++it) {
if (it->lineNumber == lineNumber) {
m_marks.last()->addTypeId(it->typeId);
for (const auto &id : ids) {
if (id.lineNumber == lineNumber) {
m_marks.last()->addTypeId(id.typeId);
} else {
lineNumber = it->lineNumber;
lineNumber = id.lineNumber;
m_marks << new QmlProfilerTextMark(viewManager,
it->typeId,
id.typeId,
FileName::fromString(fileName),
it->lineNumber);
id.lineNumber);
}
}
}
@@ -133,7 +133,7 @@ void QmlProfilerTextMarkModel::hideTextMarks()
bool QmlProfilerTextMark::addToolTipContent(QLayout *target) const
{
QGridLayout *layout = new QGridLayout;
auto layout = new QGridLayout;
layout->setHorizontalSpacing(10);
for (int row = 0, rowEnd = m_typeIds.length(); row != rowEnd; ++row) {
const QStringList typeDetails = m_viewManager->statisticsView()->details(m_typeIds[row]);

View File

@@ -304,7 +304,7 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
auto aspect = static_cast<QmlProfilerRunConfigurationAspect *>(
runConfiguration->aspect(Constants::SETTINGS));
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() ?
settings->flushInterval() : 0);
d->m_profilerModelManager->setAggregateTraces(settings->aggregateTraces());
@@ -345,7 +345,7 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionFailed,
runWorker, [this, runWorker]() {
QMessageBox *infoBox = new QMessageBox(ICore::mainWindow());
auto infoBox = new QMessageBox(ICore::mainWindow());
infoBox->setIcon(QMessageBox::Critical);
infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME);
@@ -513,7 +513,7 @@ ProjectExplorer::RunControl *QmlProfilerTool::attachToWaitingApplication()
Id kitId;
int port;
Kit *kit = 0;
Kit *kit = nullptr;
{
QSettings *settings = ICore::settings();
@@ -573,7 +573,7 @@ void QmlProfilerTool::logError(const QString &msg)
void QmlProfilerTool::showErrorDialog(const QString &error)
{
QMessageBox *errorDialog = new QMessageBox(ICore::mainWindow());
auto errorDialog = new QMessageBox(ICore::mainWindow());
errorDialog->setIcon(QMessageBox::Warning);
errorDialog->setWindowTitle(tr("QML Profiler"));
errorDialog->setText(error);
@@ -780,7 +780,7 @@ QList <QAction *> QmlProfilerTool::profilerContextMenuActions()
void QmlProfilerTool::showNonmodalWarning(const QString &warningMsg)
{
QMessageBox *noExecWarning = new QMessageBox(ICore::mainWindow());
auto noExecWarning = new QMessageBox(ICore::mainWindow());
noExecWarning->setIcon(QMessageBox::Warning);
noExecWarning->setWindowTitle(tr("QML Profiler"));
noExecWarning->setText(warningMsg);

View File

@@ -70,8 +70,6 @@
#include <QRegExp>
#include <QTextCursor>
#include <math.h>
namespace QmlProfiler {
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->setSpacing(0);
@@ -136,7 +134,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
d->m_mainView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setFocusProxy(d->m_mainView);
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
auto agg = new Aggregation::Aggregate;
agg->add(d->m_mainView);
agg->add(new TraceViewFindSupport(this, modelManager));

View File

@@ -46,7 +46,7 @@ public:
QmlProfilerViewManager(QObject *parent,
QmlProfilerModelManager *modelManager,
QmlProfilerStateManager *profilerState);
~QmlProfilerViewManager();
~QmlProfilerViewManager() override;
QmlProfilerTraceView *traceView() const { return m_traceView; }
QmlProfilerStatisticsView *statisticsView() const { return m_statisticsView; }

View File

@@ -36,7 +36,7 @@ class DebugMessagesModelTest : public QObject
{
Q_OBJECT
public:
DebugMessagesModelTest(QObject *parent = 0);
DebugMessagesModelTest(QObject *parent = nullptr);
private slots:
void initTestCase();

View File

@@ -31,7 +31,7 @@ namespace Internal {
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]() {
QmlDebug::QPacket packet(QDataStream::Qt_4_7);
const int messageId = 0;

View File

@@ -41,7 +41,7 @@ int FlameGraphModelTest::generateData(QmlProfilerModelManager *manager,
Timeline::TimelineModelAggregator *aggregator)
{
// Notes only work with timeline models
QmlProfilerRangeModel *rangeModel = new QmlProfilerRangeModel(manager, Javascript, aggregator);
auto rangeModel = new QmlProfilerRangeModel(manager, Javascript, aggregator);
int rangeModelId = rangeModel->modelId();
manager->notesModel()->addTimelineModel(rangeModel);

View File

@@ -36,7 +36,7 @@ class InputEventsModelTest : public QObject
{
Q_OBJECT
public:
InputEventsModelTest(QObject *parent = 0);
InputEventsModelTest(QObject *parent = nullptr);
private slots:
void initTestCase();

View File

@@ -37,7 +37,7 @@ class LocalQmlProfilerRunnerTest : public QObject
{
Q_OBJECT
public:
LocalQmlProfilerRunnerTest(QObject *parent = 0);
LocalQmlProfilerRunnerTest(QObject *parent = nullptr);
private slots:
void testRunner();

View File

@@ -36,7 +36,7 @@ class PixmapCacheModelTest : public QObject
{
Q_OBJECT
public:
PixmapCacheModelTest(QObject *parent = 0);
PixmapCacheModelTest(QObject *parent = nullptr);
private slots:
void initTestCase();

View File

@@ -34,7 +34,7 @@ class QmlEventTest : public QObject
{
Q_OBJECT
public:
explicit QmlEventTest(QObject *parent = 0);
explicit QmlEventTest(QObject *parent = nullptr);
private slots:
void testCtors();

View File

@@ -33,7 +33,7 @@ class QmlEventLocationTest : public QObject
{
Q_OBJECT
public:
explicit QmlEventLocationTest(QObject *parent = 0);
explicit QmlEventLocationTest(QObject *parent = nullptr);
private slots:
void testCtor();

View File

@@ -33,7 +33,7 @@ class QmlEventTypeTest : public QObject
{
Q_OBJECT
public:
explicit QmlEventTypeTest(QObject *parent = 0);
explicit QmlEventTypeTest(QObject *parent = nullptr);
private slots:
void testAccessors();

View File

@@ -35,7 +35,7 @@ class QmlNoteTest : public QObject
{
Q_OBJECT
public:
explicit QmlNoteTest(QObject *parent = 0);
explicit QmlNoteTest(QObject *parent = nullptr);
private slots:
void testAccessors();

View File

@@ -36,7 +36,7 @@ class QmlProfilerAnimationsModelTest : public QObject
{
Q_OBJECT
public:
explicit QmlProfilerAnimationsModelTest(QObject *parent = 0);
explicit QmlProfilerAnimationsModelTest(QObject *parent = nullptr);
private slots:
void initTestCase();

View File

@@ -78,7 +78,7 @@ void QmlProfilerBindingLoopsRenderPassTest::testInstance()
const QmlProfilerBindingLoopsRenderPass *inst = QmlProfilerBindingLoopsRenderPass::instance();
const QmlProfilerBindingLoopsRenderPass *inst2 = QmlProfilerBindingLoopsRenderPass::instance();
QCOMPARE(inst, inst2);
QVERIFY(inst != 0);
QVERIFY(inst != nullptr);
}
void QmlProfilerBindingLoopsRenderPassTest::testUpdate()
@@ -86,43 +86,43 @@ void QmlProfilerBindingLoopsRenderPassTest::testUpdate()
const QmlProfilerBindingLoopsRenderPass *inst = QmlProfilerBindingLoopsRenderPass::instance();
Timeline::TimelineAbstractRenderer renderer;
Timeline::TimelineRenderState parentState(0, 8, 1, 1);
Timeline::TimelineRenderPass::State *nullState = 0;
QSGNode *nullNode = 0;
Timeline::TimelineRenderPass::State *nullState = nullptr;
QSGNode *nullNode = nullptr;
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);
QmlProfilerModelManager manager;
Timeline::TimelineModelAggregator aggregator;
DummyModel model(&manager, &aggregator);
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);
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);
result = inst->update(&renderer, &parentState, 0, 2, 9, true, 1);
result = inst->update(&renderer, &parentState, nullptr, 2, 9, true, 1);
QVERIFY(result != nullState);
QCOMPARE(result->expandedOverlay(), nullNode);
QVERIFY(result->collapsedOverlay() != nullNode);
QCOMPARE(result->expandedRows().count(), 2); // all the loops are in one row
QCOMPARE(result->collapsedRows().count(), 0); // it's an overlay
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();
QVERIFY(material1 != 0);
QVERIFY(material1 != nullptr);
QCOMPARE(node->geometry()->vertexCount(), 7 * 4);
node = static_cast<QSGGeometryNode *>(result->collapsedOverlay()->firstChild());
QSGMaterial *material2 = node->material();
QCOMPARE(node->geometry()->vertexCount(), 7 * 18);
QVERIFY(material2 != 0);
QVERIFY(material2 != nullptr);
QCOMPARE(material1->type(), material2->type());
QSGMaterialShader *shader1 = material1->createShader();
QVERIFY(shader1 != 0);
QVERIFY(shader1 != nullptr);
QSGMaterialShader *shader2 = material2->createShader();
QVERIFY(shader2 != 0);
QVERIFY(shader2 != nullptr);
QCOMPARE(shader1->attributeNames(), shader2->attributeNames());
delete shader1;

View File

@@ -34,7 +34,7 @@ class QmlProfilerBindingLoopsRenderPassTest : public QObject
{
Q_OBJECT
public:
explicit QmlProfilerBindingLoopsRenderPassTest(QObject *parent = 0);
explicit QmlProfilerBindingLoopsRenderPassTest(QObject *parent = nullptr);
private slots:
void testInstance();

View File

@@ -37,7 +37,7 @@ class QmlProfilerClientManagerTest : public QObject
{
Q_OBJECT
public:
explicit QmlProfilerClientManagerTest(QObject *parent = 0);
explicit QmlProfilerClientManagerTest(QObject *parent = nullptr);
private slots:
void testConnectionFailure_data();

View File

@@ -36,7 +36,7 @@ class QmlProfilerConfigWidgetTest : public QObject
{
Q_OBJECT
public:
explicit QmlProfilerConfigWidgetTest(QObject *parent = 0);
explicit QmlProfilerConfigWidgetTest(QObject *parent = nullptr);
private slots:
void testUpdateFromSettings();