Rename enum dive_comp_type to divemode_t

...as the usuage is not anymore about a computer but
a momentary dive mode. Rename the end indicator as well.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2018-05-08 16:24:51 +02:00 committed by Lubomir I. Ivanov
parent 0b836f12fc
commit 969dfee9ec
15 changed files with 43 additions and 43 deletions

View file

@ -478,7 +478,7 @@ void calc_crushing_pressure(struct deco_state *ds, double pressure)
} }
/* add period_in_seconds at the given pressure and gas to the deco calculation */ /* add period_in_seconds at the given pressure and gas to the deco calculation */
void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, enum dive_comp_type divemode, int sac) void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, enum divemode_t divemode, int sac)
{ {
(void) sac; (void) sac;
int ci; int ci;

View file

@ -245,7 +245,7 @@ void add_extra_data(struct divecomputer *dc, const char *key, const char *value)
* saving the dive mode for each event. When the events occur AFTER 'time' seconds, the last stored divemode * saving the dive mode for each event. When the events occur AFTER 'time' seconds, the last stored divemode
* is returned. This function is self-tracking, relying on setting the event pointer 'evp' so that, in each iteration * is returned. This function is self-tracking, relying on setting the event pointer 'evp' so that, in each iteration
* that calls this function, the search does not have to begin at the first event of the dive */ * that calls this function, the search does not have to begin at the first event of the dive */
enum dive_comp_type get_current_divemode(struct divecomputer *dc, int time, struct event **evp, enum dive_comp_type *divemode) enum divemode_t get_current_divemode(struct divecomputer *dc, int time, struct event **evp, enum divemode_t *divemode)
{ {
struct event *ev = *evp; struct event *ev = *evp;
if (*divemode == UNDEF_COMP_TYPE) { if (*divemode == UNDEF_COMP_TYPE) {
@ -253,7 +253,7 @@ enum dive_comp_type get_current_divemode(struct divecomputer *dc, int time, stru
ev = dc ? get_next_event(dc->events, "modechange") : NULL; ev = dc ? get_next_event(dc->events, "modechange") : NULL;
} }
while (ev && ev->time.seconds < time) { while (ev && ev->time.seconds < time) {
*divemode = (enum dive_comp_type) ev->value; *divemode = (enum divemode_t) ev->value;
ev = get_next_event(ev->next, "modechange"); ev = get_next_event(ev->next, "modechange");
} }
*evp = ev; *evp = ev;
@ -2071,7 +2071,7 @@ int gasmix_distance(const struct gasmix *a, const struct gasmix *b)
* divemode = the dive mode pertaining to this point in the dive profile. * divemode = the dive mode pertaining to this point in the dive profile.
* This function called by: calculate_gas_information_new() in profile.c; add_segment() in deco.c. * This function called by: calculate_gas_information_new() in profile.c; add_segment() in deco.c.
*/ */
extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2, enum dive_comp_type divemode) extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2, enum divemode_t divemode)
{ {
if ((divemode != OC) && po2) { // This is a rebreather dive where pressures->o2 is defined if ((divemode != OC) && po2) { // This is a rebreather dive where pressures->o2 is defined
if (po2 >= amb_pressure) { if (po2 >= amb_pressure) {

View file

@ -27,7 +27,7 @@ extern "C" {
extern int last_xml_version; extern int last_xml_version;
enum dive_comp_type {OC, CCR, PSCR, FREEDIVE, NUM_DC_TYPE, UNDEF_COMP_TYPE}; // Flags (Open-circuit and Closed-circuit-rebreather) for setting dive computer type enum divemode_t {OC, CCR, PSCR, FREEDIVE, NUM_DIVEMODE, UNDEF_COMP_TYPE}; // Flags (Open-circuit and Closed-circuit-rebreather) for setting dive computer type
enum cylinderuse {OC_GAS, DILUENT, OXYGEN, NOT_USED, NUM_GAS_USE}; // The different uses for cylinders enum cylinderuse {OC_GAS, DILUENT, OXYGEN, NOT_USED, NUM_GAS_USE}; // The different uses for cylinders
extern const char *cylinderuse_text[]; extern const char *cylinderuse_text[];
@ -84,7 +84,7 @@ struct event {
int flags, value; int flags, value;
/* .. and this is our "extended" data for some event types */ /* .. and this is our "extended" data for some event types */
union { union {
enum dive_comp_type divemode; // for divemode change events enum divemode_t divemode; // for divemode change events
/* /*
* NOTE! The index may be -1, which means "unknown". In that * NOTE! The index may be -1, which means "unknown". In that
* case, the get_cylinder_index() function will give the best * case, the get_cylinder_index() function will give the best
@ -132,7 +132,7 @@ struct gas_pressures {
double o2, n2, he; double o2, n2, he;
}; };
extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2, enum dive_comp_type dctype); extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2, enum divemode_t dctype);
extern void sanitize_gasmix(struct gasmix *mix); extern void sanitize_gasmix(struct gasmix *mix);
extern int gasmix_distance(const struct gasmix *a, const struct gasmix *b); extern int gasmix_distance(const struct gasmix *a, const struct gasmix *b);
@ -259,7 +259,7 @@ struct divecomputer {
depth_t maxdepth, meandepth; depth_t maxdepth, meandepth;
temperature_t airtemp, watertemp; temperature_t airtemp, watertemp;
pressure_t surface_pressure; pressure_t surface_pressure;
enum dive_comp_type divemode; // dive computer type: OC(default) or CCR enum divemode_t divemode; // dive computer type: OC(default) or CCR
uint8_t no_o2sensors; // rebreathers: number of O2 sensors used uint8_t no_o2sensors; // rebreathers: number of O2 sensors used
int salinity; // kg per 10000 l int salinity; // kg per 10000 l
const char *model, *serial, *fw_version; const char *model, *serial, *fw_version;
@ -362,9 +362,9 @@ struct dive_components {
unsigned int weights : 1; unsigned int weights : 1;
}; };
extern enum dive_comp_type get_current_divemode(struct divecomputer *dc, int time, struct event **evp, enum dive_comp_type *divemode); extern enum divemode_t get_current_divemode(struct divecomputer *dc, int time, struct event **evp, enum divemode_t *divemode);
extern struct event *get_next_divemodechange(struct event **evd, bool update_pointer); extern struct event *get_next_divemodechange(struct event **evd, bool update_pointer);
extern enum dive_comp_type get_divemode_at_time(struct divecomputer *dc, int dtime, struct event **ev_dmc); extern enum divemode_t get_divemode_at_time(struct divecomputer *dc, int dtime, struct event **ev_dmc);
/* picture list and methods related to dive picture handling */ /* picture list and methods related to dive picture handling */
struct picture { struct picture {
@ -853,7 +853,7 @@ struct deco_state {
bool icd_warning; bool icd_warning;
}; };
extern void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, enum dive_comp_type divemode, int sac); extern void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, enum divemode_t divemode, int sac);
extern void clear_deco(struct deco_state *ds, double surface_pressure); extern void clear_deco(struct deco_state *ds, double surface_pressure);
extern void dump_tissues(struct deco_state *ds); extern void dump_tissues(struct deco_state *ds);
extern void set_gf(short gflow, short gfhigh); extern void set_gf(short gflow, short gfhigh);
@ -874,7 +874,7 @@ struct divedatapoint {
int setpoint; int setpoint;
bool entered; bool entered;
struct divedatapoint *next; struct divedatapoint *next;
enum dive_comp_type divemode; enum divemode_t divemode;
}; };
struct diveplan { struct diveplan {
@ -891,7 +891,7 @@ struct diveplan {
int surface_interval; int surface_interval;
}; };
struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum dive_comp_type divemode); struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum divemode_t divemode);
struct divedatapoint *create_dp(int time_incr, int depth, int cylinderid, int po2); struct divedatapoint *create_dp(int time_incr, int depth, int cylinderid, int po2);
#if DEBUG_PLAN #if DEBUG_PLAN
void dump_plan(struct diveplan *diveplan); void dump_plan(struct diveplan *diveplan);

View file

@ -416,7 +416,7 @@ static void add_dive_to_deco(struct deco_state *ds, struct dive *dive)
struct gasmix *gasmix = NULL; struct gasmix *gasmix = NULL;
int i; int i;
struct event *ev = NULL, *evd = NULL; struct event *ev = NULL, *evd = NULL;
enum dive_comp_type current_divemode = UNDEF_COMP_TYPE; enum divemode_t current_divemode = UNDEF_COMP_TYPE;
if (!dc) if (!dc)
return; return;

View file

@ -162,9 +162,9 @@ static duration_t get_duration(const char *line)
return d; return d;
} }
static enum dive_comp_type get_dctype(const char *line) static enum divemode_t get_dctype(const char *line)
{ {
for (enum dive_comp_type i = 0; i < NUM_DC_TYPE; i++) { for (enum divemode_t i = 0; i < NUM_DIVEMODE; i++) {
if (strcmp(line, divemode_text[i]) == 0) if (strcmp(line, divemode_text[i]) == 0)
return i; return i;
} }
@ -725,7 +725,7 @@ static void parse_dc_watertemp(char *line, struct membuffer *str, void *_dc)
int get_divemode(const char *divemodestring) { int get_divemode(const char *divemodestring) {
for (int i = 0; i < NUM_DC_TYPE; i++) { for (int i = 0; i < NUM_DIVEMODE; i++) {
if (!strcmp(divemodestring, divemode_text[i])) if (!strcmp(divemodestring, divemode_text[i]))
return i; return i;
} }

View file

@ -437,10 +437,10 @@ static void event_name(char *buffer, char *name)
const char *libdc_divemode_text[] = { "oc", "cc", "pscr", "freedive", "gauge"}; const char *libdc_divemode_text[] = { "oc", "cc", "pscr", "freedive", "gauge"};
/* Extract the dive computer type from the xml text buffer */ /* Extract the dive computer type from the xml text buffer */
static void get_dc_type(char *buffer, enum dive_comp_type *dct) static void get_dc_type(char *buffer, enum divemode_t *dct)
{ {
if (trimspace(buffer)) { if (trimspace(buffer)) {
for (enum dive_comp_type i = 0; i < NUM_DC_TYPE; i++) { for (enum divemode_t i = 0; i < NUM_DIVEMODE; i++) {
if (strcmp(buffer, divemode_text[i]) == 0) if (strcmp(buffer, divemode_text[i]) == 0)
*dct = i; *dct = i;
else if (strcmp(buffer, libdc_divemode_text[i]) == 0) else if (strcmp(buffer, libdc_divemode_text[i]) == 0)
@ -459,7 +459,7 @@ static void event_divemode(char *buffer, int *value)
if (size >= MAX_EVENT_NAME) if (size >= MAX_EVENT_NAME)
size = MAX_EVENT_NAME - 1; size = MAX_EVENT_NAME - 1;
buffer[size] = 0x0; buffer[size] = 0x0;
for (int i = 0; i < NUM_DC_TYPE; i++) { for (int i = 0; i < NUM_DIVEMODE; i++) {
if (!strcmp(buffer,divemode_text[i])) { if (!strcmp(buffer,divemode_text[i])) {
*value = i; *value = i;
break; break;

View file

@ -115,7 +115,7 @@ int get_gasidx(struct dive *dive, struct gasmix *mix)
return find_best_gasmix_match(mix, dive->cylinder, 0); return find_best_gasmix_match(mix, dive->cylinder, 0);
} }
void interpolate_transition(struct deco_state *ds, struct dive *dive, duration_t t0, duration_t t1, depth_t d0, depth_t d1, const struct gasmix *gasmix, o2pressure_t po2, enum dive_comp_type divemode) void interpolate_transition(struct deco_state *ds, struct dive *dive, duration_t t0, duration_t t1, depth_t d0, depth_t d1, const struct gasmix *gasmix, o2pressure_t po2, enum divemode_t divemode)
{ {
int32_t j; int32_t j;
@ -152,7 +152,7 @@ int tissue_at_end(struct deco_state *ds, struct dive *dive, struct deco_state **
psample = sample = dc->sample; psample = sample = dc->sample;
struct event *evdm = NULL; struct event *evdm = NULL;
enum dive_comp_type divemode = UNDEF_COMP_TYPE; enum divemode_t divemode = UNDEF_COMP_TYPE;
for (i = 0; i < dc->samples; i++, sample++) { for (i = 0; i < dc->samples; i++, sample++) {
o2pressure_t setpoint; o2pressure_t setpoint;
@ -231,7 +231,7 @@ void fill_default_cylinder(cylinder_t *cyl)
/* calculate the new end pressure of the cylinder, based on its current end pressure and the /* calculate the new end pressure of the cylinder, based on its current end pressure and the
* latest segment. */ * latest segment. */
static void update_cylinder_pressure(struct dive *d, int old_depth, int new_depth, int duration, int sac, cylinder_t *cyl, bool in_deco, enum dive_comp_type divemode) static void update_cylinder_pressure(struct dive *d, int old_depth, int new_depth, int duration, int sac, cylinder_t *cyl, bool in_deco, enum divemode_t divemode)
{ {
volume_t gas_used; volume_t gas_used;
pressure_t delta_p; pressure_t delta_p;
@ -267,7 +267,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive,
int lasttime = 0, last_manual_point = 0; int lasttime = 0, last_manual_point = 0;
depth_t lastdepth = {.mm = 0}; depth_t lastdepth = {.mm = 0};
int lastcylid; int lastcylid;
enum dive_comp_type type = dive->dc.divemode; enum divemode_t type = dive->dc.divemode;
if (!diveplan || !diveplan->dp) if (!diveplan || !diveplan->dp)
return; return;
@ -417,7 +417,7 @@ void add_to_end_of_diveplan(struct diveplan *diveplan, struct divedatapoint *dp)
dp->time += lasttime; dp->time += lasttime;
} }
struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum dive_comp_type divemode) struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum divemode_t divemode)
{ {
struct divedatapoint *dp = create_dp(duration, depth, cylinderid, po2); struct divedatapoint *dp = create_dp(duration, depth, cylinderid, po2);
dp->entered = entered; dp->entered = entered;
@ -553,7 +553,7 @@ int ascent_velocity(int depth, int avg_depth, int bottom_time)
} }
} }
void track_ascent_gas(int depth, cylinder_t *cylinder, int avg_depth, int bottom_time, bool safety_stop, enum dive_comp_type divemode) void track_ascent_gas(int depth, cylinder_t *cylinder, int avg_depth, int bottom_time, bool safety_stop, enum divemode_t divemode)
{ {
while (depth > 0) { while (depth > 0) {
int deltad = ascent_velocity(depth, avg_depth, bottom_time) * TIMESTEP; int deltad = ascent_velocity(depth, avg_depth, bottom_time) * TIMESTEP;
@ -569,7 +569,7 @@ void track_ascent_gas(int depth, cylinder_t *cylinder, int avg_depth, int bottom
} }
// Determine whether ascending to the next stop will break the ceiling. Return true if the ascent is ok, false if it isn't. // Determine whether ascending to the next stop will break the ceiling. Return true if the ascent is ok, false if it isn't.
bool trial_ascent(struct deco_state *ds, int wait_time, int trial_depth, int stoplevel, int avg_depth, int bottom_time, struct gasmix *gasmix, int po2, double surface_pressure, struct dive *dive, enum dive_comp_type divemode) bool trial_ascent(struct deco_state *ds, int wait_time, int trial_depth, int stoplevel, int avg_depth, int bottom_time, struct gasmix *gasmix, int po2, double surface_pressure, struct dive *dive, enum divemode_t divemode)
{ {
bool clear_to_ascend = true; bool clear_to_ascend = true;
@ -634,7 +634,7 @@ bool enough_gas(int current_cylinder)
* So we always test at the upper bundary, not in the middle! * So we always test at the upper bundary, not in the middle!
*/ */
int wait_until(struct deco_state *ds, struct dive *dive, int clock, int min, int leap, int stepsize, int depth, int target_depth, int avg_depth, int bottom_time, struct gasmix *gasmix, int po2, double surface_pressure, enum dive_comp_type divemode) int wait_until(struct deco_state *ds, struct dive *dive, int clock, int min, int leap, int stepsize, int depth, int target_depth, int avg_depth, int bottom_time, struct gasmix *gasmix, int po2, double surface_pressure, enum divemode_t divemode)
{ {
// When a deco stop exceeds two days, there is something wrong... // When a deco stop exceeds two days, there is something wrong...
if (min >= 48 * 3600) if (min >= 48 * 3600)
@ -699,7 +699,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
int laststoptime = timestep; int laststoptime = timestep;
bool o2breaking = false; bool o2breaking = false;
int decostopcounter = 0; int decostopcounter = 0;
enum dive_comp_type divemode = dive->dc.divemode; enum divemode_t divemode = dive->dc.divemode;
set_gf(diveplan->gflow, diveplan->gfhigh); set_gf(diveplan->gflow, diveplan->gfhigh);
set_vpmb_conservatism(diveplan->vpmb_conservatism); set_vpmb_conservatism(diveplan->vpmb_conservatism);

View file

@ -537,7 +537,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
/* Print warnings for pO2 */ /* Print warnings for pO2 */
dp = diveplan->dp; dp = diveplan->dp;
bool o2warning_exist = false; bool o2warning_exist = false;
enum dive_comp_type current_divemode; enum divemode_t current_divemode;
double amb; double amb;
struct event *evd = NULL; struct event *evd = NULL;
current_divemode = UNDEF_COMP_TYPE; current_divemode = UNDEF_COMP_TYPE;

View file

@ -907,7 +907,7 @@ static void setup_gas_sensor_pressure(struct dive *dive, struct divecomputer *dc
#ifndef SUBSURFACE_MOBILE #ifndef SUBSURFACE_MOBILE
/* calculate DECO STOP / TTS / NDL */ /* calculate DECO STOP / TTS / NDL */
static void calculate_ndl_tts(struct deco_state *ds, struct dive *dive, struct plot_data *entry, struct gasmix *gasmix, double surface_pressure,enum dive_comp_type divemode) static void calculate_ndl_tts(struct deco_state *ds, struct dive *dive, struct plot_data *entry, struct gasmix *gasmix, double surface_pressure,enum divemode_t divemode)
{ {
/* FIXME: This should be configurable */ /* FIXME: This should be configurable */
/* ascent speed up to first deco stop */ /* ascent speed up to first deco stop */
@ -1018,7 +1018,7 @@ void calculate_deco_information(struct deco_state *ds, struct deco_state *planne
ds->first_ceiling_pressure.mbar = depth_to_mbar(first_ceiling, dive); ds->first_ceiling_pressure.mbar = depth_to_mbar(first_ceiling, dive);
struct gasmix *gasmix = NULL; struct gasmix *gasmix = NULL;
struct event *ev = NULL, *evd = NULL; struct event *ev = NULL, *evd = NULL;
enum dive_comp_type current_divemode = UNDEF_COMP_TYPE; enum divemode_t current_divemode = UNDEF_COMP_TYPE;
for (i = 1; i < pi->nr; i++) { for (i = 1; i < pi->nr; i++) {
struct plot_data *entry = pi->entry + i; struct plot_data *entry = pi->entry + i;
@ -1207,7 +1207,7 @@ static void calculate_gas_information_new(struct dive *dive, struct divecomputer
double amb_pressure; double amb_pressure;
struct gasmix *gasmix = NULL; struct gasmix *gasmix = NULL;
struct event *evg = NULL, *evd = NULL; struct event *evg = NULL, *evd = NULL;
enum dive_comp_type current_divemode = UNDEF_COMP_TYPE; enum divemode_t current_divemode = UNDEF_COMP_TYPE;
for (i = 1; i < pi->nr; i++) { for (i = 1; i < pi->nr; i++) {
int fn2, fhe; int fn2, fhe;

View file

@ -402,7 +402,7 @@ static void save_dc(struct membuffer *b, struct dive *dive, struct divecomputer
if (dc->duration.seconds && dc->duration.seconds != dive->dc.duration.seconds) if (dc->duration.seconds && dc->duration.seconds != dive->dc.duration.seconds)
put_duration(b, dc->duration, " duration='", " min'"); put_duration(b, dc->duration, " duration='", " min'");
if (dc->divemode != OC) { if (dc->divemode != OC) {
for (enum dive_comp_type i = 0; i < NUM_DC_TYPE; i++) for (enum divemode_t i = 0; i < NUM_DIVEMODE; i++)
if (dc->divemode == i) if (dc->divemode == i)
show_utf8(b, divemode_text[i], " dctype='", "'", 1); show_utf8(b, divemode_text[i], " dctype='", "'", 1);
if (dc->no_o2sensors) if (dc->no_o2sensors)

View file

@ -123,7 +123,7 @@ void process_all_dives(struct dive *dive, struct dive **prev_dive)
free(stats_by_type); free(stats_by_type);
size = sizeof(stats_t) * (dive_table.nr + 1); size = sizeof(stats_t) * (dive_table.nr + 1);
tsize = sizeof(stats_t) * (NUM_DC_TYPE + 1); tsize = sizeof(stats_t) * (NUM_DIVEMODE + 1);
stats_yearly = malloc(size); stats_yearly = malloc(size);
stats_monthly = malloc(size); stats_monthly = malloc(size);
stats_by_trip = malloc(size); stats_by_trip = malloc(size);

View file

@ -1164,7 +1164,7 @@ void MainTab::divetype_Changed(int index)
{ {
if (editMode == IGNORE) if (editMode == IGNORE)
return; return;
displayed_dc->divemode = (enum dive_comp_type) index; displayed_dc->divemode = (enum divemode_t) index;
update_setpoint_events(&displayed_dive, displayed_dc); update_setpoint_events(&displayed_dive, displayed_dc);
markChangedWidget(ui.DiveType); markChangedWidget(ui.DiveType);
MainWindow::instance()->graphics()->recalcCeiling(); MainWindow::instance()->graphics()->recalcCeiling();

View file

@ -1414,7 +1414,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
QAction *action = m.addAction(tr("Add bookmark"), this, SLOT(addBookmark())); QAction *action = m.addAction(tr("Add bookmark"), this, SLOT(addBookmark()));
action->setData(event->globalPos()); action->setData(event->globalPos());
struct event *ev = NULL; struct event *ev = NULL;
enum dive_comp_type divemode = UNDEF_COMP_TYPE; enum divemode_t divemode = UNDEF_COMP_TYPE;
QPointF scenePos = mapToScene(mapFromGlobal(event->globalPos())); QPointF scenePos = mapToScene(mapFromGlobal(event->globalPos()));
QString gas = action->text(); QString gas = action->text();
qreal sec_val = timeAxis->valueAt(scenePos); qreal sec_val = timeAxis->valueAt(scenePos);

View file

@ -334,9 +334,9 @@ bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &v
break; break;
case DIVEMODE: case DIVEMODE:
if (value.toInt() < FREEDIVE) // FIXME: I want to be a combo box and translate strings to enum values if (value.toInt() < FREEDIVE) // FIXME: I want to be a combo box and translate strings to enum values
p.divemode = (enum dive_comp_type) value.toInt(); p.divemode = (enum divemode_t) value.toInt();
if (index.row() == 0) if (index.row() == 0)
displayed_dive.dc.divemode = (enum dive_comp_type) value.toInt(); displayed_dive.dc.divemode = (enum divemode_t) value.toInt();
break; break;
} }
editStop(index.row(), p); editStop(index.row(), p);
@ -466,10 +466,10 @@ void DivePlannerPointsModel::setGFLow(const int gflow)
void DivePlannerPointsModel::setRebreatherMode(int mode) void DivePlannerPointsModel::setRebreatherMode(int mode)
{ {
int i; int i;
displayed_dive.dc.divemode = (dive_comp_type) mode; displayed_dive.dc.divemode = (divemode_t) mode;
for (i=0; i < rowCount(); i++) { for (i=0; i < rowCount(); i++) {
divepoints[i].setpoint = mode == CCR ? prefs.defaultsetpoint : 0; divepoints[i].setpoint = mode == CCR ? prefs.defaultsetpoint : 0;
divepoints[i].divemode = (enum dive_comp_type) mode; divepoints[i].divemode = (enum divemode_t) mode;
} }
emitDataChanged(); emitDataChanged();
} }
@ -673,7 +673,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_
{ {
int cylinderid = 0; int cylinderid = 0;
bool usePrevious = false; bool usePrevious = false;
enum dive_comp_type divemode = displayed_dive.dc.divemode; enum divemode_t divemode = displayed_dive.dc.divemode;
if (cylinderid_in >= 0) if (cylinderid_in >= 0)
cylinderid = cylinderid_in; cylinderid = cylinderid_in;
else else

View file

@ -205,7 +205,7 @@ void YearlyStatisticsModel::update_yearly_stats()
/* Show the statistic sorted by dive type */ /* Show the statistic sorted by dive type */
if (stats_by_type != NULL && stats_by_type[0].selection_size) { if (stats_by_type != NULL && stats_by_type[0].selection_size) {
YearStatisticsItem *item = new YearStatisticsItem(stats_by_type[0]); YearStatisticsItem *item = new YearStatisticsItem(stats_by_type[0]);
for (i = 1; i <= NUM_DC_TYPE; ++i) { for (i = 1; i <= NUM_DIVEMODE; ++i) {
if (stats_by_type[i].selection_size == 0) if (stats_by_type[i].selection_size == 0)
continue; continue;
YearStatisticsItem *iChild = new YearStatisticsItem(stats_by_type[i]); YearStatisticsItem *iChild = new YearStatisticsItem(stats_by_type[i]);