forked from qt-creator/qt-creator
QmlProfiler: split notes model in generic and specific classes
Change-Id: I633dc6a862f344a7e5e86c25e44e400e3000f644 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
@@ -28,66 +28,26 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef NOTESMODEL_H
|
||||
#define NOTESMODEL_H
|
||||
#ifndef QMLPROFILERNOTESMODEL_H
|
||||
#define QMLPROFILERNOTESMODEL_H
|
||||
|
||||
#include "qmlprofilertimelinemodel.h"
|
||||
#include "qmlprofilermodelmanager.h"
|
||||
#include "timelinenotesmodel.h"
|
||||
#include <QList>
|
||||
#include <QHash>
|
||||
|
||||
namespace QmlProfiler {
|
||||
class QMLPROFILER_EXPORT QmlProfilerNotesModel : public QObject {
|
||||
class QMLPROFILER_EXPORT QmlProfilerNotesModel : public TimelineNotesModel {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int count READ count NOTIFY changed)
|
||||
public:
|
||||
struct Note {
|
||||
// Saved properties
|
||||
QString text;
|
||||
|
||||
// Cache, created on loading
|
||||
int timelineModel;
|
||||
int timelineIndex;
|
||||
};
|
||||
|
||||
QmlProfilerNotesModel(QObject *parent);
|
||||
int count() const;
|
||||
|
||||
void setModelManager(QmlProfilerModelManager *modelManager);
|
||||
void addTimelineModel(const TimelineModel *timelineModel);
|
||||
|
||||
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;
|
||||
|
||||
Q_INVOKABLE QVariantList byTypeId(int typeId) const;
|
||||
Q_INVOKABLE QVariantList byTimelineModel(int timelineModel) const;
|
||||
|
||||
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);
|
||||
|
||||
Q_INVOKABLE void setText(int noteId, const QString &text);
|
||||
Q_INVOKABLE void setText(int modelIndex, int index, const QString &text);
|
||||
|
||||
bool isModified() const;
|
||||
void loadData();
|
||||
void saveData();
|
||||
void clear();
|
||||
|
||||
signals:
|
||||
void changed(int typeId, int timelineModel, int timelineIndex);
|
||||
|
||||
private slots:
|
||||
void removeTimelineModel(QObject *timelineModel);
|
||||
|
||||
protected:
|
||||
QmlProfilerModelManager *m_modelManager;
|
||||
QList<Note> m_data;
|
||||
QHash<int, const TimelineModel *> m_timelineModels;
|
||||
bool m_modified;
|
||||
|
||||
int add(int typeId, qint64 startTime, qint64 duration, const QString &text);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user