mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
Hooked up 'Hide Events'
With this commit one can hide all events of the selected type through a context menu on the profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e8d1f14c90
commit
df6a80fb37
1 changed files with 21 additions and 7 deletions
|
@ -142,8 +142,8 @@ void ProfileGraphicsView::contextMenuEvent(QContextMenuEvent* event)
|
|||
connect(action, SIGNAL(triggered(bool)), this, SLOT(removeEvent()));
|
||||
m.addAction(action);
|
||||
action = new QAction(&m);
|
||||
action->setText("Hide events of that type");
|
||||
action->setData(event->globalPos());
|
||||
action->setText("Hide similar events");
|
||||
action->setData(QVariant::fromValue<void*>(item));
|
||||
connect(action, SIGNAL(triggered(bool)), this, SLOT(hideEvents()));
|
||||
m.addAction(action);
|
||||
break;
|
||||
|
@ -173,10 +173,24 @@ void ProfileGraphicsView::changeGas()
|
|||
void ProfileGraphicsView::hideEvents()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction*>(sender());
|
||||
QPoint globalPos = action->data().toPoint();
|
||||
QPoint viewPos = mapFromGlobal(globalPos);
|
||||
QPointF scenePos = mapToScene(viewPos);
|
||||
qDebug() << "Hide Event";
|
||||
EventItem *item = static_cast<EventItem*>(action->data().value<void*>());
|
||||
struct event *event = item->ev;
|
||||
|
||||
if (QMessageBox::question(mainWindow(),
|
||||
tr("Hide events"),
|
||||
tr("Hide all %1 events?").arg(event->name),
|
||||
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok){
|
||||
if (event->name) {
|
||||
for (int i = 0; i < evn_used; i++) {
|
||||
if (! strcmp(event->name, ev_namelist[i].ev_name)) {
|
||||
ev_namelist[i].plot_ev = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
mark_divelist_changed(TRUE);
|
||||
plot(current_dive, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileGraphicsView::removeEvent()
|
||||
|
@ -199,8 +213,8 @@ void ProfileGraphicsView::removeEvent()
|
|||
free(event);
|
||||
}
|
||||
mark_divelist_changed(TRUE);
|
||||
}
|
||||
plot(current_dive, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue