mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
6622f42aab
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>
45 lines
1 KiB
C++
45 lines
1 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef TAB_DIVE_EQUIPMENT_H
|
|
#define TAB_DIVE_EQUIPMENT_H
|
|
|
|
#include "TabBase.h"
|
|
#include "ui_TabDiveEquipment.h"
|
|
#include "qt-models/completionmodels.h"
|
|
#include "desktop-widgets/divelistview.h"
|
|
|
|
namespace Ui {
|
|
class TabDiveEquipment;
|
|
};
|
|
|
|
class WeightModel;
|
|
class CylindersModelFiltered;
|
|
|
|
class TabDiveEquipment : public TabBase {
|
|
Q_OBJECT
|
|
public:
|
|
TabDiveEquipment(QWidget *parent = 0);
|
|
~TabDiveEquipment();
|
|
void updateData() override;
|
|
void clear() override;
|
|
void acceptChanges();
|
|
void rejectChanges();
|
|
void divesEdited(int i);
|
|
void closeWarning();
|
|
|
|
private slots:
|
|
void divesChanged(const QVector<dive *> &dives, DiveField field);
|
|
void addCylinder_clicked();
|
|
void addWeight_clicked();
|
|
void toggleTriggeredColumn();
|
|
void editCylinderWidget(const QModelIndex &index);
|
|
void editWeightWidget(const QModelIndex &index);
|
|
void on_suit_editingFinished();
|
|
|
|
private:
|
|
Ui::TabDiveEquipment ui;
|
|
SuitCompletionModel suitModel;
|
|
CylindersModelFiltered *cylindersModel;
|
|
WeightModel *weightModel;
|
|
};
|
|
|
|
#endif // TAB_DIVE_EQUIPMENT_H
|