desktop: fold configureToolBar() into plotCurrentDive()

The MainWindow::configureToolBar() function is called every
time plotCurrentDive() is called. Moreover, this is the only
time that it is called. We might just fold the former into
the latter.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-04-12 22:20:46 +02:00 committed by Dirk Hohndel
parent c466a8f044
commit 6b615ccb4b
2 changed files with 3 additions and 13 deletions

View file

@ -398,8 +398,9 @@ void MainWindow::refreshDisplay()
ui.actionAutoGroup->setChecked(autogroup); ui.actionAutoGroup->setChecked(autogroup);
} }
void MainWindow::configureToolbar() void MainWindow::plotCurrentDive()
{ {
setEnabledToolbar(current_dive != nullptr);
if (current_dive) { if (current_dive) {
bool freeDiveMode = current_dive->dc.divemode == FREEDIVE; bool freeDiveMode = current_dive->dc.divemode == FREEDIVE;
ui.profCalcCeiling->setDisabled(freeDiveMode); ui.profCalcCeiling->setDisabled(freeDiveMode);
@ -423,21 +424,14 @@ void MainWindow::configureToolbar()
ui.profTogglePicture->setDisabled(false); ui.profTogglePicture->setDisabled(false);
ui.profHR->setDisabled(false); ui.profHR->setDisabled(false);
} }
}
void MainWindow::plotCurrentDive()
{
setEnabledToolbar(current_dive != nullptr);
graphics->plotDive(current_dive, dc_number); graphics->plotDive(current_dive, dc_number);
} }
void MainWindow::selectionChanged() void MainWindow::selectionChanged()
{ {
mainTab->updateDiveInfo(); mainTab->updateDiveInfo();
if (current_dive) { if (current_dive)
configureToolbar();
enableDisableOtherDCsActions(); enableDisableOtherDCsActions();
}
plotCurrentDive(); plotCurrentDive();
MapWidget::instance()->selectionChanged(); MapWidget::instance()->selectionChanged();
} }
@ -741,7 +735,6 @@ bool MainWindow::plannerStateClean()
void MainWindow::refreshProfile() void MainWindow::refreshProfile()
{ {
showProfile(); showProfile();
configureToolbar();
plotCurrentDive(); plotCurrentDive();
} }
@ -926,7 +919,6 @@ void MainWindow::on_actionPreviousDC_triggered()
{ {
unsigned nrdc = number_of_computers(current_dive); unsigned nrdc = number_of_computers(current_dive);
dc_number = (dc_number + nrdc - 1) % nrdc; dc_number = (dc_number + nrdc - 1) % nrdc;
configureToolbar();
plotCurrentDive(); plotCurrentDive();
mainTab->updateDiveInfo(); mainTab->updateDiveInfo();
} }
@ -935,7 +927,6 @@ void MainWindow::on_actionNextDC_triggered()
{ {
unsigned nrdc = number_of_computers(current_dive); unsigned nrdc = number_of_computers(current_dive);
dc_number = (dc_number + 1) % nrdc; dc_number = (dc_number + 1) % nrdc;
configureToolbar();
plotCurrentDive(); plotCurrentDive();
mainTab->updateDiveInfo(); mainTab->updateDiveInfo();
} }

View file

@ -201,7 +201,6 @@ private:
std::unique_ptr<LocationInformationWidget> diveSiteEdit; std::unique_ptr<LocationInformationWidget> diveSiteEdit;
bool plannerStateClean(); bool plannerStateClean();
void configureToolbar();
void setupSocialNetworkMenu(); void setupSocialNetworkMenu();
QDialog *findMovedImagesDialog; QDialog *findMovedImagesDialog;
struct dive copyPasteDive; struct dive copyPasteDive;