mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
5c4d163a41
commit
8dea2ada3b
7 changed files with 122 additions and 128 deletions
|
|
@ -53,17 +53,8 @@ void TabDiveStatistics::divesChanged(const QVector<dive *> &dives, DiveField fie
|
|||
return;
|
||||
|
||||
// TODO: make this more fine grained. Currently, the core can only calculate *all* statistics.
|
||||
switch(field) {
|
||||
case DiveField::DURATION:
|
||||
case DiveField::DEPTH:
|
||||
case DiveField::MODE:
|
||||
case DiveField::AIR_TEMP:
|
||||
case DiveField::WATER_TEMP:
|
||||
if (field.duration || field.depth || field.mode || field.air_temp || field.water_temp)
|
||||
updateData();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void TabDiveStatistics::updateData()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue