selection: move current dc logic to profile widget

The current dc global makes no sense on mobile. Therefore,
move the logic of the currently displayed dive computer
to the profile widget and remove the dc_number global
variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-09-17 19:07:35 +02:00 committed by bstoeger
parent 19baae449d
commit cad80e5a53
10 changed files with 92 additions and 66 deletions

View file

@ -79,12 +79,14 @@ protected slots:
signals:
// The propagation of selection changes is complex.
// The control flow of programmatical dive-selection goes:
// Commands/DiveListNotifier ---(dive */dive_trip *)---> DiveTripModel ---(QModelIndex)---> DiveListView
// Commands/DiveListNotifier ---(dive */dive_trip *)---> DiveTripModel
// ---(QModelIndex)---> MultiFilterSortModel
// ---(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
// into QModelIndexes according to the current view (tree/list). These are modified according to current
// filtering/sorting. Finally, the DiveListView instructs the QSelectionModel to
// perform the appropriate actions.
void divesSelected(const QVector<QModelIndex> &indices, QModelIndex currentDive, int currentDC);
void divesSelected(const QVector<QModelIndex> &indices, QModelIndex currentDive, int currentDC); // currentDC < 0 -> keep DC.
void tripSelected(QModelIndex trip, QModelIndex currentDive);
protected:
dive *oldCurrent;

View file

@ -18,7 +18,7 @@ public:
void resetModel(DiveTripModelBase::Layout layout);
signals:
void divesSelected(const QVector<QModelIndex> &indices, QModelIndex currentDive, int currentDC);
void divesSelected(const QVector<QModelIndex> &indices, QModelIndex currentDive, int currentDC); // currentDC < 0 -> keep DC.
void tripSelected(QModelIndex trip, QModelIndex currentDive);
private slots:
void divesSelectedSlot(const QVector<QModelIndex> &indices, QModelIndex currentDive, int currentDC);