mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Create divemode switches using profile context menu
Allow the manual creation of divemode switch events using the profile context menu. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
This commit is contained in:
parent
2a2098bab2
commit
e46cb2f800
2 changed files with 39 additions and 0 deletions
|
@ -1413,6 +1413,12 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
|
||||||
setpointAction->setData(event->globalPos());
|
setpointAction->setData(event->globalPos());
|
||||||
QAction *action = m.addAction(tr("Add bookmark"), this, SLOT(addBookmark()));
|
QAction *action = m.addAction(tr("Add bookmark"), this, SLOT(addBookmark()));
|
||||||
action->setData(event->globalPos());
|
action->setData(event->globalPos());
|
||||||
|
QAction *OCAction = m.addAction(tr("Add OC switch"), this, SLOT(addOCSwitch()));
|
||||||
|
OCAction->setData(event->globalPos());
|
||||||
|
QAction *CCRAction = m.addAction(tr("Add CCR switch"), this, SLOT(addCCRSwitch()));
|
||||||
|
CCRAction->setData(event->globalPos());
|
||||||
|
QAction *PSCRAction = m.addAction(tr("Add PSCR switch"), this, SLOT(addPSCRSwitch()));
|
||||||
|
PSCRAction->setData(event->globalPos());
|
||||||
|
|
||||||
if (same_string(current_dc->model, "manually added dive"))
|
if (same_string(current_dc->model, "manually added dive"))
|
||||||
m.addAction(tr("Edit the profile"), this, SIGNAL(editCurrentDive()));
|
m.addAction(tr("Edit the profile"), this, SIGNAL(editCurrentDive()));
|
||||||
|
@ -1574,6 +1580,36 @@ void ProfileWidget2::addBookmark()
|
||||||
replot();
|
replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileWidget2::addOCSwitch()
|
||||||
|
{
|
||||||
|
QAction *action = qobject_cast<QAction *>(sender());
|
||||||
|
QPointF scenePos = mapToScene(mapFromGlobal(action->data().toPoint()));
|
||||||
|
add_event(current_dc, lrint(timeAxis->valueAt(scenePos)), 8, 0, 0, "modechange");
|
||||||
|
invalidate_dive_cache(current_dive);
|
||||||
|
mark_divelist_changed(true);
|
||||||
|
replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileWidget2::addCCRSwitch()
|
||||||
|
{
|
||||||
|
QAction *action = qobject_cast<QAction *>(sender());
|
||||||
|
QPointF scenePos = mapToScene(mapFromGlobal(action->data().toPoint()));
|
||||||
|
add_event(current_dc, lrint(timeAxis->valueAt(scenePos)), 8, 0, 1, "modechange");
|
||||||
|
invalidate_dive_cache(current_dive);
|
||||||
|
mark_divelist_changed(true);
|
||||||
|
replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileWidget2::addPSCRSwitch()
|
||||||
|
{
|
||||||
|
QAction *action = qobject_cast<QAction *>(sender());
|
||||||
|
QPointF scenePos = mapToScene(mapFromGlobal(action->data().toPoint()));
|
||||||
|
add_event(current_dc, lrint(timeAxis->valueAt(scenePos)), 8, 0, 2, "modechange");
|
||||||
|
invalidate_dive_cache(current_dive);
|
||||||
|
mark_divelist_changed(true);
|
||||||
|
replot();
|
||||||
|
}
|
||||||
|
|
||||||
void ProfileWidget2::addSetpointChange()
|
void ProfileWidget2::addSetpointChange()
|
||||||
{
|
{
|
||||||
QAction *action = qobject_cast<QAction *>(sender());
|
QAction *action = qobject_cast<QAction *>(sender());
|
||||||
|
|
|
@ -115,6 +115,9 @@ slots: // Necessary to call from QAction's signals.
|
||||||
void changeGas();
|
void changeGas();
|
||||||
void addSetpointChange();
|
void addSetpointChange();
|
||||||
void addBookmark();
|
void addBookmark();
|
||||||
|
void addOCSwitch();
|
||||||
|
void addCCRSwitch();
|
||||||
|
void addPSCRSwitch();
|
||||||
void hideEvents();
|
void hideEvents();
|
||||||
void unhideEvents();
|
void unhideEvents();
|
||||||
void removeEvent();
|
void removeEvent();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue