Disable the Toolbox when in edit mode.

Some of the toolbox icons will trigger a recalculation of the dive,
triggering then a replot, that will copy the dive to the displayed_dive
again, but in the case of a edit this would discard the edition (
that would still be shown on the UI ) leaving the dive in an
unconsistent state.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-08-04 12:58:21 -03:00 committed by Dirk Hohndel
parent b32d22713c
commit e95fa6c6dc
3 changed files with 14 additions and 0 deletions

View file

@ -270,6 +270,7 @@ void MainTab::enableEdition(EditMode newEditMode)
return;
}
MainWindow::instance()->dive_list()->setEnabled(false);
MainWindow::instance()->setEnabledToolbar(false);
// only setup the globe for editing if we are editing exactly one existing dive
if (amount_selected == 1 && newEditMode != ADD)
@ -781,6 +782,7 @@ void MainTab::acceptChanges()
MainWindow::instance()->dive_list()->setFocus();
cylindersModel->changed = false;
weightModel->changed = false;
MainWindow::instance()->setEnabledToolbar(true);
}
void MainTab::resetPallete()
@ -845,6 +847,7 @@ void MainTab::rejectChanges()
MainWindow::instance()->globe()->reload();
// show the profile and dive info
MainWindow::instance()->graphics()->replot();
MainWindow::instance()->setEnabledToolbar(true);
cylindersModel->changed = false;
weightModel->changed = false;
cylindersModel->updateDive();

View file

@ -1286,3 +1286,13 @@ void MainWindow::on_actionExport_triggered()
DiveLogExportDialog diveLogExport;
diveLogExport.exec();
}
void MainWindow::setEnabledToolbar(bool arg1)
{
QList<QToolButton*> toolBar; toolBar << ui.profCalcAllTissues << ui.profCalcCeiling
<< ui.profDcCeiling << ui.profEad << ui.profHR << ui.profIncrement3m
<< ui.profMod << ui.profNdl_tts << ui.profNdl_tts << ui.profPhe << ui.profPn2
<< ui.profPO2 << ui.profRuler << ui.profSAC << ui.profScaled << ui.profTogglePicture;
Q_FOREACH(QToolButton *b, toolBar)
b->setEnabled(arg1);
}

View file

@ -156,6 +156,7 @@ slots:
void editCurrentDive();
void planCanceled();
void planCreated();
void setEnabledToolbar(bool arg1);
private:
Ui::MainWindow ui;