From 3335f083bffdafdea75b3782873621d5beb77ec3 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 22 Sep 2013 08:19:05 -0700 Subject: 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 --- qt-ui/maintab.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'qt-ui/maintab.cpp') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 406e09a50..329e5eeeb 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -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. -- cgit v1.2.3-70-g09d2