+void EffectStackView::slotItemChanged(QListWidgetItem *item)
+{
+ 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++) {
+ 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()) {
+ // Issue 238: Add icons for effect type in effectstack.
+ // Logic more or less copied from initeffects.cpp
+ QString type = d.attribute("type", QString());
+ if ("audio" == type) {
+ item = new QListWidgetItem(audioIcon, i18n(namenode.toElement().text().toUtf8().data()), m_ui.effectlist);
+ } else if ("custom" == type) {
+ 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);
+ }
+ item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ if (d.attribute("disabled") == "1") item->setCheckState(Qt::Unchecked);
+ else item->setCheckState(Qt::Checked);
+ }
+ }
+ if (m_ui.effectlist->count() == 0) {
+ m_ui.buttonDel->setEnabled(false);
+ m_ui.buttonSave->setEnabled(false);
+ m_ui.buttonReset->setEnabled(false);
+ m_ui.buttonUp->setEnabled(false);
+ m_ui.buttonDown->setEnabled(false);
+ } else {
+ 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.effectlist->blockSignals(false);
+ if (m_ui.effectlist->count() == 0) m_effectedit->transferParamDesc(QDomElement(), 0, 0);
+ else slotItemSelectionChanged(false);
+}
+
+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()) {
+ 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 && 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()
+{
+ int activeRow = m_ui.effectlist->currentRow();
+ if (activeRow <= 0) return;
+ emit changeEffectPosition(m_clipref, 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);
+}
+
+void EffectStackView::slotItemDel()
+{
+ int activeRow = m_ui.effectlist->currentRow();
+ if (activeRow >= 0) {
+ emit removeEffect(m_clipref, m_clipref->effectAt(activeRow));
+ }
+}
+
+void EffectStackView::slotResetEffect()
+{
+ int activeRow = m_ui.effectlist->currentRow();
+ if (activeRow < 0) return;
+ QDomElement old = m_clipref->effectAt(activeRow).cloneNode().toElement();
+ QDomElement dom;
+ QString effectName = m_ui.effectlist->currentItem()->text();
+ foreach(const QString &type, m_effectLists.keys()) {
+ EffectsList *list = m_effectLists[type];
+ if (list->effectNames().contains(effectName)) {
+ dom = list->getEffectByName(effectName).cloneNode().toElement();
+ break;
+ }
+ }
+ if (!dom.isNull()) {
+ dom.setAttribute("kdenlive_ix", old.attribute("kdenlive_ix"));
+ m_clipref->initEffect(dom);
+ 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::raiseWindow(QWidget* dock)
+{
+ if (m_clipref && dock)
+ dock->raise();
+}
+
+void EffectStackView::clear()
+{
+ m_ui.effectlist->blockSignals(true);
+ m_ui.effectlist->clear();
+ m_ui.buttonDel->setEnabled(false);
+ m_ui.buttonSave->setEnabled(false);
+ m_ui.buttonReset->setEnabled(false);
+ m_ui.buttonUp->setEnabled(false);
+ m_ui.buttonDown->setEnabled(false);
+ m_effectedit->transferParamDesc(QDomElement(), 0, 0);
+ m_ui.effectlist->blockSignals(false);
+}
+
+
+void EffectStackView::slotSeekTimeline(int pos)