qmlprofileranimationsmodel.h 2.6 KB
Newer Older
Christiaan Janssen's avatar
Christiaan Janssen committed
1 2
/****************************************************************************
**
3 4
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
Christiaan Janssen's avatar
Christiaan Janssen committed
5 6 7 8 9 10 11
**
** 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
12 13 14
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
Christiaan Janssen's avatar
Christiaan Janssen committed
15
**
16 17 18 19 20 21 22
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
Christiaan Janssen's avatar
Christiaan Janssen committed
23 24 25
**
****************************************************************************/

hjk's avatar
hjk committed
26
#pragma once
Christiaan Janssen's avatar
Christiaan Janssen committed
27

28
#include "qmlprofilertimelinemodel.h"
29
#include "qmlprofilereventtypes.h"
30
#include "qmleventlocation.h"
31
#include "qmlprofilerdatamodel.h"
Christiaan Janssen's avatar
Christiaan Janssen committed
32

33 34 35
#include <QVariantList>
#include <QColor>
#include <QObject>
Christiaan Janssen's avatar
Christiaan Janssen committed
36 37 38 39 40 41

namespace QmlProfiler {
class QmlProfilerModelManager;

namespace Internal {

42
class QmlProfilerAnimationsModel : public QmlProfilerTimelineModel
Christiaan Janssen's avatar
Christiaan Janssen committed
43 44 45 46 47 48 49
{
    Q_OBJECT
public:

    struct QmlPaintEventData {
        int framerate;
        int animationcount;
50
        int typeId;
Christiaan Janssen's avatar
Christiaan Janssen committed
51 52
    };

53
    QmlProfilerAnimationsModel(QmlProfilerModelManager *manager, QObject *parent = 0);
Christiaan Janssen's avatar
Christiaan Janssen committed
54

55
    int rowMaxValue(int rowNumber) const override;
56

57 58 59
    int typeId(int index) const override;
    Q_INVOKABLE int expandedRow(int index) const override;
    Q_INVOKABLE int collapsedRow(int index) const override;
60

61
    QRgb color(int index) const override;
62
    float relativeHeight(int index) const override;
Christiaan Janssen's avatar
Christiaan Janssen committed
63

64 65
    QVariantList labels() const override;
    QVariantMap details(int index) const override;
Christiaan Janssen's avatar
Christiaan Janssen committed
66

67
    bool accepted(const QmlEventType &type) const override;
68 69 70
    void loadEvent(const QmlEvent &event, const QmlEventType &type) override;
    void finalize() override;
    void clear() override;
71

Christiaan Janssen's avatar
Christiaan Janssen committed
72
private:
73
    QVector<QmlProfilerAnimationsModel::QmlPaintEventData> m_data;
74 75
    int m_maxGuiThreadAnimations = 0;
    int m_maxRenderThreadAnimations = 0;
76
    qint64 m_minNextStartTimes[2];
77

78
    int rowFromThreadId(int threadId) const;
Christiaan Janssen's avatar
Christiaan Janssen committed
79 80
};

81 82
} // namespace Internal
} // namespace QmlProfiler