#include "effectslist.h"
#include "clipitem.h"
#include "mainwindow.h"
+#include "docclipbase.h"
#include "kdenlivesettings.h"
#include <KDebug>
QWidget(parent)
{
m_ui.setupUi(this);
+ QVBoxLayout *vbox1 = new QVBoxLayout(m_ui.frame);
m_effectedit = new EffectStackEdit(m_ui.frame);
+ vbox1->setContentsMargins(0, 0, 0, 0);
+ vbox1->setSpacing(0);
+ vbox1->addWidget(m_effectedit);
+ m_ui.frame->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
//m_ui.effectlist->horizontalHeader()->setVisible(false);
//m_ui.effectlist->verticalHeader()->setVisible(false);
m_clipref = NULL;
connect(m_ui.buttonDel, SIGNAL(clicked()), this, SLOT(slotItemDel()));
connect(m_ui.buttonSave, SIGNAL(clicked()), this, SLOT(slotSaveEffect()));
connect(m_ui.buttonReset, SIGNAL(clicked()), this, SLOT(slotResetEffect()));
- connect(this, SIGNAL(transferParamDesc(const QDomElement&, int , int)), m_effectedit , SLOT(transferParamDesc(const QDomElement&, int , int)));
- connect(m_effectedit, SIGNAL(parameterChanged(const QDomElement&, const QDomElement&)), this , SLOT(slotUpdateEffectParams(const QDomElement&, const QDomElement&)));
+ connect(m_effectedit, SIGNAL(parameterChanged(const QDomElement, const QDomElement)), this , SLOT(slotUpdateEffectParams(const QDomElement, const QDomElement)));
m_effectLists["audio"] = &MainWindow::audioEffects;
m_effectLists["video"] = &MainWindow::videoEffects;
m_effectLists["custom"] = &MainWindow::customEffects;
setEnabled(false);
}
+EffectStackView::~EffectStackView()
+{
+ m_effectLists.clear();
+ delete m_effectedit;
+}
+
void EffectStackView::setMenu(QMenu *menu)
{
m_ui.buttonNew->setMenu(menu);
emit reloadEffects();
}
-void EffectStackView::slotUpdateEffectParams(const QDomElement& old, const QDomElement& e)
+void EffectStackView::slotUpdateEffectParams(const QDomElement old, const QDomElement e)
{
if (m_clipref)
emit updateClipEffect(m_clipref, old, e, m_ui.effectlist->currentRow());
void EffectStackView::slotClipItemSelected(ClipItem* c, int ix)
{
+ if (c && !c->isEnabled()) return;
if (c && c == m_clipref) {
if (ix == -1) ix = m_ui.effectlist->currentRow();
} else {
m_clipref = c;
- if (c) ix = c->selectedEffectIndex();
- else ix = 0;
+ if (c) {
+ ix = c->selectedEffectIndex();
+ QString size = c->baseClip()->getProperty("frame_size");
+ double factor = c->baseClip()->getProperty("aspect_ratio").toDouble();
+ QPoint p((int)(size.section('x', 0, 0).toInt() * factor + 0.5), size.section('x', 1, 1).toInt());
+ m_effectedit->setFrameSize(p);
+ m_effectedit->setFrameSize(p);
+ } else ix = 0;
}
if (m_clipref == NULL) {
+ m_ui.effectlist->blockSignals(true);
m_ui.effectlist->clear();
m_effectedit->transferParamDesc(QDomElement(), 0, 0);
+ m_ui.effectlist->blockSignals(false);
setEnabled(false);
return;
}
{
bool disable = true;
if (item->checkState() == Qt::Checked) disable = false;
+ m_ui.frame->setEnabled(!disable);
m_ui.buttonReset->setEnabled(!disable);
int activeRow = m_ui.effectlist->currentRow();
if (activeRow >= 0) {
+ m_effectedit->updateParameter("disabled", QString::number((int) disable));
emit changeEffectState(m_clipref, activeRow, disable);
}
}
void EffectStackView::setupListView(int ix)
{
+ m_ui.effectlist->blockSignals(true);
m_ui.effectlist->clear();
// Issue 238: Add icons for effect type in effectstack.
KIcon videoIcon("kdenlive-show-video");
KIcon audioIcon("kdenlive-show-audio");
+ KIcon customIcon("kdenlive-custom-effect");
QListWidgetItem* item;
for (int i = 0; i < m_clipref->effectsCount(); i++) {
- QDomElement d = m_clipref->effectAt(i);
+ const QDomElement d = m_clipref->effectAt(i);
+ if (d.isNull()) {
+ kDebug() << " . . . . WARNING, NULL EFFECT IN STACK!!!!!!!!!";
+ continue;
+ }
+
+ /*QDomDocument doc;
+ doc.appendChild(doc.importNode(d, true));
+ kDebug() << "IMPORTED STK: " << doc.toString();*/
QDomNode namenode = d.elementsByTagName("name").item(0);
if (!namenode.isNull()) {
if ("audio" == type) {
item = new QListWidgetItem(audioIcon, i18n(namenode.toElement().text().toUtf8().data()), m_ui.effectlist);
} else if ("custom" == type) {
- item = new QListWidgetItem(i18n(namenode.toElement().text().toUtf8().data()), m_ui.effectlist);
+ item = new QListWidgetItem(customIcon, i18n(namenode.toElement().text().toUtf8().data()), m_ui.effectlist);
} else {
item = new QListWidgetItem(videoIcon, i18n(namenode.toElement().text().toUtf8().data()), m_ui.effectlist);
}
else item->setCheckState(Qt::Checked);
}
}
- if (m_clipref->effectsCount() == 0) {
- emit transferParamDesc(QDomElement(), 0, 0);
+ if (m_ui.effectlist->count() == 0) {
m_ui.buttonDel->setEnabled(false);
m_ui.buttonSave->setEnabled(false);
m_ui.buttonReset->setEnabled(false);
if (ix < 0) ix = 0;
if (ix > m_ui.effectlist->count() - 1) ix = m_ui.effectlist->count() - 1;
m_ui.effectlist->setCurrentRow(ix);
- m_ui.buttonDel->setEnabled(true);
- m_ui.buttonSave->setEnabled(true);
- m_ui.buttonReset->setEnabled(true);
- m_ui.buttonUp->setEnabled(ix > 0);
- m_ui.buttonDown->setEnabled(ix < m_clipref->effectsCount() - 1);
}
+ m_ui.effectlist->blockSignals(false);
+ if (m_ui.effectlist->count() == 0) m_effectedit->transferParamDesc(QDomElement(), 0, 0);
+ else slotItemSelectionChanged(false);
}
-void EffectStackView::slotItemSelectionChanged()
+void EffectStackView::slotItemSelectionChanged(bool update)
{
bool hasItem = m_ui.effectlist->currentItem();
int activeRow = m_ui.effectlist->currentRow();
bool isChecked = false;
if (hasItem && m_ui.effectlist->currentItem()->checkState() == Qt::Checked) isChecked = true;
if (hasItem && m_ui.effectlist->currentItem()->isSelected()) {
- emit transferParamDesc(m_clipref->effectAt(activeRow), m_clipref->cropStart().frames(KdenliveSettings::project_fps()), m_clipref->cropDuration().frames(KdenliveSettings::project_fps()));//minx max frame
+ m_effectedit->transferParamDesc(m_clipref->effectAt(activeRow), m_clipref->cropStart().frames(KdenliveSettings::project_fps()), m_clipref->cropDuration().frames(KdenliveSettings::project_fps()));//minx max frame
}
- if (m_clipref) m_clipref->setSelectedEffect(activeRow);
+ if (m_clipref && update) m_clipref->setSelectedEffect(activeRow);
m_ui.buttonDel->setEnabled(hasItem);
m_ui.buttonSave->setEnabled(hasItem);
m_ui.buttonReset->setEnabled(hasItem && isChecked);
m_ui.buttonUp->setEnabled(activeRow > 0);
m_ui.buttonDown->setEnabled((activeRow < m_ui.effectlist->count() - 1) && hasItem);
+ m_ui.frame->setEnabled(isChecked);
}
void EffectStackView::slotItemUp()
if (!dom.isNull()) {
dom.setAttribute("kdenlive_ix", old.attribute("kdenlive_ix"));
m_clipref->initEffect(dom);
- emit transferParamDesc(dom, m_clipref->cropStart().frames(KdenliveSettings::project_fps()), m_clipref->cropDuration().frames(KdenliveSettings::project_fps()));//minx max frame
+ m_effectedit->transferParamDesc(dom, m_clipref->cropStart().frames(KdenliveSettings::project_fps()), m_clipref->cropDuration().frames(KdenliveSettings::project_fps()));//minx max frame
emit updateClipEffect(m_clipref, old, dom, activeRow);
}
}
void EffectStackView::clear()
{
+ m_ui.effectlist->blockSignals(true);
m_ui.effectlist->clear();
m_ui.buttonDel->setEnabled(false);
m_ui.buttonSave->setEnabled(false);
m_ui.buttonUp->setEnabled(false);
m_ui.buttonDown->setEnabled(false);
m_effectedit->transferParamDesc(QDomElement(), 0, 0);
+ m_ui.effectlist->blockSignals(false);
}
#include "effectstackview.moc"