selection: move dive selection, current dive and dc through signals

To reduce access of global variables.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-09-03 22:45:08 +02:00 committed by bstoeger
parent 616dbd9671
commit 72a15c46d9
10 changed files with 47 additions and 36 deletions

View file

@ -78,13 +78,13 @@ protected slots:
void reset();
signals:
// The propagation of selection changes is complex.
// The control flow of dive-selection goes:
// The control flow of programmatical dive-selection goes:
// Commands/DiveListNotifier ---(dive */dive_trip *)---> DiveTripModel ---(QModelIndex)---> DiveListView
// i.e. The command objects send changes in terms of pointer-to-dives, which the DiveTripModel transforms
// into QModelIndexes according to the current view (tree/list). Finally, the DiveListView transforms these
// indices into local indices according to current sorting/filtering and instructs the QSelectionModel to
// perform the appropriate actions.
void selectionChanged(const QVector<QModelIndex> &indices, QModelIndex currentDive);
void selectionChanged(const QVector<QModelIndex> &indices, QModelIndex currentDive, int currentDC);
void tripSelected(QModelIndex trip, QModelIndex currentDive);
protected:
dive *oldCurrent;
@ -116,7 +116,7 @@ public slots:
void divesChanged(const QVector<dive *> &dives);
void diveChanged(dive *d);
void divesTimeChanged(timestamp_t delta, const QVector<dive *> &dives);
void divesSelected(const QVector<dive *> &dives, dive *currentDive);
void divesSelected(const QVector<dive *> &dives, dive *currentDive, int currentDC);
void tripSelected(dive_trip *trip, dive *currentDive);
void tripChanged(dive_trip *trip, TripField);
void filterReset();
@ -195,7 +195,7 @@ public slots:
void divesTimeChanged(timestamp_t delta, const QVector<dive *> &dives);
// Does nothing in list view.
//void divesMovedBetweenTrips(dive_trip *from, dive_trip *to, bool deleteFrom, bool createTo, const QVector<dive *> &dives);
void divesSelected(const QVector<dive *> &dives, dive *currentDive);
void divesSelected(const QVector<dive *> &dives, dive *currentDive, int currentDC);
void tripSelected(dive_trip *trip, dive *currentDive);
void filterReset();