File indexing completed on 2024-05-19 04:54:22
0001 /* 0002 SPDX-FileCopyrightText: 2017 Nicolas Carion 0003 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 */ 0005 0006 #pragma once 0007 0008 #include "abstractmodel/treeitem.hpp" 0009 #include <mlt++/MltFilter.h> 0010 0011 enum class EffectItemType { Effect, Group }; 0012 class EffectStackModel; 0013 /** @brief This represents an effect of the effectstack 0014 */ 0015 class AbstractEffectItem : public TreeItem 0016 { 0017 0018 public: 0019 AbstractEffectItem(EffectItemType type, const QList<QVariant> &data, const std::shared_ptr<AbstractTreeModel> &stack, bool isRoot = false, 0020 bool isEnabled = true); 0021 0022 /** @brief This function change the individual enabled state of the effect, creating an undo/redo entry*/ 0023 void markEnabled(const QString &name, bool enabled); 0024 /** @brief This function directly change the individual enabled state of the effect */ 0025 void setEnabled(bool enabled); 0026 0027 /** @brief This function change the global (effectstack-wise) enabled state of the effect */ 0028 void setEffectStackEnabled(bool enabled); 0029 0030 /** @brief Returns whether the effect is enabled */ 0031 bool isEnabled() const; 0032 0033 friend class EffectGroupModel; 0034 0035 EffectItemType effectItemType() const; 0036 0037 /** @brief Return true if the effect or effect group applies only to audio */ 0038 virtual bool isAudio() const = 0; 0039 /** @brief Return true if this effect can only have one instance in an effect stack */ 0040 virtual bool isUnique() const = 0; 0041 0042 /** @brief This function plants the effect into the given service in last position 0043 */ 0044 virtual void plant(const std::weak_ptr<Mlt::Service> &service) = 0; 0045 virtual void plantClone(const std::weak_ptr<Mlt::Service> &service) = 0; 0046 /** @brief This function unplants (removes) the effect from the given service 0047 */ 0048 virtual void unplant(const std::weak_ptr<Mlt::Service> &service) = 0; 0049 virtual void unplantClone(const std::weak_ptr<Mlt::Service> &service) = 0; 0050 0051 protected: 0052 /** @brief Toggles the mlt effect according to the current activation state*/ 0053 virtual void updateEnable(bool updateTimeline = true) = 0; 0054 0055 EffectItemType m_effectItemType; 0056 bool m_enabled; 0057 bool m_effectStackEnabled; 0058 };