forked from qt-creator/qt-creator
Timeline: Rename "timelineModel" to "modelId" in notes model
"modelId" is the term used everywhere else. Change-Id: I36204a68e0b2537a1efa2f50737f3fb618d8bb8a Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -62,10 +62,10 @@ void TimelineNotesModel::addTimelineModel(const TimelineModel *timelineModel)
|
||||
d->timelineModels.insert(timelineModel->modelId(), timelineModel);
|
||||
}
|
||||
|
||||
const TimelineModel *TimelineNotesModel::timelineModelByModelId(int timelineModel) const
|
||||
const TimelineModel *TimelineNotesModel::timelineModelByModelId(int modelId) const
|
||||
{
|
||||
Q_D(const TimelineNotesModel);
|
||||
auto it = d->timelineModels.find(timelineModel);
|
||||
auto it = d->timelineModels.find(modelId);
|
||||
return it == d->timelineModels.end() ? 0 : it.value();
|
||||
}
|
||||
|
||||
@@ -113,38 +113,38 @@ QVariantList TimelineNotesModel::byTypeId(int selectedType) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
QVariantList TimelineNotesModel::byTimelineModel(int timelineModel) const
|
||||
QVariantList TimelineNotesModel::byTimelineModel(int modelId) const
|
||||
{
|
||||
Q_D(const TimelineNotesModel);
|
||||
QVariantList ret;
|
||||
for (int noteId = 0; noteId < count(); ++noteId) {
|
||||
if (d->data[noteId].timelineModel == timelineModel)
|
||||
if (d->data[noteId].timelineModel == modelId)
|
||||
ret << noteId;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int TimelineNotesModel::get(int timelineModel, int timelineIndex) const
|
||||
int TimelineNotesModel::get(int modelId, int timelineIndex) const
|
||||
{
|
||||
Q_D(const TimelineNotesModel);
|
||||
for (int noteId = 0; noteId < count(); ++noteId) {
|
||||
const TimelineNotesModelPrivate::Note ¬e = d->data[noteId];
|
||||
if (note.timelineModel == timelineModel && note.timelineIndex == timelineIndex)
|
||||
if (note.timelineModel == modelId && note.timelineIndex == timelineIndex)
|
||||
return noteId;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int TimelineNotesModel::add(int timelineModel, int timelineIndex, const QString &text)
|
||||
int TimelineNotesModel::add(int modelId, int timelineIndex, const QString &text)
|
||||
{
|
||||
Q_D(TimelineNotesModel);
|
||||
const TimelineModel *model = d->timelineModels[timelineModel];
|
||||
const TimelineModel *model = d->timelineModels[modelId];
|
||||
int typeId = model->typeId(timelineIndex);
|
||||
TimelineNotesModelPrivate::Note note = { text, timelineModel, timelineIndex };
|
||||
TimelineNotesModelPrivate::Note note = { text, modelId, timelineIndex };
|
||||
d->data << note;
|
||||
d->modified = true;
|
||||
emit changed(typeId, timelineModel, timelineIndex);
|
||||
emit changed(typeId, modelId, timelineIndex);
|
||||
return d->data.count() - 1;
|
||||
}
|
||||
|
||||
@@ -201,12 +201,12 @@ void TimelineNotesModel::setText(int noteId, const QString &text)
|
||||
remove(noteId);
|
||||
}
|
||||
|
||||
void TimelineNotesModel::setText(int modelIndex, int index, const QString &text)
|
||||
void TimelineNotesModel::setText(int modelId, int index, const QString &text)
|
||||
{
|
||||
int noteId = get(modelIndex, index);
|
||||
int noteId = get(modelId, index);
|
||||
if (noteId == -1) {
|
||||
if (text.length() > 0)
|
||||
add(modelIndex, index, text);
|
||||
add(modelId, index, text);
|
||||
} else {
|
||||
setText(noteId, text);
|
||||
}
|
||||
|
||||
@@ -53,15 +53,15 @@ public:
|
||||
Q_INVOKABLE int timelineIndex(int index) const;
|
||||
|
||||
Q_INVOKABLE QVariantList byTypeId(int typeId) const;
|
||||
Q_INVOKABLE QVariantList byTimelineModel(int timelineModel) const;
|
||||
Q_INVOKABLE QVariantList byTimelineModel(int modelId) const;
|
||||
|
||||
Q_INVOKABLE int get(int timelineModel, int timelineIndex) const;
|
||||
Q_INVOKABLE int add(int timelineModel, int timelineIndex, const QString &text);
|
||||
Q_INVOKABLE int get(int modelId, int timelineIndex) const;
|
||||
Q_INVOKABLE int add(int modelId, 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);
|
||||
Q_INVOKABLE void setText(int modelId, int index, const QString &text);
|
||||
|
||||
bool isModified() const;
|
||||
void resetModified();
|
||||
@@ -72,7 +72,7 @@ protected:
|
||||
const TimelineModel *timelineModelByModelId(int modelId) const;
|
||||
|
||||
signals:
|
||||
void changed(int typeId, int timelineModel, int timelineIndex);
|
||||
void changed(int typeId, int modelId, int timelineIndex);
|
||||
|
||||
private:
|
||||
class TimelineNotesModelPrivate;
|
||||
|
||||
Reference in New Issue
Block a user