aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-04-09 22:28:54 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-04-10 14:15:35 -0700
commit8939b6a99bbcc2db335d557df802e31b8a310aec (patch)
tree20e78e288148b5983130e61bcbaf919ed90c7def /desktop-widgets/mainwindow.cpp
parent8c72ac6b9b00778e03dd60fe30bf4ba53d87ab55 (diff)
downloadsubsurface-8939b6a99bbcc2db335d557df802e31b8a310aec.tar.gz
profile: remove enableToolbar() signal
When showing the "empty-state", the profile toolbar was disabled. This was done via a "reverse" signal from the profile to the MainWindow. Instead control the toolbar in the MainWindow directly. Break out the plot-dive functionality into a member function and there test whether a dive is shown or not. The signal makes no sense in the context of mobile or printing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r--desktop-widgets/mainwindow.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 900c1f7ae..197c54bdd 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -223,6 +223,7 @@ MainWindow::MainWindow() : QMainWindow(),
enableDisableCloudActions();
ui.mainErrorMessage->hide();
+ setEnabledToolbar(false);
graphics->setEmptyState();
initialUiSetup();
readSettings();
@@ -295,8 +296,6 @@ MainWindow::MainWindow() : QMainWindow(),
connect(ui.profPn2, &QAction::triggered, pp_gas, &qPrefPartialPressureGas::set_pn2);
connect(ui.profPO2, &QAction::triggered, pp_gas, &qPrefPartialPressureGas::set_po2);
- // now let's set up some connections
- connect(graphics, &ProfileWidget2::enableToolbar ,this, &MainWindow::setEnabledToolbar);
connect(graphics, &ProfileWidget2::editCurrentDive, this, &MainWindow::editCurrentDive);
connect(&diveListNotifier, &DiveListNotifier::settingsChanged, graphics, &ProfileWidget2::settingsChanged);
@@ -425,6 +424,12 @@ void MainWindow::configureToolbar()
}
}
+void MainWindow::plotCurrentDive()
+{
+ setEnabledToolbar(current_dive != nullptr);
+ graphics->plotDive(current_dive, dc_number);
+}
+
void MainWindow::selectionChanged()
{
mainTab->updateDiveInfo();
@@ -432,7 +437,7 @@ void MainWindow::selectionChanged()
configureToolbar();
enableDisableOtherDCsActions();
}
- graphics->plotDive(current_dive, dc_number);
+ plotCurrentDive();
MapWidget::instance()->selectionChanged();
}
@@ -736,7 +741,7 @@ void MainWindow::refreshProfile()
{
showProfile();
configureToolbar();
- graphics->plotDive(current_dive, dc_number);
+ plotCurrentDive();
}
void MainWindow::planCanceled()
@@ -921,7 +926,7 @@ void MainWindow::on_actionPreviousDC_triggered()
unsigned nrdc = number_of_computers(current_dive);
dc_number = (dc_number + nrdc - 1) % nrdc;
configureToolbar();
- graphics->plotDive(current_dive, dc_number);
+ plotCurrentDive();
mainTab->updateDiveInfo();
}
@@ -930,7 +935,7 @@ void MainWindow::on_actionNextDC_triggered()
unsigned nrdc = number_of_computers(current_dive);
dc_number = (dc_number + 1) % nrdc;
configureToolbar();
- graphics->plotDive(current_dive, dc_number);
+ plotCurrentDive();
mainTab->updateDiveInfo();
}