diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index d5fa59235..c426d753a 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -398,8 +398,9 @@ void MainWindow::refreshDisplay() ui.actionAutoGroup->setChecked(autogroup); } -void MainWindow::configureToolbar() +void MainWindow::plotCurrentDive() { + setEnabledToolbar(current_dive != nullptr); if (current_dive) { bool freeDiveMode = current_dive->dc.divemode == FREEDIVE; ui.profCalcCeiling->setDisabled(freeDiveMode); @@ -423,21 +424,14 @@ void MainWindow::configureToolbar() ui.profTogglePicture->setDisabled(false); ui.profHR->setDisabled(false); } -} - -void MainWindow::plotCurrentDive() -{ - setEnabledToolbar(current_dive != nullptr); graphics->plotDive(current_dive, dc_number); } void MainWindow::selectionChanged() { mainTab->updateDiveInfo(); - if (current_dive) { - configureToolbar(); + if (current_dive) enableDisableOtherDCsActions(); - } plotCurrentDive(); MapWidget::instance()->selectionChanged(); } @@ -741,7 +735,6 @@ bool MainWindow::plannerStateClean() void MainWindow::refreshProfile() { showProfile(); - configureToolbar(); plotCurrentDive(); } @@ -926,7 +919,6 @@ void MainWindow::on_actionPreviousDC_triggered() { unsigned nrdc = number_of_computers(current_dive); dc_number = (dc_number + nrdc - 1) % nrdc; - configureToolbar(); plotCurrentDive(); mainTab->updateDiveInfo(); } @@ -935,7 +927,6 @@ void MainWindow::on_actionNextDC_triggered() { unsigned nrdc = number_of_computers(current_dive); dc_number = (dc_number + 1) % nrdc; - configureToolbar(); plotCurrentDive(); mainTab->updateDiveInfo(); } diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index 1675415e3..a1c3a646e 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -201,7 +201,6 @@ private: std::unique_ptr diveSiteEdit; bool plannerStateClean(); - void configureToolbar(); void setupSocialNetworkMenu(); QDialog *findMovedImagesDialog; struct dive copyPasteDive;