Commit 58ca041a authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Progress on track effects

svn path=/trunk/kdenlive/; revision=4749
parent 8ac18afe
......@@ -1546,6 +1546,13 @@ void CustomTrackView::slotRefreshEffects(ClipItem *clip)
void CustomTrackView::addEffect(int track, GenTime pos, QDomElement effect)
{
if (pos < GenTime()) {
// Add track effect
m_document->addTrackEffect(m_document->tracksCount() - track, effect);
m_document->renderer()->mltAddTrackEffect(track, getEffectArgs(effect));
emit showTrackEffects(track, m_document->getTrackEffects(m_document->tracksCount() - track));
return;
}
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
if (clip) {
// Special case: speed effect
......@@ -1573,6 +1580,13 @@ void CustomTrackView::addEffect(int track, GenTime pos, QDomElement effect)
void CustomTrackView::deleteEffect(int track, GenTime pos, QDomElement effect)
{
QString index = effect.attribute("kdenlive_ix");
if (pos < GenTime()) {
// Delete track effect
m_document->removeTrackEffect(m_document->tracksCount() - track, effect);
m_document->renderer()->mltRemoveTrackEffect(track, index, true);
emit showTrackEffects(track, m_document->getTrackEffects(m_document->tracksCount() - track));
return;
}
// Special case: speed effect
if (effect.attribute("id") == "speed") {
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
......@@ -1707,8 +1721,15 @@ void CustomTrackView::slotAddEffect(QDomElement effect, GenTime pos, int track)
} else delete effectCommand;
}
void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect, bool affectGroup)
void CustomTrackView::slotDeleteEffect(ClipItem *clip, int track, QDomElement effect, bool affectGroup)
{
if (clip == NULL) {
// delete track effect
AddEffectCommand *command = new AddEffectCommand(this, track, GenTime(-1), effect, false);
m_commandStack->push(command);
setDocumentModified();
return;
}
if (affectGroup && clip->parentItem() && clip->parentItem() == m_selectionGroup) {
//clip is in a group, also remove the effect in other clips of the group
QList<QGraphicsItem *> items = m_selectionGroup->childItems();
......@@ -1754,8 +1775,26 @@ void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedE
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
return;
}
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
QDomElement effect = insertedEffect.cloneNode().toElement();
if (pos < GenTime()) {
// editing a track effect
EffectsParameterList effectParams = getEffectArgs(effect);
if (effect.attribute("tag") == "ladspa") {
// Update the ladspa affect file
initEffects::ladspaEffectFile(effect.attribute("src"), effect.attribute("ladspaid").toInt(), getLadspaParams(effect));
}
// check if we are trying to reset a keyframe effect
if (effectParams.hasParam("keyframes") && effectParams.paramValue("keyframes").isEmpty()) {
//clip->initEffect(effect);
effectParams = getEffectArgs(effect);
}
if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - track, pos, effectParams))
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
m_document->setTrackEffect(track, ix, effect);
return;
}
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
if (clip) {
// Special case: speed effect
if (effect.attribute("id") == "speed") {
......@@ -1809,6 +1848,20 @@ void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedE
void CustomTrackView::moveEffect(int track, GenTime pos, int oldPos, int newPos)
{
if (pos < GenTime()) {
// Moving track effect
kDebug() << "MOVING EFFECT IN TK: " << track;
QDomElement act = m_document->getTrackEffect(track, newPos - 1);
QDomElement before = m_document->getTrackEffect(track, oldPos - 1);
if (!act.isNull() && !before.isNull()) {
m_document->setTrackEffect(track, oldPos - 1, act);
m_document->setTrackEffect(track, newPos - 1, before);
m_document->renderer()->mltMoveEffect(m_document->tracksCount() - track, pos, oldPos, newPos);
emit showTrackEffects(m_document->tracksCount() - track, m_document->getTrackEffects(track));
} else emit displayMessage(i18n("Cannot move effect"), ErrorMessage);
return;
}
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
if (clip && !clip->effectAt(newPos - 1).isNull() && !clip->effectAt(oldPos - 1).isNull()) {
QDomElement act = clip->effectAt(newPos - 1);
......@@ -1826,27 +1879,42 @@ void CustomTrackView::moveEffect(int track, GenTime pos, int oldPos, int newPos)
} else emit displayMessage(i18n("Cannot move effect"), ErrorMessage);
}
void CustomTrackView::slotChangeEffectState(ClipItem *clip, int effectPos, bool disable)
void CustomTrackView::slotChangeEffectState(ClipItem *clip, int track, int effectPos, bool disable)
{
QDomElement effect = clip->effectAt(effectPos);
EditEffectCommand *command;
QDomElement effect;
if (clip == NULL) effect = m_document->getTrackEffect(m_document->tracksCount() - track, effectPos);
else effect = clip->effectAt(effectPos);
QDomElement oldEffect = effect.cloneNode().toElement();
effect.setAttribute("disable", (int) disable);
EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldEffect, effect, effectPos, true);
if (clip == NULL) {
// editing track effect
command = new EditEffectCommand(this, m_document->tracksCount() - track, GenTime(-1), oldEffect, effect, effectPos, true);
} else {
command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldEffect, effect, effectPos, true);
}
m_commandStack->push(command);
setDocumentModified();;
}
void CustomTrackView::slotChangeEffectPosition(ClipItem *clip, int currentPos, int newPos)
void CustomTrackView::slotChangeEffectPosition(ClipItem *clip, int track, int currentPos, int newPos)
{
MoveEffectCommand *command = new MoveEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), currentPos, newPos);
MoveEffectCommand *command;
if (clip == NULL) {
// editing track effect
command = new MoveEffectCommand(this, m_document->tracksCount() - track, GenTime(-1), currentPos, newPos);
} else command = new MoveEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), currentPos, newPos);
m_commandStack->push(command);
setDocumentModified();
}
void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, QDomElement oldeffect, QDomElement effect, int ix)
void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, int track, QDomElement oldeffect, QDomElement effect, int ix)
{
EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldeffect, effect, ix, true);
EditEffectCommand *command;
if (clip) command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldeffect, effect, ix, true);
else command = new EditEffectCommand(this, m_document->tracksCount() - track, GenTime(-1), oldeffect, effect, ix, true);
m_commandStack->push(command);
}
......@@ -3298,13 +3366,13 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
int start = item->cropStart().frames(m_document->fps());
int end = item->fadeIn();
if (end == 0) {
slotDeleteEffect(item, oldeffect, false);
slotDeleteEffect(item, -1, oldeffect, false);
} else {
end += start;
QDomElement effect = oldeffect.cloneNode().toElement();
EffectsList::setParameter(oldeffect, "in", QString::number(start));
EffectsList::setParameter(oldeffect, "out", QString::number(end));
slotUpdateClipEffect(item, effect, oldeffect, ix);
slotUpdateClipEffect(item, -1, effect, oldeffect, ix);
emit clipItemSelected(item, ix);
}
} else if (item->fadeIn() != 0 && ix2 == -1) {
......@@ -3321,13 +3389,13 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
int start = item->cropStart().frames(m_document->fps());
int end = item->fadeIn();
if (end == 0) {
slotDeleteEffect(item, oldeffect, false);
slotDeleteEffect(item, -1, oldeffect, false);
} else {
end += start;
QDomElement effect = oldeffect.cloneNode().toElement();
EffectsList::setParameter(oldeffect, "in", QString::number(start));
EffectsList::setParameter(oldeffect, "out", QString::number(end));
slotUpdateClipEffect(item, effect, oldeffect, ix2);
slotUpdateClipEffect(item, -1, effect, oldeffect, ix2);
emit clipItemSelected(item, ix2);
}
}
......@@ -3341,14 +3409,14 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
int end = (item->cropDuration() + item->cropStart()).frames(m_document->fps());
int start = item->fadeOut();
if (start == 0) {
slotDeleteEffect(item, oldeffect, false);
slotDeleteEffect(item, -1, oldeffect, false);
} else {
start = end - start;
QDomElement effect = oldeffect.cloneNode().toElement();
EffectsList::setParameter(oldeffect, "in", QString::number(start));
EffectsList::setParameter(oldeffect, "out", QString::number(end));
// kDebug()<<"EDIT FADE OUT : "<<start<<"x"<<end;
slotUpdateClipEffect(item, effect, oldeffect, ix);
slotUpdateClipEffect(item, -1, effect, oldeffect, ix);
emit clipItemSelected(item, ix);
}
} else if (item->fadeOut() != 0 && ix2 == -1) {
......@@ -3366,14 +3434,14 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
int end = (item->cropDuration() + item->cropStart()).frames(m_document->fps());
int start = item->fadeOut();
if (start == 0) {
slotDeleteEffect(item, oldeffect, false);
slotDeleteEffect(item, -1, oldeffect, false);
} else {
start = end - start;
QDomElement effect = oldeffect.cloneNode().toElement();
EffectsList::setParameter(oldeffect, "in", QString::number(start));
EffectsList::setParameter(oldeffect, "out", QString::number(end));
// kDebug()<<"EDIT FADE OUT : "<<start<<"x"<<end;
slotUpdateClipEffect(item, effect, oldeffect, ix2);
slotUpdateClipEffect(item, -1, effect, oldeffect, ix2);
emit clipItemSelected(item, ix2);
}
}
......@@ -6268,7 +6336,8 @@ bool CustomTrackView::hasAudio(int track) const
void CustomTrackView::slotAddTrackEffect(const QDomElement effect, int ix)
{
m_document->renderer()->mltAddTrackEffect(m_document->tracksCount() - ix, getEffectArgs(effect));
AddEffectCommand *command = new AddEffectCommand(this, m_document->tracksCount() - ix, GenTime(-1), effect, true);
m_commandStack->push(command);
}
......
......@@ -187,10 +187,10 @@ public slots:
void setCursorPos(int pos, bool seek = true);
void moveCursorPos(int delta);
void updateCursorPos();
void slotDeleteEffect(ClipItem *clip, QDomElement effect, bool affectGroup = true);
void slotChangeEffectState(ClipItem *clip, int effectPos, bool disable);
void slotChangeEffectPosition(ClipItem *clip, int currentPos, int newPos);
void slotUpdateClipEffect(ClipItem *clip, QDomElement oldeffect, QDomElement effect, int ix);
void slotDeleteEffect(ClipItem *clip, int track, QDomElement effect, bool affectGroup = true);
void slotChangeEffectState(ClipItem *clip, int track, int effectPos, bool disable);
void slotChangeEffectPosition(ClipItem *clip, int track, int currentPos, int newPos);
void slotUpdateClipEffect(ClipItem *clip, int track, QDomElement oldeffect, QDomElement effect, int ix);
void slotUpdateClipRegion(ClipItem *clip, int ix, QString region);
void slotRefreshEffects(ClipItem *clip);
void setDuration(int duration);
......@@ -422,6 +422,7 @@ signals:
/** @brief Monitor document changes (for example the presence of audio data in timeline for export widget.*/
void documentModified();
void forceClipProcessing(const QString &);
void showTrackEffects(int, EffectsList);
};
#endif
......
......@@ -22,6 +22,7 @@
#define DEFINITIONS_H
#include "gentime.h"
#include "effectslist.h"
#include <QTreeWidgetItem>
#include <KLocale>
......@@ -63,6 +64,7 @@ struct TrackInfo {
bool isMute;
bool isBlind;
bool isLocked;
EffectsList effectsList;
};
struct ItemInfo {
......
......@@ -40,7 +40,10 @@
EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) :
QWidget(parent),
m_monitor(monitor)
m_monitor(monitor),
m_clipref(NULL),
m_trackMode(false),
m_trackindex(-1)
{
m_ui.setupUi(this);
QVBoxLayout *vbox1 = new QVBoxLayout(m_ui.frame);
......@@ -52,7 +55,6 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) :
m_ui.region_url->fileDialog()->setFilter(ProjectList::getExtensions());
//m_ui.effectlist->horizontalHeader()->setVisible(false);
//m_ui.effectlist->verticalHeader()->setVisible(false);
m_clipref = NULL;
m_ui.buttonNew->setIcon(KIcon("document-new"));
m_ui.buttonNew->setToolTip(i18n("Add new effect"));
......@@ -125,7 +127,7 @@ void EffectStackView::slotSaveEffect()
int i = m_ui.effectlist->currentRow();
QDomDocument doc;
QDomElement effect = m_clipref->effectAt(i).cloneNode().toElement();
QDomElement effect = m_currentEffectList.at(i).cloneNode().toElement();
doc.appendChild(doc.importNode(effect, true));
effect = doc.firstChild().toElement();
effect.removeAttribute("kdenlive_ix");
......@@ -152,8 +154,10 @@ void EffectStackView::slotSaveEffect()
void EffectStackView::slotUpdateEffectParams(const QDomElement old, const QDomElement e)
{
if (m_clipref)
emit updateClipEffect(m_clipref, old, e, m_ui.effectlist->currentRow());
if (m_trackMode)
emit updateEffect(NULL, m_trackindex, old, e, m_ui.effectlist->currentRow());
else if (m_clipref)
emit updateEffect(m_clipref, -1, old, e, m_ui.effectlist->currentRow());
}
void EffectStackView::slotClipItemSelected(ClipItem* c, int ix)
......@@ -183,9 +187,21 @@ void EffectStackView::slotClipItemSelected(ClipItem* c, int ix)
return;
}
setEnabled(true);
m_trackMode = false;
m_currentEffectList = m_clipref->effectList();
setupListView(ix);
}
void EffectStackView::slotTrackItemSelected(int ix, EffectsList list)
{
setEnabled(!list.isEmpty());
m_clipref = NULL;
m_trackMode = true;
m_currentEffectList = list;
m_trackindex = ix;
setupListView(0);
}
void EffectStackView::slotItemChanged(QListWidgetItem *item)
{
bool disable = true;
......@@ -195,7 +211,8 @@ void EffectStackView::slotItemChanged(QListWidgetItem *item)
int activeRow = m_ui.effectlist->currentRow();
if (activeRow >= 0) {
m_effectedit->updateParameter("disable", QString::number((int) disable));
emit changeEffectState(m_clipref, activeRow, disable);
if (m_trackMode) emit changeEffectState(NULL, m_trackindex, activeRow, disable);
else emit changeEffectState(m_clipref, -1, activeRow, disable);
}
slotUpdateCheckAllButton();
}
......@@ -212,8 +229,8 @@ void EffectStackView::setupListView(int ix)
KIcon customIcon("kdenlive-custom-effect");
QListWidgetItem* item;
for (int i = 0; i < m_clipref->effectsCount(); i++) {
const QDomElement d = m_clipref->effectAt(i);
for (int i = 0; i < m_currentEffectList.count(); i++) {
const QDomElement d = m_currentEffectList.at(i).cloneNode().toElement();
if (d.isNull()) {
kDebug() << " . . . . WARNING, NULL EFFECT IN STACK!!!!!!!!!";
continue;
......@@ -268,14 +285,17 @@ void EffectStackView::slotItemSelectionChanged(bool update)
bool isChecked = false;
if (hasItem && m_ui.effectlist->currentItem()->checkState() == Qt::Checked) isChecked = true;
if (hasItem && m_ui.effectlist->currentItem()->isSelected()) {
QDomElement eff = m_clipref->effectAt(activeRow);
m_effectedit->transferParamDesc(eff,
0,
m_clipref->cropStart().frames(KdenliveSettings::project_fps()),
(m_clipref->cropStart() + m_clipref->cropDuration()).frames(KdenliveSettings::project_fps())); //minx max frame
QDomElement eff = m_currentEffectList.at(activeRow);
if (m_trackMode) {
// showing track effects
m_effectedit->transferParamDesc(eff, 0, 0, -1);
} else m_effectedit->transferParamDesc(eff,
0,
m_clipref->cropStart().frames(KdenliveSettings::project_fps()),
(m_clipref->cropStart() + m_clipref->cropDuration()).frames(KdenliveSettings::project_fps())); //minx max frame
m_ui.region_url->setUrl(KUrl(eff.attribute("region")));
}
if (m_clipref && update) m_clipref->setSelectedEffect(activeRow);
if (!m_trackMode && m_clipref && update) m_clipref->setSelectedEffect(activeRow);
m_ui.buttonDel->setEnabled(hasItem);
m_ui.buttonSave->setEnabled(hasItem);
m_ui.buttonReset->setEnabled(hasItem && isChecked);
......@@ -288,21 +308,24 @@ void EffectStackView::slotItemUp()
{
int activeRow = m_ui.effectlist->currentRow();
if (activeRow <= 0) return;
emit changeEffectPosition(m_clipref, activeRow + 1, activeRow);
if (m_trackMode) emit changeEffectPosition(NULL, m_trackindex, activeRow + 1, activeRow);
else emit changeEffectPosition(m_clipref, -1, activeRow + 1, activeRow);
}
void EffectStackView::slotItemDown()
{
int activeRow = m_ui.effectlist->currentRow();
if (activeRow >= m_ui.effectlist->count() - 1) return;
emit changeEffectPosition(m_clipref, activeRow + 1, activeRow + 2);
if (m_trackMode) emit changeEffectPosition(NULL, m_trackindex, activeRow + 1, activeRow + 2);
else emit changeEffectPosition(m_clipref, -1, activeRow + 1, activeRow + 2);
}
void EffectStackView::slotItemDel()
{
int activeRow = m_ui.effectlist->currentRow();
if (activeRow >= 0) {
emit removeEffect(m_clipref, m_clipref->effectAt(activeRow));
if (m_trackMode) emit removeEffect(NULL, m_trackindex, m_currentEffectList.at(activeRow).cloneNode().toElement());
else emit removeEffect(m_clipref, -1, m_clipref->effectAt(activeRow));
slotUpdateCheckAllButton();
}
}
......@@ -311,7 +334,7 @@ void EffectStackView::slotResetEffect()
{
int activeRow = m_ui.effectlist->currentRow();
if (activeRow < 0) return;
QDomElement old = m_clipref->effectAt(activeRow).cloneNode().toElement();
QDomElement old = m_currentEffectList.at(activeRow).cloneNode().toElement();
QDomElement dom;
QString effectName = m_ui.effectlist->currentItem()->text();
foreach(const QString &type, m_effectLists.keys()) {
......@@ -323,17 +346,24 @@ void EffectStackView::slotResetEffect()
}
if (!dom.isNull()) {
dom.setAttribute("kdenlive_ix", old.attribute("kdenlive_ix"));
m_clipref->initEffect(dom);
m_effectedit->transferParamDesc(dom, 0, m_clipref->cropStart().frames(KdenliveSettings::project_fps()), (m_clipref->cropStart() + m_clipref->cropDuration()).frames(KdenliveSettings::project_fps()));//minx max frame
m_ui.region_url->setUrl(KUrl(dom.attribute("region")));
emit updateClipEffect(m_clipref, old, dom, activeRow);
if (m_trackMode) {
EffectsList::setParameter(dom, "in", QString::number(0));
EffectsList::setParameter(dom, "out", QString::number(0));
m_effectedit->transferParamDesc(dom, 0, 0, 0);//minx max frame
emit updateEffect(NULL, m_trackindex, old, dom, activeRow);
} else {
m_clipref->initEffect(dom);
m_effectedit->transferParamDesc(dom, 0, m_clipref->cropStart().frames(KdenliveSettings::project_fps()), (m_clipref->cropStart() + m_clipref->cropDuration()).frames(KdenliveSettings::project_fps()));//minx max frame
m_ui.region_url->setUrl(KUrl(dom.attribute("region")));
emit updateEffect(m_clipref, -1, old, dom, activeRow);
}
}
}
void EffectStackView::raiseWindow(QWidget* dock)
{
if (m_clipref && dock)
if ((m_clipref || m_trackMode) && dock)
dock->raise();
}
......@@ -355,7 +385,7 @@ void EffectStackView::clear()
void EffectStackView::slotSeekTimeline(int pos)
{
if (m_clipref)
if (!m_trackMode && m_clipref)
emit seekTimeline(m_clipref->startPos().frames(KdenliveSettings::project_fps()) + pos);
}
......@@ -395,11 +425,12 @@ void EffectStackView::slotCheckAll(int state)
void EffectStackView::slotRegionChanged()
{
emit updateClipRegion(m_clipref, m_ui.effectlist->currentRow(), m_ui.region_url->text());
if (!m_trackMode) emit updateClipRegion(m_clipref, m_ui.effectlist->currentRow(), m_ui.region_url->text());
}
void EffectStackView::slotCheckMonitorPosition(int renderPos)
{
if (m_trackMode) return;
if (renderPos >= m_clipref->startPos().frames(KdenliveSettings::project_fps()) && renderPos <= m_clipref->endPos().frames(KdenliveSettings::project_fps())) {
if (!m_monitor->getEffectScene()->views().at(0)->isVisible())
m_monitor->slotEffectScene(true);
......
......@@ -57,10 +57,18 @@ public:
private:
Ui::EffectStack_UI m_ui;
Monitor *m_monitor;
ClipItem* m_clipref;
QMap<QString, EffectsList*> m_effectLists;
EffectsList m_currentEffectList;
EffectStackEdit* m_effectedit;
Monitor *m_monitor;
/** @brief Effectstackview can show the effects of a clip or the effects of a track.
* true if showing track effects. */
bool m_trackMode;
/** @brief The track index of currently edited track. */
int m_trackindex;
/** @brief Sets the list of effects according to the clip's effect list.
* @param ix Number of the effect to preselect */
......@@ -72,6 +80,8 @@ public slots:
* @param ix Effect to preselect */
void slotClipItemSelected(ClipItem* c, int ix);
void slotTrackItemSelected(int ix, EffectsList list);
/** @brief Emits updateClipEffect.
* @param old Old effect information
* @param e New effect information
......@@ -123,16 +133,16 @@ private slots:
void slotRenderPos(int pos);
signals:
void removeEffect(ClipItem*, QDomElement);
void removeEffect(ClipItem*, int, QDomElement);
/** Parameters for an effect changed, update the filter in playlist */
void updateClipEffect(ClipItem*, QDomElement, QDomElement, int);
void updateEffect(ClipItem*, int, QDomElement, QDomElement, int);
/** An effect in stack was moved, we need to regenerate
all effects for this clip in the playlist */
void refreshEffectStack(ClipItem *);
/** Enable or disable an effect */
void changeEffectState(ClipItem*, int, bool);
void changeEffectState(ClipItem*, int, int, bool);
/** An effect in stack was moved */
void changeEffectPosition(ClipItem*, int, int);
void changeEffectPosition(ClipItem*, int, int, int);
/** an effect was saved, reload list */
void reloadEffects();
/** An effect with position parameter was changed, seek */
......
......@@ -120,6 +120,7 @@ void HeaderTrack::mousePressEvent(QMouseEvent * event)
return;
}
if (!m_isSelected) emit selectTrack(m_index);
emit showTrackEffects(m_index);
QWidget::mousePressEvent(event);
}
......
......@@ -72,6 +72,7 @@ signals:
void selectTrack(int);
void configTrack(int);
void addTrackInfo(const QDomElement, int);
void showTrackEffects(int);
};
#endif
......@@ -1118,26 +1118,46 @@ int KdenliveDoc::tracksCount() const
TrackInfo KdenliveDoc::trackInfoAt(int ix) const
{
if (ix < 0 || ix >= m_tracksList.count()) {
kWarning() << "Track INFO outisde of range";
return TrackInfo();
}
return m_tracksList.at(ix);
}
void KdenliveDoc::switchTrackAudio(int ix, bool hide)
{
if (ix < 0 || ix >= m_tracksList.count()) {
kWarning() << "SWITCH Track outisde of range";
return;
}
m_tracksList[ix].isMute = hide; // !m_tracksList.at(ix).isMute;
}
void KdenliveDoc::switchTrackLock(int ix, bool lock)
{
if (ix < 0 || ix >= m_tracksList.count()) {
kWarning() << "Track Lock outisde of range";
return;
}
m_tracksList[ix].isLocked = lock;
}
bool KdenliveDoc::isTrackLocked(int ix) const
{
if (ix < 0 || ix >= m_tracksList.count()) {
kWarning() << "Track Lock outisde of range";
return true;
}
return m_tracksList.at(ix).isLocked;
}
void KdenliveDoc::switchTrackVideo(int ix, bool hide)
{
if (ix < 0 || ix >= m_tracksList.count()) {
kWarning() << "SWITCH Track outisde of range";
return;
}
m_tracksList[ix].isBlind = hide; // !m_tracksList.at(ix).isBlind;
}
......@@ -1149,11 +1169,19 @@ void KdenliveDoc::insertTrack(int ix, TrackInfo type)
void KdenliveDoc::deleteTrack(int ix)
{
if (ix < 0 || ix >= m_tracksList.count()) {
kWarning() << "Delete Track outisde of range";
return;
}
m_tracksList.removeAt(ix);
}
void KdenliveDoc::setTrackType(int ix, TrackInfo type)
{
if (ix < 0 || ix >= m_tracksList.count()) {
kWarning() << "SET Track Type outisde of range";
return;
}
m_tracksList[ix].type = type.type;
m_tracksList[ix].isMute = type.isMute;
m_tracksList[ix].isBlind = type.isBlind;
......@@ -1251,5 +1279,69 @@ QMap <QString, QString> KdenliveDoc::getRenderProperties() const
return renderProperties;
}
void KdenliveDoc::addTrackEffect(int ix, QDomElement effect)
{
if (ix < 0 || ix >= m_tracksList.count()) {
kWarning() << "Add Track effect outisde of range";
return;
}