Refactor dctype -> divemode

... and repair a failed rebase (sorry).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2015-01-11 00:01:15 +01:00 committed by Dirk Hohndel
parent bfe05b4340
commit e219bc70f8
18 changed files with 204 additions and 184 deletions

14
dive.c
View file

@ -29,7 +29,7 @@ static const char *default_tags[] = {
const char *cylinderuse_text[] = {
QT_TRANSLATE_NOOP("gettextFromC", "OC-gas"), QT_TRANSLATE_NOOP("gettextFromC", "diluent"), QT_TRANSLATE_NOOP("gettextFromC", "oxygen")
};
const char *dctype_text[] = { "OC", "CCR", "PSCR", "Freedive" };
const char *divemode_text[] = { "OC", "CCR", "PSCR", "Freedive" };
int event_is_gaschange(struct event *ev)
{
@ -736,7 +736,7 @@ void per_cylinder_mean_depth(struct dive *dive, struct divecomputer *dc, int *me
mean[explicit_first_cylinder(dive, dc)] = dc->meandepth.mm;
duration[explicit_first_cylinder(dive, dc)] = dc->duration.seconds;
if (dc->dctype == CCR) {
if (dc->divemode == CCR) {
// Do the same for the O2 cylinder
int o2_cyl = get_cylinder_idx_by_use(dive, OXYGEN);
if (o2_cyl < 0)
@ -866,7 +866,7 @@ int explicit_first_cylinder(struct dive *dive, struct divecomputer *dc)
struct event *ev = get_next_event(dc->events, "gaschange");
if (ev && dc && dc->sample && ev->time.seconds == dc->sample[0].time.seconds)
return get_cylinder_index(dive, ev);
else if (dc->dctype == CCR)
else if (dc->divemode == CCR)
return MAX(get_cylinder_idx_by_use(dive, DILUENT), 0);
else
return 0;
@ -878,7 +878,7 @@ void update_setpoint_events(struct divecomputer *dc)
bool changed = false;
int new_setpoint = 0;
if (dc->dctype == CCR)
if (dc->divemode == CCR)
new_setpoint = prefs.defaultsetpoint;
while (ev) {
@ -1271,7 +1271,7 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
}
fixup_pressure(dive, sample, OC_GAS);
if (dive->dc.dctype == CCR)
if (dive->dc.divemode == CCR)
fixup_pressure(dive, sample, OXYGEN);
if (temp) {
@ -1665,7 +1665,7 @@ int gasmix_distance(const struct gasmix *a, const struct gasmix *b)
* *mix = structure containing cylinder gas mixture information.
* 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 dctype, int sac)
extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2, enum dive_comp_type divemode, int sac)
{
if (!sac) {
/* The SAC has not yet been computer, so use the default *
@ -1686,7 +1686,7 @@ extern void fill_pressures(struct gas_pressures *pressures, const double amb_pre
}
}
} else {
if (dctype == PSCR) { /* The steady state approximation should be good enough */
if (divemode == PSCR) { /* The steady state approximation should be good enough */
pressures->o2 = get_o2(mix) / 1000.0 * amb_pressure - (1.0 - get_o2(mix) / 1000.0) * prefs.o2consumption / (sac * prefs.pscr_ratio / 1000.0);
pressures->he = (amb_pressure - pressures->o2) * get_he(mix) / (1000.0 - get_o2(mix));
pressures->n2 = (amb_pressure - pressures->o2) * (1000 - get_o2(mix) - get_he(mix)) / (1000.0 - get_o2(mix));

4
dive.h
View file

@ -51,7 +51,7 @@ enum dive_comp_type {OC, CCR, PSCR, FREEDIVE, NUM_DC_TYPE}; // Flags (Open-circu
enum cylinderuse {OC_GAS, DILUENT, OXYGEN, NUM_GAS_USE}; // The different uses for cylinders
extern const char *cylinderuse_text[];
extern const char *dctype_text[];
extern const char *divemode_text[];
struct gasmix {
fraction_t o2;
@ -267,7 +267,7 @@ struct divecomputer {
depth_t maxdepth, meandepth;
temperature_t airtemp, watertemp;
pressure_t surface_pressure;
enum dive_comp_type dctype; // dive computer type: OC(default) or CCR
enum dive_comp_type divemode; // dive computer type: OC(default) or CCR
uint8_t no_o2sensors; // rebreathers: number of O2 sensors used
int salinity; // kg per 10000 l
const char *model, *serial, *fw_version;

2
file.c
View file

@ -540,7 +540,7 @@ int parse_txt_file(const char *filename, const char *csv)
value = parse_mkvi_value(memtxt.buffer, "Rig Serial number");
dive->dc.deviceid = atoi(value);
free(value);
dive->dc.dctype = CCR;
dive->dc.divemode = CCR;
dive->dc.no_o2sensors = 2;
dive->cylinder[cur_cylinder_index].cylinder_use = OXYGEN;

View file

@ -556,10 +556,10 @@ static int dive_cb(const unsigned char *data, unsigned int size,
case DC_DIVEMODE_FREEDIVE:
case DC_DIVEMODE_GAUGE:
case DC_DIVEMODE_OC: /* Open circuit */
dive->dc.dctype = OC;
dive->dc.divemode = OC;
break;
case DC_DIVEMODE_CC: /* Closed circuit */
dive->dc.dctype = CCR;
dive->dc.divemode = CCR;
break;
}
#endif

View file

@ -133,7 +133,7 @@ static duration_t get_duration(const char *line)
static enum dive_comp_type get_dctype(const char *line)
{
for (enum dive_comp_type i = 0; i < NUM_DC_TYPE; i++) {
if (strcmp(line, dctype_text[i]) == 0)
if (strcmp(line, divemode_text[i]) == 0)
return i;
}
return 0;
@ -528,7 +528,7 @@ static void parse_dc_duration(char *line, struct membuffer *str, void *_dc)
{ struct divecomputer *dc = _dc; dc->duration = get_duration(line); }
static void parse_dc_dctype(char *line, struct membuffer *str, void *_dc)
{ struct divecomputer *dc = _dc; dc->dctype = get_dctype(line); }
{ struct divecomputer *dc = _dc; dc->divemode = get_dctype(line); }
static void parse_dc_maxdepth(char *line, struct membuffer *str, void *_dc)
{ struct divecomputer *dc = _dc; dc->maxdepth = get_depth(line); }

View file

@ -570,7 +570,7 @@ static void get_dc_type(char *buffer, enum dive_comp_type *dct)
{
if (trimspace(buffer)) {
for (enum dive_comp_type i = 0; i < NUM_DC_TYPE; i++) {
if (strcmp(buffer, dctype_text[i]) == 0)
if (strcmp(buffer, divemode_text[i]) == 0)
*dct = i;
}
}
@ -875,7 +875,7 @@ static void try_to_fill_dc(struct divecomputer *dc, const char *name, char *buf)
return;
if (MATCH("diveid", hex_value, &dc->diveid))
return;
if (MATCH("dctype", get_dc_type, &dc->dctype))
if (MATCH("dctype", get_dc_type, &dc->divemode))
return;
if (MATCH("no_o2sensors", get_sensor, &dc->no_o2sensors))
return;
@ -934,7 +934,7 @@ static void try_to_fill_sample(struct sample *sample, const char *name, char *bu
if (MATCH("sensor3.sample", double_to_o2pressure, &sample->o2sensor[2])) // up to 3 CCR sensors
return;
if (MATCH("po2.sample", double_to_o2pressure, &sample->setpoint)) {
cur_dive->dc.dctype = CCR;
cur_dive->dc.divemode = CCR;
return;
}
if (MATCH("heartbeat", get_uint8, &sample->heartbeat))
@ -2256,7 +2256,7 @@ extern int shearwater_profile_sample(void *handle, int columns, char **data, cha
cur_sample->temperature.mkelvin = metric ? C_to_mkelvin(atof(data[2])) : F_to_mkelvin(atof(data[2]));
if (data[3]) {
cur_sample->setpoint.mbar = atof(data[3]) * 1000;
cur_dive->dc.dctype = CCR;
cur_dive->dc.divemode = CCR;
}
if (data[4])
cur_sample->ndl.seconds = atoi(data[4]) * 60;
@ -2571,19 +2571,19 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size)
// ptr[15] is dive type
if (0xc8 <= ptr[15] && ptr[15] <= 0xcf)
cur_dc->dctype = OC;
cur_dc->divemode = OC;
else if (0xd0 <= ptr[15] && ptr[15] <= 0xd7)
cur_dc->dctype = CCR;
cur_dc->divemode = CCR;
else if (0xd8 <= ptr[15] && ptr[15] <= 0xdf)
cur_dc->dctype = CCR; // mCCR
cur_dc->divemode = CCR; // mCCR
else if (0xe0 <= ptr[15] && ptr[15] <= 0xe7)
cur_dc->dctype = OC; // Free diving
cur_dc->divemode = OC; // Free diving
else if (0xe8 <= ptr[15] && ptr[15] <= 0xef)
cur_dc->dctype = OC; // Gauge
cur_dc->divemode = OC; // Gauge
else if (0xf0 <= ptr[15] && ptr[15] <= 0xf7)
cur_dc->dctype = PSCR; // ASCR
cur_dc->divemode = PSCR; // ASCR
else if (0xf8 <= ptr[15] && ptr[15] <= 0xff)
cur_dc->dctype = PSCR;
cur_dc->divemode = PSCR;
cur_dc->maxdepth.mm = ((ptr[21] << 8) + ptr[20]) * 10;
@ -2604,7 +2604,7 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size)
// Crazy precision on these stored values...
// Only store value if we're in CCR/PSCR mode,
// because we rather calculate ppo2 our selfs.
if (cur_dc->dctype == CCR || cur_dc->dctype == PSCR)
if (cur_dc->divemode == CCR || cur_dc->divemode == PSCR)
cur_sample->o2sensor[0].mbar = ((ptr[7] << 8) + ptr[6]) / 10;
if (!ptr[8] && ptr[9])
cur_sample->in_deco = true;

View file

@ -251,7 +251,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
int oldpo2 = 0;
int lasttime = 0;
int lastdepth = 0;
enum dive_comp_type type = displayed_dive.dc.dctype;
enum dive_comp_type type = displayed_dive.dc.divemode;
if (!diveplan || !diveplan->dp)
return;
@ -346,7 +346,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
finish_sample(dc);
dp = dp->next;
}
dc->dctype = type;
dc->divemode = type;
#if DEBUG_PLAN & 32
save_dive(stdout, &displayed_dive);
#endif
@ -699,7 +699,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
snprintf(temp, sizeof(temp), "%s", translate("gettextFromC", "OTU"));
len += snprintf(buffer + len, sizeof(buffer) - len, "<br>%s: %i</div>", temp, dive->otu);
if (dive->dc.dctype == CCR)
if (dive->dc.divemode == CCR)
snprintf(temp, sizeof(temp), "%s", translate("gettextFromC", "Gas consumption (CCR legs excluded):"));
else
snprintf(temp, sizeof(temp), "%s", translate("gettextFromC", "Gas consumption:"));

View file

@ -435,7 +435,7 @@ static void check_setpoint_events(struct dive *dive, struct divecomputer *dc, st
i = set_setpoint(pi, i, setpoint.mbar, ev->time.seconds);
setpoint.mbar = ev->value;
if (setpoint.mbar)
dc->dctype = CCR;
dc->divemode = CCR;
ev = get_next_event(ev->next, "SP change");
} while (ev);
set_setpoint(pi, i, setpoint.mbar, ~0u);
@ -607,7 +607,7 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
pi->has_ndl |= sample->ndl.seconds;
entry->in_deco = sample->in_deco;
entry->cns = sample->cns;
if (dc->dctype == CCR) {
if (dc->divemode == CCR) {
entry->o2pressure.mbar = entry->o2setpoint.mbar = sample->setpoint.mbar; // for rebreathers
entry->o2sensor[0].mbar = sample->o2sensor[0].mbar; // for up to three rebreather O2 sensors
entry->o2sensor[1].mbar = sample->o2sensor[1].mbar;
@ -940,7 +940,7 @@ static void calculate_gas_information_new(struct dive *dive, struct plot_info *p
amb_pressure = depth_to_mbar(entry->depth, dive) / 1000.0;
fill_pressures(&entry->pressures, amb_pressure, &dive->cylinder[cylinderindex].gasmix, entry->o2pressure.mbar / 1000.0, dive->dc.dctype, entry->sac);
fill_pressures(&entry->pressures, amb_pressure, &dive->cylinder[cylinderindex].gasmix, entry->o2pressure.mbar / 1000.0, dive->dc.divemode, entry->sac);
fn2 = (int)(1000.0 * entry->pressures.n2 / amb_pressure);
fhe = (int)(1000.0 * entry->pressures.he / amb_pressure);
@ -984,7 +984,8 @@ void fill_o2_values(struct divecomputer *dc, struct plot_info *pi, struct dive *
for (i = 0; i < pi->nr; i++) {
struct plot_data *entry = pi->entry + i;
if (dc->dctype == CCR) {
if (dc->divemode == CCR) {
if (i == 0) { // For 1st iteration, initialise the last_sensor values
for (j = 0; j < dc->no_o2sensors; j++)
last_sensor[j].mbar = pi->entry->o2sensor[j].mbar;
@ -1058,7 +1059,7 @@ void create_plot_info_new(struct dive *dive, struct divecomputer *dc, struct plo
setup_gas_sensor_pressure(dive, dc, pi); /* Try to populate our gas pressure knowledge */
if (!fast) {
populate_pressure_information(dive, dc, pi, false); /* .. calculate missing pressure entries for all gasses except o2 */
if (dc->dctype == CCR) /* For CCR dives.. */
if (dc->divemode == CCR) /* For CCR dives.. */
populate_pressure_information(dive, dc, pi, true); /* .. calculate missing o2 gas pressure entries */
}
fill_o2_values(dc, pi, dive); /* .. and insert the O2 sensor data having 0 values. */

View file

@ -785,13 +785,13 @@ void DivePlannerPointsModel::setGFLow(const int ghflow)
void DivePlannerPointsModel::setRebreatherMode(QString mode)
{
qDebug() << mode << "selected, was" << displayed_dive.dc.dctype;
qDebug() << mode << "selected, was" << displayed_dive.dc.divemode;
if (mode == "OC")
displayed_dive.dc.dctype = OC;
displayed_dive.dc.divemode = OC;
else if (mode == "pSCR")
displayed_dive.dc.dctype = PSCR;
displayed_dive.dc.divemode = PSCR;
else if (mode == "CCR")
displayed_dive.dc.dctype = CCR;
displayed_dive.dc.divemode = CCR;
plannerModel->emitDataChanged();
}

View file

@ -430,7 +430,7 @@ void MainTab::updateDiveInfo(bool clear)
UPDATE_TEXT(displayed_dive, buddy);
UPDATE_TEMP(displayed_dive, airtemp);
UPDATE_TEMP(displayed_dive, watertemp);
ui.DiveType->setCurrentIndex(displayed_dive.dc.dctype);
ui.DiveType->setCurrentIndex(displayed_dive.dc.divemode);
if (!clear) {
updateGpsCoordinates(&displayed_dive);
@ -514,7 +514,7 @@ void MainTab::updateDiveInfo(bool clear)
ui.otuText->setText(QString("%1").arg(displayed_dive.otu));
ui.waterTemperatureText->setText(get_temperature_string(displayed_dive.watertemp, true));
ui.airTemperatureText->setText(get_temperature_string(displayed_dive.airtemp, true));
ui.DiveType->setCurrentIndex(current_dc->dctype);
ui.DiveType->setCurrentIndex(current_dc->divemode);
volume_t gases[MAX_CYLINDERS] = {};
get_gas_used(&displayed_dive, gases);
QString volumes;
@ -650,7 +650,7 @@ void MainTab::updateDiveInfo(bool clear)
}
editMode = NONE;
ui.cylinders->view()->hideColumn(CylindersModel::DEPTH);
if (get_dive_dc(&displayed_dive, dc_number)->dctype == CCR)
if (get_dive_dc(&displayed_dive, dc_number)->divemode == CCR)
ui.cylinders->view()->showColumn(CylindersModel::USE);
else
ui.cylinders->view()->hideColumn(CylindersModel::USE);
@ -772,8 +772,8 @@ void MainTab::acceptChanges()
MODIFY_SELECTED_DIVES(EDIT_VALUE(visibility));
if (displayed_dive.airtemp.mkelvin != cd->airtemp.mkelvin)
MODIFY_SELECTED_DIVES(EDIT_VALUE(airtemp.mkelvin));
if (displayed_dive.dc.dctype != cd->dc.dctype) {
MODIFY_SELECTED_DIVES(EDIT_VALUE(dc.dctype));
if (displayed_dive.dc.divemode != cd->dc.divemode) {
MODIFY_SELECTED_DIVES(EDIT_VALUE(dc.divemode));
MODIFY_SELECTED_DIVES(update_setpoint_events(&mydive->dc));
do_replot = true;
}
@ -1019,7 +1019,7 @@ void MainTab::divetype_Changed(int index)
{
if (editMode == IGNORE)
return;
displayed_dive.dc.dctype = (enum dive_comp_type) index;
displayed_dive.dc.divemode = (enum dive_comp_type) index;
update_setpoint_events(&displayed_dive.dc);
markChangedWidget(ui.DiveType);
}

View file

@ -22,7 +22,9 @@
<number>0</number>
</property>
<item row="2" column="1">
<widget class="KMessageWidget" name="diveNotesMessage" native="true"/>
<widget class="KMessageWidget" name="diveNotesMessage" native="true">
<zorder>scrollArea</zorder>
</widget>
</item>
<item row="3" column="1">
<widget class="QScrollArea" name="scrollArea">
@ -40,14 +42,41 @@
<rect>
<x>0</x>
<y>0</y>
<width>435</width>
<height>770</height>
<width>397</width>
<height>744</height>
</rect>
</property>
<layout class="QGridLayout" name="diveNotesScrollAreaLayout">
<property name="spacing">
<number>0</number>
</property>
<item row="4" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<widget class="QLabel" name="CoordinatedLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Coordinates</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TypeLabel">
<property name="text">
<string>Dive mode</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
@ -83,16 +112,6 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QDateEdit" name="dateEdit">
<property name="calendarPopup">
<bool>true</bool>
</property>
<property name="timeSpec">
<enum>Qt::UTC</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QTimeEdit" name="timeEdit">
<property name="sizePolicy">
@ -106,6 +125,16 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDateEdit" name="dateEdit">
<property name="calendarPopup">
<bool>true</bool>
</property>
<property name="timeSpec">
<enum>Qt::UTC</enum>
</property>
</widget>
</item>
<item row="1" column="2">
<layout class="QHBoxLayout" name="airWaterTempLayout">
<property name="spacing">
@ -134,104 +163,36 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="CoordinatedLabel">
<property name="text">
<string>Coordinates</string>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="10" column="0">
<widget class="QLabel" name="DivemasterLabel">
<property name="text">
<string>Divemaster</string>
</property>
</widget>
</item>
<item row="6" column="2">
<item row="10" column="2">
<widget class="QLabel" name="BuddyLabel">
<property name="text">
<string>Buddy</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<item row="11" column="0" colspan="2">
<widget class="TagWidget" name="divemaster">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="2">
<item row="11" column="2">
<widget class="TagWidget" name="buddy">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<item row="12" column="0" colspan="2">
<layout class="QHBoxLayout" name="ratingVisibilityLabels">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="StarWidget" name="rating" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
<item>
<widget class="StarWidget" name="visibility" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="2">
<widget class="QLabel" name="SuitLabel">
<property name="text">
<string>Suit</string>
</property>
</widget>
</item>
<item row="9" column="2">
<widget class="QLineEdit" name="suit">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="TagLabel">
<property name="text">
<string>Tags</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="NotesLabel">
<property name="text">
<string>Notes</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<layout class="QHBoxLayout" name="ratingVisibilityWidgets">
<property name="spacing">
<number>0</number>
</property>
@ -263,7 +224,68 @@
</item>
</layout>
</item>
<item row="11" column="0" colspan="3">
<item row="12" column="2">
<widget class="QLabel" name="SuitLabel">
<property name="text">
<string>Suit</string>
</property>
</widget>
</item>
<item row="13" column="2">
<widget class="QLineEdit" name="suit">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="13" column="0" colspan="2">
<layout class="QHBoxLayout" name="ratingVisibilityWidgets">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="StarWidget" name="rating" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
<item>
<widget class="StarWidget" name="visibility" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="14" column="0">
<widget class="QLabel" name="TagLabel">
<property name="text">
<string>Tags</string>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QLabel" name="NotesLabel">
<property name="text">
<string>Notes</string>
</property>
</widget>
</item>
<item row="15" column="0" colspan="3">
<widget class="TagWidget" name="tagWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -295,24 +317,7 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QLineEdit" name="coordinates">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
<item>
<widget class="QComboBox" name="DiveType">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</item>
<item row="13" column="0" colspan="3">
<item row="17" column="0" colspan="3">
<layout class="QHBoxLayout" name="notesAndSocialNetworksLayout">
<property name="spacing">
<number>0</number>
@ -368,6 +373,20 @@
</item>
</layout>
</item>
<item row="7" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="coordinates">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="DiveType"/>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
@ -398,8 +417,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<height>752</height>
<width>397</width>
<height>734</height>
</rect>
</property>
<layout class="QGridLayout" name="equipmentTabScrollAreaLayout">
@ -454,8 +473,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<height>752</height>
<width>397</width>
<height>734</height>
</rect>
</property>
<layout class="QGridLayout" name="diveInfoScrollAreaLayout">
@ -771,8 +790,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<height>752</height>
<width>397</width>
<height>734</height>
</rect>
</property>
<layout class="QGridLayout" name="statsScrollAreaLayout">

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>924</width>
<height>742</height>
<width>940</width>
<height>756</height>
</rect>
</property>
<property name="windowTitle">
@ -748,14 +748,14 @@
<string>Misc</string>
</property>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>GFLow</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QSpinBox" name="gflow">
<property name="minimum">
<number>1</number>
@ -765,14 +765,14 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>GFHigh</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QSpinBox" name="gfhigh">
<property name="minimum">
<number>1</number>
@ -782,28 +782,21 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="gf_low_at_maxdepth">
<property name="text">
<string>GFLow at max depth</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="show_ccr_setpoint">
<property name="text">
<string>CCR: Show setpoints when viewing pO₂</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>Default CCR set-point</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="6" column="1">
<widget class="QDoubleSpinBox" name="defaultSetpoint">
<property name="suffix">
<string>bar</string>
@ -819,6 +812,13 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="show_ccr_setpoint">
<property name="text">
<string>CCR: Show setpoints when viewing pO₂</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -1413,11 +1413,11 @@
</connections>
<buttongroups>
<buttongroup name="verticalSpeed"/>
<buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroup_2"/>
<buttongroup name="buttonGroup_3"/>
<buttongroup name="buttonGroup_4"/>
<buttongroup name="buttonGroup_5"/>
<buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroup_6"/>
</buttongroups>
</ui>

View file

@ -624,14 +624,14 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
int o2mbar;
QPolygonF boundingPoly, o2Poly; // This is the "Whole Item", but a pressure can be divided in N Polygons.
polygons.clear();
if (displayed_dive.dc.dctype == CCR)
if (displayed_dive.dc.divemode == CCR)
polygons.append(o2Poly);
for (int i = 0, count = dataModel->rowCount(); i < count; i++) {
o2mbar = 0;
plot_data *entry = dataModel->data().entry + i;
int mbar = GET_PRESSURE(entry);
if (displayed_dive.dc.dctype == CCR)
if (displayed_dive.dc.divemode == CCR)
o2mbar = GET_O2CYLINDER_PRESSURE(entry);
if (entry->cylinderindex != last_index) {
@ -665,7 +665,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
for (int i = 0, count = dataModel->rowCount(); i < count; i++) {
entry = dataModel->data().entry + i;
mbar = GET_PRESSURE(entry);
if (displayed_dive.dc.dctype == CCR && displayed_dive.oxygen_cylinder_index >= 0)
if (displayed_dive.dc.divemode == CCR && displayed_dive.oxygen_cylinder_index >= 0)
o2mbar = GET_O2CYLINDER_PRESSURE(entry);
if (o2mbar) {

View file

@ -531,7 +531,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
currentdc = fake_dc(currentdc);
}
o2SetpointGasItem->setVisible(current_dive && (currentdc->dctype == CCR) && prefs.show_ccr_setpoint && prefs.pp_graphs.po2);
o2SetpointGasItem->setVisible(current_dive && (currentdc->divemode == CCR) && prefs.show_ccr_setpoint && prefs.pp_graphs.po2);
/* This struct holds all the data that's about to be plotted.
* I'm not sure this is the best approach ( but since we are
@ -988,7 +988,7 @@ void ProfileWidget2::setProfileState()
}
pn2GasItem->setVisible(prefs.pp_graphs.pn2);
po2GasItem->setVisible(prefs.pp_graphs.po2);
o2SetpointGasItem->setVisible(current_dive && prefs.pp_graphs.po2 && (current_dc->dctype == CCR) && (prefs.show_ccr_setpoint));
o2SetpointGasItem->setVisible(current_dive && prefs.pp_graphs.po2 && (current_dc->divemode == CCR) && (prefs.show_ccr_setpoint));
pheGasItem->setVisible(prefs.pp_graphs.phe);
timeAxis->setPos(itemPos.time.pos.on);

View file

@ -355,8 +355,8 @@ static void save_dc(struct membuffer *b, struct dive *dive, struct divecomputer
show_date(b, dc->when);
if (dc->duration.seconds && dc->duration.seconds != dive->dc.duration.seconds)
put_duration(b, dc->duration, "duration ", "min\n");
if (dc->dctype != OC) {
put_format(b, "dctype %s\n", dctype_text[dc->dctype]);
if (dc->divemode != OC) {
put_format(b, "dctype %s\n", divemode_text[dc->divemode]);
put_format(b, "numberofoxygensensors %d\n",dc->no_o2sensors);
}

View file

@ -369,10 +369,10 @@ static void save_dc(struct membuffer *b, struct dive *dive, struct divecomputer
show_date(b, dc->when);
if (dc->duration.seconds && dc->duration.seconds != dive->dc.duration.seconds)
put_duration(b, dc->duration, " duration='", " min'");
if (dc->dctype != OC) {
if (dc->divemode != OC) {
for (enum dive_comp_type i = 0; i < NUM_DC_TYPE; i++)
if (dc->dctype == i)
show_utf8(b, dctype_text[i], " dctype='", "'", 1);
if (dc->divemode == i)
show_utf8(b, divemode_text[i], " dctype='", "'", 1);
if (dc->no_o2sensors)
put_format(b," no_o2sensors='%d'", dc->no_o2sensors);
}

View file

@ -308,7 +308,7 @@ bool is_cylinder_used(struct dive *dive, int idx)
return true;
event = get_next_event(event->next, "gaschange");
}
if (dc->dctype == CCR && (idx == dive->diluent_cylinder_index || idx == dive->oxygen_cylinder_index))
if (dc->divemode == CCR && (idx == dive->diluent_cylinder_index || idx == dive->oxygen_cylinder_index))
return true;
}
if (idx == 0 && !firstGasExplicit)

View file

@ -54,7 +54,7 @@ struct preferences default_prefs = {
.user_id = NULL,
.album_id = NULL,
.access_token = NULL
}
},
.defaultsetpoint = 1100
};