diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-01-30 20:12:11 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-02-11 20:37:09 -0800 |
commit | 6622f42aab937e72cc11cb5512012394aa687767 (patch) | |
tree | 42302a42594b78b99111e98c6fd9325a0b9c5959 /desktop-widgets/mainwindow.cpp | |
parent | b37c261c95761cb5762e91b5d43277d2b0181678 (diff) | |
download | subsurface-6622f42aab937e72cc11cb5512012394aa687767.tar.gz |
Cylinders: Add CylindersModelFiltered
When the show_unused_cylinders flag is not set, the cylinder tables
in the equipment tab and the planner should not show unused cylinders.
However, the code in CylindersModel is fundamentally broken if the
unused cylinders are not at the end of the list: The correct number
of cylinders is shown, but not the correct cylinders.
Therefore, add a higher-level CylindersModelFiltered model on top
of CylindersModel that does the actual filtering. Some calls are
routed through to the base model (notably those that take indexes,
as these have to be mapped), for some calls the caller has to get
access to the source model first. We might want to adjust this.
For filtering, reuse the already existing show_cylinder function
and export it via CylindersModel.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index b4db7028c..68c267e0d 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -918,7 +918,7 @@ void MainWindow::on_actionReplanDive_triggered() divePlannerWidget->setSalinity(current_dive->salinity); DivePlannerPointsModel::instance()->loadFromDive(current_dive); reset_cylinders(&displayed_dive, true); - CylindersModel::instance()->updateDive(); + CylindersModelFiltered::instance()->updateDive(); } void MainWindow::on_actionDivePlanner_triggered() |