mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
8695d8bdb1
commit
3242fbdc45
1 changed files with 9 additions and 4 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue