diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-04-12 20:33:43 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-13 09:06:34 +1200 |
commit | 3242fbdc4525349058be719de7a8e19c8aaf7214 (patch) | |
tree | 6c6243f455e40f0ac4a2c32bb91f63c9a8b6c4e9 /desktop-widgets/tab-widgets/maintab.cpp | |
parent | 8695d8bdb15f52fdfa1a5df1da83b18c4486a9d8 (diff) | |
download | subsurface-3242fbdc4525349058be719de7a8e19c8aaf7214.tar.gz |
Dive sites: dont't disable all tabs when creating new dive site
The dive tabs are disabled, when no dive is shown. The dive site tab
is implemented as a dive tab, which is of course conceptually wrong.
Moreover it has the nasty side effect that when adding an empty dive
site, no dives are shown and the tab is disabled, leading to a
UI dead lock.
Therefore, disable all tabs but the dive site tab. The proper fix
will be a refactoring of the UI.
Reported-by: Doug Junkins <junkins@foghead.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/tab-widgets/maintab.cpp')
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 0f0a2a84b..7dda4c0e7 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -491,10 +491,15 @@ void MainTab::updateDiveInfo() // don't execute this while adding / planning a dive if (editMode == MANUALLY_ADDED_DIVE || MainWindow::instance()->graphics->isPlanner()) return; - if (!isEnabled() && current_dive) - setEnabled(true); - if (isEnabled() && !current_dive) - setEnabled(false); + + // If there is no current dive, disable all widgets except the last, which is the dive site tab. + // TODO: Conceptually, the dive site tab shouldn't even be a tab here! + bool enabled = current_dive != nullptr; + ui.equipmentTab->setEnabled(enabled); + ui.notesTab->setEnabled(enabled); + for (int i = 0; i < extraWidgets.size() - 1; ++i) + extraWidgets[i]->setEnabled(enabled); + editMode = IGNORE; // don't trigger on changes to the widgets for (auto widget : extraWidgets) { |