diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-11-05 11:12:22 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-11-05 13:45:50 -0800 |
commit | 1013ba39c5216107406bf676fca4a91a191f03a5 (patch) | |
tree | 4b806caf383a2183f7b8c471cd6141d9a401722c /profile-widget | |
parent | 000c9cc21c8991682169987ae8f348243ec5008b (diff) | |
download | subsurface-1013ba39c5216107406bf676fca4a91a191f03a5.tar.gz |
Untangle Profile from MainWindow: shortcuts
This, too, should be done with signals.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile-widget')
-rw-r--r-- | profile-widget/profilewidget2.cpp | 9 | ||||
-rw-r--r-- | profile-widget/profilewidget2.h | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 178183d2e..046095465 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -976,8 +976,7 @@ void ProfileWidget2::setProfileState() connect(DivePictureModel::instance(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(plotPictures())); /* show the same stuff that the profile shows. */ - //TODO: Move the DC handling to another method. - MainWindow::instance()->enableShortcuts(); + emit enableShortcuts(); currentState = PROFILE; emit enableToolbar(true); @@ -1124,8 +1123,7 @@ void ProfileWidget2::setAddState() mouseFollowerHorizontal->setLine(timeAxis->line()); mouseFollowerVertical->setLine(QLineF(0, profileYAxis->pos().y(), 0, timeAxis->pos().y())); disconnectTemporaryConnections(); - //TODO: Move this method to another place, shouldn't be on mainwindow. - MainWindow::instance()->disableShortcuts(false); + 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); @@ -1158,8 +1156,7 @@ void ProfileWidget2::setPlanState() mouseFollowerHorizontal->setLine(timeAxis->line()); mouseFollowerVertical->setLine(QLineF(0, profileYAxis->pos().y(), 0, timeAxis->pos().y())); disconnectTemporaryConnections(); - //TODO: Move this method to another place, shouldn't be on mainwindow. - MainWindow::instance()->disableShortcuts(); + 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 8ac34f625..c102bbcf3 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -90,6 +90,8 @@ signals: void fontPrintScaleChanged(double scale); void enableToolbar(bool enable); void showError(); + void enableShortcuts(); + void disableShortcuts(bool paste); public slots: // Necessary to call from QAction's signals. |