mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: don't create "uninteresting" event icons
There is code to dynamically show/hide event icons of a certain type. The same code is used to hide generally non-interesting/ redundant items. Instead, don't even create these items. Yes, this is idle premature optimization. A loop over all created event icons to hide them can be removed, because the icon is hidden anyway on construction time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
9e831c5001
commit
8a9ca5fcda
3 changed files with 32 additions and 33 deletions
|
@ -500,20 +500,18 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
|
|||
// printMode is always selected for SUBSURFACE_MOBILE due to font problems
|
||||
// BUT events are wanted.
|
||||
#endif
|
||||
DiveEventItem *item = new DiveEventItem(d, event, lastgasmix, dataModel,
|
||||
timeAxis, profileYAxis, animSpeed, *pixmaps);
|
||||
item->setZValue(2);
|
||||
addItem(item);
|
||||
eventItems.push_back(item);
|
||||
if (DiveEventItem::isInteresting(d, currentdc, event, *dataModel)) {
|
||||
auto item = new DiveEventItem(d, event, lastgasmix, dataModel,
|
||||
timeAxis, profileYAxis, animSpeed, *pixmaps);
|
||||
item->setZValue(2);
|
||||
addItem(item);
|
||||
eventItems.push_back(item);
|
||||
}
|
||||
if (event_is_gaschange(event))
|
||||
lastgasmix = get_gasmix_from_event(d, event);
|
||||
event = event->next;
|
||||
}
|
||||
|
||||
// Only set visible the events that should be visible
|
||||
Q_FOREACH (DiveEventItem *event, eventItems) {
|
||||
event->setVisible(!event->shouldBeHidden());
|
||||
}
|
||||
QString dcText = get_dc_nickname(currentdc);
|
||||
if (dcText == "planned dive")
|
||||
dcText = tr("Planned dive");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue