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

Add JSon mimetype for Lottie animations, allow editing and check if module is there at first start

parent 415f9251
Pipeline #191595 passed with stage
in 7 minutes and 26 seconds
......@@ -2365,7 +2365,8 @@ void Bin::selectProxyModel(const QModelIndex &id)
m_editAction->setEnabled(true);
m_extractAudioAction->menuAction()->setVisible(hasAudio);
m_extractAudioAction->setEnabled(hasAudio);
m_openAction->setEnabled(type == ClipType::Image || type == ClipType::Audio || type == ClipType::TextTemplate || type == ClipType::Text);
m_openAction->setEnabled(type == ClipType::Image || type == ClipType::Audio || type == ClipType::TextTemplate || type == ClipType::Text ||
type == ClipType::Animation);
m_openAction->setVisible(!isFolder);
m_duplicateAction->setEnabled(isClip);
m_duplicateAction->setVisible(!isFolder);
......@@ -2900,6 +2901,11 @@ void Bin::setupAddClipAction(QMenu *addClipMenu, ClipType::ProducerType type, co
action->setData(static_cast<QVariant>(type));
addClipMenu->addAction(action);
connect(action, &QAction::triggered, this, &Bin::slotCreateProjectClip);
if (name == QLatin1String("add_animation_clip") && !KdenliveSettings::producerslist().contains(QLatin1String("glaxnimate"))) {
action->setEnabled(false);
} else if (name == QLatin1String("add_text_clip") && !KdenliveSettings::producerslist().contains(QLatin1String("kdenlivetitle"))) {
action->setEnabled(false);
}
}
void Bin::showClipProperties(const std::shared_ptr<ProjectClip> &clip, bool forceRefresh)
......@@ -4076,6 +4082,14 @@ void Bin::slotOpenClipExtern()
}
}
break;
case ClipType::Animation: {
QString glaxBinary = QStandardPaths::findExecutable(QStringLiteral("glaxnimate"));
if (glaxBinary.isEmpty()) {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Please install Glaxnimate to edit Lottie animations"));
} else {
QProcess::startDetached(glaxBinary, {clip->url()});
}
} break;
default:
break;
}
......
......@@ -72,6 +72,11 @@ QStringList ClipCreationDialog::getExtensions()
<< QStringLiteral("image/webp") << QStringLiteral("image/jp2") << QStringLiteral("image/avif") << QStringLiteral("image/heif")
<< QStringLiteral("image/jxl");
// Lottie animations
if (KdenliveSettings::producerslist().contains(QLatin1String("glaxnimate"))) {
mimeTypes << QStringLiteral("application/json");
}
QMimeDatabase db;
QStringList allExtensions;
for (const QString &mimeType : qAsConst(mimeTypes)) {
......@@ -211,7 +216,7 @@ void ClipCreationDialog::createAnimationClip(KdenliveDoc *doc, const QString &pa
file.close();
QString glaxBinary = QStandardPaths::findExecutable(QStringLiteral("glaxnimate"));
if (glaxBinary.isEmpty()) {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Cannot find Glaxnimate, please install it on your computer to allow editing animations."));
KMessageBox::sorry(QApplication::activeWindow(), i18n("Please install Glaxnimate to edit Lottie animations."));
return;
}
QProcess::startDetached(glaxBinary, {fileName});
......
......@@ -532,10 +532,13 @@ void Wizard::checkMltComponents()
if (!producersItemList.contains(QStringLiteral("kdenlivetitle"))) {
qDebug() << "Missing TITLER MLT module";
m_warnings.append(i18n("<li>Missing MLT module: <b>kdenlivetitle</b><br/>required to create titles</li>"));
KdenliveSettings::setHastitleproducer(false);
m_brokenModule = true;
} else {
KdenliveSettings::setHastitleproducer(true);
}
// Animation module
if (!producersItemList.contains(QStringLiteral("glaxnimate"))) {
qDebug() << "Missing Glaxnimate MLT module";
m_warnings.append(i18n("<li>Missing MLT module: <b>glaxnimate</b><br/>required to load Lottie animations</li>"));
m_brokenModule = true;
}
}
if (m_systemCheckIsOk && !m_brokenModule) {
......
......@@ -989,11 +989,6 @@
<default></default>
</entry>
<entry name="hastitleproducer" type="Bool">
<label>Is MLT compiled with Qt4 Kdenlive title support.</label>
<default>true</default>
</entry>
<entry name="mixerCollapse" type="Bool">
<label>Collapse audio mixer (only show master channel).</label>
<default>false</default>
......
......@@ -531,7 +531,7 @@ TitleWidget::TitleWidget(const QUrl &url, QString projectTitlePath, Monitor *mon
connect(anim_end, &QAbstractButton::toggled, this, &TitleWidget::slotAnimEnd);
connect(templateBox, SIGNAL(currentIndexChanged(int)), this, SLOT(templateIndexChanged(int)));
createButton->setEnabled(KdenliveSettings::hastitleproducer());
createButton->setEnabled(KdenliveSettings::producerslist().contains(QStringLiteral("kdenlivetitle")));
auto *addMenu = new QMenu(this);
addMenu->addAction(i18n("Save and add to project"));
m_createTitleAction = new QAction(i18n("Create Title"), this);
......
Supports Markdown
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