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
|
|
@ -581,7 +581,7 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
|
|||
dcText = tr("Manually added dive");
|
||||
else if (dcText.isEmpty())
|
||||
dcText = tr("Unknown dive computer");
|
||||
int nr = number_of_computers(d);
|
||||
int nr = d->number_of_computers();
|
||||
if (nr > 1)
|
||||
dcText += tr(" (#%1 of %2)").arg(dc + 1).arg(nr);
|
||||
diveComputerText->set(dcText, getColor(TIME_TEXT, isGrayscale));
|
||||
|
|
|
|||
|
|
@ -533,13 +533,13 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
|
|||
QGraphicsItem *sceneItem = itemAt(mapFromGlobal(event->globalPos()));
|
||||
if (isDiveTextItem(sceneItem, profileScene->diveComputerText)) {
|
||||
const struct divecomputer *currentdc = get_dive_dc(d, dc);
|
||||
if (!currentdc->deviceid && dc == 0 && number_of_computers(d) == 1)
|
||||
if (!currentdc->deviceid && dc == 0 && d->number_of_computers() == 1)
|
||||
// nothing to do, can't rename, delete or reorder
|
||||
return;
|
||||
// create menu to show when right clicking on dive computer name
|
||||
if (dc > 0)
|
||||
m.addAction(tr("Make first dive computer"), this, &ProfileWidget2::makeFirstDC);
|
||||
if (number_of_computers(d) > 1) {
|
||||
if (d->number_of_computers() > 1) {
|
||||
m.addAction(tr("Delete this dive computer"), this, &ProfileWidget2::deleteCurrentDC);
|
||||
m.addAction(tr("Split this dive computer into own dive"), this, &ProfileWidget2::splitCurrentDC);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ void QMLProfile::rotateDC(int dir)
|
|||
struct dive *d = divelog.dives.get_by_uniq_id(m_diveId);
|
||||
if (!d)
|
||||
return;
|
||||
int numDC = number_of_computers(d);
|
||||
int numDC = d->number_of_computers();
|
||||
if (numDC == 1)
|
||||
return;
|
||||
m_dc = (m_dc + dir) % numDC;
|
||||
|
|
@ -159,5 +159,5 @@ void QMLProfile::rotateDC(int dir)
|
|||
int QMLProfile::numDC() const
|
||||
{
|
||||
struct dive *d = divelog.dives.get_by_uniq_id(m_diveId);
|
||||
return d ? number_of_computers(d) : 0;
|
||||
return d ? d->number_of_computers() : 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue