mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: read and write the user-specified salinity
Both XML and git storage are added. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ebabbfb457
commit
d2cf58e07e
10 changed files with 62 additions and 18 deletions
|
@ -218,6 +218,11 @@ int editAtmPress(int newValue, bool currentDiveOnly)
|
|||
return execute_edit(new EditAtmPress(newValue, currentDiveOnly));
|
||||
}
|
||||
|
||||
int editWaterTypeUser(int newValue, bool currentDiveOnly)
|
||||
{
|
||||
return execute_edit(new EditWaterTypeUser(newValue, currentDiveOnly));
|
||||
}
|
||||
|
||||
int editDepth(int newValue, bool currentDiveOnly)
|
||||
{
|
||||
return execute_edit(new EditDepth(newValue, currentDiveOnly));
|
||||
|
|
|
@ -71,6 +71,7 @@ int editChill(int newValue, bool currentDiveOnly);
|
|||
int editAirTemp(int newValue, bool currentDiveOnly);
|
||||
int editWaterTemp(int newValue, bool currentDiveOnly);
|
||||
int editAtmPress(int newValue, bool currentDiveOnly);
|
||||
int editWaterTypeUser(int newValue, bool currentDiveOnly);
|
||||
int editDepth(int newValue, bool currentDiveOnly);
|
||||
int editDuration(int newValue, bool currentDiveOnly);
|
||||
int editDiveSite(struct dive_site *newValue, bool currentDiveOnly);
|
||||
|
|
|
@ -355,6 +355,27 @@ DiveField EditWaterTemp::fieldId() const
|
|||
return DiveField::WATER_TEMP;
|
||||
}
|
||||
|
||||
// ***** Water Type *****
|
||||
void EditWaterTypeUser::set(struct dive *d, int value) const
|
||||
{
|
||||
d->user_salinity = value > 0 ? value : 0;
|
||||
}
|
||||
|
||||
int EditWaterTypeUser::data(struct dive *d) const
|
||||
{
|
||||
return d->user_salinity;
|
||||
}
|
||||
|
||||
QString EditWaterTypeUser::fieldName() const
|
||||
{
|
||||
return tr("salinity");
|
||||
}
|
||||
|
||||
DiveField EditWaterTypeUser::fieldId() const
|
||||
{
|
||||
return DiveField::SALINITY;
|
||||
}
|
||||
|
||||
// ***** Atmospheric pressure *****
|
||||
void EditAtmPress::set(struct dive *d, int value) const
|
||||
{
|
||||
|
|
|
@ -161,6 +161,15 @@ public:
|
|||
DiveField fieldId() const override;
|
||||
};
|
||||
|
||||
class EditWaterTypeUser : public EditBase<int> {
|
||||
public:
|
||||
using EditBase<int>::EditBase; // Use constructor of base class.
|
||||
void set(struct dive *d, int value) const override;
|
||||
int data(struct dive *d) const override;
|
||||
QString fieldName() const override;
|
||||
DiveField fieldId() const override;
|
||||
};
|
||||
|
||||
class EditDuration : public EditBase<int> {
|
||||
public:
|
||||
using EditBase<int>::EditBase; // Use constructor of base class.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue