profile: don't use global dc_number variable in profile

The profile knows which divecomputer it is plotting. No point
in accessing a global variable (which isn't even defined on
mobile).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-03-11 22:49:53 +01:00 committed by Dirk Hohndel
parent 12406786f1
commit 5b4d4813f2

View file

@ -669,11 +669,14 @@ void ProfileWidget2::makeFirstDC()
void ProfileWidget2::renameCurrentDC()
{
bool ok;
struct divecomputer *currentdc = get_dive_dc(mutable_dive(), dc);
if (!currentdc)
return;
QString newName = QInputDialog::getText(this, tr("Edit nickname"),
tr("Set new nickname for %1 (serial %2):").arg(current_dc->model).arg(current_dc->serial),
QLineEdit::Normal, get_dc_nickname(current_dc), &ok);
tr("Set new nickname for %1 (serial %2):").arg(currentdc->model).arg(currentdc->serial),
QLineEdit::Normal, get_dc_nickname(currentdc), &ok);
if (ok)
Command::editDeviceNickname(current_dc, newName);
Command::editDeviceNickname(currentdc, newName);
}
void ProfileWidget2::hideEvents(DiveEventItem *item)