mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: implement undo of air and water temperature editing
Mostly trivial. Since now on editing the field is re-set, the validation function becomes unnecessary. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
a12adf8e2a
commit
de579c1a1a
6 changed files with 90 additions and 47 deletions
|
@ -145,7 +145,7 @@ DiveField EditRating::fieldId() const
|
|||
return DiveField::RATING;
|
||||
}
|
||||
|
||||
// ***** Visibility ****
|
||||
// ***** Visibility *****
|
||||
void EditVisibility::set(struct dive *d, int value) const
|
||||
{
|
||||
d->visibility = value;
|
||||
|
@ -166,6 +166,48 @@ DiveField EditVisibility::fieldId() const
|
|||
return DiveField::VISIBILITY;
|
||||
}
|
||||
|
||||
// ***** Air Temperature *****
|
||||
void EditAirTemp::set(struct dive *d, int value) const
|
||||
{
|
||||
d->airtemp.mkelvin = value > 0 ? (uint32_t)value : 0u;
|
||||
}
|
||||
|
||||
int EditAirTemp::data(struct dive *d) const
|
||||
{
|
||||
return (int)d->airtemp.mkelvin;
|
||||
}
|
||||
|
||||
QString EditAirTemp::fieldName() const
|
||||
{
|
||||
return tr("air temperature");
|
||||
}
|
||||
|
||||
DiveField EditAirTemp::fieldId() const
|
||||
{
|
||||
return DiveField::AIR_TEMP;
|
||||
}
|
||||
|
||||
// ***** Water Temperature *****
|
||||
void EditWaterTemp::set(struct dive *d, int value) const
|
||||
{
|
||||
d->watertemp.mkelvin = value > 0 ? (uint32_t)value : 0u;
|
||||
}
|
||||
|
||||
int EditWaterTemp::data(struct dive *d) const
|
||||
{
|
||||
return (int)d->watertemp.mkelvin;
|
||||
}
|
||||
|
||||
QString EditWaterTemp::fieldName() const
|
||||
{
|
||||
return tr("water temperature");
|
||||
}
|
||||
|
||||
DiveField EditWaterTemp::fieldId() const
|
||||
{
|
||||
return DiveField::WATER_TEMP;
|
||||
}
|
||||
|
||||
// ***** Mode *****
|
||||
// Editing the dive mode has very peculiar semantics for historic reasons:
|
||||
// Since the dive-mode depends on the dive computer, the i-th dive computer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue