Disable the info widget when no dive is selected

This solves the odd case when closing the data file that clicking in the
info widget caused the input fields to respond and the little warning icon
to show up.

Also some minor whitespace cleanup for readability.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-09-22 08:19:05 -07:00
parent 88fb82411e
commit 3335f083bf

View file

@ -202,24 +202,25 @@ void MainTab::clearStats()
ui->timeLimits->clear();
}
#define UPDATE_TEXT(d, field) \
#define UPDATE_TEXT(d, field) \
if (!d || !d->field) \
ui->field->setText(""); \
else \
else \
ui->field->setText(d->field)
#define UPDATE_TEMP(d, field) \
if (!d || d->field.mkelvin == 0) \
#define UPDATE_TEMP(d, field) \
if (!d || d->field.mkelvin == 0) \
ui->field->setText(""); \
else \
ui->field->setText(get_temperature_string(d->field, TRUE));
else \
ui->field->setText(get_temperature_string(d->field, TRUE))
void MainTab::updateDiveInfo(int dive)
{
if(!isEnabled() && dive != -1)
if (!isEnabled() && dive != -1)
setEnabled(true);
if (isEnabled() && dive == -1)
setEnabled(false);
editMode = NONE;
// This method updates ALL tabs whenever a new dive or trip is
// selected.