mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	to allow grantlee to access individual fields of the cylinder_t struct
rather than a string representation of the whole cylinder info using a
grantlee structure like this one:
	<table class="table_class">
		<tr>
			<td>Cylinder</td>
			<td>Start press.</td>
			<td>End press.</td>
			<td>Gas mix</td>
		</tr>
		{% for cylinderObject in dive.cylinderObjects %}
		<tr>
			<td>{{ cylinderObject.description }}</td>
			<td>{{ cylinderObject.startPressure }}</td>
			<td>{{ cylinderObject.endPressure }}</td>
			<td>{{ cylinderObject.gasMix }}</td>
		</tr>
		{% endfor %}
	</table>
Signed-off-by: Tim Wootton <tim@tee-jay.org.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
		
	
			
		
			
				
	
	
		
			37 lines
		
	
	
	
		
			952 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
	
		
			952 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "CylinderObjectHelper.h"
 | |
| #include "../helpers.h"
 | |
| 
 | |
| static QString EMPTY_CYLINDER_STRING = QStringLiteral("");
 | |
| CylinderObjectHelper::CylinderObjectHelper(cylinder_t *cylinder) :
 | |
| 	m_cyl(cylinder) {
 | |
| }
 | |
| 
 | |
| CylinderObjectHelper::~CylinderObjectHelper() {
 | |
| }
 | |
| 
 | |
| QString CylinderObjectHelper::description() const {
 | |
| 	if (!m_cyl->type.description)
 | |
| 		return QString(EMPTY_CYLINDER_STRING);
 | |
| 	else
 | |
| 		return QString(m_cyl->type.description);
 | |
| }
 | |
| 
 | |
| QString CylinderObjectHelper::size() const {
 | |
| 	return get_volume_string(m_cyl->type.size, true);
 | |
| }
 | |
| 
 | |
| QString CylinderObjectHelper::workingPressure() const {
 | |
| 	return get_pressure_string(m_cyl->type.workingpressure, true);
 | |
| }
 | |
| 
 | |
| QString CylinderObjectHelper::startPressure() const {
 | |
| 	return get_pressure_string(m_cyl->start, true);
 | |
| }
 | |
| 
 | |
| QString CylinderObjectHelper::endPressure() const {
 | |
| 	return get_pressure_string(m_cyl->end, true);
 | |
| }
 | |
| 
 | |
| QString CylinderObjectHelper::gasMix() const {
 | |
| 	return get_gas_string(m_cyl->gasmix);
 | |
| }
 |