Commit 9c9672d5 authored by Pushkar Kukde's avatar Pushkar Kukde

Merge branch 'master' of https://invent.kde.org/multimedia/kdenlive into timeline-archive

parents 18d09e2f b4895a06
......@@ -6,12 +6,12 @@
<parameter type="animatedrect" name="rect" default="0 0 %width %height" opacity="false">
<name>Rectangle</name>
</parameter>
<parameter type="animated" name="radius" default="0" min="0" max="1" decimals="2">
<name>Radius</name>
</parameter>
<parameter type="bool" name="circle" default="0">
<name>Circle</name>
</parameter>
<parameter type="constant" name="radius" default="0" min="0" max="1" decimals="2">
<name>Radius</name>
</parameter>
<parameter type="color" name="color" default="0x00000000" alpha="1">
<name>Padding Color</name>
</parameter>
......
......@@ -22,6 +22,7 @@ Name[pl]=Układy klawiatur Kdenlive
Name[pt]=Esquemas de Teclado do Kdenlive
Name[pt_BR]=Esquemas de teclado do Kdenlive
Name[ru]=Схемы горячих клавиш
Name[sk]=Schémy klávesnice Kdenlive
Name[sl]=Sheme tipkovnic Kdenlive
Name[sv]=Kdenlive-tangentbordsinställningar
Name[uk]=Схеми клавіатурних скорочень Kdenlive
......
......@@ -2,7 +2,7 @@
"app-id": "org.kde.kdenlive",
"default-branch": "master",
"runtime": "org.kde.Platform",
"runtime-version": "5.13",
"runtime-version": "5.15",
"sdk": "org.kde.Sdk",
"command": "kdenlive",
"rename-icon": "kdenlive",
......
......@@ -334,7 +334,7 @@ template <typename AssetType> bool AbstractAssetsRepository<AssetType>::parseInf
// Update description if the xml provide one
QString description = Xml::getSubTagContent(currentAsset, QStringLiteral("description"));
if (!description.isEmpty()) {
res.description = i18n(description.toUtf8().constData()) + QString(" (%1)").arg(res.id);
res.description = i18n(description.toUtf8().constData()) + QString(" (%1)").arg(res.mltId);
}
// Update name if the xml provide one
......
......@@ -88,6 +88,7 @@ QString AssetTreeModel::getDescription(bool isEffect, const QModelIndex &index)
return QString();
}
QVariant AssetTreeModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) {
......
......@@ -49,6 +49,7 @@ public:
virtual void reloadAssetMenu(QMenu *effectsMenu, KActionCategory *effectActions) = 0;
virtual void setFavorite(const QModelIndex &index, bool favorite, bool isEffect) = 0;
virtual void deleteEffect(const QModelIndex &index) = 0;
virtual void editCustomAsset( const QString newName,const QString newDescription,const QModelIndex &index) = 0;
// for convenience, we store the column of each data field
static int nameCol, idCol, favCol, typeCol, preferredCol;
......
......@@ -55,7 +55,7 @@ public:
/* @brief Delete a custom effect */
void deleteCustomEffect(const QModelIndex &index);
virtual void reloadCustomEffectIx(const QModelIndex &index) = 0;
virtual void editCustomAsset(const QModelIndex &index) = 0;
/* @brief Returns the description of the asset given its model index */
QString getDescription(bool isEffect, const QModelIndex &index) const;
......
......@@ -338,6 +338,14 @@ Rectangle {
assetlist.reloadCustomEffectIx(sel.currentIndex)
}
}
MenuItem {
id: editMenu
text: i18n("Edit Info")
visible: isEffectList && assetContextMenu.isCustom
onTriggered: {
assetlist.editCustomEffectInfo(sel.currentIndex)
}
}
}
TableViewColumn { role: "identifier"; title: i18n("Name"); }
......
......@@ -3656,6 +3656,9 @@ void Bin::showTitleWidget(const std::shared_ptr<ProjectClip> &clip)
QString path = clip->getProducerProperty(QStringLiteral("resource"));
QDir titleFolder(m_doc->projectDataFolder() + QStringLiteral("/titles"));
titleFolder.mkpath(QStringLiteral("."));
QList<int> clips = clip->timelineInstances();
// Temporarily hide this title clip in timeline so that it does not appear when requesting background frame
pCore->temporaryUnplug(clips, true);
TitleWidget dia_ui(QUrl(), m_doc->timecode(), titleFolder.absolutePath(), pCore->monitorManager()->projectMonitor(), pCore->window());
QDomDocument doc;
QString xmldata = clip->getProducerProperty(QStringLiteral("xmldata"));
......@@ -3666,8 +3669,9 @@ void Bin::showTitleWidget(const std::shared_ptr<ProjectClip> &clip)
} else {
doc.setContent(xmldata);
}
dia_ui.setXml(doc, clip->AbstractProjectItem::clipId());
dia_ui.setXml(doc, clip->clipId());
if (dia_ui.exec() == QDialog::Accepted) {
pCore->temporaryUnplug(clips, false);
QMap<QString, QString> newprops;
newprops.insert(QStringLiteral("xmldata"), dia_ui.xml().toString());
if (dia_ui.duration() != clip->duration().frames(pCore->getCurrentFps())) {
......@@ -3696,6 +3700,8 @@ void Bin::showTitleWidget(const std::shared_ptr<ProjectClip> &clip)
}
}
slotEditClipCommand(clip->AbstractProjectItem::clipId(), clip->currentProperties(newprops), newprops);
} else {
pCore->temporaryUnplug(clips, false);
}
}
......
......@@ -935,3 +935,8 @@ void Core::addGuides(QList <int> guides)
}
pCore->currentDoc()->getGuideModel()->addMarkers(markers);
}
void Core::temporaryUnplug(QList<int> clipIds, bool hide)
{
pCore->window()->getMainTimeline()->controller()->temporaryUnplug(clipIds, hide);
}
......@@ -230,6 +230,9 @@ public:
int audioChannels();
/** @brief Add guides in the project. */
void addGuides(QList <int> guides);
/** @brief Temporarily un/plug a list of clips in timeline. */
void temporaryUnplug(QList<int> clipIds, bool hide);
KSharedDataCache audioThumbCache;
private:
......
......@@ -32,6 +32,7 @@
#include <KActionCategory>
#include <QDebug>
#include <QMenu>
#include <QMessageBox>
EffectTreeModel::EffectTreeModel(QObject *parent)
: AssetTreeModel(parent)
......@@ -196,3 +197,79 @@ void EffectTreeModel::setFavorite(const QModelIndex &index, bool favorite, bool
KdenliveSettings::setFavorite_effects(favs);
}
void EffectTreeModel::editCustomAsset(const QString newName,const QString newDescription, const QModelIndex &index)
{
std::shared_ptr<TreeItem> item = getItemById((int)index.internalId());
QString currentName = item->dataColumn(AssetTreeModel::nameCol).toString();
QDomDocument doc;
QDomElement effect = EffectsRepository::get()->getXml(currentName);
QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/effects/"));
QString oldpath = dir.absoluteFilePath(currentName + QStringLiteral(".xml"));
doc.appendChild(doc.importNode(effect, true));
if(!newDescription.trimmed().isEmpty()){
QDomElement root = doc.documentElement();
QDomElement nodelist = root.firstChildElement("description");
QDomElement newNodeTag = doc.createElement(QString("description"));
QDomText text = doc.createTextNode(newDescription);
newNodeTag.appendChild(text);
if (!nodelist.isNull()) {
root.replaceChild(newNodeTag, nodelist);
} else {
root.appendChild(newNodeTag);
}
}
if(!newName.trimmed().isEmpty() && newName != currentName)
{
QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/effects/"));
if (!dir.exists()) {
dir.mkpath(QStringLiteral("."));
}
if (dir.exists(newName + QStringLiteral(".xml"))){
QMessageBox message;
message.critical(0, i18n("Error"), i18n("Effect name %1 already exists.\n Try another name?", newName));
message.setFixedSize(400, 200);
return;
}
QFile file(dir.absoluteFilePath(newName + QStringLiteral(".xml")));
QDomElement root = doc.documentElement();
QDomElement nodelist = root.firstChildElement("name");
QDomElement newNodeTag = doc.createElement(QString("name"));
QDomText text = doc.createTextNode(newName);
newNodeTag.appendChild(text);
root.replaceChild(newNodeTag, nodelist);
QDomElement e = doc.documentElement();
e.setAttribute("id", newName);
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
out << doc.toString();
}
file.close();
deleteEffect(index);
reloadEffect(dir.absoluteFilePath(newName + QStringLiteral(".xml")));
}
else
{
QFile file(dir.absoluteFilePath(currentName + QStringLiteral(".xml")));
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
out << doc.toString();
}
file.close();
reloadEffect(oldpath);
}
}
......@@ -42,6 +42,7 @@ public:
void reloadAssetMenu(QMenu *effectsMenu, KActionCategory *effectActions) override;
void setFavorite(const QModelIndex &index, bool favorite, bool isEffect) override;
void deleteEffect(const QModelIndex &index) override;
void editCustomAsset(const QString newName, const QString newDescription, const QModelIndex &index) override;
protected:
std::shared_ptr<TreeItem> m_customCategory;
......
......@@ -29,6 +29,12 @@
#include <QQmlContext>
#include <QStandardPaths>
#include <memory>
#include <QFormLayout>
#include <QDialog>
#include <QDialogButtonBox>
#include <QLineEdit>
#include <QTextEdit>
EffectListWidget::EffectListWidget(QWidget *parent)
: AssetListWidget(parent)
{
......@@ -101,3 +107,26 @@ void EffectListWidget::reloadEffectMenu(QMenu *effectsMenu, KActionCategory *eff
{
m_model->reloadAssetMenu(effectsMenu, effectActions);
}
void EffectListWidget::editCustomAsset(const QModelIndex &index)
{
QDialog dialog(this);
QFormLayout form(&dialog);
QLineEdit *effectName = new QLineEdit(getName(index), &dialog);
QTextEdit *descriptionBox = new QTextEdit(getDescription(true, index), &dialog);
form.addRow(i18n("Name : "), effectName);
form.addRow(i18n("Comments : "), descriptionBox);
QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog);
form.addRow(&buttonBox);
QObject::connect(&buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
QObject::connect(&buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
if(dialog.exec() == QDialog::Accepted) {
QString name = effectName->text();
QString enteredDescription = descriptionBox->toPlainText();
if (name.trimmed().isEmpty() && enteredDescription.trimmed().isEmpty()) {
return;
}
m_model->editCustomAsset(name, enteredDescription, m_proxyModel->mapToSource(index));
}
}
......@@ -48,7 +48,7 @@ public:
void updateFavorite(const QModelIndex &index);
void reloadEffectMenu(QMenu *effectsMenu, KActionCategory *effectActions);
void reloadCustomEffectIx(const QModelIndex &index) override;
void editCustomAsset(const QModelIndex &index) override;
public slots:
void reloadCustomEffect(const QString &path);
......@@ -81,6 +81,7 @@ public:
}
Q_INVOKABLE void deleteCustomEffect(const QModelIndex &index) { q->deleteCustomEffect(index); }
Q_INVOKABLE QString getDescription(const QModelIndex &index) const { return q->getDescription(true, index); }
Q_INVOKABLE void editCustomEffectInfo(const QModelIndex &index){ q->editCustomAsset(index); }
Q_INVOKABLE QVariantMap getMimeData(const QString &assetId) const { return q->getMimeData(assetId); }
Q_INVOKABLE void activate(const QModelIndex &ix) { q->activate(ix); }
......
......@@ -80,6 +80,7 @@ void EffectsRepository::parseCustomAssetFile(const QString &file_name, std::unor
//qDebug() << "Error: found unsupported effect group" << base.attribute(QStringLiteral("name"))<<" : "<<file_name;
Info result;
result.xml = base;
result.description = Xml::getSubTagContent(base, QStringLiteral("description"));
for (int i = 0; i < effects.count(); ++i) {
QDomNode currentNode = effects.item(i);
if (currentNode.isNull()) {
......
......@@ -225,7 +225,7 @@ bool ProxyJob::startJob()
return true;
} else {
m_isFfmpegJob = true;
if (KdenliveSettings::ffmpegpath().isEmpty()) {
if (!QFileInfo(KdenliveSettings::ffmpegpath()).isFile()) {
// FFmpeg not detected, cannot process the Job
m_errorMessage.prepend(i18n("Failed to create proxy. FFmpeg not found, please set path in Kdenlive's settings Environment"));
m_done = true;
......
......@@ -266,6 +266,35 @@ bool TrackModel::requestClipInsertion(int clipId, int position, bool updateView,
return false;
}
void TrackModel::temporaryUnplugClip(int clipId)
{
QWriteLocker locker(&m_lock);
int clip_position = m_allClips[clipId]->getPosition();
auto clip_loc = getClipIndexAt(clip_position);
int target_track = clip_loc.first;
int target_clip = clip_loc.second;
// lock MLT playlist so that we don't end up with invalid frames in monitor
m_playlists[target_track].lock();
Q_ASSERT(target_clip < m_playlists[target_track].count());
Q_ASSERT(!m_playlists[target_track].is_blank(target_clip));
std::unique_ptr<Mlt::Producer> prod(m_playlists[target_track].replace_with_blank(target_clip));
m_playlists[target_track].unlock();
}
void TrackModel::temporaryReplugClip(int cid)
{
QWriteLocker locker(&m_lock);
int clip_position = m_allClips[cid]->getPosition();
int target_track = m_allClips[cid]->getSubPlaylistIndex();
m_playlists[target_track].lock();
if (auto ptr = m_parent.lock()) {
std::shared_ptr<ClipModel> clip = ptr->getClipPtr(cid);
m_playlists[target_track].insert_at(clip_position, *clip, 1);
}
m_playlists[target_track].unlock();
}
void TrackModel::replugClip(int clipId)
{
QWriteLocker locker(&m_lock);
......
......@@ -254,6 +254,8 @@ protected:
/* @brief This function removes the clip from the mlt object, and then insert it back in the same spot again.
* This is used when some properties of the clip have changed, and we need this to refresh it */
void replugClip(int clipId);
void temporaryReplugClip(int cid);
void temporaryUnplugClip(int clipId);
int trackDuration() const;
......
......@@ -3676,3 +3676,18 @@ void TimelineController::addTracks(int videoTracks, int audioTracks)
undo();
}
}
void TimelineController::temporaryUnplug(QList<int> clipIds, bool hide)
{
for (auto &cid : clipIds) {
int tid = m_model->getItemTrackId(cid);
if (tid == -1) {
continue;
}
if (hide) {
m_model->getTrackById_const(tid)->temporaryUnplugClip(cid);
} else {
m_model->getTrackById_const(tid)->temporaryReplugClip(cid);
}
}
}
......@@ -558,6 +558,8 @@ public:
void addTracks(int videoTracks, int audioTracks);
/** @brief Get in/out of currently selected items */
QPoint selectionInOut() const;
/** @brief Temporarily un/plug a list of clips in timeline. */
void temporaryUnplug(QList<int> clipIds, bool hide);
public slots:
void resetView();
......
......@@ -111,3 +111,6 @@ void TransitionTreeModel::deleteEffect(const QModelIndex &)
{
}
void TransitionTreeModel::editCustomAsset(const QString newName, const QString newDescription, const QModelIndex &index)
{
}
......@@ -40,7 +40,7 @@ public:
void reloadAssetMenu(QMenu *effectsMenu, KActionCategory *effectActions) override;
void setFavorite(const QModelIndex &index, bool favorite, bool isEffect) override;
void deleteEffect(const QModelIndex &index) override;
void editCustomAsset(const QString newName, const QString newDescription, const QModelIndex &index) override;
protected:
};
......
......@@ -107,3 +107,8 @@ void TransitionListWidget::downloadNewLumas()
void TransitionListWidget::reloadCustomEffectIx(const QModelIndex &path)
{
}
void TransitionListWidget::editCustomAsset(const QModelIndex &index)
{
}
......@@ -44,7 +44,7 @@ public:
void updateFavorite(const QModelIndex &index);
void downloadNewLumas();
void reloadCustomEffectIx(const QModelIndex &path) override;
void editCustomAsset(const QModelIndex &index) override;
private:
TransitionListWidgetProxy *m_proxy;
int getNewStuff(const QString &configFile);
......
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