Undo: turn dive- and trip-fields into flags

The divesEdited signal sends the changed field as a parameter.
Since some undo-commands change multiple fields, this led to
numerous signals for a single command. This in turn would lead
to multiple profile-reloads and statistic recalculations.

Therefore, turn the enum into a bitfield. For simplicity,
provide a constructor that takes classical flags and turns
them into the bitfield. This is necessary because C-style
named initialization is only supported on C++20 onward!

Is this somewhat overengineered? Yes, maybe.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-10-13 12:44:39 +02:00 committed by Dirk Hohndel
parent 5c4d163a41
commit 8dea2ada3b
7 changed files with 122 additions and 128 deletions

View file

@ -108,13 +108,8 @@ void TabDiveEquipment::divesChanged(const QVector<dive *> &dives, DiveField fiel
if (!current_dive || !dives.contains(current_dive))
return;
switch(field) {
case DiveField::SUIT:
if (field.suit)
ui.suit->setText(QString(current_dive->suit));
break;
default:
break;
}
}
void TabDiveEquipment::toggleTriggeredColumn()