]> git.sesse.net Git - kdenlive/commitdiff
Fix monitor scene staying active when disabling a corners effect
authorTill Theato <root@ttill.de>
Fri, 7 Jan 2011 20:48:21 +0000 (20:48 +0000)
committerTill Theato <root@ttill.de>
Fri, 7 Jan 2011 20:48:21 +0000 (20:48 +0000)
svn path=/trunk/kdenlive/; revision=5295

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

index 234fe8dad82092e5c86e4b309f00aa3c92bffde5..160e59efb2c4b1d62d428ed4adbe1c7325889af7 100644 (file)
@@ -56,6 +56,10 @@ public:
      * @param maxframe Out point of the clip */
     void setRange(int minframe, int maxframe);
 
+public slots:
+    /** @brief Switches from normal monitor to monitor scene according to @param show. */
+    void slotShowScene(bool show = true);
+
 private:
     Ui::CornersWidget_UI m_ui;
     Monitor *m_monitor;
@@ -77,9 +81,6 @@ private slots:
     * @param renderPos Postion of the Monitor / Timeline cursor */
     void slotCheckMonitorPosition(int renderPos);
 
-    /** @brief Switches from normal monitor to monitor scene according to @param show. */
-    void slotShowScene(bool show = true);
-
     /** @brief Updates the on-monitor item according to the spinboxes. */
     void slotUpdateItem();
     /** @brief Updates the spinboxes according to the on-monitor item.
index 5508271853bec7a8fdef68f0cf25b4a83c3c2ca1..d15a3806104f317cb9193c6b777e61b0ec87deeb 100644 (file)
@@ -169,22 +169,9 @@ void EffectStackEdit::updateParameter(const QString &name, const QString &value)
 
     if (name == "disable") {
         // if effect is disabled, disable parameters widget
-        setEnabled(value.toInt() == 0 || !KdenliveSettings::disable_effect_parameters());
-        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 || !KdenliveSettings::disable_effect_parameters());
-                }
-            }
-        }
+        bool enabled = value.toInt() == 0 || !KdenliveSettings::disable_effect_parameters();
+        setEnabled(enabled);
+        emit effectStateChanged(enabled);
     }
 }
 
@@ -299,7 +286,8 @@ 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, disable, this);
+                GeometryWidget *geometry = new GeometryWidget(m_monitor, m_timecode, pos, isEffect, this);
+                geometry->slotShowScene(!disable);
                 // 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()));
@@ -311,6 +299,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
                 m_valueItems[paramName+"geometry"] = geometry;
                 connect(geometry, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
                 connect(this, SIGNAL(syncEffectsPos(int)), geometry, SLOT(slotSyncPosition(int)));
+                connect(this, SIGNAL(effectStateChanged(bool)), geometry, SLOT(slotShowScene(bool)));
             } else {
                 Geometryval *geo = new Geometryval(m_profile, m_timecode, m_frameSize, pos);
                 if (minFrame == maxFrame)
@@ -401,6 +390,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
                 meetDependency(paramName, type, EffectsList::parameter(e, depends));
         } else if (type == "corners") {
             CornersWidget *corners = new CornersWidget(m_monitor, pos, isEffect, pa.attribute("factor").toInt(), this);
+            corners->slotShowScene(!disable);
             connect(corners, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
             if (minFrame == maxFrame)
                 corners->setRange(m_in, m_out);
@@ -417,9 +407,9 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
                 points << QPoint(x, y);
             }
             corners->setValue(points);
-
             m_vbox->addWidget(corners);
             connect(corners, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
+            connect(this, SIGNAL(effectStateChanged(bool)), corners, SLOT(slotShowScene(bool)));
             m_valueItems[paramName] = corners;
         } else if (type == "wipe") {
             Wipeval *wpval = new Wipeval;
index e6ef5557eb70f0c52b7af842faa67cda1b4a20f4..f1e9613b6bdd8681e293c5548c99b42dc676f1b9 100644 (file)
@@ -100,6 +100,7 @@ signals:
     void checkMonitorPosition(int);
     void syncEffectsPos(int pos);
     void showComments();
+    void effectStateChanged(bool enabled);
 };
 
 #endif
index 34d2b972314f0481980da792580b7dc617822846..eaaa532904d3308a95deea96134696dc16de0036 100644 (file)
@@ -35,7 +35,7 @@
 
 
 
-GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos, bool isEffect, bool disabled, QWidget* parent):
+GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos, bool isEffect, QWidget* parent):
     QWidget(parent),
     m_monitor(monitor),
     m_timePos(new TimecodeDisplay(timecode)),
@@ -129,8 +129,6 @@ 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()));
     connect(m_scene, SIGNAL(addKeyframe()),    this, SLOT(slotAddKeyframe()));
index 3d10fb8411797127021bc1b16b3964f1e364ea33..55423be52df7faa9b3c6c725bcd757e759e8f0b7 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, bool disabled, QWidget* parent = 0);
+    GeometryWidget(Monitor *monitor, Timecode timecode, int clipPos, bool isEffect, QWidget* parent = 0);
     virtual ~GeometryWidget();
     /** @brief Gets the geometry as a serialized string. */
     QString getValue() const;