mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Warn if Dive Mode / Cylinders are Changed to an Incorrect Configuration.
Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
55a8b9089f
commit
b5f823c85a
4 changed files with 35 additions and 7 deletions
|
|
@ -43,6 +43,9 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent),
|
|||
connect(m, &MultiFilterSortModel::divesSelected, this, &DiveListView::divesSelectedSlot);
|
||||
connect(m, &MultiFilterSortModel::tripSelected, this, &DiveListView::tripSelected);
|
||||
connect(&diveListNotifier, &DiveListNotifier::settingsChanged, this, &DiveListView::settingsChanged);
|
||||
connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &DiveListView::divesChanged);
|
||||
connect(&diveListNotifier, &DiveListNotifier::cylinderEdited, this, &DiveListView::cylinderEdited);
|
||||
connect(&diveListNotifier, &DiveListNotifier::cylinderRemoved, this, &DiveListView::cylinderEdited);
|
||||
|
||||
setSortingEnabled(true);
|
||||
setContextMenuPolicy(Qt::DefaultContextMenu);
|
||||
|
|
@ -389,6 +392,27 @@ void DiveListView::settingsChanged()
|
|||
}
|
||||
}
|
||||
|
||||
static void check_cylinder_use(struct dive &dive)
|
||||
{
|
||||
for (auto &divecomputer: dive.dcs)
|
||||
check_dc_cylinder_use(dive, divecomputer);
|
||||
}
|
||||
|
||||
|
||||
void DiveListView::divesChanged(const QVector<dive *> &dives, DiveField field)
|
||||
{
|
||||
if (!field.mode)
|
||||
return;
|
||||
|
||||
for (auto &dive: dives)
|
||||
check_cylinder_use(*dive);
|
||||
}
|
||||
|
||||
void DiveListView::cylinderEdited(struct dive *dive, int)
|
||||
{
|
||||
check_cylinder_use(*dive);
|
||||
}
|
||||
|
||||
void DiveListView::toggleColumnVisibilityByIndex()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue