Commit 202bfe70 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix custom effects not recognized as audio

Fixes #336
parent 62f537f5
Pipeline #7013 passed with stage
in 19 minutes and 20 seconds
......@@ -77,8 +77,9 @@ QImage AssetIconProvider::makeIcon(const QString &effectId, const QString &effec
bool isAudio = false;
bool isCustom = false;
if (m_effect) {
isAudio = EffectsRepository::get()->getType(effectId) == EffectType::Audio;
isCustom = EffectsRepository::get()->getType(effectId) == EffectType::Custom;
EffectType type = EffectsRepository::get()->getType(effectId);
isAudio = type == EffectType::Audio || type == EffectType::CustomAudio;
isCustom = type == EffectType::CustomAudio || type == EffectType::Custom;
} else {
auto type = TransitionsRepository::get()->getType(effectId);
isAudio = (type == TransitionType::AudioComposition) || (type == TransitionType::AudioTransition);
......
......@@ -101,7 +101,7 @@ std::shared_ptr<EffectTreeModel> EffectTreeModel::construct(const QString &categ
targetCategory = audioCategory;
}
if (type == EffectType::Custom) {
if (type == EffectType::Custom || type == EffectType::CustomAudio) {
targetCategory = self->m_customCategory;
}
......
......@@ -70,6 +70,8 @@ void EffectListWidget::setFilterType(const QString &type)
static_cast<EffectFilter *>(m_proxyModel.get())->setFilterType(true, EffectType::Video);
} else if (type == "audio") {
static_cast<EffectFilter *>(m_proxyModel.get())->setFilterType(true, EffectType::Audio);
} else if (type == "customAudio") {
static_cast<EffectFilter *>(m_proxyModel.get())->setFilterType(true, EffectType::CustomAudio);
} else if (type == "custom") {
static_cast<EffectFilter *>(m_proxyModel.get())->setFilterType(true, EffectType::Custom);
} else if (type == "favorites") {
......
......@@ -123,6 +123,8 @@ void EffectsRepository::parseCustomAssetFile(const QString &file_name, std::unor
result.type = EffectType::Audio;
} else if (type == QLatin1String("custom")) {
result.type = EffectType::Custom;
} else if (type == QLatin1String("customAudio")) {
result.type = EffectType::CustomAudio;
} else if (type == QLatin1String("hidden")) {
result.type = EffectType::Hidden;
} else {
......
......@@ -35,7 +35,7 @@
* Note that this class is a Singleton
*/
enum class EffectType { Preferred, Video, Audio, Custom, Favorites, Hidden };
enum class EffectType { Preferred, Video, Audio, Custom, CustomAudio, Favorites, Hidden };
Q_DECLARE_METATYPE(EffectType)
class EffectsRepository : public AbstractAssetsRepository<EffectType>
......
......@@ -216,5 +216,6 @@ bool EffectItemModel::isCollapsed()
bool EffectItemModel::isAudio() const
{
return EffectsRepository::get()->getType(getAssetId()) == EffectType::Audio;
EffectType type = EffectsRepository::get()->getType(getAssetId());
return type == EffectType::Audio || type == EffectType::CustomAudio;
}
......@@ -284,7 +284,8 @@ bool EffectStackModel::fromXml(const QDomElement &effectsXml, Fun &undo, Fun &re
for (int i = 0; i < nodeList.count(); ++i) {
QDomElement node = nodeList.item(i).toElement();
const QString effectId = node.attribute(QStringLiteral("id"));
bool isAudioEffect = EffectsRepository::get()->getType(effectId) == EffectType::Audio;
EffectType type = EffectsRepository::get()->getType(effectId);
bool isAudioEffect = type == EffectType::Audio || type == EffectType::CustomAudio;
if (isAudioEffect) {
if (state != PlaylistState::AudioOnly) {
continue;
......
......@@ -432,7 +432,8 @@ void CollapsibleEffectView::slotSaveEffect()
effect = doc.firstChild().toElement();
effect.removeAttribute(QStringLiteral("kdenlive_ix"));
effect.setAttribute(QStringLiteral("id"), name);
effect.setAttribute(QStringLiteral("type"), QStringLiteral("custom"));
QString masterType = effect.attribute(QLatin1String("type"));
effect.setAttribute(QStringLiteral("type"), (masterType == QLatin1String("audio") || masterType == QLatin1String("customAudio")) ? QStringLiteral("customAudio") : QStringLiteral("custom"));
/*
if (m_paramWidget) {
int in = m_paramWidget->range().x();
......
......@@ -309,7 +309,8 @@ void ClipModel::setTimelineEffectsEnabled(bool enabled)
bool ClipModel::addEffect(const QString &effectId)
{
QWriteLocker locker(&m_lock);
if (EffectsRepository::get()->getType(effectId) == EffectType::Audio) {
EffectType type = EffectsRepository::get()->getType(effectId);
if (type == EffectType::Audio || type == EffectType::CustomAudio) {
if (m_currentState == PlaylistState::VideoOnly) {
return false;
}
......
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