mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: remove count_divecomputers() function
There is a number_of_computers() function which does the same thing with two exceptions: 1) checks for null-dive 2) returns an unsigned int Replace calls to count_divecomputers() by calls to number_of_computers(). In one case, the return type makes a different - add a cast to int there. Ultimately, we should probably change the dc_number to signed int throughout the code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
0424ee8996
commit
048cdcaa31
4 changed files with 4 additions and 16 deletions
|
@ -1436,13 +1436,13 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
|
|||
parentItem = parentItem->parentItem();
|
||||
}
|
||||
if (isDCName) {
|
||||
if (dc_number == 0 && count_divecomputers(current_dive) == 1)
|
||||
if (dc_number == 0 && number_of_computers(current_dive) == 1)
|
||||
// nothing to do, can't delete or reorder
|
||||
return;
|
||||
// create menu to show when right clicking on dive computer name
|
||||
if (dc_number > 0)
|
||||
m.addAction(tr("Make first dive computer"), this, &ProfileWidget2::makeFirstDC);
|
||||
if (count_divecomputers(current_dive) > 1) {
|
||||
if (number_of_computers(current_dive) > 1) {
|
||||
m.addAction(tr("Delete this dive computer"), this, &ProfileWidget2::deleteCurrentDC);
|
||||
m.addAction(tr("Split this dive computer into own dive"), this, &ProfileWidget2::splitCurrentDC);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue