]> git.sesse.net Git - kdenlive/commitdiff
disable effect stack params and monitor scene when effect is disabled
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 29 Nov 2010 23:13:46 +0000 (23:13 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 29 Nov 2010 23:13:46 +0000 (23:13 +0000)
svn path=/trunk/kdenlive/; revision=5127

src/effectstackedit.cpp
src/effectstackedit.h
src/geometrywidget.cpp
src/geometrywidget.h

index f628408d2c2c41cdb73b32696024913708204cd3..099de6fa2669ab22553310819c604b4b4ec0ca6e 100644 (file)
@@ -65,12 +65,12 @@ class Urlval: public QWidget, public Ui::Urlval_UI
 QMap<QString, QImage> EffectStackEdit::iconCache;
 
 EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent) :
-        QScrollArea(parent),
-        m_in(0),
-        m_out(0),
-        m_frameSize(QPoint()),
-        m_keyframeEditor(NULL),
-        m_monitor(monitor)
+    QScrollArea(parent),
+    m_in(0),
+    m_out(0),
+    m_frameSize(QPoint()),
+    m_keyframeEditor(NULL),
+    m_monitor(monitor)
 {
     m_baseWidget = new QWidget(this);
     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -160,6 +160,25 @@ void EffectStackEdit::updateProjectFormat(MltVideoProfile profile, Timecode t)
 void EffectStackEdit::updateParameter(const QString &name, const QString &value)
 {
     m_params.setAttribute(name, value);
+    if (name == "disable") {
+        // if effect is disabled, disable parameters widget
+        setEnabled(value.toInt() == 0);
+        if (KdenliveSettings::on_monitor_effects()) {
+            // effect disabled, hide monitor scene if any
+            QDomNodeList namenode = m_params.elementsByTagName("parameter");
+            for (int i = 0; i < namenode.count() ; i++) {
+                QDomNode pa = namenode.item(i);
+                QDomNode na = pa.firstChildElement("name");
+                QString type = pa.attributes().namedItem("type").nodeValue();
+                if (type == "geometry") {
+                    QString paramName = i18n(na.toElement().text().toUtf8().data());
+                    paramName.append("geometry");
+                    GeometryWidget *geometry = ((GeometryWidget*)m_valueItems.value(paramName));
+                    geometry->slotShowScene(value.toInt() == 0);
+                }
+            }
+        }
+    }
 }
 
 void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, int out, bool isEffect)
@@ -179,6 +198,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
     QDomElement e = m_params.toElement();
     const int minFrame = e.attribute("start").toInt();
     const int maxFrame = e.attribute("end").toInt();
+    bool disabled = d.attribute("disable") == "1";
 
 
     for (int i = 0; i < namenode.count() ; i++) {
@@ -260,7 +280,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
             connect(pl, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
         } else if (type == "geometry") {
             if (KdenliveSettings::on_monitor_effects()) {
-                GeometryWidget *geometry = new GeometryWidget(m_monitor, m_timecode, pos, isEffect, this);
+                GeometryWidget *geometry = new GeometryWidget(m_monitor, m_timecode, pos, isEffect, disabled, this);
                 // connect this before setupParam to make sure the monitor scene shows up at startup
                 connect(geometry, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
                 connect(geometry, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
@@ -448,7 +468,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
     }
     m_vbox->addStretch();
 
-    if(m_keyframeEditor)
+    if (m_keyframeEditor)
         m_keyframeEditor->checkVisibleParam();
 }
 
index e450c9f31767c1d7c1a659baf8ede50faaa023fb..d58a97d7fcb794251a7687cd910a7a7f2e54a2a2 100644 (file)
@@ -49,7 +49,7 @@ public:
     ~EffectStackEdit();
     void updateProjectFormat(MltVideoProfile profile, Timecode t);
     static QMap<QString, QImage> iconCache;
-    /** @brief Sets attribute @param name to @param value. 
+    /** @brief Sets attribute @param name to @param value.
     *
     * Used to disable the effect, by setting disabled="1" */
     void updateParameter(const QString &name, const QString &value);
index 7b2bca0950d50ab4be97f7eea1f0284e5b00b250..cbf9eec55366b684ed57141e6a2b1a6104a3b4cf 100644 (file)
 
 
 
-GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos, bool isEffect, QWidget* parent):
-        QWidget(parent),
-        m_monitor(monitor),
-        m_timePos(new TimecodeDisplay(timecode)),
-        m_clipPos(clipPos),
-        m_inPoint(0),
-        m_outPoint(1),
-        m_isEffect(isEffect),
-        m_rect(NULL),
-        m_geometry(NULL),
-        m_showScene(true)
+GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos, bool isEffect, bool disabled, QWidget* parent):
+    QWidget(parent),
+    m_monitor(monitor),
+    m_timePos(new TimecodeDisplay(timecode)),
+    m_clipPos(clipPos),
+    m_inPoint(0),
+    m_outPoint(1),
+    m_isEffect(isEffect),
+    m_rect(NULL),
+    m_geometry(NULL),
+    m_showScene(true)
 {
     m_ui.setupUi(this);
     m_scene = monitor->getEffectScene();
@@ -129,7 +129,7 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
     settingsLayout->setContentsMargins(0, 0, 0, 0);
     ((QGridLayout *)m_ui.widgetConfigButton->layout())->addWidget(m_config->getShowHideButton(), 1, 1);
     connect(m_config, SIGNAL(showScene(bool)), this, SLOT(slotShowScene(bool)));
-
+    slotShowScene(!disabled);
 
 
     connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateGeometry()));
index 7c9fe33a4a850cea15b0067cd1a1a7748389f9fb..3d10fb8411797127021bc1b16b3964f1e364ea33 100644 (file)
@@ -46,7 +46,7 @@ public:
     * @param clipPos Position of the clip in timeline
     * @param isEffect true if used in an effect, false if used in a transition
     * @param parent (optional) Parent widget */
-    GeometryWidget(Monitor *monitor, Timecode timecode, int clipPos, bool isEffect, QWidget* parent = 0);
+    GeometryWidget(Monitor *monitor, Timecode timecode, int clipPos, bool isEffect, bool disabled, QWidget* parent = 0);
     virtual ~GeometryWidget();
     /** @brief Gets the geometry as a serialized string. */
     QString getValue() const;
@@ -61,6 +61,8 @@ public slots:
     void setupParam(const QDomElement elem, int minframe, int maxframe);
     /** @brief Updates position of the local timeline to @param relTimelinePos.  */
     void slotSyncPosition(int relTimelinePos);
+    /** @brief Switches from normal monitor to monitor scene according to @param show. */
+    void slotShowScene(bool show = true);
 
 private:
     Ui::GeometryWidget_UI m_ui;
@@ -143,8 +145,6 @@ private slots:
 
     /** @brief Enables/Disables syncing with the timeline according to @param sync. */
     void slotSetSynchronize(bool sync);
-    /** @brief Switches from normal monitor to monitor scene according to @param show. */
-    void slotShowScene(bool show = true);
 
 signals:
     void parameterChanged();