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

@ -7,7 +7,7 @@
# - 2015-01-14: Initial release # - 2015-01-14: Initial release
# #
# Known bugs: # Known bugs:
# - Some list item indexes are lost during PO to ASCII conversion (see asciidoc warning messages) # - Some list item indices are lost during PO to ASCII conversion (see asciidoc warning messages)
# #
# Package deps: - po4a (for po4a-translate) # Package deps: - po4a (for po4a-translate)
# - git (for git sync) # - git (for git sync)

View file

@ -1041,18 +1041,18 @@ EditWeightBase::EditWeightBase(int index, bool currentDiveOnly) :
// For that purpose, we will determine the indices of the same weightsystem. // For that purpose, we will determine the indices of the same weightsystem.
std::vector<dive *> divesNew; std::vector<dive *> divesNew;
divesNew.reserve(dives.size()); divesNew.reserve(dives.size());
indexes.reserve(dives.size()); indices.reserve(dives.size());
for (dive *d: dives) { for (dive *d: dives) {
if (d == current) { if (d == current) {
divesNew.push_back(d); divesNew.push_back(d);
indexes.push_back(index); indices.push_back(index);
continue; continue;
} }
int idx = find_weightsystem_index(d, ws); int idx = find_weightsystem_index(d, ws);
if (idx >= 0) { if (idx >= 0) {
divesNew.push_back(d); divesNew.push_back(d);
indexes.push_back(idx); indices.push_back(idx);
} }
} }
dives = std::move(divesNew); dives = std::move(divesNew);
@ -1081,16 +1081,16 @@ RemoveWeight::RemoveWeight(int index, bool currentDiveOnly) :
void RemoveWeight::undo() void RemoveWeight::undo()
{ {
for (size_t i = 0; i < dives.size(); ++i) { for (size_t i = 0; i < dives.size(); ++i) {
add_to_weightsystem_table(&dives[i]->weightsystems, indexes[i], clone_weightsystem(ws)); add_to_weightsystem_table(&dives[i]->weightsystems, indices[i], clone_weightsystem(ws));
emit diveListNotifier.weightAdded(dives[i], indexes[i]); emit diveListNotifier.weightAdded(dives[i], indices[i]);
} }
} }
void RemoveWeight::redo() void RemoveWeight::redo()
{ {
for (size_t i = 0; i < dives.size(); ++i) { for (size_t i = 0; i < dives.size(); ++i) {
remove_weightsystem(dives[i], indexes[i]); remove_weightsystem(dives[i], indices[i]);
emit diveListNotifier.weightRemoved(dives[i], indexes[i]); emit diveListNotifier.weightRemoved(dives[i], indices[i]);
} }
} }
@ -1138,8 +1138,8 @@ EditWeight::~EditWeight()
void EditWeight::redo() void EditWeight::redo()
{ {
for (size_t i = 0; i < dives.size(); ++i) { for (size_t i = 0; i < dives.size(); ++i) {
set_weightsystem(dives[i], indexes[i], new_ws); set_weightsystem(dives[i], indices[i], new_ws);
emit diveListNotifier.weightEdited(dives[i], indexes[i]); emit diveListNotifier.weightEdited(dives[i], indices[i]);
} }
std::swap(ws, new_ws); std::swap(ws, new_ws);
} }

View file

@ -353,7 +353,7 @@ protected:
~EditWeightBase(); ~EditWeightBase();
weightsystem_t ws; weightsystem_t ws;
std::vector<int> indexes; // An index for each dive in the dives vector. std::vector<int> indices; // An index for each dive in the dives vector.
bool workToBeDone() override; bool workToBeDone() override;
}; };

View file

@ -43,10 +43,10 @@ const char *divemode_text[] = {"OC", "CCR", "PSCR", "Freedive"};
* We try to keep the same sensor index for the same sensor, so that even * We try to keep the same sensor index for the same sensor, so that even
* if the dive computer doesn't give pressure information for every sample, * if the dive computer doesn't give pressure information for every sample,
* we don't move pressure information around between the different sensor * we don't move pressure information around between the different sensor
* indexes. * indices.
* *
* The "prepare_sample()" function will always copy the sensor indices * The "prepare_sample()" function will always copy the sensor indices
* from the previous sample, so the indexes are pre-populated (but the * from the previous sample, so the indices are pre-populated (but the
* pressures obviously are not) * pressures obviously are not)
*/ */
void add_sample_pressure(struct sample *sample, int sensor, int mbar) void add_sample_pressure(struct sample *sample, int sensor, int mbar)
@ -83,7 +83,7 @@ void add_sample_pressure(struct sample *sample, int sensor, int mbar)
* "o2pressure" that is fixed to the Oxygen sensor for a CCR dive. * "o2pressure" that is fixed to the Oxygen sensor for a CCR dive.
* *
* For more complex pressure data, we have to use explicit * For more complex pressure data, we have to use explicit
* cylinder indexes for each sample. * cylinder indices for each sample.
* *
* This function returns a negative number for "no legacy mode", * This function returns a negative number for "no legacy mode",
* or a non-negative number that indicates the o2 sensor index. * or a non-negative number that indicates the o2 sensor index.
@ -2049,11 +2049,11 @@ static void dc_cylinder_renumber(struct dive *dive, struct divecomputer *dc, con
int i; int i;
struct event *ev; struct event *ev;
/* Remap or delete the sensor indexes */ /* Remap or delete the sensor indices */
for (i = 0; i < dc->samples; i++) for (i = 0; i < dc->samples; i++)
sample_renumber(dc->sample + i, i, mapping); sample_renumber(dc->sample + i, i, mapping);
/* Remap the gas change indexes */ /* Remap the gas change indices */
for (ev = dc->events; ev; ev = ev->next) for (ev = dc->events; ev; ev = ev->next)
event_renumber(ev, mapping); event_renumber(ev, mapping);
@ -2063,8 +2063,8 @@ static void dc_cylinder_renumber(struct dive *dive, struct divecomputer *dc, con
} }
/* /*
* If the cylinder indexes change (due to merging dives or deleting * If the cylinder indices change (due to merging dives or deleting
* cylinders in the middle), we need to change the indexes in the * cylinders in the middle), we need to change the indices in the
* dive computer data for this dive. * dive computer data for this dive.
* *
* Also note that we assume that the initial cylinder is cylinder 0, * Also note that we assume that the initial cylinder is cylinder 0,

View file

@ -217,7 +217,7 @@ static void analyze_plot_info_minmax(struct plot_info *pi, int entry_index)
p--; p--;
} }
// indexes to the min/max entries // indices to the min/max entries
min = max = entry_index; min = max = entry_index;
/* Then go forward until we hit an entry past the time */ /* Then go forward until we hit an entry past the time */
@ -314,7 +314,7 @@ struct plot_info *analyze_plot_info(struct plot_info *pi)
* we return that. If it doesn't, we return the best * we return that. If it doesn't, we return the best
* match based on the gasmix. * match based on the gasmix.
* *
* Some dive computers give cylinder indexes, some * Some dive computers give cylinder indices, some
* give just the gas mix. * give just the gas mix.
*/ */
int get_cylinder_index(const struct dive *dive, const struct event *ev) int get_cylinder_index(const struct dive *dive, const struct event *ev)

View file

