diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-03-02 16:03:32 +0100 |
---|---|---|
committer | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-07 00:13:35 +0200 |
commit | 13d339451ed9aa13588a452e19bdd59134107155 (patch) | |
tree | c3c656c6ad0f306004a0b132efebda1420ac2afb | |
parent | accf1fcc8f6ad84a662aeba71d582abedbcedfd8 (diff) | |
download | subsurface-13d339451ed9aa13588a452e19bdd59134107155.tar.gz |
cleanup: remove parameter to MainTab::enableEdition
All remaining callers were passing MANUALLY_ADDED_DIVE as a new
mode, so we may just as well remove the parameter and thus
simplify the logic.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 4 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.cpp | 6 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.h | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 7796ddf04..1c122a4fd 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -1767,13 +1767,13 @@ void MainWindow::editCurrentDive() graphics->setAddState(); setApplicationState(ApplicationState::EditDive); DivePlannerPointsModel::instance()->loadFromDive(d); - mainTab->enableEdition(MainTab::MANUALLY_ADDED_DIVE); + mainTab->enableEdition(); } else if (defaultDC == "planned dive") { disableShortcuts(); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN); setApplicationState(ApplicationState::EditPlannedDive); DivePlannerPointsModel::instance()->loadFromDive(d); - mainTab->enableEdition(MainTab::MANUALLY_ADDED_DIVE); + mainTab->enableEdition(); } } diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 14db8ae28..eaf19b7db 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -206,9 +206,9 @@ void MainTab::displayMessage(QString str) ui.diveNotesMessage->animatedShow(); } -void MainTab::enableEdition(EditMode newEditMode) +void MainTab::enableEdition() { - if (((newEditMode == DIVE || newEditMode == NONE) && current_dive == NULL) || editMode != NONE) + if (current_dive == NULL || editMode != NONE) return; ui.editDiveSiteButton->setEnabled(false); @@ -218,7 +218,7 @@ void MainTab::enableEdition(EditMode newEditMode) ui.dateEdit->setEnabled(true); displayMessage(tr("This dive is being edited.")); - editMode = newEditMode != NONE ? newEditMode : DIVE; + editMode = MANUALLY_ADDED_DIVE; } // This function gets called if a field gets updated by an undo command. diff --git a/desktop-widgets/tab-widgets/maintab.h b/desktop-widgets/tab-widgets/maintab.h index 6411f6b3a..2524ed2a7 100644 --- a/desktop-widgets/tab-widgets/maintab.h +++ b/desktop-widgets/tab-widgets/maintab.h @@ -72,7 +72,7 @@ slots: void closeMessage(); void closeWarning(); void displayMessage(QString str); - void enableEdition(EditMode newEditMode = NONE); + void enableEdition(); void escDetected(void); private: Ui::MainTab ui; |