]> git.sesse.net Git - kdenlive/commitdiff
Added shortcuts for Select (s), Razor (x), Spacer (m like move) tools.\n
authorSimon A. Eugster <simon.eu@gmail.com>
Mon, 3 Aug 2009 14:24:16 +0000 (14:24 +0000)
committerSimon A. Eugster <simon.eu@gmail.com>
Mon, 3 Aug 2009 14:24:16 +0000 (14:24 +0000)
* http://www.kdenlive.org/mantis/view.php?id=317
* When pressing Esc the focus on text fields and other things is removed. So when entering text you don't have to select an item that doesn't accept text to make the shortcuts working but just press Esc. http://www.kdenlive.org/mantis/view.php?id=1076

svn path=/trunk/kdenlive/; revision=3798

src/mainwindow.cpp
src/mainwindow.h

index dccb563c4a51cf92d00b57174a35765bd789d35b..f63ab57f00a0eeecfbc35faeff8ecb78de4b2dae 100644 (file)
@@ -151,6 +151,9 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent
     m_projectListDock->setWidget(m_projectList);
     addDockWidget(Qt::TopDockWidgetArea, m_projectListDock);
 
+    m_shortcutRemoveFocus = new QShortcut(QKeySequence("Esc"), this);
+    connect(m_shortcutRemoveFocus, SIGNAL(activated()), this, SLOT(slotRemoveFocus()));
+
     m_effectListDock = new QDockWidget(i18n("Effect List"), this);
     m_effectListDock->setObjectName("effect_list");
     m_effectList = new EffectsListView();
@@ -386,6 +389,7 @@ void MainWindow::queryQuit()
         delete m_projectMonitor;
         delete m_clipMonitor;
         delete m_activeDocument;
+        delete m_shortcutRemoveFocus;
         Mlt::Factory::close();
         kapp->quit();
     }
@@ -678,16 +682,19 @@ void MainWindow::setupActions()
     QString style1 = "QToolButton {background-color: rgba(230, 230, 230, 220); border-style: inset; border:1px solid #999999;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton:checked { background-color: rgba(224, 224, 0, 100); border-style: inset; border:1px solid #cc6666;border-radius: 3px;}";
 
     m_buttonSelectTool = new KAction(KIcon("kdenlive-select-tool"), i18n("Selection tool"), this);
+    m_buttonSelectTool->setShortcut(i18nc("Selection tool shortcut", "s"));
     toolbar->addAction(m_buttonSelectTool);
     m_buttonSelectTool->setCheckable(true);
     m_buttonSelectTool->setChecked(true);
 
     m_buttonRazorTool = new KAction(KIcon("edit-cut"), i18n("Razor tool"), this);
+    m_buttonRazorTool->setShortcut(i18nc("Razor tool shortcut", "x"));
     toolbar->addAction(m_buttonRazorTool);
     m_buttonRazorTool->setCheckable(true);
     m_buttonRazorTool->setChecked(false);
 
     m_buttonSpacerTool = new KAction(KIcon("kdenlive-spacer-tool"), i18n("Spacer tool"), this);
+    m_buttonSpacerTool->setShortcut(i18nc("Spacer tool shortcut", "m"));
     toolbar->addAction(m_buttonSpacerTool);
     m_buttonSpacerTool->setCheckable(true);
     m_buttonSpacerTool->setChecked(false);
@@ -2809,6 +2816,12 @@ void MainWindow::slotUpdateTimecodeFormat(int ix)
     m_projectMonitor->updateTimecodeFormat();
 }
 
+void MainWindow::slotRemoveFocus()
+{
+    statusBar()->setFocus();
+    statusBar()->clearFocus();
+}
+
 
 
 
index 98d6fd87ea6e502ad3cea6ee0aa8b75c0861b86b..cf2cff91011ef5a0cf7c58da60ee3bb2dc1fd667 100644 (file)
@@ -27,6 +27,7 @@
 #include <QProgressBar>
 #include <QEvent>
 #include <QTimer>
+#include <QShortcut>
 
 #include <KXmlGuiWindow>
 #include <KTextEdit>
@@ -143,6 +144,12 @@ private:
     QMenu *m_timelineContextClipMenu;
     QMenu *m_timelineContextTransitionMenu;
 
+    /**
+     * Shortcut to remove the focus of any element. Allows to get out
+     * of e.g. text input fields and to press another shortcut.
+     */
+    QShortcut* m_shortcutRemoveFocus;
+
     RenderWidget *m_renderWidget;
 
 #ifndef NO_JOGSHUTTLE
@@ -303,6 +310,8 @@ private slots:
     void slotSetDocumentRenderProfile(const QString &dest, const QString &name, const QString &file);
     void slotPrepareRendering(bool scriptExport, bool zoneOnly, const QString &chapterFile);
     void slotUpdateTimecodeFormat(int ix);
+    /** Removes the focus of anything */
+    void slotRemoveFocus();
 
 signals:
     Q_SCRIPTABLE void abortRenderJob(const QString &url);