mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: implement undo of depth and duration editing
This was a bit different from the other editing commands: 1) Only the current dive is edited not all selected dives. Therefore, create a function that turns the current dive into a one-element list. 2) The profile has to be replot. Here, likewise, create a function to do that. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
02d572226d
commit
c82f4487f9
7 changed files with 113 additions and 30 deletions
|
@ -215,6 +215,54 @@ DiveField EditWaterTemp::fieldId() const
|
|||
return DiveField::WATER_TEMP;
|
||||
}
|
||||
|
||||
// ***** Duration *****
|
||||
void EditDuration::set(struct dive *d, int value) const
|
||||
{
|
||||
d->dc.duration.seconds = value;
|
||||
d->duration = d->dc.duration;
|
||||
d->dc.meandepth.mm = 0;
|
||||
d->dc.samples = 0;
|
||||
}
|
||||
|
||||
int EditDuration::data(struct dive *d) const
|
||||
{
|
||||
return d->duration.seconds;
|
||||
}
|
||||
|
||||
QString EditDuration::fieldName() const
|
||||
{
|
||||
return tr("duration");
|
||||
}
|
||||
|
||||
DiveField EditDuration::fieldId() const
|
||||
{
|
||||
return DiveField::DURATION;
|
||||
}
|
||||
|
||||
// ***** Depth *****
|
||||
void EditDepth::set(struct dive *d, int value) const
|
||||
{
|
||||
d->dc.maxdepth.mm = value;
|
||||
d->maxdepth = d->dc.maxdepth;
|
||||
d->dc.meandepth.mm = 0;
|
||||
d->dc.samples = 0;
|
||||
}
|
||||
|
||||
int EditDepth::data(struct dive *d) const
|
||||
{
|
||||
return d->maxdepth.mm;
|
||||
}
|
||||
|
||||
QString EditDepth::fieldName() const
|
||||
{
|
||||
return tr("depth");
|
||||
}
|
||||
|
||||
DiveField EditDepth::fieldId() const
|
||||
{
|
||||
return DiveField::DEPTH;
|
||||
}
|
||||
|
||||
// ***** DiveSite *****
|
||||
void EditDiveSite::set(struct dive *d, struct dive_site *dive_site) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue