mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix "hide unused cylinder" behavior
There are at least two scenarios where our old code was flat out wrong. If you manually add a cylinder (because you may want to switch to it in the profile), then at least until the next time you restart Subsurface this cylinder should be shown. Also, when you switch to a cylinder by adding a gas switch event on the profile, that change should then make that cylinder visible. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
781b99170c
commit
630eece8b2
2 changed files with 5 additions and 0 deletions
|
@ -274,6 +274,8 @@ void CylindersModel::add()
|
|||
|
||||
int row = rows;
|
||||
fill_default_cylinder(¤t->cylinder[row]);
|
||||
// mark the cylinder as 'used' since it was manually added
|
||||
current->cylinder[row].used = true;
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
rows++;
|
||||
changed = true;
|
||||
|
|
|
@ -198,6 +198,9 @@ void ProfileGraphicsView::changeGas()
|
|||
validate_gas(gas.toUtf8().constData(), &o2, &he);
|
||||
int seconds = scenePos.x() / gc.maxx * (gc.rightx - gc.leftx) + gc.leftx;
|
||||
add_gas_switch_event(current_dive, current_dc, seconds, get_gasidx(current_dive, o2, he));
|
||||
// this means we potentially have a new tank that is being used and needs to be shown
|
||||
fixup_dive(current_dive);
|
||||
mainWindow()->information()->updateDiveInfo(selected_dive);
|
||||
mark_divelist_changed(true);
|
||||
plot(current_dive, true);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue