mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
selection: remove current_dive and dc_number access from tabwidgets
An attempt at limitting accesses to the globals current_dive and dc_number. These globals do not make sense on mobile. The parent widget of the tab-widgets remembers the currently displayer dive and dive computer and the individual widgets access these values from there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
8cd191c271
commit
6f03fc9689
8 changed files with 125 additions and 96 deletions
|
@ -1,5 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "TabDiveStatistics.h"
|
||||
#include "maintab.h"
|
||||
#include "ui_TabDiveStatistics.h"
|
||||
|
||||
#include "core/qthelper.h"
|
||||
|
@ -29,9 +30,8 @@ TabDiveStatistics::TabDiveStatistics(MainTab *parent) : TabBase(parent), ui(new
|
|||
connect(&diveListNotifier, &DiveListNotifier::cylinderEdited, this, &TabDiveStatistics::cylinderChanged);
|
||||
|
||||
const auto l = findChildren<QLabel *>(QString(), Qt::FindDirectChildrenOnly);
|
||||
for (QLabel *label: l) {
|
||||
for (QLabel *label: l)
|
||||
label->setAlignment(Qt::AlignHCenter);
|
||||
}
|
||||
}
|
||||
|
||||
TabDiveStatistics::~TabDiveStatistics()
|
||||
|
@ -59,7 +59,7 @@ void TabDiveStatistics::divesChanged(const QVector<dive *> &dives, DiveField fie
|
|||
|
||||
// TODO: make this more fine grained. Currently, the core can only calculate *all* statistics.
|
||||
if (field.duration || field.depth || field.mode || field.air_temp || field.water_temp)
|
||||
updateData(getDiveSelection(), current_dive, dc_number); // TODO: remember these data
|
||||
updateData(getDiveSelection(), parent.currentDive, parent.currentDC); // TODO: remember dive selection
|
||||
}
|
||||
|
||||
void TabDiveStatistics::cylinderChanged(dive *d)
|
||||
|
@ -67,7 +67,7 @@ void TabDiveStatistics::cylinderChanged(dive *d)
|
|||
// If the changed dive is not selected, do nothing
|
||||
if (!d->selected)
|
||||
return;
|
||||
updateData(getDiveSelection(), current_dive, dc_number); // TODO: remember these data
|
||||
updateData(getDiveSelection(), parent.currentDive, parent.currentDC); // TODO: remember dive selection
|
||||
}
|
||||
|
||||
void TabDiveStatistics::updateData(const std::vector<dive *> &, dive *currentDive, int)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue