]> git.sesse.net Git - kdenlive/commitdiff
Make monitor context menu consistent with "Monitor" menu
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 20 Oct 2008 18:04:29 +0000 (18:04 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 20 Oct 2008 18:04:29 +0000 (18:04 +0000)
svn path=/branches/KDE4/; revision=2518

src/clipmanager.cpp
src/mainwindow.cpp
src/monitor.cpp
src/monitor.h

index 2ecef0cb94cea52f0c418c959cc5bec82c5a1e61..ad18f93f4e3d19b6e29522d8a43ff05dfb45546b 100644 (file)
@@ -42,11 +42,10 @@ void ClipManager::checkAudioThumbs() {
         else m_clipList.at(i)->slotClearAudioCache();
     }
     if (m_audioThumbsEnabled) {
-       if (m_generatingAudioId.isEmpty()) startAudioThumbsGeneration();
-    }
-    else {
-       m_audioThumbsQueue.clear();
-       m_generatingAudioId = QString();
+        if (m_generatingAudioId.isEmpty()) startAudioThumbsGeneration();
+    } else {
+        m_audioThumbsQueue.clear();
+        m_generatingAudioId = QString();
     }
 }
 
@@ -60,15 +59,15 @@ void ClipManager::askForAudioThumb(const QString &id) {
 
 void ClipManager::startAudioThumbsGeneration() {
     if (!KdenliveSettings::audiothumbnails()) {
-       m_audioThumbsQueue.clear();
-       m_generatingAudioId = QString();
-       return;
+        m_audioThumbsQueue.clear();
+        m_generatingAudioId = QString();
+        return;
     }
     if (!m_audioThumbsQueue.isEmpty()) {
-           m_generatingAudioId = m_audioThumbsQueue.takeFirst();
-            DocClipBase *clip = getClipById(m_generatingAudioId);
-            if (!clip || !clip->slotGetAudioThumbs())
-                endAudioThumbsGeneration(m_generatingAudioId);
+        m_generatingAudioId = m_audioThumbsQueue.takeFirst();
+        DocClipBase *clip = getClipById(m_generatingAudioId);
+        if (!clip || !clip->slotGetAudioThumbs())
+            endAudioThumbsGeneration(m_generatingAudioId);
     } else {
         m_generatingAudioId = QString();
     }
@@ -76,9 +75,9 @@ void ClipManager::startAudioThumbsGeneration() {
 
 void ClipManager::endAudioThumbsGeneration(const QString &requestedId) {
     if (!KdenliveSettings::audiothumbnails()) {
-       m_audioThumbsQueue.clear();
-       m_generatingAudioId = QString();
-       return;
+        m_audioThumbsQueue.clear();
+        m_generatingAudioId = QString();
+        return;
     }
     if (!m_audioThumbsQueue.isEmpty()) {
         if (m_generatingAudioId == requestedId) {
index cf17e7dda6b3ae4d3fbaa67863ee9dbd56009c93..02ee44abd154d95579bec2aa1b601e85a5d43fac 100644 (file)
@@ -203,7 +203,10 @@ MainWindow::MainWindow(const QString &MltPath, QWidget *parent)
     setCentralWidget(m_timelineArea);
 
     setupGUI(Default, NULL /*"kdenliveui.rc"*/);
-    kDebug() << factory() << " " << factory()->container("video_effects_menu", this);
+    //kDebug() << factory() << " " << factory()->container("video_effects_menu", this);
+
+    m_projectMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)));
+    m_clipMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)));
 
     // build effects menus
     QAction *action;
@@ -698,12 +701,12 @@ void MainWindow::setupActions() {
     collection->addAction("seek_clip_end", clipEnd);
     connect(clipEnd, SIGNAL(triggered(bool)), this, SLOT(slotClipEnd()));
 
-    KAction* projectStart = new KAction(KIcon("media-seek-backward"), i18n("Go to Project Start"), this);
+    KAction* projectStart = new KAction(KIcon("go-first"), i18n("Go to Project Start"), this);
     projectStart->setShortcut(Qt::CTRL + Qt::Key_Home);
     collection->addAction("seek_start", projectStart);
     connect(projectStart, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotStart()));
 
-    KAction* projectEnd = new KAction(KIcon("media-seek-forward"), i18n("Go to Project End"), this);
+    KAction* projectEnd = new KAction(KIcon("go-last"), i18n("Go to Project End"), this);
     projectEnd->setShortcut(Qt::CTRL + Qt::Key_End);
     collection->addAction("seek_end", projectEnd);
     connect(projectEnd, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotEnd()));
index 95ee45b292f84f8f889442a14296f873b8fdf5ef..2b1102784169660d7d96afa777e549d5cbd5000d 100644 (file)
@@ -28,6 +28,7 @@
 #include <KDebug>
 #include <KLocale>
 #include <KFileDialog>
+#include <KApplication>
 
 #include "gentime.h"
 #include "monitor.h"
@@ -61,16 +62,16 @@ Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent)
     toolbar->addAction(KIcon("media-skip-backward"), i18n("Rewind 1 frame"), this, SLOT(slotRewindOneFrame()));
 
     QToolButton *playButton = new QToolButton(toolbar);
-    QMenu *playMenu = new QMenu(i18n("Play..."), this);
-    playButton->setMenu(playMenu);
-    playButton->setPopupMode(QToolButton::MenuButtonPopup);
-    toolbar->addWidget(playButton);
-
-    m_playAction = playMenu->addAction(m_playIcon, i18n("Play"));
+    m_playMenu = new QMenu(i18n("Play..."), this);
+    m_playAction = m_playMenu->addAction(m_playIcon, i18n("Play"));
     m_playAction->setCheckable(true);
     connect(m_playAction, SIGNAL(triggered()), this, SLOT(slotPlay()));
-    playMenu->addAction(m_playIcon, i18n("Play Section"), this, SLOT(slotPlayZone()));
-    playMenu->addAction(m_playIcon, i18n("Loop Section"), this, SLOT(slotLoopZone()));
+    m_playMenu->addAction(m_playIcon, i18n("Play Section"), this, SLOT(slotPlayZone()));
+    m_playMenu->addAction(m_playIcon, i18n("Loop Section"), this, SLOT(slotLoopZone()));
+
+    playButton->setMenu(m_playMenu);
+    playButton->setPopupMode(QToolButton::MenuButtonPopup);
+    toolbar->addWidget(playButton);
 
     toolbar->addAction(KIcon("media-skip-forward"), i18n("Forward 1 frame"), this, SLOT(slotForwardOneFrame()));
     toolbar->addAction(KIcon("media-seek-forward"), i18n("Forward"), this, SLOT(slotForward()));
@@ -78,9 +79,9 @@ Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent)
     playButton->setDefaultAction(m_playAction);
 
     QToolButton *configButton = new QToolButton(toolbar);
-    QMenu *configMenu = new QMenu(i18n("Misc..."), this);
+    m_configMenu = new QMenu(i18n("Misc..."), this);
     configButton->setIcon(KIcon("system-run"));
-    configButton->setMenu(configMenu);
+    configButton->setMenu(m_configMenu);
     configButton->setPopupMode(QToolButton::QToolButton::InstantPopup);
     toolbar->addWidget(configButton);
 
@@ -101,7 +102,6 @@ Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent)
 
     //m_ruler->setPixelPerMark(3);
 
-
     QVBoxLayout *rendererBox = new QVBoxLayout(ui.video_frame);
     rendererBox->setContentsMargins(0, 0, 0, 0);
     m_monitorRefresh = new MonitorRefresh(ui.video_frame);
@@ -109,13 +109,7 @@ Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent)
     render = new Render(m_name, (int) m_monitorRefresh->winId(), -1, this);
     m_monitorRefresh->setRenderer(render);
 
-    m_contextMenu = new QMenu(this);
-    m_contextMenu->addMenu(playMenu);
-    QMenu *goMenu = new QMenu(i18n("Go to..."), this);
-    goMenu->addAction(i18n("Start"), this, SLOT(slotStart()));
-    goMenu->addAction(i18n("End"), this, SLOT(slotEnd()));
-    goMenu->addAction(i18n("Zone start"), this, SLOT(slotZoneStart()));
-    goMenu->addAction(i18n("Zone end"), this, SLOT(slotZoneEnd()));
+
 
     connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
     connect(m_ruler, SIGNAL(zoneChanged(QPoint)), this, SIGNAL(zoneUpdated(QPoint)));
@@ -123,32 +117,16 @@ Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent)
     connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
     connect(render, SIGNAL(rendererStopped(int)), this, SLOT(rendererStopped(int)));
 
