[PATCH 2/3] QML UI: add function to get cylinder pressures

Joakim Bygdell j.bygdell at gmail.com
Tue Feb 9 10:26:59 PST 2016


> On 09 Feb 2016, at 19:24, Dirk Hohndel <dirk at hohndel.org> wrote:
> 
> On Tue, Feb 09, 2016 at 06:03:24PM +0100, Joakim Bygdell wrote:
>> Since we only show the first cylinder we can also only edit the first cylinder.
>> 
>> Signed-off-by: Joakim Bygdell <j.bygdell at gmail.com>
>> ---
>> subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 23 ++++++++++++++++++++++
>> subsurface-core/subsurface-qt/DiveObjectHelper.h   |  4 ++++
>> 2 files changed, 27 insertions(+)
>> 
>> diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
>> index 2f058f4..b7542f8 100644
>> --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
>> +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
>> @@ -33,6 +33,17 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx)
>> 	return fmt;
>> }
>> 
>> +static QString getPressures(struct dive *dive, unsigned int idx)
>> +{
>> +	cylinder_t *cyl = &dive->cylinder[0];
>> +	QString fmt;
>> +	if (idx == 0)
>> +		fmt = get_pressure_string(cyl->start, true);
>> +	if (idx == 1)
>> +		fmt = get_pressure_string(cyl->end, true);
>> +	return fmt;
> 
> I find that API a bit strange - idx sounds like it would be the cylinder
> number. Instead you switch between start and end. How about a bool
> parameter "returnEndPressure”?
Jepp, it occurs to me while eating dinner that this could have been implemented a bit nicer but I had already sent in the patched by then.

/Jocke

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160209/aecc44b7/attachment.html>


More information about the subsurface mailing list