Disable edit dive site if already in edit mode

If user selected a new dive site (a dive site that doesn't
exists yet, to be created) and clicked in edit it would edit
the *old* dive site. this is not optimal, but since it
removes a severe regression it will be like this (I won't
change it till 5.0) for a while, until I have time to
actually code something not messy for that.

The current dive location management is *much* nicer than
the old one, code-wise. No more magic numbers, magic codepaths,
magic constants, qt black magic. It's straigth-forward code
simple to follow, simple to edit.

This was something I was actually postponing for 5.0 but I
managed to get a boost of subsurface time at work.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-09-23 17:11:43 -03:00 committed by Dirk Hohndel
parent 7426f18a96
commit 483320a0c0

View file

@ -55,7 +55,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui.extraData->setModel(extraDataModel);
closeMessage();
ui.editDiveSiteButton->setEnabled(true);
connect(ui.editDiveSiteButton, SIGNAL(clicked()), MainWindow::instance(), SIGNAL(startDiveSiteEdit()));
QAction *action = new QAction(tr("Apply changes"), this);
@ -331,6 +330,8 @@ void MainTab::enableEdition(EditMode newEditMode)
MainWindow::instance()->editCurrentDive();
return;
}
ui.editDiveSiteButton->setEnabled(false);
MainWindow::instance()->dive_list()->setEnabled(false);
MainWindow::instance()->setEnabledToolbar(false);
@ -1105,6 +1106,7 @@ void MainTab::acceptChanges()
weightModel->changed = false;
MainWindow::instance()->setEnabledToolbar(true);
acceptingEdit = false;
ui.editDiveSiteButton->setEnabled(true);
}
void MainTab::resetPallete()
@ -1177,6 +1179,7 @@ void MainTab::rejectChanges()
cylindersModel->updateDive();
weightModel->updateDive();
extraDataModel->updateDive();
ui.editDiveSiteButton->setEnabled(true);
}
#undef EDIT_TEXT2