2014-09-26 15:49:49 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** 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
|
2014-10-16 12:00:23 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2014-09-26 15:49:49 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-16 12:00:23 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2014-09-26 15:49:49 +02:00
|
|
|
**
|
|
|
|
|
** 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 NOTESMODEL_H
|
|
|
|
|
#define NOTESMODEL_H
|
|
|
|
|
|
2014-10-28 19:01:43 +01:00
|
|
|
#include "qmlprofilertimelinemodel.h"
|
2014-09-26 15:49:49 +02:00
|
|
|
#include "qmlprofilermodelmanager.h"
|
|
|
|
|
#include <QList>
|
|
|
|
|
#include <QHash>
|
|
|
|
|
|
|
|
|
|
namespace QmlProfiler {
|
2014-10-27 17:41:22 +01:00
|
|
|
class QMLPROFILER_EXPORT QmlProfilerNotesModel : public QObject {
|
2014-09-26 15:49:49 +02:00
|
|
|
Q_OBJECT
|
2014-11-04 12:32:25 +01:00
|
|
|
Q_PROPERTY(int count READ count NOTIFY changed)
|
2014-09-26 15:49:49 +02:00
|
|
|
public:
|
|
|
|
|
struct Note {
|
|
|
|
|
// Saved properties
|
|
|
|
|
QString text;
|
|
|
|
|
|
|
|
|
|
// Cache, created on loading
|
|
|
|
|
int timelineModel;
|
|
|
|
|
int timelineIndex;
|
|
|
|
|
};
|
|
|
|
|
|
2014-10-27 17:41:22 +01:00
|
|
|
QmlProfilerNotesModel(QObject *parent);
|
2014-09-26 15:49:49 +02:00
|
|
|
int count() const;
|
|
|
|
|
|
|
|
|
|
void setModelManager(QmlProfilerModelManager *modelManager);
|
2014-12-05 17:33:21 +01:00
|
|
|
void addTimelineModel(const TimelineModel *timelineModel);
|
2014-09-26 15:49:49 +02:00
|
|
|
|
2014-11-04 12:32:25 +01:00
|
|
|
Q_INVOKABLE int typeId(int index) const;
|
|
|
|
|
Q_INVOKABLE QString text(int index) const;
|
|
|
|
|
Q_INVOKABLE int timelineModel(int index) const;
|
|
|
|
|
Q_INVOKABLE int timelineIndex(int index) const;
|
2014-09-26 15:49:49 +02:00
|
|
|
|
2014-11-04 12:32:25 +01:00
|
|
|
Q_INVOKABLE QVariantList byTypeId(int typeId) const;
|
|
|
|
|
Q_INVOKABLE QVariantList byTimelineModel(int timelineModel) const;
|
2014-09-26 15:49:49 +02:00
|
|
|
|
2014-11-04 12:32:25 +01:00
|
|
|
Q_INVOKABLE int get(int timelineModel, int timelineIndex) const;
|
|
|
|
|
Q_INVOKABLE int add(int timelineModel, int timelineIndex, const QString &text);
|
|
|
|
|
Q_INVOKABLE void update(int index, const QString &text);
|
|
|
|
|
Q_INVOKABLE void remove(int index);
|
2014-09-26 15:49:49 +02:00
|
|
|
|
2014-11-04 12:32:25 +01:00
|
|
|
Q_INVOKABLE void setText(int noteId, const QString &text);
|
|
|
|
|
Q_INVOKABLE void setText(int modelIndex, int index, const QString &text);
|
2014-09-26 15:49:49 +02:00
|
|
|
|
2014-11-04 12:32:25 +01:00
|
|
|
bool isModified() const;
|
2014-09-26 15:49:49 +02:00
|
|
|
void loadData();
|
|
|
|
|
void saveData();
|
2014-11-03 14:19:26 +01:00
|
|
|
void clear();
|
2014-09-26 15:49:49 +02:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void changed(int typeId, int timelineModel, int timelineIndex);
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void removeTimelineModel(QObject *timelineModel);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
QmlProfilerModelManager *m_modelManager;
|
|
|
|
|
QList<Note> m_data;
|
2014-12-05 17:33:21 +01:00
|
|
|
QHash<int, const TimelineModel *> m_timelineModels;
|
2014-11-03 14:19:26 +01:00
|
|
|
bool m_modified;
|
2014-09-26 15:49:49 +02:00
|
|
|
|
|
|
|
|
int add(int typeId, qint64 startTime, qint64 duration, const QString &text);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
#endif // NOTESMODEL_H
|