mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:13:23 +00:00
Don't always clear the dive before selectively copying
This will be needed when pasting the data back into a (set of) dive(s). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3766f57392
commit
4a7432e3d5
3 changed files with 6 additions and 4 deletions
6
dive.c
6
dive.c
|
@ -426,9 +426,10 @@ struct dive *clone_dive(struct dive *s)
|
||||||
d->_component = copy_string(s->_component)
|
d->_component = copy_string(s->_component)
|
||||||
|
|
||||||
// copy elements, depending on bits in what that are set
|
// copy elements, depending on bits in what that are set
|
||||||
void selective_copy_dive(struct dive *s, struct dive *d, struct dive_components what)
|
void selective_copy_dive(struct dive *s, struct dive *d, struct dive_components what, bool clear)
|
||||||
{
|
{
|
||||||
clear_dive(d);
|
if (clear)
|
||||||
|
clear_dive(d);
|
||||||
CONDITIONAL_COPY_STRING(location);
|
CONDITIONAL_COPY_STRING(location);
|
||||||
CONDITIONAL_COPY_STRING(notes);
|
CONDITIONAL_COPY_STRING(notes);
|
||||||
CONDITIONAL_COPY_STRING(divemaster);
|
CONDITIONAL_COPY_STRING(divemaster);
|
||||||
|
@ -502,6 +503,7 @@ void copy_cylinders(struct dive *s, struct dive *d, bool used_only)
|
||||||
d->cylinder[i].type = s->cylinder[i].type;
|
d->cylinder[i].type = s->cylinder[i].type;
|
||||||
d->cylinder[i].gasmix = s->cylinder[i].gasmix;
|
d->cylinder[i].gasmix = s->cylinder[i].gasmix;
|
||||||
d->cylinder[i].depth = s->cylinder[i].depth;
|
d->cylinder[i].depth = s->cylinder[i].depth;
|
||||||
|
d->cylinder[i].manually_added = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
dive.h
2
dive.h
|
@ -621,7 +621,7 @@ extern struct dive *alloc_dive(void);
|
||||||
extern void record_dive(struct dive *dive);
|
extern void record_dive(struct dive *dive);
|
||||||
extern void clear_dive(struct dive *dive);
|
extern void clear_dive(struct dive *dive);
|
||||||
extern void copy_dive(struct dive *s, struct dive *d);
|
extern void copy_dive(struct dive *s, struct dive *d);
|
||||||
extern void selective_copy_dive(struct dive *s, struct dive *d, struct dive_components what);
|
extern void selective_copy_dive(struct dive *s, struct dive *d, struct dive_components what, bool clear);
|
||||||
extern struct dive *clone_dive(struct dive *s);
|
extern struct dive *clone_dive(struct dive *s);
|
||||||
|
|
||||||
extern struct sample *prepare_sample(struct divecomputer *dc);
|
extern struct sample *prepare_sample(struct divecomputer *dc);
|
||||||
|
|
|
@ -450,6 +450,6 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button)
|
||||||
COMPONENT_FROM_UI(suit);
|
COMPONENT_FROM_UI(suit);
|
||||||
COMPONENT_FROM_UI(cylinders);
|
COMPONENT_FROM_UI(cylinders);
|
||||||
COMPONENT_FROM_UI(weights);
|
COMPONENT_FROM_UI(weights);
|
||||||
selective_copy_dive(&displayed_dive, targetDive, *what);
|
selective_copy_dive(&displayed_dive, targetDive, *what, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue