Equipment: Include Unused Tanks in Merge if Preference is Enabled.

Include unused tanks in merges of multiple logs into a single dive if
the 'Show unused cylinders' preference is enabled.
Also rename the preference (in code) to `include_unused_tanks` to
reflect the fact that it is already used in more places than just the
display (exporting, cloning dives).
Simplified the cylinder model to make forced inclusion of unused tanks
dependent on use of the model in planner.
Leaving the persisted name of the preference as `display_unused_tanks`
to avoid resetting this for all users - is there a good way to migrate
preference names?

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2023-07-09 12:14:27 +12:00
parent cb6f768865
commit 5fae7ce7a0
17 changed files with 50 additions and 47 deletions

View file

@ -36,7 +36,7 @@ public:
COMMIT_ROLE, // Save the temporary data to the dive. Must be set with Column == TYPE.
REVERT_ROLE // Revert to original data from dive. Must be set with Column == TYPE.
};
explicit CylindersModel(bool planner, bool hideUnused, QObject *parent = 0); // First argument: true if this model is used for the planner
explicit CylindersModel(bool planner, QObject *parent = 0); // First argument: true if this model is used for the planner
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
@ -67,7 +67,6 @@ private:
dive *d;
int dcNr;
bool inPlanner;
bool hideUnused;
int numRows; // Does not include unused cylinders at the end
// Used if we temporarily change a line because the user is selecting a weight type
int tempRow;