Update tank model with custom tanks used in XML files

Fixes #377

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-12-28 14:56:01 -08:00
parent a375159e6a
commit 90ff8e672b
2 changed files with 11 additions and 1 deletions

View file

@ -13,11 +13,20 @@
void add_cylinder_description(cylinder_type_t *type)
{
const char *desc;
int i;
desc = type->description;
if (!desc)
return;
/* now do something with it... */
for (i = 0; i < 100 && tank_info[i].name != NULL; i++) {
if (strcmp(tank_info[i].name, desc) == 0)
return;
}
if (i < 100) {
tank_info[i].name = desc;
tank_info[i].ml = type->size.mliter;
tank_info[i].bar = type->workingpressure.mbar / 1000;
}
}
void add_weightsystem_description(weightsystem_t *weightsystem)
{

View file

@ -75,6 +75,7 @@ MainWindow::MainWindow() : helpView(0)
void MainWindow::refreshDisplay(bool recreateDiveList)
{
ui.InfoWidget->reload();
TankInfoModel::instance()->update();
ui.ProfileWidget->refresh();
ui.globe->reload();
if (recreateDiveList)