mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Manually add trips from dive list context menu
We had all the logic, we were just lacking the UI. Fixes #243 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2c57568d56
commit
5961579cda
2 changed files with 25 additions and 1 deletions
|
@ -459,6 +459,28 @@ void DiveListView::removeFromTrip()
|
|||
reload(currentLayout, false);
|
||||
}
|
||||
|
||||
void DiveListView::newTripAbove()
|
||||
{
|
||||
dive_trip_t *trip;
|
||||
int idx;
|
||||
struct dive *d = (struct dive *) contextMenuIndex.data(DiveTripModel::DIVE_ROLE).value<void*>();
|
||||
if (!d) // shouldn't happen as we only are setting up this action if this is a dive
|
||||
return;
|
||||
rememberSelection();
|
||||
trip = create_and_hookup_trip_from_dive(d);
|
||||
if (d->selected) {
|
||||
for_each_dive(idx, d) {
|
||||
if (!d->selected)
|
||||
continue;
|
||||
add_dive_to_trip(d, trip);
|
||||
}
|
||||
}
|
||||
trip->expanded = 1;
|
||||
mark_divelist_changed(TRUE);
|
||||
reload(currentLayout, false);
|
||||
restoreSelection();
|
||||
}
|
||||
|
||||
void DiveListView::deleteDive()
|
||||
{
|
||||
int nr;
|
||||
|
@ -506,7 +528,8 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
|
|||
popup.addAction(tr("collapse all"), this, SLOT(collapseAll()));
|
||||
collapseAction = popup.addAction(tr("collapse"), this, SLOT(collapseAll()));
|
||||
if (d) {
|
||||
popup.addAction(tr("remove dive from trip"), this, SLOT(removeFromTrip()));
|
||||
popup.addAction(tr("Remove dive from trip"), this, SLOT(removeFromTrip()));
|
||||
popup.addAction(tr("Create new trip above"), this, SLOT(newTripAbove()));
|
||||
}
|
||||
if (trip) {
|
||||
popup.addAction(tr("Merge trip with trip above"), this, SLOT(mergeTripAbove()));
|
||||
|
|
|
@ -42,6 +42,7 @@ public slots:
|
|||
void fixMessyQtModelBehaviour();
|
||||
void mergeTripAbove();
|
||||
void mergeTripBelow();
|
||||
void newTripAbove();
|
||||
void mergeDives();
|
||||
void saveSelectedDivesAs();
|
||||
void exportSelectedDivesAsUDDF();
|
||||
|
|
Loading…
Add table
Reference in a new issue