mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Lookup gas via the plot_data, not the event
When straight decoding the event, it failed to handle older SAMPLE_EVENT_GASCHANGE(11), the ones without he-part correctly. This was shown clearly when it printed the 21/35 in dives/test20.xml as air. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									ad52301ca7
								
							
						
					
					
						commit
						d53d00db02
					
				
					 1 changed files with 10 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -819,8 +819,9 @@ void ProfileGraphicsView::plot_events(struct divecomputer *dc)
 | 
			
		|||
 | 
			
		||||
void ProfileGraphicsView::plot_one_event(struct event *ev)
 | 
			
		||||
{
 | 
			
		||||
	int i, depth = 0;
 | 
			
		||||
	int i;
 | 
			
		||||
	struct plot_info *pi = &gc.pi;
 | 
			
		||||
	struct plot_data *entry;
 | 
			
		||||
 | 
			
		||||
	/* is plotting of this event disabled? */
 | 
			
		||||
	if (ev->name) {
 | 
			
		||||
| 
						 | 
				
			
			@ -840,16 +841,15 @@ void ProfileGraphicsView::plot_one_event(struct event *ev)
 | 
			
		|||
		return;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < pi->nr; i++) {
 | 
			
		||||
		struct plot_data *data = pi->entry + i;
 | 
			
		||||
		if (ev->time.seconds < data->sec)
 | 
			
		||||
		entry = pi->entry + i;
 | 
			
		||||
		if (ev->time.seconds < entry->sec)
 | 
			
		||||
			break;
 | 
			
		||||
		depth = data->depth;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* draw a little triangular marker and attach tooltip */
 | 
			
		||||
 | 
			
		||||
	int x = SCALEXGC(ev->time.seconds);
 | 
			
		||||
	int y = SCALEYGC(depth);
 | 
			
		||||
	int y = SCALEYGC(entry->depth);
 | 
			
		||||
 | 
			
		||||
	EventItem *item = new EventItem(0, isGrayscale);
 | 
			
		||||
	item->setPos(x, y);
 | 
			
		||||
| 
						 | 
				
			
			@ -859,13 +859,13 @@ void ProfileGraphicsView::plot_one_event(struct event *ev)
 | 
			
		|||
	QString name = tr(ev->name);
 | 
			
		||||
	if (ev->value) {
 | 
			
		||||
		if (ev->name && name == "gaschange") {
 | 
			
		||||
			unsigned int he = ev->value >> 16;
 | 
			
		||||
			unsigned int o2 = ev->value & 0xffff;
 | 
			
		||||
			int he = get_he(&dive->cylinder[entry->cylinderindex].gasmix);
 | 
			
		||||
			int o2 = get_o2(&dive->cylinder[entry->cylinderindex].gasmix);
 | 
			
		||||
 | 
			
		||||
			name += ": ";
 | 
			
		||||
			name += (he) ? QString("%1/%2").arg(o2, he)
 | 
			
		||||
				  : (o2 == 21) ? name += tr("air")
 | 
			
		||||
				  : QString("%1% %2").arg(o2).arg("O" UTF8_SUBSCRIPT_2);
 | 
			
		||||
			name += (he) ? QString("%1/%2").arg((o2 + 5) / 10).arg((he + 5) / 10)
 | 
			
		||||
				  : is_air(o2, he) ? name += tr("air")
 | 
			
		||||
				  : QString(tr("EAN%1")).arg((o2 + 5) / 10);
 | 
			
		||||
 | 
			
		||||
		} else if (ev->name && !strcmp(ev->name, "SP change")) {
 | 
			
		||||
			name += QString(":%1").arg((double) ev->value / 1000);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue