summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/MainFrm.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2017-11-02 17:43:23 +0200
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2017-11-06 07:56:02 +0000
commit695581edd285a1df336140d46787f325469a0c5c (patch)
treef4d428c82f7321bd6468445fe4bc0e2dbaad3e69 /src/Authoring/Studio/MainFrm.cpp
parentb7875caa34d5af773dae9c9673d65e88639b534b (diff)
Fix hotkey handling
Now we use QAction for most hotkey handling. The old handling is still used for press-and-hold style hotkeys. Task-number: QT3DS-90 Change-Id: I8d7c01fcaf85f931c6032d41510a5626062219d9 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Studio/MainFrm.cpp')
-rw-r--r--src/Authoring/Studio/MainFrm.cpp69
1 files changed, 6 insertions, 63 deletions
diff --git a/src/Authoring/Studio/MainFrm.cpp b/src/Authoring/Studio/MainFrm.cpp
index fe83252c..b99af326 100644
--- a/src/Authoring/Studio/MainFrm.cpp
+++ b/src/Authoring/Studio/MainFrm.cpp
@@ -1118,65 +1118,19 @@ void CMainFrame::OnUpdatePlaybackStop()
* Registers all the keys it will need for shortcuts, also telsl children to register theirs
* @param inHotKeys the hotkeys to with which to register
*/
-void CMainFrame::RegisterGlobalKeyboardShortcuts(CHotKeys *inHotKeys)
-{
- inHotKeys->RegisterKeyEvent(new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnToolMove),
- 0, Qt::Key_W);
- inHotKeys->RegisterKeyEvent(new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnToolRotate),
- 0, Qt::Key_R);
- inHotKeys->RegisterKeyEvent(new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnToolScale),
- 0, Qt::Key_E);
- inHotKeys->RegisterKeyEvent(
- new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnViewBoundingBoxes),
- Qt::ControlModifier, Qt::Key_B);
- inHotKeys->RegisterKeyEvent(
- new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnViewPivotPoint),
- Qt::ControlModifier | Qt::AltModifier, Qt::Key_P);
- inHotKeys->RegisterKeyEvent(
- new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnEditPresentationPreferences),
- Qt::ControlModifier, Qt::Key_P);
- inHotKeys->RegisterKeyEvent(
- new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnOpenMostRecentlyUsedDocument),
- Qt::ControlModifier | Qt::AltModifier | Qt::ShiftModifier, Qt::Key_P);
-
- inHotKeys->RegisterKeyEvent(new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnShowAction),
- Qt::ControlModifier | Qt::ShiftModifier, Qt::Key_A);
- inHotKeys->RegisterKeyEvent(new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnShowBasic),
- Qt::ControlModifier | Qt::ShiftModifier, Qt::Key_B);
- inHotKeys->RegisterKeyEvent(
- new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnShowInspector),
- Qt::ControlModifier | Qt::ShiftModifier, Qt::Key_I);
- inHotKeys->RegisterKeyEvent(
- new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnShowProject),
- Qt::ControlModifier | Qt::ShiftModifier, Qt::Key_P);
- inHotKeys->RegisterKeyEvent(new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnShowSlide),
- Qt::ControlModifier | Qt::ShiftModifier, Qt::Key_D);
- inHotKeys->RegisterKeyEvent(
- new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnShowTimeline),
- Qt::ControlModifier | Qt::ShiftModifier, Qt::Key_T);
- inHotKeys->RegisterKeyEvent(
- new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnViewGuidesRulers),
- Qt::ControlModifier, Qt::Key_Semicolon);
- inHotKeys->RegisterKeyEvent(new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnLockGuides),
- Qt::ControlModifier | Qt::AltModifier, Qt::Key_Semicolon);
-
+void CMainFrame::RegisterGlobalKeyboardShortcuts(CHotKeys *inHotKeys, QWidget *actionParent)
+{
#ifdef INCLUDE_EDIT_CAMERA
- inHotKeys->RegisterKeyDownEvent(
- new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::HandleEditViewFillModeKey), 0,
- Qt::Key_F3);
- inHotKeys->RegisterKeyEvent(
- new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::HandleEditCameraZoomExtent), 0, Qt::Key_F);
+ ADD_GLOBAL_SHORTCUT(actionParent,
+ QKeySequence(Qt::Key_F3),
+ CMainFrame::HandleEditViewFillModeKey);
#endif
- inHotKeys->RegisterKeyDownEvent(
- new CDynHotKeyConsumer<CMainFrame>(this, &CMainFrame::OnPlaybackPreview), 0,
- Qt::Key_F5);
-
m_SceneView->RegisterGlobalKeyboardShortcuts(inHotKeys);
CTimelineControl *theTimelineControl = GetTimelineControl();
if (theTimelineControl)
- theTimelineControl->RegisterGlobalKeyboardShortcuts(inHotKeys);
+ theTimelineControl->RegisterGlobalKeyboardShortcuts(inHotKeys, actionParent);
}
//==============================================================================
@@ -1879,17 +1833,6 @@ void CMainFrame::OnDocumentPathChanged(const Qt3DSFile &inNewPath)
m_RecentItems->AddRecentItem(inNewPath);
}
-//==============================================================================
-/**
- * Secret hot-key compatibility with Aftereffects muscle memory
- */
-void CMainFrame::OnOpenMostRecentlyUsedDocument()
-{
- Qt3DSFile theDocument = m_RecentItems->GetItem(0);
- if (theDocument.Exists())
- g_StudioApp.OnLoadDocument(theDocument);
-}
-
void CMainFrame::OnShowSlide()
{
m_PaletteManager->ShowControl(CPaletteManager::CONTROLTYPE_SLIDE);