mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 19:53:24 +00:00
profile: set profile-mode in ProfileWidget, not MainWindow
The mode of the profile (profile, edit, plan) was set in MainWindow and ProfileWidget. For consistency move the one setProfileState() call from MainWindow to ProfileWidget. This removes a direct access to the profile-view and therefore improves encapsulation. Also, clear the profile, when no dive is shown to remove any potentially dangling references. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
12fd102e4f
commit
f8fbff9f7d
2 changed files with 3 additions and 2 deletions
|
@ -577,7 +577,7 @@ void MainWindow::enableShortcuts()
|
|||
void MainWindow::showProfile()
|
||||
{
|
||||
enableShortcuts();
|
||||
profile->view->setProfileState(current_dive, dc_number);
|
||||
profile->plotCurrentDive();
|
||||
setApplicationState(ApplicationState::Default);
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,6 @@ bool MainWindow::plannerStateClean()
|
|||
void MainWindow::refreshProfile()
|
||||
{
|
||||
showProfile();
|
||||
profile->plotCurrentDive();
|
||||
}
|
||||
|
||||
void MainWindow::planCanceled()
|
||||
|
|
|
@ -197,8 +197,10 @@ void ProfileWidget::plotCurrentDive()
|
|||
ui.profScaled->setDisabled(false); // measuring and scaling
|
||||
ui.profTogglePicture->setDisabled(false);
|
||||
ui.profHR->setDisabled(false);
|
||||
view->setProfileState(current_dive, dc_number);
|
||||
view->plotDive(current_dive, dc_number);
|
||||
} else {
|
||||
view->clear();
|
||||
stack->setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue