mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
core: remove current_dc macro
There were only three users of that. For now do it inline, but we may think about a separate function, which is only available on desktop. Moreover, add nullptr-checks, even if they are not strictly necessary. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5b4d4813f2
commit
d5fafc0e44
3 changed files with 10 additions and 5 deletions
|
@ -115,7 +115,6 @@ extern bool autogroup;
|
|||
extern struct dive displayed_dive;
|
||||
extern unsigned int dc_number;
|
||||
extern struct dive *current_dive;
|
||||
#define current_dc (get_dive_dc(current_dive, dc_number))
|
||||
|
||||
extern struct dive *get_dive(int nr);
|
||||
extern struct dive *get_dive_from_table(int nr, const struct dive_table *dt);
|
||||
|
|
|
@ -20,7 +20,9 @@ TabDiveExtraInfo::~TabDiveExtraInfo()
|
|||
|
||||
void TabDiveExtraInfo::updateData()
|
||||
{
|
||||
extraDataModel->updateDiveComputer(current_dc);
|
||||
const struct divecomputer *currentdc = get_dive_dc(current_dive, dc_number);
|
||||
if (currentdc)
|
||||
extraDataModel->updateDiveComputer(currentdc);
|
||||
}
|
||||
|
||||
void TabDiveExtraInfo::clear()
|
||||
|
|
|
@ -181,9 +181,10 @@ int TabDiveInformation::updateSalinityComboIndex(int salinity)
|
|||
// If dive->user_salinity != dive->salinity (i.e. dc value) then show the salinity-overwrite indicator
|
||||
void TabDiveInformation::checkDcSalinityOverWritten()
|
||||
{
|
||||
if (!current_dive)
|
||||
const struct divecomputer *currentdc = get_dive_dc(current_dive, dc_number);
|
||||
if (!current_dive || !currentdc)
|
||||
return;
|
||||
int dc_value = current_dc->salinity;
|
||||
int dc_value = currentdc->salinity;
|
||||
int user_value = current_dive->user_salinity;
|
||||
bool show_indicator = false;
|
||||
if (!manualDive && user_value != 0 && user_value != dc_value)
|
||||
|
@ -262,7 +263,10 @@ void TabDiveInformation::on_waterTypeCombo_activated(int index)
|
|||
{
|
||||
Q_UNUSED(index)
|
||||
int combobox_salinity = 0;
|
||||
int dc_salinity = current_dc->salinity;
|
||||
const struct divecomputer *currentdc = get_dive_dc(current_dive, dc_number);
|
||||
if (!currentdc)
|
||||
return;
|
||||
int dc_salinity = currentdc->salinity;
|
||||
switch(ui->waterTypeCombo->currentIndex()) {
|
||||
case FRESHWATER:
|
||||
combobox_salinity = FRESHWATER_SALINITY;
|
||||
|
|
Loading…
Reference in a new issue