Commit c7c4be9c authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: Remove SingleCategoryTimelineModel



All models are single-category now, so we can merge that into the base
class.

Change-Id: I4eab43ac2b4a77402121f004097e51a29b379aa4
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent 3ea13b9b
......@@ -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;
}
}
......@@ -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:
......
......@@ -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;
......
......@@ -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
......
......@@ -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",
......
......@@ -31,7 +31,7 @@
#include "qmlprofilermodelmanager.h"
#include "qmlprofilerdatamodel.h"
#include "sortedtimelinemodel.h"
#include "singlecategorytimelinemodel_p.h"
#include "abstracttimelinemodel_p.h"
#include <utils/qtcassert.h>
#include <QCoreApplication>
......@@ -48,7 +48,7 @@ namespace Internal {
class PaintEventsModelProxy::PaintEventsModelProxyPrivate :
public SortedTimelineModel<QmlPaintEventData,
SingleCategoryTimelineModel::SingleCategoryTimelineModelPrivate>
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;
}
......
......@@ -32,7 +32,7 @@
#define QMLPROFILERPAINTEVENTSMODELPROXY_H
#include <QObject>
#include "singlecategorytimelinemodel.h"
#include "abstracttimelinemodel.h"
#include <qmldebug/qmlprofilereventtypes.h>
#include <qmldebug/qmlprofilereventlocation.h>
//#include <QHash>
......@@ -48,7 +48,7 @@ class QmlProfilerModelManager;
namespace Internal {
class PaintEventsModelProxy : public SingleCategoryTimelineModel
class PaintEventsModelProxy : public AbstractTimelineModel
{
Q_OBJECT
public:
......
......@@ -31,7 +31,7 @@
#include "qmlprofilermodelmanager.h"
#include "qmlprofilerdatamodel.h"
#include "sortedtimelinemodel.h"
#include "singlecategorytimelinemodel_p.h"
#include "abstracttimelinemodel_p.h"
#include <QCoreApplication>
#include <QVector>
......@@ -47,7 +47,7 @@ namespace Internal {
class RangeTimelineModel::RangeTimelineModelPrivate :
public SortedTimelineModel<RangeTimelineModel::QmlRangeEventStartInstance,
SingleCategoryTimelineModel::SingleCategoryTimelineModelPrivate>
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)
{
......
......@@ -31,7 +31,7 @@
#ifndef QMLPROFILERTIMELINEMODELPROXY_H
#define QMLPROFILERTIMELINEMODELPROXY_H
#include "singlecategorytimelinemodel.h"
#include "abstracttimelinemodel.h"
#include <qmldebug/qmlprofilereventtypes.h>
#include <qmldebug/qmlprofilereventlocation.h>
#include <QVariantList>
......@@ -43,7 +43,7 @@ class QmlProfilerModelManager;
namespace Internal {
class RangeTimelineModel : public SingleCategoryTimelineModel
class RangeTimelineModel : public AbstractTimelineModel
{
Q_OBJECT
public:
......
/****************************************************************************
**
** 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;
}
}
/****************************************************************************
**
** 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 <qmldebug/qmlprofilereventtypes.h>
#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
/****************************************************************************
**
** 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment