summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/simplewidgets.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-07-30 15:55:29 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-11 16:22:27 -0700
commit96d87273995a6af35d90efb1190ff653e4c03d02 (patch)
treef115a9ccd821cab753f2863fa86f9f08cd20bbd4 /desktop-widgets/simplewidgets.cpp
parent26901a8dbd91a18689199361541f9d1f90d56e4e (diff)
downloadsubsurface-96d87273995a6af35d90efb1190ff653e4c03d02.tar.gz
Undo: use dive * instead of unique index in renumber-dives
Now, that pointers to dives are stable, we might just as well use dive * instead of the unique-id. This also affects the merge-dive command, as this uses the same renumbering machinery. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/simplewidgets.cpp')
-rw-r--r--desktop-widgets/simplewidgets.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp
index 1df69e7bb..6d15da475 100644
--- a/desktop-widgets/simplewidgets.cpp
+++ b/desktop-widgets/simplewidgets.cpp
@@ -161,14 +161,14 @@ void RenumberDialog::buttonClicked(QAbstractButton *button)
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
MainWindow::instance()->dive_list()->rememberSelection();
// we remember a list from dive uuid to a new number
- QVector<QPair<int, int>> renumberedDives;
+ QVector<QPair<dive *, int>> renumberedDives;
int i;
int newNr = ui.spinBox->value();
- struct dive *dive = NULL;
- for_each_dive (i, dive) {
- if (!selectedOnly || dive->selected) {
- invalidate_dive_cache(dive);
- renumberedDives.append(QPair<int, int>(dive->id, newNr++));
+ struct dive *d;
+ for_each_dive (i, d) {
+ if (!selectedOnly || d->selected) {
+ invalidate_dive_cache(d);
+ renumberedDives.append({ d, newNr++ });
}
}
Command::renumberDives(renumberedDives);