mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: fold event-related functions into event class
Not strictly necessary, but more idiomatic C++ and less polution of the global namespace. This one is so trivial that there seems to be no reason not to do it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c27314d603
commit
e237f29fb2
12 changed files with 28 additions and 29 deletions
|
@ -39,7 +39,7 @@ DiveEventItem::~DiveEventItem()
|
|||
|
||||
void DiveEventItem::setupPixmap(struct gasmix lastgasmix, const DivePixmaps &pixmaps)
|
||||
{
|
||||
event_severity severity = get_event_severity(ev);
|
||||
event_severity severity = ev.get_severity();
|
||||
if (ev.name.empty()) {
|
||||
setPixmap(pixmaps.warning);
|
||||
} else if (same_string_caseinsensitive(ev.name.c_str(), "modechange")) {
|
||||
|
@ -50,7 +50,7 @@ void DiveEventItem::setupPixmap(struct gasmix lastgasmix, const DivePixmaps &pix
|
|||
} else if (ev.type == SAMPLE_EVENT_BOOKMARK) {
|
||||
setPixmap(pixmaps.bookmark);
|
||||
setOffset(QPointF(0.0, -pixmap().height()));
|
||||
} else if (event_is_gaschange(ev)) {
|
||||
} else if (ev.is_gaschange()) {
|
||||
struct gasmix mix = get_gasmix_from_event(dive, ev);
|
||||
struct icd_data icd_data;
|
||||
bool icd = isobaric_counterdiffusion(lastgasmix, mix, &icd_data);
|
||||
|
@ -121,7 +121,7 @@ void DiveEventItem::setupToolTipString(struct gasmix lastgasmix)
|
|||
int value = ev.value;
|
||||
int type = ev.type;
|
||||
|
||||
if (event_is_gaschange(ev)) {
|
||||
if (ev.is_gaschange()) {
|
||||
struct icd_data icd_data;
|
||||
struct gasmix mix = get_gasmix_from_event(dive, ev);
|
||||
name += ": ";
|
||||
|
|
|
@ -559,7 +559,7 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
|
|||
if (event.name.empty() ||
|
||||
!(event.name == "heading" ||
|
||||
(event.name == "SP change" && event.time.seconds == 0) ||
|
||||
event_is_gaschange(event) ||
|
||||
event.is_gaschange() ||
|
||||
event.type == SAMPLE_EVENT_BOOKMARK))
|
||||
continue;
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
|
|||
addItem(item);
|
||||
eventItems.push_back(item);
|
||||
}
|
||||
if (event_is_gaschange(event))
|
||||
if (event.is_gaschange())
|
||||
lastgasmix = get_gasmix_from_event(d, event);
|
||||
}
|
||||
|
||||
|
|
|
@ -559,7 +559,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
|
|||
DiveEventItem *item = dynamic_cast<DiveEventItem *>(sceneItem);
|
||||
|
||||
// Add or edit Gas Change
|
||||
if (d && item && event_is_gaschange(item->ev)) {
|
||||
if (d && item && item->ev.is_gaschange()) {
|
||||
int eventTime = item->ev.time.seconds;
|
||||
QMenu *gasChange = m.addMenu(tr("Edit Gas Change"));
|
||||
for (int i = 0; i < d->cylinders.nr; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue