aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-08-04 12:58:21 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-04 09:48:35 -0700
commite95fa6c6dc0940bc62073b3c7c8e145933069883 (patch)
tree32d4b30992d146f34033a69fec75fee50bb71649 /qt-ui
parentb32d22713cd99ea08a63d7ce7526db9225835c05 (diff)
downloadsubsurface-e95fa6c6dc0940bc62073b3c7c8e145933069883.tar.gz
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>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/maintab.cpp3
-rw-r--r--qt-ui/mainwindow.cpp10
-rw-r--r--qt-ui/mainwindow.h1
3 files changed, 14 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 5a6f7b537..652e8242e 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -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();
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index aa9d8c145..1a4594bab 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -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);
+}
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 6b53babbd..5c0ec8efa 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -156,6 +156,7 @@ slots:
void editCurrentDive();
void planCanceled();
void planCreated();
+ void setEnabledToolbar(bool arg1);
private:
Ui::MainWindow ui;