mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: move number_of_divecomputers to struct dive
Feels natural in a C++ code base. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e90251b0cf
commit
6e29c00f35
8 changed files with 12 additions and 12 deletions
|
@ -328,7 +328,7 @@ void MainWindow::divesSelected(const std::vector<dive *> &selection, dive *curre
|
|||
|
||||
// Activate cursor keys to switch through DCs if there are more than one DC.
|
||||
if (currentDive) {
|
||||
bool nr = number_of_computers(current_dive) > 1;
|
||||
bool nr = currentDive->number_of_computers() > 1;
|
||||
enableShortcuts();
|
||||
ui.actionNextDC->setEnabled(nr);
|
||||
ui.actionPreviousDC->setEnabled(nr);
|
||||
|
|
|
@ -209,7 +209,7 @@ void ProfileWidget::plotDive(dive *dIn, int dcIn)
|
|||
|
||||
// The following is valid because number_of_computers is always at least 1.
|
||||
if (d)
|
||||
dc = std::min(dc, (int)number_of_computers(current_dive) - 1);
|
||||
dc = std::min(dc, d->number_of_computers() - 1);
|
||||
|
||||
// Exit edit mode if the dive changed
|
||||
if (endEditMode)
|
||||
|
@ -253,7 +253,7 @@ void ProfileWidget::rotateDC(int dir)
|
|||
{
|
||||
if (!d)
|
||||
return;
|
||||
int numDC = number_of_computers(d);
|
||||
int numDC = d->number_of_computers();
|
||||
int newDC = (dc + dir) % numDC;
|
||||
if (newDC < 0)
|
||||
newDC += numDC;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue