diff --git a/src/plugins/qmlprofiler/abstracttimelinemodel.cpp b/src/plugins/qmlprofiler/abstracttimelinemodel.cpp index 35e25f9e9be..c12355c606e 100644 --- a/src/plugins/qmlprofiler/abstracttimelinemodel.cpp +++ b/src/plugins/qmlprofiler/abstracttimelinemodel.cpp @@ -32,8 +32,10 @@ namespace QmlProfiler { -AbstractTimelineModel::AbstractTimelineModel(AbstractTimelineModelPrivate *dd, const QString &name, - QObject *parent) : + +AbstractTimelineModel::AbstractTimelineModel(AbstractTimelineModelPrivate *dd, + const QString &name, const QString &label, QmlDebug::Message message, + QmlDebug::RangeType rangeType, QObject *parent) : QObject(parent), d_ptr(dd) { Q_D(AbstractTimelineModel); @@ -41,6 +43,10 @@ AbstractTimelineModel::AbstractTimelineModel(AbstractTimelineModelPrivate *dd, c d->name = name; d->modelId = 0; d->modelManager = 0; + d->expanded = false; + d->title = label; + d->message = message; + d->rangeType = rangeType; } AbstractTimelineModel::~AbstractTimelineModel() @@ -193,5 +199,31 @@ void AbstractTimelineModel::dataChanged() emit expandedChanged(); } +bool AbstractTimelineModel::eventAccepted(const QmlProfilerDataModel::QmlEventData &event) const +{ + Q_D(const AbstractTimelineModel); + return (event.rangeType == d->rangeType && event.message == d->message); +} + +bool AbstractTimelineModel::expanded() const +{ + Q_D(const AbstractTimelineModel); + return d->expanded; +} + +void AbstractTimelineModel::setExpanded(bool expanded) +{ + Q_D(AbstractTimelineModel); + if (expanded != d->expanded) { + d->expanded = expanded; + emit expandedChanged(); + } +} + +const QString AbstractTimelineModel::title() const +{ + Q_D(const AbstractTimelineModel); + return d->title; +} } diff --git a/src/plugins/qmlprofiler/abstracttimelinemodel.h b/src/plugins/qmlprofiler/abstracttimelinemodel.h index 24cfd4c91b0..df1f776e004 100644 --- a/src/plugins/qmlprofiler/abstracttimelinemodel.h +++ b/src/plugins/qmlprofiler/abstracttimelinemodel.h @@ -66,12 +66,13 @@ public: int findFirstIndexNoParents(qint64 startTime) const; int findLastIndex(qint64 endTime) const; int count() const; + bool eventAccepted(const QmlProfilerDataModel::QmlEventData &event) const; + bool expanded() const; + void setExpanded(bool expanded); + const QString title() const; // Methods that have to be implemented by child models - virtual bool expanded() const = 0; - virtual void setExpanded(bool expanded) = 0; virtual int rowCount() const = 0; - virtual const QString title() const = 0; Q_INVOKABLE virtual int getEventId(int index) const = 0; Q_INVOKABLE virtual QColor getColor(int index) const = 0; virtual const QVariantList getLabels() const = 0; @@ -119,7 +120,8 @@ protected: } explicit AbstractTimelineModel(AbstractTimelineModelPrivate *dd, const QString &name, - QObject *parent = 0); + const QString &label, QmlDebug::Message message, + QmlDebug::RangeType rangeType, QObject *parent); AbstractTimelineModelPrivate *d_ptr; protected slots: diff --git a/src/plugins/qmlprofiler/abstracttimelinemodel_p.h b/src/plugins/qmlprofiler/abstracttimelinemodel_p.h index 4ef663ad1c0..c8a70ada0f5 100644 --- a/src/plugins/qmlprofiler/abstracttimelinemodel_p.h +++ b/src/plugins/qmlprofiler/abstracttimelinemodel_p.h @@ -50,6 +50,10 @@ public: QString name; QmlProfilerModelManager *modelManager; int modelId; + bool expanded; + QString title; + QmlDebug::Message message; + QmlDebug::RangeType rangeType; protected: AbstractTimelineModel *q_ptr; diff --git a/src/plugins/qmlprofiler/qmlprofiler.pro b/src/plugins/qmlprofiler/qmlprofiler.pro index 981fbfd8b1f..880d1a57db2 100644 --- a/src/plugins/qmlprofiler/qmlprofiler.pro +++ b/src/plugins/qmlprofiler/qmlprofiler.pro @@ -31,7 +31,6 @@ SOURCES += \ qmlprofilerpainteventsmodelproxy.cpp \ sortedtimelinemodel.cpp \ qmlprofilerbasemodel.cpp \ - singlecategorytimelinemodel.cpp \ qmlprofilerdatamodel.cpp HEADERS += \ @@ -65,8 +64,6 @@ HEADERS += \ sortedtimelinemodel.h \ qmlprofilerbasemodel.h \ abstracttimelinemodel_p.h \ - singlecategorytimelinemodel.h \ - singlecategorytimelinemodel_p.h \ qmlprofilerdatamodel.h \ qmlprofilerbasemodel_p.h diff --git a/src/plugins/qmlprofiler/qmlprofiler.qbs b/src/plugins/qmlprofiler/qmlprofiler.qbs index d6dc2b6be31..94bbab89630 100644 --- a/src/plugins/qmlprofiler/qmlprofiler.qbs +++ b/src/plugins/qmlprofiler/qmlprofiler.qbs @@ -50,8 +50,6 @@ QtcPlugin { "qmlprofilerviewmanager.cpp", "qmlprofilerviewmanager.h", "qv8profilerdatamodel.cpp", "qv8profilerdatamodel.h", "qv8profilereventview.h", "qv8profilereventview.cpp", - "singlecategorytimelinemodel.h", "singlecategorytimelinemodel_p.h", - "singlecategorytimelinemodel.cpp", "sortedtimelinemodel.h", "sortedtimelinemodel.cpp", "timelinemodelaggregator.cpp", "timelinemodelaggregator.h", "timelinerenderer.cpp", "timelinerenderer.h", diff --git a/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp b/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp index 1e9bfab6231..9680c69018f 100644 --- a/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp @@ -31,7 +31,7 @@ #include "qmlprofilermodelmanager.h" #include "qmlprofilerdatamodel.h" #include "sortedtimelinemodel.h" -#include "singlecategorytimelinemodel_p.h" +#include "abstracttimelinemodel_p.h" #include #include @@ -48,7 +48,7 @@ namespace Internal { class PaintEventsModelProxy::PaintEventsModelProxyPrivate : public SortedTimelineModel + AbstractTimelineModel::AbstractTimelineModelPrivate> { public: @@ -61,7 +61,7 @@ private: }; PaintEventsModelProxy::PaintEventsModelProxy(QObject *parent) - : SingleCategoryTimelineModel(new PaintEventsModelProxyPrivate, + : AbstractTimelineModel(new PaintEventsModelProxyPrivate, QLatin1String("PaintEventsModelProxy"), tr("Painting"), QmlDebug::Event, QmlDebug::MaximumRangeType, parent) { @@ -83,7 +83,7 @@ void PaintEventsModelProxy::clear() bool PaintEventsModelProxy::eventAccepted(const QmlProfilerDataModel::QmlEventData &event) const { - return SingleCategoryTimelineModel::eventAccepted(event) && + return AbstractTimelineModel::eventAccepted(event) && event.detailType== QmlDebug::AnimationFrame; } diff --git a/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h b/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h index 11389cbd29a..bc7fe6ca4eb 100644 --- a/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h +++ b/src/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h @@ -32,7 +32,7 @@ #define QMLPROFILERPAINTEVENTSMODELPROXY_H #include -#include "singlecategorytimelinemodel.h" +#include "abstracttimelinemodel.h" #include #include //#include @@ -48,7 +48,7 @@ class QmlProfilerModelManager; namespace Internal { -class PaintEventsModelProxy : public SingleCategoryTimelineModel +class PaintEventsModelProxy : public AbstractTimelineModel { Q_OBJECT public: diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp index 0b053351f07..0ab453859dd 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp @@ -31,7 +31,7 @@ #include "qmlprofilermodelmanager.h" #include "qmlprofilerdatamodel.h" #include "sortedtimelinemodel.h" -#include "singlecategorytimelinemodel_p.h" +#include "abstracttimelinemodel_p.h" #include #include @@ -47,7 +47,7 @@ namespace Internal { class RangeTimelineModel::RangeTimelineModelPrivate : public SortedTimelineModel + AbstractTimelineModel::AbstractTimelineModelPrivate> { public: // convenience functions @@ -65,7 +65,7 @@ private: }; RangeTimelineModel::RangeTimelineModel(QmlDebug::RangeType rangeType, QObject *parent) - : SingleCategoryTimelineModel(new RangeTimelineModelPrivate, + : AbstractTimelineModel(new RangeTimelineModelPrivate, QLatin1String("RangeTimelineModel"), categoryLabel(rangeType), QmlDebug::MaximumMessage, rangeType, parent) { diff --git a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h index 4f8fffdc3ff..17f88fe3907 100644 --- a/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h +++ b/src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h @@ -31,7 +31,7 @@ #ifndef QMLPROFILERTIMELINEMODELPROXY_H #define QMLPROFILERTIMELINEMODELPROXY_H -#include "singlecategorytimelinemodel.h" +#include "abstracttimelinemodel.h" #include #include #include @@ -43,7 +43,7 @@ class QmlProfilerModelManager; namespace Internal { -class RangeTimelineModel : public SingleCategoryTimelineModel +class RangeTimelineModel : public AbstractTimelineModel { Q_OBJECT public: diff --git a/src/plugins/qmlprofiler/singlecategorytimelinemodel.cpp b/src/plugins/qmlprofiler/singlecategorytimelinemodel.cpp deleted file mode 100644 index 666b27ba218..00000000000 --- a/src/plugins/qmlprofiler/singlecategorytimelinemodel.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "singlecategorytimelinemodel.h" -#include "singlecategorytimelinemodel_p.h" - -namespace QmlProfiler { - -SingleCategoryTimelineModel::SingleCategoryTimelineModel(SingleCategoryTimelineModelPrivate *dd, - const QString &name, const QString &label, QmlDebug::Message message, - QmlDebug::RangeType rangeType, QObject *parent) : - AbstractTimelineModel(dd, name, parent) -{ - Q_D(SingleCategoryTimelineModel); - d->expanded = false; - d->title = label; - d->message = message; - d->rangeType = rangeType; -} - -/////////////////// QML interface - -bool SingleCategoryTimelineModel::eventAccepted(const QmlProfilerDataModel::QmlEventData &event) const -{ - Q_D(const SingleCategoryTimelineModel); - return (event.rangeType == d->rangeType && event.message == d->message); -} - -bool SingleCategoryTimelineModel::expanded() const -{ - Q_D(const SingleCategoryTimelineModel); - return d->expanded; -} - -void SingleCategoryTimelineModel::setExpanded(bool expanded) -{ - Q_D(SingleCategoryTimelineModel); - if (expanded != d->expanded) { - d->expanded = expanded; - emit expandedChanged(); - } -} - -const QString SingleCategoryTimelineModel::title() const -{ - Q_D(const SingleCategoryTimelineModel); - return d->title; -} - -} diff --git a/src/plugins/qmlprofiler/singlecategorytimelinemodel.h b/src/plugins/qmlprofiler/singlecategorytimelinemodel.h deleted file mode 100644 index dfd5b4e6575..00000000000 --- a/src/plugins/qmlprofiler/singlecategorytimelinemodel.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef SINGLECATEGORYTIMELINEMODEL_H -#define SINGLECATEGORYTIMELINEMODEL_H - -#include -#include "abstracttimelinemodel.h" - -namespace QmlProfiler { - -class QMLPROFILER_EXPORT SingleCategoryTimelineModel : public AbstractTimelineModel -{ - Q_OBJECT -public: - bool eventAccepted(const QmlProfilerDataModel::QmlEventData &event) const; - bool expanded() const; - void setExpanded(bool expanded); - - int getEventType(int index) const; - const QString title() const; - -protected: - class SingleCategoryTimelineModelPrivate; - SingleCategoryTimelineModel(SingleCategoryTimelineModelPrivate *dd, const QString &name, - const QString &label, QmlDebug::Message message, - QmlDebug::RangeType rangeType, QObject *parent); - Q_DECLARE_PRIVATE(SingleCategoryTimelineModel) -}; - -} - -#endif // SINGLECATEGORYTIMELINEMODEL_H diff --git a/src/plugins/qmlprofiler/singlecategorytimelinemodel_p.h b/src/plugins/qmlprofiler/singlecategorytimelinemodel_p.h deleted file mode 100644 index d426f2e3147..00000000000 --- a/src/plugins/qmlprofiler/singlecategorytimelinemodel_p.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef SINGLECATEGORYTIMELINEMODEL_P_H -#define SINGLECATEGORYTIMELINEMODEL_P_H - -#include "singlecategorytimelinemodel.h" -#include "abstracttimelinemodel_p.h" - -namespace QmlProfiler { - -class SingleCategoryTimelineModel::SingleCategoryTimelineModelPrivate : - public AbstractTimelineModel::AbstractTimelineModelPrivate { -public: - bool expanded; - QString title; - QmlDebug::Message message; - QmlDebug::RangeType rangeType; -}; -} - -#endif // SINGLECATEGORYTIMELINEMODEL_P_H