]> git.sesse.net Git - kdenlive/commitdiff
Add categories for the effect actions, so they do not mess up the configure shortcuts...
authorTill Theato <root@ttill.de>
Sun, 13 Jun 2010 12:46:24 +0000 (12:46 +0000)
committerTill Theato <root@ttill.de>
Sun, 13 Jun 2010 12:46:24 +0000 (12:46 +0000)
Also made preparations for using an extra collection, but the custom dialog connected to the standard action "keybindings" simply won't show up.

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

src/mainwindow.cpp
src/mainwindow.h

index 3df60771007fe0d299905610d3901c217d8b3647..e5de70cd55c4913dca6dc15888a19d648d46742d 100644 (file)
@@ -58,7 +58,9 @@
 #include <KLocale>
 #include <KGlobal>
 #include <KActionCollection>
+#include <KActionCategory>
 #include <KStandardAction>
+#include <KShortcutsDialog>
 #include <KFileDialog>
 #include <KMessageBox>
 #include <KDebug>
@@ -947,13 +949,10 @@ void MainWindow::setupActions()
     collection->addAction("manage_profiles", profilesAction);
     connect(profilesAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProfiles()));
 
-    KNS3::standardAction(i18n("Download New Wipes..."), this, SLOT(slotGetNewLumaStuff()), actionCollection(), "get_new_lumas");
-
-    KNS3::standardAction(i18n("Download New Render Profiles..."), this, SLOT(slotGetNewRenderStuff()), actionCollection(), "get_new_profiles");
-
+    KNS3::standardAction(i18n("Download New Wipes..."),            this, SLOT(slotGetNewLumaStuff()),       actionCollection(), "get_new_lumas");
+    KNS3::standardAction(i18n("Download New Render Profiles..."),  this, SLOT(slotGetNewRenderStuff()),     actionCollection(), "get_new_profiles");
     KNS3::standardAction(i18n("Download New Project Profiles..."), this, SLOT(slotGetNewMltProfileStuff()), actionCollection(), "get_new_mlt_profiles");
-
-    KNS3::standardAction(i18n("Download New Title Templates..."), this, SLOT(slotGetNewTitleStuff()), actionCollection(), "get_new_titles");
+    KNS3::standardAction(i18n("Download New Title Templates..."),  this, SLOT(slotGetNewTitleStuff()),      actionCollection(), "get_new_titles");
 
     KAction* wizAction = new KAction(KIcon("configure"), i18n("Run Config Wizard"), this);
     collection->addAction("run_wizard", wizAction);
@@ -1285,26 +1284,18 @@ void MainWindow::setupActions()
     maxCurrent->setChecked(false);
     connect(maxCurrent, SIGNAL(triggered(bool)), this, SLOT(slotMaximizeCurrent(bool)));*/
 
-
-    m_closeAction = KStandardAction::close(this, SLOT(closeCurrentDocument()), collection);
-
-    KStandardAction::quit(this, SLOT(queryQuit()), collection);
-
-    KStandardAction::open(this, SLOT(openFile()), collection);
-
-    m_saveAction = KStandardAction::save(this, SLOT(saveFile()), collection);
-
-    KStandardAction::saveAs(this, SLOT(saveFileAs()), collection);
-
-    KStandardAction::openNew(this, SLOT(newFile()), collection);
-
-    KStandardAction::preferences(this, SLOT(slotPreferences()), collection);
-
-    KStandardAction::configureNotifications(this , SLOT(configureNotifications()), collection);
-
-    KStandardAction::copy(this, SLOT(slotCopy()), collection);
-
-    KStandardAction::paste(this, SLOT(slotPaste()), collection);
+    m_closeAction = KStandardAction::close(this,  SLOT(closeCurrentDocument()),   collection);
+    KStandardAction::quit(this,                   SLOT(queryQuit()),              collection);
+    KStandardAction::open(this,                   SLOT(openFile()),               collection);
+    m_saveAction = KStandardAction::save(this,    SLOT(saveFile()),               collection);
+    KStandardAction::saveAs(this,                 SLOT(saveFileAs()),             collection);
+    KStandardAction::openNew(this,                SLOT(newFile()),                collection);
+    KStandardAction::keyBindings(this,            SLOT(slotEditKeys()),           collection);
+    KStandardAction::preferences(this,            SLOT(slotPreferences()),        collection);
+    KStandardAction::configureNotifications(this, SLOT(configureNotifications()), collection);
+    KStandardAction::copy(this,                   SLOT(slotCopy()),               collection);
+    KStandardAction::paste(this,                  SLOT(slotPaste()),              collection);
+    KStandardAction::fullScreen(this,             SLOT(slotFullScreen()), this,   collection);
 
     KAction *undo = KStandardAction::undo(m_commandStack, SLOT(undo()), collection);
     undo->setEnabled(false);
@@ -1314,8 +1305,6 @@ void MainWindow::setupActions()
     redo->setEnabled(false);
     connect(m_commandStack, SIGNAL(canRedoChanged(bool)), redo, SLOT(setEnabled(bool)));
 
-    KStandardAction::fullScreen(this, SLOT(slotFullScreen()), this, collection);
-
     /*
     //TODO: Add status tooltip to actions ?
     connect(collection, SIGNAL(actionHovered(QAction*)),
@@ -1385,38 +1374,48 @@ void MainWindow::setupActions()
     m_projectList->setupMenu(addClips, addClip);
 
     // Setup effects and transitions actions.
+    m_effectsActionCollection = new KActionCollection(this, KGlobal::mainComponent());
+    //KActionCategory *videoEffectActions = new KActionCategory(i18n("Video Effects"), m_effectsActionCollection);
+    KActionCategory *videoEffectActions = new KActionCategory(i18n("Video Effects"), collection);
     m_videoEffects = new KAction*[videoEffects.count()];
     for (int i = 0; i < videoEffects.count(); ++i) {
         QStringList effectInfo = videoEffects.effectIdInfo(i);
         m_videoEffects[i] = new KAction(KIcon("kdenlive-show-video"), effectInfo.at(0), this);
         m_videoEffects[i]->setData(effectInfo);
         m_videoEffects[i]->setIconVisibleInMenu(false);
-        collection->addAction("video_effect_" + effectInfo.at(0), m_videoEffects[i]);
+        videoEffectActions->addAction("video_effect_" + effectInfo.at(0), m_videoEffects[i]);
     }
+    //KActionCategory *audioEffectActions = new KActionCategory(i18n("Audio Effects"), m_effectsActionCollection);
+    KActionCategory *audioEffectActions = new KActionCategory(i18n("Audio Effects"), collection);
     m_audioEffects = new KAction*[audioEffects.count()];
     for (int i = 0; i < audioEffects.count(); ++i) {
         QStringList effectInfo = audioEffects.effectIdInfo(i);
         m_audioEffects[i] = new KAction(KIcon("kdenlive-show-audio"), effectInfo.at(0), this);
         m_audioEffects[i]->setData(effectInfo);
         m_audioEffects[i]->setIconVisibleInMenu(false);
-        collection->addAction("audio_effect_" + effectInfo.at(0), m_audioEffects[i]);
+        audioEffectActions->addAction("audio_effect_" + effectInfo.at(0), m_audioEffects[i]);
     }
+    //KActionCategory *customEffectActions = new KActionCategory(i18n("Custom Effects"), m_effectsActionCollection);
+    KActionCategory *customEffectActions = new KActionCategory(i18n("Custom Effects"), collection);
     m_customEffects = new KAction*[customEffects.count()];
     for (int i = 0; i < customEffects.count(); ++i) {
         QStringList effectInfo = customEffects.effectIdInfo(i);
         m_customEffects[i] = new KAction(KIcon("kdenlive-custom-effect"), effectInfo.at(0), this);
         m_customEffects[i]->setData(effectInfo);
         m_customEffects[i]->setIconVisibleInMenu(false);
-        collection->addAction("custom_effect_" + effectInfo.at(0), m_customEffects[i]);
+        customEffectActions->addAction("custom_effect_" + effectInfo.at(0), m_customEffects[i]);
     }
+    //KActionCategory *transitionActions = new KActionCategory(i18n("Transitions"), m_effectsActionCollection);
+    KActionCategory *transitionActions = new KActionCategory(i18n("Transitions"), collection);
     m_transitions = new KAction*[transitions.count()];
     for (int i = 0; i < transitions.count(); i++) {
         QStringList effectInfo = transitions.effectIdInfo(i);
         m_transitions[i] = new KAction(effectInfo.at(0), this);
         m_transitions[i]->setData(effectInfo);
         m_transitions[i]->setIconVisibleInMenu(false);
-        collection->addAction("transition_" + effectInfo.at(0), m_transitions[i]);
+        transitionActions->addAction("transition_" + effectInfo.at(0), m_transitions[i]);
     }
+    m_effectsActionCollection->readSettings();
 
     //connect(collection, SIGNAL( clearStatusText() ),
     //statusBar(), SLOT( clear() ) );
@@ -2151,6 +2150,14 @@ void MainWindow::slotGuidesUpdated()
     if (m_renderWidget) m_renderWidget->setGuides(m_activeDocument->guidesXml(), m_activeDocument->projectDuration());
 }
 
+void MainWindow::slotEditKeys()
+{
+    KShortcutsDialog dialog(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this);
+    dialog.addCollection(actionCollection(), i18nc("general keyboard shortcuts", "General"));
+    dialog.addCollection(m_effectsActionCollection, i18nc("effects and transitions keyboard shortcuts", "Effects & Transitions"));
+    dialog.configure(); 
+}
+
 void MainWindow::slotPreferences(int page, int option)
 {
     //An instance of your dialog could be already created and could be
@@ -2938,7 +2945,6 @@ void MainWindow::slotClipInTimeline(const QString &clipId)
                 j++;
             }
             actionList.insert(j, a);
-
         }
         inTimelineMenu->addActions(actionList);
 
index 8fc9f6bad403de654733bedfe39b41bba3c68342..2732c2d88d9480a85c696df1102d100ad7d354ca 100644 (file)
@@ -61,6 +61,7 @@ class JogShuttle;
 class DocClipBase;
 class Render;
 class Transition;
+class KActionCollection;
 
 class MainWindow : public KXmlGuiWindow
 {
@@ -206,6 +207,7 @@ private:
     KAction *m_playZone;
     StatusBarMessageLabel *m_messageLabel;
     QActionGroup *m_clipTypeGroup;
+    KActionCollection *m_effectsActionCollection;
 
     bool m_findActivated;
     QString m_findString;
@@ -236,6 +238,7 @@ private:
     QByteArray m_timelineState;
     void loadTranscoders();
     QPixmap createSchemePreviewIcon(const KSharedConfigPtr &config);
+
     /** @brief Checks that the Kdenlive mime type is correctly installed.
     * @return The mimetype */
     QString getMimeType();
