Grammar: replaces 'indexes' by 'indices'

Grammar-nazi ran

git grep -l 'indexes' | xargs sed -i '' -e 's/indexes/indices/g'

to prevent future wincing when reading the source code.

Unfortunatly, Qt itself is infected as in
QModelIndexList QItemSelection::indexes() const

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2020-03-11 11:30:51 +01:00 committed by Dirk Hohndel
parent cb28158b9a
commit 285fa8acbc
26 changed files with 88 additions and 88 deletions

View file

@ -512,7 +512,7 @@ void CylindersModel::remove(QModelIndex index)
changed = true;
endRemoveRows();
// Create a mapping of cylinder indexes:
// Create a mapping of cylinder indices:
// 1) Fill mapping[0]..mapping[index-1] with 0..index
// 2) Set mapping[index] to -1
// 3) Fill mapping[index+1]..mapping[end] with index..
@ -537,7 +537,7 @@ void CylindersModel::moveAtFirst(int cylid)
memmove(get_cylinder(&displayed_dive, i + 1), get_cylinder(&displayed_dive, i), sizeof(temp_cyl));
memmove(get_cylinder(&displayed_dive, 0), &temp_cyl, sizeof(temp_cyl));
// Create a mapping of cylinder indexes:
// Create a mapping of cylinder indices:
// 1) Fill mapping[0]..mapping[cyl] with 0..index
// 2) Set mapping[cyl] to 0
// 3) Fill mapping[cyl+1]..mapping[end] with cyl..

View file

@ -153,7 +153,7 @@ std::pair<struct dive_table, struct dive_site_table> DiveImportedModel::consumeT
move_dive_table(&diveTable, &dives);
move_dive_site_table(&sitesTable, &sites);
// Reset indexes
// Reset indices
checkStates.clear();
endResetModel();

View file

