summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2018-09-14 16:48:51 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-15 15:51:26 -0700
commit00ef514da387b63311a6d02afc2e0cf9bdf9d05c (patch)
treeee93594bf2312c2635d76caee7cb335cecf708d3 /desktop-widgets/mainwindow.cpp
parent6d552d61b941dbc3a018ba46afdf27812bee2073 (diff)
downloadsubsurface-00ef514da387b63311a6d02afc2e0cf9bdf9d05c.tar.gz
code cleanup: pre-calculate the test and pass it directly
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r--desktop-widgets/mainwindow.cpp59
1 files changed, 21 insertions, 38 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 944a41a6f..a524d56cc 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -503,44 +503,27 @@ void MainWindow::recreateDiveList()
}
void MainWindow::configureToolbar() {
- if (selected_dive>0) {
- if (current_dive->dc.divemode == FREEDIVE) {
- ui.profCalcCeiling->setDisabled(true);
- ui.profCalcAllTissues ->setDisabled(true);
- ui.profIncrement3m->setDisabled(true);
- ui.profDcCeiling->setDisabled(true);
- ui.profPhe->setDisabled(true);
- ui.profPn2->setDisabled(true); //TODO is the same as scuba?
- ui.profPO2->setDisabled(true); //TODO is the same as scuba?
- ui.profRuler->setDisabled(false);
- ui.profScaled->setDisabled(false); // measuring and scaling
- ui.profTogglePicture->setDisabled(false);
- ui.profTankbar->setDisabled(true);
- ui.profMod->setDisabled(true);
- ui.profNdl_tts->setDisabled(true);
- ui.profEad->setDisabled(true);
- ui.profSAC->setDisabled(true);
- ui.profHR->setDisabled(false);
- ui.profTissues->setDisabled(true);
- } else {
- ui.profCalcCeiling->setDisabled(false);
- ui.profCalcAllTissues ->setDisabled(false);
- ui.profIncrement3m->setDisabled(false);
- ui.profDcCeiling->setDisabled(false);
- ui.profPhe->setDisabled(false);
- ui.profPn2->setDisabled(false);
- ui.profPO2->setDisabled(false); // partial pressure graphs
- ui.profRuler->setDisabled(false);
- ui.profScaled->setDisabled(false); // measuring and scaling
- ui.profTogglePicture->setDisabled(false);
- ui.profTankbar->setDisabled(false);
- ui.profMod->setDisabled(false);
- ui.profNdl_tts->setDisabled(false); // various values that a user is either interested in or not
- ui.profEad->setDisabled(false);
- ui.profSAC->setDisabled(false);
- ui.profHR->setDisabled(false); // very few dive computers support this
- ui.profTissues->setDisabled(false);; // maybe less frequently used
- }
+ if (selected_dive > 0) {
+ bool freeDiveMode = current_dive->dc.divemode == FREEDIVE;
+ ui.profCalcCeiling->setDisabled(freeDiveMode);
+ ui.profCalcCeiling->setDisabled(freeDiveMode);
+ ui.profCalcAllTissues ->setDisabled(freeDiveMode);
+ ui.profIncrement3m->setDisabled(freeDiveMode);
+ ui.profDcCeiling->setDisabled(freeDiveMode);
+ ui.profPhe->setDisabled(freeDiveMode);
+ ui.profPn2->setDisabled(freeDiveMode); //TODO is the same as scuba?
+ ui.profPO2->setDisabled(freeDiveMode); //TODO is the same as scuba?
+ ui.profTankbar->setDisabled(freeDiveMode);
+ ui.profMod->setDisabled(freeDiveMode);
+ ui.profNdl_tts->setDisabled(freeDiveMode);
+ ui.profEad->setDisabled(freeDiveMode);
+ ui.profSAC->setDisabled(freeDiveMode);
+ ui.profTissues->setDisabled(freeDiveMode);
+
+ ui.profRuler->setDisabled(false);
+ ui.profScaled->setDisabled(false); // measuring and scaling
+ ui.profTogglePicture->setDisabled(false);
+ ui.profHR->setDisabled(false);
}
}