@@ -254,20 +257,28 @@ private slots:
     void queryQuit();
     void activateDocument();
     void connectDocument(TrackView*, KdenliveDoc*);
+    
     /** @brief Shows file open dialog. */
     void openFile();
     void openLastFile();
+
     /** @brief Checks whether a URL is available to save to.
     * @return Whether the file was saved. */
     bool saveFile();
+
     /** @brief Shows a save file dialog for saving the project.
     * @return Whether the file was saved. */
     bool saveFileAs();
+
     /** @brief Set properties to match outputFileName and save the document.
     * @param outputFileName The URL to save to / The document's URL.
     * @return Whether we had success. */
     bool saveFileAs(const QString &outputFileName);
+
+    /** @brief Shows the shortcut dialog. */
+    void slotEditKeys();
     void slotPreferences(int page = -1, int option = -1);
+
     /** @brief Reflects setting changes to the GUI. */
     void updateConfiguration();
     void slotConnectMonitors();
@@ -279,6 +290,7 @@ private slots:
     void slotDetectAudioDriver();
     void slotEditProjectSettings();
     void slotDisplayActionMessage(QAction *a);
+
     /** @brief Turns automatic splitting of audio and video on/off. */
     void slotSwitchSplitAudio();
     void slotSwitchVideoThumbs();
@@ -301,6 +313,7 @@ private slots:
     void slotFitZoom();
     /** @brief Updates the zoom slider tooltip to fit @param zoomlevel. */
     void slotUpdateZoomSliderToolTip(int zoomlevel);
+
     /** @brief Displays the zoom slider tooltip.
     * @param zoomlevel (optional) The zoom level to show in the tooltip. 
     *
@@ -398,9 +411,11 @@ private slots:
     void slotTranscodeClip();
     void slotSetDocumentRenderProfile(const QString &dest, const QString &group, const QString &name, const QString &file);
     void slotPrepareRendering(bool scriptExport, bool zoneOnly, const QString &chapterFile);
+
     /** @brief Switches between displaying frames or timecode.
     * @param ix 0 = display timecode, 1 = display frames. */
     void slotUpdateTimecodeFormat(int ix);
+
     /** @brief Removes the focus of anything. */
     void slotRemoveFocus();
     void slotCleanProject();
@@ -415,6 +430,7 @@ private slots:
     void slotCheckRenderStatus();
     void slotInsertZoneToTree();
     void slotInsertZoneToTimeline();
+
     /** @brief Deletes items from timeline and document.
     * @param ids The ids of the clips to delete.
     * @param folderids The names and ids of the folders to delete. */