mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-12 12:56:16 +00:00
Enable posibility to add dives to trip below
When I'm on a dive trip i usually download dives multiple times to start logging them while i still remember them. When i have already created a trip and downloads new dives they needs to be able to be added to the already existing trip, without relying on autogroup. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a29c4ddba3
commit
519f45416f
2 changed files with 15 additions and 0 deletions
|
@ -582,7 +582,17 @@ void DiveListView::newTripAbove()
|
||||||
restoreSelection();
|
restoreSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DiveListView::addToTripBelow()
|
||||||
|
{
|
||||||
|
addToTrip(true);
|
||||||
|
}
|
||||||
|
|
||||||
void DiveListView::addToTripAbove()
|
void DiveListView::addToTripAbove()
|
||||||
|
{
|
||||||
|
addToTrip(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiveListView::addToTrip(bool below)
|
||||||
{
|
{
|
||||||
int idx, delta = (currentOrder == Qt::AscendingOrder) ? -1 : +1;
|
int idx, delta = (currentOrder == Qt::AscendingOrder) ? -1 : +1;
|
||||||
dive_trip_t *trip = NULL;
|
dive_trip_t *trip = NULL;
|
||||||
|
@ -590,6 +600,8 @@ void DiveListView::addToTripAbove()
|
||||||
struct dive *d = (struct dive *)contextMenuIndex.data(DiveTripModel::DIVE_ROLE).value<void *>();
|
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
|
if (!d) // shouldn't happen as we only are setting up this action if this is a dive
|
||||||
return;
|
return;
|
||||||
|
if (below) // Should we add to the trip below instead?
|
||||||
|
delta *= -1;
|
||||||
rememberSelection();
|
rememberSelection();
|
||||||
if (d->selected) { // we are right-clicking on one of possibly many selected dive(s)
|
if (d->selected) { // we are right-clicking on one of possibly many selected dive(s)
|
||||||
// find the top selected dive, depending on the list order
|
// find the top selected dive, depending on the list order
|
||||||
|
@ -714,6 +726,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
|
||||||
popup.addAction(tr("remove dive(s) from trip"), this, SLOT(removeFromTrip()));
|
popup.addAction(tr("remove dive(s) from trip"), this, SLOT(removeFromTrip()));
|
||||||
popup.addAction(tr("create new trip above"), this, SLOT(newTripAbove()));
|
popup.addAction(tr("create new trip above"), this, SLOT(newTripAbove()));
|
||||||
popup.addAction(tr("add dive(s) to trip immediately above"), this, SLOT(addToTripAbove()));
|
popup.addAction(tr("add dive(s) to trip immediately above"), this, SLOT(addToTripAbove()));
|
||||||
|
popup.addAction(tr("add dive(s) to trip immediately below"), this, SLOT(addToTripBelow()));
|
||||||
}
|
}
|
||||||
if (trip) {
|
if (trip) {
|
||||||
popup.addAction(tr("merge trip with trip above"), this, SLOT(mergeTripAbove()));
|
popup.addAction(tr("merge trip with trip above"), this, SLOT(mergeTripAbove()));
|
||||||
|
|
|
@ -46,6 +46,7 @@ slots:
|
||||||
void mergeTripBelow();
|
void mergeTripBelow();
|
||||||
void newTripAbove();
|
void newTripAbove();
|
||||||
void addToTripAbove();
|
void addToTripAbove();
|
||||||
|
void addToTripBelow();
|
||||||
void mergeDives();
|
void mergeDives();
|
||||||
void saveSelectedDivesAs();
|
void saveSelectedDivesAs();
|
||||||
void exportSelectedDivesAsUDDF();
|
void exportSelectedDivesAsUDDF();
|
||||||
|
@ -77,6 +78,7 @@ private:
|
||||||
void updateLastUsedImageDir(const QString &s);
|
void updateLastUsedImageDir(const QString &s);
|
||||||
void updateLastImageTimeOffset(int offset);
|
void updateLastImageTimeOffset(int offset);
|
||||||
int lastImageTimeOffset();
|
int lastImageTimeOffset();
|
||||||
|
void addToTrip(bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIVELISTVIEW_H
|
#endif // DIVELISTVIEW_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue