1 /* 2 SPDX-FileCopyrightText: 2017 Nicolas Carion 3 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 4 */ 5 6 #ifndef EFFECTITEMMODEL_H 7 #define EFFECTITEMMODEL_H 8 9 #include "abstracteffectitem.hpp" 10 #include "abstractmodel/treeitem.hpp" 11 #include "assets/model/assetparametermodel.hpp" 12 #include <mlt++/MltFilter.h> 13 14 class EffectStackModel; 15 /** @brief This represents an effect of the effectstack 16 */ 17 class EffectItemModel : public AbstractEffectItem, public AssetParameterModel 18 { 19 20 public: 21 /** @brief This construct an effect of the given id 22 @param is a ptr to the model this item belongs to. This is required to send update signals 23 */ 24 static std::shared_ptr<EffectItemModel> construct(const QString &effectId, std::shared_ptr<AbstractTreeModel> stack, bool effectEnabled = true); 25 /** @brief This construct an effect with an already existing filter 26 Only used when loading an existing clip 27 */ 28 static std::shared_ptr<EffectItemModel> construct(std::unique_ptr<Mlt::Properties> effect, std::shared_ptr<AbstractTreeModel> stack, QString originalDecimalPoint); 29 30 /** @brief This function plants the effect into the given service in last position 31 */ 32 void plant(const std::weak_ptr<Mlt::Service> &service) override; 33 void plantClone(const std::weak_ptr<Mlt::Service> &service) override; 34 void loadClone(const std::weak_ptr<Mlt::Service> &service); 35 /** @brief This function unplants (removes) the effect from the given service 36 */ 37 void unplant(const std::weak_ptr<Mlt::Service> &service) override; 38 void unplantClone(const std::weak_ptr<Mlt::Service> &service) override; 39 40 Mlt::Filter &filter() const; 41 42 /** @brief Return true if the effect applies only to audio */ 43 bool isAudio() const override; 44 bool isUnique() const override; 45 46 void setCollapsed(bool collapsed); 47 bool isCollapsed() const; 48 bool hasForcedInOut() const; 49 bool isValid() const; 50 QPair <int, int> getInOut() const; 51 void setInOut(const QString &effectName, QPair<int, int>bounds, bool enabled, bool withUndo); 52 53 protected: 54 EffectItemModel(const QList<QVariant> &effectData, std::unique_ptr<Mlt::Properties> effect, const QDomElement &xml, const QString &effectId, 55 const std::shared_ptr<AbstractTreeModel> &stack, bool isEnabled = true, QString originalDecimalPoint = QString()); 56 QMap<int, std::shared_ptr<EffectItemModel>> m_childEffects; 57 void updateEnable(bool updateTimeline = true) override; 58 int m_childId; 59 }; 60 61 #endif 62