mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Reenabled copying the diveplan to dive notes.
Gas consumption calculation fixed. Pressure difference still needs cylinder size to be set. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
04b6b6aaf9
commit
1093d6235b
2 changed files with 7 additions and 8 deletions
|
@ -480,7 +480,6 @@ static unsigned int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops,
|
||||||
return stoplevels;
|
return stoplevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DO_WE_WANT_THIS_IN_QT
|
|
||||||
static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
|
static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
|
||||||
{
|
{
|
||||||
char buffer[20000];
|
char buffer[20000];
|
||||||
|
@ -493,7 +492,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), translate("gettextFromC", "%s\nSubsurface dive plan\nbased on GFlow = %.0f and GFhigh = %.0f\n\n"),
|
snprintf(buffer, sizeof(buffer), translate("gettextFromC", "%s\nSubsurface dive plan\nbased on GFlow = %.0f and GFhigh = %.0f\n\n"),
|
||||||
disclaimer, plangflow * 100, plangfhigh * 100);
|
disclaimer, diveplan->gflow * 100, diveplan->gfhigh * 100);
|
||||||
/* we start with gas 0, then check if that was changed */
|
/* we start with gas 0, then check if that was changed */
|
||||||
o2 = get_o2(&dive->cylinder[0].gasmix);
|
o2 = get_o2(&dive->cylinder[0].gasmix);
|
||||||
he = get_he(&dive->cylinder[0].gasmix);
|
he = get_he(&dive->cylinder[0].gasmix);
|
||||||
|
@ -566,6 +565,8 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
|
||||||
double volume;
|
double volume;
|
||||||
const char *unit;
|
const char *unit;
|
||||||
char gas[64];
|
char gas[64];
|
||||||
|
if (dive->cylinder[gasidx].type.size.mliter)
|
||||||
|
dive->cylinder[gasidx].end.mbar = dive->cylinder[gasidx].start.mbar - consumption[gasidx] / dive->cylinder[gasidx].type.size.mliter / 1000;
|
||||||
if (consumption[gasidx] == 0)
|
if (consumption[gasidx] == 0)
|
||||||
continue;
|
continue;
|
||||||
len = strlen(buffer);
|
len = strlen(buffer);
|
||||||
|
@ -576,7 +577,6 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
|
||||||
}
|
}
|
||||||
dive->notes = strdup(buffer);
|
dive->notes = strdup(buffer);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int ascend_velocity(int depth, int avg_depth, int bottom_time)
|
int ascend_velocity(int depth, int avg_depth, int bottom_time)
|
||||||
{
|
{
|
||||||
|
@ -768,9 +768,7 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, b
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
record_dive(dive);
|
record_dive(dive);
|
||||||
|
|
||||||
#if DO_WE_WANT_THIS_IN_QT
|
|
||||||
add_plan_to_notes(diveplan, dive);
|
add_plan_to_notes(diveplan, dive);
|
||||||
#endif
|
|
||||||
|
|
||||||
error_exit:
|
error_exit:
|
||||||
free(stoplevels);
|
free(stoplevels);
|
||||||
|
|
|
@ -1069,7 +1069,8 @@ bool DivePlannerPointsModel::recalcQ()
|
||||||
|
|
||||||
void DivePlannerPointsModel::emitCylinderModelEdited()
|
void DivePlannerPointsModel::emitCylinderModelEdited()
|
||||||
{
|
{
|
||||||
cylinderModelEdited();
|
if (isPlanner())
|
||||||
|
cylinderModelEdited();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivePlannerPointsModel::columnCount(const QModelIndex &parent) const
|
int DivePlannerPointsModel::columnCount(const QModelIndex &parent) const
|
||||||
|
@ -1199,13 +1200,13 @@ DivePlannerPointsModel *DivePlannerPointsModel::instance()
|
||||||
|
|
||||||
void DivePlannerPointsModel::setBottomSac(int sac)
|
void DivePlannerPointsModel::setBottomSac(int sac)
|
||||||
{
|
{
|
||||||
diveplan.bottomsac = sac;
|
diveplan.bottomsac = sac * 1000;
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerPointsModel::setDecoSac(int sac)
|
void DivePlannerPointsModel::setDecoSac(int sac)
|
||||||
{
|
{
|
||||||
diveplan.decosac = sac;
|
diveplan.decosac = sac * 1000;
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue