mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: remove [disable|enable]Shortcuts() signals
When switching to the "plan" or "add" (which should rather be called "edit", by the way) mode of the profile, the "shortcuts" for copy&paste, undo&redo, etc. are disabled. When switching to "profile" mode, they are reenabled. This was done in a most convoluted way: - The MainWindow calls the set*State() function of the profile. - The Profile emits [disable|enable]Shortcuts() signals. - The MainWindow catches these signals and does the enabling or disabling. Not only is this very hard to reason about, it is also in contradiction to the profile being part of the display layer. Moreover, in editCurrentDive() the MainWindow disabled the shortcuts itself, so this was all redundant. For the sake of sanity, let's just move this logic to the MainWindow, unslotify the [disable|enable]Shortcuts() functions and make them private. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
11c54b85f6
commit
4daf687876
4 changed files with 5 additions and 11 deletions
|
@ -297,8 +297,6 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
|
||||
// now let's set up some connections
|
||||
connect(graphics, &ProfileWidget2::enableToolbar ,this, &MainWindow::setEnabledToolbar);
|
||||
connect(graphics, &ProfileWidget2::disableShortcuts, this, &MainWindow::disableShortcuts);
|
||||
connect(graphics, &ProfileWidget2::enableShortcuts, this, &MainWindow::enableShortcuts);
|
||||
connect(graphics, &ProfileWidget2::editCurrentDive, this, &MainWindow::editCurrentDive);
|
||||
|
||||
connect(&diveListNotifier, &DiveListNotifier::settingsChanged, graphics, &ProfileWidget2::settingsChanged);
|
||||
|
@ -771,6 +769,7 @@ void MainWindow::on_actionReplanDive_triggered()
|
|||
// put us in PLAN mode
|
||||
setApplicationState(ApplicationState::PlanDive);
|
||||
|
||||
disableShortcuts(true);
|
||||
graphics->setPlanState(&displayed_dive, 0);
|
||||
plannerWidgets->replanDive();
|
||||
}
|
||||
|
@ -783,6 +782,7 @@ void MainWindow::on_actionDivePlanner_triggered()
|
|||
// put us in PLAN mode
|
||||
setApplicationState(ApplicationState::PlanDive);
|
||||
|
||||
disableShortcuts(true);
|
||||
graphics->setPlanState(&displayed_dive, 0);
|
||||
plannerWidgets->planDive();
|
||||
}
|
||||
|
@ -1515,7 +1515,7 @@ void MainWindow::editCurrentDive()
|
|||
if (mainTab->isEditing() || DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING)
|
||||
return;
|
||||
|
||||
disableShortcuts();
|
||||
disableShortcuts(false);
|
||||
copy_dive(current_dive, &displayed_dive); // Work on a copy of the dive
|
||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD);
|
||||
DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue