]> git.sesse.net Git - kdenlive/blobdiff - src/monitor.cpp
Const'ref
[kdenlive] / src / monitor.cpp
index 4c3fd13ebfd96cda7d0c2a5cc505142722f11bf7..cbd94d7e1c11d68359bb4405d8b543bf855036b9 100644 (file)
@@ -42,6 +42,7 @@
 #include <QLabel>
 #include <QIntValidator>
 #include <QVBoxLayout>
+#include <QSlider>
 
 
 #define SEEK_INACTIVE (-1)
@@ -120,7 +121,7 @@ Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profil
             m_markerMenu = new QMenu(i18n("Go to marker..."), this);
             m_markerMenu->setEnabled(false);
             m_configMenu->addMenu(m_markerMenu);
-            connect(m_markerMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotGoToMarker(QAction *)));
+            connect(m_markerMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotGoToMarker(QAction*)));
         }
         m_configMenu->addAction(KIcon("transform-scale"), i18n("Resize (100%)"), this, SLOT(slotSetSizeOneToOne()));
         m_configMenu->addAction(KIcon("transform-scale"), i18n("Resize (50%)"), this, SLOT(slotSetSizeOneToTwo()));
@@ -148,7 +149,8 @@ Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profil
     setLayout(layout);
     setMinimumHeight(200);
 
-    if (profile.isEmpty()) profile = KdenliveSettings::current_profile();
+    if (profile.isEmpty())
+        profile = KdenliveSettings::current_profile();
 
     bool monitorCreated = false;
 #ifdef Q_WS_MAC
@@ -196,7 +198,7 @@ Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profil
 
     if (id == Kdenlive::projectMonitor) {
         m_effectWidget = new MonitorEditWidget(render, videoBox);
-       connect(m_effectWidget, SIGNAL(showEdit(bool, bool)), this, SLOT(slotShowEffectScene(bool, bool)));
+       connect(m_effectWidget, SIGNAL(showEdit(bool,bool)), this, SLOT(slotShowEffectScene(bool,bool)));
         m_toolbar->addAction(m_effectWidget->getVisibilityAction());
         videoBox->layout()->addWidget(m_effectWidget);
         m_effectWidget->hide();
@@ -228,7 +230,7 @@ QWidget *Monitor::container()
 }
 
 #ifdef USE_OPENGL
-bool Monitor::createOpenGlWidget(QWidget *parent, const QString profile)
+bool Monitor::createOpenGlWidget(QWidget *parent, const QString &profile)
 {
     render = new Render(id(), 0, profile, this);
     m_glWidget = new VideoGLWidget(parent);
@@ -252,7 +254,7 @@ void Monitor::setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMe
     if (markerMenu) {
         m_contextMenu->addMenu(markerMenu);
         QList <QAction *>list = markerMenu->actions();
-        for (int i = 0; i < list.count(); i++) {
+        for (int i = 0; i < list.count(); ++i) {
             if (list.at(i)->data().toString() == "edit_marker") {
                 m_editMarker = list.at(i);
                 break;
@@ -290,28 +292,6 @@ void Monitor::setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMe
     showTips->setCheckable(true);
     connect(showTips, SIGNAL(toggled(bool)), this, SLOT(slotSwitchMonitorInfo(bool)));
     showTips->setChecked(KdenliveSettings::displayMonitorInfo());
-    
-    KSelectAction *interlace = new KSelectAction(i18n("Deinterlacer"), this);
-    interlace->addAction(i18n("One Field (fast)"));
-    interlace->addAction(i18n("Linear Blend (fast)"));
-    interlace->addAction(i18n("YADIF - temporal only (good)"));
-    interlace->addAction(i18n("YADIF - temporal + spacial (best)"));
-    if (KdenliveSettings::mltdeinterlacer() == "linearblend") interlace->setCurrentItem(1);
-    else if (KdenliveSettings::mltdeinterlacer() == "yadif-temporal") interlace->setCurrentItem(2);
-    else if (KdenliveSettings::mltdeinterlacer() == "yadif") interlace->setCurrentItem(3);
-    else interlace->setCurrentItem(0);
-    connect(interlace, SIGNAL(triggered(int)), this, SLOT(slotSetDeinterlacer(int)));
-    
-    KSelectAction *interpol = new KSelectAction(i18n("Interpolation"), this);
-    interpol->addAction(i18n("Nearest Neighbor (fast)"));
-    interpol->addAction(i18n("Bilinear (good)"));
-    interpol->addAction(i18n("Bicubic (better)"));
-    interpol->addAction(i18n("Hyper/Lanczos (best)"));
-    if (KdenliveSettings::mltinterpolation() == "bilinear") interpol->setCurrentItem(1);
-    else if (KdenliveSettings::mltinterpolation() == "bicubic") interpol->setCurrentItem(2);
-    else if (KdenliveSettings::mltinterpolation() == "hyper") interpol->setCurrentItem(3);
-    else interpol->setCurrentItem(0);
-    connect(interpol, SIGNAL(triggered(int)), this, SLOT(slotSetInterpolation(int)));
 
     QAction *dropFrames = m_contextMenu->addAction(KIcon(), i18n("Real time (drop frames)"));
     dropFrames->setCheckable(true);
@@ -320,9 +300,6 @@ void Monitor::setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMe
     
     m_configMenu->addAction(showTips);
     m_configMenu->addAction(dropFrames);
-    m_configMenu->addAction(interlace);
-    m_configMenu->addAction(interpol);
-
 }
 
 void Monitor::slotGoToMarker(QAction *action)
@@ -398,7 +375,7 @@ void Monitor::updateMarkers(DocClipBase *source)
         QList <CommentedTime> markers = m_currentClip->commentedSnapMarkers();
         if (!markers.isEmpty()) {
             QList <int> marks;
-            for (int i = 0; i < markers.count(); i++) {
+            for (int i = 0; i < markers.count(); ++i) {
                 int pos = (int) markers.at(i).time().frames(m_monitorManager->timecode().fps());
                 marks.append(pos);
                 QString position = m_monitorManager->timecode().getTimecode(markers.at(i).time()) + ' ' + markers.at(i).comment();
@@ -411,7 +388,7 @@ void Monitor::updateMarkers(DocClipBase *source)
     }
 }
 
-void Monitor::setMarkers(QList <CommentedTime> markers)
+void Monitor::setMarkers(const QList<CommentedTime> &markers)
 {
     m_ruler->setMarkers(markers);
 }
@@ -635,13 +612,13 @@ void Monitor::slotExtractCurrentFrame()
     fs->setMode(KFile::File);
     fs->setConfirmOverwrite(true);
     fs->setKeepLocation(true);
-    fs->exec();
-    QString path;
-    if (fs) path = fs->selectedFile();
-    delete fs;
-    if (!path.isEmpty()) {
-        frame.save(path);
+    if (fs->exec()) {
+        QString path = fs->selectedFile();
+        if (!path.isEmpty()) {
+            frame.save(path);
+        }
     }
+    delete fs;
 }
 
 void Monitor::setTimePos(const QString &pos)
@@ -983,7 +960,7 @@ void Monitor::resetProfile(const QString &profile)
         m_effectWidget->resetProfile(render);
 }
 
-void Monitor::saveSceneList(QString path, QDomElement info)
+void Monitor::saveSceneList(const QString &path, const QDomElement &info)
 {
     if (render == NULL) return;
     render->saveSceneList(path, info);
@@ -995,7 +972,7 @@ const QString Monitor::sceneList()
     return render->sceneList();
 }
 
-void Monitor::setClipZone(QPoint pos)
+void Monitor::setClipZone(const QPoint &pos)
 {
     if (m_currentClip == NULL) return;
     m_currentClip->setZone(pos);
@@ -1006,48 +983,6 @@ void Monitor::slotSwitchDropFrames(bool show)
     render->setDropFrames(show);
 }
 
-void Monitor::slotSetDeinterlacer(int ix)
-{
-    QString value;
-    switch (ix) {
-      
-      case 1:
-       value = "linearblend";
-       break;
-      case 2:
-       value = "yadif-nospatial";
-       break;
-      case 3:
-       value = "yadif";
-       break;
-      default:
-       value = "onefield";
-    }
-    KdenliveSettings::setMltdeinterlacer(value);
-    m_monitorManager->setConsumerProperty("deinterlace_method", value);
-}
-
-void Monitor::slotSetInterpolation(int ix)
-{
-    QString value;
-    switch (ix) {
-      case 1:
-       value = "bilinear";
-       break;
-      case 2:
-       value = "bicubic";
-       break;
-      case 3:
-       value = "hyper";
-       break;
-      default:
-       value = "nearest";
-    }
-    KdenliveSettings::setMltinterpolation(value);
-    m_monitorManager->setConsumerProperty("rescale", value);
-}
-
-
 void Monitor::slotSwitchMonitorInfo(bool show)
 {
     KdenliveSettings::setDisplayMonitorInfo(show);