diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-09-22 08:19:05 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-09-22 08:20:03 -0700 |
commit | 3335f083bffdafdea75b3782873621d5beb77ec3 (patch) | |
tree | e064a65536367be632fad86c4457a5137d19a3e5 /qt-ui | |
parent | 88fb82411ee142a3ce688ad0c96d4ac73cb89b59 (diff) | |
download | subsurface-3335f083bffdafdea75b3782873621d5beb77ec3.tar.gz |
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>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/maintab.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
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. |