Alex Martín Merino
2015-06-03 10:03:04 UTC
Hi,
i've recently started developing in Kdenlive, as i have been asking to
implement the function for https://bugs.kdenlive.org/view.php?id=2513,
disabling the rendering of the effects in the timeline, without disabling
the effects.
I'm taking as a base the function
void CollapsibleEffect::slotDisable(bool disable, bool emitInfo)
{
title->setEnabled(!disable);
enabledButton->blockSignals(true);
enabledButton->setChecked(disable);
enabledButton->blockSignals(false);
enabledButton->setIcon(disable ? KIcon("layer-visible-off") :
KIcon("layer-visible-on"));
m_effect.setAttribute("disable", disable ? 1 : 0);
if (!disable || KdenliveSettings::disable_effect_parameters()) {
widgetFrame->setEnabled(!disable);
}
if (emitInfo) emit effectStateChanged(disable, effectIndex(),
isActive() && needsMonitorEffectScene());
}
trying to omit the disabling part, and trying to apply it to all the tracks
and clips in the timeline.
For now, i'm trying to disable the effects from the tracks, trying to
select them as the active ones, so i can access to the CollapsibleEffects
in their EffectStacks, and use the modification i've created from their
slotDisable(bool,bool)
The code that goes through the tracks and effects:
int nTracks=m_activeDocument->tracksCount();
QList<TrackInfo> tInfo = m_activeDocument->tracksList();
QList<CollapsibleEffect*> cEffects;
TrackInfo infoData;
for(int i=0;i<nTracks;i++) {
infoData=tInfo.at(i);
m_effectStack->slotTrackItemSelected(i,infoData);
cEffects=m_effectStack->getCollapsibleList();
for (int j=0;j<cEffects.count();j++) {
CollapsibleEffect *effect=cEffects.at(j);
effect->toggleEffects(disabled);
}
}
where toggleEffects(bool) is
void CollapsibleEffect::toggleEffects(bool disable,bool emitInfo)
{
if(m_effect.attribute("disable")==0) {
if (emitInfo) emit effectStateChanged(disable, effectIndex(),
isActive() && needsMonitorEffectScene());
}
}
but it doesn't work, maybe because it's not accesing properly to the
tracks. Should i access to those tracks through this method i mentioned,
through
QDomElement mlt =
m_activeDocument->getDocument().firstChildElement("mlt");
QDomElement tractor = mlt.firstChildElement("tractor");
QDomNodeList tracks = tractor.elementsByTagName("track");
or is there any other way?
As for the clips, i haven't found any array or QLIst that storages the
ClipItems in the timeline, so they can be used in a similar way as the
tracks. I know that in the ClipManager exists a parameter that storages a
list of DocClipBase, but in order to get the ClipItems from them i would
have to create new ClipItems, and the point is obtaining the existing ones,
not creating more. Could they be obtained as in the second approach for the
tracks, but using a different TagName as "clip" or something similar, or is
there any other way to obtain those ClipItems?
I'm sorry if I bother you with this simple problems, but i think it would
be easier to go on after that.
Thanks to all in advance,
Alex
i've recently started developing in Kdenlive, as i have been asking to
implement the function for https://bugs.kdenlive.org/view.php?id=2513,
disabling the rendering of the effects in the timeline, without disabling
the effects.
I'm taking as a base the function
void CollapsibleEffect::slotDisable(bool disable, bool emitInfo)
{
title->setEnabled(!disable);
enabledButton->blockSignals(true);
enabledButton->setChecked(disable);
enabledButton->blockSignals(false);
enabledButton->setIcon(disable ? KIcon("layer-visible-off") :
KIcon("layer-visible-on"));
m_effect.setAttribute("disable", disable ? 1 : 0);
if (!disable || KdenliveSettings::disable_effect_parameters()) {
widgetFrame->setEnabled(!disable);
}
if (emitInfo) emit effectStateChanged(disable, effectIndex(),
isActive() && needsMonitorEffectScene());
}
trying to omit the disabling part, and trying to apply it to all the tracks
and clips in the timeline.
For now, i'm trying to disable the effects from the tracks, trying to
select them as the active ones, so i can access to the CollapsibleEffects
in their EffectStacks, and use the modification i've created from their
slotDisable(bool,bool)
The code that goes through the tracks and effects:
int nTracks=m_activeDocument->tracksCount();
QList<TrackInfo> tInfo = m_activeDocument->tracksList();
QList<CollapsibleEffect*> cEffects;
TrackInfo infoData;
for(int i=0;i<nTracks;i++) {
infoData=tInfo.at(i);
m_effectStack->slotTrackItemSelected(i,infoData);
cEffects=m_effectStack->getCollapsibleList();
for (int j=0;j<cEffects.count();j++) {
CollapsibleEffect *effect=cEffects.at(j);
effect->toggleEffects(disabled);
}
}
where toggleEffects(bool) is
void CollapsibleEffect::toggleEffects(bool disable,bool emitInfo)
{
if(m_effect.attribute("disable")==0) {
if (emitInfo) emit effectStateChanged(disable, effectIndex(),
isActive() && needsMonitorEffectScene());
}
}
but it doesn't work, maybe because it's not accesing properly to the
tracks. Should i access to those tracks through this method i mentioned,
through
QDomElement mlt =
m_activeDocument->getDocument().firstChildElement("mlt");
QDomElement tractor = mlt.firstChildElement("tractor");
QDomNodeList tracks = tractor.elementsByTagName("track");
or is there any other way?
As for the clips, i haven't found any array or QLIst that storages the
ClipItems in the timeline, so they can be used in a similar way as the
tracks. I know that in the ClipManager exists a parameter that storages a
list of DocClipBase, but in order to get the ClipItems from them i would
have to create new ClipItems, and the point is obtaining the existing ones,
not creating more. Could they be obtained as in the second approach for the
tracks, but using a different TagName as "clip" or something similar, or is
there any other way to obtain those ClipItems?
I'm sorry if I bother you with this simple problems, but i think it would
be easier to go on after that.
Thanks to all in advance,
Alex