-    configMenu->addSeparator();
-    configMenu->addAction(KIcon("transform-scale"), i18n("Resize (100%)"), this, SLOT(slotSetSizeOneToOne()));
-    configMenu->addAction(KIcon("transform-scale"), i18n("Resize (50%)"), this, SLOT(slotSetSizeOneToTwo()));
+    m_configMenu->addSeparator();
+    m_configMenu->addAction(KIcon("transform-scale"), i18n("Resize (100%)"), this, SLOT(slotSetSizeOneToOne()));
+    m_configMenu->addAction(KIcon("transform-scale"), i18n("Resize (50%)"), this, SLOT(slotSetSizeOneToTwo()));
     //render->createVideoXWindow(ui.video_frame->winId(), -1);
     m_length = 0;
 
-    m_contextMenu->addMenu(goMenu);
-    m_contextMenu->addAction(zoneStart);
-    m_contextMenu->addAction(zoneEnd);
-    //TODO: add save zone to timeline monitor when fixed
-    if (name == "clip") m_contextMenu->addAction(KIcon("document-save"), i18n("Save zone"), this, SLOT(slotSaveZone()));
-
-    QAction *extractFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Extract frame"), this, SLOT(slotExtractCurrentFrame()));
-    configMenu->addAction(extractFrame);
-
     if (name != "clip") {
         connect(render, SIGNAL(rendererPosition(int)), this, SIGNAL(renderPosition(int)));
         connect(render, SIGNAL(durationChanged(int)), this, SIGNAL(durationChanged(int)));
-        QAction *splitView = m_contextMenu->addAction(KIcon("document-new"), i18n("Split view"), render, SLOT(slotSplitView(bool)));
-        splitView->setCheckable(true);
-        configMenu->addAction(splitView);
-    } else {
-        QAction *setThumbFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Set current image as thumbnail"), this, SLOT(slotSetThumbFrame()));
-        configMenu->addAction(setThumbFrame);
     }
-
     m_monitorRefresh->show();
     kDebug() << "/////// BUILDING MONITOR, ID: " << ui.video_frame->winId();
 }
@@ -157,6 +135,28 @@ QString Monitor::name() const {
     return m_name;
 }
 
+void Monitor::setupMenu(QMenu *goMenu) {
+    m_contextMenu = new QMenu(this);
+    m_contextMenu->addMenu(m_playMenu);
+    m_contextMenu->addMenu(goMenu);
+
+    //TODO: add save zone to timeline monitor when fixed
+    if (m_name == "clip") m_contextMenu->addAction(KIcon("document-save"), i18n("Save zone"), this, SLOT(slotSaveZone()));
+
+    QAction *extractFrame = m_configMenu->addAction(KIcon("document-new"), i18n("Extract frame"), this, SLOT(slotExtractCurrentFrame()));
+    m_contextMenu->addAction(extractFrame);
+
+    if (m_name != "clip") {
+        QAction *splitView = m_contextMenu->addAction(KIcon("document-new"), i18n("Split view"), render, SLOT(slotSplitView(bool)));
+        splitView->setCheckable(true);
+        m_configMenu->addAction(splitView);
+    } else {
+        QAction *setThumbFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Set current image as thumbnail"), this, SLOT(slotSetThumbFrame()));
+        m_configMenu->addAction(setThumbFrame);
+    }
+
+}
+
 void Monitor::slotSetSizeOneToOne() {
     QRect r = QApplication::desktop()->screenGeometry();
     const int maxWidth = r.width() - 20;
index fe703925bf6e4b449b70c88b873fc21e65f7b45c..4d97a4b7b51a211f9ee314a662f33d04cbf2f8a9 100644 (file)
@@ -55,6 +55,7 @@ public:
     void resetSize();
     bool isActive() const;
     void pause();
+    void setupMenu(QMenu *goMenu);
 
 protected:
     virtual void mousePressEvent(QMouseEvent * event);
@@ -83,6 +84,8 @@ private:
     KRestrictedLine *m_timePos;
     QAction *m_playAction;
     QMenu *m_contextMenu;
+    QMenu *m_configMenu;
+    QMenu *m_playMenu;
     DocClipBase *m_currentClip;
     QPoint m_DragStartPosition;
     bool m_dragStarted;