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);
}
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();
}

View file

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