mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't show gaschange events at the beginning of a dive
The initial gas change event is really special - it just specifies the gas mix from the dive computer. So don't show it as an event if that already matches the initial gas. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
81f8ed901f
commit
3c7bb789af
1 changed files with 16 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
||||||
#include "animationfunctions.h"
|
#include "animationfunctions.h"
|
||||||
#include "libdivecomputer.h"
|
#include "libdivecomputer.h"
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
|
#include "planner.h"
|
||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "gettextfromc.h"
|
#include "gettextfromc.h"
|
||||||
|
@ -107,8 +108,22 @@ void DiveEventItem::eventVisibilityChanged(const QString &eventName, bool visibl
|
||||||
|
|
||||||
bool DiveEventItem::shouldBeHidden()
|
bool DiveEventItem::shouldBeHidden()
|
||||||
{
|
{
|
||||||
|
struct event *event = internalEvent;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gas change events - particularly at the beginning of a dive - are
|
||||||
|
* special. It's just the dive computer specifying the initial gas.
|
||||||
|
*
|
||||||
|
* Don't bother showing them if they match the first gas already
|
||||||
|
*/
|
||||||
|
if (!strcmp(event->name, "gaschange") && !event->time.seconds) {
|
||||||
|
struct gasmix *mix = get_gasmix_from_event(event);
|
||||||
|
struct dive *dive = current_dive;
|
||||||
|
if (dive && get_gasidx(dive, mix) <= 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
for (int i = 0; i < evn_used; i++) {
|
for (int i = 0; i < evn_used; i++) {
|
||||||
if (!strcmp(internalEvent->name, ev_namelist[i].ev_name) && ev_namelist[i].plot_ev == false)
|
if (!strcmp(event->name, ev_namelist[i].ev_name) && ev_namelist[i].plot_ev == false)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue