diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-08-13 17:22:15 +0200 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2019-09-14 13:20:59 +0200 |
commit | a4f3580e10388a1aecfd10a3a70eaf10efe06640 (patch) | |
tree | 785a31577e77b1e7a34921c300ce5e1571184d29 | |
parent | feb11f6f5f8c22bec4e06b507e33c4169403d498 (diff) | |
download | subsurface-a4f3580e10388a1aecfd10a3a70eaf10efe06640.tar.gz |
Mobile: remove dive argument from DiveListModel::insertDive()
Since DiveListModel does not keep its own list of dives anymore,
insertDive() doesn't use the DiveObjectHelper argument. Remove it.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 4 | ||||
-rw-r--r-- | qt-models/divelistmodel.cpp | 6 | ||||
-rw-r--r-- | qt-models/divelistmodel.h | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index bb29a63bc..369c6d14d 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1212,7 +1212,7 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q if (newIdx != oldIdx) { DiveListModel::instance()->removeDive(modelIdx); modelIdx += (newIdx - oldIdx); - DiveListModel::instance()->insertDive(modelIdx, &myDive); + DiveListModel::instance()->insertDive(modelIdx); diveChanged = true; // because we already modified things } } @@ -1363,7 +1363,7 @@ bool QMLManager::undoDelete(int id) add_dive_to_trip(deletedDive, trip); } record_dive(deletedDive); - DiveListModel::instance()->insertDive(get_idx_by_uniq_id(deletedDive->id), nullptr); + DiveListModel::instance()->insertDive(get_idx_by_uniq_id(deletedDive->id)); changesNeedSaving(); deletedDive = NULL; deletedTrip = NULL; diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index ef384f4cd..0fe17627e 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -136,7 +136,7 @@ DiveListModel::DiveListModel(QObject *parent) : QAbstractListModel(parent) m_instance = this; } -void DiveListModel::insertDive(int i, DiveObjectHelper *) +void DiveListModel::insertDive(int i) { beginInsertRows(QModelIndex(), i, i); endInsertRows(); @@ -163,7 +163,7 @@ void DiveListModel::updateDive(int i, dive *d) // we need to make sure that QML knows that this dive has changed - // the only reliable way I've found is to remove and re-insert it removeDive(i); - insertDive(i, nullptr); // TODO: DiveObjectHelper not needed anymore - remove second argument + insertDive(i); } void DiveListModel::reload() @@ -254,7 +254,7 @@ QString DiveListModel::startAddDive() d->number = nr; d->dc.model = strdup("manually added dive"); append_dive(d); - insertDive(get_idx_by_uniq_id(d->id), new DiveObjectHelper(d)); + insertDive(get_idx_by_uniq_id(d->id)); return QString::number(d->id); } diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h index e08479a21..cb7c902b3 100644 --- a/qt-models/divelistmodel.h +++ b/qt-models/divelistmodel.h @@ -50,7 +50,7 @@ public: DiveListModel(QObject *parent = 0); void addDive(const QList<dive *> &listOfDives); void addAllDives(); - void insertDive(int i, DiveObjectHelper *newDive); + void insertDive(int i); void removeDive(int i); void removeDiveById(int id); void updateDive(int i, dive *d); |