Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Correctly mark disabled effects on project load

Fixes #14
parent 989c1c63
......@@ -27,10 +27,10 @@
#include <KLocalizedString>
#include <utility>
AbstractEffectItem::AbstractEffectItem(EffectItemType type, const QList<QVariant> &data, const std::shared_ptr<AbstractTreeModel> &stack, bool isRoot)
AbstractEffectItem::AbstractEffectItem(EffectItemType type, const QList<QVariant> &data, const std::shared_ptr<AbstractTreeModel> &stack, bool isRoot, bool isEnabled)
: TreeItem(data, stack, isRoot)
, m_effectItemType(type)
, m_enabled(true)
, m_enabled(isEnabled)
, m_effectStackEnabled(true)
{
}
......
......@@ -33,7 +33,7 @@ class AbstractEffectItem : public TreeItem
{
public:
AbstractEffectItem(EffectItemType type, const QList<QVariant> &data, const std::shared_ptr<AbstractTreeModel> &stack, bool isRoot = false);
AbstractEffectItem(EffectItemType type, const QList<QVariant> &data, const std::shared_ptr<AbstractTreeModel> &stack, bool isRoot = false, bool isEnabled = true);
/* @brief This function change the individual enabled state of the effect, creating an undo/redo entry*/
void markEnabled(const QString &name, bool enabled);
......
......@@ -27,8 +27,8 @@
#include <utility>
EffectItemModel::EffectItemModel(const QList<QVariant> &data, Mlt::Properties *effect, const QDomElement &xml, const QString &effectId,
const std::shared_ptr<AbstractTreeModel> &stack)
: AbstractEffectItem(EffectItemType::Effect, data, stack)
const std::shared_ptr<AbstractTreeModel> &stack, bool isEnabled)
: AbstractEffectItem(EffectItemType::Effect, data, stack, false, isEnabled)
, AssetParameterModel(effect, xml, effectId, std::static_pointer_cast<EffectStackModel>(stack)->getOwnerId())
{
}
......@@ -45,7 +45,7 @@ std::shared_ptr<EffectItemModel> EffectItemModel::construct(const QString &effec
QList<QVariant> data;
data << EffectsRepository::get()->getName(effectId) << effectId;
std::shared_ptr<EffectItemModel> self(new EffectItemModel(data, effect, xml, effectId, std::move(stack)));
std::shared_ptr<EffectItemModel> self(new EffectItemModel(data, effect, xml, effectId, std::move(stack), true));
baseFinishConstruct(self);
return self;
......@@ -71,10 +71,8 @@ std::shared_ptr<EffectItemModel> EffectItemModel::construct(Mlt::Properties *eff
QList<QVariant> data;
data << EffectsRepository::get()->getName(effectId) << effectId;
std::shared_ptr<EffectItemModel> self(new EffectItemModel(data, effect, xml, effectId, std::move(stack)));
std::shared_ptr<EffectItemModel> self(new EffectItemModel(data, effect, xml, effectId, std::move(stack), effect->get_int("disable") == 0));
baseFinishConstruct(self);
return self;
}
......
......@@ -60,7 +60,7 @@ public:
protected:
EffectItemModel(const QList<QVariant> &data, Mlt::Properties *effect, const QDomElement &xml, const QString &effectId,
const std::shared_ptr<AbstractTreeModel> &stack);
const std::shared_ptr<AbstractTreeModel> &stack, bool isEnabled = true);
void updateEnable() override;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment