mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: fix recreation of profile after dive edit
We only need to deal with this if the dive changed. And in that case, if we calculate a new fake DC, we need to clear out the meandepth as otherwise the algorithm will try to match both max and mean depth. Since the user potentially changed the max depth that could have very odd consequences. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
97d6a1e779
commit
5fc16910c2
1 changed files with 13 additions and 10 deletions
|
@ -545,17 +545,20 @@ QString QMLManager::commitChanges(QString diveId, QString date, QString location
|
|||
diveChanged = false; // because we already modified things
|
||||
}
|
||||
}
|
||||
if (d->maxdepth.mm == d->dc.maxdepth.mm &&
|
||||
d->maxdepth.mm > 0 &&
|
||||
same_string(d->dc.model, "manually added dive") &&
|
||||
d->dc.samples == 0) {
|
||||
// so we have depth > 0, a manually added dive and no samples
|
||||
// let's create an actual profile so the desktop version can work it
|
||||
d->dc = *fake_dc(&d->dc);
|
||||
}
|
||||
if (diveChanged)
|
||||
if (diveChanged) {
|
||||
if (d->maxdepth.mm == d->dc.maxdepth.mm &&
|
||||
d->maxdepth.mm > 0 &&
|
||||
same_string(d->dc.model, "manually added dive") &&
|
||||
d->dc.samples == 0) {
|
||||
// so we have depth > 0, a manually added dive and no samples
|
||||
// let's create an actual profile so the desktop version can work it
|
||||
// first clear out the mean depth (or the fake_dc() function tries
|
||||
// to be too clever
|
||||
d->meandepth.mm = d->dc.meandepth.mm = 0;
|
||||
d->dc = *fake_dc(&d->dc);
|
||||
}
|
||||
DiveListModel::instance()->updateDive(oldIdx, d);
|
||||
|
||||
}
|
||||
if (diveChanged || needResort) {
|
||||
mark_divelist_changed(true);
|
||||
// this is called "commit" for a reason - when the user saves an
|
||||
|
|
Loading…
Add table
Reference in a new issue