mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Continue populating the DiveInfo tab
Pulled one more helper from statistics-gtk.c (but didn't modify the code there to use it as that code is no longer being compiled). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0cb9b9ccfb
commit
1298aa87e5
3 changed files with 30 additions and 0 deletions
|
@ -102,7 +102,10 @@ void MainTab::updateDiveInfo(int dive)
|
||||||
// click on the item and check its objectName,
|
// click on the item and check its objectName,
|
||||||
// the access is ui->objectName from here on.
|
// the access is ui->objectName from here on.
|
||||||
volume_t sacVal;
|
volume_t sacVal;
|
||||||
|
struct dive *prevd;
|
||||||
struct dive *d = get_dive(dive);
|
struct dive *d = get_dive(dive);
|
||||||
|
|
||||||
|
process_all_dives(d, &prevd);
|
||||||
currentDive = d;
|
currentDive = d;
|
||||||
UPDATE_TEXT(d, notes);
|
UPDATE_TEXT(d, notes);
|
||||||
UPDATE_TEXT(d, location);
|
UPDATE_TEXT(d, location);
|
||||||
|
@ -118,6 +121,11 @@ void MainTab::updateDiveInfo(int dive)
|
||||||
ui->waterTemperatureText->setText(get_temperature_string(d->watertemp, TRUE));
|
ui->waterTemperatureText->setText(get_temperature_string(d->watertemp, TRUE));
|
||||||
ui->airTemperatureText->setText(get_temperature_string(d->airtemp, TRUE));
|
ui->airTemperatureText->setText(get_temperature_string(d->airtemp, TRUE));
|
||||||
ui->gasUsedText->setText(get_volume_string(get_gas_used(d), TRUE));
|
ui->gasUsedText->setText(get_volume_string(get_gas_used(d), TRUE));
|
||||||
|
ui->oxygenHeliumText->setText(get_gaslist(d));
|
||||||
|
ui->dateText->setText(get_dive_date_string(d->when));
|
||||||
|
ui->diveTimeText->setText(QString::number((int)((d->duration.seconds + 30) / 60)));
|
||||||
|
if (prevd)
|
||||||
|
ui->surfaceIntervalText->setText(get_time_string(d->when - (prevd->when + prevd->duration.seconds), 4));
|
||||||
if ((sacVal.mliter = d->sac) > 0)
|
if ((sacVal.mliter = d->sac) > 0)
|
||||||
ui->sacText->setText(get_volume_string(sacVal, TRUE).append("/min"));
|
ui->sacText->setText(get_volume_string(sacVal, TRUE).append("/min"));
|
||||||
else
|
else
|
||||||
|
|
21
statistics.c
21
statistics.c
|
@ -289,3 +289,24 @@ volume_t get_gas_used(struct dive *dive)
|
||||||
}
|
}
|
||||||
return gas_used;
|
return gas_used;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAXBUF 80
|
||||||
|
/* for the O2/He readings just create a list of them */
|
||||||
|
char *get_gaslist(struct dive *dive)
|
||||||
|
{
|
||||||
|
int idx, offset = 0;
|
||||||
|
static char buf[MAXBUF];
|
||||||
|
|
||||||
|
buf[0] = '\0';
|
||||||
|
for (idx = 0; idx < MAX_CYLINDERS; idx++) {
|
||||||
|
cylinder_t *cyl = &dive->cylinder[idx];
|
||||||
|
if (!cylinder_none(cyl)) {
|
||||||
|
int o2 = get_o2(&cyl->gasmix);
|
||||||
|
int he = get_he(&cyl->gasmix);
|
||||||
|
snprintf(buf + offset, MAXBUF - offset, (offset > 0) ? ", %d/%d" : "%d/%d",
|
||||||
|
(o2 + 5) / 10, (he + 5) / 10);
|
||||||
|
offset = strlen(buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ extern char *get_minutes(int seconds);
|
||||||
extern void process_all_dives(struct dive *dive, struct dive **prev_dive);
|
extern void process_all_dives(struct dive *dive, struct dive **prev_dive);
|
||||||
extern void get_selected_dives_text(char *buffer, int size);
|
extern void get_selected_dives_text(char *buffer, int size);
|
||||||
extern volume_t get_gas_used(struct dive *dive);
|
extern volume_t get_gas_used(struct dive *dive);
|
||||||
|
extern char *get_gaslist(struct dive *dive);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue