+void CustomTrackView::processEffect(ClipItem *item, QDomElement effect, int offset, QUndoCommand *effectCommand)
+{
+ if (effect.attribute("type") == "audio") {
+ // Don't add audio effects on video clips
+ if (item->isVideoOnly() || (item->clipType() != AUDIO && item->clipType() != AV && item->clipType() != PLAYLIST)) {
+ /* do not show error message when item is part of a group as the user probably knows what he does then
+ * and the message is annoying when working with the split audio feature */
+ if (!item->parentItem() || item->parentItem() == m_selectionGroup)
+ emit displayMessage(i18n("Cannot add an audio effect to this clip"), ErrorMessage);
+ return;
+ }
+ } else if (effect.attribute("type") == "video" || !effect.hasAttribute("type")) {
+ // Don't add video effect on audio clips
+ if (item->isAudioOnly() || item->clipType() == AUDIO) {
+ /* do not show error message when item is part of a group as the user probably knows what he does then
+ * and the message is annoying when working with the split audio feature */
+ if (!item->parentItem() || item->parentItem() == m_selectionGroup)
+ emit displayMessage(i18n("Cannot add a video effect to this clip"), ErrorMessage);
+ return;
+ }
+ }
+ if (effect.attribute("unique", "0") != "0" && item->hasEffect(effect.attribute("tag"), effect.attribute("id")) != -1) {
+ emit displayMessage(i18n("Effect already present in clip"), ErrorMessage);
+ return;
+ }
+ if (item->isItemLocked()) {
+ return;
+ }
+
+ if (effect.attribute("id") == "freeze" && m_cursorPos > item->startPos().frames(m_document->fps()) && m_cursorPos < item->endPos().frames(m_document->fps())) {
+ item->initEffect(effect, m_cursorPos - item->startPos().frames(m_document->fps()), offset);
+ } else {
+ item->initEffect(effect, 0, offset);
+ }
+ new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), effect, true, effectCommand);
+}
+