diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-04-09 21:51:42 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-04-10 14:15:35 -0700 |
commit | 4daf6878768fabb2db15fae4e202aacc47676dee (patch) | |
tree | 9921ac704c9275d24a74c932be69733ed8ad56a0 /profile-widget | |
parent | 11c54b85f6f6c567e5a9f6e6e537eace49ee6666 (diff) | |
download | subsurface-4daf6878768fabb2db15fae4e202aacc47676dee.tar.gz |
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>
Diffstat (limited to 'profile-widget')
-rw-r--r-- | profile-widget/profilewidget2.cpp | 4 | ||||
-rw-r--r-- | profile-widget/profilewidget2.h | 2 |
2 files changed, 0 insertions, 6 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index ea09ad040..8e71c391a 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -1127,8 +1127,6 @@ void ProfileWidget2::setProfileState() disconnectTemporaryConnections(); /* show the same stuff that the profile shows. */ - emit enableShortcuts(); - currentState = PROFILE; emit enableToolbar(true); setBackgroundBrush(getColor(::BACKGROUND, isGrayscale)); @@ -1279,7 +1277,6 @@ void ProfileWidget2::setAddState(const dive *d, int dc) mouseFollowerHorizontal->setLine(timeAxis->line()); mouseFollowerVertical->setLine(QLineF(0, profileYAxis->pos().y(), 0, timeAxis->pos().y())); disconnectTemporaryConnections(); - emit disableShortcuts(false); actionsForKeys[Qt::Key_Left]->setShortcut(Qt::Key_Left); actionsForKeys[Qt::Key_Right]->setShortcut(Qt::Key_Right); actionsForKeys[Qt::Key_Up]->setShortcut(Qt::Key_Up); @@ -1310,7 +1307,6 @@ void ProfileWidget2::setPlanState(const dive *d, int dc) mouseFollowerHorizontal->setLine(timeAxis->line()); mouseFollowerVertical->setLine(QLineF(0, profileYAxis->pos().y(), 0, timeAxis->pos().y())); disconnectTemporaryConnections(); - emit disableShortcuts(true); actionsForKeys[Qt::Key_Left]->setShortcut(Qt::Key_Left); actionsForKeys[Qt::Key_Right]->setShortcut(Qt::Key_Right); actionsForKeys[Qt::Key_Up]->setShortcut(Qt::Key_Up); diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index 44567dbd8..c45bbc611 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -100,8 +100,6 @@ public: signals: void fontPrintScaleChanged(double scale); void enableToolbar(bool enable); - void enableShortcuts(); - void disableShortcuts(bool paste); void editCurrentDive(); public |