From: Till Theato Date: Fri, 7 Jan 2011 20:48:21 +0000 (+0000) Subject: Fix monitor scene staying active when disabling a corners effect X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=2e3d7ddd65f439d2cd211d647be3c305173dd336;p=kdenlive Fix monitor scene staying active when disabling a corners effect svn path=/trunk/kdenlive/; revision=5295 --- diff --git a/src/cornerswidget.h b/src/cornerswidget.h index 234fe8da..160e59ef 100644 --- a/src/cornerswidget.h +++ b/src/cornerswidget.h @@ -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. diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index 55082718..d15a3806 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -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; diff --git a/src/effectstackedit.h b/src/effectstackedit.h index e6ef5557..f1e9613b 100644 --- a/src/effectstackedit.h +++ b/src/effectstackedit.h @@ -100,6 +100,7 @@ signals: void checkMonitorPosition(int); void syncEffectsPos(int pos); void showComments(); + void effectStateChanged(bool enabled); }; #endif diff --git a/src/geometrywidget.cpp b/src/geometrywidget.cpp index 34d2b972..eaaa5329 100644 --- a/src/geometrywidget.cpp +++ b/src/geometrywidget.cpp @@ -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())); diff --git a/src/geometrywidget.h b/src/geometrywidget.h index 3d10fb84..55423be5 100644 --- a/src/geometrywidget.h +++ b/src/geometrywidget.h @@ -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;