desktop: add tab-widget for dive computer names

If we want to include dive computer names in the undo system,
there should be visual feedback on undo/redo.

This would mean opening the divecomputer dialog, which would
appear quite strange. Therefore, add a tab. This is not ideal,
but consistent with the dive site tab, which probably shouldn't
be there either. In the future, the UI needs some rethinking.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-09-12 23:31:46 +02:00 committed by Dirk Hohndel
parent faebb53909
commit fa7dfa3710
8 changed files with 103 additions and 4 deletions

View file

@ -34,6 +34,7 @@
#include "TabDivePhotos.h"
#include "TabDiveStatistics.h"
#include "TabDiveSite.h"
#include "TabDiveComputer.h"
#include <QCompleter>
#include <QSettings>
@ -71,6 +72,8 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui.tabWidget->addTab(extraWidgets.last(), tr("Extra Info"));
extraWidgets << new TabDiveSite(this);
ui.tabWidget->addTab(extraWidgets.last(), tr("Dive sites"));
extraWidgets << new TabDiveComputer(this);
ui.tabWidget->addTab(extraWidgets.last(), tr("Device names"));
updateDateTimeFields();
@ -348,11 +351,12 @@ void MainTab::updateDiveInfo()
if (editMode || MainWindow::instance()->graphics->isPlanner())
return;
// 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!
// If there is no current dive, disable all widgets except the last two,
// which are the dive site tab and the dive computer tabs.
// TODO: Conceptually, these two shouldn't even be a tabs here!
bool enabled = current_dive != nullptr;
ui.notesTab->setEnabled(enabled);
for (int i = 0; i < extraWidgets.size() - 1; ++i)
for (int i = 0; i < extraWidgets.size() - 2; ++i)
extraWidgets[i]->setEnabled(enabled);
ignoreInput = true; // don't trigger on changes to the widgets