mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:03:23 +00:00
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>
This commit is contained in:
parent
8c72ac6b9b
commit
8939b6a99b
4 changed files with 12 additions and 9 deletions
|
@ -223,6 +223,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
enableDisableCloudActions();
|
enableDisableCloudActions();
|
||||||
|
|
||||||
ui.mainErrorMessage->hide();
|
ui.mainErrorMessage->hide();
|
||||||
|
setEnabledToolbar(false);
|
||||||
graphics->setEmptyState();
|
graphics->setEmptyState();
|
||||||
initialUiSetup();
|
initialUiSetup();
|
||||||
readSettings();
|
readSettings();
|
||||||
|
@ -295,8 +296,6 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
connect(ui.profPn2, &QAction::triggered, pp_gas, &qPrefPartialPressureGas::set_pn2);
|
connect(ui.profPn2, &QAction::triggered, pp_gas, &qPrefPartialPressureGas::set_pn2);
|
||||||
connect(ui.profPO2, &QAction::triggered, pp_gas, &qPrefPartialPressureGas::set_po2);
|
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(graphics, &ProfileWidget2::editCurrentDive, this, &MainWindow::editCurrentDive);
|
||||||
|
|
||||||
connect(&diveListNotifier, &DiveListNotifier::settingsChanged, graphics, &ProfileWidget2::settingsChanged);
|
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()
|
void MainWindow::selectionChanged()
|
||||||
{
|
{
|
||||||
mainTab->updateDiveInfo();
|
mainTab->updateDiveInfo();
|
||||||
|
@ -432,7 +437,7 @@ void MainWindow::selectionChanged()
|
||||||
configureToolbar();
|
configureToolbar();
|
||||||
enableDisableOtherDCsActions();
|
enableDisableOtherDCsActions();
|
||||||
}
|
}
|
||||||
graphics->plotDive(current_dive, dc_number);
|
plotCurrentDive();
|
||||||
MapWidget::instance()->selectionChanged();
|
MapWidget::instance()->selectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,7 +741,7 @@ void MainWindow::refreshProfile()
|
||||||
{
|
{
|
||||||
showProfile();
|
showProfile();
|
||||||
configureToolbar();
|
configureToolbar();
|
||||||
graphics->plotDive(current_dive, dc_number);
|
plotCurrentDive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::planCanceled()
|
void MainWindow::planCanceled()
|
||||||
|
@ -921,7 +926,7 @@ 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();
|
configureToolbar();
|
||||||
graphics->plotDive(current_dive, dc_number);
|
plotCurrentDive();
|
||||||
mainTab->updateDiveInfo();
|
mainTab->updateDiveInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -930,7 +935,7 @@ 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();
|
configureToolbar();
|
||||||
graphics->plotDive(current_dive, dc_number);
|
plotCurrentDive();
|
||||||
mainTab->updateDiveInfo();
|
mainTab->updateDiveInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,6 +236,7 @@ private:
|
||||||
void setQuadrantWidgets(QSplitter &splitter, const Quadrant &left, const Quadrant &right);
|
void setQuadrantWidgets(QSplitter &splitter, const Quadrant &left, const Quadrant &right);
|
||||||
void registerApplicationState(ApplicationState state, Quadrants q);
|
void registerApplicationState(ApplicationState state, Quadrants q);
|
||||||
void disableShortcuts(bool disablePaste = true);
|
void disableShortcuts(bool disablePaste = true);
|
||||||
|
void plotCurrentDive();
|
||||||
void enableShortcuts();
|
void enableShortcuts();
|
||||||
|
|
||||||
QMenu *connections;
|
QMenu *connections;
|
||||||
|
|
|
@ -1064,7 +1064,6 @@ void ProfileWidget2::setEmptyState()
|
||||||
setBackgroundBrush(getColor(::BACKGROUND, isGrayscale));
|
setBackgroundBrush(getColor(::BACKGROUND, isGrayscale));
|
||||||
dataModel->clear();
|
dataModel->clear();
|
||||||
currentState = EMPTY;
|
currentState = EMPTY;
|
||||||
emit enableToolbar(false);
|
|
||||||
|
|
||||||
fixBackgroundPos();
|
fixBackgroundPos();
|
||||||
background->setVisible(true);
|
background->setVisible(true);
|
||||||
|
@ -1128,7 +1127,6 @@ void ProfileWidget2::setProfileState()
|
||||||
/* show the same stuff that the profile shows. */
|
/* show the same stuff that the profile shows. */
|
||||||
|
|
||||||
currentState = PROFILE;
|
currentState = PROFILE;
|
||||||
emit enableToolbar(true);
|
|
||||||
setBackgroundBrush(getColor(::BACKGROUND, isGrayscale));
|
setBackgroundBrush(getColor(::BACKGROUND, isGrayscale));
|
||||||
|
|
||||||
background->setVisible(false);
|
background->setVisible(false);
|
||||||
|
|
|
@ -99,7 +99,6 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void fontPrintScaleChanged(double scale);
|
void fontPrintScaleChanged(double scale);
|
||||||
void enableToolbar(bool enable);
|
|
||||||
void editCurrentDive();
|
void editCurrentDive();
|
||||||
|
|
||||||
public
|
public
|
||||||
|
|
Loading…
Add table
Reference in a new issue