@ -408,7 +408,7 @@ static void save_samples(struct membuffer *b, struct dive *dive, struct divecomp
struct sample *s; struct sample *s;
struct sample dummy = { .bearing.degrees = -1, .ndl.seconds = -1 }; struct sample dummy = { .bearing.degrees = -1, .ndl.seconds = -1 };
/* Set up default pressure sensor indexes */ /* Set up default pressure sensor indices */
o2sensor = legacy_format_o2pressures(dive, dc); o2sensor = legacy_format_o2pressures(dive, dc);
if (o2sensor >= 0) { if (o2sensor >= 0) {
dummy.sensor[0] = !o2sensor; dummy.sensor[0] = !o2sensor;

View file

@ -199,11 +199,11 @@ void DiveListView::reset()
} }
// If items were selected, inform the selection model // If items were selected, inform the selection model
void DiveListView::diveSelectionChanged(const QVector<QModelIndex> &indexes) void DiveListView::diveSelectionChanged(const QVector<QModelIndex> &indices)
{ {
clearSelection(); clearSelection();
QItemSelectionModel *s = selectionModel(); QItemSelectionModel *s = selectionModel();
for (const QModelIndex &index: indexes) { for (const QModelIndex &index: indices) {
s->select(index, QItemSelectionModel::Rows | QItemSelectionModel::Select); s->select(index, QItemSelectionModel::Rows | QItemSelectionModel::Select);
// If an item of a not-yet expanded trip is selected, expand the trip. // If an item of a not-yet expanded trip is selected, expand the trip.
@ -420,7 +420,7 @@ void DiveListView::sortIndicatorChanged(int i, Qt::SortOrder order)
if (currentLayout == newLayout) { if (currentLayout == newLayout) {
sortByColumn(i, order); sortByColumn(i, order);
} else { } else {
// clear the model, repopulate with new indexes. // clear the model, repopulate with new indices.
std::vector<int> expandedRows; std::vector<int> expandedRows;
if(currentLayout == DiveTripModelBase::TREE) if(currentLayout == DiveTripModelBase::TREE)
expandedRows = backupExpandedRows(); expandedRows = backupExpandedRows();

View file

@ -60,7 +60,7 @@ slots:
void shiftTimes(); void shiftTimes();
void loadImages(); void loadImages();
void loadWebImages(); void loadWebImages();
void diveSelectionChanged(const QVector<QModelIndex> &indexes); void diveSelectionChanged(const QVector<QModelIndex> &indices);
void currentDiveChanged(QModelIndex index); void currentDiveChanged(QModelIndex index);
void tripChanged(dive_trip *trip, TripField); void tripChanged(dive_trip *trip, TripField);
private: private:

View file

@ -362,7 +362,7 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList fn, QWidget *parent) : QDia
hw = ""; hw = "";
txtLog = false; txtLog = false;
/* Add indexes of XSLTs requiring special handling to the list */ /* Add indices of XSLTs requiring special handling to the list */
specialCSV << SENSUS; specialCSV << SENSUS;
specialCSV << SUBSURFACE; specialCSV << SUBSURFACE;
specialCSV << DL7; specialCSV << DL7;

View file

@ -69,11 +69,11 @@ QVector<QString> TabDivePhotos::getSelectedFilenames() const
QVector<QString> selectedPhotos; QVector<QString> selectedPhotos;
if (!ui->photosView->selectionModel()->hasSelection()) if (!ui->photosView->selectionModel()->hasSelection())
return selectedPhotos; return selectedPhotos;
QModelIndexList indexes = ui->photosView->selectionModel()->selectedRows(); QModelIndexList indices = ui->photosView->selectionModel()->selectedRows();
if (indexes.count() == 0) if (indices.count() == 0)
indexes = ui->photosView->selectionModel()->selectedIndexes(); indices = ui->photosView->selectionModel()->selectedIndexes();
selectedPhotos.reserve(indexes.count()); selectedPhotos.reserve(indices.count());
for (const auto &photo: indexes) { for (const auto &photo: indices) {
if (photo.isValid()) { if (photo.isValid()) {
QString fileUrl = photo.data(Qt::DisplayPropertyRole).toString(); QString fileUrl = photo.data(Qt::DisplayPropertyRole).toString();
if (!fileUrl.isEmpty()) if (!fileUrl.isEmpty())
@ -114,11 +114,11 @@ void TabDivePhotos::saveSubtitles()
QVector<QString> selectedPhotos; QVector<QString> selectedPhotos;
if (!ui->photosView->selectionModel()->hasSelection()) if (!ui->photosView->selectionModel()->hasSelection())
return; return;
QModelIndexList indexes = ui->photosView->selectionModel()->selectedRows(); QModelIndexList indices = ui->photosView->selectionModel()->selectedRows();
if (indexes.count() == 0) if (indices.count() == 0)
indexes = ui->photosView->selectionModel()->selectedIndexes(); indices = ui->photosView->selectionModel()->selectedIndexes();
selectedPhotos.reserve(indexes.count()); selectedPhotos.reserve(indices.count());
for (const auto &photo: indexes) { for (const auto &photo: indices) {
if (photo.isValid()) { if (photo.isValid()) {
QString fileUrl = photo.data(Qt::DisplayPropertyRole).toString(); QString fileUrl = photo.data(Qt::DisplayPropertyRole).toString();
if (!fileUrl.isEmpty()) { if (!fileUrl.isEmpty()) {

View file

@ -107,10 +107,10 @@ void TabDiveSite::on_filterText_textChanged(const QString &text)
QVector<dive_site *> TabDiveSite::selectedDiveSites() QVector<dive_site *> TabDiveSite::selectedDiveSites()
{ {
const QModelIndexList indexes = ui.diveSites->view()->selectionModel()->selectedRows(); const QModelIndexList indices = ui.diveSites->view()->selectionModel()->selectedRows();
QVector<dive_site *> sites; QVector<dive_site *> sites;
sites.reserve(indexes.size()); sites.reserve(indices.size());
for (const QModelIndex &idx: indexes) { for (const QModelIndex &idx: indices) {
struct dive_site *ds = model.getDiveSite(idx); struct dive_site *ds = model.getDiveSite(idx);
sites.append(ds); sites.append(ds);
} }

View file

@ -178,7 +178,7 @@ void MapWidgetHelper::selectVisibleLocations()
QMetaObject::invokeMethod(m_map, "fromCoordinate", Q_RETURN_ARG(QPointF, point), QMetaObject::invokeMethod(m_map, "fromCoordinate", Q_RETURN_ARG(QPointF, point),
Q_ARG(QGeoCoordinate, dsCoord)); Q_ARG(QGeoCoordinate, dsCoord));
if (!qIsNaN(point.x())) if (!qIsNaN(point.x()))
#ifndef SUBSURFACE_MOBILE // indexes on desktop #ifndef SUBSURFACE_MOBILE // indices on desktop
selectedDiveIds.append(idx); selectedDiveIds.append(idx);
} }
#else // use id on mobile instead of index #else // use id on mobile instead of index

View file

@ -2123,7 +2123,7 @@ void QMLManager::setFilter(const QString filterText, int index)
QString f = filterText.trimmed(); QString f = filterText.trimmed();
FilterData data; FilterData data;
if (!f.isEmpty()) { if (!f.isEmpty()) {
// This is ugly - the indexes of the mode are hardcoded! // This is ugly - the indices of the mode are hardcoded!
switch(index) { switch(index) {
default: default:
case 0: data.mode = FilterData::Mode::FULLTEXT; break; case 0: data.mode = FilterData::Mode::FULLTEXT; break;

View file

@ -2036,14 +2036,14 @@ void ProfileWidget2::keyDeleteAction()
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance(); DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
int selCount = scene()->selectedItems().count(); int selCount = scene()->selectedItems().count();
if (selCount) { if (selCount) {
QVector<int> selectedIndexes; QVector<int> selectedIndices;
Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
selectedIndexes.push_back(handles.indexOf(handler)); selectedIndices.push_back(handles.indexOf(handler));
handler->hide(); handler->hide();
} }
} }
plannerModel->removeSelectedPoints(selectedIndexes); plannerModel->removeSelectedPoints(selectedIndices);
} }
} }

View file

@ -512,7 +512,7 @@ void CylindersModel::remove(QModelIndex index)
changed = true; changed = true;
endRemoveRows(); endRemoveRows();
// Create a mapping of cylinder indexes: // Create a mapping of cylinder indices:
// 1) Fill mapping[0]..mapping[index-1] with 0..index // 1) Fill mapping[0]..mapping[index-1] with 0..index
// 2) Set mapping[index] to -1 // 2) Set mapping[index] to -1
// 3) Fill mapping[index+1]..mapping[end] with index.. // 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, i + 1), get_cylinder(&displayed_dive, i), sizeof(temp_cyl));
memmove(get_cylinder(&displayed_dive, 0), &temp_cyl, 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 // 1) Fill mapping[0]..mapping[cyl] with 0..index
// 2) Set mapping[cyl] to 0 // 2) Set mapping[cyl] to 0
// 3) Fill mapping[cyl+1]..mapping[end] with cyl.. // 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_table(&diveTable, &dives);
move_dive_site_table(&sitesTable, &sites); move_dive_site_table(&sitesTable, &sites);
// Reset indexes // Reset indices
checkStates.clear(); checkStates.clear();
endResetModel(); endResetModel();

View file

@ -18,7 +18,7 @@ public:
int rowCount(const QModelIndex& index = QModelIndex()) const; int rowCount(const QModelIndex& index = QModelIndex()) const;
QVariant data(const QModelIndex& index, int role) const; QVariant data(const QModelIndex& index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, 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; Qt::ItemFlags flags(const QModelIndex &index) const;
Q_INVOKABLE void clearTable(); Q_INVOKABLE void clearTable();
QHash<int, QByteArray> roleNames() const; 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 // 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. // emit a signal, so that views can change the selection.
QVector<QModelIndex> indexes; QVector<QModelIndex> indices;
indexes.reserve(dives.count()); indices.reserve(dives.count());
processByTrip(dives, [this, &indexes] (dive_trip *trip, const QVector<dive *> &divesInTrip) processByTrip(dives, [this, &indices] (dive_trip *trip, const QVector<dive *> &divesInTrip)
{ divesSelectedTrip(trip, divesInTrip, indexes); }); { 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. // The current dive has changed. Transform the current dive into an index and pass it on to the view.
currentChanged(); 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) { if (!trip) {
// This is at the top level. // This is at the top level.
@ -1436,7 +1436,7 @@ void DiveTripModelTree::divesSelectedTrip(dive_trip *trip, const QVector<dive *>
++j; ++j;
if (j >= (int)items.size()) if (j >= (int)items.size())
break; break;
indexes.append(createIndex(j, 0, noParent)); indices.append(createIndex(j, 0, noParent));
} }
} else { } else {
// Find the trip. // Find the trip.
@ -1457,7 +1457,7 @@ void DiveTripModelTree::divesSelectedTrip(dive_trip *trip, const QVector<dive *>
++j; ++j;
if (j >= (int)entry.dives.size()) if (j >= (int)entry.dives.size())
break; 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 // 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. // emit a signal, so that views can change the selection.
QVector<QModelIndex> indexes; QVector<QModelIndex> indices;
indexes.reserve(dives.count()); indices.reserve(dives.count());
// Since both lists are sorted, we can do this linearly. Perhaps a binary search // Since both lists are sorted, we can do this linearly. Perhaps a binary search
// would be better? // would be better?
@ -1683,10 +1683,10 @@ void DiveTripModelList::divesSelected(const QVector<dive *> &divesIn, dive *curr
++j; ++j;
if (j >= (int)items.size()) if (j >= (int)items.size())
break; 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. // The current dive has changed. Transform the current dive into an index and pass it on to the view.
currentChanged(); currentChanged();

View file

@ -83,9 +83,9 @@ signals:
// Commands/DiveListNotifier ---(dive */dive_trip *)---> DiveTripModel ---(QModelIndex)---> DiveListView // 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 // 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 // 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. // perform the appropriate actions.
void selectionChanged(const QVector<QModelIndex> &indexes); void selectionChanged(const QVector<QModelIndex> &indices);
void currentDiveChanged(QModelIndex index); void currentDiveChanged(QModelIndex index);
protected: protected:
dive *oldCurrent; dive *oldCurrent;

View file

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

View file

@ -19,10 +19,10 @@ public:
void resetModel(DiveTripModelBase::Layout layout); void resetModel(DiveTripModelBase::Layout layout);
void clear(); void clear();
signals: signals:
void selectionChanged(const QVector<QModelIndex> &indexes); void selectionChanged(const QVector<QModelIndex> &indices);
void currentDiveChanged(QModelIndex index); void currentDiveChanged(QModelIndex index);
private slots: private slots:
void selectionChangedSlot(const QVector<QModelIndex> &indexes); void selectionChangedSlot(const QVector<QModelIndex> &indices);
void currentDiveChangedSlot(QModelIndex index); void currentDiveChangedSlot(QModelIndex index);
private: private:
MultiFilterSortModel(QObject *parent = 0); 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 // 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 // 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. // source model and just after recieving from the source model, respectively.
QModelIndex MobileListModel::sourceIndex(int row, int col, int parentRow) const QModelIndex MobileListModel::sourceIndex(int row, int col, int parentRow) const

View file

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

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* /*
* An .slg file is composed of a main table (Dives), a bunch of tables directly * An .slg file is composed of a main table (Dives), a bunch of tables directly
* linked to Dives by their indexes (Site, Suit, Tank, etc) and another group of * linked to Dives by their indices (Site, Suit, Tank, etc) and another group of
* independent tables (Activity, Type, Gear, Fish ...) which connect with the dives * independent tables (Activity, Type, Gear, Fish ...) which connect with the dives
* via a related group of tables (ActivityRelation, TypeRelation ...) that contain * via a related group of tables (ActivityRelation, TypeRelation ...) that contain
* just the dive index number and the related table index number. * just the dive index number and the related table index number.

View file

@ -357,7 +357,7 @@ int TestParse::parseCSVmanual(int units, std::string file)
params[pnr++] = intdup(21); params[pnr++] = intdup(21);
params[pnr++] = strdup("tagsField"); params[pnr++] = strdup("tagsField");
params[pnr++] = intdup(22); params[pnr++] = intdup(22);
// Numbers are indexes of possible options // Numbers are indices of possible options
params[pnr++] = strdup("separatorIndex"); params[pnr++] = strdup("separatorIndex");
params[pnr++] = intdup(0); params[pnr++] = intdup(0);
params[pnr++] = strdup("datefmt"); params[pnr++] = strdup("datefmt");
@ -410,7 +410,7 @@ int TestParse::parseCSVprofile(int units, std::string file)
params[pnr++] = intdup(5); params[pnr++] = intdup(5);
params[pnr++] = strdup("pressureField"); params[pnr++] = strdup("pressureField");
params[pnr++] = intdup(6); params[pnr++] = intdup(6);
// Numbers are indexes of possible options // Numbers are indices of possible options
params[pnr++] = strdup("datefmt"); params[pnr++] = strdup("datefmt");
params[pnr++] = intdup(2); params[pnr++] = intdup(2);
params[pnr++] = strdup("units"); params[pnr++] = strdup("units");

View file

@ -1,9 +1,9 @@
var itemsToShow = new Array(); //list of indexes to all dives to view var itemsToShow = new Array(); //list of indices to all dives to view
var items = new Array(); var items = new Array();
var start; //index of first element viewed in itemsToShow var start; //index of first element viewed in itemsToShow
var sizeofpage; //size of viewed page var sizeofpage; //size of viewed page
var numberofwords = 0; //just for stats var numberofwords = 0; //just for stats
var olditemstoshow; //to reference the indexes to all dives if changed var olditemstoshow; //to reference the indices to all dives if changed
////////////////////////////////// //////////////////////////////////
// // // //
// View Model // // View Model //
@ -40,8 +40,8 @@ function viewInPage()
} }
/** /**
*addHTML this Method puts the HTML of items of given indexes *addHTML this Method puts the HTML of items of given indices
*@param {array} indexes array of indexes to put in HTML *@param {array} indices array of indices to put in HTML
*/ */
function updateView(start, end) function updateView(start, end)
{ {
@ -56,17 +56,17 @@ function updateView(start, end)
} }
/** /**
*addHTML this Method puts the HTML of items of given indexes *addHTML this Method puts the HTML of items of given indices
*@param {array} indexes array of indexes to put in HTML *@param {array} indices array of indices to put in HTML
*/ */
function addHTML(indexes) function addHTML(indices)
{ {
var divelist = document.getElementById('diveslist'); var divelist = document.getElementById('diveslist');
divelist.innerHTML = ""; divelist.innerHTML = "";
for (var i = 0; i < indexes.length; i++) { for (var i = 0; i < indices.length; i++) {
divelist.innerHTML += '<ul id="' + indexes[i] + '" onclick="toggleExpansion(event, this)"></ul>'; divelist.innerHTML += '<ul id="' + indices[i] + '" onclick="toggleExpansion(event, this)"></ul>';
expand(document.getElementById(indexes[i])); expand(document.getElementById(indices[i]));
itemsToShow[indexes[i]].expanded = true; itemsToShow[indices[i]].expanded = true;
}; };
} }