@ -18,7 +18,7 @@ public:
int rowCount(const QModelIndex& index = QModelIndex()) const;
QVariant data(const QModelIndex& index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
void setImportedDivesIndexes(int first, int last);
void setImportedDivesIndices(int first, int last);
Qt::ItemFlags flags(const QModelIndex &index) const;
Q_INVOKABLE void clearTable();
QHash<int, QByteArray> roleNames() const;

View file

@ -1412,19 +1412,19 @@ void DiveTripModelTree::divesSelected(const QVector<dive *> &divesIn, dive *curr
// We got a number of dives that have been selected. Turn this into QModelIndexes and
// emit a signal, so that views can change the selection.
QVector<QModelIndex> indexes;
indexes.reserve(dives.count());
QVector<QModelIndex> indices;
indices.reserve(dives.count());
processByTrip(dives, [this, &indexes] (dive_trip *trip, const QVector<dive *> &divesInTrip)
{ divesSelectedTrip(trip, divesInTrip, indexes); });
processByTrip(dives, [this, &indices] (dive_trip *trip, const QVector<dive *> &divesInTrip)
{ divesSelectedTrip(trip, divesInTrip, indices); });
emit selectionChanged(indexes);
emit selectionChanged(indices);
// The current dive has changed. Transform the current dive into an index and pass it on to the view.
currentChanged();
}
void DiveTripModelTree::divesSelectedTrip(dive_trip *trip, const QVector<dive *> &dives, QVector<QModelIndex> &indexes)
void DiveTripModelTree::divesSelectedTrip(dive_trip *trip, const QVector<dive *> &dives, QVector<QModelIndex> &indices)
{
if (!trip) {
// This is at the top level.
@ -1436,7 +1436,7 @@ void DiveTripModelTree::divesSelectedTrip(dive_trip *trip, const QVector<dive *>
++j;
if (j >= (int)items.size())
break;
indexes.append(createIndex(j, 0, noParent));
indices.append(createIndex(j, 0, noParent));
}
} else {
// Find the trip.
@ -1457,7 +1457,7 @@ void DiveTripModelTree::divesSelectedTrip(dive_trip *trip, const QVector<dive *>
++j;
if (j >= (int)entry.dives.size())
break;
indexes.append(createIndex(j, 0, idx));
indices.append(createIndex(j, 0, idx));
}
}
}
@ -1672,8 +1672,8 @@ void DiveTripModelList::divesSelected(const QVector<dive *> &divesIn, dive *curr
// We got a number of dives that have been selected. Turn this into QModelIndexes and
// emit a signal, so that views can change the selection.
QVector<QModelIndex> indexes;
indexes.reserve(dives.count());
QVector<QModelIndex> indices;
indices.reserve(dives.count());
// Since both lists are sorted, we can do this linearly. Perhaps a binary search
// would be better?
@ -1683,10 +1683,10 @@ void DiveTripModelList::divesSelected(const QVector<dive *> &divesIn, dive *curr
++j;
if (j >= (int)items.size())
break;
indexes.append(createIndex(j, 0, noParent));
indices.append(createIndex(j, 0, noParent));
}
emit selectionChanged(indexes);
emit selectionChanged(indices);
// The current dive has changed. Transform the current dive into an index and pass it on to the view.
currentChanged();

View file

@ -83,9 +83,9 @@ signals:
// Commands/DiveListNotifier ---(dive */dive_trip *)---> DiveTripModel ---(QModelIndex)---> DiveListView
// i.e. The command objects send changes in terms of pointer-to-dives, which the DiveTripModel transforms
// into QModelIndexes according to the current view (tree/list). Finally, the DiveListView transforms these
// indexes into local indexes according to current sorting/filtering and instructs the QSelectionModel to
// indices into local indices according to current sorting/filtering and instructs the QSelectionModel to
// perform the appropriate actions.
void selectionChanged(const QVector<QModelIndex> &indexes);
void selectionChanged(const QVector<QModelIndex> &indices);
void currentDiveChanged(QModelIndex index);
protected:
dive *oldCurrent;

View file

@ -36,20 +36,20 @@ void MultiFilterSortModel::clear()
model->clear();
}
// Translate selection into local indexes and re-emit signal
void MultiFilterSortModel::selectionChangedSlot(const QVector<QModelIndex> &indexes)
// Translate selection into local indices and re-emit signal
void MultiFilterSortModel::selectionChangedSlot(const QVector<QModelIndex> &indices)
{
QVector<QModelIndex> indexesLocal;
indexesLocal.reserve(indexes.size());
for (const QModelIndex &index: indexes) {
QVector<QModelIndex> indicesLocal;
indicesLocal.reserve(indices.size());
for (const QModelIndex &index: indices) {
QModelIndex local = mapFromSource(index);
if (local.isValid())
indexesLocal.push_back(local);
indicesLocal.push_back(local);
}
emit selectionChanged(indexesLocal);
emit selectionChanged(indicesLocal);
}
// Translate current dive into local indexes and re-emit signal
// Translate current dive into local indices and re-emit signal
void MultiFilterSortModel::currentDiveChangedSlot(QModelIndex index)
{
QModelIndex local = mapFromSource(index);

View file

@ -19,10 +19,10 @@ public:
void resetModel(DiveTripModelBase::Layout layout);
void clear();
signals:
void selectionChanged(const QVector<QModelIndex> &indexes);
void selectionChanged(const QVector<QModelIndex> &indices);
void currentDiveChanged(QModelIndex index);
private slots:
void selectionChangedSlot(const QVector<QModelIndex> &indexes);
void selectionChangedSlot(const QVector<QModelIndex> &indices);
void currentDiveChangedSlot(QModelIndex index);
private:
MultiFilterSortModel(QObject *parent = 0);

View file

@ -94,7 +94,7 @@ MobileListModel::MobileListModel(DiveTripModelBase *source) : MobileListModelBas
}
// We want to show the newest dives first. Therefore, we have to invert
// the indexes with respect to the source model. To avoid mental gymnastics
// the indices with respect to the source model. To avoid mental gymnastics
// in the rest of the code, we do this right before sending to the
// source model and just after recieving from the source model, respectively.
QModelIndex MobileListModel::sourceIndex(int row, int col, int parentRow) const

View file

@ -136,7 +136,7 @@ private:
mutable QModelIndex cacheSourceParent;
mutable int cacheSourceRow = -1;
// Translate indexes from/to source
// Translate indices from/to source
int topLevelRowCountInSource(int sourceRow) const;
QModelIndex mapToSource(const QModelIndex &index) const;
int mapTopLevelFromSource(int row) const;